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
const_iterator const file data iterator
Definition at line 441 of file file.h.
iterator file data iterator
Definition at line 440 of file file.h.
Constructor & Destructor Documentation
destructor
Definition at line 435 of file file.h.
Member Function Documentation
iterator to the beginning of the file
Definition at line 453 of file file.h.
get an const_iterator to the beginning of the file
Definition at line 443 of file file.h.
Get rid of any previous error.
Definition at line 473 of file file.h.
ditto for the end
Definition at line 454 of file file.h.
get an const_iterator to the end of the file
Definition at line 448 of file file.h.
char const* error |
( |
|
) |
const |
A return of 0 means no error.
Definition at line 463 of file file.h.
See if an error occurred.
Definition at line 477 of file file.h.
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 |
) |
|
Member Data Documentation
start address of the buffer holding the contents
Definition at line 422 of file file.h.
end thereof
Definition at line 423 of file file.h.
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: