summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-24 15:02:28 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-24 15:03:09 +0300
commit19b130c8dd9119bf9eafb7756bcde828e4fc9b48 (patch)
tree72c826ca28a7fc1ba9c6445e33f2e8f9261a37d4
parentf7190f06bdfc24415ace9dad391aed71aca8f914 (diff)
downloadmplint-19b130c8dd9119bf9eafb7756bcde828e4fc9b48.tar.gz
mplint-19b130c8dd9119bf9eafb7756bcde828e4fc9b48.tar.bz2
mplint-19b130c8dd9119bf9eafb7756bcde828e4fc9b48.tar.xz
mplint-19b130c8dd9119bf9eafb7756bcde828e4fc9b48.zip
Add function called after file was processed.
-rw-r--r--src/lintmanager.cpp3
-rw-r--r--src/rulebase.h5
-rw-r--r--src/rules/dump.cpp19
-rw-r--r--src/template.hpp11
4 files changed, 29 insertions, 9 deletions
diff --git a/src/lintmanager.cpp b/src/lintmanager.cpp
index e7211b3..3b49b0b 100644
--- a/src/lintmanager.cpp
+++ b/src/lintmanager.cpp
@@ -111,6 +111,7 @@ void LintManager::applyRulesToFile()
rule->parseLine(str);
line ++;
}
+ rule->end();
}
}
@@ -145,7 +146,7 @@ void LintManager::selectRulesForFile()
// printf("set file %s, for rule %s\n",
// mFileName.c_str(), rule->getName().c_str());
rule->setFile(mFileName);
- rule->init();
+ rule->start();
mSelectedRules.push_back(rule);
}
}
diff --git a/src/rulebase.h b/src/rulebase.h
index 5fa2f57..6b41445 100644
--- a/src/rulebase.h
+++ b/src/rulebase.h
@@ -34,7 +34,10 @@ class RuleBase
virtual ~RuleBase()
{ }
- virtual void init()
+ virtual void start()
+ { }
+
+ virtual void end()
{ }
virtual void parseLine(const std::string &data A_UNUSED)
diff --git a/src/rules/dump.cpp b/src/rules/dump.cpp
index b4cec48..24b8706 100644
--- a/src/rules/dump.cpp
+++ b/src/rules/dump.cpp
@@ -22,9 +22,14 @@
registerRuleExt(dumpCpp, "(.+)[.]cpp")
-initRule(dumpCpp)
+startRule(dumpCpp)
{
- printRaw("Checking file: " + file);
+ printRaw("Start checking file: " + file);
+}
+
+endRule(dumpCpp)
+{
+ printRaw("End checking file: " + file);
}
parseLineRule(dumpCpp)
@@ -32,11 +37,17 @@ parseLineRule(dumpCpp)
print(data);
}
+
registerRuleExt(dumpH, "(.+)[.]h")
-initRule(dumpH)
+startRule(dumpH)
+{
+ printRaw("Start checking file: " + file);
+}
+
+endRule(dumpH)
{
- printRaw("Checking file: " + file);
+ printRaw("End checking file: " + file);
}
parseLineRule(dumpH)
diff --git a/src/template.hpp b/src/template.hpp
index 2bd9811..7345fff 100644
--- a/src/template.hpp
+++ b/src/template.hpp
@@ -28,7 +28,9 @@ class name : public RuleBase \
public: \
name(); \
\
- void init(); \
+ void start(); \
+\
+ void end(); \
\
void parseLine(const std::string &data); \
}; \
@@ -48,7 +50,9 @@ class name : public RuleBase \
addMask(ext); \
} \
\
- void init(); \
+ void start(); \
+\
+ void end(); \
\
void parseLine(const std::string &data); \
}; \
@@ -60,5 +64,6 @@ namespace \
#define constructRule(name) name::name()
-#define initRule(name) void name::init()
+#define startRule(name) void name::start()
+#define endRule(name) void name::end()
#define parseLineRule(name) void name::parseLine(const std::string &data)