33 if(varNameCall !=
""){
51 for(std::vector<PNestedStr>::const_iterator it(vecNestedStr.begin()); it != vecNestedStr.end(); ++it){
52 if(it->getIsVarCall()){
53 PMapKnownVar::const_iterator itCall(mapKeyVariable.find(varBegin + it->getValue() + varEnd));
54 if(itCall != mapKeyVariable.end()){
55 out += itCall->second;
57 out += varBegin + it->getValue() + varEnd;
60 out += it->getValue();
73 if(varBegin ==
"" || varEnd ==
""){
return baseStr;}
93 bool hasNestedCall(
false);
103 if(varNameCall !=
""){
108 hasNestedCall =
true;
111 return hasNestedCall;
124 for(MapDicoValue::iterator it(mapDico.begin()); it != mapDico.end(); ++it){
125 dico_find_all_var(mapReadyVar, mapNestedVar, mapVarWithNestedCall, it->second, varIdentifier);
129 for(VecDicoValue::iterator it(vecDico.begin()); it != vecDico.end(); ++it){
130 dico_find_all_var(mapReadyVar, mapNestedVar, mapVarWithNestedCall, *it, varIdentifier);
139 mapNestedVar.push_back(std::pair<PNestedCall, DicoValue*>(call, &dico));
140 mapVarWithNestedCall[varName] = std::pair<PNestedCall, DicoValue*>(call, &dico);
142 mapReadyVar[varName] = strValue;
162 for(std::vector<PNestedStr>::iterator it(vecNestedStr.begin()); it != vecNestedStr.end(); ++it){
163 if(!it->getIsVarCall()){
164 outputValue += it->getValue();
167 PString varName(it->getValue());
169 MapVarWithNestedCall::iterator itNested = mapVarWithNestedCall.find(varName);
170 if(itNested != mapVarWithNestedCall.end()){
171 dico_update_all_nestedCall(mapReadyVar, mapNestedVar, mapVarWithNestedCall, itNested->second.first, itNested->second.second, varIdentifier);
172 mapVarWithNestedCall.erase(varName);
176 PMapKnownVar::iterator itReady = mapReadyVar.find(varName);
177 if(itReady != mapReadyVar.end()){
178 outputValue += itReady->second;
181 outputValue += varIdentifier +
"{" + varName +
"}";
186 if(prevValue.size() != 0lu){
187 if(prevValue.front() ==
'\''){firstQuote =
"'";}
188 else if(prevValue.front() ==
'"'){firstQuote =
"\"";}
190 dico->
setValue(firstQuote + outputValue + firstQuote);
193 mapReadyVar[nestedCall.
getName()] = outputValue;
206 for(PVecReplaceVar::iterator itNested(mapNestedVar.begin()); itNested != mapNestedVar.end(); ++itNested){
223 dico_find_all_var(mapReadyVar, mapNestedVar, mapVarWithNestedCall, dico, varIdentifier);
std::map< PString, DicoValue > MapDicoValue
Vector of DicoValue.
std::vector< DicoValue > VecDicoValue
Vector of DicoValue.
const PString & getKey() const
Gets the key of the DicoValue.
bool hasKey() const
Say if the DicoValue has a key.
const std::vector< DicoValue > & getVecChild() const
Gets the vecChild of the DicoValue.
void setValue(const PString &value)
Sets the value of the DicoValue.
bool hasMap() const
Say if the DicoValue has a map of children.
const std::map< PString, DicoValue > & getMapChild() const
Gets the mapChild of the DicoValue.
T getValue() const
Convert the value of the current DicoValue into a type.
PString getString() const
Get a string value without the first and/or last quote or double quote in there are some.
bool hasVec() const
Say if the DicoValue has a vector of children.
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
void setFileContent(const PString &fileContent)
Set the file content.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
Class used to parse nested call variables.
void setName(const PString &name)
Sets the name of the PNestedCall.
const PString & getName() const
Gets the name of the PNestedCall.
const std::vector< PNestedStr > & getVecNestedStr() const
Gets the vecNestedStr of the PNestedCall.
Nested string or variable call.
void setValue(const PString &value)
Sets the value of the PNestedStr.
void setIsVarCall(bool isVarCall)
Sets the isVarCall of the PNestedStr.
std::vector< std::pair< PNestedCall, DicoValue * > > PVecReplaceVar
Map used to replace variable value in nested calls (VariableName, PNestedCall)
bool createNestedCallFromStr(PNestedCall &call, const PString &value, const PString varName, const PString &varBegin, const PString &varEnd)
Create the PNestedCall from the given value.
void dico_replace_nested_call(PString &out, const PNestedCall &call, const PMapKnownVar &mapKeyVariable, const PString &varBegin, const PString &varEnd)
Replace the nested call by the variables in map.
void dico_update_all_nestedCall(PMapKnownVar &mapReadyVar, PVecReplaceVar &mapNestedVar, MapVarWithNestedCall &mapVarWithNestedCall, PNestedCall &nestedCall, DicoValue *dico, const PString &varIdentifier)
Update variables with nested calls.
PString dico_replace_var_str(const PString &baseStr, const PMapKnownVar &mapKeyVariable, const PString &varBegin, const PString &varEnd)
Update the suffix of the file.
void dico_update_all_var(PMapKnownVar &mapReadyVar, PVecReplaceVar &mapNestedVar, MapVarWithNestedCall &mapVarWithNestedCall, const PString &varIdentifier)
Update the variable which contains nested calls.
void dico_create_nested_call(PNestedCall &call, const PString &baseStr, const PString &varBegin, const PString &varEnd)
Create the nested calls of the input base string.
void dico_find_all_var(PMapKnownVar &mapReadyVar, PVecReplaceVar &mapNestedVar, MapVarWithNestedCall &mapVarWithNestedCall, DicoValue &dico, const PString &varIdentifier)
Get the variable which contains only a value and those with nested calls.
std::map< PString, std::pair< PNestedCall, DicoValue * > > MapVarWithNestedCall
Map of the variables which uses nested call.
void dico_replace_var(DicoValue &dico, const PString &varIdentifier)
Replace all the variables which are string in the given DicoValue, when ${variable} apprears in the v...
std::map< PString, PString > PMapKnownVar
Map of known variables.