diff options
Diffstat (limited to '')
-rw-r--r-- | src/archive.cpp | 133 | ||||
-rw-r--r-- | src/archive.h | 28 | ||||
-rw-r--r-- | src/unit/archive.cpp | 2 |
3 files changed, 157 insertions, 6 deletions
diff --git a/src/archive.cpp b/src/archive.cpp index d6ad18d..accdeb1 100644 --- a/src/archive.cpp +++ b/src/archive.cpp | |||
@@ -45,6 +45,129 @@ bool Bu::Archive::isLoading() | |||
45 | { | 45 | { |
46 | return bLoading; | 46 | return bLoading; |
47 | } | 47 | } |
48 | |||
49 | Bu::Archive &Bu::Archive::operator<<(bool p) | ||
50 | { | ||
51 | write( &p, sizeof(p) ); | ||
52 | return *this; | ||
53 | } | ||
54 | Bu::Archive &Bu::Archive::operator<<(char p) | ||
55 | { | ||
56 | write( &p, sizeof(p) ); | ||
57 | return *this; | ||
58 | } | ||
59 | Bu::Archive &Bu::Archive::operator<<(signed char p) | ||
60 | { | ||
61 | write( &p, sizeof(p) ); | ||
62 | return *this; | ||
63 | } | ||
64 | Bu::Archive &Bu::Archive::operator<<(unsigned char p) | ||
65 | { | ||
66 | write( &p, sizeof(p) ); | ||
67 | return *this; | ||
68 | } | ||
69 | Bu::Archive &Bu::Archive::operator<<(signed short p) | ||
70 | { | ||
71 | write( &p, sizeof(p) ); | ||
72 | return *this; | ||
73 | } | ||
74 | Bu::Archive &Bu::Archive::operator<<(unsigned short p) | ||
75 | { | ||
76 | write( &p, sizeof(p) ); | ||
77 | return *this; | ||
78 | } | ||
79 | Bu::Archive &Bu::Archive::operator<<(signed int p) | ||
80 | { | ||
81 | write( &p, sizeof(p) ); | ||
82 | return *this; | ||
83 | } | ||
84 | Bu::Archive &Bu::Archive::operator<<(unsigned int p) | ||
85 | { | ||
86 | write( &p, sizeof(p) ); | ||
87 | return *this; | ||
88 | } | ||
89 | Bu::Archive &Bu::Archive::operator<<(signed long p) | ||
90 | { | ||
91 | write( &p, sizeof(p) ); | ||
92 | return *this; | ||
93 | } | ||
94 | Bu::Archive &Bu::Archive::operator<<(unsigned long p) | ||
95 | { | ||
96 | write( &p, sizeof(p) ); | ||
97 | return *this; | ||
98 | } | ||
99 | Bu::Archive &Bu::Archive::operator<<(signed long long p) | ||
100 | { | ||
101 | write( &p, sizeof(p) ); | ||
102 | return *this; | ||
103 | } | ||
104 | Bu::Archive &Bu::Archive::operator<<(unsigned long long p) | ||
105 | { | ||
106 | write( &p, sizeof(p) ); | ||
107 | return *this; | ||
108 | } | ||
109 | |||
110 | Bu::Archive &Bu::Archive::operator>>(bool &p) | ||
111 | { | ||
112 | read( &p, sizeof(p) ); | ||
113 | return *this; | ||
114 | } | ||
115 | Bu::Archive &Bu::Archive::operator>>(char &p) | ||
116 | { | ||
117 | read( &p, sizeof(p) ); | ||
118 | return *this; | ||
119 | } | ||
120 | Bu::Archive &Bu::Archive::operator>>(signed char &p) | ||
121 | { | ||
122 | read( &p, sizeof(p) ); | ||
123 | return *this; | ||
124 | } | ||
125 | Bu::Archive &Bu::Archive::operator>>(unsigned char &p) | ||
126 | { | ||
127 | read( &p, sizeof(p) ); | ||
128 | return *this; | ||
129 | } | ||
130 | Bu::Archive &Bu::Archive::operator>>(signed short &p) | ||
131 | { | ||
132 | read( &p, sizeof(p) ); | ||
133 | return *this; | ||
134 | } | ||
135 | Bu::Archive &Bu::Archive::operator>>(unsigned short &p) | ||
136 | { | ||
137 | read( &p, sizeof(p) ); | ||
138 | return *this; | ||
139 | } | ||
140 | Bu::Archive &Bu::Archive::operator>>(signed int &p) | ||
141 | { | ||
142 | read( &p, sizeof(p) ); | ||
143 | return *this; | ||
144 | } | ||
145 | Bu::Archive &Bu::Archive::operator>>(unsigned int &p) | ||
146 | { | ||
147 | read( &p, sizeof(p) ); | ||
148 | return *this; | ||
149 | } | ||
150 | Bu::Archive &Bu::Archive::operator>>(signed long &p) | ||
151 | { | ||
152 | read( &p, sizeof(p) ); | ||
153 | return *this; | ||
154 | } | ||
155 | Bu::Archive &Bu::Archive::operator>>(unsigned long &p) | ||
156 | { | ||
157 | read( &p, sizeof(p) ); | ||
158 | return *this; | ||
159 | } | ||
160 | Bu::Archive &Bu::Archive::operator>>(signed long long &p) | ||
161 | { | ||
162 | read( &p, sizeof(p) ); | ||
163 | return *this; | ||
164 | } | ||
165 | Bu::Archive &Bu::Archive::operator>>(unsigned long long &p) | ||
166 | { | ||
167 | read( &p, sizeof(p) ); | ||
168 | return *this; | ||
169 | } | ||
170 | /* | ||
48 | Bu::Archive &Bu::Archive::operator<<(bool p) | 171 | Bu::Archive &Bu::Archive::operator<<(bool p) |
49 | { | 172 | { |
50 | write( &p, sizeof(p) ); | 173 | write( &p, sizeof(p) ); |
@@ -89,12 +212,12 @@ Bu::Archive &Bu::Archive::operator<<(uint64_t p) | |||
89 | { | 212 | { |
90 | write( &p, sizeof(p) ); | 213 | write( &p, sizeof(p) ); |
91 | return *this; | 214 | return *this; |
92 | }/* | 215 | } |
93 | Bu::Archive &Bu::Archive::operator<<(long p) | 216 | Bu::Archive &Bu::Archive::operator<<(long p) |
94 | { | 217 | { |
95 | write( &p, sizeof(p) ); | 218 | write( &p, sizeof(p) ); |
96 | return *this; | 219 | return *this; |
97 | }*/ | 220 | } |
98 | Bu::Archive &Bu::Archive::operator<<(float p) | 221 | Bu::Archive &Bu::Archive::operator<<(float p) |
99 | { | 222 | { |
100 | write( &p, sizeof(p) ); | 223 | write( &p, sizeof(p) ); |
@@ -155,12 +278,12 @@ Bu::Archive &Bu::Archive::operator>>(uint64_t &p) | |||
155 | { | 278 | { |
156 | read( &p, sizeof(p) ); | 279 | read( &p, sizeof(p) ); |
157 | return *this; | 280 | return *this; |
158 | }/* | 281 | } |
159 | Bu::Archive &Bu::Archive::operator>>(long &p) | 282 | Bu::Archive &Bu::Archive::operator>>(long &p) |
160 | { | 283 | { |
161 | read( &p, sizeof(p) ); | 284 | read( &p, sizeof(p) ); |
162 | return *this; | 285 | return *this; |
163 | }*/ | 286 | } |
164 | Bu::Archive &Bu::Archive::operator>>(float &p) | 287 | Bu::Archive &Bu::Archive::operator>>(float &p) |
165 | { | 288 | { |
166 | read( &p, sizeof(p) ); | 289 | read( &p, sizeof(p) ); |
@@ -320,7 +443,7 @@ Bu::Archive &Bu::Archive::operator&&(long double &p) | |||
320 | return *this << p; | 443 | return *this << p; |
321 | } | 444 | } |
322 | } | 445 | } |
323 | 446 | */ | |
324 | 447 | ||
325 | Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p) | 448 | Bu::Archive &Bu::operator<<(Bu::Archive &s, Bu::Archival &p) |
326 | { | 449 | { |
diff --git a/src/archive.h b/src/archive.h index 31683bb..95c8c0c 100644 --- a/src/archive.h +++ b/src/archive.h | |||
@@ -88,6 +88,33 @@ namespace Bu | |||
88 | virtual void write(const void *, int32_t); | 88 | virtual void write(const void *, int32_t); |
89 | virtual void read(void *, int32_t); | 89 | virtual void read(void *, int32_t); |
90 | 90 | ||
91 | virtual Archive &operator<<(bool p); | ||
92 | virtual Archive &operator<<(char p); | ||
93 | virtual Archive &operator<<(signed char p); | ||
94 | virtual Archive &operator<<(unsigned char p); | ||
95 | virtual Archive &operator<<(signed short p); | ||
96 | virtual Archive &operator<<(unsigned short p); | ||
97 | virtual Archive &operator<<(signed int p); | ||
98 | virtual Archive &operator<<(unsigned int p); | ||
99 | virtual Archive &operator<<(signed long p); | ||
100 | virtual Archive &operator<<(unsigned long p); | ||
101 | virtual Archive &operator<<(signed long long p); | ||
102 | virtual Archive &operator<<(unsigned long long p); | ||
103 | |||
104 | virtual Archive &operator>>(bool &p); | ||
105 | virtual Archive &operator>>(char &p); | ||
106 | virtual Archive &operator>>(signed char &p); | ||
107 | virtual Archive &operator>>(unsigned char &p); | ||
108 | virtual Archive &operator>>(signed short &p); | ||
109 | virtual Archive &operator>>(unsigned short &p); | ||
110 | virtual Archive &operator>>(signed int &p); | ||
111 | virtual Archive &operator>>(unsigned int &p); | ||
112 | virtual Archive &operator>>(signed long &p); | ||
113 | virtual Archive &operator>>(unsigned long &p); | ||
114 | virtual Archive &operator>>(signed long long &p); | ||
115 | virtual Archive &operator>>(unsigned long long &p); | ||
116 | |||
117 | /* | ||
91 | virtual Archive &operator<<(bool); | 118 | virtual Archive &operator<<(bool); |
92 | virtual Archive &operator<<(int8_t); | 119 | virtual Archive &operator<<(int8_t); |
93 | virtual Archive &operator<<(int16_t); | 120 | virtual Archive &operator<<(int16_t); |
@@ -128,6 +155,7 @@ namespace Bu | |||
128 | virtual Archive &operator&&(float &); | 155 | virtual Archive &operator&&(float &); |
129 | virtual Archive &operator&&(double &); | 156 | virtual Archive &operator&&(double &); |
130 | virtual Archive &operator&&(long double &); | 157 | virtual Archive &operator&&(long double &); |
158 | */ | ||
131 | 159 | ||
132 | /** | 160 | /** |
133 | * For storage, get an ID for the pointer to the object you're going to | 161 | * For storage, get an ID for the pointer to the object you're going to |
diff --git a/src/unit/archive.cpp b/src/unit/archive.cpp index 61e3567..531ece1 100644 --- a/src/unit/archive.cpp +++ b/src/unit/archive.cpp | |||
@@ -57,7 +57,7 @@ public: | |||
57 | uint32_t p6; | 57 | uint32_t p6; |
58 | int64_t p7; | 58 | int64_t p7; |
59 | uint64_t p8; | 59 | uint64_t p8; |
60 | signed char p9; | 60 | char p9; |
61 | unsigned char p10; | 61 | unsigned char p10; |
62 | short p11; | 62 | short p11; |
63 | unsigned short p12; | 63 | unsigned short p12; |