xvr2::BasicString< _charT > Class Template Reference

#include <BasicString.h>

Inheritance diagram for xvr2::BasicString< _charT >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class _charT>
class xvr2::BasicString< _charT >

Abstract string base class.

Todo:
Add wide-characters support.

Definition at line 27 of file BasicString.h.


Public Member Functions

 ~BasicString ()
virtual int index (const _charT *s)
 Returns the location (from left to right) of the first ocurrence of s.
virtual int index (const _charT *s) const
 Returns the location (from left to right) of the first ocurrence of s.
virtual int index (const BasicString< _charT > &s)
 Returns the location (from left to right) of the first ocurrence of s.
virtual int rindex (const _charT *s)
 Returns the location (from right to left) of the first ocurrence of s.
virtual int rindex (const _charT *s) const
 Returns the location (from right to left) of the first ocurrence of s.
virtual int rindex (const BasicString< _charT > &s)
 Returns the location (from right to left) of the first ocurrence of s.
BasicString< _charT > & biteLeft (UInt32 howmany=1)
 Erases an amount of characters starting from the left.
BasicString< _charT > & biteRight (UInt32 howmany=1)
 Erases an amount of characters starting from right to left.
BasicString< _charT > & deleteFirst ()
 Erases the first character from the string itself.
BasicString< _charT > & deleteLast ()
 Erases the last character from the string itself.
virtual BasicString< _charT > & trimLeft (const _charT c= ' ')
 Erases all contiguous occurrences of a specified character from the beginning of the string to the right.
virtual BasicString< _charT > & trimRight (const _charT c= ' ')
 Erases all contiguous occurrences of a specified character from the end of the string to the left.
virtual BasicString< _charT > & trim (const _charT c= ' ')
 Combines BasicString::trimLeft and BasicString::trimRight.
virtual bool equals (const _charT *s)
 Verifies if the string is EXACTLY the same as the given argument.
virtual bool equals (const BasicString< _charT > &s)
 Verifies if the string is EXACTLY the same as the given argument.
virtual bool equals (const BasicString< _charT > &s) const
 Verifies if the string is EXACTLY the same as the given argument.
virtual bool operator== (const _charT *s)
 Verifies if the string is EXACTLY the same as the given argument.
virtual bool operator== (const BasicString< _charT > &s)
 Verifies if the string is EXACTLY the same as the given argument.
void deleteString ()
 Deletes the string contents.
const _charT * toCharPtr () const
 Converts the string to an array of characters.
const _charT * toCharPtr ()
 Converts the string to an array of characters.
const _charT charAt (int i) const
 Gets the character located at the given position.
const _charT charAt (int i)
 Gets the character located at the given position.
const _charT operator[] (int i)
 Gets the character located at the given position.
const _charT operator[] (int i) const
 Gets the character located at the given position.
bool startsWith (const _charT *s) const
 Tells if the string starts with the given substring.
bool endsWith (const _charT *s) const
 Tells if the string ends with the given substring.
BasicString< _charT > & deleteCharAt (int pos)
 Erases a character at the given position.
BasicString< _charT > & insertCharAt (const int pos, const _charT c)
 Insert a specifig character at the given position.
BasicString< _charT > getSubstr (int start, int end)
 Lets you retrieve a substring from the current string.
BasicString< _charT > & replace (const _charT from, const _charT *to)
 Replaces all occurrences of a character with the given character array.
virtual const char * getClassName ()
 Returns the name of the current class.
virtual std::string toString ()

Static Public Member Functions

static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Protected Member Functions

 BasicString ()
 BasicString (const _charT *s)

Protected Attributes

std::string __cls_name

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

template<class _charT>
xvr2::BasicString< _charT >::BasicString (  )  [inline, protected]

Definition at line 29 of file BasicString.h.

template<class _charT>
xvr2::BasicString< _charT >::BasicString ( const _charT *  s  )  [inline, protected]

Definition at line 31 of file BasicString.h.

template<class _charT>
xvr2::BasicString< _charT >::~BasicString (  )  [inline]

Definition at line 35 of file BasicString.h.


Member Function Documentation

template<class _charT>
virtual int xvr2::BasicString< _charT >::index ( const _charT *  s  )  [inline, virtual]

Returns the location (from left to right) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 42 of file BasicString.h.

template<class _charT>
virtual int xvr2::BasicString< _charT >::index ( const _charT *  s  )  const [inline, virtual]

