#include <StringUtilities.h>
Static Public Member Functions | |
static void | tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiter=" ") |
this method splits the string passed as parameter into other strings using the delimiter. For example this|is|a|test using "|" as a delimiter will produce the vector {this,is,a,test} | |
static void | trimWhiteSpace (std::string &str) |
this method removes the white spaces in the string passed as parameter | |
static void | removeBrackets (std::string &str) |
removes the { } brackets which are most outside, and all outer trailing white-spaces around a string | |
static void | addBrackets (std::string &str) |
Wraps the { } brackets around the given string. | |
static void | getElements (const std::string &str, std::vector< std::string > &elements) |
this method extracts elements from the string passed as a parameter an element is any sequence of characteres between two brackets {} or each of the strings separated by a comma if no brackets are found for instance elements of a,b,c will yield three elements a b c on the other hand elements of {a,b},{c,d} will yield two elements a,b c,d the pattern is recursive {{a,b},c,d} is one element | |
static void | addElements (std::string &str, const std::vector< std::string > &elements) |
this method merges all strings given in elements. The result string will be a comma-separated list | |
static std::string | toString (signed char data) |
transform an signed integer into a string | |
static std::string | toString (uint32_t data) |
transform an unsigned integer into a string | |
static std::string | toString (int32_t data) |
transform an integer into a string | |
static std::string | toString (int64_t data) |
transform a int64_t into a string | |
static std::string | toString (double data) |
transform a double into a string | |
static std::string | toString (const void *ptr) |
transform a const pointer into a string | |
static bool | fromString (bool &value, const std::string &str) |
transform a string into a boolean | |
static bool | fromString (signed char &value, const std::string &str) |
transform a string into a signed char | |
template<typename T > | |
static bool | fromString (T &, const std::string &) |
transform a string into a signed char |
Definition at line 15 of file StringUtilities.h.
void fesa::StringUtilities::addBrackets | ( | std::string & | str | ) | [static] |
Wraps the { } brackets around the given string.
Definition at line 58 of file StringUtilities.cpp.
void fesa::StringUtilities::addElements | ( | std::string & | str, | |
const std::vector< std::string > & | elements | |||
) | [static] |
this method merges all strings given in elements. The result string will be a comma-separated list
str | The merged string | |
elements | array of elements to add |
Definition at line 135 of file StringUtilities.cpp.
bool fesa::StringUtilities::fromString | ( | T & | val, | |
const std::string & | str | |||
) | [inline, static] |
transform a string into a signed char
str | the string to transform | |
value | that will receive the conversion |
Definition at line 161 of file StringUtilities.h.
bool fesa::StringUtilities::fromString | ( | signed char & | value, | |
const std::string & | str | |||
) | [inline, static] |
transform a string into a signed char
str | the string to transform | |
value | that will receive the conversion |
Definition at line 151 of file StringUtilities.h.
bool fesa::StringUtilities::fromString | ( | bool & | value, | |
const std::string & | str | |||
) | [inline, static] |
transform a string into a boolean
str | the string to transform | |
value | that will receive the conversion |
Definition at line 136 of file StringUtilities.h.
Referenced by fesa::InitializeDataStoreManager::getAttributeValueAsInt(), fesa::NotificationIDManager::loadNotificationIDCollection(), and fesa::Converter< signed char >::stringToValue().
void fesa::StringUtilities::getElements | ( | const std::string & | str, | |
std::vector< std::string > & | elements | |||
) | [static] |
this method extracts elements from the string passed as a parameter an element is any sequence of characteres between two brackets {} or each of the strings separated by a comma if no brackets are found for instance elements of a,b,c will yield three elements a b c on the other hand elements of {a,b},{c,d} will yield two elements a,b c,d the pattern is recursive {{a,b},c,d} is one element
str | string to get the elements from | |
elements | array to which the elements will be added |
Definition at line 105 of file StringUtilities.cpp.
References FesaErrorMissingBrackets.
Referenced by fesa::FieldStringArray::copyValue(), fesa::FieldArray2D< T >::copyValue(), fesa::FieldArray< T >::copyValue(), fesa::ArrayUtilities< T >::fillArray(), and fesa::Converter< FaultField_DataType >::stringToValue().
void fesa::StringUtilities::removeBrackets | ( | std::string & | str | ) | [static] |
removes the { } brackets which are most outside, and all outer trailing white-spaces around a string
the | string which needs to be modified |
FESA-Exception,if | notation is incorrect |
Definition at line 44 of file StringUtilities.cpp.
References FesaErrorMalFormatedData.
Referenced by fesa::FieldStringArray::copyValue(), fesa::FieldArray2D< T >::copyValue(), and fesa::FieldArray< T >::copyValue().
void fesa::StringUtilities::tokenize | ( | const std::string & | str, | |
std::vector< std::string > & | tokens, | |||
const std::string & | delimiter = " " | |||
) | [static] |
this method splits the string passed as parameter into other strings using the delimiter. For example this|is|a|test using "|" as a delimiter will produce the vector {this,is,a,test}
str | string to split | |
tokens | vector to which the strings will be added | |
delimiter | string use to create the strings |
Definition at line 13 of file StringUtilities.cpp.
References FesaErrorEmptyDelimeter.
Referenced by fesa::ManualNotificationMessage::ManualNotificationMessage(), fesa::Converter< HostPortHardwareAddress_DataType >::stringToValue(), fesa::Converter< LogicalHardwareAddress_DataType >::stringToValue(), and fesa::Converter< DeviceRelation_DataType >::stringToValue().
std::string fesa::StringUtilities::toString | ( | const void * | ptr | ) | [static] |
transform a const pointer into a string
ptr | the pointer to transform |
Definition at line 98 of file StringUtilities.cpp.
std::string fesa::StringUtilities::toString | ( | double | data | ) | [static] |
transform a double into a string
data | double to transform |
Definition at line 91 of file StringUtilities.cpp.
std::string fesa::StringUtilities::toString | ( | int64_t | data | ) | [static] |
transform a int64_t into a string
data | int64_t to transform |
Definition at line 84 of file StringUtilities.cpp.
std::string fesa::StringUtilities::toString | ( | int32_t | data | ) | [static] |
transform an integer into a string
data | integer to transform |
Definition at line 77 of file StringUtilities.cpp.
std::string fesa::StringUtilities::toString | ( | uint32_t | data | ) | [static] |
transform an unsigned integer into a string
data | unsigned integer to transform |
Definition at line 70 of file StringUtilities.cpp.
std::string fesa::StringUtilities::toString | ( | signed char | data | ) | [static] |
transform an signed integer into a string
data | unsigned integer to transform |
Definition at line 63 of file StringUtilities.cpp.
Referenced by fesa::FieldArray< T >::checkMaxDimension(), fesa::FieldArray2D< T >::checkMaxDimensions(), fesa::SettingFieldStructArray2D< T >::getCell(), fesa::SettingFieldScalarArray2D< T >::getCell(), fesa::SettingFieldStructArray< T >::getCell(), fesa::SettingFieldScalarArray< T >::getCell(), fesa::GenericFieldStructArray2D< T >::getCell(), fesa::GenericFieldScalarArray2D< T >::getCell(), fesa::GenericFieldStructArray< T >::getCell(), fesa::GenericFieldScalarArray< T >::getCell(), fesa::ConfigFieldStructArray2D< T >::getCell(), fesa::ConfigFieldScalarArray2D< T >::getCell(), fesa::ConfigFieldStructArray< T >::getCell(), fesa::ConfigFieldScalarArray< T >::getCell(), fesa::AcqFieldStructArray2D< T >::getCell(), fesa::AcqFieldScalarArray2D< T >::getCell(), fesa::AcqFieldStructArray< T >::getCell(), fesa::AcqFieldScalarArray< T >::getCell(), fesa::SettingFieldArray2D< T >::getColumn(), fesa::GenericFieldArray2D< T >::getColumn(), fesa::ConfigFieldArray2D< T >::getColumn(), fesa::AcqFieldArray2D< T >::getColumn(), fesa::SettingFieldArray2D< T >::getRow(), fesa::GenericFieldArray2D< T >::getRow(), fesa::ConfigFieldArray2D< T >::getRow(), fesa::AcqFieldArray2D< T >::getRow(), fesa::SettingFieldStringArray::getString(), fesa::GenericFieldStringArray::getString(), fesa::ConfigFieldStringArray::getString(), fesa::AcqFieldStringArray::getString(), fesa::Semaphore::getValue(), fesa::AbstractMutex::init(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDevices(), fesa::DeviceFactoryImp< GlobalDeviceType, DomainStoreType, DevInstType >::initializeDomainStores(), fesa::Semaphore::post(), fesa::Semaphore::Semaphore(), fesa::SettingFieldStringArray::set(), fesa::SettingFieldString::set(), fesa::GenericFieldStringArray::set(), fesa::GenericFieldString::set(), fesa::AcqFieldStringArray::set(), fesa::AcqFieldString::set(), fesa::SettingFieldStringArray::setString(), fesa::GenericFieldStringArray::setString(), fesa::AcqFieldStringArray::setString(), fesa::StoreManager::storeFields(), fesa::NotificationIDManager::storeNotificationIDCollection(), fesa::Semaphore::tryWait(), fesa::Converter< signed char >::valueToString(), and fesa::Semaphore::wait().
void fesa::StringUtilities::trimWhiteSpace | ( | std::string & | str | ) | [static] |
this method removes the white spaces in the string passed as parameter
[in,out] | str | string |
Definition at line 34 of file StringUtilities.cpp.