summaryrefslogtreecommitdiffstats
path: root/Source/cmCacheManager.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2020-01-06 05:00:00 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2020-01-06 05:26:28 (GMT)
commit93e9d10c7ff39f5305109bcd018e8582a7587c1b (patch)
tree90fc3be45b969dabac8b32bd24801e428b29c44d /Source/cmCacheManager.cxx
parent3f8be0ad6678ddd5ed42992fc0253740eddc9ec2 (diff)
downloadCMake-93e9d10c7ff39f5305109bcd018e8582a7587c1b.zip
CMake-93e9d10c7ff39f5305109bcd018e8582a7587c1b.tar.gz
CMake-93e9d10c7ff39f5305109bcd018e8582a7587c1b.tar.bz2
cmCacheManager: more members use std::string
Diffstat (limited to 'Source/cmCacheManager.cxx')
-rw-r--r--Source/cmCacheManager.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index e3536d5..265941a 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -190,7 +190,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey,
if (entryKey.size() > plen && *(end - plen) == '-' &&
strcmp(end - plen + 1, *p) == 0) {
std::string key = entryKey.substr(0, entryKey.size() - plen);
- cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
+ cmCacheManager::CacheIterator it = this->GetCacheIterator(key);
if (it.IsAtEnd()) {
// Create an entry and store the property.
CacheEntry& ne = this->Cache[key];
@@ -497,9 +497,15 @@ cmCacheManager::CacheEntry* cmCacheManager::GetCacheEntry(
return nullptr;
}
-cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(const char* key)
+cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
+ const std::string& key)
{
- return { *this, key };
+ return { *this, key.c_str() };
+}
+
+cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator()
+{
+ return { *this, nullptr };
}
const std::string* cmCacheManager::GetInitializedCacheValue(
@@ -638,20 +644,21 @@ void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
}
void cmCacheManager::CacheEntry::AppendProperty(const std::string& prop,
- const char* value,
+ const std::string& value,
bool asString)
{
if (prop == "TYPE") {
- this->Type = cmState::StringToCacheEntryType(value ? value : "STRING");
+ this->Type = cmState::StringToCacheEntryType(!value.empty() ? value.c_str()
+ : "STRING");
} else if (prop == "VALUE") {
- if (value) {
- if (!this->Value.empty() && *value && !asString) {
+ if (!value.empty()) {
+ if (!this->Value.empty() && !asString) {
this->Value += ";";
}
this->Value += value;
}
} else {
- this->Properties.AppendProperty(prop, value, asString);
+ this->Properties.AppendProperty(prop, value.c_str(), asString);
}
}
@@ -673,7 +680,7 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p,
}
void cmCacheManager::CacheIterator::AppendProperty(const std::string& p,
- const char* v,
+ const std::string& v,
bool asString)
{
if (!this->IsAtEnd()) {