diff options
author | Niko Sams <niko.sams@gmail.com> | 2010-10-04 20:46:53 +0200 |
---|---|---|
committer | Niko Sams <niko.sams@gmail.com> | 2010-10-04 20:46:53 +0200 |
commit | 605cbf99adb7393de7e029b2d326590540cf145f (patch) | |
tree | 5b1e5b1aaeab67b78e79dd96e06f2dadb1747b84 /src/ruleparser.h | |
parent | 01a0bb21489c7d6f019df3b8efc5cbdec7c4b443 (diff) | |
parent | a741bdb1913c28a320ff0e01518e4d39ed430289 (diff) | |
download | svn2git-605cbf99adb7393de7e029b2d326590540cf145f.tar svn2git-605cbf99adb7393de7e029b2d326590540cf145f.tar.gz svn2git-605cbf99adb7393de7e029b2d326590540cf145f.tar.bz2 svn2git-605cbf99adb7393de7e029b2d326590540cf145f.tar.xz svn2git-605cbf99adb7393de7e029b2d326590540cf145f.zip |
Merge branch 'master' of gitorious.org:svn2git/svn2git
Diffstat (limited to 'src/ruleparser.h')
-rw-r--r-- | src/ruleparser.h | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/src/ruleparser.h b/src/ruleparser.h index afd1db2..5d05d1c 100644 --- a/src/ruleparser.h +++ b/src/ruleparser.h @@ -22,11 +22,18 @@ #include <QRegExp> #include <QString> #include <QStringList> +#include <QStringBuilder> class Rules { public: - struct Repository + struct Rule + { + QString filename; + int lineNumber; + Rule() : lineNumber(0) {} + }; + struct Repository : Rule { struct Branch { @@ -35,15 +42,19 @@ public: QString name; QList<Branch> branches; - int lineNumber; QString forwardTo; QString prefix; - Repository() : lineNumber(0) { } + Repository() { } + const QString info() const { + const QString info = Rule::filename % ":" % QByteArray::number(Rule::lineNumber); + return info; + } + }; - struct Match + struct Match : Rule { QRegExp rx; QString repository; @@ -51,7 +62,6 @@ public: QString prefix; int minRevision; int maxRevision; - int lineNumber; bool annotate; enum Action { @@ -60,14 +70,18 @@ public: Recurse } action; - Match() : minRevision(-1), maxRevision(-1), lineNumber(0), annotate(false), action(Ignore) { } + Match() : minRevision(-1), maxRevision(-1), annotate(false), action(Ignore) { } + const QString info() const { + const QString info = rx.pattern() % " (" % Rule::filename % ":" % QByteArray::number(Rule::lineNumber) % ")"; + return info; + } }; Rules(const QString &filename); ~Rules(); - QList<Repository> repositories(); - QList<Match> matchRules(); + const QList<Repository> repositories() const; + const QList<Match> matchRules() const; void load(); QStringList readRules(const QString &filename) const; @@ -78,6 +92,24 @@ private: QList<Match> m_matchRules; }; +class RulesList +{ +public: + RulesList( const QString &filenames); + ~RulesList(); + + const QList<Rules::Repository> allRepositories() const; + const QList<QList<Rules::Match> > allMatchRules() const; + const QList<Rules*> rules() const; + void load(); + +private: + QString m_filenames; + QList<Rules*> m_rules; + QList<Rules::Repository> m_allrepositories; + QList<QList<Rules::Match> > m_allMatchRules; +}; + #ifndef QT_NO_DEBUG_STREAM class QDebug; QDebug operator<<(QDebug, const Rules::Match &); |