A generic file streaming class built from the I/O buffer. More...
#include <buffer.h>


Public Member Functions | |
| void | close (void) |
| Close the file, flush buffers. | |
| void | create (const char *path, fsys::access_t access=fsys::ACCESS_APPEND, unsigned permissions=0640, size_t size=512) |
| Create and open the specified file. | |
| fbuf (const char *path, fsys::access_t access, size_t size) | |
| Construct a file buffer that opens an existing file. | |
| fbuf (const char *path, fsys::access_t access, unsigned permissions, size_t size) | |
| Construct a file buffer that creates and opens a specific file. | |
| fbuf () | |
| Construct an unopened file buffer. | |
| void | open (const char *path, fsys::access_t access=fsys::ACCESS_RDWR, size_t size=512) |
| Construct a file buffer that opens an existing file. | |
| bool | seek (offset_t offset) |
| Seek specific offset in open file and reset I/O buffers. | |
| offset_t | tell (void) |
| Give the current position in the currently open file. | |
| bool | trunc (offset_t offset) |
| Truncate the currently open file to a specific position. | |
| ~fbuf () | |
| Destroy object and release all resources. | |
Protected Member Functions | |
| size_t | _pull (char *address, size_t size) |
| Method to pull buffer from physical i/o (read). | |
| size_t | _push (const char *address, size_t size) |
| Method to push buffer into physical i/o (write). | |
| fd_t | getfile (void) |
A generic file streaming class built from the I/O buffer.
This can be used in place of fopen based file operations and does not require libstdc++.
Definition at line 374 of file buffer.h.
| ucc::fbuf::fbuf | ( | const char * | path, | |
| fsys::access_t | access, | |||
| unsigned | permissions, | |||
| size_t | size | |||
| ) |
Construct a file buffer that creates and opens a specific file.
| path | of file to create. | |
| access | mode of file (rw, rdonly, etc). | |
| permissions | of the newly created file. | |
| size | of the stream buffer. |
| ucc::fbuf::fbuf | ( | const char * | path, | |
| fsys::access_t | access, | |||
| size_t | size | |||
| ) |
Construct a file buffer that opens an existing file.
| path | of existing file to open. | |
| access | mode of file (rw, rdonly, etc). | |
| size | of the stream buffer. |
| size_t ucc::fbuf::_pull | ( | char * | address, | |
| size_t | size | |||
| ) | [protected, virtual] |
Method to pull buffer from physical i/o (read).
The address is passed to this virtual since it is hidden as private.
| address | of buffer to pull data into. | |
| size | of buffer area being pulled.. |
Reimplemented from ucc::IOBuffer.
| size_t ucc::fbuf::_push | ( | const char * | address, | |
| size_t | size | |||
| ) | [protected, virtual] |
Method to push buffer into physical i/o (write).
The address is passed to this virtual since it is hidden as private.
| address | of data to push. | |
| size | of data to push. |
Reimplemented from ucc::IOBuffer.
| void ucc::fbuf::create | ( | const char * | path, | |
| fsys::access_t | access = fsys::ACCESS_APPEND, |
|||
| unsigned | permissions = 0640, |
|||
| size_t | size = 512 | |||
| ) |
Create and open the specified file.
If a file is currently open, it is closed first.
| path | of file to create. | |
| access | mode of file (rw, rdonly, etc). | |
| permissions | of the newly created file. | |
| size | of the stream buffer. |
| void ucc::fbuf::open | ( | const char * | path, | |
| fsys::access_t | access = fsys::ACCESS_RDWR, |
|||
| size_t | size = 512 | |||
| ) |
Construct a file buffer that opens an existing file.
| path | of existing file to open. | |
| access | mode of file (rw, rdonly, etc). | |
| size | of the stream buffer. |
| bool ucc::fbuf::seek | ( | offset_t | offset | ) |
Seek specific offset in open file and reset I/O buffers.
If the file is opened for both read and write, both the read and write position will be reset.
| offset | to seek. |
Reimplemented from ucc::fsys.
| offset_t ucc::fbuf::tell | ( | void | ) |
Give the current position in the currently open file.
If we are appending, this is alwayus seek::end. If we have a file opened for both read and write, this gives the read offset.
| bool ucc::fbuf::trunc | ( | offset_t | offset | ) |
Truncate the currently open file to a specific position.
All I/O buffers are reset and the file pointer is set to the end.
| offset | to truncate. |
Reimplemented from ucc::fsys.
1.6.3