MLBookProc
2.1
Toggle main menu visibility
Loading...
Searching...
No Matches
FormatAnnotation.h
1
/*
2
* Copyright (C) 2024-2025 Yury Bobylev <bobilev_yury@mail.ru>
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the Free
6
* Software Foundation, version 3.
7
*
8
* This program is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
* more details.
12
*
13
* You should have received a copy of the GNU General Public License along with
14
* this program. If not, see <https://www.gnu.org/licenses/>.
15
*/
16
17
#ifndef FORMATANNOTATION_H
18
#define FORMATANNOTATION_H
19
20
#include <MLBookProc.h>
21
#include <ReplaceTagItem.h>
22
#include <XMLParserCPP.h>
23
#include <memory>
24
#include <string>
25
#include <vector>
26
32
class
FormatAnnotation
33
{
34
public
:
39
FormatAnnotation
(
const
std::shared_ptr<MLBookProc> &mlbp);
40
41
virtual
~FormatAnnotation
();
42
53
void
54
removeEscapeSequences
(std::string &annotation);
55
65
void
66
replaceTags
(std::string &annotation);
67
78
void
79
finalCleaning
(std::string &annotation);
80
88
void
89
removeAllTags
(std::string &annotation);
90
102
void
103
setTagReplacementTable
(
104
const
std::vector<ReplaceTagItem> &replacement_table,
105
const
std::vector<std::tuple<std::string, std::string>>
106
&symbols_replacement);
107
108
private
:
109
void
110
recursiveReplacement(
const
std::vector<XMLElement> &elements,
111
std::string &annotation);
112
113
void
114
recursiveTagRemoving(
const
std::vector<XMLElement> &elements,
115
std::string &annotation);
116
117
std::string
118
replaceSymbols(
const
std::string &source);
119
120
XMLParserCPP *xml_parser;
121
122
std::vector<ReplaceTagItem> replacement_table;
123
124
std::vector<std::tuple<std::string, std::string>> symbols_replacement;
125
126
std::shared_ptr<MLBookProc> mlbp;
127
};
128
129
#endif
// FORMATANNOTATION_H
FormatAnnotation::finalCleaning
void finalCleaning(std::string &annotation)
Cleans some sequences from annotation.
FormatAnnotation::setTagReplacementTable
void setTagReplacementTable(const std::vector< ReplaceTagItem > &replacement_table, const std::vector< std::tuple< std::string, std::string > > &symbols_replacement)
Sets tag replacement table.
FormatAnnotation::FormatAnnotation
FormatAnnotation(const std::shared_ptr< MLBookProc > &mlbp)
FormatAnnotation constructor.
FormatAnnotation::removeAllTags
void removeAllTags(std::string &annotation)
Simply removes all XML tags.
FormatAnnotation::removeEscapeSequences
void removeEscapeSequences(std::string &annotation)
Removes escape sequences from annotation.
FormatAnnotation::replaceTags
void replaceTags(std::string &annotation)
Replaces XML tags.
FormatAnnotation.h
Generated by
1.17.0