![]() |
|
PhoenixFileParser
1.5.1
Set of tools to ease file parsing
|
Dictionnary of values. More...
#include <DicoValue.h>
Public Member Functions | |
| DicoValue () | |
| Constructor of class DicoValue. | |
| DicoValue (const DicoValue &other) | |
| Copy Constructor of class DicoValue. | |
| bool | fromString (const PString &content) |
| Create a DicoValue from a PString. | |
| const DicoValue * | getElementInVecWhere (const PString &key, const PString &value) const |
| Get the element of a vector of children of the current DicoValue which has 'key'.value = value. | |
| PString & | getKey () |
| Gets the key of the DicoValue. | |
| const PString & | getKey () const |
| Gets the key of the DicoValue. | |
| DicoValue * | getMap (const PString &key) |
| Get a DicoValue in the map of the current one. | |
| const DicoValue * | getMap (const PString &key) const |
| Get a DicoValue in the map of the current one. | |
| const DicoValue * | getMap (const PVecString &vecKey) const |
| Get a nested DicoValue in the map of the current one. | |
| std::map< PString, DicoValue > & | getMapChild () |
| Gets the mapChild of the DicoValue. | |
| const std::map< PString, DicoValue > & | getMapChild () const |
| Gets the mapChild of the DicoValue. | |
| PString | getString () const |
| Get a string value without the first and/or last quote or double quote in there are some. | |
| PString & | getValue () |
| Gets the value of the DicoValue. | |
| template<typename T> | |
| T | getValue () const |
| Convert the value of the current DicoValue into a type. | |
| const PString & | getValue () const |
| Gets the value of the DicoValue. | |
| std::vector< DicoValue > & | getVecChild () |
| Gets the vecChild of the DicoValue. | |
| const std::vector< DicoValue > & | getVecChild () const |
| Gets the vecChild of the DicoValue. | |
| bool | hasKey () const |
| Say if the DicoValue has a key. | |
| bool | hasMap () const |
| Say if the DicoValue has a map of children. | |
| bool | hasVec () const |
| Say if the DicoValue has a vector of children. | |
| bool | isKeyExist (const PString &key) const |
| Say if the given key exists in the map of children. | |
| bool | load (const PPath &fileName) |
| Load the DicoValue with a text file. | |
| DicoValue & | operator= (const DicoValue &other) |
| Operator = of class DicoValue. | |
| void | print () const |
| Print the DicoValue. | |
| bool | save (const PPath &fileName, const PString &valueDecorator="", PString baseIndentation="\t", PString baseNewLine="\n") const |
| Save the DicoValue with a text file. | |
| void | setKey (const PString &key) |
| Sets the key of the DicoValue. | |
| void | setMapChild (const std::map< PString, DicoValue > &mapChild) |
| Sets the mapChild of the DicoValue. | |
| void | setValue (const PString &value) |
| Sets the value of the DicoValue. | |
| void | setVecChild (const std::vector< DicoValue > &vecChild) |
| Sets the vecChild of the DicoValue. | |
| PString | toString (const PString &valueDecorator="", PString baseIndentation="\t", PString baseNewLine="\n") const |
| Convert the DicoValue into a string. | |
| virtual | ~DicoValue () |
| Destructor of class DicoValue. | |
Protected Member Functions | |
| void | copyDicoValue (const DicoValue &other) |
| Copy Function of class DicoValue. | |
Private Member Functions | |
| bool | errorAt (PFileParser &parser, bool &isRunning, const PString &errorMsg) |
| Print the parsing error. | |
| bool | loadParser (PFileParser &parser) |
| Load the DicoValue with a parser. | |
| bool | parseDicoValue (PFileParser &parser, bool &isRunning) |
| Parse a DicoValue with a text file. | |
| bool | parseList (PFileParser &parser, bool &isRunning) |
| Parse a list or a map. | |
| bool | parseListOrMap (PFileParser &parser, bool &isRunning) |
| Parse a list or a map. | |
| bool | parseString (PString &parsedString, PFileParser &parser) |
| Parse a string. | |
| PString | saveRecurse (const PString &indentation, const PString &valueDecorator, PString baseIndentation, PString baseNewLine, bool isInList=false) const |
| Save the DicoValue with a text file. | |
Private Attributes | |
| PString | p_key |
| Key of the current entry. | |
| std::map< PString, DicoValue > | p_mapChild |
| Map of sub DicoValue. | |
| PString | p_value |
| Value of the current entry. | |
| std::vector< DicoValue > | p_vecChild |
| Vector of sub DicoValue. | |
Dictionnary of values.
Definition at line 17 of file DicoValue.h.
| DicoValue::DicoValue | ( | ) |
Constructor of class DicoValue.
Definition at line 11 of file DicoValue.cpp.
Referenced by copyDicoValue(), DicoValue(), getElementInVecWhere(), getMap(), getMap(), getMap(), operator=(), parseList(), and parseListOrMap().
Here is the caller graph for this function:| DicoValue::DicoValue | ( | const DicoValue & | other | ) |
Copy Constructor of class DicoValue.
| other | : DicoValue we want ot copy |
Definition at line 18 of file DicoValue.cpp.
References copyDicoValue(), and DicoValue().
Here is the call graph for this function:
|
virtual |
|
protected |
Copy Function of class DicoValue.
| other | : DicoValue we want ot copy |
Definition at line 278 of file DicoValue.cpp.
References DicoValue(), p_key, p_mapChild, p_value, and p_vecChild.
Referenced by DicoValue(), and operator=().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Print the parsing error.
| [out] | parser | : parser to be used |
| [out] | isRunning | : true to continue the parsing, false to stop it |
| errorMsg | : error message |
Definition at line 418 of file DicoValue.cpp.
References PFileParser::getLocation(), and PFileParser::getNextToken().
Referenced by loadParser(), parseDicoValue(), parseList(), and parseListOrMap().
Here is the call graph for this function:
Here is the caller graph for this function:| bool DicoValue::fromString | ( | const PString & | content | ) |
Create a DicoValue from a PString.
| content | : content to be parsed |
Definition at line 62 of file DicoValue.cpp.
References loadParser(), PFileParser::setEscapeChar(), and PFileParser::setFileContent().
Here is the call graph for this function:| const DicoValue * DicoValue::getElementInVecWhere | ( | const PString & | key, |
| const PString & | value ) const |
Get the element of a vector of children of the current DicoValue which has 'key'.value = value.
| key | : key to be found in a child of the current DicoValue |
| value | : expected value of the child |
Definition at line 149 of file DicoValue.cpp.
References DicoValue(), getMap(), getString(), hasVec(), and p_vecChild.
Here is the call graph for this function:| PString & DicoValue::getKey | ( | ) |
| const PString & DicoValue::getKey | ( | ) | const |
Gets the key of the DicoValue.
Definition at line 236 of file DicoValue.cpp.
References p_key.
Referenced by dico_find_all_var().
Here is the caller graph for this function:| DicoValue * DicoValue::getMap | ( | const PString & | key | ) |
Get a DicoValue in the map of the current one.
| key | : name of the DicoValue to get |
Definition at line 175 of file DicoValue.cpp.
References DicoValue(), and p_mapChild.
Here is the call graph for this function:| const DicoValue * DicoValue::getMap | ( | const PString & | key | ) | const |
Get a DicoValue in the map of the current one.
| key | : name of the DicoValue to get |
Definition at line 117 of file DicoValue.cpp.
References DicoValue(), and p_mapChild.
Referenced by getElementInVecWhere(), getMap(), phoenix_get_nested_string(), phoenix_get_string(), phoenix_get_string(), phoenix_get_vecstring(), phoenix_load_value_from_config(), phoenix_load_value_from_config< bool >(), phoenix_load_value_from_dico(), phoenix_load_value_from_dico< bool >(), and phoenix_load_vecValue_from_config().
Here is the call graph for this function:
Here is the caller graph for this function:| const DicoValue * DicoValue::getMap | ( | const PVecString & | vecKey | ) | const |
Get a nested DicoValue in the map of the current one.
| vecKey | : full address name of the DicoValue to get |
Definition at line 130 of file DicoValue.cpp.
References DicoValue(), getMap(), and hasMap().
Here is the call graph for this function:| std::map< PString, DicoValue > & DicoValue::getMapChild | ( | ) |
Gets the mapChild of the DicoValue.
Definition at line 271 of file DicoValue.cpp.
References p_mapChild.
| const std::map< PString, DicoValue > & DicoValue::getMapChild | ( | ) | const |
Gets the mapChild of the DicoValue.
Definition at line 264 of file DicoValue.cpp.
References p_mapChild.
Referenced by dico_find_all_var(), and phoenix_save_value_to_dico().
Here is the caller graph for this function:| PString DicoValue::getString | ( | ) | const |
Get a string value without the first and/or last quote or double quote in there are some.
Definition at line 229 of file DicoValue.cpp.
References p_value.
Referenced by dico_find_all_var(), getElementInVecWhere(), phoenix_get_nested_string(), phoenix_get_string(), phoenix_get_string(), phoenix_load_value_from_config< bool >(), and phoenix_load_value_from_dico< bool >().
Here is the caller graph for this function:| PString & DicoValue::getValue | ( | ) |
| T DicoValue::getValue | ( | ) | const |
Convert the value of the current DicoValue into a type.
Definition at line 16 of file DicoValue_impl.h.
References p_value.
Referenced by dico_update_all_nestedCall(), phoenix_load_value_from_config(), and phoenix_load_value_from_dico().
Here is the caller graph for this function:| const PString & DicoValue::getValue | ( | ) | const |
| std::vector< DicoValue > & DicoValue::getVecChild | ( | ) |
Gets the vecChild of the DicoValue.
Definition at line 257 of file DicoValue.cpp.
References p_vecChild.
| const std::vector< DicoValue > & DicoValue::getVecChild | ( | ) | const |
Gets the vecChild of the DicoValue.
Definition at line 250 of file DicoValue.cpp.
References p_vecChild.
Referenced by dico_find_all_var(), phoenix_get_vecstring(), and phoenix_load_vecValue_from_config().
Here is the caller graph for this function:| bool DicoValue::hasKey | ( | ) | const |
Say if the DicoValue has a key.
Definition at line 92 of file DicoValue.cpp.
References p_key.
Referenced by dico_find_all_var().
Here is the caller graph for this function:| bool DicoValue::hasMap | ( | ) | const |
Say if the DicoValue has a map of children.
Definition at line 97 of file DicoValue.cpp.
References p_mapChild.
Referenced by dico_find_all_var(), and getMap().
Here is the caller graph for this function:| bool DicoValue::hasVec | ( | ) | const |
Say if the DicoValue has a vector of children.
Definition at line 102 of file DicoValue.cpp.
References p_vecChild.
Referenced by dico_find_all_var(), and getElementInVecWhere().
Here is the caller graph for this function:| bool DicoValue::isKeyExist | ( | const PString & | key | ) | const |
Say if the given key exists in the map of children.
| key | : key to be checked |
Definition at line 108 of file DicoValue.cpp.
References p_mapChild.
| bool DicoValue::load | ( | const PPath & | fileName | ) |
Load the DicoValue with a text file.
| fileName | : name of the file to be loaded |
Definition at line 40 of file DicoValue.cpp.
References loadParser(), and PFileParser::open().
Here is the call graph for this function:
|
private |
Load the DicoValue with a parser.
| [out] | parser | : parser to be used |
Definition at line 289 of file DicoValue.cpp.
References errorAt(), PFileParser::isEndOfFile(), parseDicoValue(), PFileParser::setEscapeChar(), PFileParser::setSeparator(), PFileParser::setWhiteSpace(), and PFileParser::skipWhiteSpace().
Referenced by fromString(), and load().
Here is the call graph for this function:
Here is the caller graph for this function:Operator = of class DicoValue.
| other | : DicoValue we want ot copy |
Definition at line 31 of file DicoValue.cpp.
References copyDicoValue(), and DicoValue().
Here is the call graph for this function:
|
private |
Parse a DicoValue with a text file.
| [out] | parser | : parser to be used |
| [out] | isRunning | : true to continue the parsing, false to stop it |
Definition at line 309 of file DicoValue.cpp.
References errorAt(), PFileParser::getStrComposedOf(), PFileParser::isMatch(), p_key, p_value, parseDicoValue(), parseList(), parseListOrMap(), parseString(), and PFileParser::skipWhiteSpace().
Referenced by loadParser(), parseDicoValue(), parseList(), and parseListOrMap().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Parse a list or a map.
| [out] | parser | : parser to be used |
| [out] | isRunning | : true to continue the parsing, false to stop it |
Definition at line 369 of file DicoValue.cpp.
References DicoValue(), errorAt(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PFileParser::isMatchRewind(), p_key, p_mapChild, p_vecChild, and parseDicoValue().
Referenced by parseDicoValue().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Parse a list or a map.
| [out] | parser | : parser to be used |
| [out] | isRunning | : true to continue the parsing, false to stop it |
Definition at line 341 of file DicoValue.cpp.
References DicoValue(), errorAt(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PFileParser::isMatchRewind(), p_key, p_mapChild, p_vecChild, and parseDicoValue().
Referenced by parseDicoValue().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Parse a string.
| [out] | parsedString | : parsed string |
| [out] | parser | : parser to be used |
Definition at line 399 of file DicoValue.cpp.
References PFileParser::getUntilKeyWithoutPatern(), and PFileParser::isMatch().
Referenced by parseDicoValue().
Here is the call graph for this function:
Here is the caller graph for this function:| void DicoValue::print | ( | ) | const |
Print the DicoValue.
Definition at line 83 of file DicoValue.cpp.
References saveRecurse().
Here is the call graph for this function:| bool DicoValue::save | ( | const PPath & | fileName, |
| const PString & | valueDecorator = "", | ||
| PString | baseIndentation = "\t", | ||
| PString | baseNewLine = "\n" ) const |
Save the DicoValue with a text file.
| fileName | : name of the file to be saved |
| valueDecorator | : string to add around keys and values ('"' for JSON) |
| baseIndentation | : indentation character(s) to be used |
| baseNewLine | : new line character(s) to be used |
Definition at line 53 of file DicoValue.cpp.
References toString().
Here is the call graph for this function:
|
private |
Save the DicoValue with a text file.
| indentation | : indentation of the current DicoValue |
| valueDecorator | : decorator to put around keys and values ('"' for JSON) |
| baseIndentation | : indentation character(s) to be used |
| baseNewLine | : new line character(s) to be used |
| isInList | : true if the dico value is in a list |
Definition at line 434 of file DicoValue.cpp.
References p_key, p_mapChild, p_value, and p_vecChild.
Referenced by print(), and toString().
Here is the caller graph for this function:| void DicoValue::setKey | ( | const PString & | key | ) |
Sets the key of the DicoValue.
| key | : key of the DicoValue |
Definition at line 194 of file DicoValue.cpp.
References p_key.
Referenced by phoenix_save_value_to_dico().
Here is the caller graph for this function:| void DicoValue::setMapChild | ( | const std::map< PString, DicoValue > & | mapChild | ) |
Sets the mapChild of the DicoValue.
| mapChild | : mapChild of the DicoValue |
Definition at line 208 of file DicoValue.cpp.
References p_mapChild.
| void DicoValue::setValue | ( | const PString & | value | ) |
Sets the value of the DicoValue.
| value | : value of the DicoValue |
Definition at line 187 of file DicoValue.cpp.
References p_value.
Referenced by dico_update_all_nestedCall(), and phoenix_save_value_to_dico().
Here is the caller graph for this function:| void DicoValue::setVecChild | ( | const std::vector< DicoValue > & | vecChild | ) |
Sets the vecChild of the DicoValue.
| vecChild | : vecChild of the DicoValue |
Definition at line 201 of file DicoValue.cpp.
References p_vecChild.
| PString DicoValue::toString | ( | const PString & | valueDecorator = "", |
| PString | baseIndentation = "\t", | ||
| PString | baseNewLine = "\n" ) const |
Convert the DicoValue into a string.
| valueDecorator | : string to add around keys and values ('"' for JSON) |
| baseIndentation | : indentation character(s) to be used |
| baseNewLine | : new line character(s) to be used |
Definition at line 75 of file DicoValue.cpp.
References saveRecurse().
Referenced by save().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Key of the current entry.
Definition at line 72 of file DicoValue.h.
Referenced by copyDicoValue(), getKey(), getKey(), hasKey(), parseDicoValue(), parseList(), parseListOrMap(), saveRecurse(), and setKey().
|
private |
Map of sub DicoValue.
Definition at line 76 of file DicoValue.h.
Referenced by copyDicoValue(), getMap(), getMap(), getMapChild(), getMapChild(), hasMap(), isKeyExist(), parseList(), parseListOrMap(), saveRecurse(), and setMapChild().
|
private |
Value of the current entry.
Definition at line 70 of file DicoValue.h.
Referenced by copyDicoValue(), getString(), getValue(), getValue(), parseDicoValue(), saveRecurse(), and setValue().
|
private |
Vector of sub DicoValue.
Definition at line 74 of file DicoValue.h.
Referenced by copyDicoValue(), getElementInVecWhere(), getVecChild(), getVecChild(), hasVec(), parseList(), parseListOrMap(), saveRecurse(), and setVecChild().