diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-13 17:30:00 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-13 17:32:17 (GMT) |
commit | 60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14 (patch) | |
tree | 575fad8fdaf9dd42c0d88785a5aa6b361406fe80 /Source/cmPropertyMap.cxx | |
parent | 3766633b8a49cb24f4849721bb22a0feb9ba1f60 (diff) | |
download | CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.zip CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.tar.gz CMake-60f57d0dccb18bfcb37e6bd0c6496cc2e7996d14.tar.bz2 |
cmPropertyMap: Introduce cmProp as return type for GetProperty() functions
Currently properties are usually stored internally as `std::string`.
However, family of GetProperty() functions return them as `const char *` using `c_str()`.
The proposed `cmProp`, typedef'ed as `const std::string *` will expose properties
more naturally.
Diffstat (limited to 'Source/cmPropertyMap.cxx')
-rw-r--r-- | Source/cmPropertyMap.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index d4b3552..f22f36d 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -42,13 +42,11 @@ void cmPropertyMap::RemoveProperty(const std::string& name) Map_.erase(name); } -const char* cmPropertyMap::GetPropertyValue(const std::string& name) const +cmProp cmPropertyMap::GetPropertyValue(const std::string& name) const { - { - auto it = Map_.find(name); - if (it != Map_.end()) { - return it->second.c_str(); - } + auto it = Map_.find(name); + if (it != Map_.end()) { + return &it->second; } return nullptr; } |