summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/filesystem
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Asura.Engine/filesystem')
-rw-r--r--Source/Asura.Engine/filesystem/data_buffer.cpp14
-rw-r--r--Source/Asura.Engine/filesystem/data_buffer.h39
-rw-r--r--Source/Asura.Engine/filesystem/decoded_data.cpp20
-rw-r--r--Source/Asura.Engine/filesystem/decoded_data.h41
-rw-r--r--Source/Asura.Engine/filesystem/reloadable.h27
-rw-r--r--Source/Asura.Engine/filesystem/resource_manager.cpp0
-rw-r--r--Source/Asura.Engine/filesystem/resource_manager.h44
7 files changed, 185 insertions, 0 deletions
diff --git a/Source/Asura.Engine/filesystem/data_buffer.cpp b/Source/Asura.Engine/filesystem/data_buffer.cpp
new file mode 100644
index 0000000..3c80aa1
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/data_buffer.cpp
@@ -0,0 +1,14 @@
+#include "data_buffer.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ DataBuffer::~DataBuffer()
+ {
+ delete[] data;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/Source/Asura.Engine/filesystem/data_buffer.h b/Source/Asura.Engine/filesystem/data_buffer.h
new file mode 100644
index 0000000..84d445c
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/data_buffer.h
@@ -0,0 +1,39 @@
+#ifndef __ASURA_ENGINE_DATABUFFER_H__
+#define __ASURA_ENGINE_DATABUFFER_H__
+
+#include <cstdlib>
+
+#include "Scripting/Luax.hpp"
+#include "Scripting/Portable.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ ///
+ /// ڴݵķװеʹData bufferװֱʹconst void*ͨresource managerȡ
+ ///
+ class DataBuffer ASURA_FINAL: public Scripting::Portable
+ {
+ public:
+
+ DataBuffer(const void* data, std::size_t size);
+
+ ~DataBuffer();
+
+ byte* data;
+ size_t size;
+
+ //----------------------------------------------------------------------------------------------------------
+
+ LUAX_DECL_FACTORY(DataBuffer);
+
+ //----------------------------------------------------------------------------------------------------------
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/filesystem/decoded_data.cpp b/Source/Asura.Engine/filesystem/decoded_data.cpp
new file mode 100644
index 0000000..125c652
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/decoded_data.cpp
@@ -0,0 +1,20 @@
+#include "DecodedData.h"
+#include "Exceptions/Exception.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ DecodedData::DecodedData(const DataBuffer* databuffer)
+ {
+ Decode(databuffer);
+ }
+
+ DecodedData::~DecodedData()
+ {
+
+ }
+
+ }
+}
diff --git a/Source/Asura.Engine/filesystem/decoded_data.h b/Source/Asura.Engine/filesystem/decoded_data.h
new file mode 100644
index 0000000..0b661b6
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/decoded_data.h
@@ -0,0 +1,41 @@
+#ifndef __ASURA_ENGINE_DATA_H__
+#define __ASURA_ENGINE_DATA_H__
+
+#include <cstdlib>
+
+#include "DataBuffer.h"
+#include "Scripting/Portable.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ ///
+ /// һ̹߳data̳дࡣͼƬݡƵݵȣһ߳нԭļڲݸʽ
+ /// ȡ
+ ///
+ ASURA_ABSTRACT class DecodedData
+ {
+ public:
+
+ ///
+ /// ڴйdataԷһ߳棬Դϵͳء
+ ///
+ DecodedData(const DataBuffer& databuffer);
+
+ virtual ~DecodedData();
+
+ protected:
+
+ ///
+ /// ڴеݡ
+ ///
+ virtual void Decode(const DataBuffer& buffer) = 0;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/filesystem/reloadable.h b/Source/Asura.Engine/filesystem/reloadable.h
new file mode 100644
index 0000000..eb35d3e
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/reloadable.h
@@ -0,0 +1,27 @@
+#ifndef __ASURA_ENGINE_RELOADABLE_H__
+#define __ASURA_ENGINE_RELOADABLE_H__
+
+#include "Scripting/Portable.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ ///
+ /// ¹ݽṹͼƬƵ֣ⲿݿֱӹڱ༭¹ڲıhandleԴ
+ ///
+ ASURA_ABSTRACT class Reloadable
+ {
+ public:
+ Reloadable();
+ virtual ~Reloadable();
+
+ // ̳ReloadableҪṩһload
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/Source/Asura.Engine/filesystem/resource_manager.cpp b/Source/Asura.Engine/filesystem/resource_manager.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/resource_manager.cpp
diff --git a/Source/Asura.Engine/filesystem/resource_manager.h b/Source/Asura.Engine/filesystem/resource_manager.h
new file mode 100644
index 0000000..e22ce91
--- /dev/null
+++ b/Source/Asura.Engine/filesystem/resource_manager.h
@@ -0,0 +1,44 @@
+#ifndef __ASURA_ENGINE_RESOURCE_MANAGER_H__
+#define __ASURA_ENGINE_RESOURCE_MANAGER_H__
+
+#include <string>
+
+#include "DataBuffer.h"
+#include "Scripting/Portable.h"
+
+namespace AsuraEngine
+{
+ namespace Filesystem
+ {
+
+ ///
+ /// Դء洢ԴָĿ¼ȡ
+ ///
+ class ResourceManager ASURA_FINAL
+ {
+ public:
+
+ ResourceManager();
+ ~ResourceManager();
+
+ ///
+ /// װظĿ¼
+ ///
+ void Mount(const std::string& root);
+
+ ///
+ /// ȡļһdata bufferעҪȷȷڴ棬ڵôʹunique_ptr
+ ///
+ DataBuffer* LoadFile(const std::string& path);
+
+ ///
+ /// data buffer
+ ///
+ void SaveFile(const std::string& path, const DataBuffer* buffer);
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file