Logo Search packages:      
Sourcecode: sam2p version File versions

SimBuffer::B Class Reference

#include <gensi.hpp>

Inheritance diagram for SimBuffer::B:

SimBuffer::Flat SimBuffer::Appendable GenBuffer GenBuffer GenBuffer::Writable

List of all members.


Detailed Description

A simple, non-shared, writable, flat memory buffer of bytes. Supports fast appends (with rare memory-rallocations) by pre-allocating at most twice as much memory. Prepends are slow, because they always include memory allocation and copying. Does memory management. Imp: check when `len' overflows (i.e 2*alloced etc.)

Definition at line 403 of file gensi.hpp.


Public Types

typedef void(* block_char_t )(char c, void *data)
typedef void(* block_sub_t )(char const *beg, slen_t len, void *data)

Public Member Functions

BappendDump (const char c, bool dq=false)
BappendDump (const Flat &other, bool dq=false)
BappendDumpC (const Flat &other, bool dq=false)
BappendDumpPS (const Flat &other, bool dq=false)
BappendFnq (const Flat &other, bool preminus=false)
BappendHppq (const Flat &other)
BappendNpmq (const Flat &other, bool dq=false)
BappendUnslash (const Flat &other, int iniq)
 B (Flat const &, slen_t from_offset, slen_t slen)
 B (char const *, Flat const &, char const *)
 B (Flat const &, char const *)
 B (GenBuffer const &, GenBuffer const &, GenBuffer const &)
 B (char const *, slen_t, char const *, slen_t, char const *, slen_t)
 B (GenBuffer const &, GenBuffer const &)
 B (char const *, slen_t, char const *, slen_t, int)
 B (char const *, slen_t, char const *, slen_t)
 B (GenBuffer::Readable &)
 B (GenBuffer const &)
 B (Flat const &, int)
 B (Flat const &)
 B (B const &)
 B (char const *, slen_t)
 B (char const *)
 B ()
char * begin_ () const
void clear ()
void clearFree ()
virtual int cmp (char const *s2, slen_t len) const
virtual int cmp (Flat const &s2) const
int cmp (char const *s2) const
virtual int cmp (char const *s2, slen_t len) const
virtual int cmp (GenBuffer const &s2) const
virtual slen_t copyRange (char *to, slen_t cfrom, slen_t clen) const
virtual slen_t copyRange (char *to, slen_t cfrom, slen_t clen) const
void each_char (block_char_t block, void *data) const
virtual void each_sub (block_sub_t block, void *data) const
virtual void each_sub (block_sub_t block, void *data) const =0
char * end_ () const
slen_t findFirst (char const *s, slen_t slen) const
slen_t findFirst (char const c) const
slen_t findLast (char const c) const
virtual void first_sub (Sub &sub) const
virtual void first_sub (Sub &sub) const =0
void forgetAll ()
void forgetFirst (slen_t howmuch)
void forgetLast (slen_t howmuch)
GenBuffer::Writableformat (char const *fmt,...)
GenBuffer::Writableformat (slen_t n, char const *fmt,...)
char getAt (slen_t idx)
virtual char getAt0 (slen_t idx, char fallback='\0')
char const * getCString () const
virtual slen_t getLength () const
virtual slen_t getLength () const =0
void grow_set0_by (slendiff_t lendiff)
bool isEmpty () const
bool isFull () const
void keepLeft (slen_t howmuch)
void keepRight (slen_t howmuch)
void keepSubstr (slen_t from_offset, slen_t slen)
B left (slen_t howmuch) const
virtual void next_sub (Sub &sub) const
virtual void next_sub (Sub &sub) const =0
virtual operator void * () const
virtual bool operator! () const
char const * operator() () const
Writableoperator<< (GenBuffer const &b)
Boperator<< (bool b)
Boperator<< (unsigned long n)
Boperator<< (unsigned int n)
Boperator<< (unsigned short n)
Boperator<< (signed long n)
Boperator<< (signed int n)
Boperator<< (signed short n)
Boperator<< (void const *)
Boperator<< (Flat const &)
Boperator<< (char const *s)
Boperator<< (char c)
Boperator= (char const *)
Boperator= (B const &other)
Boperator= (Flat const &other)
char & operator[] (slendiff_t idx) const
void prepend (char const *, slen_t)
B right (slen_t howmuch) const
B substr (slen_t first) const
B substr (slen_t first, slen_t howmuch) const
char * substr_grow (slen_t first, slen_t oldmuch, slen_t newmuch)
Bterm0 ()
bool toBool (bool &dst)
void toChar (char &ret) const
bool toCString (char *&dst)
bool toInteger (signed int &i)
bool toInteger (unsigned int &i)
bool toInteger (signed short &i)
bool toInteger (unsigned short &i)
bool toInteger (signed long &dst)
bool toInteger (unsigned long &dst)
GenBuffer::Writablevformat (char const *fmt, va_list ap)
GenBuffer::Writablevformat (slen_t n, char const *fmt, va_list ap)
virtual void vi_grow2 (slendiff_t left, slendiff_t right, char **lbeg, char **rbeg)
virtual char * vi_mkbeg (slen_t howmuch)
virtual char * vi_mkend (slen_t howmuch)
virtual void vi_putcc (char c)
virtual void vi_write (char const *, slen_t)
void write_num (unsigned long n, unsigned zdigits)
void write_num (unsigned long n)
void write_num (signed long n)
virtual ~B ()

Static Public Member Functions

static unsigned hexc2n (char c)
static int nocase_memcmp (char const *a, char const *s, slen_t slen)
static bool nocase_strbegins (char const *a, char const *with)
static int nocase_strcmp (char const *a, char const *b)
static bool parseBool (char const *s, slen_t slen)
static void space_pad_cpy (char *dst, char const *src, slen_t pad)
static bool strbegins (char const *a, char const *with)
static void tolower_memcpy (char *dst, char const *s, slen_t slen)
static void toupper_memcpy (char *dst, char const *s, slen_t slen)

Protected Member Functions

BB_append (GenBuffer::Readable &stream)
char * grow_by (slen_t howmuch)

Static Protected Member Functions

static void iter_char_sub (char const *beg, slen_t len, void *data)
static void iter_write_sub (char const *beg, slen_t len, void *data)

Protected Attributes

slen_t alloced
const char * beg
slen_t len
char small [8]

Friends

class B
bool operator!= (const GenBuffer &s1, const char *s2)
bool operator!= (const char *s1, const GenBuffer &s2)
bool operator!= (const GenBuffer &s1, const GenBuffer &s2)
B operator+ (const Flat &s1, const char *s2)
B operator+ (const char *s1, const Flat &s2)
B operator+ (const Flat &s1, const Flat &s2)
bool operator< (const GenBuffer &s1, const char *s2)
bool operator< (const char *s1, const GenBuffer &s2)
bool operator< (const GenBuffer &s1, const GenBuffer &s2)
Boperator<< (B &self, GenBuffer::Readable &stream)
bool operator<= (const GenBuffer &s1, const char *s2)
bool operator<= (const char *s1, const GenBuffer &s2)
bool operator<= (const GenBuffer &s1, const GenBuffer &s2)
bool operator== (const GenBuffer &s1, const char *s2)
bool operator== (const char *s1, const GenBuffer &s2)
bool operator== (const GenBuffer &s1, const GenBuffer &s2)
bool operator> (const GenBuffer &s1, const char *s2)
bool operator> (const char *s1, const GenBuffer &s2)
bool operator> (const GenBuffer &s1, const GenBuffer &s2)
bool operator>= (const GenBuffer &s1, const char *s2)
bool operator>= (const char *s1, const GenBuffer &s2)
bool operator>= (const GenBuffer &s1, const GenBuffer &s2)

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

Generated by  Doxygen 1.6.0   Back to index