PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
PFileParser Class Reference

classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres More...

#include <PFileParser.h>

+ Collaboration diagram for PFileParser:

Public Member Functions

void clear ()
 Clear the save position of the parser in ther current file. More...
 
size_t getColumn () const
 Fonction qui renvoie le numéro de la colonne du caractère courant. More...
 
char getCurrentCh () const
 Renvoie le caractère courant. More...
 
size_t getCurrentCharIdx () const
 Return the index of the current character. More...
 
PString getCurrentRow () const
 Get the current parsed row. More...
 
char getEscapeChar () const
 Gets the escape character of the PFileParser. More...
 
PPath getFileName () const
 Fonction qui renvoie le nom du fichier que l'on a ouvert. More...
 
size_t getLine () const
 Fonction qui renvoie le numéro de la ligne courante. More...
 
size_t getLineIndentation ()
 Get the current line indentation. More...
 
PLocation getLocation () const
 Fonction qui renvoie la PLocation du PFileParser. More...
 
size_t getNbTotalChar () const
 Return the number of characters in the current opened file. More...
 
char getNextChar ()
 Fonction qui renvoie le prochain caractère du fichier courant. More...
 
PString getNextToken ()
 Get the next token. More...
 
PString getNextToken (PString &skippedStr)
 Get the next token and return also the skipped characters until the next token. More...
 
char getPrevCh () const
 Renvoie le caractère courant. More...
 
PString getSeparator () const
 renvoie la liste des caractères séparateurs More...
 
PString getStrComposedOf (const PString &charset)
 Get string composed of the characters in the string charset. More...
 
PString getUntilKey (const PString &patern)
 Renvoie la chaine de caractère du caractère courant jusqu'à patern comprise. More...
 
PString getUntilKeyWithoutPatern (const PString &patern)
 Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu. More...
 
PString getUntilKeyWithoutPaternExclude (const PString &patern, const PString &strNotBeforeEndPatern)
 Parse a string until the patern is found, only if it has not strNotBeforeEndPatern before it. More...
 
PString getUntilKeyWithoutPaternRecurse (const PString &patern, const PString &beginPatern)
 Get the string until end sequence and take account recursive patern (embeded strings) More...
 
PString getUntilKeyWithoutPaternRecurse (const PString &patern, const PString &beginPatern, const PString &allowedCharAfterBegin)
 Get the string until end sequence and take account recursive patern (embeded strings) More...
 
PString getUntilKeyWithoutPaternRecurseExclude (const PString &patern, const PString &beginPatern, const PString &echapExpr)
 Get the string until end sequence and take account recursive patern (embeded strings) More...
 
PString getWhiteSpace () const
 renvoie la liste des caractères blancs More...
 
bool isChSeparator () const
 Dis si le caractère courant est un séparateur. More...
 
bool isChSpace () const
 Dis si le caractère courant est un caractère blanc. More...
 
bool isEndOfFile () const
 Dit si on est à la fin du fichier. More...
 
PString isMatch (const PParseSeq &seq)
 Check the matching of a sequence in the current file. More...
 
bool isMatch (const PString &patern)
 Says if the patern match with the current caracters of the PFileParser. More...
 
bool isMatch (const PString &patern, const PString &forbiddenCharBefore)
 Says if the patern match with the current caracters of the PFileParser. More...
 
PString isMatch (const PVecString &patern)
 Check the matching between the current caracters and all the string in the vector. More...
 
PString isMatch (const std::vector< PVecString > &patern)
 Check the matching between the current caracters and all the string in the list of list of string. More...
 
bool isMatchRewind (const PString &patern)
 Do a isMatch and then go back at the previous position. More...
 
bool isMatchSeq (const PVecString &patern, bool alwaysPopBack=false)
 Match a sequence of token in a vector. More...
 
bool isMatchToken (const PString &patern)
 Says if the patern match with the current caracters of the PFileParser but treats the string as a token (cannot be part of a word) More...
 
PString isMatchToken (const PVecString &patern)
 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...
 
template<typename T >
bool isMatchToken (PString &matchKey, T &matchValue, const std::map< PString, T > &patern)
 Check if one key of the map, matches the current token. More...
 
bool isWhiteSpace ()
 Says if the current char is a white space. More...
 
bool open (const PPath &fileName)
 Fonction qui ouvre le fichier que l'on va parser. More...
 
 PFileParser ()
 Constructeur de PFileParser. More...
 
void popPosition ()
 Get to the last saved position of the PFileParser in the current file. More...
 
void pushPosition ()
 Remember the current position of the PFileParser in the current file. More...
 
void setColumn (size_t currentCol)
 Set the current column of the PFileParser. More...
 
void setEscapeChar (char escapeChar)
 Sets the escape character of the PFileParser. More...
 
void setFileContent (const PString &fileContent)
 Set the file content. More...
 
void setLine (size_t currentLine)
 Set the current line of the PFileParser. More...
 
void setLocation (const PLocation &location)
 Set the current location of the PFileParser. More...
 
void setSeparator (const PString &separator)
 Initialise la liste des caractères séparateurs. More...
 
void setWhiteSpace (const PString &whiteSpace)
 Initialise la liste des caractères blancs. More...
 
void skipChars (const PString &chToSkip)
 Skip the characters in the given string. More...
 
void skipWhiteSpace ()
 Skip the white space if there is at the current caracter position. More...
 
virtual ~PFileParser ()
 Destructeur de PFileParser. More...
 

Private Member Functions

void incrementCurrentChar (size_t nbChar=1lu)
 Increment the current caracter. More...
 
void incrementCurrentLine ()
 Increment the current line. More...
 
void initialisationPFileParser ()
 Fonction d'initialisation du PFileParser. More...
 

Private Attributes

size_t p_currentChar
 Numéro du caractère courant. More...
 
size_t p_currentLine
 Numéro de la ligne courante. More...
 
size_t p_currentLineFirstColumn
 Number of the first column caracter of the current line. More...
 
bool p_dontSkipSpace
 Say if we don't want to skip the spaces. More...
 
char p_echapChar
 Echap caracter. More...
 
PString p_fileContent
 Contenu du fichier de configuration. More...
 
PPath p_fileName
 Nom du fichier que l'on veut parser. More...
 
PString p_listSeparator
 liste des séparateurs More...
 
PString p_listWhiteSpace
 liste des espaces blancs More...
 
size_t p_nbTotalChar
 Nombre de caractères total. More...
 
