summaryrefslogtreecommitdiff
path: root/src/archivebase.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/archivebase.h')
-rw-r--r--src/archivebase.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/archivebase.h b/src/archivebase.h
new file mode 100644
index 0000000..f421efb
--- /dev/null
+++ b/src/archivebase.h
@@ -0,0 +1,67 @@
1#ifndef BU_ARCHIVE_BASE_H
2#define BU_ARCHIVE_BASE_H
3
4#include <stdint.h>
5
6namespace Bu
7{
8 class ArchiveBase
9 {
10 public:
11 ArchiveBase();
12 virtual ~ArchiveBase();
13
14 virtual void close()=0;
15 virtual void write( const void *pData, int32_t iLength )=0;
16 virtual void read( void *pData, int32_t iLength )=0;
17 virtual bool isLoading()=0;
18 };
19
20 template<typename T> ArchiveBase &operator&&( ArchiveBase &ar, T &dat )
21 {
22 if( ar.isLoading() )
23 {
24 return ar >> dat;
25 }
26 else
27 {
28 return ar << dat;
29 }
30 }
31
32 ArchiveBase &operator<<( ArchiveBase &ar, bool p );
33 ArchiveBase &operator<<( ArchiveBase &ar, char p );
34 ArchiveBase &operator<<( ArchiveBase &ar, signed char p );
35 ArchiveBase &operator<<( ArchiveBase &ar, unsigned char p );
36 ArchiveBase &operator<<( ArchiveBase &ar, signed short p );
37 ArchiveBase &operator<<( ArchiveBase &ar, unsigned short p );
38 ArchiveBase &operator<<( ArchiveBase &ar, signed int p );
39 ArchiveBase &operator<<( ArchiveBase &ar, unsigned int p );
40 ArchiveBase &operator<<( ArchiveBase &ar, signed long p );
41 ArchiveBase &operator<<( ArchiveBase &ar, unsigned long p );
42 ArchiveBase &operator<<( ArchiveBase &ar, signed long long p );
43 ArchiveBase &operator<<( ArchiveBase &ar, unsigned long long p );
44 ArchiveBase &operator<<( ArchiveBase &ar, float p );
45 ArchiveBase &operator<<( ArchiveBase &ar, double p );
46 ArchiveBase &operator<<( ArchiveBase &ar, long double p );
47
48 ArchiveBase &operator>>( ArchiveBase &ar, bool &p );
49 ArchiveBase &operator>>( ArchiveBase &ar, char &p );
50 ArchiveBase &operator>>( ArchiveBase &ar, signed char &p );
51 ArchiveBase &operator>>( ArchiveBase &ar, unsigned char &p );
52 ArchiveBase &operator>>( ArchiveBase &ar, signed short &p );
53 ArchiveBase &operator>>( ArchiveBase &ar, unsigned short &p );
54 ArchiveBase &operator>>( ArchiveBase &ar, signed int &p );
55 ArchiveBase &operator>>( ArchiveBase &ar, unsigned int &p );
56 ArchiveBase &operator>>( ArchiveBase &ar, signed long &p );
57 ArchiveBase &operator>>( ArchiveBase &ar, unsigned long &p );
58 ArchiveBase &operator>>( ArchiveBase &ar, signed long long &p );
59 ArchiveBase &operator>>( ArchiveBase &ar, unsigned long long &p );
60 ArchiveBase &operator>>( ArchiveBase &ar, float &p );
61 ArchiveBase &operator>>( ArchiveBase &ar, double &p );
62 ArchiveBase &operator>>( ArchiveBase &ar, long double &p );
63
64
65};
66
67#endif