diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-08-16 22:43:17 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-08-16 22:43:17 +0000 |
commit | da6ebe9bd659916122ee973818c3d1f98ce2e007 (patch) | |
tree | 47320cf1e5f3fcc153378d671740236214f1abcc /src | |
parent | f1d6b50ac5a014a5cd87a605bd4f4e1e6342ef7d (diff) | |
download | libbu++-da6ebe9bd659916122ee973818c3d1f98ce2e007.tar.gz libbu++-da6ebe9bd659916122ee973818c3d1f98ce2e007.tar.bz2 libbu++-da6ebe9bd659916122ee973818c3d1f98ce2e007.tar.xz libbu++-da6ebe9bd659916122ee973818c3d1f98ce2e007.zip |
Lists now archive. Yippie!
Diffstat (limited to 'src')
-rw-r--r-- | src/archive.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/archive.h b/src/archive.h index a2d4c8f..2d652ec 100644 --- a/src/archive.h +++ b/src/archive.h | |||
@@ -207,6 +207,35 @@ namespace Bu | |||
207 | 207 | ||
208 | return ar; | 208 | return ar; |
209 | } | 209 | } |
210 | |||
211 | template<typename value> | ||
212 | Archive &operator<<( Archive &ar, List<value> &h ) | ||
213 | { | ||
214 | ar << h.getSize(); | ||
215 | for( typename List<value>::iterator i = h.begin(); i != h.end(); i++ ) | ||
216 | { | ||
217 | ar << (*i); | ||
218 | } | ||
219 | |||
220 | return ar; | ||
221 | } | ||
222 | |||
223 | template<typename value> | ||
224 | Archive &operator>>( Archive &ar, List<value> &h ) | ||
225 | { | ||
226 | h.clear(); | ||
227 | uint32_t nSize; | ||
228 | ar >> nSize; | ||
229 | |||
230 | for( uint32_t j = 0; j < nSize; j++ ) | ||
231 | { | ||
232 | value v; | ||
233 | ar >> v; | ||
234 | h.append( v ); | ||
235 | } | ||
236 | |||
237 | return ar; | ||
238 | } | ||
210 | } | 239 | } |
211 | 240 | ||
212 | #endif | 241 | #endif |