OpenLexocad  27.1
Base::StringTool Class Reference

#include <StringTool.h>

Static Public Member Functions

template<typename T >
static std::string toStlString (const T &t)
 
template<typename T >
static std::string toStlString (const T &t, int precision)
 
template<typename T >
static std::string toStlString (const T &t, int fieldWidth, char fillChar)
 
static std::string toStlString (const bool &b, int fieldWidth, char fillChar)
 
static std::string toStlString (const bool &b)
 
static std::string toStlString (const QString &str)
 
template<typename T >
static Base::String toString (const T &t)
 
template<typename T >
static Base::String toString (const T &t, int precision)
 
template<typename T >
static Base::String toString (const T &t, int fieldWidth, wchar_t fillChar)
 
static Base::String toString (const bool &b, int fieldWidth, wchar_t fillChar)
 
static Base::String toString (const bool &b)
 
static std::string toUpper (const std::string &str)
 Returns a copy of string which is converted to upper case. More...
 
static std::string toLower (const std::string &str)
 Returns a copy of string which is converted to lower case. More...
 
static Base::String toUpper (const Base::String &str)
 Returns a copy of string which is converted to upper case. More...
 
static Base::String toLower (const Base::String &str)
 Returns a copy of string which is converted to lower case. More...
 
static std::string trimLeft (const std::string &str)
 Returns a copy of string with leading spaces removed. More...
 
static std::string trimRight (const std::string &str)
 Returns a copy of string with trailing spaces removed. More...
 
static std::string trim (const std::string &str)
 Returns a copy of string with leading and trailing spaces removed. More...
 
static Base::String trimLeft (const Base::String &str)
 Returns a copy of string with leading spaces removed. More...
 
static Base::String trimRight (const Base::String &str)
 Returns a copy of string with trailing spaces removed. More...
 
static Base::String trim (const Base::String &str)
 Returns a copy of string with leading and trailing spaces removed. More...
 
static std::string replace (const std::string &str, const std::string &src, const std::string &rpl)
 Returns a copy of the string. Replaces given text with something else. More...
 
static Base::String replace (const Base::String &str, const Base::String &src, const Base::String &rpl)
 Returns a copy of the string. Replaces given text with something else. More...
 
static bool isEmpty (const std::string &str)
 Checks if a string contains characters. More...
 
static bool isEmpty (const Base::String &str)
 Checks if a string contains characters. More...
 
static bool toBool (const std::string &str, bool *ok=0)
 Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails. More...
 
static bool toBool (const char *str, bool *ok=0)
 Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails. More...
 
static bool toBool (const Base::String &str, bool *ok=0)
 Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails. More...
 
static double toDouble (const std::string &str, bool *ok=0)
 Converts the string representation of a double to a double value. ok = 'false' if conversion fails. More...
 
static double toDouble (const char *str, bool *ok=0)
 Converts the string representation of a double to a double value. ok = 'false' if conversion fails. More...
 
static double toDouble (const Base::String &str, bool *ok=0)
 Converts the string representation of a double to a double value. ok = 'false' if conversion fails. More...
 
static float toFloat (const std::string &str, bool *ok=0)
 Converts the string representation of a float to a float value. ok = 'false' if conversion fails. More...
 
static uint8_t toUInt8 (const std::string &str, bool *ok)
 Converts the string representation of an int to an int value. ok = 'false' if conversion fails. More...
 
static uint8_t toUInt8 (const Base::String &str, bool *ok)
 
static uint32_t toUInt32 (const std::string &str, bool *ok)
 
static uint32_t toUInt32 (const Base::String &str, bool *ok)
 
static uint64_t toUInt64 (const std::string &str, bool *ok)
 
static uint64_t toUInt64 (const Base::String &str, bool *ok)
 
static int toInt (const std::string &str, bool *ok=0)
 
static int toInt (const Base::String &str, bool *ok=0)
 
static char toChar (const std::string &str, bool *ok=0)
 Converts the string representation of a char to a char value. ok = 'false' if conversion fails. More...
 
static Base::String toUtf16 (const std::string &utf8string)
 Converts a UTF-8 encoded string to a UTF-16 encoded string. Throws std::exception on failure. More...
 
static std::string toUtf8 (const Base::String &widestring)
 Converts a UTF-16 encoded string to a UTF-8 encoded string. Throws std::exception on failure. More...
 
static std::wstring toWString (const Base::String &str)
 Returns Base::String as a std::wstring. More...
 
static Base::String toString (const std::string &str)
 Converts a std::string to a Base::String. More...
 
static std::string toStlString (const Base::String &str)
 
static std::string toLegal (const std::string &str)
 Replaces all characters from the string which are not letters or numbers with a '_'. More...
 
static std::string createGuidString ()
 Creates a compressed GUID string. This version uses a number system with base 64 to obtain a string with 22 characters. More...
 
static bool toUuid (const std::string &ifcguid, QUuid &uuid)
 Creates a QUuid from an IFC GUID (base 64) string. More...
 
