Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions

ByteStream Class Reference

#include <ByteStream.h>

Inheritance diagram for ByteStream:
Inheritance graph
[legend]
Collaboration diagram for ByteStream:
Collaboration graph
[legend]

List of all members.

Classes

class  Memory
class  Static
class  Stdio

Public Types

enum  codepage_type { RAW, AUTO, NATIVE, UTF8 }

Public Member Functions

virtual void flush (void)
int get_count (void) const
GNativeString getAsNative (void)
GUTF8String getAsUTF8 (void)
ByteStreamoperator& () const
ByteStreamoperator& ()
virtual size_t read (void *buffer, size_t size)
virtual int seek (long offset, int whence=SEEK_SET, bool nothrow=false)
virtual long tell (void) const
virtual size_t write (const void *buffer, size_t size)
Virtual Functions.

These functions are usually implemented by each subclass of ByteStream#.

virtual ~ByteStream ()
virtual size_t read (void *buffer, size_t size)
virtual size_t write (const void *buffer, size_t size)
virtual long tell (void) const =0
virtual int seek (long offset, int whence=SEEK_SET, bool nothrow=false)
virtual void flush (void)
Utility Functions.

Class ByteStream# implements these functions using the virtual interface functions only. All subclasses of ByteStream# inherit these functions.

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

Static Public Member Functions

static GP< ByteStreamcreate (void)
static GP< ByteStreamcreate (void const *const buffer, const size_t size)
static GP< ByteStreamcreate (char const *const mode)
static GP< ByteStreamcreate (const int fd, char const *const mode, const bool closeme)
static GP< ByteStreamcreate (const GURL &url, char const *const mode)
static GP< ByteStreamcreate (FILE *const f, char const *const mode, const bool closeme)
static GP< ByteStreamcreate_static (void const *buffer, size_t size)
static GP< ByteStreamget_stderr (char const *mode=0)
static GP< ByteStreamget_stdin (char const *mode=0)
static GP< ByteStreamget_stdout (char const *mode=0)

Public Attributes

enum ByteStream::codepage_type cp

Static Public Attributes

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

Protected Member Functions

 Wrapper (const GP< ByteStream > &xbs)
 Wrapper (void)

Protected Attributes

ByteStreambs
volatile int count
 The reference counter.
GP< ByteStreamgbs

Private Member Functions

 ByteStream (const ByteStream &)
ByteStreamoperator= (const ByteStream &)

Detailed Description

Abstract class for a stream of bytes. Class ByteStream# represent an object from which (resp. to which) bytes can be read (resp. written) as with a regular file. Virtual functions read# and write# must implement these two basic operations. In addition, function tell# returns an offset identifying the current position, and function seek# may be used to change the current position.

{ Note}. Both the copy constructor and the copy operator are declared as private members. It is therefore not possible to make multiple copies of instances of this class, as implied by the class semantic.

ByteStream::Wrapper implements wrapping bytestream. This is useful for derived classes that take a GP<ByteStream> as a creation argument, and the backwards compatible bytestreams.

Definition at line 126 of file ByteStream.h.


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

Generated by  Doxygen 1.6.0   Back to index