Neo  0.5.0
Developer Documentation
Neo::StdFile Class Reference

#include <StdFile.h>

+ Inheritance diagram for Neo::StdFile:

Public Member Functions

 StdFile ()
 
 StdFile (const char *path, const char *mode)
 
 ~StdFile ()
 
void open (const char *path, const char *mode)
 
int close ()
 Close a file stream, if open. More...
 
size_t read (void *dest, size_t size, size_t count)
 
size_t write (const void *str, size_t size, size_t count)
 
int print (const char *format,...)
 
int print (const char *format, va_list args)
 
int seek (long offset, int whence)
 
long tell ()
 
void rewind ()
 Sets the file position indicator to the beginning of the file. More...
 
bool isOpen ()
 
void destroy (void)
 Destroy file stream. More...
 
- Public Member Functions inherited from Neo::File
virtual ~File (void)
 Destructor. More...
 

Static Public Member Functions

static StdFilegetNew (const char *path, const char *mode)
 

Constructor & Destructor Documentation

Neo::StdFile::StdFile ( )
Neo::StdFile::StdFile ( const char *  path,
const char *  mode 
)
Neo::StdFile::~StdFile ( )

Member Function Documentation

int Neo::StdFile::close ( )
virtual

Close a file stream, if open.

Implements Neo::File.

void Neo::StdFile::destroy ( void  )
virtual

Destroy file stream.

Implements Neo::File.

static StdFile* Neo::StdFile::getNew ( const char *  path,
const char *  mode 
)
static
bool Neo::StdFile::isOpen ( )
inlinevirtual

Checks if file is open.

Returns
True if file is open.

Implements Neo::File.

void Neo::StdFile::open ( const char *  path,
const char *  mode 
)
virtual

Opens a file stream with the name specified by path. This usually should not be used directly and should be opened from the MFileTools interface.

Parameters
pathPath to file
modeRead or write mode ('r' or 'w')

Implements Neo::File.

int Neo::StdFile::print ( const char *  format,
  ... 
)
virtual

Produces output according to the standard printf() style format and writes to the file. Returns the number of characters written to the file (excluding the null byte used to end output strings).

Parameters
formatFormat string
Returns
Number of characters written

Implements Neo::File.

int Neo::StdFile::print ( const char *  format,
va_list  args 
)
virtual

Produces output according to the standard printf() style format and writes to the file. Returns the number of characters written to the file (excluding the null byte used to end output strings).

Parameters
formatFormat string
argsArguments
Returns
Number of characters written

Implements Neo::File.

size_t Neo::StdFile::read ( void *  dest,
size_t  size,
size_t  count 
)
virtual

Reads count amount of elements of data, each size bytes long, from the file, storing them at the location given by dest. Returns the number of items successfully read. If an error occurs, or the end-of-file is reached, the return value is a short item count (or zero).

Parameters
destData
sizeData element size in bytes
countNumber of elements to read
Returns
Number of elements read

Implements Neo::File.

void Neo::StdFile::rewind ( )
virtual

Sets the file position indicator to the beginning of the file.

Implements Neo::File.

int Neo::StdFile::seek ( long  offset,
int  whence 
)
virtual

Sets the file position indicator. The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file respectively.

Parameters
offsetOffset position in bytes
whenceSEEK_SET, SEEK_CUR, or SEEK_END
Returns
The resulting location

Implements Neo::File.

long Neo::StdFile::tell ( )
virtual

Obtains the current value of the file position indicator for the file.

Returns
Current file position

Implements Neo::File.

size_t Neo::StdFile::write ( const void *  str,
size_t  size,
size_t  count 
)
virtual

Writes count amount of elements of data, each size bytes long, to the file, obtaining them from the location given by str. Returns the number of items successfully written.

Parameters
strData
sizeData element size in bytes
countNumber of elements to write
Returns
Number of elements written

Implements Neo::File.


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