-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathserialize.h
More file actions
65 lines (50 loc) · 1.95 KB
/
serialize.h
File metadata and controls
65 lines (50 loc) · 1.95 KB
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
#ifndef SERIALIZE_H_INCLUDED
#define SERIALIZE_H_INCLUDED
#include <vector>
#include <string>
#include "stdint.h"
class CArchive
{
public:
CArchive();
~CArchive();
CArchive& operator << (uint8_t second);
CArchive& operator << (uint16_t second);
CArchive& operator << (uint32_t second);
CArchive& operator << (uint64_t second);
CArchive& operator << (int8_t second);
CArchive& operator << (int16_t second);
CArchive& operator << (int32_t second);
CArchive& operator << (int64_t second);
CArchive& operator << (const std::string& second);
CArchive& operator << (const char* second);
CArchive& operator << (bool second);
CArchive& operator >> (uint8_t& second);
CArchive& operator >> (uint16_t& second);
CArchive& operator >> (uint32_t& second);
CArchive& operator >> (uint64_t& second);
CArchive& operator >> (int8_t& second);
CArchive& operator >> (int16_t& second);
CArchive& operator >> (int32_t& second);
CArchive& operator >> (int64_t& second);
CArchive& operator >> (std::string& second);
CArchive& operator >> (char*& second);
CArchive& operator >> (bool& second);
operator bool ();
void AppendData(uint8_t* buf, uint32_t count);
void GetData(uint8_t* buf, uint32_t count);
void GetAllData(uint8_t*& buf, uint32_t& count);
void SetAllData(uint8_t* buf, uint32_t count);
void SaveToFile(std::string filename);
void LoadFromFile(std::string filename);
void SaveToStream(std::ostream& stream);
void LoadFromStream(std::istream& stream);
void Reset();
void ResetPosition();
protected:
uint32_t myPosRead;
uint32_t myPosWrite;
bool myFail;
std::vector<uint8_t> myData;
};
#endif // SERIALIZE_H_INCLUDED