Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Attributes | List of all members
SysFileBuffer Class Reference

File access class with internal buffer to read file content. More...

Inheritance diagram for SysFileBuffer:
SysFile

Public Member Functions

 SysFileBuffer (const long long &bufferSize=DEFAULT_FILE_BUFFER_SIZE)
 
 SysFileBuffer (const CoreString &filename, const Mode &mode=FILE_MODE_READ, const Type &type=FILE_TYPE_BINARY, const long long &bufferSize=DEFAULT_FILE_BUFFER_SIZE)
 
virtual long long read (void *data, const long long &element_size, const long long &count) const
 Reads data from file in incoming buffer.
 
virtual bool skip (const long long &bytes)
 Move forward in current opened file from a amount of bytes.
 
virtual void set_position (const long long &position)
 Changes file position to incoming position.
 
virtual bool is_eof () const
 Returns true if position is at the end of file. Returns also true if no file is currently opened.
 
- Public Member Functions inherited from SysFile
 SysFile ()
 Constructor, do not open file.
 
 SysFile (const CoreString &filename, const Mode &mode=FILE_MODE_READ, const Type &type=FILE_TYPE_BINARY)
 Constructor which constructs and opens file.
 
virtual ~SysFile ()
 Destructor. Closes the file if needed.
 
bool open (const CoreString &filename, const Mode &mode=FILE_MODE_READ, const Type &type=FILE_TYPE_BINARY)
 Opens file.
 
void close ()
 Closes file.
 
virtual long long read (CoreString &str, const long long &count) const
 Reads data from file in incoming buffer.
 
long long write_line (const char *buffer, const long long &buffer_size)
 write text data into file.
 
long long write_line (const CoreString &str)
 write text data into file.
 
long long write (const char *buffer, const long long &count) const
 write data into file.
 
long long write (const CoreString &str) const
 write data into file.
 
long long write (void *data, const long long &element_size, const long long &count) const
 write data into file.
 
long long write_fmt (const char *fmt,...) const
 write data into file with varying params
 
const long long & get_position () const
 Returns current file position.
 
bool is_opened () const
 returns true if a file is currently opened, false otherwise.
 
const Mode & get_mode () const
 returns file opening mode
 
const Type & get_type () const
 returns file opening type
 
const CoreStringget_filename () const
 returns filename
 
const long long & get_size () const
 returns file size
 
bool flush ()
 

Static Public Attributes

static const int DEFAULT_FILE_BUFFER_SIZE = 1024 * 1024
 

Additional Inherited Members

- Public Types inherited from SysFile
enum  Type {
  FILE_TYPE_ASCII,
  FILE_TYPE_BINARY,
  FILE_TYPE_COUNT
}
 
enum  Mode {
  FILE_MODE_READ,
  FILE_MODE_WRITE,
  FILE_MODE_READWRITE,
  FILE_MODE_APPEND,
  FILE_MODE_COUNT
}
 
- Static Public Member Functions inherited from SysFile
static CoreString get_type_name (const Type &type)
 
static CoreString get_mode_name (const Mode &mode)
 
- Protected Member Functions inherited from SysFile
virtual long long read (char *buffer, const long long &count) const
 Reads data from file in incoming buffer. Adds '\0' character at the end.
 
- Protected Attributes inherited from SysFile
void * m_file
 The FILE *. Stored as void * to avoid including stdio.h in our headers.
 
long long m_position
 

Detailed Description

File access class with internal buffer to read file content.

Member Function Documentation

long long SysFileBuffer::read ( void *  data,
const long long &  element_size,
const long long &  count 
) const
virtual

Reads data from file in incoming buffer.

Parameters
[in]bufferpre-allocated buffer to read in
[in]sizeof element to read
[in]numberof elements to read
Returns
number of elements read

Reimplemented from SysFile.

bool SysFileBuffer::skip ( const long long &  bytes)
virtual

Move forward in current opened file from a amount of bytes.

Parameters
[in]bytesamount of bytes to move forward. If bytes would make the position after end of file, we position to end of file.

Reimplemented from SysFile.