30 for(PVecString::const_iterator it(vecToken.begin()); it != vecToken.end(); ++it){
41void PHighlightParser::addToken(
const PString & beginPattern,
const PString & endPattern,
const PString & replaceBeforePattern,
const PString & replaceAfterPattern){
56 if(content.size() == 0lu ||
p_replaceTree.getMapChild().size() == 0lu){
return content;}
60 bool isPreviousMatchingString(
false);
61 PString out(
""), pattern(
""), replacePattern(
"");
63 size_t beginTest(0lu), nbMatch(0lu), indexLastMatchReplace(0lu);
67 if(it.next(currentChar)){
71 pattern += currentChar;
74 action = it->getValue();
75 replacePattern = pattern;
76 isPreviousMatchingString =
true;
83 isPreviousMatchingString =
false;
88 if(isPreviousMatchingString){
89 doReplaceAction(out, parser, action, replacePattern, indexLastMatchReplace);
91 out += parser.
getChar(beginTest);
95 isPreviousMatchingString =
false;
103 if(isPreviousMatchingString){
104 doReplaceAction(out, parser, action, replacePattern, indexLastMatchReplace);
105 }
else if(nbMatch != 0lu){
135 if(action == NULL){
return;}
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
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 setCurrentCharIdx(size_t index)
Set the index of the current char.
char getChar(size_t index) const
Get the char at the given index.
char getCurrentCh() const
Renvoie le caractère courant.
void setFileContent(const PString &fileContent)
Set the file content.
size_t getCurrentCharIdx() const
Return the index of the current character.
bool isEndOfFile() const
Dit si on est à la fin du fichier.
size_t getNbTotalChar() const
Return the number of characters in the current opened file.
virtual ~PHighlightParser()
Destructor of PHighlightParser.
PHighlightParser()
Default constructor of PHighlightParser.
PReplaceHightlightTree p_replaceTree
Map of tree to be used to do the hightlighting.
std::vector< PHighlightingAction * > p_vecPtrAction
Vector of pointer of PHighlightingAction.
void doReplaceAction(PString &out, PFileParser &parser, PHighlightingAction *action, const PString &replacePattern, size_t indexLastMatchReplace)
Do the replace action.
void clear()
Clear all PHighlightingAction.
void initialisationPHighlightParser()
Initialisation function of the class PHighlightParser.
void addToken(const PVecString &vecToken, const PString &replaceBeforePattern, const PString &replaceAfterPattern)
Add token in the highlighter.
PString makeHighlighting(const PString &content)
Do the highlighting of the given PString.
@ GET_UNITL_WITHOUT_PATTERN
Action of the hightlighting.
PString endPattern
End pattern to be used with the GET_UNITL_WITHOUT_PATTERN.
PString replaceBeforePattern
String to be placed before the replaced pattern.
PString replaceAfterPattern
String to be placed after the replaced pattern.
PHighlightType::PHighlightType type
Type of the hightlighting.