Back to index

courier  0.68.2
Public Member Functions | Private Member Functions | Private Attributes
Buffer Class Reference

#include <buffer.h>

List of all members.

Public Member Functions

 Buffer ()
 ~Buffer ()
const unsigned char * Ptr () const
 operator const unsigned char * () const
 operator const char * () const
int Int (const char *=0) const
int Length () const
void Length (int l)
 Buffer (const Buffer &)
Bufferoperator= (const Buffer &)
void push (int c)
int pop ()
int peek ()
void reset ()
void append (const void *, int)
void set (const char *)
void append (const char *p)
void set (unsigned long n)
void append (unsigned long n)
void append (double)
Bufferoperator= (const char *p)
Bufferoperator+= (const Buffer &p)
Bufferoperator+= (const char *p)
Bufferoperator+= (char c)
int operator- (const Buffer &) const
int operator- (const char *) const
int operator== (const Buffer &b) const
int operator== (const char *b) const

Private Member Functions

void append (int)

Private Attributes

unsigned char * buf
int bufsize
int buflength

Detailed Description

Definition at line 18 of file buffer.h.


Constructor & Destructor Documentation

Buffer::Buffer ( ) [inline]

Definition at line 24 of file buffer.h.

: buf(0), bufsize(0), buflength(0) {}
Buffer::~Buffer ( ) [inline]

Definition at line 25 of file buffer.h.

{ if (buf)    delete[] buf; }
Buffer::Buffer ( const Buffer )

Member Function Documentation

void Buffer::append ( int  ) [private]

Here is the caller graph for this function:

void Buffer::append ( const void *  ,
int   
)
void Buffer::append ( const char *  p) [inline]

Definition at line 51 of file buffer.h.

{ append(p, strlen(p)); }

Here is the call graph for this function:

Here is the caller graph for this function:

void Buffer::append ( unsigned long  n)
void Buffer::append ( double  )
int Buffer::Int ( const char *  = 0) const
int Buffer::Length ( ) const [inline]

Definition at line 30 of file buffer.h.

{ return (buflength); }
void Buffer::Length ( int  l) [inline]

Definition at line 31 of file buffer.h.

{ if (l < buflength) buflength=l; }
Buffer::operator const char * ( ) const [inline]

Definition at line 28 of file buffer.h.

{ return ((const char *)buf); }
Buffer::operator const unsigned char * ( ) const [inline]

Definition at line 27 of file buffer.h.

{ return (buf); }
Buffer& Buffer::operator+= ( const Buffer p) [inline]

Definition at line 56 of file buffer.h.

{ append(p.buf, p.buflength); return (*this); }

Here is the call graph for this function:

Buffer& Buffer::operator+= ( const char *  p) [inline]

Definition at line 57 of file buffer.h.

{ append(p, strlen(p)); return (*this); }

Here is the call graph for this function:

Buffer& Buffer::operator+= ( char  c) [inline]

Definition at line 58 of file buffer.h.

{ push(c); return (*this); }

Here is the call graph for this function:

int Buffer::operator- ( const Buffer ) const
int Buffer::operator- ( const char *  ) const
Buffer& Buffer::operator= ( const Buffer )
Buffer& Buffer::operator= ( const char *  p) [inline]

Definition at line 55 of file buffer.h.

{ set(p); return (*this); }
int Buffer::operator== ( const Buffer b) const [inline]

Definition at line 61 of file buffer.h.

              { return ( operator-(b) == 0); }
int Buffer::operator== ( const char *  b) const [inline]

Definition at line 63 of file buffer.h.

              { return ( operator-(b) == 0); }
int Buffer::peek ( ) [inline]

Definition at line 43 of file buffer.h.

{ return (buflength ? buf[buflength-1]:0); }
int Buffer::pop ( ) [inline]

Definition at line 42 of file buffer.h.

{ return (buflength ? buf[--buflength]:0); }
const unsigned char* Buffer::Ptr ( ) const [inline]

Definition at line 26 of file buffer.h.

{ return (buf); }
void Buffer::push ( int  c) [inline]

Definition at line 36 of file buffer.h.

                          { if (buflength < bufsize)
                            {
                                   buf[buflength]=c;
                                   ++buflength;
                            }
                            else   append(c); }

Here is the call graph for this function:

Here is the caller graph for this function:

void Buffer::reset ( ) [inline]

Definition at line 44 of file buffer.h.

{ buflength=0; }
void Buffer::set ( const char *  )
void Buffer::set ( unsigned long  n) [inline]

Definition at line 52 of file buffer.h.

{ buflength=0; append(n); }

Here is the call graph for this function:


Member Data Documentation

unsigned char* Buffer::buf [private]

Definition at line 20 of file buffer.h.

int Buffer::buflength [private]

Definition at line 22 of file buffer.h.

int Buffer::bufsize [private]

Definition at line 21 of file buffer.h.


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