diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-11 05:29:41 +0000 |
commit | f4b191f0ea396b58465bfba40749977780a3af58 (patch) | |
tree | 891490e91ab3b67524be67b2b71c85d84fd2f92a /src/old/serializerbinary.cpp | |
parent | 292ae9453e7fdb2f1023ed9dfc99cbcd751f8b90 (diff) | |
download | libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.gz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.bz2 libbu++-f4b191f0ea396b58465bfba40749977780a3af58.tar.xz libbu++-f4b191f0ea396b58465bfba40749977780a3af58.zip |
Just removing some things that are cluttering up the source tree.
Diffstat (limited to 'src/old/serializerbinary.cpp')
-rw-r--r-- | src/old/serializerbinary.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/old/serializerbinary.cpp b/src/old/serializerbinary.cpp deleted file mode 100644 index ea7ed93..0000000 --- a/src/old/serializerbinary.cpp +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #include "serializerbinary.h" | ||
2 | #include "serializable.h" | ||
3 | #include "exceptions.h" | ||
4 | |||
5 | SerializerBinary::SerializerBinary(FILE *fhFile, bool bLoading): | ||
6 | Serializer(bLoading), | ||
7 | fhFile(fhFile), | ||
8 | bCloseFile(false) | ||
9 | { | ||
10 | } | ||
11 | |||
12 | SerializerBinary::SerializerBinary(const char *sFileName, bool bLoading): | ||
13 | Serializer(bLoading), | ||
14 | bCloseFile(true) | ||
15 | { | ||
16 | if (bLoading) | ||
17 | { | ||
18 | fhFile = fopen(sFileName, "rb"); | ||
19 | if( fhFile == NULL ) | ||
20 | throw FileException("Unable to open file: %s", sFileName ); | ||
21 | } | ||
22 | else | ||
23 | { | ||
24 | fhFile = fopen(sFileName, "wb"); | ||
25 | if( fhFile == NULL ) | ||
26 | throw FileException("Unable to open file: %s", sFileName ); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | SerializerBinary::~SerializerBinary() | ||
31 | { | ||
32 | close(); | ||
33 | } | ||
34 | |||
35 | void SerializerBinary::close() | ||
36 | { | ||
37 | if (fhFile != NULL && bCloseFile ) | ||
38 | { | ||
39 | fclose(fhFile); | ||
40 | fhFile = NULL; | ||
41 | } | ||
42 | } | ||
43 | |||
44 | void SerializerBinary::write(const void * pData, int32_t nSize) | ||
45 | { | ||
46 | if( nSize == 0 ) | ||
47 | return; | ||
48 | |||
49 | fwrite(pData, nSize, 1, fhFile); | ||
50 | } | ||
51 | |||
52 | void SerializerBinary::read(void * pData, int32_t nSize) | ||
53 | { | ||
54 | if( nSize == 0 ) | ||
55 | return; | ||
56 | |||
57 | uint32_t nRead = fread(pData, nSize, 1, fhFile); | ||
58 | if( nRead < 1 ) | ||
59 | { | ||
60 | throw FileException( excodeEOF, "End of file read"); | ||
61 | } | ||
62 | } | ||
63 | |||