PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
ConfigParser.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #include "ConfigParser.h"
8 
12 }
13 
16 
17 }
18 
20 
22 const std::string & ConfigParser::getDocString() const{
23  return p_lastDocString;
24 }
25 
27 
30  if(!p_run) return false;
31 
33  //To parse the file we need to read char by char until we get something we know
34  if(parseDocString()){}
35  else if(isMatch("//")){p_parser->getUntilKeyWithoutPatern("\n");} //Skip comment
36  else{
38  pointAtRow();
39  return false;
40  }
42  return true;
43 }
44 
47  //Save the current source
48  getCurrentParser()->setWhiteSpace(" \t\n");
49  getCurrentParser()->setSeparator(",;{}[]()");
50  p_lastDocString = "";
51 }
52 
55 
56 }
57 
60 
61 }
62 
64 
67  if(!isMatch("///")){return false;}
69 
70  return true;
71 }
72 
73 
74 
75 
virtual void preLoadFile()
Initialisation to be done just before loading a file.
virtual ~ConfigParser()
Destructor of ConfigParser.
bool parseDocString()
Parse a doc string.
void initialisationConfigParser()
Initialisation function of the class ConfigParser.
virtual void postLoadFile()
Initialisation to be done just after loading a file.
virtual bool parseFile()
Parse the input file.
ConfigParser()
Default constructor of ConfigParser.
const std::string & getDocString() const
Get the last doc string.
std::string p_lastDocString
Last documentation string.
Definition: ConfigParser.h:31
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
Definition: PFileParser.cpp:43
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
void setWhiteSpace(const PString &whiteSpace)
Initialise la liste des caractères blancs.
Definition: PFileParser.cpp:35
void skipWhiteSpace()
Skip the white space if there is at the current caracter position.
bool isMatch(const PString &token)
Check if the given token matches the current read file.
void unexpectedToken()
Print unexpected token error.
void pointAtRow()
Point the problem.
PFileParser * p_parser
Parser helper for the config file.
bool p_run
Run the parsing if true.
PFileParser * getCurrentParser()
Gets the current parser.