MLBookProc 1.3
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 <AuxFunc.h>
21#include <ReplaceTagItem.h>
22#include <XMLParserCPP.h>
23#include <memory>
24#include <string>
25#include <vector>
26
33{
34public:
39 FormatAnnotation(const std::shared_ptr<AuxFunc> &af);
40
45
60 __attribute__((deprecated)) void
61 remove_escape_sequences(std::string &annotation);
62
73 void
74 removeEscapeSequences(std::string &annotation);
75
88 __attribute__((deprecated)) void
89 replace_tags(std::string &annotation);
90
100 void
101 replaceTags(std::string &annotation);
102
117 __attribute__((deprecated)) void
118 final_cleaning(std::string &annotation);
119
130 void
131 finalCleaning(std::string &annotation);
132
140 void
141 removeAllTags(std::string &annotation);
142
153 void
155 const std::vector<ReplaceTagItem> &replacement_table,
156 const std::vector<std::tuple<std::string, std::string>>
157 &symbols_replacement);
158
159private:
160 void
161 recursiveReplacement(const std::vector<XMLElement> &elements,
162 std::string &annotation);
163
164 void
165 recursiveTagRemoving(const std::vector<XMLElement> &elements,
166 std::string &annotation);
167
168 std::string
169 replaceSymbols(const std::string &source);
170
171 XMLParserCPP *xml_parser;
172
173 std::vector<ReplaceTagItem> replacement_table;
174
175 std::vector<std::tuple<std::string, std::string>> symbols_replacement;
176
177 std::shared_ptr<AuxFunc> af;
178};
179
180#endif // FORMATANNOTATION_H
void finalCleaning(std::string &annotation)
Cleans some sequences from annotation.
void setTagReplacementTable(const std::vector< ReplaceTagItem > &replacement_table, const std::vector< std::tuple< std::string, std::string > > &symbols_replacement)
Sets tag replacement table.
FormatAnnotation(const std::shared_ptr< AuxFunc > &af)
FormatAnnotation constructor.
void removeAllTags(std::string &annotation)
Simply removes all XML tags.
void removeEscapeSequences(std::string &annotation)
Removes escape sequences from annotation.
void remove_escape_sequences(std::string &annotation)
Removes escape sequences from annotation.
virtual ~FormatAnnotation()
FormatAnnotation destructor.
void final_cleaning(std::string &annotation)
Cleans some sequences from annotation.
void replace_tags(std::string &annotation)
Replaces XML tags.
void replaceTags(std::string &annotation)
Replaces XML tags.