|
GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
|
helper functions and features More...
Classes | |
| struct | CharConv |
Typedefs | |
| typedef struct GCW::Core::CharConv | CharConv_t |
Functions | |
| std::vector< std::string > | split (const std::string &value, char delim) |
| std::string & | rtrim (std::string &s, const char *t=trim_ws) |
| std::string & | ltrim (std::string &s, const char *t=trim_ws) |
| std::string & | trim (std::string &s, const char *t=trim_ws) |
| std::string | toupper (const std::string &s) |
| std::string | tolower (const std::string &s) |
| Wt::Json::Object | toJson (Wt::WTreeView *_view) |
| std::string | hexDump (const std::string &data, int start=-1, int end=-1) |
| auto | newGuid () -> std::string |
| Generate new GUID string value. | |
| auto | currentDateTime () -> Wt::WDateTime |
| Current Date/Time. | |
| auto | dateStorageString (const Wt::WDate *_date) -> std::string |
| auto | dateTimeStorageString (const Wt::WDateTime &_dateTime) -> std::string |
| auto | dateTimeDisplayString (const Wt::WDateTime &_dateTime) -> std::string |
| auto | currentDateTimeStorageString () -> std::string |
| auto | currentDateTimeDisplayString () -> std::string |
| std::string | makeFileName (const std::string &value) |
| Make File Name. | |
| 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. | |
| std::vector< std::string > | fileList (const std::string &folder) |
| File Listing. | |
| std::vector< std::string > | findFiles (const std::string &folder, const std::string &match) |
| Find File. | |
| 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. | |
| std::string | prepend (const std::string &s, int length=0, char pad='0') |
| Prepend some number of characters in front of another string. | |
| std::string | ucase (const std::string &value) |
| Upper Case a string. | |
| std::string | lcase (const std::string &value) |
| Lower Case a string. | |
| int | roundUp (float value) |
| Round a number up. | |
| int | roundDown (float value) |
| Round a number down. | |
| float | roundCurrency (float value) |
| Round a number for Currency. | |
| std::string | replace (const std::string &string, const std::string &before, const std::string &after) |
| Replace a String. | |
| 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) |
Variables | |
| const char * | trim_ws = " \t\n\r\f\v" |
| const CharConv_t | g_iso8859Conv [256] |
helper functions and features
| typedef struct GCW::Core::CharConv GCW::Core::CharConv_t |
| auto GCW::Core::append | ( | const std::string & | s, |
| const std::string & | append, | ||
| const std::string & | separator | ||
| ) |
Append a string to string.
This will append a string to another string and place a separator if there is already data in the lead string
Definition at line 705 of file Core.cpp.
References append(), and ends_with().
Referenced by append().
| auto GCW::Core::currentDateTime | ( | ) | -> Wt::WDateTime |
Current Date/Time.
This will return the current date/time suitable for back-end storage
Definition at line 269 of file Core.cpp.
References Wt::WDateTime::currentDateTime().
Referenced by currentDateTimeDisplayString(), and currentDateTimeStorageString().
| auto GCW::Core::currentDateTimeDisplayString | ( | ) | -> std::string |
Definition at line 320 of file Core.cpp.
References currentDateTime(), and dateTimeDisplayString().
Referenced by GCW::Gui::BillPay::PaymentWidget::loadData().
| auto GCW::Core::currentDateTimeStorageString | ( | ) | -> std::string |
Definition at line 299 of file Core.cpp.
References currentDateTime(), and dateTimeStorageString().
Referenced by GCW::Gui::BillPay::PaymentWidget::saveData().
| auto GCW::Core::dateStorageString | ( | const Wt::WDate * | _date | ) | -> std::string |
| auto GCW::Core::dateTimeDisplayString | ( | const Wt::WDateTime & | _dateTime | ) | -> std::string |
Definition at line 308 of file Core.cpp.
References GCW_DATE_FORMAT_DISPLAY.
Referenced by currentDateTimeDisplayString().
| auto GCW::Core::dateTimeStorageString | ( | const Wt::WDateTime & | _dateTime | ) | -> std::string |
Definition at line 287 of file Core.cpp.
References GCW_DATETIME_FORMAT_STORAGE.
Referenced by currentDateTimeStorageString().
| auto GCW::Core::ends_with | ( | const std::string & | value, |
| const std::string & | ending | ||
| ) |
| auto GCW::Core::feq | ( | double | a, |
| double | b, | ||
| double | epsilon = 0.005f, |
||
| bool | trace = false |
||
| ) |
| auto GCW::Core::fileExists | ( | const std::string & | fileName | ) |
| auto GCW::Core::fileList | ( | const std::string & | folder | ) |
File Listing.
This procedure will scan a folder and return a list of all the files in it.
Definition at line 463 of file Core.cpp.
References ialphasort().
Referenced by findFiles().
| auto GCW::Core::findFiles | ( | const std::string & | folder, |
| const std::string & | match | ||
| ) |
Find File.
This scans a directory folder and returns a list containing the full file-name of all the files that matche the value.
Definition at line 543 of file Core.cpp.
References fileList().
| auto GCW::Core::ftom | ( | const std::string & | prefix, |
| double | value, | ||
| int | decimals = 2 |
||
| ) |
| auto GCW::Core::ftos | ( | const std::string & | prefix, |
| double | value, | ||
| int | decimals = 2 |
||
| ) |
| auto GCW::Core::ftos | ( | double | value, |
| const std::string & | suffix, | ||
| int | decimals = 2 |
||
| ) |
| auto GCW::Core::ftos | ( | double | value, |
| int | decimals = 2 |
||
| ) |
| auto GCW::Core::hexDump | ( | const std::string & | data, |
| int | start = -1, |
||
| int | end = -1 |
||
| ) |
| auto GCW::Core::itos | ( | int | value | ) |
Convert an Integer to a String.
Definition at line 587 of file Core.cpp.
References Wt::WString::arg(), and Wt::WString::toUTF8().
Referenced by GCW::Gui::BillPay::YearSelector::YearSelector().
| auto GCW::Core::lcase | ( | const std::string & | value | ) |
| std::string & GCW::Core::ltrim | ( | std::string & | s, |
| const char * | t = trim_ws |
||
| ) |
| auto GCW::Core::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
| auto GCW::Core::newGuid | ( | ) | -> std::string |
Generate new GUID string value.
This GUID is suitable for use as the primary-guid-key value for the data tables.
Definition at line 244 of file Core.cpp.
Referenced by GCW::Eng::Transaction::Manager::newTransaction(), and GCW::Gui::BillPay::EditWidget::saveData().
| auto GCW::Core::prepend | ( | const std::string & | s, |
| int | length = 0, |
||
| char | pad = '0' |
||
| ) |
| auto GCW::Core::readCSVRow | ( | const std::string & | row | ) |
Definition at line 834 of file Core.cpp.
References QuotedField, QuotedQuote, and UnquotedField.
| auto GCW::Core::replace | ( | const std::string & | string, |
| const std::string & | before, | ||
| const std::string & | after | ||
| ) |
| auto GCW::Core::roundCurrency | ( | float | value | ) |
| auto GCW::Core::roundDown | ( | float | value | ) |
| auto GCW::Core::roundUp | ( | float | value | ) |
| std::string & GCW::Core::rtrim | ( | std::string & | s, |
| const char * | t = trim_ws |
||
| ) |
| std::vector< std::string > GCW::Core::split | ( | const std::string & | value, |
| char | delim | ||
| ) |
Definition at line 39 of file Core.cpp.
References split().
Referenced by GCW::Dbo::Accounts::byFullName().
| auto GCW::Core::stof | ( | const std::string & | value | ) |
| auto GCW::Core::stoi | ( | const std::string & | value | ) |
Convert a String to an Integer.
Definition at line 568 of file Core.cpp.
Referenced by GCW::Gui::BillPay::ToolBar::selectedYear(), and GCW::Gui::BillPay::YearSelector::YearSelector().
| auto GCW::Core::system_command | ( | const std::string & | cmd, |
| bool | show = false |
||
| ) |
| auto GCW::Core::to_htmlfile | ( | Wt::WTemplate & | templt, |
| const std::string & | folderName, | ||
| const std::string & | fileName | ||
| ) |
| auto GCW::Core::to_htmlfile | ( | Wt::WTemplate * | templt, |
| const std::string & | folderName, | ||
| const std::string & | fileName | ||
| ) |
Definition at line 1006 of file Core.cpp.
References to_htmlfile().
| auto GCW::Core::to_string | ( | Wt::WTemplate & | templt | ) |
Definition at line 960 of file Core.cpp.
Referenced by to_htmlfile(), and to_string().
| auto GCW::Core::to_string | ( | Wt::WTemplate * | templt | ) |
Definition at line 987 of file Core.cpp.
References to_string().
| Wt::Json::Object GCW::Core::toJson | ( | Wt::WTreeView * | _view | ) |
Definition at line 157 of file Core.cpp.
References Wt::WString::arg(), iterate(), and Wt::WString::toUTF8().
| std::string & GCW::Core::trim | ( | std::string & | s, |
| const char * | t = trim_ws |
||
| ) |
| auto GCW::Core::ucase | ( | const std::string & | value | ) |
|
extern |