OpenM++ runtime library (libopenm)
omHelper.h File Reference

OpenM++ common helper utilities. More...

Include dependency graph for omHelper.h:
This graph shows which files directly or indirectly include this file:

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

 openm
 openM++ namespace
 

Macros

#define OM_PATH_MAX   (FILENAME_MAX < 4096 ? FILENAME_MAX : 4096)
 
#define OM_STRLEN_MAX   INT_MAX /** max string length supported */
 
#define OM_STR_DB_MAX   32000 /** max database string length: notes varchar (clob, text) */
 
#define OM_CODE_DB_MAX   32 /** max database length for codes: language code, digests, date-time string */
 
#define OM_NAME_DB_MAX   255 /** max database length for names: parameter name, table name, etc. */
 
#define OM_DESCR_DB_MAX   255 /** max database length for description: parameter description, table description, etc. */
 
#define OM_OPTION_DB_MAX   2048 /** max database length for option value: profile_option, run_option */
 

Typedefs

typedef map< string, string, LessNoCase > openm::NoCaseMap
 map of key-value strings with case neutral key search
 
typedef set< string, LessNoCase > openm::NoCaseSet
 set of strings with case neutral key search
 
typedef unique_ptr< IRowBase > openm::IRowBaseUptr
 unique pointer to db row
 
typedef vector< IRowBaseUptr > openm::IRowBaseVec
 db rows: vector of unique pointers to db row
 
typedef list< IRowBaseUptr > openm::IRowBaseList
 db rows: list of unique pointers to db row
 

Functions

void openm::toLower (string &io_str, const locale &i_locale=locale(""))
 convert string to lower case
 
void openm::toLower (char *io_str, const locale &i_locale=locale(""))
 convert string to lower case
 
void openm::toUpper (string &io_str, const locale &i_locale=locale(""))
 convert string to upper case
 
void openm::toUpper (char *io_str, const locale &i_locale=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 string &i_str, const char *i_start)
 check if string start with i_start, using case neutral string comparison
 
bool openm::endWithNoCase (const string &i_str, const char *i_end)
 check if string end with i_end, using case neutral string comparison
 
string openm::trimLeft (const string &i_str, const locale &i_locale=locale(""))
 trim leading blank and space characters
 
string openm::trimRight (const string &i_str, const locale &i_locale=locale(""))
 trim trailing blank and space characters
 
string openm::trim (const string &i_str, const locale &i_locale=locale(""))
 trim leading and trailing blank and space characters
 
void openm::blankCrLf (string &io_str)
 replace all <cr> or <lf> with blank space character
 
const string openm::toQuoted (const string &i_str, char i_quote='\'')
 make quoted string using sql single ' quote by default, ie: 'O''Brien'
 
const string openm::toUnQuoted (const string &i_str, char i_quote='\'', const locale &i_locale=locale(""))
 make unquoted string using sql single ' quote by default, ie: 'O''Brien' into O'Brien
 
const string openm::toString (double i_val)
 convert float type to string: exist to fix std::to_string conversion losses. More...
 
const string openm::toAlphaNumeric (const string &i_str, int i_maxSize=0)
 replace all non [A-Z,a-z,0-9] by _ underscore and remove repetitive underscores. More...
 
const string openm::replaceAll (const 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
 
const string openm::makeDateTime (const chrono::system_clock::time_point &i_time)
 make date-time string, ie: 2012-08-17 16:04:59.148
 
const string openm::makeTimeStamp (const chrono::system_clock::time_point &i_time)
 make timestamp string, ie: 2012_08_17_16_04_59_148
 
const string openm::toDateTimeString (const 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()
 
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
 
string openm::regexReplace (const string &i_srcText, const char *i_pattern, const char *i_replaceWith)
 
const string openm::normalizeLanguageName (const string &i_srcLanguage)
 normalize language name by removing encoding part, replace _ by - and lower case: "en-ca" from "en_CA.UTF-8"
 
const list< string > openm::splitLanguageName (const string &i_srcLanguage)
 normalize language name and split it into list of prefered languages: en_CA => [en-ca, en]
 
const string openm::getDefaultLocaleName (void)
 get user prefered locale name: en-CA en-CA or empty "" string on error
 
list< string > openm::splitCsv (const 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 string &i_values, list< string > &io_resultLst, const char *i_delimiters=",", bool i_isUnquote=false, char i_quote='\'', const locale &i_locale=locale(""))
 split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon). More...
 

Detailed Description

OpenM++ common helper utilities.