Returns the location (from left to right) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 51 of file BasicString.h.

template<class _charT>
virtual int xvr2::BasicString< _charT >::index ( const BasicString< _charT > &  s  )  [inline, virtual]

Returns the location (from left to right) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 60 of file BasicString.h.

template<class _charT>
virtual int xvr2::BasicString< _charT >::rindex ( const _charT *  s  )  [inline, virtual]

Returns the location (from right to left) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 69 of file BasicString.h.

template<class _charT>
virtual int xvr2::BasicString< _charT >::rindex ( const _charT *  s  )  const [inline, virtual]

Returns the location (from right to left) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 78 of file BasicString.h.

template<class _charT>
virtual int xvr2::BasicString< _charT >::rindex ( const BasicString< _charT > &  s  )  [inline, virtual]

Returns the location (from right to left) of the first ocurrence of s.

Parameters:
s The substring to search for.
Returns:
The position where the substring is or BasicString::npos if the substring was not contained in the string itself.

Definition at line 87 of file BasicString.h.

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::biteLeft ( UInt32  howmany = 1  )  [inline]

Erases an amount of characters starting from the left.

Parameters:
howmany The amount of chars to be deleted from the beginning of the string.
Returns:
A reference to string after modified.

Definition at line 94 of file BasicString.h.

Referenced by xvr2::BasicString< char >::deleteFirst().

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::biteRight ( UInt32  howmany = 1  )  [inline]

Erases an amount of characters starting from right to left.

Parameters:
howmany The amount of chars to be deleted from the the last portions of the string backwards.
Returns:
A reference to string after modified.

Definition at line 111 of file BasicString.h.

Referenced by xvr2::BasicString< char >::deleteLast().

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::deleteFirst (  )  [inline]

Erases the first character from the string itself.

Returns:
A reference to string after modified.

Definition at line 125 of file BasicString.h.

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::deleteLast (  )  [inline]

Erases the last character from the string itself.

Returns:
A reference to string after modified.

Definition at line 130 of file BasicString.h.

template<class _charT>
virtual BasicString<_charT>& xvr2::BasicString< _charT >::trimLeft ( const _charT  c = ' '  )  [inline, virtual]

Erases all contiguous occurrences of a specified character from the beginning of the string to the right.

Parameters:
c The character to look for and erase.
Returns:
A reference to string after modified.

Reimplemented in xvr2::String.

Definition at line 137 of file BasicString.h.

Referenced by xvr2::BasicString< char >::trim().

template<class _charT>
virtual BasicString<_charT>& xvr2::BasicString< _charT >::trimRight ( const _charT  c = ' '  )  [inline, virtual]

Erases all contiguous occurrences of a specified character from the end of the string to the left.

Parameters:
c The character to look for and erase.
Returns:
A reference to string after modified.

Reimplemented in xvr2::String.

Definition at line 151 of file BasicString.h.

Referenced by xvr2::BasicString< char >::trim().

template<class _charT>
virtual BasicString<_charT>& xvr2::BasicString< _charT >::trim ( const _charT  c = ' '  )  [inline, virtual]

Combines BasicString::trimLeft and BasicString::trimRight.

Parameters:
c The character to look for and erase.
Returns:
A reference to string after modified.

Definition at line 165 of file BasicString.h.

template<class _charT>
virtual bool xvr2::BasicString< _charT >::equals ( const _charT *  s  )  [inline, virtual]

Verifies if the string is EXACTLY the same as the given argument.

Parameters:
s The string to be compared with.
Returns:
true if both are the same, false if not.

Definition at line 174 of file BasicString.h.

template<class _charT>
virtual bool xvr2::BasicString< _charT >::equals ( const BasicString< _charT > &  s  )  [inline, virtual]

Verifies if the string is EXACTLY the same as the given argument.

Parameters:
s The string to be compared with.
Returns:
true if both are the same, false if not.

Definition at line 181 of file BasicString.h.

template<class _charT>
virtual bool xvr2::BasicString< _charT >::equals ( const BasicString< _charT > &  s  )  const [inline, virtual]

Verifies if the string is EXACTLY the same as the given argument.

Parameters:
s The string to be compared with.
Returns:
true if both are the same, false if not.

Definition at line 188 of file BasicString.h.

template<class _charT>
virtual bool xvr2::BasicString< _charT >::operator== ( const _charT *  s  )  [inline, virtual]

Verifies if the string is EXACTLY the same as the given argument.

Parameters:
s The string to be compared with.
Returns:
true if both are the same, false if not.

Definition at line 195 of file BasicString.h.

template<class _charT>
virtual bool xvr2::BasicString< _charT >::operator== ( const BasicString< _charT > &  s  )  [inline, virtual]

Verifies if the string is EXACTLY the same as the given argument.

Parameters:
s The string to be compared with.
Returns:
true if both are the same, false if not.

Definition at line 202 of file BasicString.h.

template<class _charT>
void xvr2::BasicString< _charT >::deleteString (  )  [inline]

Deletes the string contents.

Definition at line 206 of file BasicString.h.

template<class _charT>
const _charT* xvr2::BasicString< _charT >::toCharPtr (  )  const [inline]

Converts the string to an array of characters.

Returns:
A const pointer to the internal character array.

Definition at line 211 of file BasicString.h.

Referenced by xvr2::Net::URI::_cmpf::operator()().

template<class _charT>
const _charT* xvr2::BasicString< _charT >::toCharPtr (  )  [inline]

Converts the string to an array of characters.

Returns:
A const pointer to the internal character array.

Definition at line 216 of file BasicString.h.

template<class _charT>
const _charT xvr2::BasicString< _charT >::charAt ( int  i  )  const [inline]

Gets the character located at the given position.

Parameters:
i The position where the requested character is located at.
Returns:
the character at given position i.

Definition at line 223 of file BasicString.h.

Referenced by xvr2::BasicString< char >::replace().

template<class _charT>
const _charT xvr2::BasicString< _charT >::charAt ( int  i  )  [inline]

Gets the character located at the given position.

Parameters:
i The position where the requested character is located at.
Returns:
the character at given position i.

Definition at line 230 of file BasicString.h.

template<class _charT>
const _charT xvr2::BasicString< _charT >::operator[] ( int  i  )  [inline]

Gets the character located at the given position.

Parameters:
i The position where the requested character is located at.
Returns:
the character at given position i.

Definition at line 237 of file BasicString.h.

template<class _charT>
const _charT xvr2::BasicString< _charT >::operator[] ( int  i  )  const [inline]

Gets the character located at the given position.

Parameters:
i The position where the requested character is located at.
Returns:
the character at given position i.

Definition at line 244 of file BasicString.h.

template<class _charT>
bool xvr2::BasicString< _charT >::startsWith ( const _charT *  s  )  const [inline]

Tells if the string starts with the given substring.

Parameters:
s substring to look at the beginning.
Returns:
true if the string starts with the specified substring, false otherwise.

Definition at line 251 of file BasicString.h.

template<class _charT>
bool xvr2::BasicString< _charT >::endsWith ( const _charT *  s  )  const [inline]

Tells if the string ends with the given substring.

Parameters:
s substring to look at the end.
Returns:
true if the string ends with the specified substring, false otherwise.

Definition at line 258 of file BasicString.h.

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::deleteCharAt ( int  pos  )  [inline]

Erases a character at the given position.

Parameters:
pos The position (from left to right) where the character we want to delete is located at.
Returns:
A reference to the string after modified.

Definition at line 269 of file BasicString.h.

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::insertCharAt ( const int  pos,
const _charT  c 
) [inline]

Insert a specifig character at the given position.

Parameters:
pos The position at where we want to place the character
c The character we want to insert.
Returns:
A reference to the string after modified.

Definition at line 277 of file BasicString.h.

template<class _charT>
BasicString<_charT> xvr2::BasicString< _charT >::getSubstr ( int  start,
int  end 
) [inline]

Lets you retrieve a substring from the current string.

Parameters:
start The position where the initial part of the substring we want to extract is located at.
end The position at where the last character from our substring is located at.
Returns:
The extracted substring.

Reimplemented in xvr2::String.

Definition at line 287 of file BasicString.h.

template<class _charT>
BasicString<_charT>& xvr2::BasicString< _charT >::replace ( const _charT  from,
const _charT *  to 
) [inline]

Replaces all occurrences of a character with the given character array.

Parameters:
from The character we wish to replace.
to The array of characters wish will be used as replacement.
Returns:
A reference to the string after modified.

Definition at line 296 of file BasicString.h.

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

virtual std::string xvr2::Object::toString (  )  [virtual, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


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

Generated on Fri Jun 20 22:55:50 2008 for X-VR2 SDK by  doxygen 1.5.5