|
The Micro C++ Library
|
A File is a special Stream associated to a filename. More...
#include <micxx.hxx>
Inherits micxx::traits::NonCopyable, micxx::traits::Stream, micxx::traits::Reader< unsigned char, std::size_t >, and micxx::traits::Writer< unsigned char, std::size_t >.
Public Types | |
| typedef unsigned char | char_type |
| typedef std::size_t | off_type |
Public Member Functions | |
| File (const std::string &filename="") | |
| Create a new File with the specified assigned filename. | |
| File (const std::wstring &filename) | |
| Create a new File with the specified assigned filename. | |
| virtual | ~File () |
| virtual void | close () |
| Close this Stream instance. | |
| virtual void | flush () |
| Flushes the context to the underlying file resource. | |
| virtual pos_type | getSize () |
| The current file size. | |
| virtual void | ignore (off_type size, int delim=EOF) |
| The stream is positioned either size bytes forward or until delim is read (if this occurs before size bytes could be read). | |
| virtual bool | isOpen () const |
| virtual void | open (std::ios_base::openmode openMode=std::ios_base::binary|std::ios_base::in) |
| Open the stream in the specified open mode. | |
| virtual off_type | read (void *buffer, off_type size) |
| Read size Reader::char_type into buffer. | |
| virtual void | setPosition (pos_type value) |
| Set the current stream position to position. | |
| virtual void | setName (const std::wstring &value) |
| Set the name for this stream to name. | |
| virtual void | write (const void *buffer, off_type size) |
| Write size Writer::char_type from the buffer to the stream. | |
Static Public Attributes | |
| static const char * | LINE_SEPARATOR |
Either "\r\n" or "\n", depending on the target platform. | |
| static const wchar_t * | WLINE_SEPARATOR |
Either L"\\r\\n" or L"\\n", depending on the target platform. | |
A File is a special Stream associated to a filename.
| typedef unsigned char micxx::File::char_type |
Reimplemented from micxx::traits::Reader< unsigned char, std::size_t >.
| typedef std::size_t micxx::File::off_type |
Reimplemented from micxx::traits::Reader< unsigned char, std::size_t >.
| micxx::File::File | ( | const std::string & | filename = "" | ) |
Create a new File with the specified assigned filename.
| micxx::File::File | ( | const std::wstring & | filename | ) |
Create a new File with the specified assigned filename.
| virtual micxx::File::~File | ( | ) | [virtual] |
| virtual void micxx::File::close | ( | ) | [virtual] |
Close this Stream instance.
Implements micxx::traits::Stream.
| virtual void micxx::File::flush | ( | ) | [virtual] |
Flushes the context to the underlying file resource.
| virtual pos_type micxx::File::getSize | ( | ) | [virtual] |
The current file size.
| virtual void micxx::File::ignore | ( | off_type | size, |
| int | delim = EOF |
||
| ) | [virtual] |
The stream is positioned either size bytes forward or until delim is read (if this occurs before size bytes could be read).
Implements micxx::traits::Reader< unsigned char, std::size_t >.
| virtual bool micxx::File::isOpen | ( | ) | const [virtual] |
true, if the file is open, false otherwise. | virtual void micxx::File::open | ( | std::ios_base::openmode | mode = std::ios_base::binary|std::ios_base::in | ) | [virtual] |
Open the stream in the specified open mode.
Implements micxx::traits::Stream.
Read size Reader::char_type into buffer.
If buffer is 0, the stream is positioned size bytes forward.
Implements micxx::traits::Reader< unsigned char, std::size_t >.
| virtual void micxx::File::setName | ( | const std::wstring & | name | ) | [virtual] |
Set the name for this stream to name.
Reimplemented from micxx::traits::Stream.
| virtual void micxx::File::setPosition | ( | pos_type | position | ) | [virtual] |
Set the current stream position to position.
Reimplemented from micxx::traits::Stream.
| virtual void micxx::File::write | ( | const void * | buffer, |
| off_type | size | ||
| ) | [virtual] |
Write size Writer::char_type from the buffer to the stream.
Implements micxx::traits::Writer< unsigned char, std::size_t >.
const char* micxx::File::LINE_SEPARATOR [static] |
Either "\r\n" or "\n", depending on the target platform.
const wchar_t* micxx::File::WLINE_SEPARATOR [static] |
Either L"\\r\\n" or L"\\n", depending on the target platform.