summaryrefslogtreecommitdiff
path: root/src/serializer.h
blob: 274d8deb161f4d8eb41ec12825dc1d911937dded (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
70
71
72
73
#ifndef SERIALIZABLE_H
#define SERIALIZABLE_H

#include <stdint.h>
#include <string>
#include <list>
//#include "serializable.h"

class Serializer
{
private:
	bool bLoading;
public:
	bool isLoading();
	
	Serializer(bool bLoading);
	virtual ~Serializer();
	virtual void close()=0;

	virtual void write(const void *, int32_t)=0;
	virtual void read(void *, int32_t)=0;
	
	virtual Serializer &operator<<(bool)=0;
	virtual Serializer &operator<<(int8_t)=0;
	virtual Serializer &operator<<(int16_t)=0;
	virtual Serializer &operator<<(int32_t)=0;
	virtual Serializer &operator<<(int64_t)=0;
	virtual Serializer &operator<<(uint8_t)=0;
	virtual Serializer &operator<<(uint16_t)=0;
	virtual Serializer &operator<<(uint32_t)=0;
	virtual Serializer &operator<<(uint64_t)=0;
	virtual Serializer &operator<<(float)=0;
	virtual Serializer &operator<<(double)=0;
	virtual Serializer &operator<<(long double)=0;

	virtual Serializer &operator>>(bool &)=0;
	virtual Serializer &operator>>(int8_t &)=0;
	virtual Serializer &operator>>(int16_t &)=0;
	virtual Serializer &operator>>(int32_t &)=0;
	virtual Serializer &operator>>(int64_t &)=0;
	virtual Serializer &operator>>(uint8_t &)=0;
	virtual Serializer &operator>>(uint16_t &)=0;
	virtual Serializer &operator>>(uint32_t &)=0;
	virtual Serializer &operator>>(uint64_t &)=0;
	virtual Serializer &operator>>(float &)=0;
	virtual Serializer &operator>>(double &)=0;
	virtual Serializer &operator>>(long double &)=0;
	
	/*
	virtual Serializer &operator&(bool &);
	virtual Serializer &operator&(int8_t &);
	virtual Serializer &operator&(int16_t &);
	virtual Serializer &operator&(int32_t &);
	virtual Serializer &operator&(int64_t &);
	virtual Serializer &operator&(uint8_t &);
	virtual Serializer &operator&(uint16_t &);
	virtual Serializer &operator&(uint32_t &);
	virtual Serializer &operator&(uint64_t &);
	virtual Serializer &operator&(float &);
	virtual Serializer &operator&(double &);
	virtual Serializer &operator&(long double &);
	*/

	//virtual Serializer &operator&(Serializable &);
};

Serializer &operator<<(Serializer &, class Serializable &);
Serializer &operator>>(Serializer &, class Serializable &);

Serializer &operator<<(Serializer &, std::string &);
Serializer &operator>>(Serializer &, std::string &);

#endif