diff options
author | Brad King <brad.king@kitware.com> | 2015-04-13 15:45:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-13 15:45:02 (GMT) |
commit | 62c5e6f1a19df0043a0e9aaba6cf7247f76a5cc3 (patch) | |
tree | 8ca950377efbfd2cf90c7fe61eb7ff566a121d5e /Source/CursesDialog | |
parent | 92d61798937e42ecb7ae3d1be8b2b4ab7ce15fcb (diff) | |
parent | f081c5bdddcfcaaf5bee7b918fe5c7ff01faae35 (diff) | |
download | CMake-62c5e6f1a19df0043a0e9aaba6cf7247f76a5cc3.zip CMake-62c5e6f1a19df0043a0e9aaba6cf7247f76a5cc3.tar.gz CMake-62c5e6f1a19df0043a0e9aaba6cf7247f76a5cc3.tar.bz2 |
Merge topic 'introduce-cmState'
f081c5bd cmState: Move CacheEntryType enum from cmCacheManager.
f71fdf0e cmMakefile: Remove unused CacheManager accessor.
ff7169a0 Port to cmState.
a6b1ad13 Introduce cmState class.
Diffstat (limited to 'Source/CursesDialog')
-rw-r--r-- | Source/CursesDialog/ccmake.cxx | 1 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesBoolWidget.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 17 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.h | 1 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesDummyWidget.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesFilePathWidget.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 1 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 80 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.h | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesPathWidget.cxx | 4 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesStringWidget.cxx | 2 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesWidget.h | 6 |
13 files changed, 60 insertions, 62 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx index 3d92a2d..e013f81 100644 --- a/Source/CursesDialog/ccmake.cxx +++ b/Source/CursesDialog/ccmake.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmake.h" #include "../cmDocumentation.h" diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index fd15b99..29d9cb2 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -16,7 +16,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; + this->Type = cmState::BOOL; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 4f028c4..7e09242 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -19,6 +19,7 @@ #include "cmCursesDummyWidget.h" #include "../cmSystemTools.h" #include "../cmake.h" +#include "../cmState.h" #include <assert.h> @@ -50,11 +51,11 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } this->Entry = 0; - const char* value = cm->GetCacheManager()->GetCacheEntryValue(key); + const char* value = cm->GetState()->GetCacheEntryValue(key); assert(value); - switch (cm->GetCacheManager()->GetCacheEntryType(key)) + switch (cm->GetState()->GetCacheEntryType(key)) { - case cmCacheManager::BOOL: + case cmState::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); if (cmSystemTools::IsOn(value)) { @@ -65,17 +66,17 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(false); } break; - case cmCacheManager::PATH: + case cmState::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value); break; - case cmCacheManager::FILEPATH: + case cmState::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value); break; - case cmCacheManager::STRING: + case cmState::STRING: { - const char* stringsProp = cm->GetCacheManager() + const char* stringsProp = cm->GetState() ->GetCacheEntryProperty(key, "STRINGS"); if(stringsProp) { @@ -98,7 +99,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; } - case cmCacheManager::UNINITIALIZED: + case cmState::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", key.c_str()); break; diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h index dc4ee4af..f280897 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.h +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h @@ -12,7 +12,6 @@ #ifndef cmCursesCacheEntryComposite_h #define cmCursesCacheEntryComposite_h -#include "../cmCacheManager.h" #include "cmCursesLabelWidget.h" class cmCursesCacheEntryComposite diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 60086a5..9801e4d 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -15,7 +15,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::INTERNAL; + this->Type = cmState::INTERNAL; } diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 01db014..51ed670 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -15,6 +15,6 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { - this->Type = cmCacheManager::FILEPATH; + this->Type = cmState::FILEPATH; } diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 057f8f3..67e4aab 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmake.h" #include "../cmVersion.h" diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 833d540..be17a9f 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -9,7 +9,6 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "../cmCacheManager.h" #include "../cmSystemTools.h" #include "../cmVersion.h" #include "../cmake.h" @@ -23,6 +22,7 @@ #include "cmCursesCacheEntryComposite.h" #include "cmCursesLongMessageForm.h" #include "cmAlgorithms.h" +#include "cmState.h" inline int ctrl(int z) @@ -107,21 +107,21 @@ void cmCursesMainForm::InitializeUI() // which contain labels, entries and new entry markers std::vector<cmCursesCacheEntryComposite*>* newEntries = new std::vector<cmCursesCacheEntryComposite*>; - newEntries->reserve(this->CMakeInstance->GetCacheManager()->GetSize()); + std::vector<std::string> cacheKeys = + this->CMakeInstance->GetState()->GetCacheEntryKeys(); + newEntries->reserve(cacheKeys.size()); // Count non-internal and non-static entries int count=0; - std::vector<std::string> cacheKeys = - this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys(); for(std::vector<std::string>::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t != cmCacheManager::INTERNAL && - t != cmCacheManager::STATIC && - t != cmCacheManager::UNINITIALIZED) + if (t != cmState::INTERNAL && + t != cmState::STATIC && + t != cmState::UNINITIALIZED) { ++count; } @@ -147,11 +147,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -171,11 +171,11 @@ void cmCursesMainForm::InitializeUI() it != cacheKeys.end(); ++it) { std::string key = *it; - cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager() + cmState::CacheEntryType t = this->CMakeInstance->GetState() ->GetCacheEntryType(*it); - if (t == cmCacheManager::INTERNAL || - t == cmCacheManager::STATIC || - t == cmCacheManager::UNINITIALIZED ) + if (t == cmState::INTERNAL || + t == cmState::STATIC || + t == cmState::UNINITIALIZED ) { continue; } @@ -225,10 +225,10 @@ void cmCursesMainForm::RePost() for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -257,10 +257,10 @@ void cmCursesMainForm::RePost() for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -293,9 +293,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) cmCursesWidget* cw = reinterpret_cast<cmCursesWidget*> (field_userptr(currentField)); // If in edit mode, get out of it - if ( cw->GetType() == cmCacheManager::STRING || - cw->GetType() == cmCacheManager::PATH || - cw->GetType() == cmCacheManager::FILEPATH ) + if ( cw->GetType() == cmState::STRING || + cw->GetType() == cmState::PATH || + cw->GetType() == cmState::FILEPATH ) { cmCursesStringWidget* sw = static_cast<cmCursesStringWidget*>(cw); sw->SetInEdit(false); @@ -329,10 +329,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -352,10 +352,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) for (it = this->Entries->begin(); it != this->Entries->end(); ++it) { const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue((*it)->GetValue()); bool advanced = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED"); if (!existingValue || (!this->AdvancedMode && advanced)) { @@ -516,10 +516,10 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Get the help string of the current entry // and add it to the help string const char* existingValue = - this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField); + this->CMakeInstance->GetState()->GetCacheEntryValue(curField); if (existingValue) { - const char* hs = this->CMakeInstance->GetCacheManager() + const char* hs = this->CMakeInstance->GetState() ->GetCacheEntryProperty(curField, "HELPSTRING"); if ( hs ) { @@ -814,7 +814,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() for(size_t i=0; i < size; i++) { std::string cacheKey = (*this->Entries)[i]->Key; - const char* existingValue = this->CMakeInstance->GetCacheManager() + const char* existingValue = this->CMakeInstance->GetState() ->GetCacheEntryValue(cacheKey); if (existingValue) { @@ -822,8 +822,8 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmCacheManager::CacheEntryType t = - this->CMakeInstance->GetCacheManager() + cmState::CacheEntryType t = + this->CMakeInstance->GetState() ->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); this->FixValue(t, newValue, fixedNewValue); @@ -831,24 +831,24 @@ void cmCursesMainForm::FillCacheManagerFromUI() if(!(fixedOldValue == fixedNewValue)) { // The user has changed the value. Mark it as modified. - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true); - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->SetCacheEntryValue(cacheKey, fixedNewValue); } } } } -void cmCursesMainForm::FixValue(cmCacheManager::CacheEntryType type, +void cmCursesMainForm::FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const { out = in.substr(0,in.find_last_not_of(" ")+1); - if(type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH) + if(type == cmState::PATH || type == cmState::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } - if(type == cmCacheManager::BOOL) + if(type == cmState::BOOL) { if(cmSystemTools::IsOff(out.c_str())) { @@ -1046,11 +1046,11 @@ void cmCursesMainForm::HandleInput() const char* helpString = 0; const char* existingValue = - this->CMakeInstance->GetCacheManager() + this->CMakeInstance->GetState() ->GetCacheEntryValue(curField); if (existingValue) { - helpString = this->CMakeInstance->GetCacheManager() + helpString = this->CMakeInstance->GetState() ->GetCacheEntryProperty(curField, "HELPSTRING"); } if (helpString) @@ -1161,7 +1161,7 @@ void cmCursesMainForm::HandleInput() field_userptr(this->Fields[findex-2])); if ( lbl ) { - this->CMakeInstance->GetCacheManager()->RemoveCacheEntry(lbl->GetValue()); + this->CMakeInstance->GetState()->RemoveCacheEntry(lbl->GetValue()); std::string nextVal; if (nextCur) diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 6455252..255c823 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -113,7 +113,7 @@ protected: // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmCacheManager::CacheEntryType type, + void FixValue(cmState::CacheEntryType type, const std::string& in, std::string& out) const; // Re-post the existing fields. Used to toggle between // normal and advanced modes. Render() should be called diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 2f4b59e..30110a4 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -21,7 +21,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmCacheManager::BOOL; // this is a bit of a hack + this->Type = cmState::BOOL; // this is a bit of a hack // there is no option type, and string type causes ccmake to cast // the widget into a string widget at some point. BOOL is safe for // now. diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 89e2238..6116823 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -18,7 +18,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { - this->Type = cmCacheManager::PATH; + this->Type = cmState::PATH; this->Cycle = false; this->CurrentIndex = 0; } @@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } std::vector<std::string> dirs; - cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0)); + cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmState::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) { cstr = dirs[this->CurrentIndex]; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index d25022d..acf262f 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -22,7 +22,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, cmCursesWidget(width, height, left, top) { this->InEdit = false; - this->Type = cmCacheManager::STRING; + this->Type = cmState::STRING; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 7d82864..7bbdff1 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -12,7 +12,7 @@ #ifndef cmCursesWidget_h #define cmCursesWidget_h -#include "../cmCacheManager.h" +#include "../cmState.h" #include "cmCursesStandardIncludes.h" class cmCursesMainForm; @@ -46,7 +46,7 @@ public: /** * Get the type of the widget (STRING, PATH etc...) */ - cmCacheManager::CacheEntryType GetType() + cmState::CacheEntryType GetType() { return this->Type; } /** @@ -77,7 +77,7 @@ protected: cmCursesWidget(const cmCursesWidget& from); void operator=(const cmCursesWidget&); - cmCacheManager::CacheEntryType Type; + cmState::CacheEntryType Type; std::string Value; FIELD* Field; // The page in the main form this widget is in |