summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-utils/io/file_data.h
blob: 106e06844503634f98b7be9b7cd19c1dac246d79 (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-lib-utils/scripting/portable.hpp>

#include "data_buffer.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 buffer������filedata����ʱ���٣���lua���ü���Ϊ0ʱ��lua����GC���١�����mDataʱ������һ����Ա���á�
			///
			ASURA_REF DataBuffer* mData;
			Luax::LuaxMemberRef   mDataRef;

			std::string mFileName;  ///< ������չ�����ļ���
			std::string mExtension; ///< �����������չ��
			std::string mName;      ///< ��������ͺ�׺���ļ���

			LUAX_DECL_METHOD(_GetFileName);
			LUAX_DECL_METHOD(_GetExtension);
			LUAX_DECL_METHOD(_GetName);
			LUAX_DECL_METHOD(_GetDataBuffer);

		};

	}
}

#endif