VDKString Class Reference

Implements famous cont referenced string objects. More...

#include <vdkstring.h>

List of all members.

Public Member Functions


Detailed Description

Implements famous cont referenced string objects.

Constructor & Destructor Documentation

VDKString::VDKString (  ) 

Constructor, makes an empty string

VDKString::VDKString ( const char *  s  ) 

Constructor

Parameters:
s a null terminated C string
VDKString s = "uncle bill";

VDKString::VDKString ( const char &  c  ) 

Constructor

Parameters:
c a single character
VDKString s(c);

VDKString::VDKString ( const VDKString s  ) 

Copy-initializer

Parameters:
s a VDKString reference
VDKString s = "uncle bill";
VDKString s1 = s;

VDKString::~VDKString (  ) 

Destructor


Member Function Documentation

VDKString & VDKString::operator= ( const VDKString s  ) 

Assignement operator

Parameters:
s a VDKString reference
VDKString s = "uncle bill";
VDKString s1 = s;
VDKString s2 = "uncle sam";
s = s2;

VDKString & VDKString::operator= ( const char *  s  ) 

Assignement operator

Parameters:
s a null terminated C string
VDKString s = "uncle bill";
s = "uncle sam";

VDKString::operator char * (  )  [inline]

VDKString to char* casting warning ** can violate data hiding OO concept

int VDKString::operator== ( const VDKString s  )  const

Equality operator

int VDKString::operator< ( const VDKString s  )  const

less than operator

int VDKString::operator> ( const VDKString s  )  const

greater than operator

int VDKString::operator<= ( const VDKString s  )  const

less-equal operator

int VDKString::operator>= ( const VDKString s  )  const

greater-equal operator

int VDKString::operator!= ( const VDKString s  )  const

disequality operator

VDKString & VDKString::operator+= ( const char *  s  ) 

cat to this

Parameters:
s a null terminated string
VDKString s = "uncle bill";
s += " is a smart boy";

VDKString & VDKString::operator+= ( const VDKString s  ) 

cat to this

Parameters:
s a VDKString
VDKString s = "uncle bill";
VDKString s1 = " is a smart boy";
s += s1;

VDKString VDKString::operator+ ( const char *  s  )  const

Returns a VDKString concatenated

Parameters:
s a null terminated string
VDKString s = "uncle bill";
VDKString s1 = s + " is a smart boy";

VDKString VDKString::operator+ ( const VDKString s  )  const

Returns a VDKString concatenated

Parameters:
s a VDKString

bool VDKString::isNull (  )  const

Returns true if this is an empty string

int VDKString::size (  )  const

as strlen()

char VDKString::operator[] ( unsigned int  ix  )  const

index operator for const instances returns NULL if ix >= size

const char * VDKString::c_str (  )  const

string pointer access for const instances

VDKString & VDKString::DelSelection ( unsigned int  begin,
unsigned int  len 
)

Removes a part of the string, beginning at 'begin' on 'len' length. Modifies and returns the resulting VDKString.

Parameters:
begin char number where begins the selection (0 based)
len selection length

VDKString & VDKString::RTrim (  ) 

Removes all trailing spaces. Modifies and returns the resulting VDKString.

VDKString & VDKString::LTrim (  ) 

Removes all leading spaces. Modifies and returns the resulting VDKString.

VDKString & VDKString::Trim (  ) 

Removes all leading and trailing spaces. Modifies and returns the resulting VDKString.

unsigned int VDKString::CharCount ( const char  car  )  const

Returns the number of the specified char 'car' contained in the string.

Parameters:
car char to be counted
VDKString s = "uncle bill";
int NumCar = s.CharCount('l');  // NumCar value is 3

VDKString & VDKString::UpperCase (  ) 

Returns the upper case VDKString after having modify it.

Warning:
Does not modify unknown characters.

Upper case characters are assumed without accents.

VDKString & VDKString::LowerCase (  ) 

Returns the lower case VDKString after having modify it.

Warning:
Upper case characters are assumed without accents.

bool VDKString::isEmpty (  )  const

