BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables | Friends

Classes

class  BALL::String
 
class  BALL::Substring
 

Functions

virtual void * BALL::String::create (bool=true, bool empty=false) const
 
BALL_EXPORT bool BALL::operator== (const String &s1, const String &s2)
 
BALL_EXPORT bool BALL::operator!= (const String &s1, const String &s2)
 
BALL_EXPORT bool BALL::operator< (const String &s1, const String &s2)
 
BALL_EXPORT bool BALL::operator<= (const String &s1, const String &s2)
 
BALL_EXPORT bool BALL::operator> (const String &s1, const String &s2)
 
BALL_EXPORT bool BALL::operator>= (const String &s1, const String &s2)
 
BALL_EXPORT String BALL::operator+ (const String &s1, const string &s2)
 Concatenates two strings. More...
 
BALL_EXPORT String BALL::operator+ (const string &s1, const String &s2)
 Concatenates two strings. More...
 
BALL_EXPORT String BALL::operator+ (const String &s1, const String &s2)
 Concatenates two strings. More...
 
BALL_EXPORT String BALL::operator+ (const String &s1, const char *char_ptr)
 Concatenates a string and a C type string. More...
 
BALL_EXPORT String BALL::operator+ (const char *char_ptr, const String &s)
 Concatenates a C type string and a string. More...
 
BALL_EXPORT String BALL::operator+ (const String &s, char c)
 Concatenates a string and a character. More...
 
BALL_EXPORT String BALL::operator+ (char c, const String &s)
 Concatenates a character and a string. More...
 

Variables

static const String BALL::String::EMPTY
 Constant empty string. More...
 

Friends

class BALL::String::Substring
 

Enums and Constants

enum  BALL::String::CompareMode { BALL::String::CASE_SENSITIVE = 0, BALL::String::CASE_INSENSITIVE = 1 }
 
static const Size BALL::String::EndPos
 
static const size_t BALL::String::npos = -1
 

Predefined character classes

There exist several predefined character classes, that may be used in several functions (e.g. trim methods) to represent a set of characters.

static const char * BALL::String::CHARACTER_CLASS__ASCII_ALPHA
 Character class containing all letters (lower and upper case) More...
 
static const char * BALL::String::CHARACTER_CLASS__ASCII_ALPHANUMERIC
 Character class containing all letters and digits. More...
 
static const char * BALL::String::CHARACTER_CLASS__ASCII_LOWER
 Character class containing all lower case letters. More...
 
static const char * BALL::String::CHARACTER_CLASS__ASCII_UPPER
 Character class containing all upper case letters. More...
 
static const char * BALL::String::CHARACTER_CLASS__ASCII_NUMERIC
 Character class containing the digits from 0 to 9. More...
 
static const char * BALL::String::CHARACTER_CLASS__ASCII_FLOAT
 Character class containing the digits from 0 to 9 and a dot. More...
 
static const char * BALL::String::CHARACTER_CLASS__WHITESPACE
 
static const char * BALL::String::CHARACTER_CLASS__QUOTES
 

Constructors and Destructors

 BALL::String::String ()
 Default Constructor. More...
 
 BALL::String::String (const string &string)
 STL string copy constructor. More...
 
 BALL::String::String (const String &s)
 Copy constructor. More...
 
 BALL::String::String (const QString &string)
 QString copy constructor. More...
 
 BALL::String::String (const QByteArray &string)
 QByteArray copy constructor. More...
 
 BALL::String::String (const String &s, Index from, Size len=EndPos)
 
 BALL::String::String (const char *char_ptr, Index from=0, Size len=EndPos)
 
 BALL::String::String (Size buffer_size, const char *format,...)
 
 BALL::String::String (std::strstream &s)
 
 BALL::String::String (const char c, Size len=1)
 
 BALL::String::String (const unsigned char uc)
 Creates a string just containing an unsigned character. More...
 
 BALL::String::String (short s)
 Construct a String from a short. More...
 
 BALL::String::String (unsigned short us)
 Construct a String from an unsigned short. More...
 
 BALL::String::String (int i)
 Construct a String from an int. More...
 
 BALL::String::String (unsigned int ui)
 Construct a String from an unsigned int. More...
 
 BALL::String::String (long l)
 Construct a String from a long. More...
 
 BALL::String::String (unsigned long)
 Construct a String from an unsigned long. More...
 
 BALL::String::String (float f)
 Construct a String from a float value. More...
 
 BALL::String::String (double d)
 Construct a String from a double value. More...
 
 BALL::String::operator string & ()
 Cast the String to a std::string reference. More...
 
 BALL::String::operator string const & () const
 Cast the String to a std::string reference, const version. More...
 
virtual BALL::String::~String ()
 Destructor. More...
 
void BALL::String::destroy ()
 Clear the string (reset to the empty string) More...
 

Assignment methods

void BALL::String::set (const String &s)
 
void BALL::String::set (const String &string, Index from, Size len=EndPos)
 
void BALL::String::set (const char *char_ptr, Index from=0, Size len=EndPos)
 
void BALL::String::set (Size buffer_size, const char *format,...)
 
void BALL::String::set (std::strstream &s)
 
void BALL::String::set (char c, Size len=1)
 Assign a String from the result of repeating c len times. More...
 
void BALL::String::set (unsigned char uc)
 Assign a String from an unsigned char. More...
 
void BALL::String::set (short s)
 Assign a String from a short. More...
 
void BALL::String::set (unsigned short us)
 Assign a String from an unsigned short. More...
 
void BALL::String::set (int i)
 Assign a String from an int. More...
 
void BALL::String::set (unsigned int ui)
 Assign a String from an unsigned int. More...
 
void BALL::String::set (long l)
 Assign a String from a long. More...
 
void BALL::String::set (unsigned long ul)
 Assign a String from an unsigned long. More...
 
void BALL::String::set (float f)
 Assign a String from a float value. More...
 
void BALL::String::set (double d)
 Assign a String from a double value. More...
 
void BALL::String::get (char *char_ptr, Index from=0, Size len=EndPos) const
 
const String & BALL::String::operator= (const String &s)
 Assign a String from another String. More...
 
const String & BALL::String::operator= (const char *pc)
 
const String & BALL::String::operator= (std::strstream &s)
 
const String & BALL::String::operator= (char c)
 Assign a String from a single char. More...
 
const String & BALL::String::operator= (unsigned char uc)
 Assign a String from an unsigned char. More...
 
const String & BALL::String::operator= (short s)
 Assign a String from a short. More...
 
const String & BALL::String::operator= (unsigned short us)
 Assign a String from an unsigned short. More...
 
const String & BALL::String::operator= (int i)
 Assign a String from an int. More...
 
const String & BALL::String::operator= (unsigned int ui)
 Assign a String from an unsigned int. More...
 
const String & BALL::String::operator= (long l)
 Assign a String from a long. More...
 
const String & BALL::String::operator= (unsigned long ul)
 Assign a String from an unsigned long. More...
 
const String & BALL::String::operator= (float f)
 Assign a String from a float. More...
 
const String & BALL::String::operator= (double d)
 Assign a String from a double. More...
 

Compare mode-related methods.

All string comparisons can be made case-sensitive or case insensitive. The behavior can be toggled globally for all strings.

static void BALL::String::setCompareMode (CompareMode compare_mode)
 Set the compareison mode for all string comparisons. More...
 
static CompareMode BALL::String::getCompareMode ()
 Return the current comparison mode. More...
 

Converters

bool BALL::String::toBool () const
 
char BALL::String::toChar () const
 Return the first character of the string. More...
 
unsigned char BALL::String::toUnsignedChar () const
 Return the first character of the string converted to an unsigned char. More...
 
short BALL::String::toShort () const
 
unsigned short BALL::String::toUnsignedShort () const
 
int BALL::String::toInt () const
 
unsigned int BALL::String::toUnsignedInt () const
 
long BALL::String::toLong () const
 
unsigned long BALL::String::toUnsignedLong () const
 
float BALL::String::toFloat () const
 
double BALL::String::toDouble () const
 

Case Conversion

void BALL::String::toLower (Index from=0, Size len=EndPos)
 
void BALL::String::toUpper (Index from=0, Size len=EndPos)
 

Substring Definition

Substring BALL::String::getSubstring (Index from=0, Size len=EndPos) const
 
Substring BALL::String::operator() (Index from, Size len=EndPos) const
 
Substring BALL::String::before (const String &s, Index from=0) const
 
Substring BALL::String::through (const String &s, Index from=0) const
 
Substring BALL::String::from (const String &s, Index from=0) const
 
Substring BALL::String::after (const String &s, Index from=0) const
 

AWK style field operations

Size BALL::String::countFields (const char *delimiters=CHARACTER_CLASS__WHITESPACE) const
 
Size BALL::String::countFieldsQuoted (const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES) const
 
String BALL::String::getField (Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index *from=0) const
 
String BALL::String::getFieldQuoted (Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index *from=0) const
 
Size BALL::String::split (String string_array[], Size array_size, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
 
Size BALL::String::split (std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
 
Size BALL::String::splitQuoted (std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index from=0) const
 

BASIC style string operations

String & BALL::String::trimLeft (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
 
String & BALL::String::trimRight (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
 
String & BALL::String::trim (const char *trimmed=CHARACTER_CLASS__WHITESPACE)
 
String BALL::String::trim (const char *trimmed=CHARACTER_CLASS__WHITESPACE) const
 
String & BALL::String::truncate (Size size)
 Truncate the string to length size More...
 
Substring BALL::String::left (Size len) const
 Return a substring containing the len leftmost characters of the string. More...
 
Substring BALL::String::right (Size len) const
 Return a substring containing the len rightmost characters of the string. More...
 
Substring BALL::String::instr (const String &pattern, Index from=0) const
 

String Operations

BALL_EXPORT friend String BALL::String::operator+ (const String &s1, const string &s2)
 Concatenates two strings. More...
 
BALL_EXPORT friend String BALL::String::operator+ (const string &s1, const String &s2)
 Concatenates two strings. More...
 
BALL_EXPORT friend String BALL::String::operator+ (const String &s1, const String &s2)
 Concatenates two strings. More...
 
BALL_EXPORT friend String BALL::String::operator+ (const String &s1, const char *char_ptr)
 Concatenates a string and a C type string. More...
 
BALL_EXPORT friend String BALL::String::operator+ (const char *char_ptr, const String &s)
 Concatenates a C type string and a string. More...
 
BALL_EXPORT friend String BALL::String::operator+ (const String &s, char c)
 Concatenates a string and a character. More...
 
BALL_EXPORT friend String BALL::String::operator+ (char c, const String &s)
 Concatenates a character and a string. More...
 
void BALL::String::swap (String &s)
 Swaps the contents with another String. More...
 
String & BALL::String::reverse (Index from=0, Size len=EndPos)
 
Size BALL::String::substitute (const String &to_replace, const String &replacing)
 
void BALL::String::substituteAll (const String &to_replace, const String &replacing)
 
const char * BALL::String::c_str () const BALL_NOEXCEPT
 
const char * BALL::String::data () const BALL_NOEXCEPT
 
allocator_type BALL::String::get_allocator () const BALL_NOEXCEPT
 
size_t BALL::String::copy (char *s, size_t len, size_t pos=0) const
 
size_t BALL::String::find (const string &str, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::find (const char *s, size_t pos=0) const
 
size_t BALL::String::find (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::find (char c, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::rfind (const string &str, size_t pos=npos) const BALL_NOEXCEPT
 
size_t BALL::String::rfind (const char *s, size_t pos=npos) const
 
size_t BALL::String::rfind (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::rfind (char c, size_t pos=npos) const BALL_NOEXCEPT
 
size_t BALL::String::find_first_of (const string &str, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::find_first_of (const char *s, size_t pos=0) const
 
size_t BALL::String::find_first_of (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::find_first_of (char c, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::find_last_of (const string &str, size_t pos=npos) const BALL_NOEXCEPT
 
size_t BALL::String::find_last_of (const char *s, size_t pos=npos) const
 
size_t BALL::String::find_last_of (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::find_last_of (char c, size_t pos=npos) const BALL_NOEXCEPT
 
size_t BALL::String::find_first_not_of (const string &str, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::find_first_not_of (const char *s, size_t pos=0) const
 
size_t BALL::String::find_first_not_of (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::find_first_not_of (char c, size_t pos=0) const BALL_NOEXCEPT
 
size_t BALL::String::find_last_not_of (const string &str, size_t pos=npos) const BALL_NOEXCEPT
 
size_t BALL::String::find_last_not_of (const char *s, size_t pos=npos) const
 
size_t BALL::String::find_last_not_of (const char *s, size_t pos, size_t n) const
 
size_t BALL::String::find_last_not_of (char c, size_t pos=npos) const BALL_NOEXCEPT
 
string BALL::String::substr (size_t pos=0, size_t len=npos) const
 
int BALL::String::compare (const string &str) const BALL_NOEXCEPT
 
int BALL::String::compare (size_t pos, size_t len, const string &str) const
 
int BALL::String::compare (size_t pos, size_t len, const string &str, size_t subpos, size_t sublen) const
 
int BALL::String::compare (size_t pos, size_t len, const char *s) const
 
int BALL::String::compare (size_t pos, size_t len, const char *s, size_t n) const
 

Predicates

bool BALL::String::has (char c) const
 True, if the string contains character c More...
 
bool BALL::String::hasSubstring (const String &s, Index from=0) const
 True, if the string contains the substring s after index from More...
 
bool BALL::String::hasPrefix (const String &s) const
 True, if the string starts with s More...
 
bool BALL::String::hasSuffix (const String &s) const
 True, if the string ends with s More...
 
bool BALL::String::isEmpty () const
 True, if the string has size 0. More...
 
bool BALL::String::isAlpha () const
 
bool BALL::String::isAlnum () const
 
bool BALL::String::isDigit () const
 
bool BALL::String::isFloat () const
 
bool BALL::String::isSpace () const
 
bool BALL::String::isWhitespace () const
 
static bool BALL::String::isAlpha (char c)
 True, if the character is a letter (any case) More...
 
static bool BALL::String::isAlnum (char c)
 True, if the character is a letter or a digit. More...
 
static bool BALL::String::isDigit (char c)
 True, if the character is a digit. More...
 
static bool BALL::String::isSpace (char c)
 True, if the character is a space. More...
 
static bool BALL::String::isWhitespace (char c)
 

Base64 String methods

String BALL::String::encodeBase64 ()
 Convert a string to a base 64 string. More...
 
String BALL::String::decodeBase64 ()
 

Comparators

BALL_EXPORT friend bool BALL::String::operator== (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator!= (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator< (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator<= (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator> (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator>= (const String &s1, const String &s2)
 
BALL_EXPORT friend bool BALL::String::operator== (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator!= (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator< (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator<= (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator> (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator>= (const char *char_ptr, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator== (char c, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator!= (char c, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator< (char c, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator<= (char c, const String &string)
 
BALL_EXPORT friend bool BALL::String::operator> (char c, const String &string)
 
bool BALL::String::operator>= (char c, const String &string)
 
int BALL::String::compare (const String &string, Index from=0) const
 
int BALL::String::compare (const String &string, Index from, Size len) const
 
int BALL::String::compare (const char *char_ptr, Index from=0) const
 
int BALL::String::compare (const char *char_ptr, Index from, Size len) const
 
int BALL::String::compare (char c, Index from=0) const
 
bool BALL::String::operator== (const char *char_ptr) const
 
bool BALL::String::operator!= (const char *char_ptr) const
 
bool BALL::String::operator< (const char *char_ptr) const
 
bool BALL::String::operator<= (const char *char_ptr) const
 
bool BALL::String::operator> (const char *char_ptr) const
 
bool BALL::String::operator>= (const char *char_ptr) const
 
bool BALL::String::operator== (char c) const
 
bool BALL::String::operator!= (char c) const
 
bool BALL::String::operator< (char c) const
 
bool BALL::String::operator<= (char c) const
 
bool BALL::String::operator> (char c) const
 
bool BALL::String::operator>= (char c) const
 

Debugging and Diagnostics

bool BALL::String::isValid () const
 
void BALL::String::dump (std::ostream &s=std::cout, Size depth=0) const
 

Stream Operations

std::istream & BALL::String::getline (std::istream &s=std::cin, char delimiter= '\n')
 
typedef string::value_type BALL::String::valuetype
 
typedef string::traits_type BALL::String::traits_type
 
typedef string::allocator_type BALL::String::allocator_type
 
typedef string::reference BALL::String::reference
 
typedef string::const_reference BALL::String::const_reference
 
typedef string::pointer BALL::String::pointer
 
typedef string::const_pointer BALL::String::const_pointer
 
typedef string::iterator BALL::String::iterator
 
typedef string::const_iterator BALL::String::const_iterator
 
typedef string::reverse_iterator BALL::String::reverse_iterator
 
typedef
string::const_reverse_iterator 
BALL::String::const_reverse_iterator
 
typedef string::difference_type BALL::String::difference_type
 
typedef string::size_type BALL::String::size_type
 

Iterators

iterator BALL::String::begin () BALL_NOEXCEPT
 
const_iterator BALL::String::begin () const BALL_NOEXCEPT
 
iterator BALL::String::end () BALL_NOEXCEPT
 
const_iterator BALL::String::end () const BALL_NOEXCEPT
 
reverse_iterator BALL::String::rbegin () BALL_NOEXCEPT
 
const_reverse_iterator BALL::String::rbegin () const BALL_NOEXCEPT
 
reverse_iterator BALL::String::rend () BALL_NOEXCEPT
 
const_reverse_iterator BALL::String::rend () const BALL_NOEXCEPT
 

Capacity

size_t BALL::String::size () const BALL_NOEXCEPT
 
size_t BALL::String::length () const BALL_NOEXCEPT
 
size_t BALL::String::max_size () const BALL_NOEXCEPT
 
void BALL::String::resize (size_t n)
 
void BALL::String::resize (size_t n, char c)
 
size_t BALL::String::capacity () const BALL_NOEXCEPT
 
void BALL::String::reserve (size_t n=0)
 
void BALL::String::clear () BALL_NOEXCEPT
 
bool BALL::String::empty () const BALL_NOEXCEPT
 

Element Access

char & BALL::String::operator[] (size_t pos)
 
const char & BALL::String::operator[] (size_t pos) const
 
char & BALL::String::at (size_t pos)
 
const char & BALL::String::at (size_t pos) const
 

Modifiers

String & BALL::String::operator+= (const String &str)
 
String & BALL::String::operator+= (const string &str)
 
String & BALL::String::operator+= (const char *s)
 
String & BALL::String::operator+= (char c)
 
String & BALL::String::append (const String &str)
 
String & BALL::String::append (const string &str)
 
String & BALL::String::append (const string &str, size_t subpos, size_t sublen)
 
String & BALL::String::append (const char *s)
 
String & BALL::String::append (const char *s, size_t n)
 
String & BALL::String::append (size_t n, char c)
 
template<class InputIterator >
String & BALL::String::append (InputIterator first, InputIterator last)
 
void BALL::String::push_back (char c)
 
String & BALL::String::assign (const String &str)
 
String & BALL::String::assign (const string &str)
 
String & BALL::String::assign (const string &str, size_t subpos, size_t sublen)
 
String & BALL::String::assign (const char *s)
 
String & BALL::String::assign (const char *s, size_t n)
 
String & BALL::String::assign (size_t n, char c)
 
template<class InputIterator >
String & BALL::String::assign (InputIterator first, InputIterator last)
 
String & BALL::String::insert (size_t pos, const string &str)
 
String & BALL::String::insert (size_t pos, const string &str, size_t subpos, size_t sublen)
 
String & BALL::String::insert (size_t pos, const char *s)
 
String & BALL::String::insert (size_t pos, const char *s, size_t n)
 
String & BALL::String::insert (size_t pos, size_t n, char c)
 
void BALL::String::insert (iterator p, size_t n, char c)
 
iterator BALL::String::insert (iterator p, char c)
 
template<class InputIterator >
iterator BALL::String::insert (iterator p, InputIterator first, InputIterator last)
 
String & BALL::String::erase (size_t pos=0, size_t len=npos)
 
iterator BALL::String::erase (iterator p)
 
iterator BALL::String::erase (iterator first, iterator last)
 
String & BALL::String::replace (size_t pos, size_t len, const string &str)
 
String & BALL::String::replace (size_t pos, size_t len, const string &str, size_t subpos, size_t sublen)
 
String & BALL::String::replace (size_t pos, size_t len, const char *s)
 
String & BALL::String::replace (size_t pos, size_t len, const char *s, size_t n)
 
String & BALL::String::replace (size_t pos, size_t len, size_t n, char c)
 
String & BALL::String::replace (iterator i1, iterator i2, const string &str)
 
String & BALL::String::replace (iterator i1, iterator i2, const char *s)
 
String & BALL::String::replace (iterator i1, iterator i2, const char *s, size_t n)
 
String & BALL::String::replace (iterator i1, iterator i2, size_t n, char c)
 
template<class InputIterator >
String & BALL::String::replace (iterator i1, iterator i2, InputIterator first, InputIterator last)
 
void BALL::String::swap (string &str)
 

Detailed Description

An improved version of STL string.

Typedef Documentation

typedef string::allocator_type BALL::String::allocator_type

Definition at line 1036 of file string.h.

typedef string::const_iterator BALL::String::const_iterator

Definition at line 1042 of file string.h.

typedef string::const_pointer BALL::String::const_pointer

Definition at line 1040 of file string.h.

typedef string::const_reference BALL::String::const_reference

Definition at line 1038 of file string.h.

typedef string::const_reverse_iterator BALL::String::const_reverse_iterator

Definition at line 1044 of file string.h.

typedef string::difference_type BALL::String::difference_type

Definition at line 1045 of file string.h.

typedef string::iterator BALL::String::iterator

Definition at line 1041 of file string.h.

typedef string::pointer BALL::String::pointer

Definition at line 1039 of file string.h.

typedef string::reference BALL::String::reference

Definition at line 1037 of file string.h.

typedef string::reverse_iterator BALL::String::reverse_iterator

Definition at line 1043 of file string.h.

typedef string::size_type BALL::String::size_type

Definition at line 1046 of file string.h.

typedef string::traits_type BALL::String::traits_type

Definition at line 1035 of file string.h.

typedef string::value_type BALL::String::valuetype

@ std::string compatibility layername typedefs

Definition at line 1034 of file string.h.

Enumeration Type Documentation

Constants to set the compare mode. Use one of these constants to set the mode you need. These modes affect all compare methods. As these methods are also used in the implementation of comparison operators, all comparison operations will get affected from a change.

You may change the comparison mode by invoking setCompareMode.
Enumerator
CASE_SENSITIVE 

Constant to set to case sensitive comparisons (default)

CASE_INSENSITIVE 

Constant to set to case insensitive comparisons.

Definition at line 85 of file string.h.

Function Documentation

BALL::String::String ( )

Default Constructor.

BALL::String::String ( const string &  string)

STL string copy constructor.

BALL::String::String ( const String s)

Copy constructor.

BALL::String::String ( const QString &  string)
explicit

QString copy constructor.

BALL::String::String ( const QByteArray &  string)
explicit

QByteArray copy constructor.

BALL::String::String ( const String s,
Index  from,
Size  len = EndPos 
)

Creates a new string from a given range of another string.

See also
String:Indices
Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
BALL::String::String ( const char *  char_ptr,
Index  from = 0,
Size  len = EndPos 
)

Creates a new string from a C type string. The new string contains the contents of s until it has reached a length of len or contains a zero character (whichever comes first). Default value for len is EndPos, meaning as long as possible.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
Exception::NullPointerif char_ptr == NULL
BALL::String::String ( Size  buffer_size,
const char *  format,
  ... 
)

Creates a string using sprintf. This constructor creates a new string and sets its content to the result of a call to sprintf using format as a format string and all additional parameters as arguments.

The result of the sprintf call is intermediately written to a buffer of a maximum size of buffer_size characters, so choose an appropriate size for this variables.
Exceptions
IndexUnderflow,ifthe buffer size specified is not larger than 0
NullPointer,ifformat == 0
BALL::String::String ( std::strstream &  s)

Create a new string from the contents of a stringstream. The contents of the stringstream are not modified, i.e. successive construction of multiple strings from the same stringstream object leads to identical copies.

BALL::String::String ( const char  c,
Size  len = 1 
)

Creates a new string from len copies of c.

BALL::String::String ( const unsigned char  uc)

Creates a string just containing an unsigned character.

BALL::String::String ( short  s)

Construct a String from a short.

BALL::String::String ( unsigned short  us)

Construct a String from an unsigned short.

BALL::String::String ( int  i)

Construct a String from an int.

BALL::String::String ( unsigned int  ui)

Construct a String from an unsigned int.

BALL::String::String ( long  l)

Construct a String from a long.

BALL::String::String ( unsigned  long)

Construct a String from an unsigned long.

BALL::String::String ( float  f)

Construct a String from a float value.

BALL::String::String ( double  d)

Construct a String from a double value.

virtual BALL::String::~String ( )
virtual

Destructor.

Substring BALL::String::after ( const String s,
Index  from = 0 
) const

Return a substring containing the string after the first occurence of s.

String& BALL::String::append ( const String str)
String& BALL::String::append ( const string &  str)
String& BALL::String::append ( const string &  str,
size_t  subpos,
size_t  sublen 
)
String& BALL::String::append ( const char *  s)
String& BALL::String::append ( const char *  s,
size_t  n 
)
String& BALL::String::append ( size_t  n,
char  c 
)
template<class InputIterator >
String& BALL::String::append ( InputIterator  first,
InputIterator  last 
)
String& BALL::String::assign ( const String str)
String& BALL::String::assign ( const string &  str)
String& BALL::String::assign ( const string &  str,
size_t  subpos,
size_t  sublen 
)
String& BALL::String::assign ( const char *  s)
String& BALL::String::assign ( const char *  s,
size_t  n 
)
String& BALL::String::assign ( size_t  n,
char  c 
)
template<class InputIterator >
String& BALL::String::assign ( InputIterator  first,
InputIterator  last 
)
char& BALL::String::at ( size_t  pos)
const char& BALL::String::at ( size_t  pos) const
Substring BALL::String::before ( const String s,
Index  from = 0 
) const

Return a substring containing the string before the first occurence of s

iterator BALL::String::begin ( )
const_iterator BALL::String::begin ( ) const
const char* BALL::String::c_str ( ) const
size_t BALL::String::capacity ( ) const
void BALL::String::clear ( )
int BALL::String::compare ( const String string,
Index  from = 0 
) const

compare to a string.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
int BALL::String::compare ( const String string,
Index  from,
Size  len 
) const

compare to a string.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
int BALL::String::compare ( const char *  char_ptr,
Index  from = 0 
) const

compare to c-style string.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
Exception::NullPointerif char_ptr == NULL
int BALL::String::compare ( const char *  char_ptr,
Index  from,
Size  len 
) const

compare to c-style string.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
Exception::NullPointerif char_ptr == NULL
int BALL::String::compare ( char  c,
Index  from = 0 
) const

compare to character

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
int BALL::String::compare ( const string &  str) const
int BALL::String::compare ( size_t  pos,
size_t  len,
const string &  str 
) const
int BALL::String::compare ( size_t  pos,
size_t  len,
const string &  str,
size_t  subpos,
size_t  sublen 
) const
int BALL::String::compare ( size_t  pos,
size_t  len,
const char *  s 
) const
int BALL::String::compare ( size_t  pos,
size_t  len,
const char *  s,
size_t  n 
) const
size_t BALL::String::copy ( char *  s,
size_t  len,
size_t  pos = 0 
) const
Size BALL::String::countFields ( const char *  delimiters = CHARACTER_CLASS__WHITESPACE) const

Count the fields that are separated by a defined set of delimiters

Exceptions
Exception::NullPointerif delimiters == NULL
Size BALL::String::countFieldsQuoted ( const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
const char *  quotes = CHARACTER_CLASS__QUOTES 
) const

Count the fields and respect quote characters.

Exceptions
Exception::NullPointerif delimiters == NULL or quotes == NULL
virtual void* BALL::String::create ( bool  = true,
bool  empty = false 
) const
virtual
const char* BALL::String::data ( ) const
String BALL::String::decodeBase64 ( )

Decode a base 64 string. Return an empty string, if base64 string is not right encoded.

void BALL::String::destroy ( )

Clear the string (reset to the empty string)

void BALL::String::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const
bool BALL::String::empty ( ) const
String BALL::String::encodeBase64 ( )

Convert a string to a base 64 string.

iterator BALL::String::end ( )
const_iterator BALL::String::end ( ) const
String& BALL::String::erase ( size_t  pos = 0,
size_t  len = npos 
)
iterator BALL::String::erase ( iterator  p)
iterator BALL::String::erase ( iterator  first,
iterator  last 
)
size_t BALL::String::find ( const string &  str,
size_t  pos = 0 
) const
size_t BALL::String::find ( const char *  s,
size_t  pos = 0 
) const
size_t BALL::String::find ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::find ( char  c,
size_t  pos = 0 
) const
size_t BALL::String::find_first_not_of ( const string &  str,
size_t  pos = 0 
) const
size_t BALL::String::find_first_not_of ( const char *  s,
size_t  pos = 0 
) const
size_t BALL::String::find_first_not_of ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::find_first_not_of ( char  c,
size_t  pos = 0 
) const
size_t BALL::String::find_first_of ( const string &  str,
size_t  pos = 0 
) const
size_t BALL::String::find_first_of ( const char *  s,
size_t  pos = 0 
) const
size_t BALL::String::find_first_of ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::find_first_of ( char  c,
size_t  pos = 0 
) const
size_t BALL::String::find_last_not_of ( const string &  str,
size_t  pos = npos 
) const
size_t BALL::String::find_last_not_of ( const char *  s,
size_t  pos = npos 
) const
size_t BALL::String::find_last_not_of ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::find_last_not_of ( char  c,
size_t  pos = npos 
) const
size_t BALL::String::find_last_of ( const string &  str,
size_t  pos = npos 
) const
size_t BALL::String::find_last_of ( const char *  s,
size_t  pos = npos 
) const
size_t BALL::String::find_last_of ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::find_last_of ( char  c,
size_t  pos = npos 
) const
Substring BALL::String::from ( const String s,
Index  from = 0 
) const

Return a substring containing the string from the first occurence of s on

void BALL::String::get ( char *  char_ptr,
Index  from = 0,
Size  len = EndPos 
) const

Assign to a C type string The resulting string contains the contents of this until it has reached a length of len or contains a zero character (whichever comes first). Default value for len is EndPos, meaning as long as possible.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
Exception::NullPointerif char_ptr == NULL
allocator_type BALL::String::get_allocator ( ) const
static CompareMode BALL::String::getCompareMode ( )
static

Return the current comparison mode.

String BALL::String::getField ( Index  index,
const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
Index from = 0 
) const

Return a given field as a substring

Exceptions
Exception::IndexUnderflowif from < 0
Exception::NullPointerif delimiters == NULL
String BALL::String::getFieldQuoted ( Index  index,
const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
const char *  quotes = CHARACTER_CLASS__QUOTES,
Index from = 0 
) const

Return a given field and respect quote characters.

Exceptions
Exception::IndexUnderflowif from < 0
Exception::NullPointerif delimiters == NULL
std::istream& BALL::String::getline ( std::istream &  s = std::cin,
char  delimiter = '\n' 
)
Substring BALL::String::getSubstring ( Index  from = 0,
Size  len = EndPos 
) const

Return a substring

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
bool BALL::String::has ( char  c) const

True, if the string contains character c

bool BALL::String::hasPrefix ( const String s) const

True, if the string starts with s

bool BALL::String::hasSubstring ( const String s,
Index  from = 0 
) const

True, if the string contains the substring s after index from

bool BALL::String::hasSuffix ( const String s) const

True, if the string ends with s

String& BALL::String::insert ( size_t  pos,
const string &  str 
)
String& BALL::String::insert ( size_t  pos,
const string &  str,
size_t  subpos,
size_t  sublen 
)
String& BALL::String::insert ( size_t  pos,
const char *  s 
)
String& BALL::String::insert ( size_t  pos,
const char *  s,
size_t  n 
)
String& BALL::String::insert ( size_t  pos,
size_t  n,
char  c 
)
void BALL::String::insert ( iterator  p,
size_t  n,
char  c 
)
iterator BALL::String::insert ( iterator  p,
char  c 
)
template<class InputIterator >
iterator BALL::String::insert ( iterator  p,
InputIterator  first,
InputIterator  last 
)
Substring BALL::String::instr ( const String pattern,
Index  from = 0 
) const

Return a substring containing the first occurence of pattern in the string. If the pattern is not contained in the string, an empty Substring is returned. The search for the pattern may also start from an index different from zero, allowing incremental search.

Returns
Substring containing the search pattern, empty if not found
Parameters
patternthe search pattern
fromthe index in the string to start the search from
bool BALL::String::isAlnum ( ) const

True, if the string only contains letters and digits. It returns also true, if called for an empty string.

static bool BALL::String::isAlnum ( char  c)
static

True, if the character is a letter or a digit.

bool BALL::String::isAlpha ( ) const

True, if the string only contains letters (any case). It returns also true, if called for an empty string.

static bool BALL::String::isAlpha ( char  c)
static

True, if the character is a letter (any case)

bool BALL::String::isDigit ( ) const

True, if the string only contains digits. It returns also true, if called for an empty string.

static bool BALL::String::isDigit ( char  c)
static

True, if the character is a digit.

bool BALL::String::isEmpty ( ) const

True, if the string has size 0.

bool BALL::String::isFloat ( ) const

True, if the string is a floating number. (It contains only numbers and maybe a dot). It returns also true, if called for an empty string.

bool BALL::String::isSpace ( ) const

True, if the string only contains spaces. It returns also true, if called for an empty string.

static bool BALL::String::isSpace ( char  c)
static

True, if the character is a space.

bool BALL::String::isValid ( ) const
bool BALL::String::isWhitespace ( ) const

True, if the string only contains whitespace characters. Whitespaces are defined in CHARACTER_CLASS__WHITESPACE. It returns also true, if called for an empty string.

static bool BALL::String::isWhitespace ( char  c)
static

True, if the character is any whitespace character. Whitespaces are defined in CHARACTER_CLASS__WHITESPACE

Substring BALL::String::left ( Size  len) const

Return a substring containing the len leftmost characters of the string.

size_t BALL::String::length ( ) const
size_t BALL::String::max_size ( ) const
BALL::String::operator string & ( )

Cast the String to a std::string reference.

BALL::String::operator string const & ( ) const

Cast the String to a std::string reference, const version.

bool BALL::String::operator!= ( const char *  char_ptr) const

Inequality operator.

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator!= ( char  c) const
BALL_EXPORT bool BALL::operator!= ( const String &  s1,
const String &  s2 
)

Inequality operator.

Substring BALL::String::operator() ( Index  from,
Size  len = EndPos 
) const

Return a substring

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
BALL_EXPORT String BALL::operator+ ( const String &  s1,
const string &  s2 
)

Concatenates two strings.

BALL_EXPORT String BALL::operator+ ( const string &  s1,
const String &  s2 
)

Concatenates two strings.

BALL_EXPORT String BALL::operator+ ( const String &  s1,
const String &  s2 
)

Concatenates two strings.

BALL_EXPORT String BALL::operator+ ( const String &  s1,
const char *  char_ptr 
)

Concatenates a string and a C type string.

BALL_EXPORT String BALL::operator+ ( const char *  char_ptr,
const String &  s 
)

Concatenates a C type string and a string.

BALL_EXPORT String BALL::operator+ ( const String &  s,
char  c 
)

Concatenates a string and a character.

BALL_EXPORT String BALL::operator+ ( char  c,
const String &  s 
)

Concatenates a character and a string.

String& BALL::String::operator+= ( const String str)
String& BALL::String::operator+= ( const string &  str)
String& BALL::String::operator+= ( const char *  s)
String& BALL::String::operator+= ( char  c)
bool BALL::String::operator< ( const char *  char_ptr) const

Less than comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator< ( char  c) const
BALL_EXPORT bool BALL::operator< ( const String &  s1,
const String &  s2 
)

Less than comparison

bool BALL::String::operator<= ( const char *  char_ptr) const

Less than or equal comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator<= ( char  c) const
BALL_EXPORT bool BALL::operator<= ( const String &  s1,
const String &  s2 
)

Less than or equal comparison

const String& BALL::String::operator= ( const String s)

Assign a String from another String.

const String& BALL::String::operator= ( const char *  pc)

Assign a String from a C type string

Exceptions
Exception::NullPointerif pc == NULL
const String& BALL::String::operator= ( std::strstream &  s)

Assign a string from a stringstream. The contents of the stringstream object are not modified.

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

Assign a String from a single char.

const String& BALL::String::operator= ( unsigned char  uc)

Assign a String from an unsigned char.

const String& BALL::String::operator= ( short  s)

Assign a String from a short.

const String& BALL::String::operator= ( unsigned short  us)

Assign a String from an unsigned short.

const String& BALL::String::operator= ( int  i)

Assign a String from an int.

const String& BALL::String::operator= ( unsigned int  ui)

Assign a String from an unsigned int.

const String& BALL::String::operator= ( long  l)

Assign a String from a long.

const String& BALL::String::operator= ( unsigned long  ul)

Assign a String from an unsigned long.

const String& BALL::String::operator= ( float  f)

Assign a String from a float.

const String& BALL::String::operator= ( double  d)

Assign a String from a double.

bool BALL::String::operator== ( const char *  char_ptr) const

Equality operator.

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator== ( char  c) const
BALL_EXPORT bool BALL::operator== ( const String &  s1,
const String &  s2 
)

Equality operator.

bool BALL::String::operator> ( const char *  char_ptr) const

Greater than comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator> ( char  c) const
BALL_EXPORT bool BALL::operator> ( const String &  s1,
const String &  s2 
)

Greater than comparison

bool BALL::String::operator>= ( const char *  char_ptr) const

Greater than or equal comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
bool BALL::String::operator>= ( char  c) const
BALL_EXPORT bool BALL::operator>= ( const String &  s1,
const String &  s2 
)

Greater than or equal comparison

char& BALL::String::operator[] ( size_t  pos)
const char& BALL::String::operator[] ( size_t  pos) const
void BALL::String::push_back ( char  c)
reverse_iterator BALL::String::rbegin ( )
const_reverse_iterator BALL::String::rbegin ( ) const
reverse_iterator BALL::String::rend ( )
const_reverse_iterator BALL::String::rend ( ) const
String& BALL::String::replace ( size_t  pos,
size_t  len,
const string &  str 
)
String& BALL::String::replace ( size_t  pos,
size_t  len,
const string &  str,
size_t  subpos,
size_t  sublen 
)
String& BALL::String::replace ( size_t  pos,
size_t  len,
const char *  s 
)
String& BALL::String::replace ( size_t  pos,
size_t  len,
const char *  s,
size_t  n 
)
String& BALL::String::replace ( size_t  pos,
size_t  len,
size_t  n,
char  c 
)
String& BALL::String::replace ( iterator  i1,
iterator  i2,
const string &  str 
)
String& BALL::String::replace ( iterator  i1,
iterator  i2,
const char *  s 
)
String& BALL::String::replace ( iterator  i1,
iterator  i2,
const char *  s,
size_t  n 
)
String& BALL::String::replace ( iterator  i1,
iterator  i2,
size_t  n,
char  c 
)
template<class InputIterator >
String& BALL::String::replace ( iterator  i1,
iterator  i2,
InputIterator  first,
InputIterator  last 
)
void BALL::String::reserve ( size_t  n = 0)
void BALL::String::resize ( size_t  n)
void BALL::String::resize ( size_t  n,
char  c 
)
String& BALL::String::reverse ( Index  from = 0,
Size  len = EndPos 
)

Reverses the string. If called without arguments, this method simply reverses the character sequence of the string. By giving arguments for the indices, only a subsequence of the string may be reversed.

Parameters
fromfirst index of the sequence to be reversed
tolast index of the sequence to be reversed
See also
String:Indices
Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
size_t BALL::String::rfind ( const string &  str,
size_t  pos = npos 
) const
size_t BALL::String::rfind ( const char *  s,
size_t  pos = npos 
) const
size_t BALL::String::rfind ( const char *  s,
size_t  pos,
size_t  n 
) const
size_t BALL::String::rfind ( char  c,
size_t  pos = npos 
) const
Substring BALL::String::right ( Size  len) const

Return a substring containing the len rightmost characters of the string.

void BALL::String::set ( const String s)

Assign a string

void BALL::String::set ( const String string,
Index  from,
Size  len = EndPos 
)

Assign a String from a range of another string

Exceptions
Exception::IndexOverflowif from < 0
Exception::IndexUnderflowif from >= size()
void BALL::String::set ( const char *  char_ptr,
Index  from = 0,
Size  len = EndPos 
)

Assign a String from a C type string

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= size()
Exception::NullPointerif char_ptr == NULL
void BALL::String::set ( Size  buffer_size,
const char *  format,
  ... 
)

Assign a string to the result of a sprintf call

Exceptions
Exception::IndexUnderflow,ifthe buffer size is zero
Exception::NullPointer,<tt>format</tt>is a NULL pointer
void BALL::String::set ( std::strstream &  s)

Assign a String from a stringstream. The contents of the stringstream object are not modified.

void BALL::String::set ( char  c,
Size  len = 1 
)

Assign a String from the result of repeating c len times.

void BALL::String::set ( unsigned char  uc)

Assign a String from an unsigned char.

void BALL::String::set ( short  s)

Assign a String from a short.

void BALL::String::set ( unsigned short  us)

Assign a String from an unsigned short.

void BALL::String::set ( int  i)

Assign a String from an int.

void BALL::String::set ( unsigned int  ui)

Assign a String from an unsigned int.

void BALL::String::set ( long  l)

Assign a String from a long.

void BALL::String::set ( unsigned long  ul)

Assign a String from an unsigned long.

void BALL::String::set ( float  f)

Assign a String from a float value.

void BALL::String::set ( double  d)

Assign a String from a double value.

static void BALL::String::setCompareMode ( CompareMode  compare_mode)
static

Set the compareison mode for all string comparisons.

size_t BALL::String::size ( ) const
Size BALL::String::split ( String  string_array[],
Size  array_size,
const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
Index  from = 0 
) const

Split the string into fields and assign these field to an array of strings

Exceptions
Exception::IndexUnderflowif from < 0
Exception::NullPointerif delimiters == NULL
Size BALL::String::split ( std::vector< String > &  strings,
const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
Index  from = 0 
) const

Split the string into fields and assign these field to a vector of strings. The vector of strings is cleared in any case. Its final size is returned.

Exceptions
IndexOverflowif from < 0
NullPointerif delimiters == 0
Size BALL::String::splitQuoted ( std::vector< String > &  strings,
const char *  delimiters = CHARACTER_CLASS__WHITESPACE,
const char *  quotes = CHARACTER_CLASS__QUOTES,
Index  from = 0 
) const

Split the string into fields and respect quote characters. Similar to split , but delimiters that are inside quote characters (default is CHARACTER_CLASS__QUOTES ) are not considered to split the string. The vector of strings is cleared in any case. Its final size is returned.

Exceptions
IndexOverflowif from < 0
NullPointerif delimiters == 0
Size BALL::String::substitute ( const String to_replace,
const String replacing 
)

Substitute the first occurence of to_replace by the content of replacing.

Returns
the first position of the substitution or EndPos if to_replace is not found
void BALL::String::substituteAll ( const String to_replace,
const String replacing 
)

Substitute all occurences of to_replace by the content of replacing.

string BALL::String::substr ( size_t  pos = 0,
size_t  len = npos 
) const
void BALL::String::swap ( String s)

Swaps the contents with another String.

void BALL::String::swap ( string &  str)
Substring BALL::String::through ( const String s,
Index  from = 0 
) const

Return a substring containing the beginning of the string including the first occurence of s

bool BALL::String::toBool ( ) const

Converts the string to a bool value. This method returns false, if the string contains the string false (may be surrounded by whitespaces), or true otherwise.

char BALL::String::toChar ( ) const

Return the first character of the string.

double BALL::String::toDouble ( ) const

Convert the string to a double

Exceptions
Exception::InvalidFormat
float BALL::String::toFloat ( ) const

Convert the string to a float

Exceptions
Exception::InvalidFormat
int BALL::String::toInt ( ) const

Convert the string to an int

Exceptions
Exception::InvalidFormat
long BALL::String::toLong ( ) const

Convert the string to a long

Exceptions
Exception::InvalidFormat
void BALL::String::toLower ( Index  from = 0,
Size  len = EndPos 
)

Convert all characters in the given range to lower case

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from || len >= size()
short BALL::String::toShort ( ) const

Convert the string to a short

Exceptions
Exception::InvalidFormat
unsigned char BALL::String::toUnsignedChar ( ) const

Return the first character of the string converted to an unsigned char.

unsigned int BALL::String::toUnsignedInt ( ) const

Convert the string to an unsigned int

Exceptions
Exception::InvalidFormat
unsigned long BALL::String::toUnsignedLong ( ) const

Convert the string to an unsigned long

Exceptions
Exception::InvalidFormat
unsigned short BALL::String::toUnsignedShort ( ) const

Convert the string to an unsigned short

Exceptions
Exception::InvalidFormat
void BALL::String::toUpper ( Index  from = 0,
Size  len = EndPos 
)

Convert all characters in the given range to upper case

Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from || len >= size()
String& BALL::String::trim ( const char *  trimmed = CHARACTER_CLASS__WHITESPACE)

Strips all characters in trimmed from both sides of the string. trim calls trimRight(trimmed).trimLeft(trimmed).

String BALL::String::trim ( const char *  trimmed = CHARACTER_CLASS__WHITESPACE) const

Strips all characters in trimmed from both sides of the string. trim calls trimRight(trimmed).trimLeft(trimmed).

String& BALL::String::trimLeft ( const char *  trimmed = CHARACTER_CLASS__WHITESPACE)

Strips all characters in trimmed from the left of the string. trimLeft stops at the first character encountered that is not in trimmed. Using its default parameter CHARACTER_CLASS__WHITESPACE, it is usually handy to remove blanks from the beginning of a string. Strings consisting of character from trimmed only yield an empty string.

String& BALL::String::trimRight ( const char *  trimmed = CHARACTER_CLASS__WHITESPACE)

Strips all characters in trimmed from the right of the string. trimRight stops at the first character encountered that is not in trimmed. Using its default parameter CHARACTER_CLASS__WHITESPACE, it is usually handy to remove blanks from the end of a string. Strings consisting of character from trimmed only yield an empty string.

String& BALL::String::truncate ( Size  size)

Truncate the string to length size

Variable Documentation

const char* BALL::String::CHARACTER_CLASS__ASCII_ALPHA
static

Character class containing all letters (lower and upper case)

Definition at line 114 of file string.h.

const char* BALL::String::CHARACTER_CLASS__ASCII_ALPHANUMERIC
static

Character class containing all letters and digits.

Definition at line 117 of file string.h.

const char* BALL::String::CHARACTER_CLASS__ASCII_FLOAT
static

Character class containing the digits from 0 to 9 and a dot.

Definition at line 129 of file string.h.

const char* BALL::String::CHARACTER_CLASS__ASCII_LOWER
static

Character class containing all lower case letters.

Definition at line 120 of file string.h.

const char* BALL::String::CHARACTER_CLASS__ASCII_NUMERIC
static

Character class containing the digits from 0 to 9.

Definition at line 126 of file string.h.

const char* BALL::String::CHARACTER_CLASS__ASCII_UPPER
static

Character class containing all upper case letters.

Definition at line 123 of file string.h.

const char* BALL::String::CHARACTER_CLASS__QUOTES
static

Character class containing double quotes.

Definition at line 146 of file string.h.

const char* BALL::String::CHARACTER_CLASS__WHITESPACE
static

Character class containing all whitespace characters. Whitespace characters are:

  • blank " "
  • horizontal tab $ "\backslash t" $
  • new-line $ "\backslash n" $
  • line-feed $ "\backslash r" $
  • vertical tab $ "\backslash v" $
  • form-feed $ "\backslash f" $

Definition at line 142 of file string.h.

const String BALL::String::EMPTY
static

Constant empty string.

Definition at line 1025 of file string.h.

const Size BALL::String::EndPos
static

Constant indicating the end of the string. Use this constant instead of string::npos to indicate an invalid position inside the string or the end of the string in those methods requiring indices.

Definition at line 99 of file string.h.

const size_t BALL::String::npos = -1
static

Constant with a value of the greatest posible value for an element of type size_t.

Definition at line 103 of file string.h.

Friends

BALL_EXPORT friend bool operator!= ( const String s1,
const String s2 
)
friend

Inequality operator.

BALL_EXPORT friend bool operator!= ( const char *  char_ptr,
const String string 
)
friend

Inequality operator.

Exceptions
Exception::NullPointerif char_ptr == NULL
BALL_EXPORT friend bool operator!= ( char  c,
const String string 
)
friend
BALL_EXPORT friend String operator+ ( const String s1,
const string &  s2 
)
friend

Concatenates two strings.

BALL_EXPORT friend String operator+ ( const string &  s1,
const String s2 
)
friend

Concatenates two strings.

BALL_EXPORT friend String operator+ ( const String s1,
const String s2 
)
friend

Concatenates two strings.

BALL_EXPORT friend String operator+ ( const String s1,
const char *  char_ptr 
)
friend

Concatenates a string and a C type string.

BALL_EXPORT friend String operator+ ( const char *  char_ptr,
const String s 
)
friend

Concatenates a C type string and a string.

BALL_EXPORT friend String operator+ ( const String s,
char  c 
)
friend

Concatenates a string and a character.

BALL_EXPORT friend String operator+ ( char  c,
const String s 
)
friend

Concatenates a character and a string.

BALL_EXPORT friend bool operator< ( const String s1,
const String s2 
)
friend

Less than comparison

BALL_EXPORT friend bool operator< ( const char *  char_ptr,
const String string 
)
friend

Less than comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
BALL_EXPORT friend bool operator< ( char  c,
const String string 
)
friend
BALL_EXPORT friend bool operator<= ( const String s1,
const String s2 
)
friend

Less than or equal comparison

BALL_EXPORT friend bool operator<= ( const char *  char_ptr,
const String string 
)
friend

Less than or equal comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
BALL_EXPORT friend bool operator<= ( char  c,
const String string 
)
friend
BALL_EXPORT friend bool operator== ( const String s1,
const String s2 
)
friend

Equality operator.

BALL_EXPORT friend bool operator== ( const char *  char_ptr,
const String string 
)
friend

Equality operator.

Exceptions
Exception::NullPointerif char_ptr == NULL
BALL_EXPORT friend bool operator== ( char  c,
const String string 
)
friend
BALL_EXPORT friend bool operator> ( const String s1,
const String s2 
)
friend

Greater than comparison

BALL_EXPORT friend bool operator> ( const char *  char_ptr,
const String string 
)
friend

Greater than comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
BALL_EXPORT friend bool operator> ( char  c,
const String string 
)
friend
BALL_EXPORT friend bool operator>= ( const String s1,
const String s2 
)
friend

Greater than or equal comparison

BALL_EXPORT friend bool operator>= ( const char *  char_ptr,
const String string 
)
friend

Greater than or equal comparison

Exceptions
Exception::NullPointerif char_ptr == NULL
bool operator>= ( char  c,
const String string 
)
friend
friend class Substring
friend

Definition at line 64 of file string.h.