|
bpp-core
2.2.0
|
Tools to deal with the keyval syntax. More...
#include <Bpp/Text/KeyvalTools.h>
Public Member Functions | |
| KeyvalTools () | |
| virtual | ~KeyvalTools () |
Static Public Member Functions | |
| static void | singleKeyval (const std::string &desc, std::string &key, std::string &val, const std::string &split="=") throw (KeyvalException) |
| Split a string into a key and a value (General purpose function). More... | |
| static void | multipleKeyvals (const std::string &desc, std::map< std::string, std::string > &keyvals, const std::string &split=",", bool nested=true) throw (KeyvalException) |
| Split a string into several keys and corresponding values (General purpose function). More... | |
| static void | parseProcedure (const std::string &desc, std::string &name, std::map< std::string, std::string > &args) throw (KeyvalException) |
| Parse (not recursively) a procedure string. More... | |
Tools to deal with the keyval syntax.
This class contains method to deal with parameter=value syntax procedure. A keyval procedure takes the form
where 'p' are parameter names, and 'v' are the corresponding values. These values can be nested keyval procedures.
Definition at line 74 of file KeyvalTools.h.
| bpp::KeyvalTools::KeyvalTools | ( | ) |
|
virtual |
|
static | ||||||||||||||||||||||||||||
Split a string into several keys and corresponding values (General purpose function).
| desc | [in] A string descibing the keyval, with format key1=val1,key2=val2,etc (space are considered normal character, that's up to you to deal with that afterward!). |
| keyvals | [out] Will contain the text of the keys and their corresponding values. |
| split | [in] The keyval delimiter.the default is a coma, but a space character can be used for instance. |
| nested | [in] Tell if nested keyval procedures are expected. |
| KeyvalException | If the syntax describing the keyval is not correct. |
Definition at line 58 of file KeyvalTools.cpp.
References bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), and bpp::TextTools::removeSurroundingWhiteSpaces().
Referenced by bpp::NumCalcApplicationTools::getVector().
|
static | ||||||||||||||||||||||||
Parse (not recursively) a procedure string.
| desc | [in] A string descibing the keyval procedure. |
| name | [out] Outputs the name of the procedure. |
| args | [out] Fills a map with all keys and values for parameters. |
| KeyvalException | If the description is invalid (one parenthesis is missing for instance). |
Definition at line 98 of file KeyvalTools.cpp.
References bpp::TextTools::isEmpty(), and bpp::TextTools::removeFirstWhiteSpaces().
Referenced by bpp::BppODiscreteDistributionFormat::read().
|
static | ||||||||||||||||||||||||||||
Split a string into a key and a value (General purpose function).
| desc | [in] A string descibing the keyval, with format key=val (space are considered normal character, that's up to you to deal with that afterward!). |
| key | [out] Will contain the text of the key. |
| val | [out] Will contain the text of the value. |
| split | [in] The delimiter. Default is '=' but ':' can be used. |
| KeyvalException | If the syntax describing the keyval is not correct. |
Definition at line 49 of file KeyvalTools.cpp.