diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-07 20:45:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-13 15:44:16 (GMT) |
commit | f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35 (patch) | |
tree | a2aad443ecfe835aaa3eaa1d4dd95fc34d94f59f /Source/cmState.cxx | |
parent | f71fdf0ec8289ada5b32b784bc2f6f617538ce0b (diff) | |
download | CMake-f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35.zip CMake-f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35.tar.gz CMake-f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35.tar.bz2 |
cmState: Move CacheEntryType enum from cmCacheManager.
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r-- | Source/cmState.cxx | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f5e3752..7602f63 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -12,26 +12,59 @@ #include "cmState.h" #include "cmake.h" +#include "cmCacheManager.h" cmState::cmState(cmake* cm) : CMakeInstance(cm) { } -cmCacheManager::CacheEntryType -cmState::StringToCacheEntryType(const char* s) + +const char* cmCacheEntryTypes[] = +{ "BOOL", + "PATH", + "FILEPATH", + "STRING", + "INTERNAL", + "STATIC", + "UNINITIALIZED", + 0 +}; + +const char* +cmState::CacheEntryTypeToString(cmState::CacheEntryType type) { - return cmCacheManager::StringToType(s); + if ( type > 6 ) + { + return cmCacheEntryTypes[6]; + } + return cmCacheEntryTypes[type]; } -const char* -cmState::CacheEntryTypeToString(cmCacheManager::CacheEntryType t) +cmState::CacheEntryType +cmState::StringToCacheEntryType(const char* s) { - return cmCacheManager::TypeToString(t); + int i = 0; + while(cmCacheEntryTypes[i]) + { + if(strcmp(s, cmCacheEntryTypes[i]) == 0) + { + return static_cast<cmState::CacheEntryType>(i); + } + ++i; + } + return STRING; } bool cmState::IsCacheEntryType(std::string const& key) { - return cmCacheManager::IsType(key.c_str()); + for(int i=0; cmCacheEntryTypes[i]; ++i) + { + if(strcmp(key.c_str(), cmCacheEntryTypes[i]) == 0) + { + return true; + } + } + return false; } std::vector<std::string> cmState::GetCacheEntryKeys() const @@ -64,7 +97,7 @@ cmState::GetInitializedCacheValue(std::string const& key) const return this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue(key); } -cmCacheManager::CacheEntryType +cmState::CacheEntryType cmState::GetCacheEntryType(std::string const& key) const { cmCacheManager::CacheIterator it = @@ -117,7 +150,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, void cmState::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmCacheManager::CacheEntryType type) + cmState::CacheEntryType type) { this->CMakeInstance->GetCacheManager()->AddCacheEntry(key, value, helpString, type); |