summaryrefslogtreecommitdiffhomepage
path: root/StorageKit/StorageCore.inl
blob: f089188090ab4c873319e3ba4245ec0b1ffbe404 (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
/*
 *	========================================================
 *
 *	hCore
 * 	Copyright Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */
 
#ifndef __STORAGEKIT_STORAGECORE_INL__
#define __STORAGEKIT_STORAGECORE_INL__

#include <NewKit/Defines.hpp>

// @brief Storage management unit.
// swap files, files, dirs optimization.

namespace hCore
{
	typedef Char* SKStr;
	
	//! @brief Storage context, reads and write file according to the descriptor layout.
	class StorageContext
	{
	public:
		explicit StorageContext() = default;
		~StorageContext() = default;
		
		StorageContext& operator=(const StorageContext&) = default;
		StorageContext(const StorageContext&) = default;
		
	public:
		bool Write(VoidPtr fileDescriptor, SizeT sizeFileDescriptor);
		
		struct SDescriptor
		{
			VoidPtr fFilePtr;
			SizeT fFilePtrSz;
		};
		
		SDescriptor Read(const SKStr name);
		
	};
	
#define kMaxPathSK 4096
	
	struct StorageLayout final
	{
		Char fName[kMaxPathSK];
		VoidPtr fData;	
		SizeT fDataSz;
		Int32 fType;
	};
}

#endif /* ifndef __STORAGEKIT_STORAGECORE_INL__ */