7 #ifndef __PFILE_PARSER_H__
8 #define __PFILE_PARSER_H__
32 void setLine(
size_t currentLine);
std::vector< PString > PVecString
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
void setSeparator(const PString &separator)
Initialise la liste des caractères séparateurs.
size_t getLine() const
Fonction qui renvoie le numéro de la ligne courante.
PFileParser()
Constructeur de PFileParser.
std::vector< size_t > p_vecPosition
Vector of all the checkpoint positions in the text file (added with pushPosition() and removed with p...
virtual ~PFileParser()
Destructeur de PFileParser.
void skipChars(const PString &chToSkip)
Skip the characters in the given string.
bool isWhiteSpace()
Says if the current char is a white space.
bool isMatchSeq(const PVecString &patern, bool alwaysPopBack=false)
Match a sequence of token in a vector.
bool open(const PPath &fileName)
Fonction qui ouvre le fichier que l'on va parser.
bool isChSpace() const
Dis si le caractère courant est un caractère blanc.
bool p_dontSkipSpace
Say if we don't want to skip the spaces.
PString getUntilKeyWithoutPaternExclude(const PString &patern, const PString &strNotBeforeEndPatern)
Parse a string until the patern is found, only if it has not strNotBeforeEndPatern before it.
PString getCurrentRow() const
Get the current parsed row.
size_t getColumn() const
Fonction qui renvoie le numéro de la colonne du caractère courant.
PString getNextToken()
Get the next token.
PString getUntilKeyWithoutPatern(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern exclu.
void incrementCurrentChar(size_t nbChar=1lu)
Increment the current caracter.
void setEscapeChar(char escapeChar)
Sets the escape character of the PFileParser.
void clear()
Clear the save position of the parser in ther current file.
PString getWhiteSpace() const
renvoie la liste des caractères blancs
PString getSeparator() const
renvoie la liste des caractères séparateurs
PString getUntilKeyWithoutPaternRecurse(const PString &patern, const PString &beginPatern, const PString &allowedCharAfterBegin)
Get the string until end sequence and take account recursive patern (embeded strings)
void setLine(size_t currentLine)
Set the current line of the PFileParser.
PString getStrComposedOf(const PString &charset)
Get string composed of the characters in the string charset.
PString p_listSeparator
liste des séparateurs
void setWhiteSpace(const PString &whiteSpace)
Initialise la liste des caractères blancs.
bool isMatchRewind(const PString &patern)
Do a isMatch and then go back at the previous position.
std::vector< size_t > p_vecLine
Vector of all the checkpoint rows in the text file (added with pushPosition() and removed with popPos...
bool isMatchToken(const PString &patern)
Says if the patern match with the current caracters of the PFileParser but treats the string as a tok...
bool isMatch(const PString &patern)
Says if the patern match with the current caracters of the PFileParser.
char getCurrentCh() const
Renvoie le caractère courant.
char p_echapChar
Echap caracter.
size_t getLineIndentation()
Get the current line indentation.
void popPosition()
Get to the last saved position of the PFileParser in the current file.
size_t p_nbTotalChar
Nombre de caractères total.
PPath p_fileName
Nom du fichier que l'on veut parser.
PString getUntilKey(const PString &patern)
Renvoie la chaine de caractère du caractère courant jusqu'à patern comprise.
void initialisationPFileParser()
Fonction d'initialisation du PFileParser.
void incrementCurrentLine()
Increment the current line.
PString p_fileContent
Contenu du fichier de configuration.
PLocation getLocation() const
Fonction qui renvoie la PLocation du PFileParser.
PPath getFileName() const
Fonction qui renvoie le nom du fichier que l'on a ouvert.
bool isChSeparator() const
Dis si le caractère courant est un séparateur.
void setColumn(size_t currentCol)
Set the current column of the PFileParser.
size_t p_currentLineFirstColumn
Number of the first column caracter of the current line.
void setLocation(const PLocation &location)
Set the current location of the PFileParser.
PString p_listWhiteSpace
liste des espaces blancs
void skipWhiteSpace()
Skip the white space if there is at the current caracter position.
friend std::ostream & operator<<(std::ostream &out, const PFileParser &other)
Définition de l'opérateur de flux sortant.
void setFileContent(const PString &fileContent)
Set the file content.
void pushPosition()
Remember the current position of the PFileParser in the current file.
size_t p_currentChar
Numéro du caractère courant.
size_t p_currentLine
Numéro de la ligne courante.
PString getUntilKeyWithoutPaternRecurseExclude(const PString &patern, const PString &beginPatern, const PString &echapExpr)
Get the string until end sequence and take account recursive patern (embeded strings)
char getPrevCh() const
Renvoie le caractère courant.
size_t getCurrentCharIdx() const
Return the index of the current character.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
char getEscapeChar() const
Gets the escape character of the PFileParser.
size_t getNbTotalChar() const
Return the number of characters in the current opened file.
char getNextChar()
Fonction qui renvoie le prochain caractère du fichier courant.
Classe qui permet de décrire une localisation, avec un nom de fichier et une ligne.
Path of a directory or a file.