Functions | |
| Str | trim (Str str) |
| Trim string of leading and trailing blanks. | |
| void | split_file_name (Str file_name_in, Str &dir, Str &file_name, bool &is_relative) |
| Splits a file name into a directory string and base file name. | |
| int | string_to_int (const Str &str, bool &ok) |
| Converts a string to an integer. | |
| bool | is_int (const Str &str) |
| Tests if a string to an integer. | |
| double | string_to_double (const Str &str, bool &ok) |
| Converts a string to a real (double). | |
| bool | is_double (const Str &str) |
| Tests if a string to a double. | |
| bool | string_to_bool (const Str &str, bool &ok) |
| Converts a string to a logical bool. | |
| bool | is_bool (const Str &str) |
| Tests if a string to a bool. | |
| Str | bool_to_string (bool this_bool) |
| Converts a bool to a string. | |
| Str | int_to_string (const int i, bool &ok) |
| Converts an integer to a string. | |
| Str | double_to_string (const double r, bool &ok) |
| Converts an real double to a string. | |
| Str | str_to_upper (const Str &str_in) |
| Converts a string to upper case. | |
| Str | str_to_lower (const Str &str_in) |
| Converts a string to lower case. | |
| Str | add_parens (const Str &sub_expression, const Str &expression, int i0) |
| Adds parentheses "(...)" around a sub-expression that will be inserted in a larger expression. | |
| Str | add_parens (const Str &sub_expression, int op_level) |
| Adds parentheses "(...)" around an expression that will be inserted in a larger expression. | |
| Str | to_xml_string (Str str_in) |
| Converts characters "&", "<", ">", and '"' to their XML equivalents: "&", "<", etc. | |
| Str | from_xml_string (Str str_in) |
| Converts XML character entity reference references like "&", <", etc to their character equivalents: "&", "<", ">", "'", and '"'. | |
| Str | str_pop (StrList &str_list) |
| Pops the front item of the list and returns it. | |
| Str | element_val (StrList &s_list, int index) |
Returns the string value of an element in a StrList indexed by index. | |
| bool | found (StrList &s_list, const Str &item) |
| Returns true if an item is in the list. | |
| StrListIter | find (StrList &s_list, const Str &item) |
| Returns an iterator to a matching item in a list. | |
| StrList | list_copy (StrListIter begin, StrListIter end) |
| Returns a copy of a list: [begin, end). | |
| bool | found_value (StrMap &string_map, const Str &item) |
| Returns true if an item is a value in a map. | |
| bool | get_taylor_exponents (const Str &exp_str, IntVec &exp_vec) |
| Decomposes an exponent string like "0 2 1 0 0 0" into its component numbers. | |
| bool | splitXMLName (const Str &_name, Str &uri, Str &prefix, Str &loc_name) |
| Splits an XML name into a URI, prefix and local name components. | |
| string BasicUtilities::add_parens | ( | const Str & | sub_expression, | |
| int | op_level | |||
| ) |
Adds parentheses "(...)" around an expression that will be inserted in a larger expression.
The op_level argument indicates the level of the operators in the larger expression to either: op_level = 1: Add parantheses if there is a "+" or "-" operator outside of any parentheses. For example: An expression like "(a/b) + c" needs parentheses but the expression "a * (b + c)" does not. op_level = 2: Add parantheses if there is a "+", "-", "/", or "*" operator outside of any parentheses. For example: An expression like "a * c" needs parentheses but the expression "a^2" does not. side of the insertion point. This is useful when adding an expression to a larger expression.
| sub_expression | Input expression | |
| op_level | Level of the operators in the larger expression to either side of the insertion point. |
Definition at line 374 of file BasicUtilities.cpp.
| string BasicUtilities::add_parens | ( | const Str & | sub_expression, | |
| const Str & | expression, | |||
| int | i0 | |||
| ) |
Adds parentheses "(...)" around a sub-expression that will be inserted in a larger expression.
| sub_expression | Sub-expression to be inserted. | |
| expression | Larger expression. | |
| i0 | Insertion point. |
Definition at line 346 of file BasicUtilities.cpp.
| string BasicUtilities::bool_to_string | ( | bool | this_bool | ) |
Converts a bool to a string.
| this_bool | Bool input. |
Definition at line 264 of file BasicUtilities.cpp.
| string BasicUtilities::double_to_string | ( | const double | r, | |
| bool & | ok | |||
| ) |
Converts an real double to a string.
| r | Double input. | |
| ok | True if conversion OK. False otherwise. |
Definition at line 313 of file BasicUtilities.cpp.
| std::string BasicUtilities::element_val | ( | StrList & | s_list, | |
| int | index | |||
| ) |
Returns the string value of an element in a StrList indexed by index.
| s_list | List of strings. | |
| index | Index of element in s_list. |
Definition at line 73 of file BasicUtilities.cpp.
| StrListIter BasicUtilities::find | ( | StrList & | s_list, | |
| const Str & | item | |||
| ) |
Returns an iterator to a matching item in a list.
| s_list | List of strings. | |
| item | String to search for. |
Definition at line 477 of file BasicUtilities.cpp.
| bool BasicUtilities::found | ( | StrList & | s_list, | |
| const Str & | item | |||
| ) |
Returns true if an item is in the list.
| s_list | List of strings. | |
| item | String to search for. |
| bool BasicUtilities::found_value | ( | StrMap & | string_map, | |
| const Str & | item | |||
| ) |
Returns true if an item is a value in a map.
| string_map | Key/Value map. | |
| item | String to search for. |
Definition at line 470 of file BasicUtilities.cpp.
| string BasicUtilities::from_xml_string | ( | Str | str_in | ) |
Converts XML character entity reference references like "&", <", etc to their character equivalents: "&", "<", ">", "'", and '"'.
| str_in | Input XML string. |
Definition at line 432 of file BasicUtilities.cpp.
| bool BasicUtilities::get_taylor_exponents | ( | const Str & | exp_str, | |
| IntVec & | exp_vec | |||
| ) |
Decomposes an exponent string like "0 2 1 0 0 0" into its component numbers.
| exp_str | Input exponent string. | |
| exp_vec | Output vector of 6 exponents. |
Definition at line 509 of file BasicUtilities.cpp.
| string BasicUtilities::int_to_string | ( | const int | i, | |
| bool & | ok | |||
| ) |
Converts an integer to a string.
| i | Integer input. | |
| ok | True if conversion OK. False otherwise. |
Definition at line 289 of file BasicUtilities.cpp.
| bool BasicUtilities::is_bool | ( | const Str & | str | ) |
Tests if a string to a bool.
| str | String to convert. |
Definition at line 272 of file BasicUtilities.cpp.
| bool BasicUtilities::is_double | ( | const Str & | str | ) |
Tests if a string to a double.
| str | String to convert. |
Definition at line 224 of file BasicUtilities.cpp.
| bool BasicUtilities::is_int | ( | const Str & | str | ) |
Tests if a string to an integer.
| str | String to convert. |
Definition at line 186 of file BasicUtilities.cpp.
| StrList BasicUtilities::list_copy | ( | StrListIter | begin, | |
| StrListIter | end | |||
| ) |
Returns a copy of a list: [begin, end).
| begin | Beginning of copy region | |
| end | End of copy region. end is not copied! |
Definition at line 488 of file BasicUtilities.cpp.
| void BasicUtilities::split_file_name | ( | Str | file_name_in, | |
| Str & | dir, | |||
| Str & | file_name, | |||
| bool & | is_relative | |||
| ) |
Splits a file name into a directory string and base file name.
| file_name_in | The input file name. | |
| dir | Set to the directory with trailing '/'. | |
| file_name | The base file name stripped of the directory string. | |
| is_relative | Set True if the directory name is relative to the default directory (as opposed to an absolute path name). |
Definition at line 103 of file BasicUtilities.cpp.
| bool BasicUtilities::splitXMLName | ( | const Str & | _name, | |
| Str & | uri, | |||
| Str & | prefix, | |||
| Str & | loc_name | |||
| ) |
Splits an XML name into a URI, prefix and local name components.
| _name | A local/qualified/universal/or full name. | |
| uri | URI part of xml_name. | |
| prefix | Prefix part of the name | |
| loc_name | Local part of xml_name. | |
| prefix_found | Set false if a prefix was not defined. Set true otherwise. That is, set false when _name is a local-name or a universal-name. |
Definition at line 535 of file BasicUtilities.cpp.
| string BasicUtilities::str_pop | ( | StrList & | str_list | ) |
Pops the front item of the list and returns it.
| str_list | The list of strings. |
Definition at line 498 of file BasicUtilities.cpp.
| string BasicUtilities::str_to_lower | ( | const Str & | str_in | ) |
Converts a string to lower case.
| str_in | Input string. |
Definition at line 335 of file BasicUtilities.cpp.
| string BasicUtilities::str_to_upper | ( | const Str & | str_in | ) |
Converts a string to upper case.
| str_in | Input string. |
Definition at line 398 of file BasicUtilities.cpp.
| bool BasicUtilities::string_to_bool | ( | const Str & | str, | |
| bool & | ok | |||
| ) |
Converts a string to a logical bool.
| str | String to convert. | |
| ok | True if conversion OK. False otherwise. "" returns ok = false. |
Definition at line 241 of file BasicUtilities.cpp.
| double BasicUtilities::string_to_double | ( | const Str & | str, | |
| bool & | ok | |||
| ) |
Converts a string to a real (double).
| str | String to convert. | |
| ok | True if conversion OK. False otherwise. "" returns ok = false. |
Definition at line 201 of file BasicUtilities.cpp.
| int BasicUtilities::string_to_int | ( | const Str & | str, | |
| bool & | ok | |||
| ) |
Converts a string to an integer.
| str | String to convert. | |
| ok | True if conversion OK. False otherwise. "" returns ok = false. |
Definition at line 163 of file BasicUtilities.cpp.
| string BasicUtilities::to_xml_string | ( | Str | str_in | ) |
Converts characters "&", "<", ">", and '"' to their XML equivalents: "&", "<", etc.
Notice that single quote is not converted since it is assumed that double quotes will be used to bound the string.
| str_in | Input string. |
Definition at line 409 of file BasicUtilities.cpp.
| string BasicUtilities::trim | ( | Str | str | ) |
Trim string of leading and trailing blanks.
| str | String to be trimmed. |
Definition at line 84 of file BasicUtilities.cpp.
1.5.7