cmMakefile: Make GetProperty const.

This commit is contained in:
Stephen Kelly 2014-01-22 14:38:10 +01:00
parent 0bd4157886
commit b33ea5783a
2 changed files with 16 additions and 15 deletions

View File

@ -3235,9 +3235,9 @@ void cmMakefile::AddMacro(const char* name, const char* signature)
this->MacrosMap[name] = signature; this->MacrosMap[name] = signature;
} }
void cmMakefile::GetListOfMacros(std::string& macros) void cmMakefile::GetListOfMacros(std::string& macros) const
{ {
StringStringMap::iterator it; StringStringMap::const_iterator it;
macros = ""; macros = "";
int cc = 0; int cc = 0;
for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it ) for ( it = this->MacrosMap.begin(); it != this->MacrosMap.end(); ++it )
@ -3673,7 +3673,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString); this->Properties.AppendProperty(prop,value,cmProperty::DIRECTORY,asString);
} }
const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const char *cmMakefile::GetPropertyOrDefinition(const char* prop) const
{ {
const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY); const char *ret = this->GetProperty(prop, cmProperty::DIRECTORY);
if (!ret) if (!ret)
@ -3683,13 +3683,13 @@ const char *cmMakefile::GetPropertyOrDefinition(const char* prop)
return ret; return ret;
} }
const char *cmMakefile::GetProperty(const char* prop) const char *cmMakefile::GetProperty(const char* prop) const
{ {
return this->GetProperty(prop, cmProperty::DIRECTORY); return this->GetProperty(prop, cmProperty::DIRECTORY);
} }
const char *cmMakefile::GetProperty(const char* prop, const char *cmMakefile::GetProperty(const char* prop,
cmProperty::ScopeType scope) cmProperty::ScopeType scope) const
{ {
if(!prop) if(!prop)
{ {
@ -3713,7 +3713,8 @@ const char *cmMakefile::GetProperty(const char* prop,
} }
else if (!strcmp("LISTFILE_STACK",prop)) else if (!strcmp("LISTFILE_STACK",prop))
{ {
for (std::deque<cmStdString>::iterator i = this->ListFileStack.begin(); for (std::deque<cmStdString>::const_iterator
i = this->ListFileStack.begin();
i != this->ListFileStack.end(); ++i) i != this->ListFileStack.end(); ++i)
{ {
if (i != this->ListFileStack.begin()) if (i != this->ListFileStack.begin())
@ -3828,7 +3829,7 @@ const char *cmMakefile::GetProperty(const char* prop,
return retVal; return retVal;
} }
bool cmMakefile::GetPropertyAsBool(const char* prop) bool cmMakefile::GetPropertyAsBool(const char* prop) const
{ {
return cmSystemTools::IsOn(this->GetProperty(prop)); return cmSystemTools::IsOn(this->GetProperty(prop));
} }

View File

@ -142,7 +142,7 @@ public:
void SetLocalGenerator(cmLocalGenerator*); void SetLocalGenerator(cmLocalGenerator*);
///! Get the current makefile generator. ///! Get the current makefile generator.
cmLocalGenerator* GetLocalGenerator() cmLocalGenerator* GetLocalGenerator() const
{ return this->LocalGenerator;} { return this->LocalGenerator;}
/** /**
@ -492,7 +492,7 @@ public:
{ {
this->IncludeFileRegularExpression = regex; this->IncludeFileRegularExpression = regex;
} }
const char* GetIncludeRegularExpression() const char* GetIncludeRegularExpression() const
{ {
return this->IncludeFileRegularExpression.c_str(); return this->IncludeFileRegularExpression.c_str();
} }
@ -803,7 +803,7 @@ public:
/** /**
* Get a list of macros as a ; separated string * Get a list of macros as a ; separated string
*/ */
void GetListOfMacros(std::string& macros); void GetListOfMacros(std::string& macros) const;
/** /**
* Return a location of a file in cmake or custom modules directory * Return a location of a file in cmake or custom modules directory
@ -813,10 +813,10 @@ public:
///! Set/Get a property of this directory ///! Set/Get a property of this directory
void SetProperty(const char *prop, const char *value); void SetProperty(const char *prop, const char *value);
void AppendProperty(const char *prop, const char *value,bool asString=false); void AppendProperty(const char *prop, const char *value,bool asString=false);
const char *GetProperty(const char *prop); const char *GetProperty(const char *prop) const;
const char *GetPropertyOrDefinition(const char *prop); const char *GetPropertyOrDefinition(const char *prop) const;
const char *GetProperty(const char *prop, cmProperty::ScopeType scope); const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const char *prop); bool GetPropertyAsBool(const char *prop) const;
const char* GetFeature(const char* feature, const char* config); const char* GetFeature(const char* feature, const char* config);