1 |
#ifndef XMLPATCH_H |
2 |
#define XMLPATCH_H |
3 |
|
4 |
#include "xmltools.h" |
5 |
#include "optionsparser.h" |
6 |
#include <omp.h> // OpenMP support |
7 |
#include <ctime> // script execution time calculation |
8 |
|
9 |
#define SLOW_SCRIPT_TIME 0.1 // if a user script takes more than 0.1 seconds to execute give a warning. |
10 |
|
11 |
class XmlPatch |
12 |
{ |
13 |
public: |
14 |
XmlPatch(QString patchFilesWildcard, QString forceTargetFilesWildcard, bool noBackups, bool noVerbose); |
15 |
void readAndProcessPatchFile(); |
16 |
private: |
17 |
QStringList patchFilesToProcess; |
18 |
QString forceTargetFilesWildcard; |
19 |
pugi::xml_document document; |
20 |
pugi::xml_node rootNode; |
21 |
bool backupsEnabled, verboseEnabled; |
22 |
QString getPatchParameterValue(const QString& line, QString parameter); |
23 |
void insertNodesOperation(const QString &xmlString, XmlFilter &filters, const QString &xPathExpression, const QString &filesWildcard=""); |
24 |
void removeNodesOperation(XmlFilter &filters, const QString &xPathExpression, const QString &filesWildcard=""); |
25 |
void executeCommandOperation(const QString &commandString); |
26 |
void executeCustomCommandOperation(const QString &jsString, const QString &filesWildcard=""); |
27 |
void checkPatchVersion(const QString &file, QTextStream &fileStream); |
28 |
void checkAndProcessValidCommands(QTextStream &fileStream); |
29 |
void displayJsException(QScriptEngine &engine, QScriptValue &engineResult); |
30 |
}; |
31 |
|
32 |
#endif // XMLPATCH_H |