Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_DATATYPE_STRING_H
#define BALL_DATATYPE_STRING_H
#ifndef BALL_CONFIG_CONFIG_H
# include <BALL/CONFIG/config.h>
#endif
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
#ifndef BALL_COMMON_CREATE_H
# include <BALL/COMMON/create.h>
#endif
#ifndef BALL_COMMON_MACROS_H
# include <BALL/COMMON/macros.h>
#endif
#ifndef BALL_COMMON_EXCEPTION_H
# include <BALL/COMMON/exception.h>
#endif
#ifndef BALL_COMMON_DEBUG_H
# include <BALL/COMMON/debug.h>
#endif
#include <string>
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <vector>
using std::string;
class QString;
class QByteArray;
namespace BALL
{
// forward declaration
class Substring;
class BALL_EXPORT String
{
friend class Substring;
public:
// String has no copy constructor taking String&, bool as arguments.
// the compiler would confuse it with another copy constructor,
// cast true to 1 and copy only the string from the second character
// on! We could use BALL_CREATE_NODEEP, but this leads to trouble with
// inline constructors, so we code it by hand (here and in string.C)
virtual void* create(bool /* deep */ = true, bool empty = false) const;
enum CompareMode
{
CASE_SENSITIVE = 0,
CASE_INSENSITIVE = 1
};
static const Size EndPos;
static const size_t npos = -1;
static const char* CHARACTER_CLASS__ASCII_ALPHA;
static const char* CHARACTER_CLASS__ASCII_ALPHANUMERIC;
static const char* CHARACTER_CLASS__ASCII_LOWER;
static const char* CHARACTER_CLASS__ASCII_UPPER;
static const char* CHARACTER_CLASS__ASCII_NUMERIC;
static const char* CHARACTER_CLASS__ASCII_FLOAT;
static const char* CHARACTER_CLASS__WHITESPACE;
static const char* CHARACTER_CLASS__QUOTES;
String();
String(const string& string);
String(const String& s);
String(String&& s);
String(string&& s);
String& operator=(String&& s);
String& operator=(string&& s);
explicit String(const QString& string);
explicit String(const QByteArray& string);
String(const String& s, Index from, Size len = EndPos);
String(const char* char_ptr, Index from = 0, Size len = EndPos);
String(Size buffer_size, const char* format, ... );
String(std::stringstream& s);
String(const char c, Size len = 1);
String(const unsigned char uc);
String(short s);
String(unsigned short us);
String(int i);
String(unsigned int ui);
String(long l);
String(unsigned long);
#ifdef BALL_ALLOW_LONG64_TYPE_OVERLOADS
String(LongIndex l);
String(LongSize);
#endif
String(float f);
String(double d);
operator string&();
operator string const&() const;
virtual ~String();
void destroy();
void set(const String& s);
void set(const String& string, Index from, Size len = EndPos);
void set(const char* char_ptr, Index from = 0, Size len = EndPos);
void set(Size buffer_size, const char *format, ...);
void set(std::stringstream& s);
void set(char c, Size len = 1);
void set(unsigned char uc);
void set(short s);
void set(unsigned short us);
void set(int i);
void set(unsigned int ui);
void set(long l);
void set(unsigned long ul);
#ifdef BALL_ALLOW_LONG64_TYPE_OVERLOADS
void set(LongIndex l);
void set(LongSize ul);
#endif
void set(float f);
void set(double d);
void get(char* char_ptr, Index from = 0, Size len = EndPos) const;
const String& operator = (const String& s);
const String& operator = (const char* pc);
const String& operator = (std::stringstream& s);
const String& operator = (char c);
const String& operator = (unsigned char uc);
const String& operator = (short s);
const String& operator = (unsigned short us);
const String& operator = (int i);
const String& operator = (unsigned int ui);
const String& operator = (long l);
const String& operator = (unsigned long ul);
#ifdef BALL_ALLOW_LONG64_TYPE_OVERLOADS
const String& operator = (LongIndex l);
const String& operator = (LongSize ul);
#endif
const String& operator = (float f);
const String& operator = (double d);
static void setCompareMode(CompareMode compare_mode);
static CompareMode getCompareMode();
bool toBool() const;
char toChar() const;
unsigned char toUnsignedChar() const;
short toShort() const;
unsigned short toUnsignedShort() const;
int toInt() const;
unsigned int toUnsignedInt() const;
long toLong() const;
unsigned long toUnsignedLong() const;
float toFloat() const;
double toDouble() const;
void toLower(Index from = 0, Size len = EndPos);
void toUpper(Index from = 0, Size len = EndPos);
Substring getSubstring(Index from = 0, Size len = EndPos) const;
Substring operator () (Index from, Size len = EndPos) const;
Substring before(const String& s, Index from = 0) const;
Substring through(const String& s, Index from = 0) const;
Substring from(const String& s, Index from = 0) const;
Substring after(const String& s, Index from = 0) const;
Size countFields(const char* delimiters = CHARACTER_CLASS__WHITESPACE) const;
Size countFieldsQuoted(const char* delimiters = CHARACTER_CLASS__WHITESPACE,
const char* quotes = CHARACTER_CLASS__QUOTES) const;
String getField(Index index, const char* delimiters = CHARACTER_CLASS__WHITESPACE, Index* from = 0) const;
String getFieldQuoted(Index index, const char* delimiters = CHARACTER_CLASS__WHITESPACE,
const char* quotes = CHARACTER_CLASS__QUOTES, Index* from = 0) const;
Size split(String string_array[], Size array_size, const char* delimiters = CHARACTER_CLASS__WHITESPACE, Index from = 0) const;
Size split(std::vector<String>& strings, const char* delimiters = CHARACTER_CLASS__WHITESPACE, Index from = 0) const;
Size splitQuoted(std::vector<String>& strings, const char* delimiters = CHARACTER_CLASS__WHITESPACE,
const char* quotes = CHARACTER_CLASS__QUOTES, Index from = 0) const;
String& trimLeft(const char* trimmed = CHARACTER_CLASS__WHITESPACE);
String& trimRight(const char* trimmed = CHARACTER_CLASS__WHITESPACE);
String& trim(const char* trimmed = CHARACTER_CLASS__WHITESPACE);
// ?????
String trim(const char* trimmed = CHARACTER_CLASS__WHITESPACE) const;
String& truncate(Size size);
Substring left(Size len) const;
Substring right(Size len) const;
Substring instr(const String& pattern, Index from = 0) const;
// NOTE: please, please, pretty please, only try to optimize away operator+ definitions
// if you *really* know what you are doing. We didn't, and we definitely don't want
// to touch this stinking heap of C++ garbage ever again!
// (dstoeckel & anhi)
BALL_EXPORT
friend String operator + (const String& s1, const string& s2);
BALL_EXPORT
friend String operator + (const string& s1, const String& s2);
BALL_EXPORT
friend String operator + (const String& s1, const String& s2);
BALL_EXPORT
friend String operator + (const String& s1, const char* char_ptr);
BALL_EXPORT
friend String operator + (const char* char_ptr, const String& s);
BALL_EXPORT
friend String operator + (const String& s, char c);
BALL_EXPORT
friend String operator + (char c, const String& s);
BALL_EXPORT
friend String operator + (String&& s1, const string& s2);
BALL_EXPORT
friend String operator + (String&& s1, const String& s2);
BALL_EXPORT
friend String operator + (String&& s1, String&& s2);
BALL_EXPORT
friend String operator + (const String& s1, string&& s2);
BALL_EXPORT
friend String operator + (string&& s1, const String& s2);
BALL_EXPORT
friend String operator + (const string& s1, String&& s2);
BALL_EXPORT
friend String operator + (const String& s1, String&& s2);
BALL_EXPORT
friend String operator + (String&& s1, const char* char_ptr);
BALL_EXPORT
friend String operator + (const char* char_ptr, String&& s);
BALL_EXPORT
friend String operator + (String&& s, char c);
BALL_EXPORT
friend String operator + (char c, String&& s);
void swap(String& s);
String& reverse(Index from = 0, Size len = EndPos);
Size substitute(const String& to_replace, const String& replacing);
void substituteAll(const String& to_replace, const String& replacing);
bool has(char c) const;
bool hasSubstring(const String& s, Index from = 0) const;
bool hasPrefix(const String& s) const;
bool hasSuffix(const String& s) const;
bool isEmpty() const;
bool isAlpha() const;
bool isAlnum() const;
bool isDigit() const;
bool isFloat() const;
bool isSpace() const;
bool isWhitespace() const;
static bool isAlpha(char c);
static bool isAlnum(char c);
static bool isDigit(char c);
static bool isSpace(char c);
static bool isWhitespace(char c);
String encodeBase64();
String decodeBase64();
int compare(const String& string, Index from = 0) const;
int compare(const String& string, Index from, Size len) const;
int compare(const char* char_ptr, Index from = 0) const;
int compare(const char* char_ptr, Index from, Size len) const;
int compare(char c, Index from = 0) const;
BALL_EXPORT
friend bool operator == (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator != (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator < (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator <= (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator > (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator >= (const String& s1, const String& s2);
BALL_EXPORT
friend bool operator == (const char* char_ptr, const String& string);
BALL_EXPORT
friend bool operator != (const char* char_ptr, const String& string);
BALL_EXPORT
friend bool operator < (const char* char_ptr, const String& string);
BALL_EXPORT
friend bool operator <= (const char* char_ptr, const String& string);
BALL_EXPORT
friend bool operator > (const char* char_ptr, const String& string);
BALL_EXPORT
friend bool operator >= (const char* char_ptr, const String& string);
bool operator == (const char* char_ptr) const;
bool operator != (const char* char_ptr) const;
bool operator < (const char* char_ptr) const;
bool operator <= (const char* char_ptr) const;
bool operator > (const char* char_ptr) const;
bool operator >= (const char* char_ptr) const;
BALL_EXPORT
friend bool operator == (char c, const String& string);
BALL_EXPORT
friend bool operator != (char c, const String& string);
BALL_EXPORT
friend bool operator < (char c, const String& string);
BALL_EXPORT
friend bool operator <= (char c, const String& string);
BALL_EXPORT
friend bool operator > (char c, const String& string);
friend bool operator >= (char c, const String& string);
bool operator == (char c) const;
bool operator != (char c) const;
bool operator < (char c) const;
bool operator <= (char c) const;
bool operator > (char c) const;
bool operator >= (char c) const;
bool isValid() const;
void dump(std::ostream& s = std::cout, Size depth = 0) const;
std::istream& getline(std::istream& s = std::cin, char delimiter = '\n');
// BALL_EXPORT
// friend std::istream& getline(std::istream& s, String& string, char delimiter);
static const String EMPTY;
typedef string::value_type valuetype;
typedef string::traits_type traits_type;
typedef string::allocator_type allocator_type;
typedef string::reference reference;
typedef string::const_reference const_reference;
typedef string::pointer pointer;
typedef string::const_pointer const_pointer;
typedef string::iterator iterator;
typedef string::const_iterator const_iterator;
typedef string::reverse_iterator reverse_iterator;
typedef string::const_reverse_iterator const_reverse_iterator;
typedef string::difference_type difference_type;
typedef string::size_type size_type;
iterator begin() BALL_NOEXCEPT;
const_iterator begin() const BALL_NOEXCEPT;
iterator end() BALL_NOEXCEPT;
const_iterator end() const BALL_NOEXCEPT;
reverse_iterator rbegin() BALL_NOEXCEPT;
const_reverse_iterator rbegin() const BALL_NOEXCEPT;
reverse_iterator rend() BALL_NOEXCEPT;
const_reverse_iterator rend() const BALL_NOEXCEPT;
const_iterator cbegin() const BALL_NOEXCEPT;
const_iterator cend() const BALL_NOEXCEPT;
const_reverse_iterator crbegin() const BALL_NOEXCEPT;
const_reverse_iterator crend() const BALL_NOEXCEPT;
size_t size() const BALL_NOEXCEPT;
size_t length() const BALL_NOEXCEPT;
size_t max_size() const BALL_NOEXCEPT;
void resize(size_t n);
void resize(size_t n, char c);
size_t capacity() const BALL_NOEXCEPT;
void reserve(size_t n = 0);
void clear() BALL_NOEXCEPT;
bool empty() const BALL_NOEXCEPT;
void shrink_to_fit();
char& operator[] (size_t pos);
const char& operator[] (size_t pos) const;
char& at(size_t pos);
const char& at(size_t pos) const;
char& front();
const char& front() const;
char& back();
const char& back() const;
String& operator += (const String& str);
String& operator += (const string& str);
String& operator += (const char* s);
String& operator += (char c);
String& operator += (std::initializer_list<char> il);
String& append(const String& str);
String& append(const string& str);
String& append(const string& str, size_t subpos, size_t sublen);
String& append(const char* s);
String& append(const char* s, size_t n);
String& append(size_t n, char c);
template <class InputIterator>
String& append(InputIterator first, InputIterator last);
String& append(std::initializer_list<char> li);
void push_back(char c);
String& assign(const String& str);
String& assign(const string& str);
String& assign(const string& str, size_t subpos, size_t sublen);
String& assign(const char* s);
String& assign(const char* s, size_t n);
String& assign(size_t n, char c);
template <class InputIterator>
String& assign(InputIterator first, InputIterator last);
String& assign(std::initializer_list<char> li);
String& assign(string&& str) BALL_NOEXCEPT;
String& insert(size_t pos, const string& str);
String& insert(size_t pos, const string& str, size_t subpos, size_t sublen);
String& insert(size_t pos, const char* s);
String& insert(size_t pos, const char* s, size_t n);
String& insert(size_t pos, size_t n, char c);
#ifdef BALL_HAS_STD_STRING_CONST_ITERATOR_FUNCTIONS
iterator insert(const_iterator p, size_t n, char c);
iterator insert(const_iterator p, char c);
#else
void insert(iterator p, size_t n, char c);
iterator insert(iterator p, char c);
#endif
template <class InputIterator>
iterator insert(iterator p, InputIterator first, InputIterator last);
#ifdef BALL_HAS_STD_STRING_CONST_ITERATOR_INITLIST_INSERT
String& insert(const_iterator p, std::initializer_list<char> li);
#endif
String& erase(size_t pos = 0, size_t len = npos);
#ifdef BALL_HAS_STD_STRING_CONST_ITERATOR_FUNCTIONS
iterator erase(const_iterator p);
iterator erase(const_iterator first, const_iterator last);
#else
iterator erase(iterator p);
iterator erase(iterator first, iterator last);
#endif
String& replace(size_t pos, size_t len, const string& str);
String& replace(size_t pos, size_t len, const string& str, size_t subpos, size_t sublen);
String& replace(size_t pos, size_t len, const char* s);
String& replace(size_t pos, size_t len, const char* s, size_t n);
String& replace(size_t pos, size_t len, size_t n, char c);
#ifdef BALL_HAS_STD_STRING_CONST_ITERATOR_FUNCTIONS
String& replace(const_iterator i1, const_iterator i2, const string& str);
String& replace(const_iterator i1, const_iterator i2, const char* s);
String& replace(const_iterator i1, const_iterator i2, const char* s, size_t n);
String& replace(const_iterator i1, const_iterator i2, size_t n, char c);
template <class InputIterator>
String& replace(const_iterator i1, const_iterator i2, InputIterator first, InputIterator last);
#else
String& replace(iterator i1, iterator i2, const string& str);
String& replace(iterator i1, iterator i2, const char* s);
String& replace(iterator i1, iterator i2, const char* s, size_t n);
String& replace(iterator i1, iterator i2, size_t n, char c);
template <class InputIterator>
String& replace(iterator i1, iterator i2, InputIterator first, InputIterator last);
#endif
#ifdef BALL_HAS_STD_STRING_CONST_ITERATOR_FUNCTIONS
String& replace(const_iterator i1, const_iterator i2, std::initializer_list<char> li);
#endif
void swap(string& str);
void pop_back();
const char* c_str() const BALL_NOEXCEPT;
const char* data() const BALL_NOEXCEPT;
allocator_type get_allocator() const BALL_NOEXCEPT;
size_t copy(char* s, size_t len, size_t pos = 0) const;
size_t find(const string& str, size_t pos = 0) const BALL_NOEXCEPT;
size_t find(const char* s, size_t pos = 0) const;
size_t find(const char* s, size_t pos, size_t n) const;
size_t find(char c, size_t pos = 0) const BALL_NOEXCEPT;
size_t rfind(const string& str, size_t pos = npos) const BALL_NOEXCEPT;
size_t rfind(const char* s, size_t pos = npos) const;
size_t rfind(const char* s, size_t pos, size_t n) const;
size_t rfind(char c, size_t pos = npos) const BALL_NOEXCEPT;
size_t find_first_of(const string& str, size_t pos = 0) const BALL_NOEXCEPT;
size_t find_first_of(const char* s, size_t pos = 0) const;
size_t find_first_of(const char* s, size_t pos, size_t n) const;
size_t find_first_of(char c, size_t pos = 0) const BALL_NOEXCEPT;
size_t find_last_of(const string& str, size_t pos = npos) const BALL_NOEXCEPT;
size_t find_last_of(const char* s, size_t pos = npos) const;
size_t find_last_of(const char* s, size_t pos, size_t n) const;
size_t find_last_of(char c, size_t pos = npos) const BALL_NOEXCEPT;
size_t find_first_not_of(const string& str, size_t pos = 0) const BALL_NOEXCEPT;
size_t find_first_not_of(const char* s, size_t pos = 0) const;
size_t find_first_not_of(const char* s, size_t pos, size_t n) const;
size_t find_first_not_of(char c, size_t pos = 0) const BALL_NOEXCEPT;
size_t find_last_not_of(const string& str, size_t pos = npos) const BALL_NOEXCEPT;
size_t find_last_not_of(const char* s, size_t pos = npos) const;
size_t find_last_not_of(const char* s, size_t pos, size_t n) const;
size_t find_last_not_of(char c, size_t pos = npos) const BALL_NOEXCEPT;
string substr(size_t pos = 0, size_t len = npos) const;
int compare(const string& str) const BALL_NOEXCEPT;
int compare(size_t pos, size_t len, const string& str) const;
int compare(size_t pos, size_t len, const string& str, size_t subpos, size_t sublen) const;
//int compare(const char* s) const;
int compare(size_t pos, size_t len, const char* s) const;
int compare(size_t pos, size_t len, const char* s, size_t n) const;
protected:
// the validate... methods check perform a thorough
// index checking and an index translation
// Indices below zero are interpreted as indices
// relative to the end of the string
// All methods throw IndexUnder|Overflow exceptions
//
void validateIndex_(Index& index) const;
void validateRange_(Index& from, Size& len) const;
static void validateCharPtrRange_(Index& from, Size& len, const char* char_ptr);
static void valudateCharPtrIndex_(Index& index);
private:
string str_;
static int compareAscendingly_(const char* a, const char* b);
static int compareDescendingly_(const char* a, const char* b);
static CompareMode compare_mode_;
static char B64Chars_[64];
static int Index_64_[128];
};
class BALL_EXPORT Substring
{
friend class String;
public:
BALL_CREATE_DEEP(Substring)
class BALL_EXPORT UnboundSubstring
: public Exception::GeneralException
{
public:
UnboundSubstring(const char* file, int line);
};
class BALL_EXPORT InvalidSubstring
: public Exception::GeneralException
{
public:
InvalidSubstring(const char* file, int line);
};
Substring();
Substring(const Substring& substring, bool deep = true);
Substring(const String& string, Index from = 0, Size len = String::EndPos);
virtual ~Substring();
void destroy();
virtual void clear();
operator String() const;
//explicit operator string() const;
String toString() const;
Substring& bind(const String& string, Index from = 0, Size len = String::EndPos);
Substring& bind(const Substring& substring, Index from = 0, Size len = String::EndPos);
void unbind();
String* getBoundString();
const String* getBoundString() const
;
void set(const String& string);
void set(const Substring& s);
void set(const char* char_ptr, Size size = String::EndPos);
const Substring& operator = (const String& string);
const Substring& operator = (const Substring& substring);
const Substring& operator = (const char* char_ptr);
char* c_str();
const char* c_str() const;
Index getFirstIndex() const;
Index getLastIndex() const;
Size size() const;
char& operator [] (Index index);
char operator [] (Index index) const;
Substring& toLower();
Substring& toUpper();
bool isBound() const;
bool isEmpty() const;
bool operator == (const Substring& substring) const;
bool operator != (const Substring& substring) const;
bool operator == (const String& string) const;
bool operator != (const String& string) const;
BALL_EXPORT
friend bool operator == (const String& string, const Substring& substring);
BALL_EXPORT
friend bool operator != (const String& string, const Substring& substring);
bool operator == (const char* char_ptr) const;
bool operator != (const char* char_ptr) const;
bool operator == (char c) const;
bool operator != (char c) const;
BALL_EXPORT
friend std::ostream& operator << (std::ostream& s, const Substring& substring);
bool isValid() const;
void dump(std::ostream& s = std::cout, Size depth = 0) const;
protected:
// throws IndexUnderflow|IndexOverflow
void validateRange_(Index& from, Size& len) const;
private:
/*_ @name Attributes
*/
//_@{
//_ pointer to the bound String
String* bound_;
//_ start index in the bound String
Index from_;
//_ end index in the bound String
Index to_;
//_@}
};
// non-member functions of String
BALL_EXPORT
bool operator == (const String& s1, const String& s2);
BALL_EXPORT
bool operator != (const String& s1, const String& s2);
BALL_EXPORT
bool operator < (const String& s1, const String& s2);
BALL_EXPORT
bool operator <= (const String& s1, const String& s2);
BALL_EXPORT
bool operator > (const String& s1, const String& s2);
BALL_EXPORT
bool operator >= (const String& s1, const String& s2);
BALL_EXPORT
String operator + (const String& s1, const string& s2);
BALL_EXPORT
String operator + (const string& s1, const String& s2);
BALL_EXPORT
String operator + (const String& s1, const String& s2);
BALL_EXPORT
String operator + (const String& s1, const char* char_ptr);
BALL_EXPORT
String operator + (const char* char_ptr, const String& s);
BALL_EXPORT
String operator + (const String& s, char c);
BALL_EXPORT
String operator + (char c, const String& s);
BALL_EXPORT
String operator + (String&& s1, const string& s2);
BALL_EXPORT
String operator + (String&& s1, const String& s2);
BALL_EXPORT
String operator + (String&& s1, String&& s2);
BALL_EXPORT
String operator + (const String& s1, string&& s2);
BALL_EXPORT
String operator + (string&& s1, const String& s2);
BALL_EXPORT
String operator + (const string& s1, String&& s2);
BALL_EXPORT
String operator + (const String& s1, String&& s2);
BALL_EXPORT
String operator + (String&& s1, const char* char_ptr);
BALL_EXPORT
String operator + (const char* char_ptr, String&& s);
BALL_EXPORT
String operator + (String&& s, char c);
BALL_EXPORT
String operator + (char c, String&& s);
} // namespace BALL
namespace std
{
// Non-member functions for string
BALL_EXPORT istream& operator>> (istream& is, BALL::String& str);
BALL_EXPORT ostream& operator<< (ostream& os, BALL::String const& str);
BALL_EXPORT istream& getline(istream& is, BALL::String& str, char delim);
BALL_EXPORT istream& getline(istream& is, BALL::String& str);
BALL_EXPORT istream& getline(istream& is, BALL::String&& str, char delim);
BALL_EXPORT istream& getline(istream& is, BALL::String&& str);
}
# ifndef BALL_NO_INLINE_FUNCTIONS
# include <BALL/DATATYPE/string.iC>
# endif
#endif // BALL_DATATYPE_STRING_H
exception.h
global.h
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Exception::GeneralException
Definition COMMON/exception.h:61
BALL::Exception::GeneralException::GeneralException
GeneralException()
Default constructor.
BALL::String
Definition string.h:57
BALL::String::swap
void swap(String &s)
Swaps the contents with another String.
BALL::String::length
size_t length() const BALL_NOEXCEPT
BALL::String::rfind
size_t rfind(const string &str, size_t pos=npos) const BALL_NOEXCEPT
BALL::String::empty
bool empty() const BALL_NOEXCEPT
BALL::String::validateIndex_
void validateIndex_(Index &index) const
BALL::String::CHARACTER_CLASS__QUOTES
static const char * CHARACTER_CLASS__QUOTES
Definition string.h:141
BALL::String::toUnsignedInt
unsigned int toUnsignedInt() const
BALL::String::isDigit
bool isDigit() const
BALL::String::isSpace
static bool isSpace(char c)
True, if the character is a space.
BALL::String::traits_type
string::traits_type traits_type
Definition string.h:1014
BALL::String::substitute
Size substitute(const String &to_replace, const String &replacing)
BALL::String::trimRight
String & trimRight(const char *trimmed=CHARACTER_CLASS__WHITESPACE)
BALL::String::toUnsignedLong
unsigned long toUnsignedLong() const
BALL::String::isAlpha
bool isAlpha() const
BALL::String::const_iterator
string::const_iterator const_iterator
Definition string.h:1021
BALL::String::toUnsignedShort
unsigned short toUnsignedShort() const
BALL::String::CHARACTER_CLASS__ASCII_ALPHA
static const char * CHARACTER_CLASS__ASCII_ALPHA
Character class containing all letters (lower and upper case).
Definition string.h:109
BALL::String::isWhitespace
bool isWhitespace() const
BALL::String::toLower
void toLower(Index from=0, Size len=EndPos)
BALL::String::clear
void clear() BALL_NOEXCEPT
BALL::String::npos
static const size_t npos
Definition string.h:98
BALL::String::set
void set(int i)
Assign a String from an int.
BALL::String::String
String(Size buffer_size, const char *format,...)
BALL::String::const_reference
string::const_reference const_reference
Definition string.h:1017
BALL::String::set
void set(Size buffer_size, const char *format,...)
BALL::String::replace
String & replace(size_t pos, size_t len, size_t n, char c)
BALL::String::String
String(double d)
Construct a String from a double value.
BALL::String::CHARACTER_CLASS__WHITESPACE
static const char * CHARACTER_CLASS__WHITESPACE
Definition string.h:137
BALL::String::end
iterator end() BALL_NOEXCEPT
BALL::String::from
Substring from(const String &s, Index from=0) const
BALL::String::compare
int compare(const char *char_ptr, Index from, Size len) const
BALL::String::EMPTY
static const String EMPTY
Constant empty string.
Definition string.h:1004
BALL::String::isAlnum
static bool isAlnum(char c)
True, if the character is a letter or a digit.
BALL::String::trim
String & trim(const char *trimmed=CHARACTER_CLASS__WHITESPACE)
BALL::String::String
String(unsigned long)
Construct a String from an unsigned long.
BALL::String::replace
String & replace(size_t pos, size_t len, const string &str)
BALL::String::insert
iterator insert(iterator p, char c)
BALL::String::validateCharPtrRange_
static void validateCharPtrRange_(Index &from, Size &len, const char *char_ptr)
BALL::String::toBool
bool toBool() const
BALL::String::insert
iterator insert(iterator p, InputIterator first, InputIterator last)
BALL::String::CHARACTER_CLASS__ASCII_NUMERIC
static const char * CHARACTER_CLASS__ASCII_NUMERIC
Character class containing the digits from 0 to 9.
Definition string.h:121
BALL::String::begin
iterator begin() BALL_NOEXCEPT
BALL::String::toInt
int toInt() const
BALL::String::find_last_not_of
size_t find_last_not_of(const string &str, size_t pos=npos) const BALL_NOEXCEPT
BALL::String::compare
int compare(const String &string, Index from=0) const
BALL::String::destroy
void destroy()
Clear the string (reset to the empty string).
BALL::String::set
void set(unsigned char uc)
Assign a String from an unsigned char.
BALL::String::at
char & at(size_t pos)
BALL::String::data
const char * data() const BALL_NOEXCEPT
BALL::String::difference_type
string::difference_type difference_type
Definition string.h:1024
BALL::String::dump
void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::String::get
void get(char *char_ptr, Index from=0, Size len=EndPos) const
BALL::String::assign
String & assign(const String &str)
BALL::String::toUpper
void toUpper(Index from=0, Size len=EndPos)
BALL::String::substituteAll
void substituteAll(const String &to_replace, const String &replacing)
BALL::String::String
String(const char *char_ptr, Index from=0, Size len=EndPos)
BALL::String::decodeBase64
String decodeBase64()
BALL::String::after
Substring after(const String &s, Index from=0) const
BALL::String::countFields
Size countFields(const char *delimiters=CHARACTER_CLASS__WHITESPACE) const
BALL::String::back
char & back()
BALL::String::CompareMode
CompareMode
Definition string.h:81
BALL::String::CASE_SENSITIVE
@ CASE_SENSITIVE
Constant to set to case sensitive comparisons (default).
Definition string.h:83
BALL::String::CASE_INSENSITIVE
@ CASE_INSENSITIVE
Constant to set to case insensitive comparisons.
Definition string.h:86
BALL::String::CHARACTER_CLASS__ASCII_ALPHANUMERIC
static const char * CHARACTER_CLASS__ASCII_ALPHANUMERIC
Character class containing all letters and digits.
Definition string.h:112
BALL::String::isSpace
bool isSpace() const
BALL::String::find_first_of
size_t find_first_of(const string &str, size_t pos=0) const BALL_NOEXCEPT
BALL::String::isAlnum
bool isAlnum() const
BALL::String::String
String(const String &s, Index from, Size len=EndPos)
BALL::String::copy
size_t copy(char *s, size_t len, size_t pos=0) const
BALL::String::isWhitespace
static bool isWhitespace(char c)
BALL::String::toUnsignedChar
unsigned char toUnsignedChar() const
Return the first character of the string converted to an unsigned char.
BALL::String::rbegin
reverse_iterator rbegin() BALL_NOEXCEPT
BALL::String::pointer
string::pointer pointer
Definition string.h:1018
BALL::String::toLong
long toLong() const
BALL::String::replace
String & replace(iterator i1, iterator i2, size_t n, char c)
BALL::String::encodeBase64
String encodeBase64()
Convert a string to a base 64 string.
BALL::String::String
String(long l)
Construct a String from a long.
BALL::String::valuetype
string::value_type valuetype
Definition string.h:1013
BALL::String::set
void set(short s)
Assign a String from a short.
BALL::String::replace
String & replace(size_t pos, size_t len, const string &str, size_t subpos, size_t sublen)
BALL::String::isDigit
static bool isDigit(char c)
True, if the character is a digit.
BALL::String::String
String(string &&s)
Move constructor for STL string.
BALL::String::trimLeft
String & trimLeft(const char *trimmed=CHARACTER_CLASS__WHITESPACE)
BALL::String::CHARACTER_CLASS__ASCII_UPPER
static const char * CHARACTER_CLASS__ASCII_UPPER
Character class containing all upper case letters.
Definition string.h:118
BALL::String::rend
reverse_iterator rend() BALL_NOEXCEPT
BALL::String::hasPrefix
bool hasPrefix(const String &s) const
True, if the string starts with s.
BALL::String::before
Substring before(const String &s, Index from=0) const
BALL::String::has
bool has(char c) const
True, if the string contains character c.
BALL::String::push_back
void push_back(char c)
BALL::String::set
void set(std::stringstream &s)
BALL::String::set
void set(long l)
Assign a String from a long.
BALL::String::reserve
void reserve(size_t n=0)
BALL::String::String
String(const char c, Size len=1)
BALL::String::swap
void swap(string &str)
BALL::String::truncate
String & truncate(Size size)
Truncate the string to length size.
BALL::String::replace
String & replace(size_t pos, size_t len, const char *s)
BALL::String::crbegin
const_reverse_iterator crbegin() const BALL_NOEXCEPT
BALL::String::insert
String & insert(size_t pos, const string &str)
BALL::String::cbegin
const_iterator cbegin() const BALL_NOEXCEPT
BALL::String::find
size_t find(const string &str, size_t pos=0) const BALL_NOEXCEPT
BALL::String::operator=
String & operator=(string &&s)
Move assignment operator for STL string.
BALL::String::String
String()
Default Constructor.
BALL::String::String
String(const QByteArray &string)
QByteArray copy constructor.
BALL::String::splitQuoted
Size splitQuoted(std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index from=0) const
BALL::String::getCompareMode
static CompareMode getCompareMode()
Return the current comparison mode.
BALL::String::compare
int compare(const String &string, Index from, Size len) const
BALL::String::replace
String & replace(iterator i1, iterator i2, const string &str)
BALL::String::String
String(short s)
Construct a String from a short.
BALL::String::set
void set(float f)
Assign a String from a float value.
BALL::String::erase
String & erase(size_t pos=0, size_t len=npos)
BALL::String::set
void set(unsigned short us)
Assign a String from an unsigned short.
BALL::String::set
void set(unsigned long ul)
Assign a String from an unsigned long.
BALL::String::hasSubstring
bool hasSubstring(const String &s, Index from=0) const
True, if the string contains the substring s after index from.
BALL::String::replace
String & replace(iterator i1, iterator i2, const char *s)
BALL::String::erase
iterator erase(iterator first, iterator last)
BALL::String::compare
int compare(char c, Index from=0) const
BALL::String::right
Substring right(Size len) const
Return a substring containing the len rightmost characters of the string.
BALL::String::CHARACTER_CLASS__ASCII_LOWER
static const char * CHARACTER_CLASS__ASCII_LOWER
Character class containing all lower case letters.
Definition string.h:115
BALL::String::compare
int compare(const char *char_ptr, Index from=0) const
BALL::String::replace
String & replace(size_t pos, size_t len, const char *s, size_t n)
BALL::String::EndPos
static const Size EndPos
Definition string.h:94
BALL::String::size_type
string::size_type size_type
Definition string.h:1025
BALL::String::getSubstring
Substring getSubstring(Index from=0, Size len=EndPos) const
BALL::String::hasSuffix
bool hasSuffix(const String &s) const
True, if the string ends with s.
BALL::String::validateRange_
void validateRange_(Index &from, Size &len) const
BALL::String::const_reverse_iterator
string::const_reverse_iterator const_reverse_iterator
Definition string.h:1023
BALL::String::set
void set(const char *char_ptr, Index from=0, Size len=EndPos)
BALL::String::String
String(float f)
Construct a String from a float value.
BALL::String::toShort
short toShort() const
BALL::String::set
void set(unsigned int ui)
Assign a String from an unsigned int.
BALL::String::split
Size split(String string_array[], Size array_size, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
BALL::String::set
void set(double d)
Assign a String from a double value.
BALL::String::resize
void resize(size_t n)
BALL::String::reverse_iterator
string::reverse_iterator reverse_iterator
Definition string.h:1022
BALL::String::c_str
const char * c_str() const BALL_NOEXCEPT
BALL::String::set
void set(const String &s)
BALL::String::String
String(const string &string)
STL string copy constructor.
BALL::String::String
String(std::stringstream &s)
BALL::String::shrink_to_fit
void shrink_to_fit()
BALL::String::replace
String & replace(iterator i1, iterator i2, InputIterator first, InputIterator last)
BALL::String::front
char & front()
BALL::String::insert
void insert(iterator p, size_t n, char c)
BALL::String::valudateCharPtrIndex_
static void valudateCharPtrIndex_(Index &index)
BALL::String::reference
string::reference reference
Definition string.h:1016
BALL::String::max_size
size_t max_size() const BALL_NOEXCEPT
BALL::String::String
String(const String &s)
Copy constructor.
BALL::String::String
String(const QString &string)
QString copy constructor.
BALL::String::find_first_not_of
size_t find_first_not_of(const string &str, size_t pos=0) const BALL_NOEXCEPT
BALL::String::allocator_type
string::allocator_type allocator_type
Definition string.h:1015
BALL::String::isValid
bool isValid() const
BALL::String::get_allocator
allocator_type get_allocator() const BALL_NOEXCEPT
BALL::String::trim
String trim(const char *trimmed=CHARACTER_CLASS__WHITESPACE) const
BALL::String::split
Size split(std::vector< String > &strings, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index from=0) const
BALL::String::set
void set(char c, Size len=1)
Assign a String from the result of repeating c len times.
BALL::String::append
String & append(const String &str)
BALL::String::find_last_of
size_t find_last_of(const string &str, size_t pos=npos) const BALL_NOEXCEPT
BALL::String::size
size_t size() const BALL_NOEXCEPT
BALL::String::toDouble
double toDouble() const
BALL::String::operator=
String & operator=(String &&s)
Move assigment operator.
BALL::String::getline
std::istream & getline(std::istream &s=std::cin, char delimiter='\n')
BALL::String::String
String(unsigned short us)
Construct a String from an unsigned short.
BALL::String::set
void set(const String &string, Index from, Size len=EndPos)
BALL::String::String
String(String &&s)
Move constructor.
BALL::String::const_pointer
string::const_pointer const_pointer
Definition string.h:1019
BALL::String::erase
iterator erase(iterator p)
BALL::String::isFloat
bool isFloat() const
BALL::String::replace
String & replace(iterator i1, iterator i2, const char *s, size_t n)
BALL::String::String
String(const unsigned char uc)
Creates a string just containing an unsigned character.
BALL::String::substr
string substr(size_t pos=0, size_t len=npos) const
BALL::String::crend
const_reverse_iterator crend() const BALL_NOEXCEPT
BALL::String::CHARACTER_CLASS__ASCII_FLOAT
static const char * CHARACTER_CLASS__ASCII_FLOAT
Character class containing the digits from 0 to 9 and a dot.
Definition string.h:124
BALL::String::capacity
size_t capacity() const BALL_NOEXCEPT
BALL::String::toChar
char toChar() const
Return the first character of the string.
BALL::String::through
Substring through(const String &s, Index from=0) const
BALL::String::instr
Substring instr(const String &pattern, Index from=0) const
BALL::String::countFieldsQuoted
Size countFieldsQuoted(const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES) const
BALL::String::String
String(int i)
Construct a String from an int.
BALL::String::cend
const_iterator cend() const BALL_NOEXCEPT
BALL::String::setCompareMode
static void setCompareMode(CompareMode compare_mode)
Set the compareison mode for all string comparisons.
BALL::String::String
String(unsigned int ui)
Construct a String from an unsigned int.
BALL::String::left
Substring left(Size len) const
Return a substring containing the len leftmost characters of the string.
BALL::String::pop_back
void pop_back()
BALL::String::iterator
string::iterator iterator
Definition string.h:1020
BALL::String::~String
virtual ~String()
Destructor.
BALL::String::reverse
String & reverse(Index from=0, Size len=EndPos)
BALL::String::getFieldQuoted
String getFieldQuoted(Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, const char *quotes=CHARACTER_CLASS__QUOTES, Index *from=0) const
BALL::String::toFloat
float toFloat() const
BALL::String::isEmpty
bool isEmpty() const
True, if the string has size 0.
BALL::String::create
virtual void * create(bool=true, bool empty=false) const
BALL::String::getField
String getField(Index index, const char *delimiters=CHARACTER_CLASS__WHITESPACE, Index *from=0) const
BALL::String::isAlpha
static bool isAlpha(char c)
True, if the character is a letter (any case).
BALL::String::Substring
friend class Substring
Definition string.h:59
BALL::Substring::InvalidSubstring::InvalidSubstring
InvalidSubstring(const char *file, int line)
BALL::Substring::UnboundSubstring::UnboundSubstring
UnboundSubstring(const char *file, int line)
BALL::Substring
Definition string.h:1386
BALL::Substring::set
void set(const String &string)
BALL::Substring::c_str
char * c_str()
BALL::Substring::isValid
bool isValid() const
BALL::Substring::bind
Substring & bind(const Substring &substring, Index from=0, Size len=String::EndPos)
BALL::Substring::getBoundString
const String * getBoundString() const
Retunrs a const pointer to the bound String.
BALL::Substring::size
Size size() const
Return the substring size.
BALL::Substring::validateRange_
void validateRange_(Index &from, Size &len) const
BALL::Substring::Substring
Substring(const Substring &substring, bool deep=true)
BALL::Substring::dump
void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::Substring::bind
Substring & bind(const String &string, Index from=0, Size len=String::EndPos)
BALL::Substring::toString
String toString() const
BALL::Substring::String
friend class String
Definition string.h:1387
BALL::Substring::toUpper
Substring & toUpper()
BALL::Substring::getFirstIndex
Index getFirstIndex() const
BALL::Substring::set
void set(const char *char_ptr, Size size=String::EndPos)
BALL::Substring::~Substring
virtual ~Substring()
BALL::Substring::toLower
Substring & toLower()
BALL::Substring::destroy
void destroy()
BALL::Substring::unbind
void unbind()
unbinds the substring from the string it is bound to
BALL::Substring::getBoundString
String * getBoundString()
Return a pointer to the bound String.
BALL::Substring::Substring
Substring()
BALL::Substring::c_str
const char * c_str() const
BALL::Substring::Substring
Substring(const String &string, Index from=0, Size len=String::EndPos)
BALL::Substring::isBound
bool isBound() const
Return true, if the substring is bound to a String.
BALL::Substring::getLastIndex
Index getLastIndex() const
BALL::Substring::isEmpty
bool isEmpty() const
Return true, if the substring is empty or unbound.
BALL::Substring::set
void set(const Substring &s)
BALL::Substring::clear
virtual void clear()
create.h
debug.h
BALL_CREATE_DEEP
#define BALL_CREATE_DEEP(name)
Definition create.h:26
macros.h
BALL::Exception
Definition COMMON/exception.h:33
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::LongSize
BALL_ULONG64_TYPE LongSize
Definition COMMON/global.h:192
BALL::LongIndex
BALL_LONG64_TYPE LongIndex
Definition COMMON/global.h:201
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
std
STL namespace.
std::getline
BALL_EXPORT istream & getline(istream &is, BALL::String &str, char delim)