summaryrefslogtreecommitdiff
path: root/source/modules/asura-utils/IO/FileData.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-utils/IO/FileData.h')
-rw-r--r--source/modules/asura-utils/IO/FileData.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/source/modules/asura-utils/IO/FileData.h b/source/modules/asura-utils/IO/FileData.h
new file mode 100644
index 0000000..f93040c
--- /dev/null
+++ b/source/modules/asura-utils/IO/FileData.h
@@ -0,0 +1,69 @@
+#ifndef _ASURA_ENGINE_FILE_DATA_H_
+#define _ASURA_ENGINE_FILE_DATA_H_
+
+#include <string>
+
+#include <asura-utils/Scripting/Portable.hpp>
+
+#include "DataBuffer.h"
+
+namespace AsuraEngine
+{
+ namespace IO
+ {
+
+ class Filesystem;
+
+ ///
+ /// filesystemֱӶȡļʱFileDataļݺϢFilesystem
+ ///
+ class FileData ASURA_FINAL
+ : public AEScripting::Portable<FileData>
+ {
+ public:
+
+ LUAX_DECL_FACTORY(FileData);
+
+ ~FileData();
+
+ ///
+ /// ļݣͨDatabufferݺʹСڲӿڶData bufferΪҲdata buffer
+ ///
+ DataBuffer* GetDataBuffer();
+
+ const std::string& GetFileName();
+ const std::string& GetExtension();
+ const std::string& GetName();
+
+ private:
+
+ friend class Filesystem;
+
+ FileData(const std::string& name);
+
+ ///
+ /// data buffer
+ ///
+ void BindData(ASURA_MOVE DataBuffer* buffer);
+
+ ///
+ /// Data bufferfiledataʱ٣luaüΪ0ʱluaGC١mDataʱһԱá
+ ///
+ ASURA_REF DataBuffer* m_Data;
+ Luax::LuaxMemberRef m_DataRef;
+
+ std::string m_FileName; ///< չļ
+ std::string m_Extension; ///< չ
+ std::string m_Name; ///< ͺ׺ļ
+
+ LUAX_DECL_METHOD(_GetDataBuffer);
+ LUAX_DECL_METHOD(_GetFileName);
+ LUAX_DECL_METHOD(_GetExtension);
+ LUAX_DECL_METHOD(_GetName);
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file