Xcode: Add const qualifiers

This commit is contained in:
James Touton 2016-06-03 16:38:52 -07:00 committed by Brad King
parent acf0c0f444
commit 025edea019
1 changed files with 21 additions and 16 deletions

View File

@ -59,11 +59,11 @@ public:
static const char* PBXTypeNames[]; static const char* PBXTypeNames[];
virtual ~cmXCodeObject(); virtual ~cmXCodeObject();
cmXCodeObject(PBXType ptype, Type type); cmXCodeObject(PBXType ptype, Type type);
Type GetType() { return this->TypeValue; } Type GetType() const { return this->TypeValue; }
PBXType GetIsA() { return this->IsA; } PBXType GetIsA() const { return this->IsA; }
void SetString(const std::string& s); void SetString(const std::string& s);
const std::string& GetString() { return this->String; } const std::string& GetString() const { return this->String; }
void AddAttribute(const std::string& name, cmXCodeObject* value) void AddAttribute(const std::string& name, cmXCodeObject* value)
{ {
@ -73,7 +73,7 @@ public:
void SetObject(cmXCodeObject* value) { this->Object = value; } void SetObject(cmXCodeObject* value) { this->Object = value; }
cmXCodeObject* GetObject() { return this->Object; } cmXCodeObject* GetObject() { return this->Object; }
void AddObject(cmXCodeObject* value) { this->List.push_back(value); } void AddObject(cmXCodeObject* value) { this->List.push_back(value); }
bool HasObject(cmXCodeObject* o) bool HasObject(cmXCodeObject* o) const
{ {
return !(std::find(this->List.begin(), this->List.end(), o) == return !(std::find(this->List.begin(), this->List.end(), o) ==
this->List.end()); this->List.end());
@ -94,23 +94,25 @@ public:
virtual void PrintComment(std::ostream&) {} virtual void PrintComment(std::ostream&) {}
static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out); static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out);
const std::string& GetId() { return this->Id; } const std::string& GetId() const { return this->Id; }
void SetId(const std::string& id) { this->Id = id; } void SetId(const std::string& id) { this->Id = id; }
cmGeneratorTarget* GetTarget() { return this->Target; } cmGeneratorTarget* GetTarget() const { return this->Target; }
void SetTarget(cmGeneratorTarget* t) { this->Target = t; } void SetTarget(cmGeneratorTarget* t) { this->Target = t; }
const std::string& GetComment() { return this->Comment; } const std::string& GetComment() const { return this->Comment; }
bool HasComment() { return (!this->Comment.empty()); } bool HasComment() const { return (!this->Comment.empty()); }
cmXCodeObject* GetObject(const char* name) cmXCodeObject* GetObject(const char* name) const
{ {
if (this->ObjectAttributes.count(name)) { std::map<std::string, cmXCodeObject*>::const_iterator i =
return this->ObjectAttributes[name]; this->ObjectAttributes.find(name);
if (i != this->ObjectAttributes.end()) {
return i->second;
} }
return 0; return 0;
} }
// search the attribute list for an object of the specified type // search the attribute list for an object of the specified type
cmXCodeObject* GetObject(cmXCodeObject::PBXType t) cmXCodeObject* GetObject(cmXCodeObject::PBXType t) const
{ {
for (std::vector<cmXCodeObject*>::iterator i = this->List.begin(); for (std::vector<cmXCodeObject*>::const_iterator i = this->List.begin();
i != this->List.end(); ++i) { i != this->List.end(); ++i) {
cmXCodeObject* o = *i; cmXCodeObject* o = *i;
if (o->IsA == t) { if (o->IsA == t) {
@ -126,7 +128,7 @@ public:
{ {
this->DependLibraries[configName].push_back(l); this->DependLibraries[configName].push_back(l);
} }
std::map<std::string, StringVec> const& GetDependLibraries() std::map<std::string, StringVec> const& GetDependLibraries() const
{ {
return this->DependLibraries; return this->DependLibraries;
} }
@ -134,11 +136,14 @@ public:
{ {
this->DependTargets[configName].push_back(tName); this->DependTargets[configName].push_back(tName);
} }
std::map<std::string, StringVec> const& GetDependTargets() std::map<std::string, StringVec> const& GetDependTargets() const
{ {
return this->DependTargets; return this->DependTargets;
} }
std::vector<cmXCodeObject*> const& GetObjectList() { return this->List; } std::vector<cmXCodeObject*> const& GetObjectList() const
{
return this->List;
}
void SetComment(const std::string& c) { this->Comment = c; } void SetComment(const std::string& c) { this->Comment = c; }
static void PrintString(std::ostream& os, std::string String); static void PrintString(std::ostream& os, std::string String);