std::vector< size_t > p_vecLine
 Vector of all the checkpoint rows in the text file (added with pushPosition() and removed with popPosition() or clear() More...
 
std::vector< size_t > p_vecPosition
 Vector of all the checkpoint positions in the text file (added with pushPosition() and removed with popPosition() or clear() More...
 

Friends

std::ostream & operator<< (std::ostream &out, const PFileParser &other)
 Définition de l'opérateur de flux sortant. More...
 

Detailed Description

classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres

Definition at line 20 of file PFileParser.h.

Constructor & Destructor Documentation

◆ PFileParser()

PFileParser::PFileParser ( )

Constructeur de PFileParser.

Definition at line 11 of file PFileParser.cpp.

11  {
13 }
void initialisationPFileParser()
Fonction d'initialisation du PFileParser.

References initialisationPFileParser().

+ Here is the call graph for this function:

◆ ~PFileParser()

PFileParser::~PFileParser ( )
virtual

Destructeur de PFileParser.

Definition at line 16 of file PFileParser.cpp.

16  {
17 
18 }

Member Function Documentation

◆ clear()

void PFileParser::clear ( )

Clear the save position of the parser in ther current file.

Definition at line 110 of file PFileParser.cpp.

110  {
111  p_vecPosition.clear();
112  p_vecLine.clear();
113 }
std::vector< size_t > p_vecPosition
Vector of all the checkpoint positions in the text file (added with pushPosition() and removed with p...
Definition: PFileParser.h:115
std::vector< size_t > p_vecLine
Vector of all the checkpoint rows in the text file (added with pushPosition() and removed with popPos...
Definition: PFileParser.h:117

References p_vecLine, and p_vecPosition.

Referenced by testPFileParserBase().

+ Here is the caller graph for this function:

◆ getColumn()

size_t PFileParser::getColumn ( ) const

Fonction qui renvoie le numéro de la colonne du caractère courant.

Returns
colonne du caractère courant

Definition at line 692 of file PFileParser.cpp.

692  {
695  }else{return 0lu;}
696 }
size_t p_currentLineFirstColumn
Number of the first column caracter of the current line.
Definition: PFileParser.h:107
size_t p_currentChar
Numéro du caractère courant.
Definition: PFileParser.h:101

References p_currentChar, and p_currentLineFirstColumn.

Referenced by getLocation(), and PMultiFileParser::pointAtRow().

+ Here is the caller graph for this function:

◆ getCurrentCh()

char PFileParser::getCurrentCh ( ) const

Renvoie le caractère courant.

Returns
caractère courant

Definition at line 669 of file PFileParser.cpp.

669  {
670  if(isEndOfFile()) return '\0';
672 }
PString p_fileContent
Contenu du fichier de configuration.
Definition: PFileParser.h:99
bool isEndOfFile() const
Dit si on est à la fin du fichier.
Definition: PFileParser.cpp:88

References isEndOfFile(), p_currentChar, and p_fileContent.

Referenced by testPFileParserVecVecIsMatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentCharIdx()

size_t PFileParser::getCurrentCharIdx ( ) const

Return the index of the current character.

Returns
index of the current character

Definition at line 708 of file PFileParser.cpp.

708  {
709  return p_currentChar;
710 }

References p_currentChar.

Referenced by PMultiFileParser::fullParsing(), and testPFileParserVecVecIsMatch().

+ Here is the caller graph for this function:

◆ getCurrentRow()

PString PFileParser::getCurrentRow ( ) const

Get the current parsed row.

Returns
current parsed row

Definition at line 415 of file PFileParser.cpp.

415  {
416  if(p_fileContent.empty()) return "";
417  size_t currentCharIndex(p_currentChar);
418  char ch = p_fileContent[currentCharIndex];
419  size_t indexBeginRow(currentCharIndex);
420  size_t indexEndRow(currentCharIndex);
421  if(ch != '\n'){
422  while(p_fileContent[indexEndRow] != '\n' && !isEndOfFile()){
423  ++indexEndRow;
424  }
425  }
426  if(ch == '\n' && indexBeginRow != 0lu){
427  --indexBeginRow;
428  }
429  while(p_fileContent[indexBeginRow] != '\n' && indexBeginRow != 0lu){
430  --indexBeginRow;
431  }
432  if(p_fileContent[indexBeginRow] == '\n'){indexBeginRow++;}
433  return p_fileContent.substr(indexBeginRow, indexEndRow - indexBeginRow);
434 }

References isEndOfFile(), p_currentChar, and p_fileContent.

Referenced by PMultiFileParser::pointAtRow(), and testPFileParserGetCurrentRow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEscapeChar()

char PFileParser::getEscapeChar ( ) const

Gets the escape character of the PFileParser.

Returns
escape character of the PFileParser

Definition at line 134 of file PFileParser.cpp.

134  {
135  return p_echapChar;
136 }
char p_echapChar
Echap caracter.
Definition: PFileParser.h:113

References p_echapChar.

Referenced by testPFileParserBase().

+ Here is the caller graph for this function:

◆ getFileName()

PPath PFileParser::getFileName ( ) const

Fonction qui renvoie le nom du fichier que l'on a ouvert.

Returns
nom du fichier que l'on a ouvert

Definition at line 141 of file PFileParser.cpp.

141  {
142  return p_fileName;
143 }
PPath p_fileName
Nom du fichier que l'on veut parser.
Definition: PFileParser.h:97

References p_fileName.

Referenced by testPFileParserBase().

+ Here is the caller graph for this function:

◆ getLine()

size_t PFileParser::getLine ( ) const

Fonction qui renvoie le numéro de la ligne courante.

Returns
numéro de la ligne courante

Definition at line 685 of file PFileParser.cpp.

685  {
686  return p_currentLine;
687 }
size_t p_currentLine
Numéro de la ligne courante.
Definition: PFileParser.h:105

References p_currentLine.

Referenced by testPFileParserVecVecIsMatch().

+ Here is the caller graph for this function:

◆ getLineIndentation()

size_t PFileParser::getLineIndentation ( )

Get the current line indentation.

Returns
current line indentation

Definition at line 715 of file PFileParser.cpp.

715  {
716  //First, let's get the current column
717  size_t indentation(0lu), currentCharIdx(p_currentLineFirstColumn);
718  while(currentCharIdx < p_nbTotalChar && PString(" \t").find(p_fileContent[currentCharIdx])){
719  ++indentation;
720  ++currentCharIdx;
721  }
722  if(currentCharIdx > p_currentChar){
723  p_currentChar = currentCharIdx; //Anyway, it was just white character
724  }
725 
726  return indentation;
727 }
size_t p_nbTotalChar
Nombre de caractères total.
Definition: PFileParser.h:103
Extends the std::string.
Definition: PString.h:16

References p_currentChar, p_currentLineFirstColumn, p_fileContent, and p_nbTotalChar.

◆ getLocation()

PLocation PFileParser::getLocation ( ) const

Fonction qui renvoie la PLocation du PFileParser.

Returns
PLocation du PFileParser

Definition at line 732 of file PFileParser.cpp.

732  {
734 }
size_t getColumn() const
Fonction qui renvoie le numéro de la colonne du caractère courant.
Classe qui permet de décrire une localisation, avec un nom de fichier et une ligne.
Definition: PLocation.h:15

References getColumn(), p_currentLine, and p_fileName.

Referenced by PMultiFileParser::errorAt(), DicoValue::errorAt(), PMultiFileParser::fullParsing(), pxml_parserXmlAttribute(), and pxml_parserXmlContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNbTotalChar()

size_t PFileParser::getNbTotalChar ( ) const

Return the number of characters in the current opened file.

Returns
number of characters in the current opened file

Definition at line 701 of file PFileParser.cpp.

701  {
702  return p_nbTotalChar;
703 }

References p_nbTotalChar.

◆ getNextChar()

char PFileParser::getNextChar ( )

Fonction qui renvoie le prochain caractère du fichier courant.

Returns
prochain caractère du fichier courant ou le caractère NULL si on est à la fin

Definition at line 187 of file PFileParser.cpp.

187  {
189  if(p_currentChar < p_nbTotalChar - 1lu){
190  char ch = p_fileContent[p_currentChar];
191  return ch;
192  }else{
194  return '\0';
195  }
196 }
void incrementCurrentChar(size_t nbChar=1lu)
Increment the current caracter.

References incrementCurrentChar(), p_currentChar, p_fileContent, and p_nbTotalChar.

Referenced by testPFileParserBase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextToken() [1/2]

PString PFileParser::getNextToken ( )

Get the next token.

Returns
next token

Definition at line 148 of file PFileParser.cpp.

148  {
149  PString dummySkipedStr("");
150  return getNextToken(dummySkipedStr);
151 }
PString getNextToken()
Get the next token.

Referenced by PMultiFileParser::checkExpectedMatch(), PMultiFileParser::getCurrentTokenWithoutComment(), pxml_parserXmlAttribute(), testPFileParserGetNextToken(), testPFileParserGetNextToken2(), and PMultiFileParser::unexpectedToken().

+ Here is the caller graph for this function:

◆ getNextToken() [2/2]

PString PFileParser::getNextToken ( PString skippedStr)

Get the next token and return also the skipped characters until the next token.

Parameters
[out]skippedStr: string of skipped characters
Returns
next token

Definition at line 157 of file PFileParser.cpp.

157  {
158  if(isEndOfFile()) return "";
159  char ch = p_fileContent[p_currentChar];
160  while(!isEndOfFile() && p_listWhiteSpace.find(ch)){
161  skippedStr += ch;
163  if(isEndOfFile()) return "";
165  }
166  //We are sur ethe current char is not a white character
167  if(p_listSeparator.find(ch) && !isEndOfFile()){ //If is it a separator, we stop
169  PString s("");
170  s += ch;
171  return s;
172  }
173  //If not we get all characters until the next white character or separator character
174  PString buf("");
175  while(!isEndOfFile() && !p_listWhiteSpace.find(ch) && !p_listSeparator.find(ch)){
176  buf += ch;
178  if(isEndOfFile()){return buf;}
180  }
181  return buf;
182 }
PString p_listSeparator
liste des séparateurs
Definition: PFileParser.h:111
PString p_listWhiteSpace
liste des espaces blancs
Definition: PFileParser.h:109
bool find(char ch) const
Find a char in a string.
Definition: PString.cpp:371

References PString::find(), incrementCurrentChar(), isEndOfFile(), p_currentChar, p_fileContent, p_listSeparator, and p_listWhiteSpace.

+ Here is the call graph for this function:

◆ getPrevCh()

char PFileParser::getPrevCh ( ) const

Renvoie le caractère courant.

Returns
caractère courant

Definition at line 677 of file PFileParser.cpp.

677  {
678  if(isEndOfFile() && p_currentChar > 0lu) return '\0';
679  return p_fileContent[p_currentChar - 1lu];
680 }

References isEndOfFile(), p_currentChar, and p_fileContent.

Referenced by testPFileParserVecVecIsMatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSeparator()

PString PFileParser::getSeparator ( ) const

renvoie la liste des caractères séparateurs

Returns
liste des caractères séparateurs

Definition at line 662 of file PFileParser.cpp.

662  {
663  return p_listSeparator;
664 }

References p_listSeparator.

Referenced by testPFileParserVecVecIsMatch().

+ Here is the caller graph for this function:

◆ getStrComposedOf()

PString PFileParser::getStrComposedOf ( const PString charset)

Get string composed of the characters in the string charset.

Parameters
charset: set of the available characters to get the current string
Returns
corresponding string

Definition at line 394 of file PFileParser.cpp.

394  {
395  PString tmpWhiteSpace(p_listWhiteSpace.eraseChar(charset));
396  if(tmpWhiteSpace != ""){
397  skipChars(tmpWhiteSpace);
398  }
399  std::string out("");
400  bool isInCharSet(true);
401  while(!isEndOfFile() && isInCharSet){
402  char ch = p_fileContent[p_currentChar];
403  isInCharSet = charset.find(ch);
404  if(isInCharSet){
405  out += ch;
407  }
408  }
409  return out;
410 }
void skipChars(const PString &chToSkip)
Skip the characters in the given string.
PString eraseChar(char ch) const
Erase char ch of current string.
Definition: PString.cpp:478

References PString::eraseChar(), PString::find(), incrementCurrentChar(), isEndOfFile(), p_currentChar, p_fileContent, p_listWhiteSpace, and skipChars().

Referenced by PMultiFileParser::getStrComposedOf(), isMatch(), DicoValue::parseDicoValue(), pxml_parserXmlAttribute(), and pxml_parserXmlContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUntilKey()

PString PFileParser::getUntilKey ( const PString patern)

Renvoie la chaine de caractère du caractère courant jusqu'à patern comprise.

Parameters
patern: séquence d'arrêt
Returns
chaine de caractère du caractère courant jusqu'à patern comprise

Definition at line 202 of file PFileParser.cpp.

202  {
203  if(patern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
204  return getUntilKeyWithoutPatern(patern) + patern;
205 }
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.

References getUntilKeyWithoutPatern(), isEndOfFile(), and p_nbTotalChar.

Referenced by PMultiFileParser::getCurrentTokenWithoutComment(), parse_generic_string(), PMultiFileParser::skipComment(), and testPFileParserGetUntilKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUntilKeyWithoutPatern()

PString PFileParser::getUntilKeyWithoutPatern ( const PString patern)

Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.

Parameters
patern: séquence d'arrêt
Returns
chaine de caractère du caractère courant jusqu'à patern exclu

Definition at line 211 of file PFileParser.cpp.

211  {
212  if(patern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
213  size_t sizePatern(patern.size());
214  std::string out(""); //on évite les petits désagréments
215  size_t sizeSrc(p_nbTotalChar - p_currentChar);
216  size_t beginTest(0lu), beginLine(0lu), beginI(0lu), nbMatch(0lu);
217  for(size_t i(0lu); i < sizeSrc; ++i){
218  if(p_fileContent[p_currentChar] == patern[nbMatch]){ //si le caractère i est le même que le caractère nbMatch
219  if(nbMatch == 0lu){ //c'est le premier qu'on teste
220  beginTest = p_currentChar; //il faut donc se rappeler où on a commencer à faire le test
221  beginLine = p_currentLine;
222  beginI = i;
223  }
224  ++nbMatch; //la prochaîne fois on testera le caractère suivant
225  if(nbMatch == sizePatern){ //dans ce cas, on a tout testé et tout les caractères correspondent, donc on sauvegarde
227  return out;
228  }
229  }else{ //si le caractère i n'est pas le même caractère que nbMatch
230  if(nbMatch == 0lu){ //si on n'en avait pas trouver de bon avant
231  out += p_fileContent[p_currentChar]; //on ne change rien à ce caractère
232  }else{ //si on avais déjà tester des caractères avant
233  out += p_fileContent[beginTest];
234  p_currentChar = beginTest;
235  p_currentLine = beginLine;
236  i = beginI;
237  }
238  beginTest = 0lu; //on remet le début des tests à 0 (pour évité les dépassements, on ne sait jamais)
239  nbMatch = 0lu; //on remet ne nombre des tests à 0, comme on n'a pas trouver de nouveau le motif
240  }
242  }
243  return out;
244 }

References incrementCurrentChar(), isEndOfFile(), p_currentChar, p_currentLine, p_fileContent, and p_nbTotalChar.

Referenced by createNestedCallFromStr(), dico_create_nested_call(), getUntilKey(), ConfigParser::parseDocString(), ConfigParser::parseFile(), DicoValue::parseString(), pxml_parserXmlAttribute(), pxml_parserXmlContent(), and testPFileParserPartern().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUntilKeyWithoutPaternExclude()

PString PFileParser::getUntilKeyWithoutPaternExclude ( const PString patern,
const PString strNotBeforeEndPatern 
)

Parse a string until the patern is found, only if it has not strNotBeforeEndPatern before it.

Parameters
patern: patern to be found
strNotBeforeEndPatern: string which cannot be found before the patern, otherwise the patern is not considered as the end
Returns
string unit patern, without it

Definition at line 251 of file PFileParser.cpp.

251  {
252  if(patern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
253  std::string out(""); //on évite les petits désagréments
254  bool prevSkipSpace(p_dontSkipSpace);
255  p_dontSkipSpace = true;
256  bool skiptNextEnd(false);
257  while(!isEndOfFile()){
258  if(isMatch(strNotBeforeEndPatern)){
259  out += strNotBeforeEndPatern;
260  skiptNextEnd = true;
261  }else if(skiptNextEnd){
262  skiptNextEnd = false;
265  }else if(isMatch(patern)){
266  p_dontSkipSpace = prevSkipSpace;
267  return out;
268  }else{
271  }
272  }
273  p_dontSkipSpace = prevSkipSpace;
274  return out;
275 }
bool p_dontSkipSpace
Say if we don't want to skip the spaces.
Definition: PFileParser.h:119
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.

References incrementCurrentChar(), isEndOfFile(), isMatch(), p_currentChar, p_dontSkipSpace, p_fileContent, and p_nbTotalChar.

Referenced by testPFileParserParternExclude().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUntilKeyWithoutPaternRecurse() [1/2]

PString PFileParser::getUntilKeyWithoutPaternRecurse ( const PString patern,
const PString beginPatern 
)

Get the string until end sequence and take account recursive patern (embeded strings)

Parameters
patern: end patern
beginPatern: definition of new embeded string
Returns
output string

Definition at line 362 of file PFileParser.cpp.

363 {
364  if(patern == "" || beginPatern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
365  bool prevSkipSpace(p_dontSkipSpace);
366  p_dontSkipSpace = true;
367  std::string out("");
368  long int nbEmbeded(1l);
369  while(!isEndOfFile()){
370  if(isMatch(patern)){
371  --nbEmbeded;
372  if(nbEmbeded <= 0l){
373  p_dontSkipSpace = prevSkipSpace;
374  return out;
375  }else{
376  out += patern;
377  }
378  }else if(isMatch(beginPatern)){
379  out += beginPatern;
380  ++nbEmbeded;
381  }else{
384  }
385  }
386  p_dontSkipSpace = prevSkipSpace;
387  return out;
388 }

References incrementCurrentChar(), isEndOfFile(), isMatch(), p_currentChar, p_dontSkipSpace, p_fileContent, and p_nbTotalChar.

+ Here is the call graph for this function:

◆ getUntilKeyWithoutPaternRecurse() [2/2]

PString PFileParser::getUntilKeyWithoutPaternRecurse ( const PString patern,
const PString beginPatern,
const PString allowedCharAfterBegin 
)

Get the string until end sequence and take account recursive patern (embeded strings)

Parameters
patern: end patern
beginPatern: definition of new embeded string
allowedCharAfterBegin: characters allowed after the beginPatern
Returns
output string

Definition at line 283 of file PFileParser.cpp.

285 {
286  if(patern == "" || beginPatern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
287  bool prevSkipSpace(p_dontSkipSpace);
288  p_dontSkipSpace = true;
289  std::string out("");
290  long int nbEmbeded(1lu);
291  while(!isEndOfFile()){
292  if(isMatch(patern)){
293  --nbEmbeded;
294  if(nbEmbeded <= 0l){
295  p_dontSkipSpace = prevSkipSpace;
296  return out;
297  }else{
298  out += patern;
299  }
300  }else if(isMatch(beginPatern)){
301  if(allowedCharAfterBegin.find(p_fileContent[p_currentChar])){
302  out += beginPatern;
303  ++nbEmbeded;
304  }
305  }else{
308  }
309  }
310  p_dontSkipSpace = prevSkipSpace;
311  return out;
312 }

References PString::find(), incrementCurrentChar(), isEndOfFile(), isMatch(), p_currentChar, p_dontSkipSpace, p_fileContent, and p_nbTotalChar.

Referenced by testPFileParserParternRecurse(), testPFileParserParternRecurse2(), and testPFileParserParternRecurseAllowChar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUntilKeyWithoutPaternRecurseExclude()

PString PFileParser::getUntilKeyWithoutPaternRecurseExclude ( const PString patern,
const PString beginPatern,
const PString echapExpr 
)

Get the string until end sequence and take account recursive patern (embeded strings)

Parameters
patern: end patern
beginPatern: definition of new embeded string
echapExpr: echap expression
Returns
output string

Definition at line 320 of file PFileParser.cpp.

322 {
323  if(patern == "" || beginPatern == "" || p_nbTotalChar == 0lu || isEndOfFile()) return "";
324  bool prevSkipSpace(p_dontSkipSpace);
325  p_dontSkipSpace = true;
326  std::string out("");
327  long int nbEmbeded(1lu);
328  bool skiptNextEnd(false);
329  while(!isEndOfFile()){
330  if(isMatch(echapExpr)){
331  out += echapExpr;
332  skiptNextEnd = true;
333  }else if(skiptNextEnd){
334  skiptNextEnd = false;
337  }else if(isMatch(patern)){
338  --nbEmbeded;
339  if(nbEmbeded <= 0l){
340  p_dontSkipSpace = prevSkipSpace;
341  return out;
342  }else{
343  out += patern;
344  }
345  }else if(isMatch(beginPatern)){
346  out += beginPatern;
347  ++nbEmbeded;
348  }else{
351  }
352  }
353  p_dontSkipSpace = prevSkipSpace;
354  return out;
355 }

References incrementCurrentChar(), isEndOfFile(), isMatch(), p_currentChar, p_dontSkipSpace, p_fileContent, and p_nbTotalChar.

Referenced by testPFileParserParternRecurseExcludeEnd(), and testPFileParserParternRecurseExcludeEnd2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWhiteSpace()

PString PFileParser::getWhiteSpace ( ) const

renvoie la liste des caractères blancs

Returns
liste des caractères blancs

Definition at line 655 of file PFileParser.cpp.

655  {
656  return p_listWhiteSpace;
657 }

References p_listWhiteSpace.

◆ incrementCurrentChar()

void PFileParser::incrementCurrentChar ( size_t  nbChar = 1lu)
private

Increment the current caracter.

Parameters
nbChar: number of char to go ahead

Definition at line 767 of file PFileParser.cpp.

767  {
768  bool currentCharEchaped(false);
769  for(size_t i(0lu); i < nbChar || currentCharEchaped; ++i){
770  if(p_fileContent[p_currentChar] == '\n'){
772  }
773  if(!currentCharEchaped && p_fileContent[p_currentChar] == p_echapChar && p_echapChar != '\0'){
774  currentCharEchaped = true;
775  }else{
776  currentCharEchaped = false;
777  }
779  ++p_currentChar;
780  }
781  }
782 }
void incrementCurrentLine()
Increment the current line.

References incrementCurrentLine(), p_currentChar, p_echapChar, p_fileContent, and p_nbTotalChar.

Referenced by getNextChar(), getNextToken(), getStrComposedOf(), getUntilKeyWithoutPatern(), getUntilKeyWithoutPaternExclude(), getUntilKeyWithoutPaternRecurse(), getUntilKeyWithoutPaternRecurseExclude(), isMatch(), isWhiteSpace(), skipChars(), and skipWhiteSpace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ incrementCurrentLine()

void PFileParser::incrementCurrentLine ( )
private

Increment the current line.

Definition at line 759 of file PFileParser.cpp.

759  {
760  ++p_currentLine;
762 }

References p_currentChar, p_currentLine, and p_currentLineFirstColumn.

Referenced by incrementCurrentChar().

+ Here is the caller graph for this function:

◆ initialisationPFileParser()

void PFileParser::initialisationPFileParser ( )
private

Fonction d'initialisation du PFileParser.

Definition at line 747 of file PFileParser.cpp.

747  {
748  p_currentChar = 0lu;
749  p_currentLine = 1lu;
751  p_fileContent = "";
752  p_listWhiteSpace = " \t\n";
753  p_listSeparator = "()[]{}+=.;,:/*%<>#";
754  p_echapChar = '\0';
755  p_dontSkipSpace = false;
756 }

References p_currentChar, p_currentLine, p_currentLineFirstColumn, p_dontSkipSpace, p_echapChar, p_fileContent, p_listSeparator, and p_listWhiteSpace.

Referenced by PFileParser().

+ Here is the caller graph for this function:

◆ isChSeparator()

bool PFileParser::isChSeparator ( ) const

Dis si le caractère courant est un séparateur.

Returns
true si caractère courant est un séparateur

Definition at line 126 of file PFileParser.cpp.

126  {
127  if(isEndOfFile()) return false;
129 }

References PString::find(), isEndOfFile(), p_currentChar, p_fileContent, and p_listSeparator.

Referenced by testPFileParserBase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isChSpace()

bool PFileParser::isChSpace ( ) const

Dis si le caractère courant est un caractère blanc.

Returns
true si caractère courant est un caractère blanc

Definition at line 118 of file PFileParser.cpp.

118  {
119  if(isEndOfFile()) return false;
121 }

References PString::find(), isEndOfFile(), p_currentChar, p_fileContent, and p_listWhiteSpace.

Referenced by testPFileParserBase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEndOfFile()

◆ isMatch() [1/5]

PString PFileParser::isMatch ( const PParseSeq seq)

Check the matching of a sequence in the current file.

Parameters
seq: sequence to be checked
Returns
matched string

Definition at line 582 of file PFileParser.cpp.

582  {
583  pushPosition();
584  PString body("");
585  const PVecParseStep & vecStep = seq.getVecStep();
586  PVecParseStep::const_iterator itStep(vecStep.begin());
587  bool isParseNextStep(true);
588  while(itStep != vecStep.end() && isParseNextStep){
589  isParseNextStep = itStep->getIsOptional();
590  const PVecParseCmd & vecCmd = itStep->getVecCmd();
591  bool isMatchedCmd(false);
592  PVecParseCmd::const_iterator itCmd(vecCmd.begin());
593  while(itCmd != vecCmd.end() && !isMatchedCmd){
594  PString str(itCmd->getStr());
595  if(itCmd->getIsMatch()){
596  isMatchedCmd = isMatch(str);
597  body += str;
598  }else{
599  PString res(getStrComposedOf(str));
600  if(res != ""){
601  body += res;
602  isMatchedCmd = true;
603  }
604  }
605  ++itCmd;
606  }
607  isParseNextStep |= isMatchedCmd;
608  ++itStep;
609  }
610  if(!isParseNextStep){
611  popPosition();
612  body = "";
613  }
614  return body;
615 }
std::vector< PParseCmd > PVecParseCmd
Definition: PParseSeqDef.h:13
std::vector< PParseStep > PVecParseStep
Definition: PParseSeqDef.h:12
PString getStrComposedOf(const PString &charset)
Get string composed of the characters in the string charset.
void popPosition()
Get to the last saved position of the PFileParser in the current file.
Definition: PFileParser.cpp:99
void pushPosition()
Remember the current position of the PFileParser in the current file.
Definition: PFileParser.cpp:93
const std ::vector< PParseStep > & getVecStep() const
Get the variable p_vecStep.
Definition: PParseSeq.cpp:256

References getStrComposedOf(), PParseSeq::getVecStep(), isMatch(), popPosition(), and pushPosition().

+ Here is the call graph for this function:

◆ isMatch() [2/5]

bool PFileParser::isMatch ( const PString patern)

Says if the patern match with the current caracters of the PFileParser.

Parameters
patern: patern we want to check (this patern should not begin with white caracters)
Returns
true if the patern match, false otherwise If the patern match, the current char will be in the next char of the patern

Definition at line 441 of file PFileParser.cpp.

441  {
442  if(patern == "" || isEndOfFile()) return false;
443  skipWhiteSpace();
444  size_t nbCharPatern(patern.size());
445  if(p_currentChar + nbCharPatern > p_nbTotalChar){return false;}
446  bool match = true;
447  size_t i(0lu);
448  while(match && i < nbCharPatern){
449  match = (patern[i] == p_fileContent[p_currentChar + i]);
450  ++i;
451  }
452  if(match){
453  incrementCurrentChar(nbCharPatern);
454  }
455  return match;
456 }
void skipWhiteSpace()
Skip the white space if there is at the current caracter position.

References incrementCurrentChar(), isEndOfFile(), p_currentChar, p_fileContent, p_nbTotalChar, and skipWhiteSpace().

Referenced by PMultiFileParser::checkExpectedMatch(), checkParseSeq(), PMultiFileParser::getCurrentTokenWithoutComment(), getUntilKeyWithoutPaternExclude(), getUntilKeyWithoutPaternRecurse(), getUntilKeyWithoutPaternRecurseExclude(), isMatch(), PMultiFileParser::isMatch(), isMatchRewind(), isMatchSeq(), isMatchToken(), parse_generic_string(), DicoValue::parseDicoValue(), DicoValue::parseListOrMap(), DicoValue::parseString(), pxml_isAttributeEnd(), pxml_parserXmlAttribute(), pxml_parserXmlContent(), PMultiFileParser::skipComment(), testPFileParserIsMatch(), testPFileParserSeq(), testPFileParserSeqOneStep(), testPFileParserVecIsMatch(), and testPFileParserVecVecIsMatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMatch() [3/5]

bool PFileParser::isMatch ( const PString patern,
const PString forbiddenCharBefore 
)

Says if the patern match with the current caracters of the PFileParser.

Parameters
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
Returns
true if the patern match, false otherwise If the patern match, the current char will be in the next char of the patern

Definition at line 495 of file PFileParser.cpp.

495  {
496  if(p_currentChar > 0lu){
497  //If we find a forbidden character before the current char, the patern is canceled
498  if(forbiddenCharBefore.find(p_fileContent[p_currentChar - 1lu])){
499  return false;
500  }
501  }
502  return isMatch(patern);
503 }

References PString::find(), isMatch(), p_currentChar, and p_fileContent.

+ Here is the call graph for this function:

◆ isMatch() [4/5]

PString PFileParser::isMatch ( const PVecString patern)

Check the matching between the current caracters and all the string in the vector.

Parameters
patern: vector of the patern we want to check
Returns
matching patern if there is one, empty string otherwise

Definition at line 536 of file PFileParser.cpp.

536  {
537  if(patern.size() == 0lu) return "";
538  PVecString::const_iterator it(patern.begin());
539  while(it != patern.end()){
540  if(isMatch(*it)) return *it;
541  ++it;
542  }
543  return "";
544 }

References isMatch().

+ Here is the call graph for this function:

◆ isMatch() [5/5]

PString PFileParser::isMatch ( const std::vector< PVecString > &  patern)

Check the matching between the current caracters and all the string in the list of list of string.

Parameters
patern: list of the list of the patern we want to check
Returns
matching patern if there is one, empty string otherwise

Definition at line 564 of file PFileParser.cpp.

564  {
565  if(patern.size() == 0lu) return "";
566  std::vector<PVecString >::const_iterator itList(patern.begin());
567  while(itList != patern.end()){
568  PVecString::const_iterator it(itList->begin());
569  while(it != itList->end()){
570  if(isMatch(*it)) return *it;
571  ++it;
572  }
573  ++itList;
574  }
575  return "";
576 }

References isMatch().

+ Here is the call graph for this function:

◆ isMatchRewind()

bool PFileParser::isMatchRewind ( const PString patern)

Do a isMatch and then go back at the previous position.

Parameters
patern: patern we want to check (this patern should not begin with white caracters)
Returns
true if the patern match, false otherwise If the patern match, the current char will be in the next char of the patern

Definition at line 463 of file PFileParser.cpp.

463  {
464  pushPosition();
465  bool b = isMatch(patern);
466  popPosition();
467  return b;
468 }

References isMatch(), popPosition(), and pushPosition().

Referenced by PMultiFileParser::isMatchRewind(), and DicoValue::parseListOrMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMatchSeq()

bool PFileParser::isMatchSeq ( const PVecString patern,
bool  alwaysPopBack = false 
)

Match a sequence of token in a vector.

Parameters
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
Returns
true if the full sequence matches, false otherwise

Definition at line 475 of file PFileParser.cpp.

475  {
476  pushPosition();
477  PVecString::const_iterator it(patern.begin());
478  bool matchPatern(true);
479  while(it != patern.end() && matchPatern){
480  matchPatern = isMatch(*it);
481  ++it;
482  }
483  if(!matchPatern || alwaysPopBack){
484  popPosition();
485  }
486  return matchPatern;
487 }

References isMatch(), popPosition(), and pushPosition().

Referenced by PMultiFileParser::isMatchSeq(), and testPFileParserMatchSeq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMatchToken() [1/3]

bool PFileParser::isMatchToken ( const PString patern)

Says if the patern match with the current caracters of the PFileParser but treats the string as a token (cannot be part of a word)

Parameters
patern: patern we want to check (this patern should not begin with white caracters)
Returns
true if the patern match, false otherwise If the patern match, the current char will be in the next char of the patern

Definition at line 510 of file PFileParser.cpp.

510  {
511  pushPosition();
512  if(!isMatch(patern)){
513  popPosition();
514  return false;
515  }
516  PString letterNumberUnderscore("_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
517  if(p_currentChar > patern.size()){
518  if(letterNumberUnderscore.find(p_fileContent[p_currentChar - patern.size() - 1lu])){
519  popPosition();
520  return false;
521  }
522  }
524  if(letterNumberUnderscore.find(p_fileContent[p_currentChar])){
525  popPosition();
526  return false;
527  }
528  }
529  return true;
530 }

References PString::find(), isMatch(), p_currentChar, p_fileContent, p_nbTotalChar, popPosition(), and pushPosition().

Referenced by isMatchToken(), PMultiFileParser::isMatchToken(), testPFileParserMapIsMatchToken(), and testPFileParserVecIsMatchToken().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isMatchToken() [2/3]

PString PFileParser::isMatchToken ( const PVecString patern)

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)

Parameters
patern: vector of the patern we want to check
Returns
matching patern if there is one, empty string otherwise

Definition at line 550 of file PFileParser.cpp.

550  {
551  if(patern.size() == 0lu) return "";
552  PVecString::const_iterator it(patern.begin());
553  while(it != patern.end()){
554  if(isMatchToken(*it)) return *it;
555  ++it;
556  }
557  return "";
558 }
bool isMatchToken(const PString &patern)
Says if the patern match with the current caracters of the PFileParser but treats the string as a tok...

References isMatchToken().

+ Here is the call graph for this function:

◆ isMatchToken() [3/3]

template<typename T >
bool PFileParser::isMatchToken ( PString matchKey,
T &  matchValue,
const std::map< PString, T > &  patern 
)

Check if one key of the map, matches the current token.

Parameters
[out]matchKey: matching key (on success)
[out]matchValue: matching value (on success)
patern: map of patterns to be checked
Returns
true if one of the map key matches the current token, false otherwise

Definition at line 19 of file PFileParser_impl.h.

19  {
20  if(patern.size() == 0lu) return false;
21  typename std::map<PString, T>::const_iterator it(patern.begin());
22  while(it != patern.end()){
23  if(isMatchToken(it->first)){
24  matchKey = it->first;
25  matchValue = it->second;
26  return true;
27  }
28  ++it;
29  }
30  return false;
31 }

References isMatchToken().

+ Here is the call graph for this function:

◆ isWhiteSpace()

bool PFileParser::isWhiteSpace ( )

Says if the current char is a white space.

Returns
true if the current char is a white space, false if not If it matchs, the current caracter will be put on a non white space caracter

Definition at line 621 of file PFileParser.cpp.

621  {
622  if(isEndOfFile()) return false;
624  do{
627  return true;
628  }else return false;
629 }

References PString::find(), incrementCurrentChar(), isEndOfFile(), p_currentChar, p_fileContent, and p_listWhiteSpace.

Referenced by testPFileParserVecVecIsMatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ open()

bool PFileParser::open ( const PPath fileName)

Fonction qui ouvre le fichier que l'on va parser.

Parameters
fileName: nom du fichier à ouvrir
Returns
true si la fonction à réussie, false sinon

Definition at line 24 of file PFileParser.cpp.

24  {
25  p_fileName = fileName;
26  p_fileContent = fileName.loadFileContent();
28  return (p_fileContent != "");
29 }
PString loadFileContent() const
Get the file content in a PString.
Definition: PPath.cpp:382

References PPath::loadFileContent(), p_fileContent, p_fileName, and p_nbTotalChar.

Referenced by PMultiFileParser::load(), and DicoValue::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ popPosition()

void PFileParser::popPosition ( )

Get to the last saved position of the PFileParser in the current file.

Definition at line 99 of file PFileParser.cpp.

99  {
100  if(p_vecPosition.size() == 0lu){
101  return;
102  }
103  p_currentChar = p_vecPosition.back();
104  p_currentLine = p_vecLine.back();
105  p_vecPosition.pop_back();
106  p_vecLine.pop_back();
107 }

References p_currentChar, p_currentLine, p_vecLine, and p_vecPosition.

Referenced by isMatch(), isMatchRewind(), isMatchSeq(), isMatchToken(), and testPFileParserBase().

+ Here is the caller graph for this function:

◆ pushPosition()

void PFileParser::pushPosition ( )

Remember the current position of the PFileParser in the current file.

Definition at line 93 of file PFileParser.cpp.

93  {
94  p_vecPosition.push_back(p_currentChar);
95  p_vecLine.push_back(p_currentLine);
96 }

References p_currentChar, p_currentLine, p_vecLine, and p_vecPosition.

Referenced by isMatch(), isMatchRewind(), isMatchSeq(), and isMatchToken().

+ Here is the caller graph for this function:

◆ setColumn()

void PFileParser::setColumn ( size_t  currentCol)

Set the current column of the PFileParser.

Parameters
currentCol: current column of the PFileParser

Definition at line 81 of file PFileParser.cpp.

81  {
82  p_currentLineFirstColumn = currentCol;
83 }

References p_currentLineFirstColumn.

Referenced by setLocation(), and testPFileParserBase().

+ Here is the caller graph for this function:

◆ setEscapeChar()

void PFileParser::setEscapeChar ( char  escapeChar)

Sets the escape character of the PFileParser.

Parameters
escapeChar: escape character of the PFileParser

Definition at line 58 of file PFileParser.cpp.

58  {
59  p_echapChar = escapeChar;
60 }

References p_echapChar.

Referenced by DicoValue::loadParser().

+ Here is the caller graph for this function:

◆ setFileContent()

◆ setLine()

void PFileParser::setLine ( size_t  currentLine)

Set the current line of the PFileParser.

Parameters
currentLine: current line of the PFileParser

Definition at line 74 of file PFileParser.cpp.

74  {
75  p_currentLine = currentLine;
76 }

References p_currentLine.

Referenced by setLocation(), and testPFileParserBase().

+ Here is the caller graph for this function:

◆ setLocation()

void PFileParser::setLocation ( const PLocation location)

Set the current location of the PFileParser.

Parameters
location: current location of the PFileParser

Definition at line 65 of file PFileParser.cpp.

65  {
66  setLine(location.getLine());
67  setColumn(location.getColumn());
68  p_fileName = location.getFileName();
69 }
void setLine(size_t currentLine)
Set the current line of the PFileParser.
Definition: PFileParser.cpp:74
void setColumn(size_t currentCol)
Set the current column of the PFileParser.
Definition: PFileParser.cpp:81
size_t getLine() const
renvoie la ligne du PLocation
Definition: PLocation.cpp:67
PPath getFileName() const
renvoie le fichier du PLocation
Definition: PLocation.cpp:60
size_t getColumn() const
renvoie la colonne du PLocation
Definition: PLocation.cpp:74

References PLocation::getColumn(), PLocation::getFileName(), PLocation::getLine(), p_fileName, setColumn(), and setLine().

Referenced by testPFileParserBase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSeparator()

void PFileParser::setSeparator ( const PString separator)

Initialise la liste des caractères séparateurs.

Parameters
separator: liste des caractères séparateurs Se sont les caractères que l'on ne prend en compte un par un

Definition at line 43 of file PFileParser.cpp.

43  {
44  p_listSeparator = separator;
45 }

References p_listSeparator.

Referenced by DicoValue::loadParser(), ConfigParser::preLoadFile(), pxml_parserXmlContent(), pxml_setXmlParser(), testPFileParserBase(), testPFileParserGetNextToken(), and testPFileParserGetNextToken2().

+ Here is the caller graph for this function:

◆ setWhiteSpace()

void PFileParser::setWhiteSpace ( const PString whiteSpace)

Initialise la liste des caractères blancs.

Parameters
whiteSpace: liste des caractères blancs Se sont les caractères que l'on ne prend jamais en compte

Definition at line 35 of file PFileParser.cpp.

35  {
36  p_listWhiteSpace = whiteSpace;
37 }

References p_listWhiteSpace.

Referenced by DicoValue::loadParser(), ConfigParser::preLoadFile(), pxml_parserXmlAttribute(), pxml_parserXmlContent(), pxml_setXmlParser(), testPFileParserBase(), testPFileParserGetNextToken(), and testPFileParserGetNextToken2().

+ Here is the caller graph for this function:

◆ skipChars()

void PFileParser::skipChars ( const PString chToSkip)

Skip the characters in the given string.

Parameters
chToSkip: set of characters tb skip

Definition at line 644 of file PFileParser.cpp.

644  {
645  if(chToSkip.find(p_fileContent[p_currentChar])){
646  do{
648  }while(chToSkip.find(p_fileContent[p_currentChar]) && !isEndOfFile());
649  }
650 }

References PString::find(), incrementCurrentChar(), isEndOfFile(), p_currentChar, and p_fileContent.

Referenced by getStrComposedOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ skipWhiteSpace()

void PFileParser::skipWhiteSpace ( )

Skip the white space if there is at the current caracter position.

Definition at line 632 of file PFileParser.cpp.

632  {
633  if(p_dontSkipSpace){return;}
635  do{
638  }
639 }

References PString::find(), incrementCurrentChar(), isEndOfFile(), p_currentChar, p_dontSkipSpace, p_fileContent, and p_listWhiteSpace.

Referenced by isMatch(), DicoValue::loadParser(), DicoValue::parseDicoValue(), and ConfigParser::parseFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const PFileParser other 
)
friend

Définition de l'opérateur de flux sortant.

Parameters
out: flux dans lequel il faut écrire
other: PFileParser
Returns
flux contenant le PFileParser

Definition at line 741 of file PFileParser.cpp.

741  {
742  out << "file '" << other.getFileName() << "' line " << other.getLine() << ":" << other.getColumn();
743  return out;
744 }
size_t getLine() const
Fonction qui renvoie le numéro de la ligne courante.
PPath getFileName() const
Fonction qui renvoie le nom du fichier que l'on a ouvert.

Member Data Documentation

◆ p_currentChar

◆ p_currentLine

size_t PFileParser::p_currentLine
private

◆ p_currentLineFirstColumn

size_t PFileParser::p_currentLineFirstColumn
private

Number of the first column caracter of the current line.

Definition at line 107 of file PFileParser.h.

Referenced by getColumn(), getLineIndentation(), incrementCurrentLine(), initialisationPFileParser(), and setColumn().

◆ p_dontSkipSpace

bool PFileParser::p_dontSkipSpace
private

◆ p_echapChar

char PFileParser::p_echapChar
private

Echap caracter.

Definition at line 113 of file PFileParser.h.

Referenced by getEscapeChar(), incrementCurrentChar(), initialisationPFileParser(), and setEscapeChar().

◆ p_fileContent

◆ p_fileName

PPath PFileParser::p_fileName
private

Nom du fichier que l'on veut parser.

Definition at line 97 of file PFileParser.h.

Referenced by getFileName(), getLocation(), open(), and setLocation().

◆ p_listSeparator

PString PFileParser::p_listSeparator
private

liste des séparateurs

Definition at line 111 of file PFileParser.h.

Referenced by getNextToken(), getSeparator(), initialisationPFileParser(), isChSeparator(), and setSeparator().

◆ p_listWhiteSpace

PString PFileParser::p_listWhiteSpace
private

◆ p_nbTotalChar

◆ p_vecLine

std::vector<size_t> PFileParser::p_vecLine
private

Vector of all the checkpoint rows in the text file (added with pushPosition() and removed with popPosition() or clear()

Definition at line 117 of file PFileParser.h.

Referenced by clear(), popPosition(), and pushPosition().

◆ p_vecPosition

std::vector<size_t> PFileParser::p_vecPosition
private

Vector of all the checkpoint positions in the text file (added with pushPosition() and removed with popPosition() or clear()

Definition at line 115 of file PFileParser.h.

Referenced by clear(), popPosition(), and pushPosition().


The documentation for this class was generated from the following files: