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/old/sfile.cpp | 74 ------------------------------------------------------- src/old/sfile.h | 29 ---------------------- 2 files changed, 103 deletions(-) delete mode 100644 src/old/sfile.cpp delete mode 100644 src/old/sfile.h (limited to 'src/old') diff --git a/src/old/sfile.cpp b/src/old/sfile.cpp deleted file mode 100644 index f1de03c..0000000 --- a/src/old/sfile.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "sfile.h" -#include "exceptions.h" - -SFile::SFile( const char *sName, const char *sFlags ) -{ - fh = fopen( sName, sFlags ); -} - -SFile::~SFile() -{ -} - -void SFile::close() -{ - if( fh ) - { - fclose( fh ); - fh = NULL; - } -} - -size_t SFile::read( char *pBuf, size_t nBytes ) -{ - if( !fh ) - throw FileException("File not open."); - - return fread( pBuf, 1, nBytes, fh ); -} - -size_t SFile::write( const char *pBuf, size_t nBytes ) -{ - if( !fh ) - throw FileException("File not open."); - - return fwrite( pBuf, 1, nBytes, fh ); -} - -long SFile::tell() -{ - if( !fh ) - throw FileException("File not open."); - - return ftell( fh ); -} - -void SFile::seek( long offset ) -{ - if( !fh ) - throw FileException("File not open."); - - fseek( fh, offset, SEEK_CUR ); -} - -void SFile::setPos( long pos ) -{ - if( !fh ) - throw FileException("File not open."); - - fseek( fh, pos, SEEK_SET ); -} - -void SFile::setPosEnd( long pos ) -{ - if( !fh ) - throw FileException("File not open."); - - fseek( fh, pos, SEEK_END ); -} - -bool SFile::isEOS() -{ - return feof( fh ); -} - diff --git a/src/old/sfile.h b/src/old/sfile.h deleted file mode 100644 index b51e5bc..0000000 --- a/src/old/sfile.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SFILE_H -#define SFILE_H - -#include - -#include "stream.h" - -class SFile : public Stream -{ -public: - SFile( const char *sName, const char *sFlags ); - virtual ~SFile(); - - virtual void close(); - virtual size_t read( char *pBuf, size_t nBytes ); - virtual size_t write( const char *pBuf, size_t nBytes ); - - virtual long tell(); - virtual void seek( long offset ); - virtual void setPos( long pos ); - virtual void setPosEnd( long pos ); - virtual bool isEOS(); - -private: - FILE *fh; - -}; - -#endif -- cgit v1.2.3