FileContents Class Reference

An in-memory representation of a file's contents. An in memory copy of the file as returned by FileName::slurp(). If the ok() method returns true then no error occurred during the reading. However if it returns false, an explanation of the error can be obtained using 'error()'. More...

#include <file.h>

List of all members.

Public Types

typedef char const * const_iterator
 const_iterator const file data iterator
typedef char * iterator
 iterator file data iterator

Public Member Functions

iterator begin ()
 iterator to the beginning of the file
const_iterator begin () const
 get an const_iterator to the beginning of the file
void clear_error ()
 Get rid of any previous error.
iterator end ()
 ditto for the end
const_iterator end () const
 get an const_iterator to the end of the file
char const * error () const
 A return of 0 means no error.
 FileContents ()
 FileContents() default constructor.
bool ok () const
 See if an error occurred.
void reserve (long bytes)
 empty the file and make room for a given size in bytes
void set_error (char const *msg)
 Force the FileContents to return an error.
long size () const
 size() how big is the file
 ~FileContents ()
 destructor

Private Attributes

char * begin_
 start address of the buffer holding the contents
char * end_
 end thereof
char const * error_
 should be NULL, char* holding the file open error

Detailed Description

An in-memory representation of a file's contents. An in memory copy of the file as returned by FileName::slurp(). If the ok() method returns true then no error occurred during the reading. However if it returns false, an explanation of the error can be obtained using 'error()'.

Definition at line 413 of file file.h.


Member Typedef Documentation

typedef char const* const_iterator

const_iterator const file data iterator

Definition at line 441 of file file.h.

typedef char* iterator

iterator file data iterator

Definition at line 440 of file file.h.


Constructor & Destructor Documentation

FileContents (  ) 

FileContents() default constructor.

Definition at line 428 of file file.h.

~FileContents (  ) 

destructor

Definition at line 435 of file file.h.


Member Function Documentation

iterator begin (  ) 

iterator to the beginning of the file

Definition at line 453 of file file.h.

const_iterator begin (  )  const

get an const_iterator to the beginning of the file

Definition at line 443 of file file.h.

Here is the caller graph for this function:

void clear_error (  ) 

Get rid of any previous error.

Definition at line 473 of file file.h.

iterator end (  ) 

ditto for the end

Definition at line 454 of file file.h.

const_iterator end (  )  const

get an const_iterator to the end of the file

Definition at line 448 of file file.h.

Here is the caller graph for this function:

char const* error (  )  const

A return of 0 means no error.

Definition at line 463 of file file.h.

Here is the caller graph for this function:

bool ok (  )  const

See if an error occurred.

Definition at line 477 of file file.h.

Here is the caller graph for this function:

void reserve ( long  bytes  ) 

empty the file and make room for a given size in bytes

Definition at line 456 of file file.h.

void set_error ( char const *  msg  ) 

Force the FileContents to return an error.

Definition at line 468 of file file.h.

long size (  )  const

size() how big is the file

Definition at line 461 of file file.h.


Member Data Documentation

char* begin_ [private]

start address of the buffer holding the contents

Definition at line 422 of file file.h.

char* end_ [private]

end thereof

Definition at line 423 of file file.h.

char const* error_ [private]

should be NULL, char* holding the file open error

Definition at line 424 of file file.h.


The documentation for this class was generated from the following file:
Generated on Wed Feb 29 22:54:39 2012 for CXXUtilities by  doxygen 1.6.3