|
otsdaq
3.04.02
|
Collaboration diagram for ots::StringMacros:Classes | |
| struct | IgnoreCaseCompareStruct |
Static Public Member Functions | |
| static bool | wildCardMatch (const std::string &needle, const std::string &haystack, unsigned int *priorityIndex=0) |
| static bool | inWildCardSet (const std::string &needle, const std::set< std::string > &haystack) |
| template<class T > | |
| static T & | getWildCardMatchFromMap (const std::string &needle, std::map< std::string, T > &haystack, std::string *foundKey=0) |
| defined in included .icc source More... | |
| static std::string | decodeURIComponent (const std::string &data) |
| static std::string | encodeURIComponent (const std::string &data) |
| static void | sanitizeForSQL (std::string &data) |
| StringMacros::sanitizeForSQL. | |
| static std::string | escapeString (std::string inString, bool allowWhiteSpace=false) |
| static std::string | escapeJSONStringEntities (const std::string &str) |
| static std::string | restoreJSONStringEntities (const std::string &str) |
| static const std::string & | trim (std::string &s) |
| static std::string | convertEnvironmentVariables (const std::string &data) |
| static bool | isNumber (const std::string &stringToCheck) |
| Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck) More... | |
| static std::string | getNumberType (const std::string &stringToCheck) |
| Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck) More... | |
| template<class T > | |
| static bool | getNumber (const std::string &s, T &retValue) |
| static bool | getNumber (const std::string &s, bool &retValue) |
| template<> More... | |
| static std::string | getTimestampString (const std::string &linuxTimeInSeconds) |
| static std::string | getTimestampString (const time_t linuxTimeInSeconds=time(0)) |
| static std::string | getTimeDurationString (const time_t durationInSeconds=time(0)) |
| template<class T > | |
| static T | validateValueForDefaultStringDataType (const std::string &value, bool doConvertEnvironmentVariables=true) |
| static std::string | validateValueForDefaultStringDataType (const std::string &value, bool doConvertEnvironmentVariables=true) |
| static void | getSetFromString (const std::string &inputString, std::set< std::string > &setToReturn, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}) |
| template<class T , class S = std::string> | |
| static void | getMapFromString (const std::string &inputString, std::map< S, T > &mapToReturn, const std::set< char > &pairPairDelimiter={',', '|', '&'}, const std::set< char > &nameValueDelimiter={'=', ':'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}) |
| getMapFromString ~ More... | |
| static void | getMapFromString (const std::string &inputString, std::map< std::string, std::string > &mapToReturn, const std::set< char > &pairPairDelimiter={',', '|', '&'}, const std::set< char > &nameValueDelimiter={'=', ':'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}) |
| static void | getVectorFromString (const std::string &inputString, std::vector< std::string > &listToReturn, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}, std::vector< char > *listOfDelimiters=0, bool decodeURIComponents=false) |
| static std::vector< std::string > | getVectorFromString (const std::string &inputString, const std::set< char > &delimiter={',', '|', '&'}, const std::set< char > &whitespace={' ', '\t', '\n', '\r'}, std::vector< char > *listOfDelimiters=0, bool decodeURIComponents=false) |
| template<class T > | |
| static std::string | mapToString (const std::map< std::string, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::pair< std::string, std::string >, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::pair< std::string, std::pair< std::string, std::string >>, T > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::string, std::pair< std::string, T >> &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::string, std::map< std::string, T >> &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::string, std::set< T >> &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| template<class T > | |
| static std::string | mapToString (const std::map< std::string, std::vector< T >> &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| static std::string | mapToString (const std::map< std::string, uint8_t > &mapToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=": ") |
| mapToString | |
| template<class T > | |
| static std::string | setToString (const std::set< T > &setToReturn, const std::string &delimeter=", ") |
| setToString ~ More... | |
| static std::string | setToString (const std::set< uint8_t > &setToReturn, const std::string &delimeter=", ") |
| setToString | |
| template<class S , class T > | |
| static std::string | setToString (const std::set< std::pair< S, T >> &setToReturn, const std::string &primaryDelimeter=", ", const std::string &secondaryDelimeter=":") |
| template<class T > | |
| static std::string | vectorToString (const std::vector< T > &setToReturn, const std::string &delimeter=", ") |
| vectorToString ~ More... | |
| static std::string | vectorToString (const std::vector< uint8_t > &setToReturn, const std::string &delimeter=", ") |
| vectorToString | |
| template<class S , class T > | |
| static std::string | vectorToString (const std::vector< std::pair< S, T >> &setToReturn, const std::string &primaryDelimeter="; ", const std::string &secondaryDelimeter=":") |
| static bool | extractCommonChunks (const std::vector< std::string > &haystack, std::vector< std::string > &commonChunksToReturn, std::vector< std::string > &wildcardStrings, unsigned int &fixedWildcardLength) |
| static std::string | demangleTypeName (const char *name) |
| template<class T > | |
| static std::string | getTypeName (void) |
| static std::string | stackTrace (void) |
| static std::string | exec (const char *cmd) |
| static char * | otsGetEnvironmentVarable (const char *name, const std::string &location, const unsigned int &line) |
| static std::string | extractXmlField (const std::string &xml, const std::string &field, uint32_t occurrence, size_t after, size_t *returnFindPos=nullptr, const std::string &valueField="value=", const std::string "eType="'") |
| static std::string | rextractXmlField (const std::string &xml, const std::string &field, uint32_t occurrence, size_t before, size_t *returnFindPos=nullptr, const std::string &valueField="value=", const std::string "eType="'") |
| static void | coutSplit (const std::string &str, uint8_t traceLevel=TLVL_DEBUG, const std::set< char > &delimiter={',', '\n', ';'}) |
Static Public Attributes | |
| static std::map< std::string, std::map< std::string, std::string > > | systemVariables_ |
| static const std::string | TBD = "To-be-defined" |
Definition at line 14 of file StringMacros.h.
|
static |
convertEnvironmentVariables ~ static recursive function
Allows environment variables entered as $NAME or ${NAME} or system variables entered as ${OTS.<variable>.<property>} (only bracket syntax allowed!) e.g. ${OTS.ActiveStateMachine.name} e.g. ${OTS.ActiveStateMachine.fileNameAlias} System variable are read from the static StringMacros map, which is generally filled by the host Supervisor.
Definition at line 495 of file StringMacros.cc.
|
static |
Breaks up long string into multiple TRACE TLOG calls split on the delimiter to avoid truncation by a single TLOG call. The lvl parameter is the offset from TLVL_DEBUG.
Definition at line 1846 of file StringMacros.cc.
|
static |
decodeURIComponent converts all %## to the ascii character
Definition at line 121 of file StringMacros.cc.
|
static |
demangleTypeName
Definition at line 1878 of file StringMacros.cc.
|
static |
getEscapedValueAsString Returns string with special characters escaped for JSON Note: this should be useful for any values placed in double quotes, i.e. JSON. Reverse of restoreJSONStringEntities()
Definition at line 382 of file StringMacros.cc.
|
static |
StringMacros::escapeString convert quotes to html quote characters ' = ' and " = " remove new line characters and (if !allowWhiteSpace) remove white space (so that read from file white space artifact removed)
convert & = & if(allowWhiteSpace) convert \t to 8   spaces and
to
Definition at line 202 of file StringMacros.cc.
|
static |
exec run linux command and get result back in string
Definition at line 1554 of file StringMacros.cc.
|
static |
extractCommonChunks return the common chunks from the vector of strings e.g. if the strings were created from a template string like reader*_east*, this function will return a vector of size 3 := {"reader","_east",""} and a vector of wildcards that would replace the *
Returns true if common chunks and wildcards found, returns false if all inputs were the same (i.e. no wildcards needed)
Definition at line 1200 of file StringMacros.cc.
|
static |
extract valueField for field from xml looking forwards from after occurence = 0 is first occurence
Definition at line 1691 of file StringMacros.cc.
|
static |
getMapFromString ~
| inputString | defined in included .icc source |
|
static |
getMapFromString extracts the map of name-value pairs from string that uses two delimiters ignoring whitespace
Definition at line 1030 of file StringMacros.cc.
|
static |
template<>
defined in included .icc source // Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck)
for bool, but not all other number types return false if string is not a bool template<> inline bool StringMacros::getNumber<bool>(const std::string& s, bool& retValue)
Definition at line 745 of file StringMacros.cc.
|
static |
defined in included .icc source // Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck)
|
static |
Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck)
getNumberType ~~ returns string of number type: "unsigned long long", "double" or else "nan" for not-a-number
Numbers can be hex ("0x.."), binary("b..."), or base10.
Definition at line 665 of file StringMacros.cc.
|
static |
getSetFromString extracts the set of elements from string that uses a delimiter ignoring whitespace
Definition at line 842 of file StringMacros.cc.
|
static |
getTimeDurationString returns the duration HH:MM:SS with consideration for day(s)
Definition at line 801 of file StringMacros.cc.
|
static |
getTimestampString ~~ returns ots style timestamp string of known fixed size: Thu Aug 23 14:55:02 2001 CST
Definition at line 776 of file StringMacros.cc.
|
static |
getTimestampString ~~ returns ots style timestamp string of known fixed size: Thu Aug 23 14:55:02 2001 CST
Definition at line 786 of file StringMacros.cc.
|
static |
getVectorFromString extracts the list of elements from string that uses a delimiter ignoring whitespace optionally returns the list of delimiters encountered, which may be useful for extracting which operator was used.
Note: lists are returned as vectors Note: the size() of delimiters will be one less than the size() of the returned values unless there is a leading delimiter, in which case vectors will have the same size.
Definition at line 1008 of file StringMacros.cc.
|
static |
getVectorFromString extracts the list of elements from string that uses a delimiter ignoring whitespace optionally returns the list of delimiters encountered, which may be useful for extracting which operator was used.
Note: lists are returned as vectors Note: the size() of delimiters will be one less than the size() of the returned values unless there is a leading delimiter, in which case vectors will have the same size.
Definition at line 889 of file StringMacros.cc.
|
static |
defined in included .icc source
getWildCardMatchFromMap ~ returns value if needle is in haystack otherwise throws exception (considering wildcards AND match priority as defined by StringMacros::wildCardMatch)
|
static |
inWildCardSet ~ returns true if needle is in haystack (considering wildcards) allow inverted haystack strings by first character being '!'
Definition at line 100 of file StringMacros.cc.
|
static |
Note: before call consider use of stringToCheck = StringMacros::convertEnvironmentVariables(stringToCheck)
isNumber ~~ returns true if one or many numbers separated by operations (+,-,/,*) is present in the string. Numbers can be hex ("0x.."), binary("b..."), or base10.
Definition at line 588 of file StringMacros.cc.
|
static |
mapToString ~ *ToString declarations (template definitions are in included .icc source)
| mapToReturn | defined in included .icc source |
|
static |
otsGetEnvironmentVarable declare special ots environment variable get, that throws exception instead of causing crashes with null pointer. Note: usually called with ENV(X) in CoutMacros.h
Definition at line 1673 of file StringMacros.cc.
|
static |
restoreJSONStringEntities Returns string with literals
\t " \r \ replaced with char Reverse of escapeJSONStringEntities()
Definition at line 420 of file StringMacros.cc.
|
static |
extract valueField for field from xml looking backwards from before occurence = 0 is first occurence
Definition at line 1770 of file StringMacros.cc.
|
static |
setToString ~
| setToReturn | defined in included .icc source |
|
static |
stackTrace static function https://gist.github.com/fmela/591333/c64f4eb86037bb237862a8283df70cdfc25f01d3
Definition at line 1579 of file StringMacros.cc.
|
static |
StringMacros::trim Remove whitespace like JavaScript trim()
Definition at line 469 of file StringMacros.cc.
|
static |
validateValueForDefaultStringDataType ~ special validation ignoring any table info - just assuming type string
| value | defined in included .icc source |
|
static |
validateValueForDefaultStringDataType
Definition at line 823 of file StringMacros.cc.
|
static |
vectorToString ~
| setToReturn | defined in included .icc source |
|
static |
Here is the list of static helper functions:
wildCardMatch inWildCardSet getWildCardMatchFromMap decodeURIComponent encodeURIComponent sanitizeForSQL escapeString escapeJSONStringEntities restoreJSONStringEntities trim convertEnvironmentVariables isNumber getNumber getTimestampString getTimeDurationString validateValueForDefaultStringDataType getSetFromString getVectorFromString getMapFromString setToString vectorToString mapToString demangleTypeName getTypeName stackTrace exec otsGetEnvironmentVarable extractXmlField rextractXmlField coutSplit
End list of static helper functions:
wildCardMatch find needle in haystack allow needle to have leading and/or trailing wildcard '*' consider priority in matching, no matter the order in the haystack:
Definition at line 24 of file StringMacros.cc.