Logo Search packages:      
Sourcecode: djvulibre version File versions

UnicodeByteStream Class Reference

#include <UnicodeByteStream.h>

Inheritance diagram for UnicodeByteStream:

ByteStream GPEnabled

List of all members.


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.


Public Types

enum  codepage_type { RAW, AUTO, NATIVE, UTF8 }

Public Member Functions

virtual void flush (void)
 Does a flush, and clears the read ahead buffer.
int get_count (void) const
int get_lines_read (void) const
 Find out how many lines have been read with gets.
GNativeString getAsNative (void)
GUTF8String getAsUTF8 (void)
virtual GUTF8String gets (size_t const t=0, unsigned long const stopat='\n', bool const inclusive=true)
 Simmular to fgets(), except read aheads effect the tell() position.
virtual size_t read (void *buffer, size_t size)
virtual int seek (long offset, int whence=SEEK_SET, bool nothrow=false)
 Resets the gets buffering as well as physically seeking.
void set_encodetype (const GStringRep::EncodeType et=GStringRep::XUTF8)
 Sets the encoding type and seek's to position 0.
void set_encoding (const GUTF8String &encoding)
virtual long tell (void) const
 tell will tell you the read position, including read ahead for gets()...
virtual size_t write (const void *buffer, size_t size)
 Not correctly implimented...
Utility Functions.
Class ByteStream# implements these functions using the virtual interface functions only. All subclasses of ByteStream# inherit these functions.

size_t copy (ByteStream &bsfrom, size_t size=0)
GP< ByteStreamduplicate (const size_t size=0) const
size_t format (const char *fmt,...)
 Allows printf() type operations to a bytestream.
void formatmessage (const char *fmt,...)
TArray< char > get_data (void)
 Use at your own risk, only guarenteed to work for ByteStream::Memorys.
virtual bool is_static (void) const
 Returns false, unless a subclass of ByteStream::Static.
unsigned int read16 ()
unsigned int read24 ()
unsigned int read32 ()
unsigned int read8 ()
size_t readall (void *buffer, size_t size)
virtual size_t readat (void *buffer, size_t sz, int pos)
int scanf (const char *fmt,...)
 Allows scanf() type operations on a bytestream.
virtual int size (void) const
size_t writall (const void *buffer, size_t size)
void write16 (unsigned int card16)
void write24 (unsigned int card24)
void write32 (unsigned int card32)
void write8 (unsigned int card8)
void writemessage (const char *message)
size_t writestring (const GNativeString &s)
size_t writestring (const GUTF8String &s)

Static Public Member Functions

static GP< ByteStreamcreate (FILE *const f, char const *const mode, const bool closeme)
static GP< ByteStreamcreate (const int fd, char const *const mode, const bool closeme)
static GP< ByteStreamcreate (char const *const mode)
static GP< ByteStreamcreate (const GURL &url, char const *const mode)
static GP< ByteStreamcreate (void const *const buffer, const size_t size)
static GP< ByteStreamcreate (void)
static GP< UnicodeByteStreamcreate (GP< ByteStream > bs, const GStringRep::EncodeType encodetype=GStringRep::XUTF8)
static GP< ByteStreamcreate_static (void const *const buffer, const size_t size)
static GP< ByteStreamget_stderr (char const *const mode=0)
static GP< ByteStreamget_stdin (char const *const mode=0)
static GP< ByteStreamget_stdout (char const *const mode=0)

Public Attributes

enum ByteStream::codepage_type cp

Static Public Attributes

static const char * EndOfFile = ERR_MSG("EOF")

Protected Member Functions

 UnicodeByteStream (GP< ByteStream > bs, const GStringRep::EncodeType encodetype=GStringRep::XUTF8)
 UnicodeByteStream (const UnicodeByteStream &bs)

Protected Attributes

GP< ByteStreambs
 The real byte stream.
GUTF8String buffer
int bufferpos
volatile int count
 The reference counter.
int linesread
long startpos

Private Member Functions

UnicodeByteStreamoperator= (UnicodeByteStream &)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index