summaryrefslogtreecommitdiff
path: root/Source/modules/asura-base/FileSystem/FileData.h
blob: d0acd26d7a1fb37589e31a182be63a8f19ed81d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _ASURA_ENGINE_FILE_DATA_H_
#define _ASURA_ENGINE_FILE_DATA_H_

#include <string>

#include <asura-base/Scripting/Scripting.h>

#include "DataBuffer.h"

namespace AsuraEngine
{
	namespace FileSystem
	{

		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 FileManager;

			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