Returns true if this is an empty string meaning NULL buffer or strlen() == 0.

VDKString & VDKString::Concatf ( const char *  format,
  ... 
)

Strcat() to the existing string (printf style). Modifies and returns the resulting VDKString.

Warning:
Final string is 65534 chars max.

Returns the previous string in case of memory overflow or buffer overflow.

Parameters:
format a NULL terminated string
... a list of parameters
VDKString s = "uncle bill";
s.Concatf("%s", " is a smart boy");     // s value is "uncle bill is a smart boy"

VDKString & VDKString::Sprintf ( const char *  format,
  ... 
)

Assignment to string (printf style). Modifies and returns the resulting VDKString.

Warning:
Final string is 65534 chars max.

Returns the previous string in case of memory overflow or buffer overflow.

Parameters:
format a NULL terminated string
... a list of parameters
VDKString s;
s.Sprintf("%s is %d years old", "uncle bill", 40);      // s value is "uncle bill is 40 years old"

VDKString & VDKString::GetPart ( unsigned int  i,
const char  sep = '|' 
)

Extract the specified part of a formatted string. Modifies and returns the resulting VDKString.

Warning:
Returns an isNull() string if the specified part not found.
Parameters:
i the desired part position (starting at 1)
sep the parts separator, '|' by default
VDKString s = "one|two|three|four";
VDKString p = s;
p.GetPart(2);           // p value is "two"

int VDKString::GetFCharPos ( const char  car  )  const

Returns the first occurrence position of the specified char 'car' (0 based) or -1 if 'car ' not found.

Parameters:
car char to be searched for

int VDKString::GetLCharPos ( const char  car  )  const

Returns the last occurrence position of the specified char 'car' (0 based) or -1 if 'car ' not found.

Parameters:
car char to be searched for

double VDKString::StrtoDouble (  )  const

Returns the converted string to double. See atof() for details.

int VDKString::StrtoInt (  )  const

Returns the converted string to int. See atoi() for details.

VDKString & VDKString::SubStr ( unsigned int  start,
unsigned int  len 
)

Extract a part of the string beginning at 'start' upon 'len' length. Modifies and returns the resulting VDKString.

Parameters:
start first char position (0 based)
len maximum length of the resulting string

VDKString & VDKString::Cut ( unsigned int  len  ) 

Cut the string at 'len' length. Modifies and returns the resulting VDKString.

Parameters:
len length of the resulting string

VDKString & VDKString::LPad ( unsigned int  len,
const char  car 
)

Pad left of string with a specified char 'car' upon 'len' length. Modifies and returns the resulting VDKString.

Parameters:
len length of the resulting string
car char to be padded

VDKString & VDKString::RPad ( unsigned int  len,
const char  car 
)

Pad right of string with a specified char 'car' upon 'len' length. Modifies and returns the resulting VDKString.

Parameters:
len length of the resulting string
car char to be padded

VDKString & VDKString::DoubleChar ( const char  car = '\''  ) 

Double all 'car' chars in the string (for SQL purpose). Modifies and returns the resulting VDKString.

Parameters:
car char to be doubled, '\'' (cote) by default
VDKString s = "Don't do that";
VDKString p = s;
p.DoublaChar(); // p value is "Don''t do that"

VDKString & VDKString::FormatDate ( const char  sep,
int  orig,
int  ret 
)

Returns a VDKString containing a formatted date according to parameters settings. Modifies and returns the resulting VDKString.

Warning:
Only complete dates are supported. That's to say days and months on two digits and years on 4 digits. For ex. : 02/03/2000.
Parameters:
sep desired separator. If 0, no separator left
orig date style staying in VDKString buffer
ret date style to return
VDKString s = "12/25/2000";
VDKString p = s;
p.FormatDate(0, ENG_DATE, INT_DATE); // p value is "20001225"

VDKString s = "12/25/2000";
VDKString p = s;
p.FormatDate('-', ENG_DATE, EUR_DATE); // p value is "25-12-2000"


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

Generated on Tue May 6 03:40:11 2008 for vdk 2.4.0 by  doxygen 1.5.5