PhoenixYml  0.5.0
Yml parser for Phoenix
Loading...
Searching...
No Matches
parser_yml.h File Reference
#include "phoenix_get_string.h"
+ Include dependency graph for parser_yml.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool parse_yml_string (PString &str, PFileParser &parser)
 Parse string value.
 
bool parser_yml (DicoValue &dico, const PPath &fileName)
 Parse a yml file and update the given DicoValue.
 

Function Documentation

◆ parse_yml_string()

bool parse_yml_string ( PString & str,
PFileParser & parser )

Parse string value.

Parameters
[out]str: parsed string value
[out]parser: PFileParser to be used

Definition at line 125 of file parser_yml.cpp.

125 {
126 if(parser.isMatch("\"")){
127 str = "\"" + parser.getUntilKey("\"");
128 }else if(parser.isMatch("'")){
129 str = "'" + parser.getUntilKey("'");
130 }else{
131 return false;
132 }
133 return true;
134}

Referenced by parse_yml_compactListContent().

+ Here is the caller graph for this function:

◆ parser_yml()

bool parser_yml ( DicoValue & dico,
const PPath & fileName )

Parse a yml file and update the given DicoValue.

Parameters
[out]dico: dictionnary of values
fileName: name of the file to be parsed
Returns
true on success, false otherwise

Definition at line 343 of file parser_yml.cpp.

343 {
344 PFileParser parser;
345 parser.setWhiteSpace("");
346 parser.setSeparator(":-'\",{}[]>|#");
347 parser.setEscapeChar('\\');
348 if(!parser.open(fileName)){
349 std::cerr << "parser_yml : cannot open file '"<<fileName<<"'" << std::endl;
350 return false;
351 }
352 VecValue vecValue;
353 vecValue.setType(VecValueType::MAIN);
354 vecValue.setIndentation(parser.getLocation().getColumn());
355 bool b(parser_yml_fileParser(vecValue, parser));
356 vecValueToDicoValue(dico, vecValue);
357 return b;
358}
Vector of keys and values.
Definition VecValue.h:15
void setIndentation(size_t indentation)
Sets the indentation of the VecValue.
Definition VecValue.cpp:69
void setType(const VecValueType::VecValueType &type)
Sets the type of the VecValue.
Definition VecValue.cpp:62
bool parser_yml_fileParser(VecValue &dico, PFileParser &parser)
Parse a yml file and update the given VecValue.
void vecValueToDicoValue(DicoValue &dicoValue, const VecValue &vecVal, bool isMainValue)
Convert a VecValue into a DicoValue.

References VecValueType::MAIN, parser_yml_fileParser(), VecValue::setIndentation(), VecValue::setType(), and vecValueToDicoValue().

+ Here is the call graph for this function: