PhoenixFileParser
1.7.3
Set of tools to ease file parsing
Toggle main menu visibility
Loading...
Searching...
No Matches
PHighlightParser.h
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
#ifndef __PHIGHLIGHTPARSER_H__
8
#define __PHIGHLIGHTPARSER_H__
9
10
#include "
PFileParser.h
"
11
#include "PMapTree.h"
12
13
namespace
PHighlightType
{
15
enum
PHighlightType
{
16
REPLACE
,
17
GET_UNITL_WITHOUT_PATTERN
18
};
19
}
20
21
23
struct
PHighlightingAction
{
25
PHighlightType::PHighlightType
type
;
27
PString
replaceBeforePattern
;
29
PString
replaceAfterPattern
;
31
PString
endPattern
;
32
};
33
34
typedef
PMapTree<char, PHighlightingAction*>
PReplaceHightlightTree
;
35
37
class
PHighlightParser
{
38
public
:
39
PHighlightParser
();
40
virtual
~PHighlightParser
();
41
42
void
addToken
(
const
PVecString & vecToken,
const
PString & replaceBeforePattern,
const
PString & replaceAfterPattern);
43
44
void
addToken
(
const
PString & beginPattern,
const
PString & endPattern,
const
PString & replaceBeforePattern,
const
PString & replaceAfterPattern);
45
46
PString
makeHighlighting
(
const
PString & content);
47
48
49
void
clear
();
50
private
:
51
void
initialisationPHighlightParser
();
52
void
doReplaceAction
(PString & out,
PFileParser
& parser,
PHighlightingAction
* action,
const
PString & replacePattern,
size_t
indexLastMatchReplace);
54
PReplaceHightlightTree
p_replaceTree
;
56
std::vector<PHighlightingAction*>
p_vecPtrAction
;
57
};
58
59
60
61
#endif
62
PFileParser.h
PReplaceHightlightTree
PMapTree< char, PHighlightingAction * > PReplaceHightlightTree
Definition
PHighlightParser.h:34
PFileParser
classe qui permet de parser des fichiers texte en renvoyant les tokens les uns après les autres
Definition
PFileParser.h:20
PHighlightParser::~PHighlightParser
virtual ~PHighlightParser()
Destructor of PHighlightParser.
Definition
PHighlightParser.cpp:15
PHighlightParser::PHighlightParser
PHighlightParser()
Default constructor of PHighlightParser.
Definition
PHighlightParser.cpp:10
PHighlightParser::p_replaceTree
PReplaceHightlightTree p_replaceTree
Map of tree to be used to do the hightlighting.
Definition
PHighlightParser.h:54
PHighlightParser::p_vecPtrAction
std::vector< PHighlightingAction * > p_vecPtrAction
Vector of pointer of PHighlightingAction.
Definition
PHighlightParser.h:56
PHighlightParser::doReplaceAction
void doReplaceAction(PString &out, PFileParser &parser, PHighlightingAction *action, const PString &replacePattern, size_t indexLastMatchReplace)
Do the replace action.
Definition
PHighlightParser.cpp:134
PHighlightParser::clear
void clear()
Clear all PHighlightingAction.
Definition
PHighlightParser.cpp:116
PHighlightParser::initialisationPHighlightParser
void initialisationPHighlightParser()
Initialisation function of the class PHighlightParser.
Definition
PHighlightParser.cpp:123
PHighlightParser::addToken
void addToken(const PVecString &vecToken, const PString &replaceBeforePattern, const PString &replaceAfterPattern)
Add token in the highlighter.
Definition
PHighlightParser.cpp:24
PHighlightParser::makeHighlighting
PString makeHighlighting(const PString &content)
Do the highlighting of the given PString.
Definition
PHighlightParser.cpp:55
PHighlightType
Definition
PHighlightParser.h:13
PHighlightType::PHighlightType
PHighlightType
Type of the hightlighting.
Definition
PHighlightParser.h:15
PHighlightType::GET_UNITL_WITHOUT_PATTERN
@ GET_UNITL_WITHOUT_PATTERN
Definition
PHighlightParser.h:17
PHighlightType::REPLACE
@ REPLACE
Definition
PHighlightParser.h:16
PHighlightingAction
Action of the hightlighting.
Definition
PHighlightParser.h:23
PHighlightingAction::endPattern
PString endPattern
End pattern to be used with the GET_UNITL_WITHOUT_PATTERN.
Definition
PHighlightParser.h:31
PHighlightingAction::replaceBeforePattern
PString replaceBeforePattern
String to be placed before the replaced pattern.
Definition
PHighlightParser.h:27
PHighlightingAction::replaceAfterPattern
PString replaceAfterPattern
String to be placed after the replaced pattern.
Definition
PHighlightParser.h:29
PHighlightingAction::type
PHighlightType::PHighlightType type
Type of the hightlighting.
Definition
PHighlightParser.h:25
src
PHighlightParser.h
Generated by
1.17.0