![]() |
PhoenixInkscape
2.0.0
Generate multiple png files with svg inkscape files
|
Parse the configuration a create the vector of sources. More...
#include <ConfigParser.h>
Public Member Functions | |
void | addCommentConfig (const PMultiCommentConfig &commentConfig) |
Adds a comment config for the parser. More... | |
void | addCommentConfig (const PString &beginStringComment, const PString &endStringComment="\n") |
Adds a comment config for the parser. More... | |
bool | checkExpectedMatch (const PString &tokenExpected, const PString &tokenBefore="") |
Check if the tokenExpected match. More... | |
bool | checkExpectedToken (const PString &tokenExpected, const PString &tokenBefore="") |
Check if the p_currentToken == tokenExpected. More... | |
void | clearComment () |
Clear comment. More... | |
ConfigParser () | |
Default constructor of ConfigParser. More... | |
void | errorAt () |
Write a parsing error. More... | |
bool | fullParsing () |
Perform the full parsing pf data. More... | |
PFileParser * | getCurrentParser () |
Gets the current parser. More... | |
void | getCurrentTokenWithoutComment () |
Get the current token and skip the comment. More... | |
const std::string & | getDocString () const |
Get the last doc string. More... | |
PString & | getLastComment () |
Get the last comment. More... | |
const PString & | getLastComment () const |
Get the last comment. More... | |
PString | getStrComposedOf (const PString &charset) |
Get the string composed of charset charcters. More... | |
bool | isMatch (const PString &patern, const PString &forbiddenCharBefore) |
Says if the patern match with the current caracters of the PFileParser. More... | |
bool | isMatch (const PString &token) |
Check if the given token matches the current read file. More... | |
PString | isMatch (const PVecString &vecToken) |
Check if the one entry of the vector of token matches. More... | |
bool | isMatchRewind (const PString &token) |
Check if the given token matches the current read file and goes back even if the token matches. More... | |
bool | isMatchSeq (const PVecString &patern, bool alwaysPopBack=false) |
Match a sequence of token in a vector. More... | |
PString | isMatchToken (const PVecString &vecToken) |
Check the matching between the current caracters and all the string in the vector but treats the string as a token (cannot be part of a word) More... | |
bool | load (const PPath &configFile) |
Load the PMultiFileParser with the configFile. More... | |
void | pointAtRow () |
Point the problem. More... | |
void | setFileContent (const PString &fileContent) |
Set the file content to be parsed. More... | |
void | skipComment () |
Skip comment. More... | |
void | stopParsing () |
Stop the parsing of all the files. More... | |
void | unexpectedToken () |
Print unexpected token error. More... | |
virtual | ~ConfigParser () |
Destructor of ConfigParser. More... | |
Protected Member Functions | |
virtual bool | parseFile () |
Parse the input file. More... | |
virtual void | postLoadFile () |
Initialisation to be done just after loading a file. More... | |
virtual void | preLoadFile () |
Initialisation to be done just before loading a file. More... | |
Protected Attributes | |
PString | p_currentToken |
CurrentToken parsed. More... | |
PPath | p_inputDirectory |
Input directory of the parser. More... | |
PString | p_lastComment |
last comment More... | |
std::list< PFileParser > | p_listFileParser |
List of all the parsers for all the loaded files. More... | |
PPath | p_outputDirectory |
Output directory of the parser. More... | |
PFileParser * | p_parser |
Parser helper for the config file. More... | |
bool | p_run |
Run the parsing if true. More... | |
Private Member Functions | |
void | initialisationConfigParser () |
Initialisation function of the class ConfigParser. More... | |
void | initialisationPMultiFileParser (const PPath &inputDirectory, const PPath &outputDirectory) |
Initialisation function of the class PMultiFileParser. More... | |
bool | parseDocString () |
Parse a doc string. More... | |
Private Attributes | |
std::string | p_lastDocString |
Last documentation string. More... | |
PListMultiCommentConfig | p_listCommentConfig |
Defines the differents comments we allow in the parsing. More... | |
Parse the configuration a create the vector of sources.
Definition at line 13 of file ConfigParser.h.
ConfigParser::ConfigParser | ( | ) |
Default constructor of ConfigParser.
Definition at line 10 of file ConfigParser.cpp.
References initialisationConfigParser().
|
virtual |
|
inherited |
Adds a comment config for the parser.
commentConfig | : comment config for the PMultiFileParser |
Definition at line 84 of file PMultiFileParser.cpp.
References PMultiFileParser::p_listCommentConfig.
|
inherited |
Adds a comment config for the parser.
beginStringComment | : string which defines the begining of a comment |
endStringComment | : string which defines the ending of a comment |
Definition at line 92 of file PMultiFileParser.cpp.
References PMultiFileParser::p_listCommentConfig.
|
inherited |
Check if the tokenExpected match.
tokenExpected | : token we expect |
tokenBefore | : token before the exprected one |
Definition at line 166 of file PMultiFileParser.cpp.
References PMultiFileParser::errorAt(), PFileParser::getNextToken(), PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::stopParsing().
|
inherited |
Check if the p_currentToken == tokenExpected.
tokenExpected | : token we expect |
tokenBefore | : token before the exprected one |
Definition at line 151 of file PMultiFileParser.cpp.
References PMultiFileParser::errorAt(), PMultiFileParser::p_currentToken, and PMultiFileParser::stopParsing().
|
inherited |
Clear comment.
Definition at line 193 of file PMultiFileParser.cpp.
References PMultiFileParser::p_lastComment.
Referenced by PMultiFileParser::initialisationPMultiFileParser().
|
inherited |
Write a parsing error.
Definition at line 126 of file PMultiFileParser.cpp.
References PFileParser::getLocation(), and PMultiFileParser::p_parser.
Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::checkExpectedToken(), and PMultiFileParser::unexpectedToken().
|
inherited |
Perform the full parsing pf data.
Definition at line 57 of file PMultiFileParser.cpp.
References PFileParser::getCurrentCharIdx(), PFileParser::getLocation(), PFileParser::isEndOfFile(), PMultiFileParser::p_listFileParser, PMultiFileParser::p_parser, PMultiFileParser::p_run, PMultiFileParser::parseFile(), PMultiFileParser::pointAtRow(), PMultiFileParser::postLoadFile(), PMultiFileParser::preLoadFile(), and PMultiFileParser::unexpectedToken().
Referenced by checkPMultiFileParser(), and PMultiFileParser::load().
|
inherited |
Gets the current parser.
Definition at line 303 of file PMultiFileParser.cpp.
References PMultiFileParser::p_parser.
Referenced by preLoadFile().
|
inherited |
Get the current token and skip the comment.
Definition at line 280 of file PMultiFileParser.cpp.
References PFileParser::getNextToken(), PFileParser::getUntilKey(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_currentToken, PMultiFileParser::p_lastComment, PMultiFileParser::p_listCommentConfig, PMultiFileParser::p_parser, and PMultiFileParser::p_run.
const std::string & ConfigParser::getDocString | ( | ) | const |
Get the last doc string.
Definition at line 22 of file ConfigParser.cpp.
References p_lastDocString.
Referenced by checkPMultiFileParser().
|
inherited |
Get the last comment.
Definition at line 106 of file PMultiFileParser.cpp.
References PMultiFileParser::p_lastComment.
|
inherited |
Get the last comment.
Definition at line 99 of file PMultiFileParser.cpp.
References PMultiFileParser::p_lastComment.
Get the string composed of charset charcters.
charset | : set of allowed characters |
Definition at line 272 of file PMultiFileParser.cpp.
References PFileParser::getStrComposedOf(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
private |
Initialisation function of the class ConfigParser.
Definition at line 59 of file ConfigParser.cpp.
Referenced by ConfigParser().
|
privateinherited |
Initialisation function of the class PMultiFileParser.
inputDirectory | : input directory of the PMultiFileParser |
outputDirectory | : output directory of the PMultiFileParser |
Definition at line 311 of file PMultiFileParser.cpp.
References PMultiFileParser::clearComment(), PMultiFileParser::p_currentToken, PMultiFileParser::p_inputDirectory, PMultiFileParser::p_outputDirectory, PMultiFileParser::p_parser, and PMultiFileParser::p_run.
Referenced by PMultiFileParser::PMultiFileParser().
|
inherited |
Says if the patern match with the current caracters of the PFileParser.
patern | : patern we want to check (this patern should not begin with white caracters) |
forbiddenCharBefore | : lisr of characters which cannot be just before the first character of the patern |
Definition at line 239 of file PMultiFileParser.cpp.
References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
inherited |
Check if the given token matches the current read file.
token | : token to be checked |
Definition at line 202 of file PMultiFileParser.cpp.
References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
Referenced by parseDocString(), and parseFile().
|
inherited |
Check if the one entry of the vector of token matches.
vecToken | : vector of token |
Definition at line 250 of file PMultiFileParser.cpp.
References PFileParser::isMatch(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
inherited |
Check if the given token matches the current read file and goes back even if the token matches.
token | : token to be checked |
Definition at line 214 of file PMultiFileParser.cpp.
References PFileParser::isMatchRewind(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
inherited |
Match a sequence of token in a vector.
patern | : set of token to match in this order and totally |
alwaysPopBack | : true to make the PFileParser at the exact same place before the check even is the sequence matches |
Definition at line 226 of file PMultiFileParser.cpp.
References PFileParser::isMatchSeq(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
inherited |
Check the matching between the current caracters and all the string in the vector but treats the string as a token (cannot be part of a word)
vecToken | : vector of token |
Definition at line 261 of file PMultiFileParser.cpp.
References PFileParser::isMatchToken(), PMultiFileParser::p_parser, and PMultiFileParser::skipComment().
|
inherited |
Load the PMultiFileParser with the configFile.
configFile | : file name of the cnofiguration file |
Definition at line 27 of file PMultiFileParser.cpp.
References PMultiFileParser::fullParsing(), MULTI_PARSER_SEPARATORS_STRING, PFileParser::open(), PMultiFileParser::p_listFileParser, and PMultiFileParser::p_parser.
Referenced by checkPMultiFileParser().
|
private |
Parse a doc string.
Definition at line 66 of file ConfigParser.cpp.
References PFileParser::getUntilKeyWithoutPatern(), PMultiFileParser::isMatch(), p_lastDocString, and PMultiFileParser::p_parser.
Referenced by parseFile().
|
protectedvirtual |
Parse the input file.
Implements PMultiFileParser.
Definition at line 29 of file ConfigParser.cpp.
References PFileParser::getUntilKeyWithoutPatern(), PMultiFileParser::isMatch(), PMultiFileParser::p_parser, PMultiFileParser::p_run, parseDocString(), PMultiFileParser::pointAtRow(), PFileParser::skipWhiteSpace(), and PMultiFileParser::unexpectedToken().
|
inherited |
Point the problem.
Definition at line 138 of file PMultiFileParser.cpp.
References PFileParser::getColumn(), PFileParser::getCurrentRow(), and PMultiFileParser::p_parser.
Referenced by PMultiFileParser::fullParsing(), and parseFile().
|
protectedvirtual |
Initialisation to be done just after loading a file.
Reimplemented from PMultiFileParser.
Definition at line 54 of file ConfigParser.cpp.
|
protectedvirtual |
Initialisation to be done just before loading a file.
Reimplemented from PMultiFileParser.
Definition at line 46 of file ConfigParser.cpp.
References PMultiFileParser::getCurrentParser(), p_lastDocString, PFileParser::setSeparator(), and PFileParser::setWhiteSpace().
|
inherited |
Set the file content to be parsed.
fileContent | : file content to be parsed |
Definition at line 43 of file PMultiFileParser.cpp.
References MULTI_PARSER_SEPARATORS_STRING, PMultiFileParser::p_listFileParser, PMultiFileParser::p_parser, and PFileParser::setFileContent().
Referenced by checkPMultiFileParser().
|
inherited |
Skip comment.
Definition at line 177 of file PMultiFileParser.cpp.
References PFileParser::getUntilKey(), PFileParser::isEndOfFile(), PFileParser::isMatch(), PMultiFileParser::p_lastComment, PMultiFileParser::p_listCommentConfig, PMultiFileParser::p_parser, and PMultiFileParser::p_run.
Referenced by PMultiFileParser::getStrComposedOf(), PMultiFileParser::isMatch(), PMultiFileParser::isMatchRewind(), PMultiFileParser::isMatchSeq(), and PMultiFileParser::isMatchToken().
|
inherited |
Stop the parsing of all the files.
Definition at line 121 of file PMultiFileParser.cpp.
References PMultiFileParser::p_run.
Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::checkExpectedToken(), and PMultiFileParser::unexpectedToken().
|
inherited |
Print unexpected token error.
Definition at line 131 of file PMultiFileParser.cpp.
References PMultiFileParser::errorAt(), PFileParser::getNextToken(), PMultiFileParser::p_parser, and PMultiFileParser::stopParsing().
Referenced by PMultiFileParser::fullParsing(), and parseFile().
|
protectedinherited |
CurrentToken parsed.
Definition at line 78 of file PMultiFileParser.h.
Referenced by PMultiFileParser::checkExpectedToken(), PMultiFileParser::getCurrentTokenWithoutComment(), and PMultiFileParser::initialisationPMultiFileParser().
|
protectedinherited |
Input directory of the parser.
Definition at line 80 of file PMultiFileParser.h.
Referenced by PMultiFileParser::initialisationPMultiFileParser().
|
protectedinherited |
last comment
Definition at line 76 of file PMultiFileParser.h.
Referenced by PMultiFileParser::clearComment(), PMultiFileParser::getCurrentTokenWithoutComment(), PMultiFileParser::getLastComment(), and PMultiFileParser::skipComment().
|
private |
Last documentation string.
Definition at line 31 of file ConfigParser.h.
Referenced by getDocString(), parseDocString(), and preLoadFile().
|
privateinherited |
Defines the differents comments we allow in the parsing.
Definition at line 88 of file PMultiFileParser.h.
Referenced by PMultiFileParser::addCommentConfig(), PMultiFileParser::getCurrentTokenWithoutComment(), and PMultiFileParser::skipComment().
|
protectedinherited |
List of all the parsers for all the loaded files.
Definition at line 72 of file PMultiFileParser.h.
Referenced by PMultiFileParser::fullParsing(), PMultiFileParser::load(), and PMultiFileParser::setFileContent().
|
protectedinherited |
Output directory of the parser.
Definition at line 82 of file PMultiFileParser.h.
Referenced by PMultiFileParser::initialisationPMultiFileParser().
|
protectedinherited |
Parser helper for the config file.
Definition at line 70 of file PMultiFileParser.h.
Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::errorAt(), PMultiFileParser::fullParsing(), PMultiFileParser::getCurrentParser(), PMultiFileParser::getCurrentTokenWithoutComment(), PMultiFileParser::getStrComposedOf(), PMultiFileParser::initialisationPMultiFileParser(), PMultiFileParser::isMatch(), PMultiFileParser::isMatchRewind(), PMultiFileParser::isMatchSeq(), PMultiFileParser::isMatchToken(), PMultiFileParser::load(), parseDocString(), parseFile(), PMultiFileParser::pointAtRow(), PMultiFileParser::setFileContent(), PMultiFileParser::skipComment(), and PMultiFileParser::unexpectedToken().
|
protectedinherited |
Run the parsing if true.
Definition at line 74 of file PMultiFileParser.h.
Referenced by PMultiFileParser::fullParsing(), PMultiFileParser::getCurrentTokenWithoutComment(), PMultiFileParser::initialisationPMultiFileParser(), parseFile(), PMultiFileParser::skipComment(), and PMultiFileParser::stopParsing().