Bstrlib::String Struct Reference

#include <BString.hpp>

Inheritance diagram for Bstrlib::String:

tagbstring List of all members.

Detailed Description

The string class.


Public Member Functions

char * Alloc (int length)
 Space allocation.
int caselessCmp (const String &b) const
 Case insensitive compare.
int caselessEqual (const String &b) const
 Check if the argument is equal in a case insensitive compare.
int caselessFind (const char *b, int pos=0) const
 Find a given substring starting at position pos in a case insensitive search.
int caselessFind (const String &b, int pos=0) const
 Find a given substring starting at position pos in a case insensitive search.
int caselessReverseFind (const char *b, int pos) const
 Reverse find a given substring starting at position pos in a case insensitive search.
int caselessReverseFind (const String &b, int pos) const
 Reverse find a given substring starting at position pos in a case insensitive search.
CharWriteProtected Character (int i)
 Character retrieval when write protected.
unsigned char Character (int i) const
 Bound checking character retrieval.
int Count (const String &b) const
 Count the number of times the given substring appears in the string.
String extractToken (char c, int &pos) const
 Extract tokens from by splitting the string with the given char, starting at position pos (first call should set pos == 0).
void Fill (int length, unsigned char fill= ' ')
 Fill the string with 'fill' char length times.
int Find (char c, int pos=0) const
 Find a given char starting at position pos.
int Find (const char *b, int pos=0) const
 Find a given substring starting at position pos.
int Find (const String &b, int pos=0) const
 Find a given substring starting at position pos.
void findAndReplace (const char *find, const char *repl, int pos=0)
 Find the given substring starting at position pos and replace it.
void findAndReplace (const char *find, const String &repl, int pos=0)
 Find the given substring starting at position pos and replace it.
void findAndReplace (const String &find, const char *repl, int pos=0)
 Find the given substring starting at position pos and replace it.
void findAndReplace (const String &find, const String &repl, int pos=0)
 Find the given substring starting at position pos and replace it.
void findAndReplaceCaseless (const char *find, const char *repl, int pos=0)
 Find the given substring starting at position pos and replace it with caseless search.
void findAndReplaceCaseless (const char *find, const String &repl, int pos=0)
 Find the given substring starting at position pos and replace it with caseless search.
void findAndReplaceCaseless (const String &find, const char *repl, int pos=0)
 Find the given substring starting at position pos and replace it with caseless search.
void findAndReplaceCaseless (const String &find, const String &repl, int pos=0)
 Find the given substring starting at position pos and replace it with caseless search.
int findAnyChar (const char *s, int pos=0) const
 Find the first occurrence matching any char of the given substring starting at position pos.
int findAnyChar (const String &b, int pos=0) const
 Find the first occurrence matching any char of the given substring starting at position pos.
StringFormat (const char *fmt,...)
 Printf like format.
void Formata (const char *fmt,...)
 Printf like format for ascii.
int getLength () const
 Return the length of the string.
void Insert (int pos, const char *b, unsigned char fill= ' ')
 Insert at pos the string b.
void Insert (int pos, const String &b, unsigned char fill= ' ')
 Insert at pos the string b.
void insertChars (int pos, int len, unsigned char fill= ' ')
 Insert at pos len times the 'fill' char.
int invFindAnyChar (const char *b, int pos=0) const
 Find the first occurrence not matching any char of the given substring starting at position pos.
int invFindAnyChar (const String &b, int pos=0) const
 Find the first occurrence not matching any char of the given substring starting at position pos.
int invReverseFindAnyChar (const char *b, int pos) const
 Reverse find the first occurrence not matching any char of the given substring starting at position pos.
int invReverseFindAnyChar (const String &b, int pos) const
 Reverse find the first occurrence not matching any char of the given substring starting at position pos.
bool isWriteProtected () const
 Is the current string write protected ?
void leftTrim (const String &b=String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n")))
 Trim the left side of this string with the given chars.
const String midString (int left, int len) const
 Extract the string starting at left of len char long.
const String operator * (int count) const
 * operator, repeat and copy
const Stringoperator *= (int count)
 *= operator, this one simply repeats the string count times
 operator const char * () const
 To char * and unsigned char *.
 operator const unsigned char * () const
 operator double () const
 To double, as long as the string contains a double value (0 on error).
 operator float () const
 To float, as long as the string contains a float value (0 on error).
 operator signed int () const
 To int, as long as the string contains a int value (0 on error).
 operator unsigned int () const
 To unsigned int, as long as the string contains a int value (0 on error).
bool operator!= (const unsigned char *s) const
bool operator!= (const char *s) const
bool operator!= (const String &b) const
const String operator+ (const tagbstring &x) const
const String operator+ (const String &b) const
const String operator+ (const char *s) const
const String operator+ (const unsigned char *s) const
const String operator+ (unsigned char c) const
const String operator+ (char c) const
 + operator
const Stringoperator+= (const tagbstring &x)
const Stringoperator+= (const String &b)
const Stringoperator+= (const char *s)
const Stringoperator+= (unsigned char c)
const Stringoperator+= (char c)
 += operator
bool operator< (const unsigned char *s) const
bool operator< (const char *s) const
bool operator< (const String &b) const
bool operator<= (const unsigned char *s) const
bool operator<= (const char *s) const
bool operator<= (const String &b) const
const Stringoperator= (const tagbstring &x)
const Stringoperator= (const String &b)
const Stringoperator= (const char *s)
const Stringoperator= (unsigned char c)
const Stringoperator= (char c)
 = operator
bool operator== (const unsigned char *s) const
bool operator== (const char *s) const
bool operator== (const String &b) const
 Comparison operators.
bool operator> (const unsigned char *s) const
bool operator> (const char *s) const
bool operator> (const String &b) const
bool operator>= (const unsigned char *s) const
bool operator>= (const char *s) const
bool operator>= (const String &b) const
CharWriteProtected operator[] (int i)
unsigned char operator[] (int i) const
 Bound checking character retrieval.
void releaseLock (const int &len)
 Release a lock acquired with Alloc method.
void Remove (int pos, int len)
 Remove, at pos, len char from the string.
void Repeat (int count)
 Repeat the same string count times.
void Replace (int pos, int len, const char *s, unsigned char fill= ' ')
 Replace, at pos, len char to the string b.
void Replace (int pos, int len, const String &b, unsigned char fill= ' ')
 Replace, at pos, len char to the string b.
int reverseFind (char c, int pos) const
 Reverse find a given char starting at position pos.
int reverseFind (const char *b, int pos) const
 Reverse find a given substring starting at position pos.
int reverseFind (const String &b, int pos) const
 Reverse find a given substring starting at position pos.
int reverseFindAnyChar (const char *s, int pos) const
 Reverse find the first occurrence matching any char of the given substring starting at position pos.
int reverseFindAnyChar (const String &b, int pos) const
 Reverse find the first occurrence matching any char of the given substring starting at position pos.
void rightTrim (const String &b=String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n")))
 Trim the right side of this string with the given chars.
void Scan (const char *fmt, void *data) const
 Scan the string and extract to the given data (fmt follows scanf's format spec).
void setSubstring (int pos, const char *b, unsigned char fill= ' ')
 Set the substring at pos to the string b.
void setSubstring (int pos, const String &b, unsigned char fill= ' ')
 Set the substring at pos to the string b.
 String (const void *blk, int len)
 Bulk construction from a given block.
 String (const tagbstring &x)
 String (const String &b)
 Copy constructors.
 String (int len, const char *s)
 C-Style string with len limitation.
 String (const char *s)
 C-Style string constructor.
 String (char c, int len)
 String (unsigned char c)
 String (char c)
 Char and unsigned char constructor.
 String ()
 Default constructor - Allocate 8 bytes of memory.
void toLowercase ()
 Change to lowercase.
void toUppercase ()
 Change to uppercase.
void Trim (const String &b=String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n")))
 Trim the both sides of this string with the given chars.
void Truncate (int len)
 Truncate the string at the given len.
void writeAllow ()
 Allow writing to this string.
void writeProtect ()
 Write protect this string.
 ~String ()
 Destructor.

Public Attributes

unsigned char * data
int mlen
int slen


Constructor & Destructor Documentation

Bstrlib::String::String (  ) 

Default constructor - Allocate 8 bytes of memory.

Bstrlib::String::String ( char  c  ) 

Char and unsigned char constructor.

Bstrlib::String::String ( unsigned char  c  ) 

Bstrlib::String::String ( char  c,
int  len 
)

Bstrlib::String::String ( const char *  s  ) 

C-Style string constructor.

Bstrlib::String::String ( int  len,
const char *  s 
)

C-Style string with len limitation.

Warning:
len is the minimum size, s might be larger

Bstrlib::String::String ( const String b  ) 

Copy constructors.

Bstrlib::String::String ( const tagbstring x  ) 

Bstrlib::String::String ( const void *  blk,
int  len 
)

Bulk construction from a given block.

Bstrlib::String::~String (  ) 

Destructor.


Member Function Documentation

char * Bstrlib::String::Alloc ( int  length  ) 

Space allocation.

int Bstrlib::String::caselessCmp ( const String b  )  const

Case insensitive compare.

int Bstrlib::String::caselessEqual ( const String b  )  const

Check if the argument is equal in a case insensitive compare.

int Bstrlib::String::caselessFind ( const char *  b,
int  pos = 0 
) const

Find a given substring starting at position pos in a case insensitive search.

int Bstrlib::String::caselessFind ( const String b,
int  pos = 0 
) const

Find a given substring starting at position pos in a case insensitive search.

int Bstrlib::String::caselessReverseFind ( const char *  b,
int  pos 
) const

Reverse find a given substring starting at position pos in a case insensitive search.

int Bstrlib::String::caselessReverseFind ( const String b,
int  pos 
) const

Reverse find a given substring starting at position pos in a case insensitive search.

CharWriteProtected Bstrlib::String::Character ( int  i  )  [inline]

Character retrieval when write protected.

unsigned char Bstrlib::String::Character ( int  i  )  const [inline]

Bound checking character retrieval.

int Bstrlib::String::Count ( const String b  )  const

Count the number of times the given substring appears in the string.

String Bstrlib::String::extractToken ( char  c,
int &  pos 
) const

Extract tokens from by splitting the string with the given char, starting at position pos (first call should set pos == 0).

void Bstrlib::String::Fill ( int  length,
unsigned char  fill = ' ' 
)

Fill the string with 'fill' char length times.

int Bstrlib::String::Find ( char  c,
int  pos = 0 
) const

Find a given char starting at position pos.

int Bstrlib::String::Find ( const char *  b,
int  pos = 0 
) const

Find a given substring starting at position pos.

int Bstrlib::String::Find ( const String b,
int  pos = 0 
) const

Find a given substring starting at position pos.

void Bstrlib::String::findAndReplace ( const char *  find,
const char *  repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it.

void Bstrlib::String::findAndReplace ( const char *  find,
const String repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it.

void Bstrlib::String::findAndReplace ( const String find,
const char *  repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it.

void Bstrlib::String::findAndReplace ( const String find,
const String repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it.

void Bstrlib::String::findAndReplaceCaseless ( const char *  find,
const char *  repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it with caseless search.

void Bstrlib::String::findAndReplaceCaseless ( const char *  find,
const String repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it with caseless search.

void Bstrlib::String::findAndReplaceCaseless ( const String find,
const char *  repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it with caseless search.

void Bstrlib::String::findAndReplaceCaseless ( const String find,
const String repl,
int  pos = 0 
)

Find the given substring starting at position pos and replace it with caseless search.

int Bstrlib::String::findAnyChar ( const char *  s,
int  pos = 0 
) const

Find the first occurrence matching any char of the given substring starting at position pos.

int Bstrlib::String::findAnyChar ( const String b,
int  pos = 0 
) const

Find the first occurrence matching any char of the given substring starting at position pos.

String & Bstrlib::String::Format ( const char *  fmt,
  ... 
)

Printf like format.

void Bstrlib::String::Formata ( const char *  fmt,
  ... 
)

Printf like format for ascii.

int Bstrlib::String::getLength (  )  const [inline]

Return the length of the string.

void Bstrlib::String::Insert ( int  pos,
const char *  b,
unsigned char  fill = ' ' 
)

Insert at pos the string b.

If pos > len, (pos-len) 'fill' char are inserted

void Bstrlib::String::Insert ( int  pos,
const String b,
unsigned char  fill = ' ' 
)

Insert at pos the string b.

If pos > len, (pos-len) 'fill' char are inserted

void Bstrlib::String::insertChars ( int  pos,
int  len,
unsigned char  fill = ' ' 
)

Insert at pos len times the 'fill' char.

int Bstrlib::String::invFindAnyChar ( const char *  b,
int  pos = 0 
) const

Find the first occurrence not matching any char of the given substring starting at position pos.

int Bstrlib::String::invFindAnyChar ( const String b,
int  pos = 0 
) const

Find the first occurrence not matching any char of the given substring starting at position pos.

int Bstrlib::String::invReverseFindAnyChar ( const char *  b,
int  pos 
) const

Reverse find the first occurrence not matching any char of the given substring starting at position pos.

int Bstrlib::String::invReverseFindAnyChar ( const String b,
int  pos 
) const

Reverse find the first occurrence not matching any char of the given substring starting at position pos.

bool Bstrlib::String::isWriteProtected (  )  const [inline]

Is the current string write protected ?

void Bstrlib::String::leftTrim ( const String b = String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n"))  ) 

Trim the left side of this string with the given chars.

const String Bstrlib::String::midString ( int  left,
int  len 
) const

Extract the string starting at left of len char long.

const String Bstrlib::String::operator * ( int  count  )  const [inline]

* operator, repeat and copy

const String& Bstrlib::String::operator *= ( int  count  )  [inline]

*= operator, this one simply repeats the string count times

Bstrlib::String::operator const char * (  )  const [inline]

To char * and unsigned char *.

Bstrlib::String::operator const unsigned char * (  )  const [inline]

Bstrlib::String::operator double (  )  const

To double, as long as the string contains a double value (0 on error).

Bstrlib::String::operator float (  )  const

To float, as long as the string contains a float value (0 on error).

Bstrlib::String::operator signed int (  )  const

To int, as long as the string contains a int value (0 on error).

Bstrlib::String::operator unsigned int (  )  const

To unsigned int, as long as the string contains a int value (0 on error).

bool Bstrlib::String::operator!= ( const unsigned char *  s  )  const

bool Bstrlib::String::operator!= ( const char *  s  )  const

bool Bstrlib::String::operator!= ( const String b  )  const

const String Bstrlib::String::operator+ ( const tagbstring x  )  const

const String Bstrlib::String::operator+ ( const String b  )  const

const String Bstrlib::String::operator+ ( const char *  s  )  const

const String Bstrlib::String::operator+ ( const unsigned char *  s  )  const

const String Bstrlib::String::operator+ ( unsigned char  c  )  const

const String Bstrlib::String::operator+ ( char  c  )  const

+ operator

const String & Bstrlib::String::operator+= ( const tagbstring x  ) 

const String & Bstrlib::String::operator+= ( const String b  ) 

const String & Bstrlib::String::operator+= ( const char *  s  ) 

const String & Bstrlib::String::operator+= ( unsigned char  c  ) 

const String & Bstrlib::String::operator+= ( char  c  ) 

+= operator

bool Bstrlib::String::operator< ( const unsigned char *  s  )  const

bool Bstrlib::String::operator< ( const char *  s  )  const

bool Bstrlib::String::operator< ( const String b  )  const

bool Bstrlib::String::operator<= ( const unsigned char *  s  )  const

bool Bstrlib::String::operator<= ( const char *  s  )  const

bool Bstrlib::String::operator<= ( const String b  )  const

const String & Bstrlib::String::operator= ( const tagbstring x  ) 

const String & Bstrlib::String::operator= ( const String b  ) 

const String & Bstrlib::String::operator= ( const char *  s  ) 

const String & Bstrlib::String::operator= ( unsigned char  c  ) 

const String & Bstrlib::String::operator= ( char  c  ) 

= operator

bool Bstrlib::String::operator== ( const unsigned char *  s  )  const

bool Bstrlib::String::operator== ( const char *  s  )  const

bool Bstrlib::String::operator== ( const String b  )  const

Comparison operators.

bool Bstrlib::String::operator> ( const unsigned char *  s  )  const

bool Bstrlib::String::operator> ( const char *  s  )  const

bool Bstrlib::String::operator> ( const String b  )  const

bool Bstrlib::String::operator>= ( const unsigned char *  s  )  const

bool Bstrlib::String::operator>= ( const char *  s  )  const

bool Bstrlib::String::operator>= ( const String b  )  const

CharWriteProtected Bstrlib::String::operator[] ( int  i  )  [inline]

unsigned char Bstrlib::String::operator[] ( int  i  )  const [inline]

Bound checking character retrieval.

void Bstrlib::String::releaseLock ( const int &  len  )  [inline]

Release a lock acquired with Alloc method.

void Bstrlib::String::Remove ( int  pos,
int  len 
)

Remove, at pos, len char from the string.

void Bstrlib::String::Repeat ( int  count  ) 

Repeat the same string count times.

void Bstrlib::String::Replace ( int  pos,
int  len,
const char *  s,
unsigned char  fill = ' ' 
)

Replace, at pos, len char to the string b.

If pos > string length or pos+len > string length, the missing 'fill' char are inserted

void Bstrlib::String::Replace ( int  pos,
int  len,
const String b,
unsigned char  fill = ' ' 
)

Replace, at pos, len char to the string b.

If pos > string length or pos+len > string length, the missing 'fill' char are inserted

int Bstrlib::String::reverseFind ( char  c,
int  pos 
) const

Reverse find a given char starting at position pos.

int Bstrlib::String::reverseFind ( const char *  b,
int  pos 
) const

Reverse find a given substring starting at position pos.

int Bstrlib::String::reverseFind ( const String b,
int  pos 
) const

Reverse find a given substring starting at position pos.

int Bstrlib::String::reverseFindAnyChar ( const char *  s,
int  pos 
) const

Reverse find the first occurrence matching any char of the given substring starting at position pos.

int Bstrlib::String::reverseFindAnyChar ( const String b,
int  pos 
) const

Reverse find the first occurrence matching any char of the given substring starting at position pos.

void Bstrlib::String::rightTrim ( const String b = String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n"))  ) 

Trim the right side of this string with the given chars.

void Bstrlib::String::Scan ( const char *  fmt,
void *  data 
) const

Scan the string and extract to the given data (fmt follows scanf's format spec).

void Bstrlib::String::setSubstring ( int  pos,
const char *  b,
unsigned char  fill = ' ' 
)

Set the substring at pos to the string b.

If pos > len, (pos-len) 'fill' char are inserted

void Bstrlib::String::setSubstring ( int  pos,
const String b,
unsigned char  fill = ' ' 
)

Set the substring at pos to the string b.

If pos > len, (pos-len) 'fill' char are inserted

void Bstrlib::String::toLowercase (  ) 

Change to lowercase.

void Bstrlib::String::toUppercase (  ) 

Change to uppercase.

void Bstrlib::String::Trim ( const String b = String(" \t\v\f\r\n", sizeof(" \t\v\f\r\n"))  )  [inline]

Trim the both sides of this string with the given chars.

void Bstrlib::String::Truncate ( int  len  ) 

Truncate the string at the given len.

void Bstrlib::String::writeAllow (  ) 

Allow writing to this string.

void Bstrlib::String::writeProtect (  ) 

Write protect this string.


Member Data Documentation

unsigned char* tagbstring::data [inherited]

int tagbstring::mlen [inherited]

int tagbstring::slen [inherited]


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

(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is