Utility class
es and functions are member of this namespace
.
More...
Classes | |
class | Global |
Manager of global objects. More... | |
struct | IsBasic |
This meta-function checks if a type is either bool , double , string , ptime or unsigned int or not. More... | |
struct | IsBasicOrEnum |
This meta-function checks if a type is either bool , double , string , ptime , unsigned int or enum or not. More... | |
class | NullDeleter |
A shared_ptr deleter that does not do anything. More... | |
class | Saver |
Saves a variable reference at construction time to restore/set its value at destruction time. More... | |
Functions | |
template<typename From , typename To > | |
To | Lexical (const From &input) |
Converts from type From to type To. | |
ptime | tenor2ptime (const ptime &start, const string &tenor) |
Convert a tenor string (from a start date) into the corresponding date. |
Utility class
es and functions are member of this namespace
.
To keyvalue::util::Lexical | ( | const From & | input | ) |
Converts from type From to type To.
From | : (template parameter) The input type; | |
To | : (template parameter) The output type; | |
input | : Data to be converted. |
For | <From, To> = <double , bool> : It returns true if input != 0.0. Otherwise, it returns false . | |
For | <From, To> = <bool , double> : It returns 1.0 if input = true and 0.0 if input = false . | |
For | <From, To> = <string , bool> : It returns true if input is either "TRUE", "True", "true", "YES", "Yes", "yes", "Y" or "y". It returns false if input is either "FALSE", "False", "false", "NO", "No", "no", "N" or "n". | |
For | <From, To> = <bool , string> : It returns "True" if input = true and "False" if input = false . | |
For | <From, To> = <string , double> : It returns the double represented by string input. | |
For | <From, To> = <double , string> : It returns the string representation of input. |
throw RuntimeError : If required conversion is invalid.
ptime keyvalue::util::tenor2ptime | ( | const ptime & | start, | |
const string & | tenor | |||
) |
Convert a tenor string (from a start date) into the corresponding date.
A tenor is a string of the form nP, where n is a positive integer and P is a char
defining a period of time. Possible values for P are:
This function returns the date which follows start by the amount of time defined by the tenor.
start | : The start date; | |
tenor | : The tenor. |
RuntimeError | : When an invalid tenor is provided. |