summaryrefslogtreecommitdiff
path: root/src/old
diff options
context:
space:
mode:
Diffstat (limited to 'src/old')
-rw-r--r--src/old/sfile.cpp74
-rw-r--r--src/old/sfile.h29
2 files changed, 0 insertions, 103 deletions
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 @@
1#include "sfile.h"
2#include "exceptions.h"
3
4SFile::SFile( const char *sName, const char *sFlags )
5{
6 fh = fopen( sName, sFlags );
7}
8
9SFile::~SFile()
10{
11}
12
13void SFile::close()
14{
15 if( fh )
16 {
17 fclose( fh );
18 fh = NULL;
19 }
20}
21
22size_t SFile::read( char *pBuf, size_t nBytes )
23{
24 if( !fh )
25 throw FileException("File not open.");
26
27 return fread( pBuf, 1, nBytes, fh );
28}
29
30size_t SFile::write( const char *pBuf, size_t nBytes )
31{
32 if( !fh )
33 throw FileException("File not open.");
34
35 return fwrite( pBuf, 1, nBytes, fh );
36}
37
38long SFile::tell()
39{
40 if( !fh )
41 throw FileException("File not open.");
42
43 return ftell( fh );
44}
45
46void SFile::seek( long offset )
47{
48 if( !fh )
49 throw FileException("File not open.");
50
51 fseek( fh, offset, SEEK_CUR );
52}
53
54void SFile::setPos( long pos )
55{
56 if( !fh )
57 throw FileException("File not open.");
58
59 fseek( fh, pos, SEEK_SET );
60}
61
62void SFile::setPosEnd( long pos )
63{
64 if( !fh )
65 throw FileException("File not open.");
66
67 fseek( fh, pos, SEEK_END );
68}
69
70bool SFile::isEOS()
71{
72 return feof( fh );
73}
74
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 @@
1#ifndef SFILE_H
2#define SFILE_H
3
4#include <stdint.h>
5
6#include "stream.h"
7
8class SFile : public Stream
9{
10public:
11 SFile( const char *sName, const char *sFlags );
12 virtual ~SFile();
13
14 virtual void close();
15 virtual size_t read( char *pBuf, size_t nBytes );
16 virtual size_t write( const char *pBuf, size_t nBytes );
17
18 virtual long tell();
19 virtual void seek( long offset );
20 virtual void setPos( long pos );
21 virtual void setPosEnd( long pos );
22 virtual bool isEOS();
23
24private:
25 FILE *fh;
26
27};
28
29#endif