Commit 46c4ab7b authored by hjk's avatar hjk

Utils: Introduce a not-so-abstract MacroExpander utility class

The current use of AbstractMacroExpander requires some boiler plate
code that can be avoided.

Change-Id: I753d872d824274d94d5105232a8fc05ac7bf0711
Reviewed-by: default avatarOswald Buddenhagen <>
Reviewed-by: default avatarTobias Hunger <>
parent 08127189
......@@ -32,6 +32,8 @@
#include "utils_global.h"
#include <functional>
class QStringList;
......@@ -75,6 +77,19 @@ private:
bool expandNestedMacros(const QString &str, int *pos, QString *ret);
class QTCREATOR_UTILS_EXPORT MacroExpander : public AbstractMacroExpander
typedef std::function<bool(const QString &name, QString *ret)> Resolver;
explicit MacroExpander(const Resolver &resolver) : m_resolver(resolver) {}
bool resolveMacro(const QString &name, QString *ret) { return m_resolver(name, ret); }
Resolver m_resolver;
QTCREATOR_UTILS_EXPORT void expandMacros(QString *str, AbstractMacroExpander *mx);
QTCREATOR_UTILS_EXPORT QString expandMacros(const QString &str, AbstractMacroExpander *mx);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment