diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2022-04-20 14:04:47 -0700 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2022-04-20 14:04:47 -0700 |
commit | fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975 (patch) | |
tree | f16f7e7f54399ef9c753beb87069eed8122dbccb /src/stable/archive.cpp | |
parent | d10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3 (diff) | |
download | libbu++-fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975.tar.gz libbu++-fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975.tar.bz2 libbu++-fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975.tar.xz libbu++-fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975.zip |
Gradually moving to better archive structure.
It's dragging other new API changes along with it, including use of Blob
and Text.
Diffstat (limited to 'src/stable/archive.cpp')
-rw-r--r-- | src/stable/archive.cpp | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/src/stable/archive.cpp b/src/stable/archive.cpp index df9b1ff..829e7eb 100644 --- a/src/stable/archive.cpp +++ b/src/stable/archive.cpp | |||
@@ -17,181 +17,205 @@ Bu::Archive::~Archive() | |||
17 | 17 | ||
18 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, bool p) | 18 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, bool p) |
19 | { | 19 | { |
20 | ar.write( &p, sizeof(p) ); | 20 | ar.write( p ); |
21 | return ar; | 21 | return ar; |
22 | } | 22 | } |
23 | 23 | ||
24 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, char p) | 24 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, char p) |
25 | { | 25 | { |
26 | ar.write( &p, sizeof(p) ); | 26 | ar.write( p ); |
27 | return ar; | 27 | return ar; |
28 | } | 28 | } |
29 | 29 | ||
30 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed char p) | 30 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed char p) |
31 | { | 31 | { |
32 | ar.write( &p, sizeof(p) ); | 32 | ar.write( p ); |
33 | return ar; | 33 | return ar; |
34 | } | 34 | } |
35 | 35 | ||
36 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned char p) | 36 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned char p) |
37 | { | 37 | { |
38 | ar.write( &p, sizeof(p) ); | 38 | ar.write( p ); |
39 | return ar; | 39 | return ar; |
40 | } | 40 | } |
41 | 41 | ||
42 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed short p) | 42 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed short p) |
43 | { | 43 | { |
44 | ar.write( &p, sizeof(p) ); | 44 | ar.write( p ); |
45 | return ar; | 45 | return ar; |
46 | } | 46 | } |
47 | 47 | ||
48 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned short p) | 48 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned short p) |
49 | { | 49 | { |
50 | ar.write( &p, sizeof(p) ); | 50 | ar.write( p ); |
51 | return ar; | 51 | return ar; |
52 | } | 52 | } |
53 | 53 | ||
54 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed int p) | 54 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed int p) |
55 | { | 55 | { |
56 | ar.write( &p, sizeof(p) ); | 56 | ar.write( p ); |
57 | return ar; | 57 | return ar; |
58 | } | 58 | } |
59 | 59 | ||
60 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned int p) | 60 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned int p) |
61 | { | 61 | { |
62 | ar.write( &p, sizeof(p) ); | 62 | ar.write( p ); |
63 | return ar; | 63 | return ar; |
64 | } | 64 | } |
65 | 65 | ||
66 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed long p) | 66 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed long p) |
67 | { | 67 | { |
68 | ar.write( &p, sizeof(p) ); | 68 | ar.write( p ); |
69 | return ar; | 69 | return ar; |
70 | } | 70 | } |
71 | 71 | ||
72 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned long p) | 72 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned long p) |
73 | { | 73 | { |
74 | ar.write( &p, sizeof(p) ); | 74 | ar.write( p ); |
75 | return ar; | 75 | return ar; |
76 | } | 76 | } |
77 | 77 | ||
78 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed long long p) | 78 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, signed long long p) |
79 | { | 79 | { |
80 | ar.write( &p, sizeof(p) ); | 80 | ar.write( p ); |
81 | return ar; | 81 | return ar; |
82 | } | 82 | } |
83 | 83 | ||
84 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned long long p) | 84 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, unsigned long long p) |
85 | { | 85 | { |
86 | ar.write( &p, sizeof(p) ); | 86 | ar.write( p ); |
87 | return ar; | 87 | return ar; |
88 | } | 88 | } |
89 | 89 | ||
90 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, float p) | 90 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, float p) |
91 | { | 91 | { |
92 | ar.write( &p, sizeof(p) ); | 92 | ar.write( p ); |
93 | return ar; | 93 | return ar; |
94 | } | 94 | } |
95 | 95 | ||
96 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, double p) | 96 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, double p) |
97 | { | 97 | { |
98 | ar.write( &p, sizeof(p) ); | 98 | ar.write( p ); |
99 | return ar; | 99 | return ar; |
100 | } | 100 | } |
101 | 101 | ||
102 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, long double p) | 102 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, long double p) |
103 | { | 103 | { |
104 | ar.write( &p, sizeof(p) ); | 104 | ar.write( p ); |
105 | return ar; | ||
106 | } | ||
107 | |||
108 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, const Bu::Blob &p) | ||
109 | { | ||
110 | ar.write( p ); | ||
111 | return ar; | ||
112 | } | ||
113 | |||
114 | Bu::Archive &Bu::operator<<( Bu::Archive &ar, const Bu::Text &p) | ||
115 | { | ||
116 | ar.write( p ); | ||
105 | return ar; | 117 | return ar; |
106 | } | 118 | } |
107 | 119 | ||
108 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, bool &p) | 120 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, bool &p) |
109 | { | 121 | { |
110 | ar.read( &p, sizeof(p) ); | 122 | ar.read( p ); |
111 | return ar; | 123 | return ar; |
112 | } | 124 | } |
113 | 125 | ||
114 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, char &p) | 126 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, char &p) |
115 | { | 127 | { |
116 | ar.read( &p, sizeof(p) ); | 128 | ar.read( p ); |
117 | return ar; | 129 | return ar; |
118 | } | 130 | } |
119 | 131 | ||
120 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed char &p) | 132 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed char &p) |
121 | { | 133 | { |
122 | ar.read( &p, sizeof(p) ); | 134 | ar.read( p ); |
123 | return ar; | 135 | return ar; |
124 | } | 136 | } |
125 | 137 | ||
126 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned char &p) | 138 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned char &p) |
127 | { | 139 | { |
128 | ar.read( &p, sizeof(p) ); | 140 | ar.read( p ); |
129 | return ar; | 141 | return ar; |
130 | } | 142 | } |
131 | 143 | ||
132 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed short &p) | 144 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed short &p) |
133 | { | 145 | { |
134 | ar.read( &p, sizeof(p) ); | 146 | ar.read( p ); |
135 | return ar; | 147 | return ar; |
136 | } | 148 | } |
137 | 149 | ||
138 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned short &p) | 150 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned short &p) |
139 | { | 151 | { |
140 | ar.read( &p, sizeof(p) ); | 152 | ar.read( p ); |
141 | return ar; | 153 | return ar; |
142 | } | 154 | } |
143 | 155 | ||
144 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed int &p) | 156 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed int &p) |
145 | { | 157 | { |
146 | ar.read( &p, sizeof(p) ); | 158 | ar.read( p ); |
147 | return ar; | 159 | return ar; |
148 | } | 160 | } |
149 | 161 | ||
150 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned int &p) | 162 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned int &p) |
151 | { | 163 | { |
152 | ar.read( &p, sizeof(p) ); | 164 | ar.read( p ); |
153 | return ar; | 165 | return ar; |
154 | } | 166 | } |
155 | 167 | ||
156 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed long &p) | 168 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed long &p) |
157 | { | 169 | { |
158 | ar.read( &p, sizeof(p) ); | 170 | ar.read( p ); |
159 | return ar; | 171 | return ar; |
160 | } | 172 | } |
161 | 173 | ||
162 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned long &p) | 174 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned long &p) |
163 | { | 175 | { |
164 | ar.read( &p, sizeof(p) ); | 176 | ar.read( p ); |
165 | return ar; | 177 | return ar; |
166 | } | 178 | } |
167 | 179 | ||
168 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed long long &p) | 180 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, signed long long &p) |
169 | { | 181 | { |
170 | ar.read( &p, sizeof(p) ); | 182 | ar.read( p ); |
171 | return ar; | 183 | return ar; |
172 | } | 184 | } |
173 | 185 | ||
174 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned long long &p) | 186 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, unsigned long long &p) |
175 | { | 187 | { |
176 | ar.read( &p, sizeof(p) ); | 188 | ar.read( p ); |
177 | return ar; | 189 | return ar; |
178 | } | 190 | } |
179 | 191 | ||
180 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, float &p) | 192 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, float &p) |
181 | { | 193 | { |
182 | ar.read( &p, sizeof(p) ); | 194 | ar.read( p ); |
183 | return ar; | 195 | return ar; |
184 | } | 196 | } |
185 | 197 | ||
186 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, double &p) | 198 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, double &p) |
187 | { | 199 | { |
188 | ar.read( &p, sizeof(p) ); | 200 | ar.read( p ); |
189 | return ar; | 201 | return ar; |
190 | } | 202 | } |
191 | 203 | ||
192 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, long double &p) | 204 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, long double &p) |
193 | { | 205 | { |
194 | ar.read( &p, sizeof(p) ); | 206 | ar.read( p ); |
207 | return ar; | ||
208 | } | ||
209 | |||
210 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, Bu::Blob &p) | ||
211 | { | ||
212 | ar.read( p ); | ||
213 | return ar; | ||
214 | } | ||
215 | |||
216 | Bu::Archive &Bu::operator>>( Bu::Archive &ar, Bu::Text &p) | ||
217 | { | ||
218 | ar.read( p ); | ||
195 | return ar; | 219 | return ar; |
196 | } | 220 | } |
197 | 221 | ||