![]() |
PhoenixInkscape
2.0.0
Generate multiple png files with svg inkscape files
|
Dictionnary of values. More...
#include <DicoValue.h>
Public Member Functions | |
DicoValue () | |
Constructor of class DicoValue. More... | |
DicoValue (const DicoValue &other) | |
Copy Constructor of class DicoValue. More... | |
bool | fromString (const PString &content) |
Create a DicoValue from a PString. More... | |
PString & | getKey () |
Gets the key of the DicoValue. More... | |
const PString & | getKey () const |
Gets the key of the DicoValue. More... | |
DicoValue * | getMap (const PString &key) |
Get a DicoValue in the map of the current one. More... | |
const DicoValue * | getMap (const PString &key) const |
Get a DicoValue in the map of the current one. More... | |
std::map< PString, DicoValue > & | getMapChild () |
Gets the mapChild of the DicoValue. More... | |
const std::map< PString, DicoValue > & | getMapChild () const |
Gets the mapChild of the DicoValue. More... | |
PString | getString () const |
Get a string value without the first and/or last quote or double quote in there are some. More... | |
PString & | getValue () |
Gets the value of the DicoValue. More... | |
template<typename T > | |
T | getValue () const |
Convert the value of the current DicoValue into a type. More... | |
const PString & | getValue () const |
Gets the value of the DicoValue. More... | |
std::vector< DicoValue > & | getVecChild () |
Gets the vecChild of the DicoValue. More... | |
const std::vector< DicoValue > & | getVecChild () const |
Gets the vecChild of the DicoValue. More... | |
bool | hasKey () const |
Say if the DicoValue has a key. More... | |
bool | hasMap () const |
Say if the DicoValue has a map of children. More... | |
bool | hasVec () const |
Say if the DicoValue has a vector of children. More... | |
bool | isKeyExist (const PString &key) const |
Say if the given key exists in the map of children. More... | |
bool | load (const PPath &fileName) |
Load the DicoValue with a text file. More... | |
DicoValue & | operator= (const DicoValue &other) |
Operator = of class DicoValue. More... | |
void | print () const |
Print the DicoValue. More... | |
bool | save (const PPath &fileName, const PString &valueDecorator="", PString baseIndentation="\t", PString baseNewLine="\n") const |
Save the DicoValue with a text file. More... | |
void | setKey (const PString &key) |
Sets the key of the DicoValue. More... | |
void | setMapChild (const std::map< PString, DicoValue > &mapChild) |
Sets the mapChild of the DicoValue. More... | |
void | setValue (const PString &value) |
Sets the value of the DicoValue. More... | |
void | setVecChild (const std::vector< DicoValue > &vecChild) |
Sets the vecChild of the DicoValue. More... | |
PString | toString (const PString &valueDecorator="", PString baseIndentation="\t", PString baseNewLine="\n") const |
Convert the DicoValue into a string. More... | |
virtual | ~DicoValue () |
Destructor of class DicoValue. More... | |
Protected Member Functions | |
void | copyDicoValue (const DicoValue &other) |
Copy Function of class DicoValue. More... | |
Private Member Functions | |
bool | errorAt (PFileParser &parser, bool &isRunning, const PString &errorMsg) |
Print the parsing error. More... | |
bool | loadParser (PFileParser &parser) |
Load the DicoValue with a parser. More... | |
bool | parseDicoValue (PFileParser &parser, bool &isRunning) |
Parse a DicoValue with a text file. More... | |
bool | parseListOrMap (PFileParser &parser, bool &isRunning) |
Parse a list or a map. More... | |
PString | parseString (PFileParser &parser) |
Parse a string. More... | |
PString | saveRecurse (const PString &indentation, const PString &valueDecorator, PString baseIndentation, PString baseNewLine) const |
Save the DicoValue with a text file. More... | |
Private Attributes | |
PString | p_key |
Key of the current entry. More... | |
std::map< PString, DicoValue > | p_mapChild |
Map of sub DicoValue. More... | |
PString | p_value |
Value of the current entry. More... | |
std::vector< DicoValue > | p_vecChild |
Vector of sub DicoValue. More... | |
Dictionnary of values.
Definition at line 17 of file DicoValue.h.
DicoValue::DicoValue | ( | ) |
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().
|
virtual |
|
protected |
Copy Function of class DicoValue.
other | : DicoValue we want ot copy |
Definition at line 232 of file DicoValue.cpp.
References p_key, p_mapChild, p_value, and p_vecChild.
Referenced by DicoValue(), and operator=().
|
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 337 of file DicoValue.cpp.
References PFileParser::getLocation().
Referenced by loadParser(), parseDicoValue(), and parseListOrMap().
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(), and PFileParser::setFileContent().
Referenced by testFromJSonToJSon().
PString & DicoValue::getKey | ( | ) |
const PString & DicoValue::getKey | ( | ) | const |
Gets the key of the DicoValue.
Definition at line 190 of file DicoValue.cpp.
References p_key.
Referenced by dico_find_all_var(), and testDicoValue().
Get a DicoValue in the map of the current one.
key | : name of the DicoValue to get |
Definition at line 129 of file DicoValue.cpp.
References p_mapChild.
Get a DicoValue in the map of the current one.
key | : name of the DicoValue to get |
Definition at line 116 of file DicoValue.cpp.
References p_mapChild.
Referenced by checkConstDicoValue(), 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 >(), phoenix_load_vecValue_from_config(), testDicoDicoString(), testDicoDicoValueKeyPtr(), testDicoValue(), testDicoValue3(), testDicoVecString(), and testDicoVecValue().
Gets the mapChild of the DicoValue.
Definition at line 225 of file DicoValue.cpp.
References p_mapChild.
Gets the mapChild of the DicoValue.
Definition at line 218 of file DicoValue.cpp.
References p_mapChild.
Referenced by checkLoadFromConfig(), dico_find_all_var(), phoenix_save_value_to_dico(), testDicoDicoValueKeyPtr(), testDicoValue(), and testDicoValue2().
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 183 of file DicoValue.cpp.
References PString::eraseFirstLastChar(), and p_value.
Referenced by dico_find_all_var(), phoenix_get_string(), phoenix_load_value_from_config< bool >(), and phoenix_load_value_from_dico< bool >().
PString & DicoValue::getValue | ( | ) |
T DicoValue::getValue |
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(), phoenix_load_value_from_dico(), testDicoValue(), testDicoValueKey(), and testDicoValueKeyPtr().
const PString & DicoValue::getValue | ( | ) | const |
std::vector< DicoValue > & DicoValue::getVecChild | ( | ) |
Gets the vecChild of the DicoValue.
Definition at line 211 of file DicoValue.cpp.
References p_vecChild.
const std::vector< DicoValue > & DicoValue::getVecChild | ( | ) | const |
Gets the vecChild of the DicoValue.
Definition at line 204 of file DicoValue.cpp.
References p_vecChild.
Referenced by checkLoadFromConfig(), dico_find_all_var(), phoenix_get_vecstring(), phoenix_load_vecValue_from_config(), testDicoValue(), and testDicoVecValueKeyPtr().
bool DicoValue::hasKey | ( | ) | const |
Say if the DicoValue has a key.
Definition at line 91 of file DicoValue.cpp.
References p_key.
Referenced by checkLoadFromConfig(), and dico_find_all_var().
bool DicoValue::hasMap | ( | ) | const |
Say if the DicoValue has a map of children.
Definition at line 96 of file DicoValue.cpp.
References p_mapChild.
Referenced by checkLoadFromConfig(), and dico_find_all_var().
bool DicoValue::hasVec | ( | ) | const |
Say if the DicoValue has a vector of children.
Definition at line 101 of file DicoValue.cpp.
References p_vecChild.
Referenced by checkLoadFromConfig(), and dico_find_all_var().
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 107 of file DicoValue.cpp.
References p_mapChild.
Referenced by testDicoValue2().
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().
Referenced by testDicoBadParsing(), testDicoDicoString(), testDicoGoodParsing(), testDicoValue(), testDicoValue2(), testDicoValue3(), testDicoVecString(), testDicoVecValue(), and testFromJSonToJSon().
|
private |
Load the DicoValue with a parser.
[out] | parser | : parser to be used |
Definition at line 243 of file DicoValue.cpp.
References errorAt(), PFileParser::isEndOfFile(), parseDicoValue(), PFileParser::setEscapeChar(), PFileParser::setSeparator(), PFileParser::setWhiteSpace(), and PFileParser::skipWhiteSpace().
Referenced by fromString(), and load().
Operator = of class DicoValue.
other | : DicoValue we want ot copy |
Definition at line 31 of file DicoValue.cpp.
References copyDicoValue().
|
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 263 of file DicoValue.cpp.
References errorAt(), PFileParser::getStrComposedOf(), PFileParser::isMatch(), p_key, p_value, parseListOrMap(), parseString(), and PFileParser::skipWhiteSpace().
Referenced by loadParser(), and parseListOrMap().
|
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 293 of file DicoValue.cpp.
References errorAt(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PFileParser::isMatchRewind(), p_key, p_mapChild, p_vecChild, and parseDicoValue().
Referenced by parseDicoValue().
|
private |
Parse a string.
[out] | parser | : parser to be used |
Definition at line 322 of file DicoValue.cpp.
References PFileParser::getUntilKeyWithoutPatern(), and PFileParser::isMatch().
Referenced by parseDicoValue().
void DicoValue::print | ( | ) | const |
Print the DicoValue.
Definition at line 82 of file DicoValue.cpp.
References saveRecurse().
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 PPath::saveFileContent(), and toString().
Referenced by saveDico(), testDicoSaveParsing(), and testFromJSonToJSon().
|
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 |
Definition at line 351 of file DicoValue.cpp.
References PString::find(), p_key, p_mapChild, p_value, and p_vecChild.
Referenced by print(), and toString().
void DicoValue::setKey | ( | const PString & | key | ) |
Sets the key of the DicoValue.
key | : key of the DicoValue |
Definition at line 148 of file DicoValue.cpp.
References p_key.
Referenced by checkLoadFromConfig(), and phoenix_save_value_to_dico().
Sets the mapChild of the DicoValue.
mapChild | : mapChild of the DicoValue |
Definition at line 162 of file DicoValue.cpp.
References p_mapChild.
Referenced by testDicoValue().
void DicoValue::setValue | ( | const PString & | value | ) |
Sets the value of the DicoValue.
value | : value of the DicoValue |
Definition at line 141 of file DicoValue.cpp.
References p_value.
Referenced by checkLoadFromConfig(), dico_update_all_nestedCall(), phoenix_save_value_to_dico(), and testDicoSaveParsing().
void DicoValue::setVecChild | ( | const std::vector< DicoValue > & | vecChild | ) |
Sets the vecChild of the DicoValue.
vecChild | : vecChild of the DicoValue |
Definition at line 155 of file DicoValue.cpp.
References p_vecChild.
Referenced by testDicoValue().
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 74 of file DicoValue.cpp.
References saveRecurse().
Referenced by save(), and testFromJSonToJSon().
|
private |
Key of the current entry.
Definition at line 69 of file DicoValue.h.
Referenced by copyDicoValue(), getKey(), hasKey(), parseDicoValue(), parseListOrMap(), saveRecurse(), and setKey().
Map of sub DicoValue.
Definition at line 73 of file DicoValue.h.
Referenced by copyDicoValue(), getMap(), getMapChild(), hasMap(), isKeyExist(), parseListOrMap(), saveRecurse(), and setMapChild().
|
private |
Value of the current entry.
Definition at line 67 of file DicoValue.h.
Referenced by copyDicoValue(), getString(), getValue(), parseDicoValue(), saveRecurse(), and setValue().
|
private |
Vector of sub DicoValue.
Definition at line 71 of file DicoValue.h.
Referenced by copyDicoValue(), getVecChild(), hasVec(), parseListOrMap(), saveRecurse(), and setVecChild().