
|
IFile implementation of a disk file.
More...
#include <File.h>
List of all members.
Detailed Description
IFile implementation of a disk file.
Definition at line 46 of file File.h.
Constructor & Destructor Documentation
File::File |
( |
FILE * |
fil |
) |
|
File::File |
( |
const std::string & |
path, |
|
|
const std::string & |
mode | |
|
) |
| | |
File::File |
( |
const File & |
|
) |
[inline, private] |
Member Function Documentation
bool File::fopen |
( |
const std::string & |
path, |
|
|
const std::string & |
mode | |
|
) |
| | [virtual] |
Implements IFile.
Definition at line 80 of file File.cpp.
References m_fil, m_mode, and m_path.
Referenced by File().
00081 {
00082 m_path = path;
00083 m_mode = mode;
00084 #if defined( _WIN32) && !defined(__CYGWIN__)
00085 if (fopen_s(&m_fil, path.c_str(), mode.c_str()))
00086 m_fil = NULL;
00087 #else
00088 m_fil = ::fopen(path.c_str(), mode.c_str());
00089 #endif
00090
00091 return m_fil ? true : false;
00092 }
void File::fclose |
( |
|
) |
const [virtual] |
size_t File::fread |
( |
char * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb | |
|
) |
| | const [virtual] |
size_t File::fwrite |
( |
const char * |
ptr, |
|
|
size_t |
size, |
|
|
size_t |
nmemb | |
|
) |
| | [virtual] |
char * File::fgets |
( |
char * |
s, |
|
|
int |
size | |
|
) |
| | const [virtual] |
void File::fprintf |
( |
const char * |
format, |
|
|
|
... | |
|
) |
| | [virtual] |
Implements IFile.
Definition at line 146 of file File.cpp.
References m_fil, and m_wptr.
00147 {
00148 if (!m_fil)
00149 return;
00150 va_list ap;
00151 va_start(ap, format);
00152 fseek(m_fil, m_wptr, SEEK_SET);
00153 vfprintf(m_fil, format, ap);
00154 m_wptr = ftell(m_fil);
00155 va_end(ap);
00156 }
off_t File::size |
( |
|
) |
const [virtual] |
Implements IFile.
Definition at line 159 of file File.cpp.
References m_path.
00160 {
00161 struct stat st;
00162 if (stat(m_path.c_str(), &st) == -1)
00163 {
00164 return 0;
00165 }
00166 return st.st_size;
00167 }
bool File::eof |
( |
|
) |
const [virtual] |
Implements IFile.
Definition at line 170 of file File.cpp.
References m_fil.
00171 {
00172 if (m_fil)
00173 {
00174 if (feof(m_fil))
00175 return true;
00176 }
00177 return false;
00178 }
void File::reset_read |
( |
|
) |
const [virtual] |
void File::reset_write |
( |
|
) |
[virtual] |
const std::string & File::Path |
( |
|
) |
const [virtual] |
File& File::operator= |
( |
const File & |
|
) |
[inline, private] |
Member Data Documentation
The documentation for this class was generated from the following files:
|