From f4c20290509d7ed3a8fd5304577e7a4cc0b9d974 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Apr 2007 03:49:53 +0000 Subject: Ok, no code is left in src, it's all in src/old. We'll gradually move code back into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier. --- src/serializerbinary.cpp | 63 ------------------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 src/serializerbinary.cpp (limited to 'src/serializerbinary.cpp') diff --git a/src/serializerbinary.cpp b/src/serializerbinary.cpp deleted file mode 100644 index ea7ed93..0000000 --- a/src/serializerbinary.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "serializerbinary.h" -#include "serializable.h" -#include "exceptions.h" - -SerializerBinary::SerializerBinary(FILE *fhFile, bool bLoading): - Serializer(bLoading), - fhFile(fhFile), - bCloseFile(false) -{ -} - -SerializerBinary::SerializerBinary(const char *sFileName, bool bLoading): - Serializer(bLoading), - bCloseFile(true) -{ - if (bLoading) - { - fhFile = fopen(sFileName, "rb"); - if( fhFile == NULL ) - throw FileException("Unable to open file: %s", sFileName ); - } - else - { - fhFile = fopen(sFileName, "wb"); - if( fhFile == NULL ) - throw FileException("Unable to open file: %s", sFileName ); - } -} - -SerializerBinary::~SerializerBinary() -{ - close(); -} - -void SerializerBinary::close() -{ - if (fhFile != NULL && bCloseFile ) - { - fclose(fhFile); - fhFile = NULL; - } -} - -void SerializerBinary::write(const void * pData, int32_t nSize) -{ - if( nSize == 0 ) - return; - - fwrite(pData, nSize, 1, fhFile); -} - -void SerializerBinary::read(void * pData, int32_t nSize) -{ - if( nSize == 0 ) - return; - - uint32_t nRead = fread(pData, nSize, 1, fhFile); - if( nRead < 1 ) - { - throw FileException( excodeEOF, "End of file read"); - } -} - -- cgit v1.2.3