Rev | Line | |
---|
[905] | 1 | #ifndef XMLTOOLS_H
|
---|
| 2 | #define XMLTOOLS_H
|
---|
| 3 |
|
---|
| 4 | #define _USE_OLD_JS_ENGINE
|
---|
| 5 |
|
---|
| 6 | #include <string>
|
---|
| 7 | #include <QtCore>
|
---|
| 8 | #include <stdio.h>
|
---|
| 9 | #ifdef _USE_OLD_JS_ENGINE // Needs to test each one in terms of performance... At first look seems old engine is faster for the xml parsing method used!
|
---|
| 10 | #include <QScriptEngine>
|
---|
| 11 | #else
|
---|
| 12 | #include <QJSEngine>
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
| 15 | #include "utilxmltools.h"
|
---|
| 16 | #include "multidimvar.h"
|
---|
| 17 |
|
---|
| 18 | // Template got from here:
|
---|
| 19 | // http://www.lubby.org/ebooks/qtconsoleapp2/qtconsoleapp2.html
|
---|
| 20 |
|
---|
| 21 | // The xml library used was pugixml:
|
---|
| 22 | // https://code.google.com/p/pugixml/
|
---|
| 23 |
|
---|
| 24 | class XmlTools
|
---|
| 25 | {
|
---|
| 26 | public:
|
---|
| 27 | XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups);
|
---|
| 28 | void addValues(QString newValues);
|
---|
| 29 | void removeValues(QString valuesToRemove);
|
---|
| 30 | void replaceValue(QString oldValue, QString newValue);
|
---|
| 31 | void replaceAll(QString value, QString valuePositions = "");
|
---|
| 32 | void updateElements(QString diffBetweenOldAndNewValue);
|
---|
| 33 | void invertElements();
|
---|
| 34 | private:
|
---|
| 35 | QString replaceSpecificPositions(const QString &newValue, const QString &currValues, const QString &positionsToReplace);
|
---|
| 36 | pugi::xml_document document;
|
---|
| 37 | pugi::xml_node rootNode;
|
---|
| 38 | QStringList filesToProcess;
|
---|
| 39 | XmlFilter filters;
|
---|
| 40 | bool backupsEnabled;
|
---|
| 41 | };
|
---|
| 42 |
|
---|
| 43 | #endif // XMLTOOLS_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.