static bool toGUID (const std::string &ifcguid, std::string &guid)
 Create a GUID string (p.e. {53FD4419-39F9-4211-AD37-29DA1D3E9AF8} ) from base64 string. More...
 
static bool toBase64String (const std::string &in, std::string &out)
 Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a GUID string. More...
 
static bool toBase64String (const QUuid &in, std::string &out)
 Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a QUuid. More...
 
static bool toBase64String (const Base::GlobalId &in, Base::String &out)
 Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a Base::GlobalId. More...
 
static QString toQString (const Base::String &str)
 Converts a Base::String to a QString. More...
 
static Base::String toString (const QString &str)
 Converts a QString to a Base::String. More...
 
static std::string toMultiByteString (const Base::String &str)
 

Member Function Documentation

◆ createGuidString()

static std::string Base::StringTool::createGuidString ( )
static

Creates a compressed GUID string. This version uses a number system with base 64 to obtain a string with 22 characters.

◆ isEmpty() [1/2]

static bool Base::StringTool::isEmpty ( const std::string &  str)
static

Checks if a string contains characters.

◆ isEmpty() [2/2]

static bool Base::StringTool::isEmpty ( const Base::String str)
static

Checks if a string contains characters.

◆ replace() [1/2]

static std::string Base::StringTool::replace ( const std::string &  str,
const std::string &  src,
const std::string &  rpl 
)
static

Returns a copy of the string. Replaces given text with something else.

◆ replace() [2/2]

static Base::String Base::StringTool::replace ( const Base::String str,
const Base::String src,
const Base::String rpl 
)
static

Returns a copy of the string. Replaces given text with something else.

◆ toBase64String() [1/3]

static bool Base::StringTool::toBase64String ( const std::string &  in,
std::string &  out 
)
static

Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a GUID string.

◆ toBase64String() [2/3]

static bool Base::StringTool::toBase64String ( const QUuid &  in,
std::string &  out 
)
static

Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a QUuid.

◆ toBase64String() [3/3]

static bool Base::StringTool::toBase64String ( const Base::GlobalId in,
Base::String out 
)
static

Create a IFCGUID string (p.e. 10YjwXGv9FPhDS3ghximXO ) from a Base::GlobalId.

◆ toBool() [1/3]

static bool Base::StringTool::toBool ( const std::string &  str,
bool *  ok = 0 
)
static

Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails.

◆ toBool() [2/3]

static bool Base::StringTool::toBool ( const char *  str,
bool *  ok = 0 
)
static

Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails.

◆ toBool() [3/3]

static bool Base::StringTool::toBool ( const Base::String str,
bool *  ok = 0 
)
static

Converts the string representation of a bool to a boolean value. ok = 'false' if conversion fails.

◆ toChar()

static char Base::StringTool::toChar ( const std::string &  str,
bool *  ok = 0 
)
static

Converts the string representation of a char to a char value. ok = 'false' if conversion fails.

◆ toDouble() [1/3]

static double Base::StringTool::toDouble ( const std::string &  str,
bool *  ok = 0 
)
static

Converts the string representation of a double to a double value. ok = 'false' if conversion fails.

◆ toDouble() [2/3]

static double Base::StringTool::toDouble ( const char *  str,
bool *  ok = 0 
)
static

Converts the string representation of a double to a double value. ok = 'false' if conversion fails.

◆ toDouble() [3/3]

static double Base::StringTool::toDouble ( const Base::String str,
bool *  ok = 0 
)
static

Converts the string representation of a double to a double value. ok = 'false' if conversion fails.

◆ toFloat()

static float Base::StringTool::toFloat ( const std::string &  str,
bool *  ok = 0 
)
static

Converts the string representation of a float to a float value. ok = 'false' if conversion fails.

◆ toGUID()

static bool Base::StringTool::toGUID ( const std::string &  ifcguid,
std::string &  guid 
)
static

Create a GUID string (p.e. {53FD4419-39F9-4211-AD37-29DA1D3E9AF8} ) from base64 string.

◆ toInt() [1/2]

static int Base::StringTool::toInt ( const std::string &  str,
bool *  ok = 0 
)
static

◆ toInt() [2/2]

static int Base::StringTool::toInt ( const Base::String str,
bool *  ok = 0 
)
static

◆ toLegal()

static std::string Base::StringTool::toLegal ( const std::string &  str)
static

Replaces all characters from the string which are not letters or numbers with a '_'.

◆ toLower() [1/2]

static std::string Base::StringTool::toLower ( const std::string &  str)
static

Returns a copy of string which is converted to lower case.

◆ toLower() [2/2]

static Base::String Base::StringTool::toLower ( const Base::String str)
static

Returns a copy of string which is converted to lower case.

◆ toMultiByteString()

static std::string Base::StringTool::toMultiByteString ( const Base::String str)
static

◆ toQString()

static QString Base::StringTool::toQString ( const Base::String str)
static

