summaryrefslogtreecommitdiff
path: root/src/lintmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-24 15:53:52 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-24 15:53:52 +0300
commit8520c503041946148e499faf6a6b65b2afc670bf (patch)
tree342870ea2f00de996b90c3bd26bcbb003777076f /src/lintmanager.cpp
parentc20a4844817573be1de5f355d4890e93db386e54 (diff)
downloadmplint-8520c503041946148e499faf6a6b65b2afc670bf.tar.gz
mplint-8520c503041946148e499faf6a6b65b2afc670bf.tar.bz2
mplint-8520c503041946148e499faf6a6b65b2afc670bf.tar.xz
mplint-8520c503041946148e499faf6a6b65b2afc670bf.zip
Add second rule for checking #include "debug.h"
Diffstat (limited to 'src/lintmanager.cpp')
-rw-r--r--src/lintmanager.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lintmanager.cpp b/src/lintmanager.cpp
index 3b49b0b..8acb622 100644
--- a/src/lintmanager.cpp
+++ b/src/lintmanager.cpp
@@ -48,11 +48,22 @@ void LintManager::addRule(RuleBase *const rule)
void LintManager::deleteRule(RuleBase *const rule)
{
- FOR_EACH (std::vector<RuleBase*>::iterator, it, mRules)
+ deleteFrom(rule, mRules);
+}
+
+void LintManager::deleteSelectedRule(RuleBase *const rule)
+{
+ deleteFrom(rule, mSelectedRules);
+}
+
+void LintManager::deleteFrom(RuleBase *const rule,
+ std::vector<RuleBase*> &rules)
+{
+ FOR_EACH (std::vector<RuleBase*>::iterator, it, rules)
{
if (*it == rule)
{
- mRules.erase(it);
+ rules.erase(it);
return;
}
}
@@ -109,9 +120,12 @@ void LintManager::applyRulesToFile()
const std::string &str = *itStr;
rule->setLine(line);
rule->parseLine(str);
+ if (!rule->getFlag())
+ break;
line ++;
}
- rule->end();
+ if (rule->getFlag())
+ rule->end();
}
}
@@ -145,6 +159,7 @@ void LintManager::selectRulesForFile()
{
// printf("set file %s, for rule %s\n",
// mFileName.c_str(), rule->getName().c_str());
+ rule->init();
rule->setFile(mFileName);
rule->start();
mSelectedRules.push_back(rule);