Wtx ~ Wt Extension Library
WtxLib
|
witty extension library More...
Namespaces | |
Core | |
functions and features | |
Crm | |
Contact Relationships Management. | |
Dbo | |
database access objects | |
Eml | |
Email Management. | |
Lib | |
library functions and resources | |
Sys | |
System Namespace. | |
Classes | |
struct | CharConv |
class | ClientFolder |
Client Folder. More... | |
class | FormModel |
class | MessageBox |
class | PopupMessage |
class | PopupQuestion |
class | PopupYesNo |
class | TableView |
Table View. More... | |
class | TableViewDef |
Table View Definition. More... | |
class | Template |
class | TemplateFormView |
Template Form View. More... | |
Typedefs | |
typedef struct Wtx::CharConv | CharConv_t |
Functions | |
std::string | json_number_to_string (const std::string &key, const std::string &data) |
Convert a number to a string. More... | |
std::string | makeFileName (const std::string &value) |
Make File Name. More... | |
bool | fileExists (const std::string &fileName) |
Check if a File or Folder exists. | |
int | system_command (const std::string &cmd, bool show=false) |
Execute a system command. More... | |
std::vector< std::string > | fileList (const std::string &folder) |
File Listing. More... | |
std::vector< std::string > | findFiles (const std::string &folder, const std::string &match) |
Find File. More... | |
int | stoi (const std::string &value) |
Convert a String to an Integer. | |
std::string | itos (int value) |
Convert an Integer to a String. | |
double | stof (const std::string &value) |
Convert a String to Float. | |
std::string | ftos (double value, int decimals=2) |
Convert a Float to String with decimal precision. | |
std::string | ftos (double value, const std::string &suffix, int decimals=2) |
std::string | ftos (const std::string &prefix, double value, int decimals=2) |
std::string | ftom (double value, int decimals=2) |
std::string | ftom (const std::string &prefix, double value, int decimals=2) |
bool | ends_with (const std::string &value, const std::string &ending) |
Check if a string ends with another string. | |
std::string | append (const std::string &s, const std::string &append, const std::string &separator) |
Append a string to string. More... | |
std::string | prepend (const std::string &s, int length=0, char pad= '0') |
Prepend some number of characters in front of another string. More... | |
std::string | ucase (const std::string &value) |
Upper Case a string. More... | |
std::string | lcase (const std::string &value) |
Lower Case a string. More... | |
int | roundUp (float value) |
Round a number up. More... | |
int | roundDown (float value) |
Round a number down. More... | |
float | roundCurrency (float value) |
Round a number for Currency. More... | |
std::string | replace (const std::string &string, const std::string &before, const std::string &after) |
Replace a String. More... | |
void | ltrim (std::string &s) |
void | rtrim (std::string &s) |
void | trim (std::string &s) |
std::string | ltrim_copy (std::string s) |
std::string | rtrim_copy (std::string s) |
std::string | trim_copy (std::string s) |
std::vector< std::string > | readCSVRow (const std::string &row) |
bool | feq (double a, double b, double epsilon=0.005f, bool trace=false) |
std::string | to_string (Wt::WTemplate &templt) |
std::string | to_string (Wt::WTemplate *templt) |
bool | to_htmlfile (Wt::WTemplate &templt, const std::string &folderName, const std::string &fileName) |
bool | to_htmlfile (Wt::WTemplate *templt, const std::string &folderName, const std::string &fileName) |
std::string | hexDump (const std::string &data, int start=-1, int end=-1) |
void | mapClasses (::Wtx::Dbo::Session &session) |
void | postCreateTables (::Wtx::Dbo::Session &session) |
bool | forceUppercase () |
void | setForceUppercase (bool value=true) |
Variables | |
Wt::WLength | g_dialogWidth |
Default Dialog Width. More... | |
Wt::WLength | g_dialogHeight |
Default Dialog Height. More... | |
const CharConv_t | g_iso8859Conv [256] |
bool | g_forceUppercase = false |
witty extension library
std::string Wtx::append | ( | const std::string & | s, |
const std::string & | append, | ||
const std::string & | separator | ||
) |
bool Wtx::feq | ( | double | a, |
double | b, | ||
double | epsilon = 0.005f , |
||
bool | trace = false |
||
) |
std::vector< std::string > Wtx::fileList | ( | const std::string & | folder | ) |
std::vector< std::string > Wtx::findFiles | ( | const std::string & | folder, |
const std::string & | match | ||
) |
std::string Wtx::json_number_to_string | ( | const std::string & | key, |
const std::string & | data | ||
) |
Convert a number to a string.
Sometimes it happens that a json string will contain 'Number' type values where the numbers are too large for the json processor. In these cases, it is necessary to convert the Number type value to a String type value. This function will take care of that conversion.
This will result in a json string that appears as follows, where the 'webinarKey' value is an integer that will not parse properly:
in to a 'webinarKey' value that is a 'string type' and can therefore be easily processed:
using a regex, find the 'key' value which is followed by a ':' colon. This is the first (capture). The second (capture) is a space followed by at least 8 numbers, possibly more. The (replace) function then takes the first capture, and follows that with the second capture, but places " (double quote) characters around the second capture, thus turning the value in to a String type.
Refer to the cpp source file for an explanation of the regex string.
std::string Wtx::lcase | ( | const std::string & | value | ) |
std::string Wtx::makeFileName | ( | const std::string & | value | ) |
Make File Name.
This will take an odrinary string and remove anything that is not acceptable in a valid file-name. The intended use for this function is to take something like a person's name or a company name and remove and replace anything in those strings that might not produce a disk-compatible file-name. This includes things like ':' colons and '/' forward and back slashes and anything else that looks just plain weird.
All non-printable characters are simply discarded
The routine performs simple character-by-character substitution. In some cases the substitution is 'nothing', like in the case of '.' (period) and ',' (comma) other characters are simply replaced with suitable replacements that have similar appearance but are not likely to mess up a file-name on disk. Odd punctuation characters are removed since this function is a string-to-filename conversion, therefore absolute punctuation has less meaning in a file-name than it does in the database.
'.' period -> nothing
',' comma -> nothing
'<' less than -> open paren
'>' greater than -> close paren
':' colon -> dash ~ sometimes works, but is actually NTFS Alternate Data Streams
'"' double quote -> single quote
'/' forward slash -> dash
'\'backslash -> dash
'|' vertical bar or pipe -> nothing
'?' question mark -> nothing
'*' asterisk -> nothing
std::string Wtx::prepend | ( | const std::string & | s, |
int | length = 0 , |
||
char | pad = '0' |
||
) |
std::string Wtx::replace | ( | const std::string & | string, |
const std::string & | before, | ||
const std::string & | after | ||
) |
float Wtx::roundCurrency | ( | float | value | ) |
int Wtx::roundDown | ( | float | value | ) |
int Wtx::roundUp | ( | float | value | ) |
int Wtx::system_command | ( | const std::string & | cmd, |
bool | show = false |
||
) |
std::string Wtx::ucase | ( | const std::string & | value | ) |
Wt::WLength Wtx::g_dialogHeight |
Default Dialog Height.
Static-global default dialog height value. This can be set by the start-up application to control the size of the dialog windows.
Definition at line 59 of file TableViewDef.h.
Wt::WLength Wtx::g_dialogWidth |
Default Dialog Width.
Static-global default dialog width value. This can be set by the start-up application to control the size of the dialog windows.
Definition at line 58 of file TableViewDef.h.