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