kviewshell
UnicodeByteStream Class Reference
ByteStream interface for an Unicode file. More...
#include <UnicodeByteStream.h>
Public Member Functions | |
virtual void | flush (void) |
int | get_lines_read (void) const |
virtual GUTF8String | gets (size_t const t=0, unsigned long const stopat='\n', bool const inclusive=true) |
virtual size_t | read (void *buffer, size_t size) |
virtual int | seek (long offset, int whence=SEEK_SET, bool nothrow=false) |
void | set_encodetype (const GStringRep::EncodeType et=GStringRep::XUTF8) |
void | set_encoding (const GUTF8String &encoding) |
virtual long | tell (void) const |
virtual size_t | write (const void *buffer, size_t size) |
~UnicodeByteStream () | |
Static Public Member Functions | |
static GP< UnicodeByteStream > | create (GP< ByteStream > bs, const GStringRep::EncodeType encodetype=GStringRep::XUTF8) |
Protected Member Functions | |
UnicodeByteStream (GP< ByteStream > bs, const GStringRep::EncodeType encodetype=GStringRep::XUTF8) | |
UnicodeByteStream (const UnicodeByteStream &bs) | |
Protected Attributes | |
GP< ByteStream > | bs |
GUTF8String | buffer |
int | bufferpos |
int | linesread |
long | startpos |
Detailed Description
ByteStream interface for an Unicode file.Class UnicodeByteStream# augments the ByteStream# interface with functions for navigating Unicode documents. It works in relation with a ByteStream specified at construction time.
{ Reading an Unicode file} --- You can read an Unicode file by constructing an UnicodeByteStream# object attached to the ByteStream containing the Unicode file.
{ Writing an Unicode file} --- You can write an Unicode file by constructing an UnicodeByteStream# object attached to the seekable ByteStream object that will contain the XML file.
Writing an XML file requires a seekable ByteStream (see {ByteStream::is_seekable}). This is not much of a problem because you can always create the XML file into a {MemoryByteStream} and then use {ByteStream::copy} to transfer the XML file into a non seekable ByteStream.
Definition at line 122 of file UnicodeByteStream.h.
Constructor & Destructor Documentation
UnicodeByteStream::UnicodeByteStream | ( | const UnicodeByteStream & | bs | ) | [protected] |
Definition at line 75 of file UnicodeByteStream.cpp.
UnicodeByteStream::UnicodeByteStream | ( | GP< ByteStream > | bs, | |
const GStringRep::EncodeType | encodetype = GStringRep::XUTF8 | |||
) | [protected] |
Definition at line 81 of file UnicodeByteStream.cpp.
UnicodeByteStream::~UnicodeByteStream | ( | ) |
Definition at line 89 of file UnicodeByteStream.cpp.
Member Function Documentation
static GP<UnicodeByteStream> UnicodeByteStream::create | ( | GP< ByteStream > | bs, | |
const GStringRep::EncodeType | encodetype = GStringRep::XUTF8 | |||
) | [inline, static] |
Constructs an UnicodeByteStream object attached to ByteStream bs#.
Any ByteStream can be used when reading an XML file. Writing an XML file however requires a seekable ByteStream.
Definition at line 132 of file UnicodeByteStream.h.
void UnicodeByteStream::flush | ( | void | ) | [virtual] |
Does a flush, and clears the read ahead buffer.
Reimplemented from ByteStream.
Definition at line 168 of file UnicodeByteStream.cpp.
int UnicodeByteStream::get_lines_read | ( | void | ) | const [inline] |
Find out how many lines have been read with gets.
Definition at line 156 of file UnicodeByteStream.h.
GUTF8String UnicodeByteStream::gets | ( | size_t const | t = 0 , |
|
unsigned long const | stopat = '\n' , |
|||
bool const | inclusive = true | |||
) | [virtual] |
Simmular to fgets(), except read aheads effect the tell() position.
Definition at line 178 of file UnicodeByteStream.cpp.
size_t UnicodeByteStream::read | ( | void * | buffer, | |
size_t | size | |||
) | [virtual] |
Physically reads the specified bytes, and truncate the read ahead buffer.
Reimplemented from ByteStream.
Definition at line 119 of file UnicodeByteStream.cpp.
int UnicodeByteStream::seek | ( | long | offset, | |
int | whence = SEEK_SET , |
|||
bool | nothrow = false | |||
) | [virtual] |
Resets the gets buffering as well as physically seeking.
Reimplemented from ByteStream.
Definition at line 159 of file UnicodeByteStream.cpp.
void UnicodeByteStream::set_encodetype | ( | const GStringRep::EncodeType | et = GStringRep::XUTF8 |
) |
Sets the encoding type and seek's to position 0.
Definition at line 103 of file UnicodeByteStream.cpp.
void UnicodeByteStream::set_encoding | ( | const GUTF8String & | encoding | ) |
Definition at line 111 of file UnicodeByteStream.cpp.
long UnicodeByteStream::tell | ( | void | ) | const [virtual] |
tell will tell you the read position, including read ahead for gets()...
Implements ByteStream.
Definition at line 143 of file UnicodeByteStream.cpp.
size_t UnicodeByteStream::write | ( | const void * | buffer, | |
size_t | size | |||
) | [virtual] |
Not correctly implimented...
Reimplemented from ByteStream.
Definition at line 135 of file UnicodeByteStream.cpp.
Member Data Documentation
GP<ByteStream> UnicodeByteStream::bs [protected] |
GUTF8String UnicodeByteStream::buffer [protected] |
Definition at line 160 of file UnicodeByteStream.h.
int UnicodeByteStream::bufferpos [protected] |
Definition at line 161 of file UnicodeByteStream.h.
int UnicodeByteStream::linesread [protected] |
Definition at line 162 of file UnicodeByteStream.h.
long UnicodeByteStream::startpos [protected] |
Definition at line 163 of file UnicodeByteStream.h.
The documentation for this class was generated from the following files: