From 0ecabf708cd56e0312392cca6d85aa8c3f2e7ccc Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 15 Feb 2017 17:54:58 +0100 Subject: Use SINK_REGISTER_TYPES to avoid repeating the types --- sinksh/sinksh_utils.cpp | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'sinksh') diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp index 9a0d1d8..3bbffef 100644 --- a/sinksh/sinksh_utils.cpp +++ b/sinksh/sinksh_utils.cpp @@ -36,31 +36,15 @@ StoreBase &getStore(const QString &type) { using namespace Sink::ApplicationDomain; - if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } else if (type == getTypeName()) { - static Store store; - return store; - } +#define REGISTER_TYPE(TYPE) \ + if (type == getTypeName()) { static Store store; return store; } else +SINK_REGISTER_TYPES() +#undef REGISTER_TYPE + { + SinkWarning_("", "") << "Trying to get a store that doesn't exist: " << type; + Q_ASSERT(false); + } - SinkWarning_("", "") << "Trying to get a store that doesn't exist: " << type; - Q_ASSERT(false); static DummyStore store; return store; } -- cgit v1.2.3