Last change
on this file since 945 was 923, checked in by s10k, 11 years ago |
XmlTools2
added --no-verbose mode
The insertion of xml via patch now support multiple nodes inside <xml></xml> tags
|
File size:
1.4 KB
|
Rev | Line | |
---|
[906] | 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:
|
---|
[923] | 27 | XmlTools(QString filesWildcard, XmlFilter filter, bool noBackups, bool noVerbose);
|
---|
| 28 | XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups, bool noVerbose);
|
---|
[906] | 29 | void addValues(QString newValues);
|
---|
| 30 | void removeValues(QString valuesToRemove);
|
---|
| 31 | void replaceValue(QString oldValue, QString newValue);
|
---|
| 32 | void replaceAll(QString value, QString valuePositions = "");
|
---|
| 33 | void updateElements(QString diffBetweenOldAndNewValue);
|
---|
| 34 | void invertElements();
|
---|
| 35 | private:
|
---|
| 36 | QString replaceSpecificPositions(const QString &newValue, const QString &currValues, const QString &positionsToReplace);
|
---|
| 37 | pugi::xml_document document;
|
---|
| 38 | pugi::xml_node rootNode;
|
---|
| 39 | QStringList filesToProcess;
|
---|
[920] | 40 | QString xPathExpression;
|
---|
[906] | 41 | XmlFilter filters;
|
---|
[923] | 42 | bool backupsEnabled, verboseEnabled;
|
---|
[906] | 43 | };
|
---|
| 44 |
|
---|
| 45 | #endif // XMLTOOLS_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.