Utils: MacroExpander API cosmetics.

Make const-correct, add convenience function for commandline parameter
expansion.

Change-Id: I12c3651e4e7b8a0a9319d1dfbea676b622b1a41a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2014-10-21 13:19:38 +02:00
parent 1b3db2f57b
commit 35e883eea0
14 changed files with 88 additions and 64 deletions

View File

@@ -47,20 +47,22 @@ class MacroExpander;
typedef std::function<MacroExpander *()> MacroExpanderProvider;
typedef QVector<MacroExpander *> MacroExpanders;
class QTCREATOR_UTILS_EXPORT MacroExpander : public AbstractMacroExpander
class QTCREATOR_UTILS_EXPORT MacroExpander
{
Q_DECLARE_TR_FUNCTIONS("MacroExpander")
public:
explicit MacroExpander();
~MacroExpander();
virtual ~MacroExpander();
bool resolveMacro(const QString &name, QString *ret);
virtual bool resolveMacro(const QString &name, QString *ret) const;
QString value(const QByteArray &variable, bool *found = 0);
QString value(const QByteArray &variable, bool *found = 0) const;
QString expand(const QString &stringWithVariables);
QByteArray expand(const QByteArray &stringWithVariables);
QString expand(const QString &stringWithVariables) const;
QByteArray expand(const QByteArray &stringWithVariables) const;
QString expandProcessArgs(const QString &argsWithVariables) const;
typedef std::function<QString(QString)> PrefixFunction;
typedef std::function<QString()> StringFunction;
@@ -78,10 +80,11 @@ public:
void registerFileVariables(const QByteArray &prefix,
const QString &heading, const StringFunction &value);
QList<QByteArray> variables();
QString variableDescription(const QByteArray &variable);
QList<QByteArray> variables() const;
QString variableDescription(const QByteArray &variable) const;
MacroExpanders subExpanders() const;
AbstractMacroExpander *abstractExpander() const;
QString displayName() const;
void setDisplayName(const QString &displayName);
@@ -95,6 +98,7 @@ private:
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
friend class Internal::MacroExpanderPrivate;
Internal::MacroExpanderPrivate *d;
};