aboutsummaryrefslogtreecommitdiff
path: root/src/archive.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-12 20:40:20 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-12 20:40:20 +0000
commit6acfc972c2d5734e62c45b4803ef18101fc1dcb2 (patch)
treefd77ca5eced12a3fe09ed6fe32e5df09682f4326 /src/archive.h
parent1300301a52bba102fed8b08bdcb668d246973af5 (diff)
downloadlibbu++-6acfc972c2d5734e62c45b4803ef18101fc1dcb2.tar.gz
libbu++-6acfc972c2d5734e62c45b4803ef18101fc1dcb2.tar.bz2
libbu++-6acfc972c2d5734e62c45b4803ef18101fc1dcb2.tar.xz
libbu++-6acfc972c2d5734e62c45b4803ef18101fc1dcb2.zip
The Bu::Archive class now supports arbitrary, named properties via variants.
Diffstat (limited to '')
-rw-r--r--src/archive.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/archive.h b/src/archive.h
index 7b74999..bd85113 100644
--- a/src/archive.h
+++ b/src/archive.h
@@ -12,6 +12,7 @@
12#include "bu/archivebase.h" 12#include "bu/archivebase.h"
13#include "bu/hash.h" 13#include "bu/hash.h"
14#include "bu/util.h" 14#include "bu/util.h"
15#include "bu/variant.h"
15 16
16namespace Bu 17namespace Bu
17{ 18{
@@ -109,11 +110,28 @@ namespace Bu
109 */ 110 */
110 void readID( const void *ptr, uint32_t id ); 111 void readID( const void *ptr, uint32_t id );
111 112
113 template<typename t>
114 void setProp( const Bu::FString &sId, const t &val )
115 {
116 if( !hProps.has( sId ) )
117 {
118 hProps.insert( sId, Variant() );
119 }
120 hProps.get( sId ) = val;
121 }
122
123 template<typename t>
124 t getProp( const Bu::FString &sId )
125 {
126 return hProps.get( sId );
127 }
128
112 private: 129 private:
113 Stream &rStream; 130 Stream &rStream;
114 uint32_t nNextID; 131 uint32_t nNextID;
115 Hash<uint32_t,uint32_t> hPtrID; 132 Hash<uint32_t,uint32_t> hPtrID;
116 Hash<uint32_t,List<void **> > hPtrDest; 133 Hash<uint32_t,List<void **> > hPtrDest;
134 Hash<Bu::FString, Variant> hProps;
117 }; 135 };
118} 136}
119 137