16 #define CARCHIVE_BUFFER_MAX 4096 49 CArchive& operator<<(
unsigned short int us);
51 CArchive& operator<<(
unsigned int ui);
53 CArchive& operator<<(
unsigned long int ul);
54 CArchive& operator<<(
long long int ll);
55 CArchive& operator<<(
unsigned long long int ull);
58 CArchive& operator<<(
const std::string &str);
59 CArchive& operator<<(
const std::wstring& wstr);
63 CArchive& operator<<(const std::vector<std::string>& strArray);
64 CArchive& operator<<(const std::vector<int>& iArray);
67 inline CArchive& operator>>(
float& f)
69 return streamin(&f,
sizeof(f));
72 inline CArchive& operator>>(
double& d)
74 return streamin(&d,
sizeof(d));
77 inline CArchive& operator>>(
short int& s)
79 return streamin(&s,
sizeof(s));
82 inline CArchive& operator>>(
unsigned short int& us)
84 return streamin(&us,
sizeof(us));
89 return streamin(&i,
sizeof(i));
92 inline CArchive& operator>>(
unsigned int& ui)
94 return streamin(&ui,
sizeof(ui));
97 inline CArchive& operator>>(
long int& l)
99 return streamin(&l,
sizeof(l));
102 inline CArchive& operator>>(
unsigned long int& ul)
104 return streamin(&ul,
sizeof(ul));
107 inline CArchive& operator>>(
long long int& ll)
109 return streamin(&ll,
sizeof(ll));
112 inline CArchive& operator>>(
unsigned long long int& ull)
114 return streamin(&ull,
sizeof(ull));
117 inline CArchive& operator>>(
bool& b)
119 return streamin(&b,
sizeof(b));
122 inline CArchive& operator>>(
char& c)
124 return streamin(&c,
sizeof(c));
127 CArchive& operator>>(std::string &str);
128 CArchive& operator>>(std::wstring& wstr);
132 CArchive& operator>>(std::vector<std::string>& strArray);
133 CArchive& operator>>(std::vector<int>& iArray);
135 bool IsLoading()
const;
136 bool IsStoring()
const;
140 enum Mode {load = 0, store};
143 inline CArchive &streamout(
const void *dataPtr,
size_t size)
145 auto ptr =
static_cast<const uint8_t *
>(dataPtr);
148 if (m_BufferRemain > size)
150 memcpy(m_BufferPos, ptr, size);
152 m_BufferRemain -= size;
156 return streamout_bufferwrap(ptr, size);
159 inline CArchive &streamin(
void *dataPtr,
size_t size)
161 auto ptr =
static_cast<uint8_t *
>(dataPtr);
163 if (m_BufferRemain >= size)
165 memcpy(ptr, m_BufferPos, size);
167 m_BufferRemain -= size;
171 return streamin_bufferwrap(ptr, size);
176 std::unique_ptr<uint8_t[]> m_pBuffer;
177 uint8_t *m_BufferPos;
178 size_t m_BufferRemain;
182 CArchive &streamout_bufferwrap(
const uint8_t *ptr,
size_t size);
184 CArchive &streamin_bufferwrap(uint8_t *ptr,
size_t size);
Definition: XTimeUtils.h:30
Definition: XTimeUtils.cpp:27
Definition: SimpleFS.h:27
Definition: IArchivable.h:13