-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmltools.h
39 lines (32 loc) · 1.15 KB
/
xmltools.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef XMLTOOLS_H
#define XMLTOOLS_H
#include <string>
#include <stdio.h>
#include "utilxmltools.h"
#include "utilglobalvars.h"
#include "multidimvar.h"
// Template got from here:
// http://www.lubby.org/ebooks/qtconsoleapp2/qtconsoleapp2.html
// The xml library used was pugixml:
// https://code.google.com/p/pugixml/
class XmlTools
{
public:
XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups, bool noVerbose);
XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups, bool noVerbose);
void addValues(QString newValues);
void removeValues(QString valuesToRemove);
void replaceValue(QString oldValue, QString newValue);
void replaceAll(QString value, QString valuePositions = "");
void updateElements(QString diffBetweenOldAndNewValue);
void invertElements();
private:
QString replaceSpecificPositions(const QString &newValue, const QString &currValues, const QString &positionsToReplace);
pugi::xml_document document;
pugi::xml_node rootNode;
QVector<QString> filesToProcess;
QString xPathExpression;
XmlFilter filters;
bool backupsEnabled, verboseEnabled;
};
#endif // XMLTOOLS_H