Public Types | Public Member Functions | Private Attributes

File Class Reference

Represent a File object. More...

#include <Filesystem.h>

List of all members.

Public Types

typedef char byte
typedef const char const_byte
typedef const_byteRawByteStream
typedef std::string::iterator iterator
typedef
std::string::reverse_iterator 
reverse_iterator
typedef std::string ByteStream

Public Member Functions

 File ()
 File (const std::string &byteStream, const std::string &fileName)
 ~File ()
ByteStreambytes ()
const ByteStreambytes () const
RawByteStream raw_bytes () const
Uint size () const
bool empty () const
iterator begin ()
iterator end ()
reverse_iterator rbegin ()
reverse_iterator rend ()
iterator seek (Uint pos)
reverse_iterator rseek (Uint pos)
byteoperator[] (Uint pos)
const_byteoperator[] (Uint pos) const
void clear ()
std::string filename () const

Private Attributes

ByteStream mByteStream
std::string mFileName

Detailed Description

Represent a File object.

The File object represents a file as a stream of bytes.


Member Typedef Documentation

typedef char File::byte
typedef std::string File::ByteStream
typedef const char File::const_byte
typedef std::string::iterator File::iterator
typedef std::string::reverse_iterator File::reverse_iterator

Constructor & Destructor Documentation

File::File (  )  [inline]

Default Constructor

File::File ( const std::string &  byteStream,
const std::string &  fileName 
) [inline]

Constructor

Parameters:
byteStream A stream of bytes stored in a std::string object.
fileName The full name of the file including path.
File::~File (  )  [inline]

Member Function Documentation

iterator File::begin (  )  [inline]
const ByteStream& File::bytes (  )  const [inline]

Gets a reference to the internal ByteStream.

Note:
This gets a const reference to the internal ByteStream.
ByteStream& File::bytes (  )  [inline]

Gets a reference to the internal ByteStream.

Note:
This gets a non- const reference to the internal ByteStream so that modifications can be made as necessary.
void File::clear (  )  [inline]

Clears the File and leaves it completely empty.

bool File::empty (  )  const [inline]
iterator File::end (  )  [inline]
std::string File::filename (  )  const [inline]

Gets the file name.

Note:
Filenames include both the individual file's name and full directory path.
byte& File::operator[] ( Uint  pos  )  [inline]
const_byte& File::operator[] ( Uint  pos  )  const [inline]
RawByteStream File::raw_bytes (  )  const [inline]

Gets a raw pointer to a const byte stream.

Note:
This function is provided as a convenience for use with low-level and legacy C libraries that need a const char* byte stream.
reverse_iterator File::rbegin (  )  [inline]
reverse_iterator File::rend (  )  [inline]
reverse_iterator File::rseek ( Uint  pos  )  [inline]
iterator File::seek ( Uint  pos  )  [inline]
Uint File::size (  )  const [inline]

Gets the size, in bytes, of the file.


Member Data Documentation

Internal stream of bytes.

std::string File::mFileName [private]

Internal filename including directory path.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines