Description
Typedefs
|
|
|
|
typedef std::pair< const std::string, std::string > |
keyValuePair |
Variables
Functions
|
|
|
|
bool |
beginsWith(const char * subject, const char * find) Does subject begin withfind ? |
|
|
bool |
beginsWith(std::istream & is, const std::string & find) |
|
|
std::string |
createRandomString(size_t length) Create a random string out of digits, and lower and uppercase letters. |
|
|
std::string |
escape(const std::string & s) Escape quotes, newlines and backslashes. |
|
|
void |
extractFloats(const std::string & in, std::deque< float > & out) |
|
|
void |
extractUnsignedLongs(const std::string & in, std::deque< unsigned long > & out) |
|
|
std::string |
getLine(const char * subject) |
template< typename Iterator_T > |
|
std::string |
implode(const Iterator_T & begin, const Iterator_T & end, const std::string & delimiter) |
|
|
bool |
nextLine(const char * subject, int & cursor) Move cursor to the next line. Return false if end of subject is reached. |
|
|
std::pair< uint32_t, uint8_t > |
readUTF8Codepoint(const std::string & str, const size_t pos) |
|
|
std::string |
readQuotedString(const char * subject, int & cursor) |
|
|
std::string |
replaceAll(const std::string & subject, const std::string & find, const std::string & replace, int count) Replace all(or maximal count) occurrences of find in subject by replace. |
|
|
std::string |
replaceMultiple(const std::string & subject, int replaceCount, const std::string find, const std::string replace, int max) |
|
|
std::string |
replaceMultiple(const std::string & subject, const std::deque< keyValuePair > & findReplace, int max) |
|
|
bool |
stepText(const char * subject, int & cursor, const char * search) |
|
|
void |
stepWhitespaces(const char * subject, int & cursor) Whitespace chars are skipped. |
|
|
void |
stepWhitespaces(std::istream & is) |
|
|
void |
stepWhitespaces(std::istream & is, int & line) |
|
|
void |
stepWhitespaces(char ** cursor) |
template< typename _T > |
|
_T |
toNumber(const std::string & in) |
|
|
bool |
toBool(const std::string & s) |
|
|
std::deque< bool > |
toBools(const std::string & s) e.g. “0 1 -4 6.0” -> [false, true, true, true] |
|
|
std::vector< float > |
toFloats(const std::string & s) e.g. “0 1 -4 6.0” -> [0.0f,1.0f,-4.0f,6.0f] |
|
|
std::vector< int > |
toInts(const std::string & s) e.g. “0 1 -4 6.0” -> [0, 1, -4, 6] |
|
|
std::string |
trim(const std::string & s) Strip all whitespaces from the beginning and ending of s. |
|
|
std::string |
toFormattedString(float i) |
template< typename Type > |
|
std::string |
toString(Type var) |
template< > |
|
std::string |
toString< unsigned char >(unsigned char var) |
template< > |
|
std::string |
toString< signed char >(signed char var) |
template< > |
|
std::string |
toString< char >(char var) |
template< > |
|
std::string |
toString< const std::string & >(const std::string & var) |
|
|
std::u32string |
utf8_to_utf32(const std::string & str_u8) |
|
|
std::string |
utf32_to_utf8(const std::u32string & str_u32) |
|
|
std::string |
utf32_to_utf8(const uint32_t u32) |
Documentation
typedef
Util::StringUtils::keyValuePair
|
|
typedef std::pair< const std::string, std::string > keyValuePair |
Defined in Util/StringUtils.h:89
variable
Util::StringUtils::INVALID_UNICODE_CODE_POINT
Defined in Util/StringUtils.h:76
function
Util::StringUtils::beginsWith
|
|
|
|
|
|
bool beginsWith( |
const char * |
subject, |
|
const char * |
find |
) |
|
|
Does subject begin withfind
?
Defined in Util/StringUtils.h:31
function
Util::StringUtils::beginsWith
|
|
|
|
|
|
bool beginsWith( |
std::istream & |
is, |
|
const std::string & |
find |
) |
|
|
Defined in Util/StringUtils.h:32
function
Util::StringUtils::createRandomString
Create a random string out of digits, and lower and uppercase letters.
Defined in Util/StringUtils.h:35
function
Util::StringUtils::escape
|
|
|
|
|
|
std::string escape( |
const std::string & |
s ) |
Escape quotes, newlines and backslashes.
Defined in Util/StringUtils.h:38
function
Util::StringUtils::extractFloats
|
|
|
|
|
|
void extractFloats( |
const std::string & |
in, |
|
std::deque< float > & |
out |
) |
|
|
Convert the given string containing white space separated number representations and append the numbers to the given double-ended queue.
Parameters
- in
- String which is taken as input of the conversion.
- out
- Double-ended queue that is used to add the numbers.
Note: ** Use toFloats(…) instead! ***
Defined in Util/StringUtils.h:47
function
Util::StringUtils::extractUnsignedLongs
Convert the given string containing white space separated number representations and append the numbers to the given double-ended queue.
Parameters
- in
- String which is taken as input of the conversion.
- out
- Double-ended queue that is used to add the numbers.
Defined in Util/StringUtils.h:55
function
Util::StringUtils::getLine
|
|
|
|
|
|
std::string getLine( |
const char * |
subject ) |
Read the next line.
Defined in Util/StringUtils.h:58
function
Util::StringUtils::implode
|
|
|
template< typename Iterator_T > |
|
|
std::string implode( |
const Iterator_T & |
begin, |
|
const Iterator_T & |
end, |
|
const std::string & |
delimiter |
) |
|
|
Defined in Util/StringUtils.h:61
function
Util::StringUtils::nextLine
|
|
|
|
|
|
bool nextLine( |
const char * |
subject, |
|
int & |
cursor |
) |
|
|
Move cursor to the next line. Return false if end of subject is reached.
Defined in Util/StringUtils.h:74
function
Util::StringUtils::readUTF8Codepoint
|
|
|
|
|
|
std::pair< uint32_t, uint8_t > readUTF8Codepoint( |
const std::string & |
str, |
|
const size_t |
pos |
) |
|
|
Reads the next UTF8 code point from the givenstring
at the givenpos
.
Returns
[UnicodeCodePoint, numberOfBytes]; If the code point lies beyond the string, numberOfBytes is 0. If no valid code point could be read (e.g. formatting error), UnicodeCodePoint is INVALID_UNICODE_CODE_POINT.
Defined in Util/StringUtils.h:82
function
Util::StringUtils::readQuotedString
Read and return the content of a quoted string “foo bar”. The cursor is placed after the string. If no quoted string is found at the beginning of the stream, the cursor is not moved.
Defined in Util/StringUtils.h:86
function
Util::StringUtils::replaceAll
|
|
|
|
|
|
std::string replaceAll( |
const std::string & |
subject, |
|
const std::string & |
find, |
|
const std::string & |
replace, |
|
int |
count |
) |
|
|
Replace all(or maximal count) occurrences of find in subject by replace.
Defined in Util/StringUtils.h:92
function
Util::StringUtils::replaceMultiple
|
|
|
|
|
|
std::string replaceMultiple( |
const std::string & |
subject, |
|
int |
replaceCount, |
|
const std::string |
find, |
|
const std::string |
replace, |
|
int |
max |
) |
|
|
Defined in Util/StringUtils.h:93
function
Util::StringUtils::replaceMultiple
Defined in Util/StringUtils.h:94
function
Util::StringUtils::stepText
|
|
|
|
|
|
bool stepText( |
const char * |
subject, |
|
int & |
cursor, |
|
const char * |
search |
) |
|
|
If subject[cursor] begins withsearch
, thecursor
is moved behind that text and true is returned. Otherwise, false is returned.
Defined in Util/StringUtils.h:98
function
Util::StringUtils::stepWhitespaces
Whitespace chars are skipped.
Defined in Util/StringUtils.h:101
function
Util::StringUtils::stepWhitespaces
Defined in Util/StringUtils.h:102
function
Util::StringUtils::stepWhitespaces
Defined in Util/StringUtils.h:103
function
Util::StringUtils::stepWhitespaces
Defined in Util/StringUtils.h:104
function
Util::StringUtils::toNumber
|
|
|
template< typename _T > |
|
|
_T toNumber( |
const std::string & |
in ) |
Convert the given string to a number.
Parameters
- in
- String containing a number representation.
Returns
Number as type determined by template parameter.
Defined in Util/StringUtils.h:113
function
Util::StringUtils::toBool
|
|
|
|
|
|
bool toBool( |
const std::string & |
s ) |
Defined in Util/StringUtils.h:119
function
Util::StringUtils::toBools
|
|
|
|
|
|
std::deque< bool > toBools( |
const std::string & |
s ) |
e.g. “0 1 -4 6.0” -> [false, true, true, true]
Defined in Util/StringUtils.h:122
function
Util::StringUtils::toFloats
|
|
|
|
|
|
std::vector< float > toFloats( |
const std::string & |
s ) |
e.g. “0 1 -4 6.0” -> [0.0f,1.0f,-4.0f,6.0f]
Defined in Util/StringUtils.h:124
function
Util::StringUtils::toInts
|
|
|
|
|
|
std::vector< int > toInts( |
const std::string & |
s ) |
e.g. “0 1 -4 6.0” -> [0, 1, -4, 6]
Defined in Util/StringUtils.h:126
function
Util::StringUtils::trim
|
|
|
|
|
|
std::string trim( |
const std::string & |
s ) |
Strip all whitespaces from the beginning and ending of s.
Defined in Util/StringUtils.h:129
function
Util::StringUtils::toFormattedString
Defined in Util/StringUtils.h:131
function
Util::StringUtils::toString
|
|
|
template< typename Type > |
|
|
std::string toString( |
Type |
var ) |
Defined in Util/StringUtils.h:134
function
Util::StringUtils::toString< unsigned char >
Defined in Util/StringUtils.h:139
function
Util::StringUtils::toString< signed char >
Defined in Util/StringUtils.h:142
function
Util::StringUtils::toString< char >
Defined in Util/StringUtils.h:145
function
Util::StringUtils::toString< const std::string & >
Defined in Util/StringUtils.h:148
function
Util::StringUtils::utf8_to_utf32
Defined in Util/StringUtils.h:152
function
Util::StringUtils::utf32_to_utf8
Defined in Util/StringUtils.h:153
function
Util::StringUtils::utf32_to_utf8
Defined in Util/StringUtils.h:154