summaryrefslogtreecommitdiff
path: root/src/template.hpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-24 14:55:48 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-24 14:56:38 +0300
commitf7190f06bdfc24415ace9dad391aed71aca8f914 (patch)
tree7e49be84f9b2375c2b56c784d3ab0a3dbdfd533d /src/template.hpp
parentddb7f310fb31934c92f73da3ae0c4226f2689b76 (diff)
downloadmplint-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.hpp23
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)