GCC Code Coverage Report


Directory: ./
File: src/PHighlightParser.h
Date: 2025-11-27 16:44:16
Exec Total Coverage
Lines: 0 0 -%
Functions: 0 0 -%
Branches: 0 0 -%

Line Branch Exec Source
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{
14 ///@brief Type of the hightlighting
15 enum PHighlightType{
16 REPLACE,
17 GET_UNITL_WITHOUT_PATTERN
18 };
19 }
20
21
22 ///@brief Action of the hightlighting
23 struct PHighlightingAction{
24 ///Type of the hightlighting
25 PHighlightType::PHighlightType type;
26 ///String to be placed before the replaced pattern
27 PString replaceBeforePattern;
28 ///String to be placed after the replaced pattern
29 PString replaceAfterPattern;
30 ///End pattern to be used with the GET_UNITL_WITHOUT_PATTERN
31 PString endPattern;
32 };
33
34 typedef PMapTree<char, PHighlightingAction*> PReplaceHightlightTree;
35
36 ///@brief Parse full hightlighting of a string
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);
53 ///Map of tree to be used to do the hightlighting
54 PReplaceHightlightTree p_replaceTree;
55 ///Vector of pointer of PHighlightingAction
56 std::vector<PHighlightingAction*> p_vecPtrAction;
57 };
58
59
60
61 #endif
62
63