aboutsummaryrefslogtreecommitdiff
path: root/src/archive.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 05:09:12 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 05:09:12 +0000
commitc884da672645231b5ec47706c886381dab1b391a (patch)
treef9c0a0c4fb9006c2c1aa10c8c65de2f6e42894de /src/archive.cpp
parentda89e6d30e57bd6dbb10b4d36b093ce9bbf5c666 (diff)
downloadlibbu++-c884da672645231b5ec47706c886381dab1b391a.tar.gz
libbu++-c884da672645231b5ec47706c886381dab1b391a.tar.bz2
libbu++-c884da672645231b5ec47706c886381dab1b391a.tar.xz
libbu++-c884da672645231b5ec47706c886381dab1b391a.zip
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...
Diffstat (limited to 'src/archive.cpp')
-rw-r--r--src/archive.cpp27
1 files changed, 25 insertions, 2 deletions
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 @@
1#include "archive.h" 1#include "archive.h"
2 2
3Bu::Archive::Archive(bool bLoading): 3Bu::Archive::Archive( Stream &rStream, bool bLoading ) :
4 bLoading(bLoading) 4 bLoading( bLoading ),
5 rStream( rStream )
5{ 6{
6} 7}
8
7Bu::Archive::~Archive() 9Bu::Archive::~Archive()
8{ 10{
9} 11}
10 12
13void Bu::Archive::write( const void *pData, int32_t nSize )
14{
15 if( nSize == 0 || pData == NULL )
16 return;
17
18 rStream.write( (const char *)pData, nSize );
19}
20
21void Bu::Archive::read( void *pData, int32_t nSize )
22{
23 if( nSize == 0 || pData == NULL )
24 return;
25
26 rStream.read( (char *)pData, nSize );
27}
28
29void Bu::Archive::close()
30{
31 rStream.close();
32}
33
11bool Bu::Archive::isLoading() 34bool Bu::Archive::isLoading()
12{ 35{
13 return bLoading; 36 return bLoading;