PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PGE_FileFormats_misc::TextFileInput Class Reference

Provides cross-platform text file reading interface. More...

#include <pge_file_lib_globs.h>

Public Types

enum  positions { current =0, begin, end }
 Relative positions of carriage. More...
 

Public Member Functions

 TextFileInput ()
 Constructor.
 
 TextFileInput (PGESTRING filePath, bool utf8=false)
 Constructor with pre-opening of the file. More...
 
 ~TextFileInput ()
 Destructor.
 
bool open (PGESTRING filePath, bool utf8=false)
 Opening of the file. More...
 
void close ()
 Close currently opened file.
 
PGESTRING read (long len)
 Reads requested number of characters from a file. More...
 
PGESTRING readLine ()
 Reads whole line before line feed character. More...
 
PGESTRING readAll ()
 Reads all data from a file at current position of carriage. More...
 
bool eof ()
 Is carriage position at end of file. More...
 
long long tell ()
 Returns current position of carriage relative to begin of file. More...
 
void seek (long long pos, positions relativeTo)
 Changes position of carriage to specific file position. More...
 

Static Public Member Functions

static bool exists (PGESTRING filePath)
 Checks is requested file exist. More...
 

Detailed Description

Provides cross-platform text file reading interface.

Member Enumeration Documentation

Relative positions of carriage.

Enumerator
current 

Relative to current position.

begin 

Relative to begin of file.

end 

Relative to end of file.

Constructor & Destructor Documentation

PGE_FileFormats_misc::TextFileInput::TextFileInput ( PGESTRING  filePath,
bool  utf8 = false 
)

Constructor with pre-opening of the file.

Parameters
filePathFull or relative path to the file
utf8Use UTF-8 encoding or will be used local 8-bin encoding

Member Function Documentation

bool PGE_FileFormats_misc::TextFileInput::eof ( )

Is carriage position at end of file.

Returns
true if carriage position at end of file
bool PGE_FileFormats_misc::TextFileInput::exists ( PGESTRING  filePath)
static

Checks is requested file exist.

Parameters
filePathFull or relative path to the file
Returns
true if file exists
bool PGE_FileFormats_misc::TextFileInput::open ( PGESTRING  filePath,
bool  utf8 = false 
)

Opening of the file.

Parameters
filePathFull or relative path to the file
utf8Use UTF-8 encoding or will be used local 8-bin encoding
PGESTRING PGE_FileFormats_misc::TextFileInput::read ( long  len)

Reads requested number of characters from a file.

Parameters
Maximallenght of characters to read from file
Returns
string contains requested line of characters
PGESTRING PGE_FileFormats_misc::TextFileInput::readAll ( )

Reads all data from a file at current position of carriage.

Returns
PGESTRING PGE_FileFormats_misc::TextFileInput::readLine ( )

Reads whole line before line feed character.

Returns
string contains gotten line
void PGE_FileFormats_misc::TextFileInput::seek ( long long  pos,
TextFileInput::positions  relativeTo 
)

Changes position of carriage to specific file position.

Parameters
posTarget position of carriage
relativeTodefines relativity of target position of carriage (current position, begin of file or end of file)
long long PGE_FileFormats_misc::TextFileInput::tell ( )

Returns current position of carriage relative to begin of file.

Returns
current position of carriage relative to begin of file

The documentation for this class was generated from the following files: