Utils: Merge Abstract{Qtc,}MacroExpander classes

Change-Id: Id78fb47a9b8059684b8b4fc77d9aaaaf23b11bae
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-06-24 16:17:58 +02:00
parent 5d7effd0f3
commit 8005de886b
6 changed files with 10 additions and 11 deletions

View File

@@ -115,7 +115,7 @@ QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path)
return outPath; return outPath;
} }
int AbstractQtcMacroExpander::findMacro(const QString &str, int *pos, QString *ret) int AbstractMacroExpander::findMacro(const QString &str, int *pos, QString *ret)
{ {
forever { forever {
int openPos = str.indexOf(QLatin1String("%{"), *pos); int openPos = str.indexOf(QLatin1String("%{"), *pos);

View File

@@ -55,7 +55,8 @@ QTCREATOR_UTILS_EXPORT QString commonPath(const QStringList &files);
// If path is not sub of home path, or when running on Windows, returns the input // If path is not sub of home path, or when running on Windows, returns the input
QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path); QTCREATOR_UTILS_EXPORT QString withTildeHomePath(const QString &path);
class QTCREATOR_UTILS_EXPORT AbstractMacroExpander { class QTCREATOR_UTILS_EXPORT AbstractMacroExpander
{
public: public:
virtual ~AbstractMacroExpander() {} virtual ~AbstractMacroExpander() {}
// Not const, as it may change the state of the expander. // Not const, as it may change the state of the expander.
@@ -64,11 +65,6 @@ public:
//! \param pos Position to start scan on input, found position on output //! \param pos Position to start scan on input, found position on output
//! \param ret Replacement string on output //! \param ret Replacement string on output
//! \return Length of string part to replace, zero if no (further) matches found //! \return Length of string part to replace, zero if no (further) matches found
virtual int findMacro(const QString &str, int *pos, QString *ret) = 0;
};
class QTCREATOR_UTILS_EXPORT AbstractQtcMacroExpander : public AbstractMacroExpander {
public:
virtual int findMacro(const QString &str, int *pos, QString *ret); virtual int findMacro(const QString &str, int *pos, QString *ret);
//! Provide a replacement string for an expando //! Provide a replacement string for an expando
//! \param name The name of the expando //! \param name The name of the expando

View File

@@ -43,7 +43,7 @@ static const char kFileBaseNamePostfix[] = ":FileBaseName";
namespace Core { namespace Core {
class VMMapExpander : public Utils::AbstractQtcMacroExpander class VMMapExpander : public Utils::AbstractMacroExpander
{ {
public: public:
virtual bool resolveMacro(const QString &name, QString *ret) virtual bool resolveMacro(const QString &name, QString *ret)

View File

@@ -55,7 +55,8 @@ static const char BUILDDIRECTORY_KEY[] = "ProjectExplorer.BuildConfiguration.Bui
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
class BuildConfigMacroExpander : public Utils::AbstractQtcMacroExpander { class BuildConfigMacroExpander : public Utils::AbstractMacroExpander
{
public: public:
explicit BuildConfigMacroExpander(const BuildConfiguration *bc) : m_bc(bc) {} explicit BuildConfigMacroExpander(const BuildConfiguration *bc) : m_bc(bc) {}
virtual bool resolveMacro(const QString &name, QString *ret); virtual bool resolveMacro(const QString &name, QString *ret);

View File

@@ -41,7 +41,9 @@
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
class FallBackMacroExpander : public Utils::AbstractQtcMacroExpander {
class FallBackMacroExpander : public Utils::AbstractMacroExpander
{
public: public:
explicit FallBackMacroExpander(const Target *target) : m_target(target) {} explicit FallBackMacroExpander(const Target *target) : m_target(target) {}
virtual bool resolveMacro(const QString &name, QString *ret); virtual bool resolveMacro(const QString &name, QString *ret);

View File

@@ -37,7 +37,7 @@
namespace ProjectExplorer { namespace ProjectExplorer {
class Kit; class Kit;
class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::AbstractQtcMacroExpander class PROJECTEXPLORER_EXPORT ProjectMacroExpander : public Utils::AbstractMacroExpander
{ {
public: public:
ProjectMacroExpander(const QString &projectFilePath, const QString &projectName, const Kit *k, const QString &bcName); ProjectMacroExpander(const QString &projectFilePath, const QString &projectName, const Kit *k, const QString &bcName);