Neo  0.5.0
Developer Documentation
Neo::File Class Referenceabstract

#include <File.h>

+ Inheritance diagram for Neo::File:

Public Member Functions

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

Detailed Description

File I/O class. This interface can be used manually, but will usually be used from the FileTools interface, to more closely match standard C file I/O.

Constructor & Destructor Documentation

virtual Neo::File::~File ( void  )
inlinevirtual

Destructor.

Member Function Documentation

virtual int Neo::File::close ( )
pure virtual

Close a file stream, if open.

Implemented in Neo::StdFile.

virtual void Neo::File::destroy ( )
pure virtual

Destroy file stream.

Implemented in Neo::StdFile.

virtual bool Neo::File::isOpen ( )
pure virtual

Checks if file is open.

Returns
True if file is open.

Implemented in Neo::StdFile.

virtual void Neo::File::open ( const char *  path,
const char *  mode 
)
pure 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')

Implemented in Neo::StdFile.

virtual int Neo::File::print ( const char *  format,
  ... 
)
pure 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

Implemented in Neo::StdFile.

virtual int Neo::File::print ( const char *  format,
va_list  args 
)
pure 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

Implemented in Neo::StdFile.

virtual size_t Neo::File::read ( void *  dest,
size_t  size,
size_t  count 
)
pure 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

Implemented in Neo::StdFile.

virtual void Neo::File::rewind ( )
pure virtual

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

Implemented in Neo::StdFile.

virtual int Neo::File::seek ( long  offset,
int  whence 
)
pure 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

Implemented in Neo::StdFile.

virtual long Neo::File::tell ( )
pure virtual

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

Returns
Current file position

Implemented in Neo::StdFile.

virtual size_t Neo::File::write ( const void *  str,
size_t  size,
size_t  count 
)
pure 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

Implemented in Neo::StdFile.


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