aboutsummaryrefslogtreecommitdiff
path: root/src/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/file.cpp (renamed from src/sfile.cpp)28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/sfile.cpp b/src/file.cpp
index 529d8cd..5de5f6c 100644
--- a/src/sfile.cpp
+++ b/src/file.cpp
@@ -1,8 +1,8 @@
1#include "sfile.h" 1#include "file.h"
2#include "exceptions.h" 2#include "exceptions.h"
3#include <errno.h> 3#include <errno.h>
4 4
5Bu::SFile::SFile( const char *sName, const char *sFlags ) 5Bu::File::File( const char *sName, const char *sFlags )
6{ 6{
7 fh = fopen( sName, sFlags ); 7 fh = fopen( sName, sFlags );
8 if( fh == NULL ) 8 if( fh == NULL )
@@ -11,12 +11,12 @@ Bu::SFile::SFile( const char *sName, const char *sFlags )
11 } 11 }
12} 12}
13 13
14Bu::SFile::~SFile() 14Bu::File::~File()
15{ 15{
16 close(); 16 close();
17} 17}
18 18
19void Bu::SFile::close() 19void Bu::File::close()
20{ 20{
21 if( fh ) 21 if( fh )
22 { 22 {
@@ -25,7 +25,7 @@ void Bu::SFile::close()
25 } 25 }
26} 26}
27 27
28size_t Bu::SFile::read( void *pBuf, size_t nBytes ) 28size_t Bu::File::read( void *pBuf, size_t nBytes )
29{ 29{
30 if( !fh ) 30 if( !fh )
31 throw FileException("File not open."); 31 throw FileException("File not open.");
@@ -38,7 +38,7 @@ size_t Bu::SFile::read( void *pBuf, size_t nBytes )
38 return nAmnt; 38 return nAmnt;
39} 39}
40 40
41size_t Bu::SFile::write( const void *pBuf, size_t nBytes ) 41size_t Bu::File::write( const void *pBuf, size_t nBytes )
42{ 42{
43 if( !fh ) 43 if( !fh )
44 throw FileException("File not open."); 44 throw FileException("File not open.");
@@ -46,7 +46,7 @@ size_t Bu::SFile::write( const void *pBuf, size_t nBytes )
46 return fwrite( pBuf, 1, nBytes, fh ); 46 return fwrite( pBuf, 1, nBytes, fh );
47} 47}
48 48
49long Bu::SFile::tell() 49long Bu::File::tell()
50{ 50{
51 if( !fh ) 51 if( !fh )
52 throw FileException("File not open."); 52 throw FileException("File not open.");
@@ -54,7 +54,7 @@ long Bu::SFile::tell()
54 return ftell( fh ); 54 return ftell( fh );
55} 55}
56 56
57void Bu::SFile::seek( long offset ) 57void Bu::File::seek( long offset )
58{ 58{
59 if( !fh ) 59 if( !fh )
60 throw FileException("File not open."); 60 throw FileException("File not open.");
@@ -62,7 +62,7 @@ void Bu::SFile::seek( long offset )
62 fseek( fh, offset, SEEK_CUR ); 62 fseek( fh, offset, SEEK_CUR );
63} 63}
64 64
65void Bu::SFile::setPos( long pos ) 65void Bu::File::setPos( long pos )
66{ 66{
67 if( !fh ) 67 if( !fh )
68 throw FileException("File not open."); 68 throw FileException("File not open.");
@@ -70,7 +70,7 @@ void Bu::SFile::setPos( long pos )
70 fseek( fh, pos, SEEK_SET ); 70 fseek( fh, pos, SEEK_SET );
71} 71}
72 72
73void Bu::SFile::setPosEnd( long pos ) 73void Bu::File::setPosEnd( long pos )
74{ 74{
75 if( !fh ) 75 if( !fh )
76 throw FileException("File not open."); 76 throw FileException("File not open.");
@@ -78,22 +78,22 @@ void Bu::SFile::setPosEnd( long pos )
78 fseek( fh, pos, SEEK_END ); 78 fseek( fh, pos, SEEK_END );
79} 79}
80 80
81bool Bu::SFile::isEOS() 81bool Bu::File::isEOS()
82{ 82{
83 return feof( fh ); 83 return feof( fh );
84} 84}
85 85
86bool Bu::SFile::canRead() 86bool Bu::File::canRead()
87{ 87{
88 return true; 88 return true;
89} 89}
90 90
91bool Bu::SFile::canWrite() 91bool Bu::File::canWrite()
92{ 92{
93 return true; 93 return true;
94} 94}
95 95
96bool Bu::SFile::canSeek() 96bool Bu::File::canSeek()
97{ 97{
98 return true; 98 return true;
99} 99}