diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-24 14:55:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-24 14:56:38 +0300 |
commit | f7190f06bdfc24415ace9dad391aed71aca8f914 (patch) | |
tree | 7e49be84f9b2375c2b56c784d3ab0a3dbdfd533d /src/template.hpp | |
parent | ddb7f310fb31934c92f73da3ae0c4226f2689b76 (diff) | |
download | mplint-f7190f06bdfc24415ace9dad391aed71aca8f914.tar.gz mplint-f7190f06bdfc24415ace9dad391aed71aca8f914.tar.bz2 mplint-f7190f06bdfc24415ace9dad391aed71aca8f914.tar.xz mplint-f7190f06bdfc24415ace9dad391aed71aca8f914.zip |
Add macro for fast creating rule with single mask.
Diffstat (limited to 'src/template.hpp')
-rw-r--r-- | src/template.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/template.hpp b/src/template.hpp index 3aa0003..2bd9811 100644 --- a/src/template.hpp +++ b/src/template.hpp @@ -35,9 +35,30 @@ class name : public RuleBase \ \ namespace \ { \ - name instance; \ + name instance##name; \ } \ +#define registerRuleExt(name, ext) \ +class name : public RuleBase \ +{ \ + public: \ + name() \ + { \ + setName(#name); \ + addMask(ext); \ + } \ +\ + void init(); \ +\ + void parseLine(const std::string &data); \ +}; \ +\ +namespace \ +{ \ + name instance##name; \ +} \ + + #define constructRule(name) name::name() #define initRule(name) void name::init() #define parseLineRule(name) void name::parseLine(const std::string &data) |