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
|
#ifndef BU_ARCHIVE_BASE_H
#define BU_ARCHIVE_BASE_H
#include <stdint.h>
namespace Bu
{
class ArchiveBase
{
public:
ArchiveBase();
virtual ~ArchiveBase();
virtual void close()=0;
virtual void write( const void *pData, int32_t iLength )=0;
virtual void read( void *pData, int32_t iLength )=0;
virtual bool isLoading()=0;
};
template<typename T> ArchiveBase &operator&&( ArchiveBase &ar, T &dat )
{
if( ar.isLoading() )
{
return ar >> dat;
}
else
{
return ar << dat;
}
}
ArchiveBase &operator<<( ArchiveBase &ar, bool p );
ArchiveBase &operator<<( ArchiveBase &ar, char p );
ArchiveBase &operator<<( ArchiveBase &ar, signed char p );
ArchiveBase &operator<<( ArchiveBase &ar, unsigned char p );
ArchiveBase &operator<<( ArchiveBase &ar, signed short p );
ArchiveBase &operator<<( ArchiveBase &ar, unsigned short p );
ArchiveBase &operator<<( ArchiveBase &ar, signed int p );
ArchiveBase &operator<<( ArchiveBase &ar, unsigned int p );
ArchiveBase &operator<<( ArchiveBase &ar, signed long p );
ArchiveBase &operator<<( ArchiveBase &ar, unsigned long p );
ArchiveBase &operator<<( ArchiveBase &ar, signed long long p );
ArchiveBase &operator<<( ArchiveBase &ar, unsigned long long p );
ArchiveBase &operator<<( ArchiveBase &ar, float p );
ArchiveBase &operator<<( ArchiveBase &ar, double p );
ArchiveBase &operator<<( ArchiveBase &ar, long double p );
ArchiveBase &operator>>( ArchiveBase &ar, bool &p );
ArchiveBase &operator>>( ArchiveBase &ar, char &p );
ArchiveBase &operator>>( ArchiveBase &ar, signed char &p );
ArchiveBase &operator>>( ArchiveBase &ar, unsigned char &p );
ArchiveBase &operator>>( ArchiveBase &ar, signed short &p );
ArchiveBase &operator>>( ArchiveBase &ar, unsigned short &p );
ArchiveBase &operator>>( ArchiveBase &ar, signed int &p );
ArchiveBase &operator>>( ArchiveBase &ar, unsigned int &p );
ArchiveBase &operator>>( ArchiveBase &ar, signed long &p );
ArchiveBase &operator>>( ArchiveBase &ar, unsigned long &p );
ArchiveBase &operator>>( ArchiveBase &ar, signed long long &p );
ArchiveBase &operator>>( ArchiveBase &ar, unsigned long long &p );
ArchiveBase &operator>>( ArchiveBase &ar, float &p );
ArchiveBase &operator>>( ArchiveBase &ar, double &p );
ArchiveBase &operator>>( ArchiveBase &ar, long double &p );
};
#endif
|