Merge topic 'expose-cache-properties'
63c0e92c
cmState: Expose list of properties of values in the cache6eee2463
cmCacheEntry: Retrieve all properties of cache entries120899c6
cmPropertyList: Add a way to retrieve all properties7066218e
cmake: Kill cmake::CacheManager and its getter
This commit is contained in:
commit
473634eb1c
|
@ -540,6 +540,11 @@ void cmCacheManager::CacheIterator::Next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> cmCacheManager::CacheIterator::GetPropertyList() const
|
||||||
|
{
|
||||||
|
return this->GetEntry().GetPropertyList();
|
||||||
|
}
|
||||||
|
|
||||||
void cmCacheManager::CacheIterator::SetValue(const char* value)
|
void cmCacheManager::CacheIterator::SetValue(const char* value)
|
||||||
{
|
{
|
||||||
if (this->IsAtEnd()) {
|
if (this->IsAtEnd()) {
|
||||||
|
@ -559,6 +564,11 @@ bool cmCacheManager::CacheIterator::GetValueAsBool() const
|
||||||
return cmSystemTools::IsOn(this->GetEntry().Value.c_str());
|
return cmSystemTools::IsOn(this->GetEntry().Value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
|
||||||
|
{
|
||||||
|
return this->Properties.GetPropertyList();
|
||||||
|
}
|
||||||
|
|
||||||
const char* cmCacheManager::CacheEntry::GetProperty(
|
const char* cmCacheManager::CacheEntry::GetProperty(
|
||||||
const std::string& prop) const
|
const std::string& prop) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@ private:
|
||||||
std::string Value;
|
std::string Value;
|
||||||
cmState::CacheEntryType Type;
|
cmState::CacheEntryType Type;
|
||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
|
std::vector<std::string> GetPropertyList() const;
|
||||||
const char* GetProperty(const std::string&) const;
|
const char* GetProperty(const std::string&) const;
|
||||||
void SetProperty(const std::string& property, const char* value);
|
void SetProperty(const std::string& property, const char* value);
|
||||||
void AppendProperty(const std::string& property, const char* value,
|
void AppendProperty(const std::string& property, const char* value,
|
||||||
|
@ -60,6 +61,7 @@ public:
|
||||||
bool IsAtEnd() const;
|
bool IsAtEnd() const;
|
||||||
void Next();
|
void Next();
|
||||||
std::string GetName() const { return this->Position->first; }
|
std::string GetName() const { return this->Position->first; }
|
||||||
|
std::vector<std::string> GetPropertyList() const;
|
||||||
const char* GetProperty(const std::string&) const;
|
const char* GetProperty(const std::string&) const;
|
||||||
bool GetPropertyAsBool(const std::string&) const;
|
bool GetPropertyAsBool(const std::string&) const;
|
||||||
bool PropertyExists(const std::string&) const;
|
bool PropertyExists(const std::string&) const;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
|
cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
|
||||||
|
@ -29,6 +30,17 @@ cmProperty* cmPropertyMap::GetOrCreateProperty(const std::string& name)
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> cmPropertyMap::GetPropertyList() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> keyList;
|
||||||
|
for (cmPropertyMap::const_iterator i = this->begin(), e = this->end();
|
||||||
|
i != e; ++i) {
|
||||||
|
keyList.push_back(i->first);
|
||||||
|
}
|
||||||
|
std::sort(keyList.begin(), keyList.end());
|
||||||
|
return keyList;
|
||||||
|
}
|
||||||
|
|
||||||
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
|
void cmPropertyMap::SetProperty(const std::string& name, const char* value)
|
||||||
{
|
{
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
|
|
@ -19,6 +19,8 @@ class cmPropertyMap : public std::map<std::string, cmProperty>
|
||||||
public:
|
public:
|
||||||
cmProperty* GetOrCreateProperty(const std::string& name);
|
cmProperty* GetOrCreateProperty(const std::string& name);
|
||||||
|
|
||||||
|
std::vector<std::string> GetPropertyList() const;
|
||||||
|
|
||||||
void SetProperty(const std::string& name, const char* value);
|
void SetProperty(const std::string& name, const char* value);
|
||||||
|
|
||||||
void AppendProperty(const std::string& name, const char* value,
|
void AppendProperty(const std::string& name, const char* value,
|
||||||
|
|
|
@ -246,6 +246,14 @@ void cmState::SetCacheEntryBoolProperty(std::string const& key,
|
||||||
it.SetProperty(propertyName, value);
|
it.SetProperty(propertyName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> cmState::GetCacheEntryPropertyList(
|
||||||
|
const std::string& key)
|
||||||
|
{
|
||||||
|
cmCacheManager::CacheIterator it =
|
||||||
|
this->CacheManager->GetCacheIterator(key.c_str());
|
||||||
|
return it.GetPropertyList();
|
||||||
|
}
|
||||||
|
|
||||||
const char* cmState::GetCacheEntryProperty(std::string const& key,
|
const char* cmState::GetCacheEntryProperty(std::string const& key,
|
||||||
std::string const& propertyName)
|
std::string const& propertyName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -247,6 +247,7 @@ public:
|
||||||
std::string const& value);
|
std::string const& value);
|
||||||
void SetCacheEntryBoolProperty(std::string const& key,
|
void SetCacheEntryBoolProperty(std::string const& key,
|
||||||
std::string const& propertyName, bool value);
|
std::string const& propertyName, bool value);
|
||||||
|
std::vector<std::string> GetCacheEntryPropertyList(std::string const& key);
|
||||||
const char* GetCacheEntryProperty(std::string const& key,
|
const char* GetCacheEntryProperty(std::string const& key,
|
||||||
std::string const& propertyName);
|
std::string const& propertyName);
|
||||||
bool GetCacheEntryPropertyAsBool(std::string const& key,
|
bool GetCacheEntryPropertyAsBool(std::string const& key,
|
||||||
|
|
|
@ -209,9 +209,6 @@ public:
|
||||||
return this->GeneratorToolset;
|
return this->GeneratorToolset;
|
||||||
}
|
}
|
||||||
|
|
||||||
///! get the cmCachemManager used by this invocation of cmake
|
|
||||||
cmCacheManager* GetCacheManager() { return this->CacheManager; }
|
|
||||||
|
|
||||||
const std::vector<std::string>& GetSourceExtensions() const
|
const std::vector<std::string>& GetSourceExtensions() const
|
||||||
{
|
{
|
||||||
return this->SourceFileExtensions;
|
return this->SourceFileExtensions;
|
||||||
|
@ -423,7 +420,6 @@ protected:
|
||||||
CreateExtraGeneratorFunctionType newFunction);
|
CreateExtraGeneratorFunctionType newFunction);
|
||||||
|
|
||||||
cmGlobalGenerator* GlobalGenerator;
|
cmGlobalGenerator* GlobalGenerator;
|
||||||
cmCacheManager* CacheManager;
|
|
||||||
std::map<std::string, DiagLevel> DiagLevels;
|
std::map<std::string, DiagLevel> DiagLevels;
|
||||||
std::string GeneratorPlatform;
|
std::string GeneratorPlatform;
|
||||||
std::string GeneratorToolset;
|
std::string GeneratorToolset;
|
||||||
|
|
Loading…
Reference in New Issue