From 6acfc972c2d5734e62c45b4803ef18101fc1dcb2 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 12 May 2010 20:40:20 +0000 Subject: The Bu::Archive class now supports arbitrary, named properties via variants. --- src/archive.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/archive.h') 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 @@ #include "bu/archivebase.h" #include "bu/hash.h" #include "bu/util.h" +#include "bu/variant.h" namespace Bu { @@ -109,11 +110,28 @@ namespace Bu */ void readID( const void *ptr, uint32_t id ); + template + void setProp( const Bu::FString &sId, const t &val ) + { + if( !hProps.has( sId ) ) + { + hProps.insert( sId, Variant() ); + } + hProps.get( sId ) = val; + } + + template + t getProp( const Bu::FString &sId ) + { + return hProps.get( sId ); + } + private: Stream &rStream; uint32_t nNextID; Hash hPtrID; Hash > hPtrDest; + Hash hProps; }; } -- cgit v1.2.3