The Micro C++ Library
|
A Stream is a generic abstract streaming interface to read and/or write data from and/or to. More...
#include <micxx/traits/Stream.hxx>
Inherits micxx::traits::ToString.
Inherited by micxx::File, and micxx::StreamReader.
Public Types | |
typedef unsigned long long | pos_type |
Public Member Functions | |
Stream () | |
Create a new Stream object. | |
Stream (const std::string &name) | |
Create a new Stream object with the specified name. | |
Stream (const std::wstring &name) | |
Create a new Stream object with the specified name. | |
virtual | ~Stream () |
The Stream destructor. | |
virtual void | close ()=0 |
Close this Stream instance. | |
virtual pos_type | tellg () const |
Return the current stream position. | |
virtual const std::wstring & | getName () const |
Return the stream's name. | |
virtual std::ios_base::openmode | getOpenMode () const |
The std::ios_base::openmode in which the stream has been opened. | |
virtual void | open (std::ios_base::openmode mode)=0 |
Open the stream in the specified open mode. | |
virtual void | setPosition (pos_type position) |
Set the current stream position to position. | |
virtual void | setName (const std::wstring &name) |
Set the name for this stream to name. | |
virtual std::string | toString () const |
Return a string representation. | |
Protected Attributes | |
std::ios_base::openmode | openMode |
The std::ios_base::openmode in which the stream has been opened. |
A Stream is a generic abstract streaming interface to read and/or write data from and/or to.
typedef unsigned long long micxx::traits::Stream::pos_type |
micxx::traits::Stream::Stream | ( | ) | [inline] |
micxx::traits::Stream::Stream | ( | const std::string & | name | ) | [inline] |
Create a new Stream object with the specified name.
: openMode(std::ios_base::in | std::ios_base::out), name(Strings::convert(name)), position(0) { }
micxx::traits::Stream::Stream | ( | const std::wstring & | name | ) | [inline] |
virtual micxx::traits::Stream::~Stream | ( | ) | [inline, virtual] |
The Stream destructor.
{ }
virtual void micxx::traits::Stream::close | ( | ) | [pure virtual] |
Close this Stream instance.
Implemented in micxx::File, and micxx::StreamReader.
virtual const std::wstring& micxx::traits::Stream::getName | ( | ) | const [inline, virtual] |
Return the stream's name.
{
return name;
}
virtual std::ios_base::openmode micxx::traits::Stream::getOpenMode | ( | ) | const [inline, virtual] |
The std::ios_base::openmode
in which the stream has been opened.
Defaults to ios_base::in | ios_base::out
.
{ return openMode; }
virtual void micxx::traits::Stream::open | ( | std::ios_base::openmode | mode | ) | [pure virtual] |
Open the stream in the specified open mode.
Implemented in micxx::File, and micxx::StreamReader.
virtual void micxx::traits::Stream::setName | ( | const std::wstring & | name | ) | [inline, virtual] |
virtual void micxx::traits::Stream::setPosition | ( | pos_type | position | ) | [inline, virtual] |
Set the current stream position to position.
Reimplemented in micxx::File.
{ this->position = position; }
virtual pos_type micxx::traits::Stream::tellg | ( | ) | const [inline, virtual] |
Return the current stream position.
{
return position;
}
virtual std::string micxx::traits::Stream::toString | ( | ) | const [inline, virtual] |
Return a string representation.
Reimplemented from micxx::traits::ToString.
{ __MICXXTRY__ return Strings::convert(getName()); __MICXXEND__ }
std::ios_base::openmode micxx::traits::Stream::openMode [protected] |
The std::ios_base::openmode
in which the stream has been opened.