Converts a Base::String to a QString.

◆ toStlString() [1/7]

template<typename T >
static std::string Base::StringTool::toStlString ( const T &  t)
inlinestatic

◆ toStlString() [2/7]

template<typename T >
static std::string Base::StringTool::toStlString ( const T &  t,
int  precision 
)
inlinestatic

◆ toStlString() [3/7]

template<typename T >
static std::string Base::StringTool::toStlString ( const T &  t,
int  fieldWidth,
char  fillChar 
)
inlinestatic

◆ toStlString() [4/7]

static std::string Base::StringTool::toStlString ( const bool &  b,
int  fieldWidth,
char  fillChar 
)
inlinestatic

◆ toStlString() [5/7]

static std::string Base::StringTool::toStlString ( const bool &  b)
inlinestatic

◆ toStlString() [6/7]

static std::string Base::StringTool::toStlString ( const QString &  str)
static

◆ toStlString() [7/7]

static std::string Base::StringTool::toStlString ( const Base::String str)
static

◆ toString() [1/7]

template<typename T >
static Base::String Base::StringTool::toString ( const T &  t)
inlinestatic

◆ toString() [2/7]

template<typename T >
static Base::String Base::StringTool::toString ( const T &  t,
int  precision 
)
inlinestatic

◆ toString() [3/7]

template<typename T >
static Base::String Base::StringTool::toString ( const T &  t,
int  fieldWidth,
wchar_t  fillChar 
)
inlinestatic

◆ toString() [4/7]

static Base::String Base::StringTool::toString ( const bool &  b,
int  fieldWidth,
wchar_t  fillChar 
)
inlinestatic

◆ toString() [5/7]

static Base::String Base::StringTool::toString ( const bool &  b)
inlinestatic

◆ toString() [6/7]

static Base::String Base::StringTool::toString ( const std::string &  str)
static

Converts a std::string to a Base::String.

◆ toString() [7/7]

static Base::String Base::StringTool::toString ( const QString &  str)
static

Converts a QString to a Base::String.

◆ toUInt32() [1/2]

static uint32_t Base::StringTool::toUInt32 ( const std::string &  str,
bool *  ok 
)
static

◆ toUInt32() [2/2]

static uint32_t Base::StringTool::toUInt32 ( const Base::String str,
bool *  ok 
)
static

◆ toUInt64() [1/2]

static uint64_t Base::StringTool::toUInt64 ( const std::string &  str,
bool *  ok 
)
static

◆ toUInt64() [2/2]

static uint64_t Base::StringTool::toUInt64 ( const Base::String str,
bool *  ok 
)
static

◆ toUInt8() [1/2]

static uint8_t Base::StringTool::toUInt8 ( const std::string &  str,
bool *  ok 
)
static

Converts the string representation of an int to an int value. ok = 'false' if conversion fails.

◆ toUInt8() [2/2]

static uint8_t Base::StringTool::toUInt8 ( const Base::String str,
bool *  ok 
)
static

◆ toUpper() [1/2]

static std::string Base::StringTool::toUpper ( const std::string &  str)
static

Returns a copy of string which is converted to upper case.

◆ toUpper() [2/2]

static Base::String Base::StringTool::toUpper ( const Base::String str)
static

Returns a copy of string which is converted to upper case.

◆ toUtf16()

static Base::String Base::StringTool::toUtf16 ( const std::string &  utf8string)
static

Converts a UTF-8 encoded string to a UTF-16 encoded string. Throws std::exception on failure.

◆ toUtf8()

static std::string Base::StringTool::toUtf8 ( const Base::String widestring)
static

Converts a UTF-16 encoded string to a UTF-8 encoded string. Throws std::exception on failure.

◆ toUuid()

static bool Base::StringTool::toUuid ( const std::string &  ifcguid,
QUuid &  uuid 
)
static

Creates a QUuid from an IFC GUID (base 64) string.

◆ toWString()

static std::wstring Base::StringTool::toWString ( const Base::String str)
static

Returns Base::String as a std::wstring.

◆ trim() [1/2]

static std::string Base::StringTool::trim ( const std::string &  str)
static

Returns a copy of string with leading and trailing spaces removed.

◆ trim() [2/2]

static Base::String Base::StringTool::trim ( const Base::String str)
static

Returns a copy of string with leading and trailing spaces removed.

◆ trimLeft() [1/2]

static std::string Base::StringTool::trimLeft ( const std::string &  str)
static

Returns a copy of string with leading spaces removed.

◆ trimLeft() [2/2]

static Base::String Base::StringTool::trimLeft ( const Base::String str)
static

Returns a copy of string with leading spaces removed.

◆ trimRight() [1/2]

static std::string Base::StringTool::trimRight ( const std::string &  str)
static

Returns a copy of string with trailing spaces removed.

◆ trimRight() [2/2]

static Base::String Base::StringTool::trimRight ( const Base::String str)
static

Returns a copy of string with trailing spaces removed.


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