#ifndef XMLTOOLS_H #define XMLTOOLS_H #define _USE_OLD_JS_ENGINE #include #include #include #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! #include #else #include #endif #include "utilxmltools.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); XmlTools(QString filesWildcard, QString xPathExpression, bool noBackups); 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; QStringList filesToProcess; QString xPathExpression; XmlFilter filters; bool backupsEnabled; }; #endif // XMLTOOLS_H