Logo Search packages:      
Sourcecode: djvulibre version File versions

ByteStream::Memory Class Reference

Inheritance diagram for ByteStream::Memory:

ByteStream GPEnabled

List of all members.


Detailed Description

ByteStream interface managing a memory buffer. Class ByteStream::Memory# manages a dynamically resizable buffer from which data can be read or written. The buffer itself is organized as an array of blocks of 4096 bytes.

Definition at line 190 of file ByteStream.cpp.


Public Types

enum  codepage_type { RAW, AUTO, NATIVE, UTF8 }

Public Member Functions

void empty ()
int get_count (void) const
GNativeString getAsNative (void)
GUTF8String getAsUTF8 (void)
GUTF8String init (const void *const buffer, const size_t size)
 Memory ()
char & operator[] (int n)
virtual size_t read (void *buffer, size_t size)
virtual int seek (long offset, int whence=SEEK_SET, bool nothrow=false)
virtual int size (void) const
virtual long tell (void) const
virtual size_t write (const void *buffer, size_t size)
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)
int scanf (const char *fmt,...)
 Allows scanf() type operations on a bytestream.
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)
Virtual Functions.
These functions are usually implemented by each subclass of ByteStream#.

virtual void flush (void)

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< 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

virtual size_t readat (void *buffer, size_t sz, int pos)

Protected Attributes

char ** blocks
int bsize
volatile int count
 The reference counter.
GPBuffer< char * > gblocks
int nblocks

Private Member Functions

 Memory (const Memory &)
Memoryoperator= (const Memory &)

Private Attributes

int where

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

Generated by  Doxygen 1.6.0   Back to index