|
Graphite Version 3
An experimental 3D geometry processing program
|
Manages a set of name-value or name-values pairs, used to manipulate text files. More...
#include <OGF/basic/os/text_utils.h>
Public Member Functions | |
| bool | has_variable (const std::string &name) const |
| Tests whether a variable exists in this Environment. | |
| std::string | value (const std::string &name) const |
| Gets the value of a variable. | |
| const std::vector< std::string > & | values (const std::string &name) const |
| Gets the vector of values associated with a variable. | |
| void | set_value (const std::string &name, const std::string &value) |
| Sets the value of a variable. | |
| void | set_values (const std::string &name, const std::vector< std::string > &values) |
| Sets the values of a variable. | |
| void | append_value (const std::string &name, const std::string &value) |
| Appends a value to the set of values associated with a variable. | |
| void | append_values (const std::string &name, const std::vector< std::string > &values) |
| Appends a set of values to the set of values associated with a variable. | |
| void | clear_value (const std::string &name) |
| Clears the values of a variable. | |
| void | clear () |
| Removes all the variables and their values. | |
| void | print (std::ostream &out) const |
| Outputs the contents of this Enviroment to a stream. | |
Manages a set of name-value or name-values pairs, used to manipulate text files.
Definition at line 61 of file text_utils.h.
| void OGF::TextUtils::Environment::append_value | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Appends a value to the set of values associated with a variable.
If the variable did not exist, it creates it. If one of the values has the form "$var" and a variable named "var" exists in this Environment, then it is replaced with the set of values of variable "var".
| [in] | name | name of the variable |
| [in] | value | value to be associated with the variable |
| void OGF::TextUtils::Environment::append_values | ( | const std::string & | name, |
| const std::vector< std::string > & | values | ||
| ) |
Appends a set of values to the set of values associated with a variable.
If the variable did not exist, it creates it. If one of the values has the form "$var" and a variable named "var" exists in this Environment, then it is replaced with the set of values of variable "var".
| [in] | name | name of the variable |
| [in] | values | new vector of values to be associated with the variable |
| void OGF::TextUtils::Environment::clear_value | ( | const std::string & | name | ) |
Clears the values of a variable.
If the variable did not exist, it creates it with an empty value. If it already existed, it overwrites its contents with an empty value.
| [in] | name | name of the variable |
| bool OGF::TextUtils::Environment::has_variable | ( | const std::string & | name | ) | const |
Tests whether a variable exists in this Environment.
| [in] | name | name of the variable |
| true | if the variable exists |
| false | otherwise |
| void OGF::TextUtils::Environment::print | ( | std::ostream & | out | ) | const |
Outputs the contents of this Enviroment to a stream.
| [in,out] | out | the stream where the contents of this Environment should be output |
| void OGF::TextUtils::Environment::set_value | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Sets the value of a variable.
If the variable did not exist, it creates it. If it already existed, it overwrites its previous content. If value has the form "$var" and a variable named "var" exists in this Environment, then it is replaced with the set of values of variable "var".
| [in] | name | name of the variable |
| [in] | value | new value of the variable |
| void OGF::TextUtils::Environment::set_values | ( | const std::string & | name, |
| const std::vector< std::string > & | values | ||
| ) |
Sets the values of a variable.
If the variable did not exist, it creates it. If it already existed, it overwrites its previous content. If one of the values has the form "$var" and a variable named "var" exists in this Environment, then it is replaced with the set of values of variable "var".
| [in] | name | name of the variable |
| [in] | values | new vector of values to be associated with the variable |
| std::string OGF::TextUtils::Environment::value | ( | const std::string & | name | ) | const |
Gets the value of a variable.
| [in] | name | name of the variable |
variable if it existed, or an empty string otherwise, then this creates the variable | const std::vector< std::string > & OGF::TextUtils::Environment::values | ( | const std::string & | name | ) | const |
Gets the vector of values associated with a variable.
If the variable does not exists, throws an assertion failure.
| [in] | name | name of the variable |
name