diff options
author | Brad King <brad.king@kitware.com> | 2014-03-09 14:29:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-03-09 14:29:02 (GMT) |
commit | ad9f0d831e6522d9606bab7ae08559cebeed83ce (patch) | |
tree | d85ba309d378fac37063e7b05fc624e60a819a64 /Source/cmXCodeObject.h | |
parent | 6aad93f407f341fae1afb80ebeab532451c39458 (diff) | |
parent | b633b263082ae2c74a030aefb9048b0a20098b61 (diff) | |
download | CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.zip CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.gz CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.bz2 |
Merge topic 'dev/string-apis'
b633b263 CPackWiX: Fix test to build with expected config
191f25e2 stringapi: Prevent a NULL dereference in WiX
219d6ad6 speedup: Avoid excess iterator dereferences
caaad357 speedup: Cache strings for comparisons
7abf4e31 stringapi: Use strings for dependency information
94fc63e2 stringapi: Use strings for cache iterator values
85fc9f26 stringapi: Command names
6557382d stringapi: Use strings for program paths
1a1b737c stringapi: Use strings for generator names
24b5e93d stringapi: Use strings for directories
11ed3e2c stringapi: Add string overload for the Def struct
b3bf31a5 stringapi: Miscellaneous char* parameters
5af95c39 typo: Match argument name with the header
2b17626e stringapi: Pass strings as install directories in CPack
3def29da stringapi: Use strings for feature arguments
acb116e3 stringapi: Return a string reference for the configuration
...
Diffstat (limited to 'Source/cmXCodeObject.h')
-rw-r--r-- | Source/cmXCodeObject.h | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index b89f78c..ed2940a 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -30,20 +30,20 @@ public: PBXCopyFilesBuildPhase, None }; - class StringVec: public std::vector<cmStdString> {}; + class StringVec: public std::vector<std::string> {}; static const char* PBXTypeNames[]; virtual ~cmXCodeObject(); cmXCodeObject(PBXType ptype, Type type); Type GetType() { return this->TypeValue;} PBXType GetIsA() { return this->IsA;} - void SetString(const char* s); - const char* GetString() + void SetString(const std::string& s); + const std::string& GetString() { - return this->String.c_str(); + return this->String; } - void AddAttribute(const char* name, cmXCodeObject* value) + void AddAttribute(const std::string& name, cmXCodeObject* value) { this->ObjectAttributes[name] = value; } @@ -79,11 +79,11 @@ public: static void PrintList(std::vector<cmXCodeObject*> const&, std::ostream& out); - const char* GetId() + const std::string& GetId() { - return this->Id.c_str(); + return this->Id; } - void SetId(const char* id) + void SetId(const std::string& id) { this->Id = id; } @@ -95,8 +95,8 @@ public: { this->Target = t; } - const char* GetComment() {return this->Comment.c_str();} - bool HasComment() { return (this->Comment.size() != 0);} + const std::string& GetComment() {return this->Comment;} + bool HasComment() { return (!this->Comment.empty());} cmXCodeObject* GetObject(const char* name) { if(this->ObjectAttributes.count(name)) @@ -122,49 +122,41 @@ public: void CopyAttributes(cmXCodeObject* ); - void AddDependLibrary(const char* configName, - const char* l) + void AddDependLibrary(const std::string& configName, + const std::string& l) { - if(!configName) - { - configName = ""; - } this->DependLibraries[configName].push_back(l); } - std::map<cmStdString, StringVec> const& GetDependLibraries() + std::map<std::string, StringVec> const& GetDependLibraries() { return this->DependLibraries; } - void AddDependTarget(const char* configName, - const char* tName) + void AddDependTarget(const std::string& configName, + const std::string& tName) { - if(!configName) - { - configName = ""; - } this->DependTargets[configName].push_back(tName); } - std::map<cmStdString, StringVec> const& GetDependTargets() + std::map<std::string, StringVec> const& GetDependTargets() { return this->DependTargets; } std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;} - void SetComment(const char* c) { this->Comment = c;} - static void PrintString(std::ostream& os,cmStdString String); + void SetComment(const std::string& c) { this->Comment = c;} + static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; cmTarget* Target; Type TypeValue; - cmStdString Id; + std::string Id; PBXType IsA; int Version; - cmStdString Comment; - cmStdString String; + std::string Comment; + std::string String; cmXCodeObject* Object; std::vector<cmXCodeObject*> List; - std::map<cmStdString, StringVec> DependLibraries; - std::map<cmStdString, StringVec> DependTargets; - std::map<cmStdString, cmXCodeObject*> ObjectAttributes; + std::map<std::string, StringVec> DependLibraries; + std::map<std::string, StringVec> DependTargets; + std::map<std::string, cmXCodeObject*> ObjectAttributes; }; #endif |