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