ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
#include <stream.h>
Public Types | |
enum | access_t { RDONLY, WRONLY, RDWR } |
Public Member Functions | |
filestream () | |
filestream (const filestream ©) | |
filestream (const char *path, unsigned mode, fsys::access_t access, size_t bufsize=512) | |
filestream (const char *path, fsys::access_t access, size_t bufsize=512) | |
virtual | ~filestream () |
operator bool () const | |
bool | operator! () const |
void | open (const char *filename, fsys::access_t access, size_t buffering=512) |
void | open (const char *filename, unsigned mode, fsys::access_t access, size_t buffering=512) |
void | close (void) |
void | seek (fsys::offset_t offset) |
void | rewind (void) |
int | err (void) const |
![]() | |
int | sync (void) |
bool | is_open (void) const |
operator bool () const | |
bool | operator! () const |
Protected Member Functions | |
int | underflow (void) __OVERRIDE |
int | overflow (int ch) __OVERRIDE |
![]() | |
StreamBuffer () | |
int | uflow () __OVERRIDE |
void | release (void) |
void | allocate (size_t size) |
Protected Attributes | |
fsys_t | fd |
fsys::access_t | ac |
![]() | |
size_t | bufsize |
char * | gbuf |
char * | pbuf |
Private Member Functions | |
__LOCAL void | allocate (size_t size, fsys::access_t mode) |
Streamable file class based on low level fsys io. This differs from the normal fstream classes as it may apply to other kinds of file streams.
ucommon::filestream::filestream | ( | ) |
Create an unopened pipe stream.
Definition at line 620 of file stream.cpp.
ucommon::filestream::filestream | ( | const filestream & | copy | ) |
Create duplicate stream.
Definition at line 625 of file stream.cpp.
References allocate(), ucommon::copy(), fd, and ucommon::is().
ucommon::filestream::filestream | ( | const char * | path, |
unsigned | mode, | ||
fsys::access_t | access, | ||
size_t | bufsize = 512 |
||
) |
ucommon::filestream::filestream | ( | const char * | path, |
fsys::access_t | access, | ||
size_t | bufsize = 512 |
||
) |
|
virtual |
|
private |
Definition at line 677 of file stream.cpp.
References ac, ucommon::fsys::APPEND, ucommon::StreamBuffer::bufsize, ucommon::clear(), ucommon::StreamBuffer::gbuf, ucommon::StreamBuffer::pbuf, ucommon::fsys::RDONLY, ucommon::fsys::RDWR, ucommon::fsys::SHARED, and ucommon::fsys::WRONLY.
Referenced by filestream(), and open().
void ucommon::filestream::close | ( | void | ) |
Close an active stream connection.
Definition at line 667 of file stream.cpp.
References ucommon::StreamBuffer::bufsize, ucommon::fsys::close(), fd, ucommon::StreamBuffer::release(), and ucommon::StreamBuffer::sync().
Referenced by open(), overflow(), underflow(), and ~filestream().
|
inline |
Get error flag from last i/o operation.
Definition at line 448 of file stream.h.
References ucommon::fsys::err().
void ucommon::filestream::open | ( | const char * | filename, |
fsys::access_t | access, | ||
size_t | buffering = 512 |
||
) |
Open a stream connection to a tcp service.
Definition at line 745 of file stream.cpp.
References allocate(), close(), fd, ucommon::is(), and ucommon::fsys::open().
Referenced by filestream().
void ucommon::filestream::open | ( | const char * | filename, |
unsigned | mode, | ||
fsys::access_t | access, | ||
size_t | buffering = 512 |
||
) |
Create a stream connection to a tcp service.
Definition at line 737 of file stream.cpp.
References allocate(), close(), fd, ucommon::is(), and ucommon::fsys::open().
|
inline |
|
inline |
|
protected |
This streambuf method is used to write the output buffer through the established pipe connection.
ch | char to push through. |
Definition at line 781 of file stream.cpp.
References ucommon::StreamBuffer::bufsize, close(), EOF, fd, ucommon::StreamBuffer::pbuf, PUT, and ucommon::fsys::write().
void ucommon::filestream::rewind | ( | void | ) |
Definition at line 659 of file stream.cpp.
References ucommon::StreamBuffer::bufsize, fd, ucommon::fsys::seek(), and ucommon::StreamBuffer::sync().
void ucommon::filestream::seek | ( | fsys::offset_t | offset | ) |
Seek position.
Definition at line 651 of file stream.cpp.
References ucommon::StreamBuffer::bufsize, fd, ucommon::fsys::seek(), and ucommon::StreamBuffer::sync().
|
protected |
This streambuf method is used to load the input buffer through the established pipe connection.
Definition at line 753 of file stream.cpp.
References ucommon::StreamBuffer::bufsize, ucommon::clear(), close(), EOF, fd, ucommon::StreamBuffer::gbuf, GET, and ucommon::fsys::read().
|
protected |
Definition at line 361 of file stream.h.
Referenced by allocate().
|
protected |
Definition at line 360 of file stream.h.
Referenced by close(), filestream(), open(), overflow(), rewind(), seek(), and underflow().