diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 05:09:12 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 05:09:12 +0000 |
commit | c884da672645231b5ec47706c886381dab1b391a (patch) | |
tree | f9c0a0c4fb9006c2c1aa10c8c65de2f6e42894de /src/archive.cpp | |
parent | da89e6d30e57bd6dbb10b4d36b093ce9bbf5c666 (diff) | |
download | libbu++-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.cpp | 27 |
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 | ||
3 | Bu::Archive::Archive(bool bLoading): | 3 | Bu::Archive::Archive( Stream &rStream, bool bLoading ) : |
4 | bLoading(bLoading) | 4 | bLoading( bLoading ), |
5 | rStream( rStream ) | ||
5 | { | 6 | { |
6 | } | 7 | } |
8 | |||
7 | Bu::Archive::~Archive() | 9 | Bu::Archive::~Archive() |
8 | { | 10 | { |
9 | } | 11 | } |
10 | 12 | ||
13 | void 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 | |||
21 | void 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 | |||
29 | void Bu::Archive::close() | ||
30 | { | ||
31 | rStream.close(); | ||
32 | } | ||
33 | |||
11 | bool Bu::Archive::isLoading() | 34 | bool Bu::Archive::isLoading() |
12 | { | 35 | { |
13 | return bLoading; | 36 | return bLoading; |