OpenM++ runtime library (libopenm)
|
OpenM++ common helper utilities. More...
Go to the source code of this file.
Classes | |
struct | openm::LessNoCase |
case neutral less comparator for strings More... | |
struct | openm::IRowBase |
db-row abstract base More... | |
struct | openm::IFinalState |
final model run state public interface: thread safe More... | |
class | openm::exit_guard< ResourceHolder > |
simple resource exit guard implementation More... | |
Namespaces | |
namespace | openm |
openM++ namespace | |
Functions | |
void | openm::toLower (std::string &io_str, const std::locale &i_locale=std::locale("")) |
convert string to lower case | |
void | openm::toLower (char *io_str, const std::locale &i_locale=std::locale("")) |
convert string to lower case | |
void | openm::toUpper (std::string &io_str, const std::locale &i_locale=std::locale("")) |
convert string to upper case | |
void | openm::toUpper (char *io_str, const std::locale &i_locale=std::locale("")) |
convert string to upper case | |
int | openm::compareNoCase (const char *i_left, const char *i_right, size_t i_length=0) |
case neutral string comparison | |
bool | openm::equalNoCase (const char *i_left, const char *i_right, size_t i_length=0) |
case neutral string equal comparison | |
bool | openm::startWithNoCase (const std::string &i_str, const char *i_start) |
check if string start with i_start, using case neutral string comparison | |
bool | openm::endWithNoCase (const std::string &i_str, const char *i_end) |
check if string end with i_end, using case neutral string comparison | |
std::string | openm::trimLeft (const std::string &i_str, const std::locale &i_locale=std::locale("")) |
trim leading blank and space characters | |
std::string | openm::trimRight (const std::string &i_str, const std::locale &i_locale=std::locale("")) |
trim trailing blank and space characters | |
std::string | openm::trim (const std::string &i_str, const std::locale &i_locale=std::locale("")) |
trim leading and trailing blank and space characters | |
void | openm::blankCrLf (std::string &io_str) |
replace all <cr> or <lf> with blank space character | |
const std::string | openm::toQuoted (const std::string &i_str, char i_quote='\'') |
make quoted string using sql single ' quote by default, ie: 'O''Brien' | |
const std::string | openm::toUnQuoted (const std::string &i_str, char i_quote='\'', const std::locale &i_locale=std::locale("")) |
make unquoted string using sql single ' quote by default, ie: 'O''Brien' into O'Brien | |
const std::string | openm::toString (double i_val) |
convert float type to string: exist to fix std::to_string conversion losses. | |
const std::string | openm::toAlphaNumeric (const std::string &i_str, int i_maxSize=0) |
replace all non [A-Z,a-z,0-9] by _ underscore and remove repetitive underscores. | |
const std::string | openm::cleanPathChars (const std::string &i_str, int i_maxSize=0) |
replace all non non-printable and any of "'`$}{><:|?*&^;/\ by _ underscore. | |
const std::string | openm::replaceAll (const std::string &i_src, const char *i_oldValue, const char *i_newValue) |
replace all occurence of i_oldValue by i_newValue, both old and new values must be not empty | |
bool | openm::isBoolType (const char *i_typeName) |
return true if model type is boolean (logical) | |
bool | openm::isStringType (const char *i_typeName) |
return true if model type is string (varchar) | |
bool | openm::isBigIntType (const char *i_typeName) |
return true if model type is bigint (64 bit) | |
bool | openm::isIntType (const char *i_typeName, int i_typeId) |
return true if model type is integer: not float, string, boolean, bigint (if type is not a built-in then it must be integer enums) | |
bool | openm::isBuiltInType (int i_typeId) |
return true if model type id is built-in type id, ie: int, double, logical | |
bool | openm::isFloatType (const char *i_typeName) |
return true if model type is float (float, real, double or time) | |
bool | openm::isTimeType (const char *i_typeName) |
return true if model type is Time | |
bool | openm::isIntValid (const char *i_value) |
return true if i_value string represent valid integer constant | |
bool | openm::isFloatValid (const char *i_value) |
return true if i_value string represent valid floating point constant | |
bool | openm::isBoolTrue (const char *i_str) |
return true if lower case of source string one of: "yes" "1" "true" | |
bool | openm::isBoolValid (const char *i_str) |
return true if lower case of source string one of: "yes" "1" "true" "no" "0" "false" | |
int | openm::boolStringToInt (const char *i_value) |
convert i_value string represnting boolean option and return one of: return 1 if i_value is one of: "yes", "1", "true" or empty "" value, return 0 if i_value is one of: "no", "0", "false", return -1 if i_value is nullptr, return -2 otherwise. | |
ptrdiff_t | openm::memCopyTo (uint8_t *io_dst, ptrdiff_t i_offset, const void *i_src, size_t i_size) |
copy bytes source into destination and return next destination offset | |
const std::string | openm::makeDateTime (const std::chrono::system_clock::time_point &i_time) |
make date-time string, ie: 2012-08-17 16:04:59.148 | |
const std::string | openm::makeTimeStamp (const std::chrono::system_clock::time_point &i_time) |
make timestamp string, ie: 2012_08_17_16_04_59_148 | |
const std::string | openm::toDateTimeString (const std::string &i_timestamp) |
make date-time string from timestamp string, ie: 2012_08_17_16_04_59_148 => 2012-08-17 16:04:59.148 | |
void | openm::formatTo (size_t i_size, char *io_buffer, const char *i_format, va_list io_args) |
format message into supplied buffer using vsnprintf() | |
std::string | openm::formatToString (const char *i_format,...) |
format message into string result using vsnprintf() | |
const char * | openm::elliptString (const char *i_src, size_t i_size, char *io_buffer) |
if source string exceed max size than return ellipted copy into the buffer | |
const std::string | openm::normalizeLanguageName (const std::string &i_srcLanguage) |
normalize language name by removing encoding part, replace _ by - and lower case: "en-ca" from "en_CA.UTF-8" | |
const std::list< std::string > | openm::splitLanguageName (const std::string &i_srcLanguage) |
normalize language name and split it into list of prefered languages: en_CA => [en-ca, en] | |
std::list< std::string > | openm::splitCsv (const std::string &i_values, const char *i_delimiters=",", bool i_isUnquote=false, char i_quote='\'') |
split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon). More... | |
void | openm::splitCsv (const std::string &i_values, std::list< std::string > &io_resultLst, const char *i_delimiters=",", bool i_isUnquote=false, char i_quote='\'', const std::locale &i_locale=std::locale("")) |
split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon). More... | |
OpenM++ common helper utilities.