#include <File.h>
Inheritance diagram for TFile:
Public Member Functions | |
TFile (void) | |
Constructor. | |
~TFile (void) | |
Destructor. | |
TFile (const TFile &orig) | |
fake copy constructor | |
void | operator= (const TFile &orig) |
fake assignment operator | |
const TString & | GetName (void) const |
Return relative filename (relative path + filename) of opened file. | |
BOOL | IsBinary (void) const |
Determines whether file is opened as binary, if return FALSE file is opened in translated mode. | |
BOOL | IsOpened (void) const |
Determines whether file is opened. | |
BOOL | Open (const TString &name, BOOL binary) |
Open specified file. | |
BOOL | Close (void) |
Close opened file. | |
DWORD | Read (void *buffer, const DWORD &size) |
Reads data from file into buffer. | |
DWORD | Write (const void *buffer, const DWORD &size) |
Writes data to file from buffer. | |
int | GetChar (void) |
Return character from file. | |
int | PutChar (const int &character) |
Put character into file. | |
BOOL | Write (const TString &str) |
Writes string into file. | |
BOOL | Seek (const DWORD &position) |
Move pointer in file to specified location from begin of file. | |
BOOL | SeekRelative (const LONG &position) |
Move pointer into file to specified location relative to actual position. | |
BOOL | SeekToEnd (void) |
Move pointer to end of this file. | |
void | Rewind (void) |
Rewind this file to begin. | |
LONG | Tell (void) |
Returns actual position in file. | |
BOOL | Eof (void) |
Tests for end of file (for READ operations only). | |
BOOL | Erase (void) |
Erase contents of file. | |
BOOL | Flush (void) |
Flushes actually buffered data from stream to file on disk. | |
DWORD | GetSize (void) |
Return file size in bytes. | |
BOOL | FindChar (int ch) |
Find next character in file. | |
BOOL | SkipNextBlock (void) |
Find first block "{...}" and skip it. | |
BOOL | ReadUntil (int ch, TString &res) |
Read file until specified character and store it into string. | |
BOOL | ReadString (TString &text) |
Read next string - "..". | |
BOOL | ReadWord (TString &text) |
Read next word from file. | |
Static Public Member Functions | |
static BOOL | IsExists (const char *filename) |
This method determines whether specified file exists. |
File is opened for reading and writing together, but between these operations Flush() method should be called for safe storing buffered data.
File is opened after calling TFile::Open method, constructor only prepares object.
Because each mode (read,write) are defined for opened file if file not exists it will be created, thus if you need perform READ operation you should use static method IsExists which check file existence (if you don't this then empty file will be created and you read 0 bytes in you reading loop).
Definition at line 35 of file File.h.
|
Constructor. This method doesnt open file!!! Definition at line 23 of file File.cpp. References FALSE. |
|
Destructor. Automatically close opened file - if exists. Definition at line 33 of file File.cpp. References FALSE. |
|
fake copy constructor
|
|
Close opened file.
Definition at line 84 of file File.cpp. References DBGCNDTRACEF, and FALSE. Referenced by NSXLoader::TXLoader::LoadFile(), Open(), and NSXLoader::TXLoader::~TXLoader(). |
|
Tests for end of file (for READ operations only).
Definition at line 201 of file File.h. References DBGASSERT. |
|
Erase contents of file. After this operation is possible write to empty file. Definition at line 103 of file File.cpp. References DBGASSERT, FALSE, TString::GetString(), and TRUE. Here is the call graph for this function: ![]() |
|
Find next character in file. File would be in translated mode for calling this method! If returns TRUE chracter was found and file is at position after this character.
Definition at line 143 of file File.cpp. References DBGASSERT, DBGCNDTRACEF, FALSE, and TRUE. |
|
Flushes actually buffered data from stream to file on disk. This operation should be called between read and write operation. Definition at line 192 of file File.h. References DBGASSERT. |
|
Return character from file. Behavior of this method is identical to fgetc from CRT. Definition at line 211 of file File.h. References DBGASSERT. |
|
Return relative filename (relative path + filename) of opened file.
|
|
Return file size in bytes. This method automaticaly flushes data from buffer to stream. Definition at line 122 of file File.cpp. References DBGASSERT. |
|
Determines whether file is opened as binary, if return FALSE file is opened in translated mode.
|
|
This method determines whether specified file exists.
|
|
Determines whether file is opened.
Definition at line 106 of file File.h. Referenced by NSXLoader::TXLoader::LoadFile(), and NSXLoader::TXLoader::~TXLoader(). |
|
Open specified file.
Definition at line 51 of file File.cpp. References Close(), FALSE, TString::GetString(), and TString::Set(). Referenced by TCRC::ComputeFileCRC32(), NSConfigFile::TConfigFile::LoadConfigFile(), NSXLoader::TXLoader::LoadFile(), NSFileSystem::TFSCabinetTable::LoadTableFromFile(), and NSConfigFile::TConfigFile::SaveConfigFile(). Here is the call graph for this function: ![]() |
|
fake assignment operator
|
|
Put character into file. Behavior of this method is identical to fputc from CRT.
Definition at line 223 of file File.h. References DBGASSERT. Referenced by NSConfigFile::TConfigFileSection::WriteToFile(). |
|
Reads data from file into buffer.
Definition at line 118 of file File.h. References DBGASSERT. |
|
Read next string - "..". Method founds first character '"' and then reads string until next ". Final string doesnt contain begin and end character '"'. String parameter TEXT is always cleared. After returning TRUE position in file is set to first character after end of string (after '"'); Readed string musnt contains symbol '"' - escape characters arent recognized too.
Definition at line 235 of file File.cpp. References TString::Add(), TString::Clear(), DBGASSERT, FALSE, and TRUE. Here is the call graph for this function: ![]() |
|
Read file until specified character and store it into string. Terminal character is not included in result string. String RES is automatically clearer in function.
Definition at line 205 of file File.cpp. References TString::Add(), TString::Clear(), DBGASSERT, FALSE, and TRUE. Here is the call graph for this function: ![]() |
|
Read next word from file. Word is end with white space (according to isspace macro) or EOF. White spaces before word are ommited. Method search first non-white space and continue until next white space. Result is stored in parameter only if TRUE is returned. String parameter TEXT is always cleared.
Definition at line 270 of file File.cpp. References TString::Add(), TString::Clear(), DBGASSERT, FALSE, and TRUE. Here is the call graph for this function: ![]() |
|
Rewind this file to begin.
Definition at line 173 of file File.h. References DBGASSERT. |
|
Move pointer in file to specified location from begin of file. Position must be in range of file size!!!
Definition at line 144 of file File.h. References DBGASSERT. |
|
Move pointer into file to specified location relative to actual position.
Definition at line 155 of file File.h. References DBGASSERT. |
|
Move pointer to end of this file.
Definition at line 164 of file File.h. References DBGASSERT. |
|
Find first block "{...}" and skip it. File would be in translated mode for calling this method! Inner blocks are skiped too. Returns TRUE if block was successfully skipped, FALSE otherwise (probably EOF). Definition at line 163 of file File.cpp. References DBGASSERT, DBGCNDTRACEF, FALSE, and TRUE. |
|
Returns actual position in file.
Definition at line 182 of file File.h. References DBGASSERT. |
|
Writes string into file.
Definition at line 234 of file File.h. References TString::c_str(). Here is the call graph for this function: ![]() |
|
Writes data to file from buffer.
Definition at line 132 of file File.h. References DBGASSERT. Referenced by NSConfigFile::TConfigFileSection::WriteToFile(). |