From c884da672645231b5ec47706c886381dab1b391a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Apr 2007 05:09:12 +0000 Subject: The file stream is imported and works, as does our first test, and the new tweaks to archive. The && operator is now a template function, and as such requires no special handling. It could be worth it to check this out for other types, yet dangerous, since it would let you archive anything, even a class, without writing the proper functions for it...we shall see what happens... --- src/archive.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/archive.cpp') diff --git a/src/archive.cpp b/src/archive.cpp index 5f5145c..be06c0e 100644 --- a/src/archive.cpp +++ b/src/archive.cpp @@ -1,13 +1,36 @@ #include "archive.h" -Bu::Archive::Archive(bool bLoading): - bLoading(bLoading) +Bu::Archive::Archive( Stream &rStream, bool bLoading ) : + bLoading( bLoading ), + rStream( rStream ) { } + Bu::Archive::~Archive() { } +void Bu::Archive::write( const void *pData, int32_t nSize ) +{ + if( nSize == 0 || pData == NULL ) + return; + + rStream.write( (const char *)pData, nSize ); +} + +void Bu::Archive::read( void *pData, int32_t nSize ) +{ + if( nSize == 0 || pData == NULL ) + return; + + rStream.read( (char *)pData, nSize ); +} + +void Bu::Archive::close() +{ + rStream.close(); +} + bool Bu::Archive::isLoading() { return bLoading; -- cgit v1.2.3