// // Created by Tobias Hieta on 20/08/15. // #ifndef KONVERGO_CACHEDREGEXMATCHER_H #define KONVERGO_CACHEDREGEXMATCHER_H #include #include #include #include typedef QPair MatcherValuePair; typedef QList MatcherValueList; class CachedRegexMatcher : public QObject { public: explicit CachedRegexMatcher(bool allowMultiplePatterns = true, QObject* parent = nullptr) : QObject(parent), m_allowMultiplePatterns(allowMultiplePatterns) {} bool addMatcher(const QString& pattern, const QVariant& result); QVariantList match(const QString& input); void clear(); private: MatcherValueList m_matcherList; QHash m_matcherCache; bool m_allowMultiplePatterns; }; #endif //KONVERGO_CACHEDREGEXMATCHER_H