diff options
author | Mike Buland <eichlan@xagasoft.com> | 2022-04-21 10:32:35 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2022-04-21 10:32:35 -0700 |
commit | 23d88aa2812c361d30abefeeb296548698409bf5 (patch) | |
tree | 1fae38f0fccdff7bf8bc8f868bb5533cbe607af9 /src/stable/archivebinary.cpp | |
parent | fd56cdd21a7c9c944ad189cf91ff24d3c2b0f975 (diff) | |
download | libbu++-23d88aa2812c361d30abefeeb296548698409bf5.tar.gz libbu++-23d88aa2812c361d30abefeeb296548698409bf5.tar.bz2 libbu++-23d88aa2812c361d30abefeeb296548698409bf5.tar.xz libbu++-23d88aa2812c361d30abefeeb296548698409bf5.zip |
More progress, mostly planning and playing.
I'm trying to find the right design usage patterns for using the archive
system with tagging and lists and dictionaries. Also, are there other
structures that I'm missing?
Diffstat (limited to '')
-rw-r--r-- | src/stable/archivebinary.cpp | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/src/stable/archivebinary.cpp b/src/stable/archivebinary.cpp index 04e80d2..f46bd28 100644 --- a/src/stable/archivebinary.cpp +++ b/src/stable/archivebinary.cpp | |||
@@ -13,8 +13,7 @@ | |||
13 | 13 | ||
14 | Bu::ArchiveBinary::ArchiveBinary( Stream &rStream, bool bLoading ) : | 14 | Bu::ArchiveBinary::ArchiveBinary( Stream &rStream, bool bLoading ) : |
15 | bLoading( bLoading ), | 15 | bLoading( bLoading ), |
16 | rStream( rStream ), | 16 | rStream( rStream ) |
17 | nNextID( 1 ) | ||
18 | { | 17 | { |
19 | } | 18 | } |
20 | 19 | ||
@@ -236,44 +235,6 @@ bool Bu::ArchiveBinary::isLoading() | |||
236 | return bLoading; | 235 | return bLoading; |
237 | } | 236 | } |
238 | 237 | ||
239 | uint32_t Bu::ArchiveBinary::getID( const void *ptr ) | ||
240 | { | ||
241 | if( hPtrID.has( (ptrdiff_t)ptr ) ) | ||
242 | return hPtrID.get( (ptrdiff_t)ptr ); | ||
243 | hPtrID.insert( (ptrdiff_t)ptr, nNextID ); | ||
244 | return nNextID++; | ||
245 | } | ||
246 | |||
247 | void Bu::ArchiveBinary::assocPtrID( void **ptr, uint32_t id ) | ||
248 | { | ||
249 | if( hPtrID.has( id ) ) | ||
250 | { | ||
251 | *ptr = (void *)hPtrID.get( id ); | ||
252 | return; | ||
253 | } | ||
254 | |||
255 | if( !hPtrDest.has( id ) ) | ||
256 | hPtrDest.insert( id, List<void **>() ); | ||
257 | |||
258 | hPtrDest[id].getValue().append( ptr ); | ||
259 | } | ||
260 | |||
261 | void Bu::ArchiveBinary::readID( const void *ptr, uint32_t id ) | ||
262 | { | ||
263 | hPtrID.insert( id, (ptrdiff_t)ptr ); | ||
264 | |||
265 | if( hPtrDest.has( id ) ) | ||
266 | { | ||
267 | Bu::List<void **> &l = hPtrDest.get( id ); | ||
268 | for( Bu::List<void **>::iterator i = l.begin(); i != l.end(); i++ ) | ||
269 | { | ||
270 | *(*i) = (void *)ptr; | ||
271 | } | ||
272 | |||
273 | hPtrDest.erase( id ); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | void Bu::ArchiveBinary::setProperty( const Bu::Blob &rKey, const Bu::Variant &rValue ) | 238 | void Bu::ArchiveBinary::setProperty( const Bu::Blob &rKey, const Bu::Variant &rValue ) |
278 | { | 239 | { |
279 | hProps.insert( rKey, rValue ); | 240 | hProps.insert( rKey, rValue ); |