[Cmake-commits] CMake branch, next, updated. v3.2.1-1606-gbf53173

Stephen Kelly steveire at gmail.com
Wed Apr 8 02:55:55 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  bf53173a0d19d025fe21e53091a2efe6b1c62a21 (commit)
       via  a580ee87517d40cd835df07be5f7618001c35e9e (commit)
       via  7a5c285e30a7cc5f1389c69fab79085c90443fcb (commit)
       via  51890a7e0718c675c064520bb9fdf5710a062ef5 (commit)
       via  9d97c4da28d5ebde5d5c47aadec826367eebd238 (commit)
       via  0b325419d12bbb51a3125f19d18302b49f0dc5c3 (commit)
       via  77f2807ce56491fab7637327564c7fb1033dadb1 (commit)
       via  14973054a2f3954111789cda5e54c2e2e2175521 (commit)
       via  1f2c12ebd196f3d23aa40d85c965654dbc36d0ad (commit)
       via  97c50a8dbd9f1ca5026f60e4a224e9a087e01f0e (commit)
      from  277b21a95f7a895adca29963fe9d619aac33f611 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf53173a0d19d025fe21e53091a2efe6b1c62a21
commit bf53173a0d19d025fe21e53091a2efe6b1c62a21
Merge: 277b21a a580ee8
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 8 02:55:51 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Apr 8 02:55:51 2015 -0400

    Merge topic 'refactor-cache-api' into next
    
    a580ee87 cmCacheManager: Port consumers to non-iterator API.
    7a5c285e Port QtDialog to non-iterator cache API.
    51890a7e Port CursesDialog to non-iterator cache API.
    9d97c4da cmMakefile: Port away from CacheEntry.Initialized.
    0b325419 cmCacheManager: Add non-iterator-based API.
    77f2807c cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
    14973054 Add API for cache loading, deleting and saving to the cmake class.
    1f2c12eb cmMakefile: Remove cache version accessors.
    97c50a8d cmMakefile: Simplify GetDefinitions implementation.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a580ee87517d40cd835df07be5f7618001c35e9e
commit a580ee87517d40cd835df07be5f7618001c35e9e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 5 10:48:04 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 8 01:09:02 2015 +0200

    cmCacheManager: Port consumers to non-iterator API.
    
    This simplifies reasoning about the follow-up commit which ports
    away from cmCacheManager to a class with the same method names.

diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index f63df61..cc08052 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -366,18 +366,18 @@ bool cmFindBase::CheckForVariableInCache()
   if(const char* cacheValue =
      this->Makefile->GetDefinition(this->VariableName))
     {
-    cmCacheManager::CacheIterator it =
-      this->Makefile->GetCacheManager()->
-      GetCacheIterator(this->VariableName.c_str());
+    cmCacheManager* manager = this->Makefile->GetCacheManager();
+    const char* cacheEntry = manager->GetCacheEntryValue(this->VariableName);
     bool found = !cmSystemTools::IsNOTFOUND(cacheValue);
-    bool cached = !it.IsAtEnd();
+    bool cached = cacheEntry ? true : false;
     if(found)
       {
       // If the user specifies the entry on the command line without a
       // type we should add the type and docstring but keep the
       // original value.  Tell the subclass implementations to do
       // this.
-      if(cached && it.GetType() == cmCacheManager::UNINITIALIZED)
+      if(cached && manager->GetCacheEntryType(this->VariableName)
+                                            == cmCacheManager::UNINITIALIZED)
         {
         this->AlreadyInCacheWithoutMetaInfo = true;
         }
@@ -385,7 +385,8 @@ bool cmFindBase::CheckForVariableInCache()
       }
     else if(cached)
       {
-      const char* hs = it.GetProperty("HELPSTRING");
+      const char* hs = manager->GetCacheEntryProperty(this->VariableName,
+                                                     "HELPSTRING");
       this->VariableDocumentation = hs?hs:"(none)";
       }
     }
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index f0b2686..0e6e0c2 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -391,11 +391,10 @@ bool cmGetPropertyCommand::HandleCacheMode()
     }
 
   const char* value = 0;
-  cmCacheManager::CacheIterator it =
-    this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str());
-  if(!it.IsAtEnd())
+  if(this->Makefile->GetCacheManager()->GetCacheEntryValue(this->Name))
     {
-    value = it.GetProperty(this->PropertyName);
+    value = this->Makefile->GetCacheManager()
+                ->GetCacheEntryProperty(this->Name, this->PropertyName);
     }
   this->StoreResult(value);
   return true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f23caa6..35394b8 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1559,9 +1559,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
            cmSystemTools::IsNOTFOUND(lib->first.c_str()))
           {
           std::string varName = lib->first.substr(0, lib->first.size()-9);
-          cmCacheManager::CacheIterator it =
-            manager->GetCacheIterator(varName.c_str());
-          if(it.GetPropertyAsBool("ADVANCED"))
+          if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
             {
             varName += " (ADVANCED)";
             }
@@ -1592,9 +1590,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
             cmSystemTools::IsNOTFOUND(incDir->c_str()))
           {
           std::string varName = incDir->substr(0, incDir->size()-9);
-          cmCacheManager::CacheIterator it =
-            manager->GetCacheIterator(varName.c_str());
-          if(it.GetPropertyAsBool("ADVANCED"))
+          if(manager->GetCacheEntryPropertyAsBool(varName, "ADVANCED"))
             {
             varName += " (ADVANCED)";
             }
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7c1b9c4..34b4621 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1848,8 +1848,8 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
       }
 
     }
-  this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0, doc,
-                                         type);
+  this->GetCacheManager()->AddCacheEntry(name, haveVal ? val.c_str() : 0,
+                                         doc, type);
   // if there was a definition then remove it
   this->Internal->VarStack.top().Set(name, 0);
 }
@@ -2499,12 +2499,10 @@ std::vector<std::string> cmMakefile
         this->Internal->VarStack.top().ClosureKeys();
     res.insert(res.end(), definitions.begin(), definitions.end());
     }
-  cmCacheManager::CacheIterator cit =
-    this->GetCacheManager()->GetCacheIterator();
-  for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
-    {
-    res.push_back(cit.GetName());
-    }
+  std::vector<std::string> cacheKeys =
+      this->GetCacheManager()->GetCacheEntryKeys();
+  res.insert(res.end(), cacheKeys.begin(), cacheKeys.end());
+
   std::sort(res.begin(), res.end());
   return res;
 }
diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx
index f6a2c26..cc094b1 100644
--- a/Source/cmMarkAsAdvancedCommand.cxx
+++ b/Source/cmMarkAsAdvancedCommand.cxx
@@ -37,24 +37,19 @@ bool cmMarkAsAdvancedCommand
     {
     std::string variable = args[i];
     cmCacheManager* manager = this->Makefile->GetCacheManager();
-    cmCacheManager::CacheIterator it =
-      manager->GetCacheIterator(variable.c_str());
-    if ( it.IsAtEnd() )
+    if (!manager->GetCacheEntryValue(variable))
       {
-      this->Makefile->GetCacheManager()
-        ->AddCacheEntry(variable, 0, 0,
-          cmCacheManager::UNINITIALIZED);
+      manager->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED);
       overwrite = true;
       }
-    it.Find(variable);
-    if ( it.IsAtEnd() )
+    if (!manager->GetCacheEntryValue(variable))
       {
       cmSystemTools::Error("This should never happen...");
       return false;
       }
-    if ( !it.PropertyExists("ADVANCED") || overwrite )
+    if (!manager->GetCacheEntryProperty(variable, "ADVANCED") || overwrite)
       {
-      it.SetProperty("ADVANCED", value);
+      manager->SetCacheEntryProperty(variable, "ADVANCED", value);
       }
     }
   return true;
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index 60728ea..baf5b1e 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -42,16 +42,16 @@ bool cmOptionCommand
   std::string initialValue = "Off";
   // Now check and see if the value has been stored in the cache
   // already, if so use that value and don't look for the program
-  cmCacheManager::CacheIterator it =
-    this->Makefile->GetCacheManager()->GetCacheIterator(args[0].c_str());
-  if(!it.IsAtEnd())
+  cmCacheManager* manager = this->Makefile->GetCacheManager();
+  const char* existingValue = manager->GetCacheEntryValue(args[0]);
+  if(existingValue)
     {
-    if ( it.GetType() != cmCacheManager::UNINITIALIZED )
+    if (manager->GetCacheEntryType(args[0]) != cmCacheManager::UNINITIALIZED)
       {
-      it.SetProperty("HELPSTRING", args[1].c_str());
+      manager->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]);
       return true;
       }
-    initialValue = it.GetValue();
+    initialValue = existingValue;
     }
   if(args.size() == 3)
     {
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 204d95b..e17474b 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -136,9 +136,10 @@ bool cmSetCommand
     }
 
   // see if this is already in the cache
-  cmCacheManager::CacheIterator it =
-    this->Makefile->GetCacheManager()->GetCacheIterator(variable);
-  if(!it.IsAtEnd() && (it.GetType() != cmCacheManager::UNINITIALIZED))
+  cmCacheManager* manager = this->Makefile->GetCacheManager();
+  const char* existingValue = manager->GetCacheEntryValue(variable);
+  if(existingValue &&
+      (manager->GetCacheEntryType(variable) != cmCacheManager::UNINITIALIZED))
     {
     // if the set is trying to CACHE the value but the value
     // is already in the cache and the type is not internal
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 1150bc7..77f9fb9 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -452,11 +452,11 @@ bool cmSetPropertyCommand::HandleCacheMode()
     // Get the source file.
     cmMakefile* mf = this->GetMakefile();
     cmake* cm = mf->GetCMakeInstance();
-    cmCacheManager::CacheIterator it =
-      cm->GetCacheManager()->GetCacheIterator(ni->c_str());
-    if(!it.IsAtEnd())
+    const char* existingValue
+                          = cm->GetCacheManager()->GetCacheEntryValue(*ni);
+    if(existingValue)
       {
-      if(!this->HandleCacheEntry(it))
+      if(!this->HandleCacheEntry(*ni))
         {
         return false;
         }
@@ -474,22 +474,25 @@ bool cmSetPropertyCommand::HandleCacheMode()
 }
 
 //----------------------------------------------------------------------------
-bool cmSetPropertyCommand::HandleCacheEntry(cmCacheManager::CacheIterator& it)
+bool cmSetPropertyCommand::HandleCacheEntry(std::string const& cacheKey)
 {
   // Set or append the property.
   const char* name = this->PropertyName.c_str();
   const char* value = this->PropertyValue.c_str();
+  cmCacheManager* manager = this->Makefile->GetCacheManager();
   if (this->Remove)
     {
-    value = 0;
+    manager->RemoveCacheEntryProperty(cacheKey, name);
+    return true;
     }
   if(this->AppendMode)
     {
-    it.AppendProperty(name, value, this->AppendAsString);
+    manager->AppendCacheEntryProperty(cacheKey, name, value,
+                                      this->AppendAsString);
     }
   else
     {
-    it.SetProperty(name, value);
+    manager->SetCacheEntryProperty(cacheKey, name, value);
     }
 
   return true;
diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h
index b06cb68..3285e60 100644
--- a/Source/cmSetPropertyCommand.h
+++ b/Source/cmSetPropertyCommand.h
@@ -61,7 +61,7 @@ private:
   bool HandleTestMode();
   bool HandleTest(cmTest* test);
   bool HandleCacheMode();
-  bool HandleCacheEntry(cmCacheManager::CacheIterator&);
+  bool HandleCacheEntry(std::string const&);
   bool HandleInstallMode();
   bool HandleInstall(cmInstalledFile* file);
 };
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index b5280cf..911ade8 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -264,11 +264,12 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
                                        comment.c_str(),
                                        cmCacheManager::STRING);
 
-    cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
-                             GetCacheIterator(this->RunResultVariable.c_str());
-    if ( !it.IsAtEnd() )
+    cmCacheManager* manager = this->Makefile->GetCacheManager();
+    const char* existingValue
+                      = manager->GetCacheEntryValue(this->RunResultVariable);
+    if (existingValue)
       {
-      it.SetProperty("ADVANCED", "1");
+      manager->SetCacheEntryProperty(this->RunResultVariable, "ADVANCED", "1");
       }
 
     error = true;
@@ -290,11 +291,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
                                          "PLEASE_FILL_OUT-NOTFOUND",
                                          comment.c_str(),
                                          cmCacheManager::STRING);
-      cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()->
-                               GetCacheIterator(internalRunOutputName.c_str());
-      if ( !it.IsAtEnd() )
+      cmCacheManager* manager = this->Makefile->GetCacheManager();
+      const char* existing =
+          manager->GetCacheEntryValue(internalRunOutputName);
+      if (existing)
         {
-        it.SetProperty("ADVANCED", "1");
+        manager->SetCacheEntryProperty(internalRunOutputName,
+                                       "ADVANCED", "1");
         }
 
       error = true;
diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx
index 80c1286..dd2a682 100644
--- a/Source/cmVariableRequiresCommand.cxx
+++ b/Source/cmVariableRequiresCommand.cxx
@@ -41,9 +41,9 @@ bool cmVariableRequiresCommand
       requirementsMet = false;
       notSet += args[i];
       notSet += "\n";
-      cmCacheManager::CacheIterator it =
-        this->Makefile->GetCacheManager()->GetCacheIterator(args[i].c_str());
-      if(!it.IsAtEnd() && it.GetPropertyAsBool("ADVANCED"))
+      cmCacheManager* manager = this->Makefile->GetCacheManager();
+      if(manager->GetCacheEntryValue(args[i]) &&
+          manager->GetCacheEntryPropertyAsBool(args[i], "ADVANCED"))
         {
         hasAdvanced = true;
         }
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 210c0ef..64b332c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -403,17 +403,18 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
       //go through all cache entries and collect the vars which will be removed
       std::vector<std::string> entriesToDelete;
-      cmCacheManager::CacheIterator it =
-                                    this->CacheManager->GetCacheIterator();
-      for ( it.Begin(); !it.IsAtEnd(); it.Next() )
+      std::vector<std::string> cacheKeys =
+          this->CacheManager->GetCacheEntryKeys();
+      for (std::vector<std::string>::const_iterator it = cacheKeys.begin();
+            it != cacheKeys.end(); ++it)
         {
-        cmCacheManager::CacheEntryType t = it.GetType();
+        cmCacheManager::CacheEntryType t =
+            this->CacheManager->GetCacheEntryType(*it);
         if(t != cmCacheManager::STATIC)
           {
-          std::string entryName = it.GetName();
-          if (regex.find(entryName.c_str()))
+          if (regex.find(it->c_str()))
             {
-            entriesToDelete.push_back(entryName);
+            entriesToDelete.push_back(*it);
             }
           }
         }
@@ -917,16 +918,18 @@ void cmake::SetDirectoriesFromFile(const char* arg)
   // If there is a CMakeCache.txt file, use its settings.
   if(!cachePath.empty())
     {
-    cmCacheManager* cachem = this->GetCacheManager();
-    cmCacheManager::CacheIterator it = cachem->NewIterator();
-    if(this->LoadCache(cachePath) &&
-      it.Find("CMAKE_HOME_DIRECTORY"))
+    if(this->LoadCache(cachePath))
       {
-      this->SetHomeOutputDirectory(cachePath);
-      this->SetStartOutputDirectory(cachePath);
-      this->SetHomeDirectory(it.GetValue());
-      this->SetStartDirectory(it.GetValue());
-      return;
+      const char* existingValue =
+          this->CacheManager->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
+      if (existingValue)
+        {
+        this->SetHomeOutputDirectory(cachePath);
+        this->SetStartOutputDirectory(cachePath);
+        this->SetHomeDirectory(existingValue);
+        this->SetStartDirectory(existingValue);
+        return;
+        }
       }
     }
 
@@ -1575,11 +1578,11 @@ int cmake::ActualConfigure()
       ("CMAKE_USE_RELATIVE_PATHS", "OFF",
        "If true, cmake will use relative paths in makefiles and projects.",
        cmCacheManager::BOOL);
-    cmCacheManager::CacheIterator it =
-      this->CacheManager->GetCacheIterator("CMAKE_USE_RELATIVE_PATHS");
-    if ( !it.PropertyExists("ADVANCED") )
+    if (!this->CacheManager->GetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
+                                                   "ADVANCED"))
       {
-      it.SetProperty("ADVANCED", "1");
+      this->CacheManager->SetCacheEntryProperty("CMAKE_USE_RELATIVE_PATHS",
+                                                  "ADVANCED", "1");
       }
     }
 
@@ -2314,17 +2317,9 @@ const char *cmake::GetProperty(const std::string& prop,
   std::string output = "";
   if ( prop == "CACHE_VARIABLES" )
     {
-    cmCacheManager::CacheIterator cit =
-      this->GetCacheManager()->GetCacheIterator();
-    for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
-      {
-      if (!output.empty())
-        {
-        output += ";";
-        }
-      output += cit.GetName();
-      }
-    this->SetProperty("CACHE_VARIABLES", output.c_str());
+    std::vector<std::string> cacheKeys =
+        this->CacheManager->GetCacheEntryKeys();
+    this->SetProperty("CACHE_VARIABLES", cmJoin(cacheKeys, ";").c_str());
     }
   else if ( prop == "COMMANDS" )
     {
@@ -2686,9 +2681,9 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
     if(t == cmake::AUTHOR_WARNING)
       {
       // Allow suppression of these warnings.
-      cmCacheManager::CacheIterator it = this->CacheManager
-        ->GetCacheIterator("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
-      if(!it.IsAtEnd() && it.GetValueAsBool())
+      const char* suppress = this->CacheManager->GetCacheEntryValue(
+                                        "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+      if(suppress && cmSystemTools::IsOn(suppress))
         {
         return;
         }
@@ -2801,37 +2796,42 @@ int cmake::Build(const std::string& dir,
     }
   std::string cachePath = dir;
   cmSystemTools::ConvertToUnixSlashes(cachePath);
-  cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator();
   if(!this->LoadCache(cachePath))
     {
     std::cerr << "Error: could not load cache\n";
     return 1;
     }
-  if(!it.Find("CMAKE_GENERATOR"))
+  const char* cachedGenerator =
+      this->CacheManager->GetCacheEntryValue("CMAKE_GENERATOR");
+  if(!cachedGenerator)
     {
     std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
     return 1;
     }
   cmsys::auto_ptr<cmGlobalGenerator> gen(
-    this->CreateGlobalGenerator(it.GetValue()));
+    this->CreateGlobalGenerator(cachedGenerator));
   if(!gen.get())
     {
     std::cerr << "Error: could create CMAKE_GENERATOR \""
-              << it.GetValue() << "\"\n";
+              << cachedGenerator << "\"\n";
     return 1;
     }
   std::string output;
   std::string projName;
-  if(!it.Find("CMAKE_PROJECT_NAME"))
+  const char* cachedProjectName =
+      this->CacheManager->GetCacheEntryValue("CMAKE_PROJECT_NAME");
+  if(!cachedProjectName)
     {
     std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
     return 1;
     }
-  projName = it.GetValue();
+  projName = cachedProjectName;
   bool verbose = false;
-  if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
+  const char* cachedVerbose =
+      this->CacheManager->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
+  if(cachedVerbose)
     {
-    verbose = it.GetValueAsBool();
+    verbose = cmSystemTools::IsOn(cachedVerbose);
     }
   return gen->Build("", dir,
                     projName, target,
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index ac73ad0..3b518be 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -328,25 +328,31 @@ int do_cmake(int ac, char const* const* av)
   int res = cm.Run(args, view_only);
   if ( list_cached || list_all_cached )
     {
-    cmCacheManager::CacheIterator it =
-      cm.GetCacheManager()->GetCacheIterator();
     std::cout << "-- Cache values" << std::endl;
-    for ( it.Begin(); !it.IsAtEnd(); it.Next() )
+    std::vector<std::string> keys =
+        cm.GetCacheManager()->GetCacheEntryKeys();
+    for (std::vector<std::string>::const_iterator it = keys.begin();
+        it != keys.end(); ++it)
       {
-      cmCacheManager::CacheEntryType t = it.GetType();
+      cmCacheManager::CacheEntryType t =
+          cm.GetCacheManager()->GetCacheEntryType(*it);
       if ( t != cmCacheManager::INTERNAL && t != cmCacheManager::STATIC &&
         t != cmCacheManager::UNINITIALIZED )
         {
-        bool advanced = it.PropertyExists("ADVANCED");
-        if ( list_all_cached || !advanced)
+        const char* advancedProp =
+            cm.GetCacheManager()->GetCacheEntryProperty(*it, "ADVANCED");
+        if ( list_all_cached || !advancedProp)
           {
           if ( list_help )
             {
-            std::cout << "// " << it.GetProperty("HELPSTRING") << std::endl;
+            std::cout << "// "
+                      << cm.GetCacheManager()->GetCacheEntryProperty(*it,
+                                                   "HELPSTRING") << std::endl;
             }
-          std::cout << it.GetName() << ":" <<
-            cmCacheManager::TypeToString(it.GetType())
-            << "=" << it.GetValue() << std::endl;
+          std::cout << *it << ":" <<
+            cmCacheManager::TypeToString(t)
+            << "=" << cm.GetCacheManager()->GetCacheEntryValue(*it)
+            << std::endl;
           if ( list_help )
             {
             std::cout << std::endl;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a5c285e30a7cc5f1389c69fab79085c90443fcb
commit 7a5c285e30a7cc5f1389c69fab79085c90443fcb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Apr 6 12:14:40 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 8 01:09:02 2015 +0200

    Port QtDialog to non-iterator cache API.

diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 009d06e..08d53ce 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -110,17 +110,18 @@ void QCMake::setBinaryDirectory(const QString& _dir)
 
     QCMakePropertyList props = this->properties();
     emit this->propertiesChanged(props);
-    cmCacheManager::CacheIterator itm = cachem->NewIterator();
-    if ( itm.Find("CMAKE_HOME_DIRECTORY"))
+    const char* homeDir = cachem->GetCacheEntryValue("CMAKE_HOME_DIRECTORY");
+    if (homeDir)
       {
-      setSourceDirectory(QString::fromLocal8Bit(itm.GetValue().c_str()));
+      setSourceDirectory(QString::fromLocal8Bit(homeDir));
       }
-    if ( itm.Find("CMAKE_GENERATOR"))
+    const char* gen = cachem->GetCacheEntryValue("CMAKE_GENERATOR");
+    if (gen)
       {
       const char* extraGen = cachem
                         ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
       std::string curGen = cmExternalMakefileProjectGenerator::
-        CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
+        CreateFullGeneratorName(gen, extraGen? extraGen : "");
       this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
       }
     }
@@ -195,33 +196,35 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
 
   // set the value of properties
   cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
-  for(cmCacheManager::CacheIterator i = cachem->NewIterator();
-      !i.IsAtEnd(); i.Next())
+  std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
+  for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+      it != cacheKeys.end(); ++it)
     {
-
-    if(i.GetType() == cmCacheManager::INTERNAL ||
-       i.GetType() == cmCacheManager::STATIC)
+    cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*it);
+    if(t == cmCacheManager::INTERNAL ||
+       t == cmCacheManager::STATIC)
       {
       continue;
       }
 
     QCMakeProperty prop;
-    prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
+    prop.Key = QString::fromLocal8Bit(it->c_str());
     int idx = props.indexOf(prop);
     if(idx == -1)
       {
-      toremove.append(QString::fromLocal8Bit(i.GetName().c_str()));
+      toremove.append(QString::fromLocal8Bit(it->c_str()));
       }
     else
       {
       prop = props[idx];
       if(prop.Value.type() == QVariant::Bool)
         {
-        i.SetValue(prop.Value.toBool() ? "ON" : "OFF");
+        cachem->SetCacheEntryValue(*it, prop.Value.toBool() ? "ON" : "OFF");
         }
       else
         {
-        i.SetValue(prop.Value.toString().toLocal8Bit().data());
+        cachem->SetCacheEntryValue(*it,
+                                   prop.Value.toString().toLocal8Bit().data());
         }
       props.removeAt(idx);
       }
@@ -279,42 +282,47 @@ QCMakePropertyList QCMake::properties() const
   QCMakePropertyList ret;
 
   cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
-  for(cmCacheManager::CacheIterator i = cachem->NewIterator();
-      !i.IsAtEnd(); i.Next())
+  std::vector<std::string> cacheKeys = cachem->GetCacheEntryKeys();
+  for (std::vector<std::string>::const_iterator i = cacheKeys.begin();
+        i != cacheKeys.end(); ++i)
     {
-
-    if(i.GetType() == cmCacheManager::INTERNAL ||
-       i.GetType() == cmCacheManager::STATIC ||
-       i.GetType() == cmCacheManager::UNINITIALIZED)
+    cmCacheManager::CacheEntryType t = cachem->GetCacheEntryType(*i);
+    if(t == cmCacheManager::INTERNAL ||
+       t == cmCacheManager::STATIC ||
+       t == cmCacheManager::UNINITIALIZED)
       {
       continue;
       }
 
-    QCMakeProperty prop;
-    prop.Key = QString::fromLocal8Bit(i.GetName().c_str());
-    prop.Help = QString::fromLocal8Bit(i.GetProperty("HELPSTRING"));
-    prop.Value = QString::fromLocal8Bit(i.GetValue().c_str());
-    prop.Advanced = i.GetPropertyAsBool("ADVANCED");
+    const char* cachedValue = cachem->GetCacheEntryValue(*i);
 
-    if(i.GetType() == cmCacheManager::BOOL)
+    QCMakeProperty prop;
+    prop.Key = QString::fromLocal8Bit(i->c_str());
+    prop.Help = QString::fromLocal8Bit(
+                            cachem->GetCacheEntryProperty(*i, "HELPSTRING"));
+    prop.Value = QString::fromLocal8Bit(cachedValue);
+    prop.Advanced = cachem->GetCacheEntryPropertyAsBool(*i, "ADVANCED");
+    if(t == cmCacheManager::BOOL)
       {
       prop.Type = QCMakeProperty::BOOL;
-      prop.Value = cmSystemTools::IsOn(i.GetValue().c_str());
+      prop.Value = cmSystemTools::IsOn(cachedValue);
       }
-    else if(i.GetType() == cmCacheManager::PATH)
+    else if(t == cmCacheManager::PATH)
       {
       prop.Type = QCMakeProperty::PATH;
       }
-    else if(i.GetType() == cmCacheManager::FILEPATH)
+    else if(t == cmCacheManager::FILEPATH)
       {
       prop.Type = QCMakeProperty::FILEPATH;
       }
-    else if(i.GetType() == cmCacheManager::STRING)
+    else if(t == cmCacheManager::STRING)
       {
       prop.Type = QCMakeProperty::STRING;
-      if (i.PropertyExists("STRINGS"))
+      const char* stringsProperty =
+                                cachem->GetCacheEntryProperty(*i, "STRINGS");
+      if (stringsProperty)
         {
-        prop.Strings = QString::fromLocal8Bit(i.GetProperty("STRINGS")).split(";");
+        prop.Strings = QString::fromLocal8Bit(stringsProperty).split(";");
         }
       }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51890a7e0718c675c064520bb9fdf5710a062ef5
commit 51890a7e0718c675c064520bb9fdf5710a062ef5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Apr 6 12:01:35 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 8 01:09:02 2015 +0200

    Port CursesDialog to non-iterator cache API.

diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 682f95f..4f028c4 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -18,6 +18,9 @@
 #include "cmCursesFilePathWidget.h"
 #include "cmCursesDummyWidget.h"
 #include "../cmSystemTools.h"
+#include "../cmake.h"
+
+#include <assert.h>
 
 cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
                                                         const std::string& key,
@@ -32,7 +35,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
 }
 
 cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
-  const std::string& key, const cmCacheManager::CacheIterator& it, bool isNew,
+  const std::string& key, cmake *cm, bool isNew,
   int labelwidth, int entrywidth)
   : Key(key), LabelWidth(labelwidth), EntryWidth(entrywidth)
 {
@@ -47,11 +50,13 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
     }
 
   this->Entry = 0;
-  switch ( it.GetType() )
+  const char* value = cm->GetCacheManager()->GetCacheEntryValue(key);
+  assert(value);
+  switch (cm->GetCacheManager()->GetCacheEntryType(key))
     {
-    case  cmCacheManager::BOOL:
+    case cmCacheManager::BOOL:
       this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1);
-      if (cmSystemTools::IsOn(it.GetValue().c_str()))
+      if (cmSystemTools::IsOn(value))
         {
         static_cast<cmCursesBoolWidget*>(this->Entry)->SetValueAsBool(true);
         }
@@ -62,40 +67,40 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
       break;
     case cmCacheManager::PATH:
       this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1);
-      static_cast<cmCursesPathWidget*>(this->Entry)->SetString(
-        it.GetValue());
+      static_cast<cmCursesPathWidget*>(this->Entry)->SetString(value);
       break;
     case cmCacheManager::FILEPATH:
       this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1);
-      static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(
-        it.GetValue());
+      static_cast<cmCursesFilePathWidget*>(this->Entry)->SetString(value);
       break;
     case cmCacheManager::STRING:
-      if(it.PropertyExists("STRINGS"))
+      {
+      const char* stringsProp = cm->GetCacheManager()
+                                  ->GetCacheEntryProperty(key, "STRINGS");
+      if(stringsProp)
         {
         cmCursesOptionsWidget* ow =
           new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1);
         this->Entry = ow;
         std::vector<std::string> options;
-        cmSystemTools::ExpandListArgument(
-          std::string(it.GetProperty("STRINGS")), options);
+        cmSystemTools::ExpandListArgument(stringsProp, options);
         for(std::vector<std::string>::iterator
               si = options.begin(); si != options.end(); ++si)
           {
           ow->AddOption(*si);
           }
-        ow->SetOption(it.GetValue());
+        ow->SetOption(value);
         }
       else
         {
         this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1);
-        static_cast<cmCursesStringWidget*>(this->Entry)->SetString(
-          it.GetValue());
+        static_cast<cmCursesStringWidget*>(this->Entry)->SetString(value);
         }
       break;
+      }
     case cmCacheManager::UNINITIALIZED:
       cmSystemTools::Error("Found an undefined variable: ",
-                           it.GetName().c_str());
+                           key.c_str());
       break;
     default:
       // TODO : put warning message here
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 7cdf13b..dc4ee4af 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -21,7 +21,7 @@ public:
   cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
                               int entrywidth);
   cmCursesCacheEntryComposite(const std::string& key,
-                              const cmCacheManager::CacheIterator& it,
+                              cmake *cm,
                               bool isNew, int labelwidth, int entrywidth);
   ~cmCursesCacheEntryComposite();
   const char* GetValue();
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 1217bda..833d540 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -111,13 +111,17 @@ void cmCursesMainForm::InitializeUI()
 
   // Count non-internal and non-static entries
   int count=0;
-  for(cmCacheManager::CacheIterator i =
-        this->CMakeInstance->GetCacheManager()->NewIterator();
-      !i.IsAtEnd(); i.Next())
+  std::vector<std::string> cacheKeys =
+      this->CMakeInstance->GetCacheManager()->GetCacheEntryKeys();
+
+  for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+      it != cacheKeys.end(); ++it)
     {
-    if ( i.GetType() != cmCacheManager::INTERNAL &&
-         i.GetType() != cmCacheManager::STATIC  &&
-         i.GetType() != cmCacheManager::UNINITIALIZED)
+    cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
+        ->GetCacheEntryType(*it);
+    if (t != cmCacheManager::INTERNAL &&
+        t != cmCacheManager::STATIC &&
+        t != cmCacheManager::UNINITIALIZED)
       {
       ++count;
       }
@@ -139,45 +143,49 @@ void cmCursesMainForm::InitializeUI()
     // Create the composites.
 
     // First add entries which are new
-    for(cmCacheManager::CacheIterator i =
-          this->CMakeInstance->GetCacheManager()->NewIterator();
-        !i.IsAtEnd(); i.Next())
+    for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+        it != cacheKeys.end(); ++it)
       {
-      std::string key = i.GetName();
-      if ( i.GetType() == cmCacheManager::INTERNAL ||
-           i.GetType() == cmCacheManager::STATIC ||
-           i.GetType() == cmCacheManager::UNINITIALIZED )
+      std::string key = *it;
+      cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
+          ->GetCacheEntryType(*it);
+      if (t == cmCacheManager::INTERNAL ||
+          t == cmCacheManager::STATIC ||
+          t == cmCacheManager::UNINITIALIZED )
         {
         continue;
         }
 
       if (!this->LookForCacheEntry(key))
         {
-        newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
-                                                              true, 30,
-                                                              entrywidth));
+        newEntries->push_back(new cmCursesCacheEntryComposite(key,
+                                                          this->CMakeInstance,
+                                                          true, 30,
+                                                          entrywidth));
         this->OkToGenerate = false;
         }
       }
 
     // then add entries which are old
-    for(cmCacheManager::CacheIterator i =
-          this->CMakeInstance->GetCacheManager()->NewIterator();
-        !i.IsAtEnd(); i.Next())
+    for(std::vector<std::string>::const_iterator it = cacheKeys.begin();
+        it != cacheKeys.end(); ++it)
       {
-      std::string key = i.GetName();
-      if ( i.GetType() == cmCacheManager::INTERNAL ||
-           i.GetType() == cmCacheManager::STATIC ||
-           i.GetType() == cmCacheManager::UNINITIALIZED )
+      std::string key = *it;
+      cmCacheManager::CacheEntryType t = this->CMakeInstance->GetCacheManager()
+          ->GetCacheEntryType(*it);
+      if (t == cmCacheManager::INTERNAL ||
+          t == cmCacheManager::STATIC ||
+          t == cmCacheManager::UNINITIALIZED )
         {
         continue;
         }
 
       if (this->LookForCacheEntry(key))
         {
-        newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
-                                                              false, 30,
-                                                              entrywidth));
+        newEntries->push_back(new cmCursesCacheEntryComposite(key,
+                                                          this->CMakeInstance,
+                                                          false, 30,
+                                                          entrywidth));
         }
       }
     }
@@ -216,10 +224,13 @@ void cmCursesMainForm::RePost()
     std::vector<cmCursesCacheEntryComposite*>::iterator it;
     for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
       {
-      cmCacheManager::CacheIterator mit =
-        this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
-      if (mit.IsAtEnd() ||
-          (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+      const char* existingValue =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryValue((*it)->GetValue());
+      bool advanced =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+      if (!existingValue || (!this->AdvancedMode && advanced))
         {
         continue;
         }
@@ -245,10 +256,13 @@ void cmCursesMainForm::RePost()
   std::vector<cmCursesCacheEntryComposite*>::iterator it;
   for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
     {
-    cmCacheManager::CacheIterator mit =
-      this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
-    if (mit.IsAtEnd() ||
-        (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+    const char* existingValue =
+        this->CMakeInstance->GetCacheManager()
+            ->GetCacheEntryValue((*it)->GetValue());
+    bool advanced =
+        this->CMakeInstance->GetCacheManager()
+            ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+    if (!existingValue || (!this->AdvancedMode && advanced))
       {
       continue;
       }
@@ -314,10 +328,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
     std::vector<cmCursesCacheEntryComposite*>::iterator it;
     for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
       {
-      cmCacheManager::CacheIterator mit =
-        this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
-      if (mit.IsAtEnd() ||
-          (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+      const char* existingValue =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryValue((*it)->GetValue());
+      bool advanced =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+      if (!existingValue || (!this->AdvancedMode && advanced))
         {
         continue;
         }
@@ -334,10 +351,13 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
     std::vector<cmCursesCacheEntryComposite*>::iterator it;
     for (it = this->Entries->begin(); it != this->Entries->end(); ++it)
       {
-      cmCacheManager::CacheIterator mit =
-        this->CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
-      if (mit.IsAtEnd() ||
-          (!this->AdvancedMode && mit.GetPropertyAsBool("ADVANCED")))
+      const char* existingValue =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryValue((*it)->GetValue());
+      bool advanced =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryPropertyAsBool((*it)->GetValue(), "ADVANCED");
+      if (!existingValue || (!this->AdvancedMode && advanced))
         {
         continue;
         }
@@ -495,11 +515,12 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
 
     // Get the help string of the current entry
     // and add it to the help string
-    cmCacheManager::CacheIterator it =
-      this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
-    if (!it.IsAtEnd())
+    const char* existingValue =
+        this->CMakeInstance->GetCacheManager()->GetCacheEntryValue(curField);
+    if (existingValue)
       {
-      const char* hs = it.GetProperty("HELPSTRING");
+      const char* hs = this->CMakeInstance->GetCacheManager()
+                           ->GetCacheEntryProperty(curField, "HELPSTRING");
       if ( hs )
         {
         strncpy(help, hs, 127);
@@ -792,23 +813,28 @@ void cmCursesMainForm::FillCacheManagerFromUI()
   size_t size = this->Entries->size();
   for(size_t i=0; i < size; i++)
     {
-    cmCacheManager::CacheIterator it =
-      this->CMakeInstance->GetCacheManager()->GetCacheIterator(
-        (*this->Entries)[i]->Key.c_str());
-    if (!it.IsAtEnd())
+    std::string cacheKey = (*this->Entries)[i]->Key;
+      const char* existingValue = this->CMakeInstance->GetCacheManager()
+        ->GetCacheEntryValue(cacheKey);
+    if (existingValue)
       {
-      std::string oldValue = it.GetValue();
+      std::string oldValue = existingValue;
       std::string newValue = (*this->Entries)[i]->Entry->GetValue();
       std::string fixedOldValue;
       std::string fixedNewValue;
-      this->FixValue(it.GetType(), oldValue, fixedOldValue);
-      this->FixValue(it.GetType(), newValue, fixedNewValue);
+      cmCacheManager::CacheEntryType t =
+          this->CMakeInstance->GetCacheManager()
+              ->GetCacheEntryType(cacheKey);
+      this->FixValue(t, oldValue, fixedOldValue);
+      this->FixValue(t, newValue, fixedNewValue);
 
       if(!(fixedOldValue == fixedNewValue))
         {
         // The user has changed the value.  Mark it as modified.
-        it.SetProperty("MODIFIED", true);
-        it.SetValue(fixedNewValue.c_str());
+        this->CMakeInstance->GetCacheManager()
+            ->SetCacheEntryBoolProperty(cacheKey, "MODIFIED", true);
+        this->CMakeInstance->GetCacheManager()
+            ->SetCacheEntryValue(cacheKey, fixedNewValue);
         }
       }
     }
@@ -1017,12 +1043,15 @@ void cmCursesMainForm::HandleInput()
         cmCursesWidget* lbl = reinterpret_cast<cmCursesWidget*>(field_userptr(
           this->Fields[findex-2]));
         const char* curField = lbl->GetValue();
-        const char* helpString=0;
-        cmCacheManager::CacheIterator it =
-          this->CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
-        if (!it.IsAtEnd())
+        const char* helpString = 0;
+
+        const char* existingValue =
+            this->CMakeInstance->GetCacheManager()
+                ->GetCacheEntryValue(curField);
+        if (existingValue)
           {
-          helpString = it.GetProperty("HELPSTRING");
+          helpString = this->CMakeInstance->GetCacheManager()
+                           ->GetCacheEntryProperty(curField, "HELPSTRING");
           }
         if (helpString)
           {

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d97c4da28d5ebde5d5c47aadec826367eebd238
commit 9d97c4da28d5ebde5d5c47aadec826367eebd238
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Apr 6 10:46:25 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 8 01:09:01 2015 +0200

    cmMakefile: Port away from CacheEntry.Initialized.
    
    The API has no other external users.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b6eff3d..7c1b9c4 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1810,16 +1810,17 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
 {
   bool haveVal = value ? true : false;
   std::string val = haveVal ? value : "";
-  cmCacheManager::CacheIterator it =
-    this->GetCacheManager()->GetCacheIterator(name.c_str());
-  if(!it.IsAtEnd() && (it.GetType() == cmCacheManager::UNINITIALIZED) &&
-     it.Initialized())
+  const char* existingValue =
+    this->GetCacheManager()->GetInitializedCacheValue(name);
+  if(existingValue
+      && (this->GetCacheManager()->GetCacheEntryType(name)
+                                            == cmCacheManager::UNINITIALIZED))
     {
     // if this is not a force, then use the value from the cache
     // if it is a force, then use the value being passed in
     if(!force)
       {
-      val = it.GetValue();
+      val = existingValue;
       haveVal = true;
       }
     if ( type == cmCacheManager::PATH || type == cmCacheManager::FILEPATH )
@@ -1842,7 +1843,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
         }
 
       this->GetCacheManager()->AddCacheEntry(name, nvalue.c_str(), doc, type);
-      val = it.GetValue();
+      val = this->GetCacheManager()->GetInitializedCacheValue(name);
       haveVal = true;
       }
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0b325419d12bbb51a3125f19d18302b49f0dc5c3
commit 0b325419d12bbb51a3125f19d18302b49f0dc5c3
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 5 19:50:05 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 8 01:09:01 2015 +0200

    cmCacheManager: Add non-iterator-based API.
    
    The iterator pattern is an unusual one for CMake, and it hinders
    refactoring all configuration-time data manipulation into a
    single class.

diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 31d302a..a08006a 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -139,6 +139,83 @@ public:
   ///! Get a value from the cache given a key
   const char* GetInitializedCacheValue(const std::string& key) const;
 
+  const char* GetCacheEntryValue(const std::string& key)
+  {
+    cmCacheManager::CacheIterator it = this->GetCacheIterator(key.c_str());
+    if (it.IsAtEnd())
+      {
+      return 0;
+      }
+    static std::string value;
+    value = it.GetValue();
+    return value.c_str();
+  }
+
+  const char* GetCacheEntryProperty(std::string const& key,
+                                    std::string const& propName)
+  {
+    return this->GetCacheIterator(key.c_str()).GetProperty(propName);
+  }
+
+  CacheEntryType GetCacheEntryType(std::string const& key)
+  {
+    return this->GetCacheIterator(key.c_str()).GetType();
+  }
+
+  bool GetCacheEntryPropertyAsBool(std::string const& key,
+                                   std::string const& propName)
+  {
+    return this->GetCacheIterator(key.c_str()).GetPropertyAsBool(propName);
+  }
+
+  void SetCacheEntryProperty(std::string const& key,
+                             std::string const& propName,
+                             std::string const& value)
+  {
+    this->GetCacheIterator(key.c_str()).SetProperty(propName, value.c_str());
+  }
+
+  void SetCacheEntryBoolProperty(std::string const& key,
+                                 std::string const& propName,
+                                 bool value)
+  {
+    this->GetCacheIterator(key.c_str()).SetProperty(propName, value);
+  }
+
+  void SetCacheEntryValue(std::string const& key,
+                          std::string const& value)
+  {
+    this->GetCacheIterator(key.c_str()).SetValue(value.c_str());
+  }
+
+  void RemoveCacheEntryProperty(std::string const& key,
+                                std::string const& propName)
+  {
+    this->GetCacheIterator(key.c_str()).SetProperty(propName, (void*)0);
+  }
+
+  void AppendCacheEntryProperty(std::string const& key,
+                                std::string const& propName,
+                                std::string const& value,
+                                bool asString = false)
+  {
+    this->GetCacheIterator(key.c_str()).AppendProperty(propName,
+                                                       value.c_str(),
+                                                       asString);
+  }
+
+  std::vector<std::string> GetCacheEntryKeys()
+  {
+    std::vector<std::string> definitions;
+    definitions.reserve(this->GetSize());
+    cmCacheManager::CacheIterator cit = this->GetCacheIterator();
+    for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
+      {
+      definitions.push_back(cit.GetName());
+      }
+    return definitions;
+  }
+
   /** Get the version of CMake that wrote the cache.  */
   unsigned int GetCacheMajorVersion() const
     { return this->CacheMajorVersion; }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77f2807ce56491fab7637327564c7fb1033dadb1
commit 77f2807ce56491fab7637327564c7fb1033dadb1
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 5 10:28:34 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 7 23:25:44 2015 +0200

    cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
    
    Being initialized is a requirement for this method to return something,
    and is what differentiates it from using GetIterator with it.GetValue.

diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 3df48d1..009d06e 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -117,7 +117,8 @@ void QCMake::setBinaryDirectory(const QString& _dir)
       }
     if ( itm.Find("CMAKE_GENERATOR"))
       {
-      const char* extraGen = cachem->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+      const char* extraGen = cachem
+                        ->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
       std::string curGen = cmExternalMakefileProjectGenerator::
         CreateFullGeneratorName(itm.GetValue(), extraGen? extraGen : "");
       this->setGenerator(QString::fromLocal8Bit(curGen.c_str()));
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index b8dfe04..5387d0c 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -283,14 +283,16 @@ bool cmCacheManager::LoadCache(const std::string& path,
     }
   this->CacheMajorVersion = 0;
   this->CacheMinorVersion = 0;
-  if(const char* cmajor = this->GetCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
+  if(const char* cmajor =
+                  this->GetInitializedCacheValue("CMAKE_CACHE_MAJOR_VERSION"))
     {
     unsigned int v=0;
     if(sscanf(cmajor, "%u", &v) == 1)
       {
       this->CacheMajorVersion = v;
       }
-    if(const char* cminor = this->GetCacheValue("CMAKE_CACHE_MINOR_VERSION"))
+    if(const char* cminor =
+                  this->GetInitializedCacheValue("CMAKE_CACHE_MINOR_VERSION"))
       {
       if(sscanf(cminor, "%u", &v) == 1)
         {
@@ -312,10 +314,11 @@ bool cmCacheManager::LoadCache(const std::string& path,
     }
   // check to make sure the cache directory has not
   // been moved
-  if ( internal && this->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+  const char* oldDir = this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR");
+  if (internal && oldDir)
     {
     std::string currentcwd = path;
-    std::string oldcwd = this->GetCacheValue("CMAKE_CACHEFILE_DIR");
+    std::string oldcwd = oldDir;
     cmSystemTools::ConvertToUnixSlashes(currentcwd);
     currentcwd += "/CMakeCache.txt";
     oldcwd += "/CMakeCache.txt";
@@ -324,7 +327,7 @@ bool cmCacheManager::LoadCache(const std::string& path,
       std::string message =
         std::string("The current CMakeCache.txt directory ") +
         currentcwd + std::string(" is different than the directory ") +
-        std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
+        std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
         std::string(" where CMakeCache.txt was created. This may result "
                     "in binaries being created in the wrong place. If you "
                     "are not sure, reedit the CMakeCache.txt");
@@ -654,7 +657,8 @@ cmCacheManager::CacheIterator cmCacheManager::GetCacheIterator(
   return CacheIterator(*this, key);
 }
 
-const char* cmCacheManager::GetCacheValue(const std::string& key) const
+const char*
+cmCacheManager::GetInitializedCacheValue(const std::string& key) const
 {
   CacheEntryMap::const_iterator i = this->Cache.find(key);
   if(i != this->Cache.end() &&
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index f7f8776..31d302a 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -137,7 +137,7 @@ public:
                          CacheEntryType& type);
 
   ///! Get a value from the cache given a key
-  const char* GetCacheValue(const std::string& key) const;
+  const char* GetInitializedCacheValue(const std::string& key) const;
 
   /** Get the version of CMake that wrote the cache.  */
   unsigned int GetCacheMajorVersion() const
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 747b7e4..99bf5f5 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -90,7 +90,8 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
     }
   if ( strcmp(key, "CACHE") == 0 )
     {
-    if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var))
+    if(const char* c = this->Makefile->GetCacheManager()
+                           ->GetInitializedCacheValue(var))
       {
       if(this->EscapeQuotes)
         {
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 810ec57..0d32e4b 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
 
   std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
   cacheEntryName += envVar;
-  const char* cacheValue = mf->GetCacheManager()->GetCacheValue(
+  const char* cacheValue = mf->GetCacheManager()->GetInitializedCacheValue(
                                                        cacheEntryName);
 
   // now we have both, decide which one to use
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 3c0a0e2..f23caa6 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -179,7 +179,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
     return;
     }
   const char* cname = this->GetCMakeInstance()->
-    GetCacheManager()->GetCacheValue(langComp);
+    GetCacheManager()->GetInitializedCacheValue(langComp);
   std::string changeVars;
   if(cname && !optional)
     {
@@ -1641,7 +1641,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
   // and there is a good chance that the try compile stuff will
   // take the bulk of the time, so try and guess some progress
   // by getting closer and closer to 100 without actually getting there.
-  if (!this->CMakeInstance->GetCacheManager()->GetCacheValue
+  if (!this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
       ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"))
     {
     // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set
@@ -1839,7 +1839,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg)
   // update progress
   // estimate how many lg there will be
   const char *numGenC =
-    this->CMakeInstance->GetCacheManager()->GetCacheValue
+    this->CMakeInstance->GetCacheManager()->GetInitializedCacheValue
     ("CMAKE_NUMBER_OF_LOCAL_GENERATORS");
 
   if (!numGenC)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ad4ad7c..b6eff3d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2432,7 +2432,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
   this->Internal->VarUsageStack.top().insert(name);
   if(!def)
     {
-    def = this->GetCacheManager()->GetCacheValue(name);
+    def = this->GetCacheManager()->GetInitializedCacheValue(name);
     }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   if(cmVariableWatch* vv = this->GetVariableWatch())
@@ -2457,7 +2457,7 @@ const char* cmMakefile::GetDefinition(const std::string& name) const
   const char* def = this->Internal->VarStack.top().Get(name);
   if(!def)
     {
-    def = this->GetCacheManager()->GetCacheValue(name);
+    def = this->GetCacheManager()->GetInitializedCacheValue(name);
     }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   cmVariableWatch* vv = this->GetVariableWatch();
@@ -2835,7 +2835,8 @@ cmake::MessageType cmMakefile::ExpandVariablesInStringNew(
               value = cmSystemTools::GetEnv(lookup.c_str());
               break;
             case CACHE:
-              value = this->GetCacheManager()->GetCacheValue(lookup);
+              value = this->GetCacheManager()
+                          ->GetInitializedCacheValue(lookup);
               break;
             }
           // Get the string we're meant to append to.
@@ -4903,7 +4904,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
      (status == cmPolicies::WARN || status == cmPolicies::OLD))
     {
     if(!(this->GetCacheManager()
-         ->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
+         ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
       {
       // Set it to 2.4 because that is the last version where the
       // variable had meaning.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index e781417..210c0ef 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -344,7 +344,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         std::string cachedValue;
         if(this->WarnUnusedCli)
           {
-          if(const char *v = this->CacheManager->GetCacheValue(var))
+          if(const char *v = this->CacheManager
+                                 ->GetInitializedCacheValue(var))
             {
             haveValue = true;
             cachedValue = v;
@@ -357,7 +358,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         if(this->WarnUnusedCli)
           {
           if (!haveValue ||
-              cachedValue != this->CacheManager->GetCacheValue(var))
+              cachedValue != this->CacheManager
+                                 ->GetInitializedCacheValue(var))
             {
             this->WatchUnusedCli(var);
             }
@@ -1203,10 +1205,10 @@ int cmake::DoPreConfigureChecks()
     }
 
   // do a sanity check on some values
-  if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
+  if(this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"))
     {
     std::string cacheStart =
-      this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
+      this->CacheManager->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY");
     cacheStart += "/CMakeLists.txt";
     std::string currentStart = this->GetHomeDirectory();
     currentStart += "/CMakeLists.txt";
@@ -1355,9 +1357,9 @@ int cmake::ActualConfigure()
   if(!this->GlobalGenerator)
     {
     const char* genName =
-      this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+      this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR");
     const char* extraGenName =
-      this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
+      this->CacheManager->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
     if(genName)
       {
       std::string fullName = cmExternalMakefileProjectGenerator::
@@ -1435,7 +1437,8 @@ int cmake::ActualConfigure()
       }
     }
 
-  const char* genName = this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
+  const char* genName = this->CacheManager
+                            ->GetInitializedCacheValue("CMAKE_GENERATOR");
   if(genName)
     {
     if(!this->GlobalGenerator->MatchesGeneratorName(genName))
@@ -1451,7 +1454,7 @@ int cmake::ActualConfigure()
       return -2;
       }
     }
-  if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
+  if(!this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR"))
     {
     this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
                                       this->GlobalGenerator->GetName().c_str(),
@@ -1464,7 +1467,7 @@ int cmake::ActualConfigure()
     }
 
   if(const char* platformName =
-     this->CacheManager->GetCacheValue("CMAKE_GENERATOR_PLATFORM"))
+     this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM"))
     {
     if(this->GeneratorPlatform.empty())
       {
@@ -1492,7 +1495,7 @@ int cmake::ActualConfigure()
     }
 
   if(const char* tsName =
-     this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
+     this->CacheManager->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET"))
     {
     if(this->GeneratorToolset.empty())
       {
@@ -1546,16 +1549,18 @@ int cmake::ActualConfigure()
   // project requires compatibility with CMake 2.4.  We detect this
   // here by looking for the old CMAKE_BACKWARDS_COMPATIBILITY
   // variable created when CMP0001 is not set to NEW.
-  if(this->GetCacheManager()->GetCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
+  if(this->GetCacheManager()
+         ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY"))
     {
-    if(!this->CacheManager->GetCacheValue("LIBRARY_OUTPUT_PATH"))
+    if(!this->CacheManager->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH"))
       {
       this->CacheManager->AddCacheEntry
         ("LIBRARY_OUTPUT_PATH", "",
          "Single output directory for building all libraries.",
          cmCacheManager::PATH);
       }
-    if(!this->CacheManager->GetCacheValue("EXECUTABLE_OUTPUT_PATH"))
+    if(!this->CacheManager
+            ->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH"))
       {
       this->CacheManager->AddCacheEntry
         ("EXECUTABLE_OUTPUT_PATH", "",
@@ -1563,7 +1568,8 @@ int cmake::ActualConfigure()
          cmCacheManager::PATH);
       }
     }
-  if(!this->CacheManager->GetCacheValue("CMAKE_USE_RELATIVE_PATHS"))
+  if(!this->CacheManager
+          ->GetInitializedCacheValue("CMAKE_USE_RELATIVE_PATHS"))
     {
     this->CacheManager->AddCacheEntry
       ("CMAKE_USE_RELATIVE_PATHS", "OFF",
@@ -1578,9 +1584,9 @@ int cmake::ActualConfigure()
     }
 
   if(cmSystemTools::GetFatalErrorOccured() &&
-     (!this->CacheManager->GetCacheValue("CMAKE_MAKE_PROGRAM") ||
+     (!this->CacheManager->GetInitializedCacheValue("CMAKE_MAKE_PROGRAM") ||
       cmSystemTools::IsOff(this->CacheManager->
-                           GetCacheValue("CMAKE_MAKE_PROGRAM"))))
+                           GetInitializedCacheValue("CMAKE_MAKE_PROGRAM"))))
     {
     // We must have a bad generator selection.  Wipe the cache entry so the
     // user can select another.
@@ -1796,7 +1802,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value,
 
 const char* cmake::GetCacheDefinition(const std::string& name) const
 {
-  return this->CacheManager->GetCacheValue(name);
+  return this->CacheManager->GetInitializedCacheValue(name);
 }
 
 void cmake::AddDefaultCommands()
@@ -1956,7 +1962,8 @@ void cmake::UpdateConversionPathTable()
 {
   // Update the path conversion table with any specified file:
   const char* tablepath =
-    this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
+    this->CacheManager
+        ->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE");
 
   if(tablepath)
     {
@@ -2190,7 +2197,7 @@ void cmake::TruncateOutputLog(const char* fname)
     {
     return;
     }
-  if ( !this->CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+  if ( !this->CacheManager->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") )
     {
     cmSystemTools::RemoveFile(fullPath);
     return;
@@ -2469,7 +2476,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
   // we have to find the module directory, so we can copy the files
   this->AddCMakePaths();
   std::string modulesPath =
-    this->CacheManager->GetCacheValue("CMAKE_ROOT");
+    this->CacheManager->GetInitializedCacheValue("CMAKE_ROOT");
   modulesPath += "/Modules";
   std::string inFile = modulesPath;
   inFile += "/SystemInformation.cmake";

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=14973054a2f3954111789cda5e54c2e2e2175521
commit 14973054a2f3954111789cda5e54c2e2e2175521
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Apr 5 00:07:04 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 7 23:25:39 2015 +0200

    Add API for cache loading, deleting and saving to the cmake class.
    
    Migrate existing users of the CacheManager API to use the new
    API.  The CacheManager will be going away soon.

diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 0827037..586070b 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -18,7 +18,6 @@
 #include "cmGlobalGenerator.h"
 #include <cmsys/Process.h>
 #include "cmCTestTestHandler.h"
-#include "cmCacheManager.h"
 
 //----------------------------------------------------------------------
 cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
@@ -255,7 +254,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
     cm.SetGeneratorToolset(this->BuildGeneratorToolset);
 
     // Load the cache to make CMAKE_MAKE_PROGRAM available.
-    cm.GetCacheManager()->LoadCache(this->BinaryDir);
+    cm.LoadCache(this->BinaryDir);
     }
   else
     {
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index d60062e..1217bda 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -639,7 +639,7 @@ int cmCursesMainForm::Configure(int noconfigure)
 
   // always save the current gui values to disk
   this->FillCacheManagerFromUI();
-  this->CMakeInstance->GetCacheManager()->SaveCache(
+  this->CMakeInstance->SaveCache(
     this->CMakeInstance->GetHomeOutputDirectory());
   this->LoadCache(0);
 
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 996aa75..3df48d1 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -96,7 +96,7 @@ void QCMake::setBinaryDirectory(const QString& _dir)
     emit this->binaryDirChanged(this->BinaryDirectory);
     cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
     this->setGenerator(QString());
-    if(!this->CMakeInstance->GetCacheManager()->LoadCache(
+    if(!this->CMakeInstance->LoadCache(
       this->BinaryDirectory.toLocal8Bit().data()))
       {
       QDir testDir(this->BinaryDirectory);
@@ -270,7 +270,7 @@ void QCMake::setProperties(const QCMakePropertyList& newProps)
       }
     }
 
-  cachem->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
+  this->CMakeInstance->SaveCache(this->BinaryDirectory.toLocal8Bit().data());
 }
 
 QCMakePropertyList QCMake::properties() const
@@ -397,9 +397,9 @@ QStringList QCMake::availableGenerators() const
 void QCMake::deleteCache()
 {
   // delete cache
-  this->CMakeInstance->GetCacheManager()->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
+  this->CMakeInstance->DeleteCache(this->BinaryDirectory.toLocal8Bit().data());
   // reload to make our cache empty
-  this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
+  this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
   // emit no generator and no properties
   this->setGenerator(QString());
   QCMakePropertyList props = this->properties();
@@ -412,7 +412,7 @@ void QCMake::reloadCache()
   QCMakePropertyList props;
   emit this->propertiesChanged(props);
   // reload
-  this->CMakeInstance->GetCacheManager()->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
+  this->CMakeInstance->LoadCache(this->BinaryDirectory.toLocal8Bit().data());
   // emit new cache properties
   props = this->properties();
   emit this->propertiesChanged(props);
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index df61fe6..1db057b 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2281,7 +2281,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg)
   std::string value;
   cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
 
-  if (cmCacheManager::ParseEntry(arg, name, value, type))
+  if (cmake::ParseCacheEntry(arg, name, value, type))
     {
     this->Definitions[name] = value;
     return true;
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index d64b0d7..810ec57 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -223,7 +223,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
     mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
                            cacheEntryName.c_str(), cmCacheManager::STRING,
                            true);
-    mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
+    mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
     }
   else if (envVarValue==0 && cacheValue!=0)
     {
@@ -244,7 +244,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
       mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
                              cacheEntryName.c_str(), cmCacheManager::STRING,
                              true);
-      mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory());
+      mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
       }
     }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5e584a4..0561a05 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3703,7 +3703,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
 
   // Since this call may have created new cache entries, save the cache:
   //
-  root->GetMakefile()->GetCacheManager()->SaveCache(
+  root->GetMakefile()->GetCMakeInstance()->SaveCache(
     root->GetMakefile()->GetHomeOutputDirectory());
 }
 
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index 93aec32..e2ae901 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -81,8 +81,8 @@ bool cmLoadCacheCommand
       {
       break;
       }
-    this->Makefile->GetCacheManager()->LoadCache(args[i], false,
-                                             excludes, includes);
+    this->Makefile->GetCMakeInstance()->LoadCache(args[i], false,
+                                                  excludes, includes);
     }
 
 
@@ -173,7 +173,7 @@ void cmLoadCacheCommand::CheckLine(const char* line)
   std::string var;
   std::string value;
   cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
-  if(cmCacheManager::ParseEntry(line, var, value, type))
+  if(cmake::ParseCacheEntry(line, var, value, type))
     {
     // Found a real entry.  See if this one was requested.
     if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 5c52a1a..e781417 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -917,7 +917,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
     {
     cmCacheManager* cachem = this->GetCacheManager();
     cmCacheManager::CacheIterator it = cachem->NewIterator();
-    if(cachem->LoadCache(cachePath) &&
+    if(this->LoadCache(cachePath) &&
       it.Find("CMAKE_HOME_DIRECTORY"))
       {
       this->SetHomeOutputDirectory(cachePath);
@@ -1860,10 +1860,18 @@ void cmake::AddDefaultGenerators()
 #endif
 }
 
+bool cmake::ParseCacheEntry(const std::string& entry,
+                            std::string& var,
+                            std::string& value,
+                            cmCacheManager::CacheEntryType& type)
+{
+  return cmCacheManager::ParseEntry(entry, var, value, type);
+}
+
 int cmake::LoadCache()
 {
   // could we not read the cache
-  if (!this->CacheManager->LoadCache(this->GetHomeOutputDirectory()))
+  if (!this->LoadCache(this->GetHomeOutputDirectory()))
     {
     // if it does exist, but isn't readable then warn the user
     std::string cacheFile = this->GetHomeOutputDirectory();
@@ -1886,6 +1894,28 @@ int cmake::LoadCache()
   return 0;
 }
 
+bool cmake::LoadCache(const std::string& path)
+{
+  return this->CacheManager->LoadCache(path);
+}
+
+bool cmake::LoadCache(const std::string& path, bool internal,
+                std::set<std::string>& excludes,
+                std::set<std::string>& includes)
+{
+  return this->CacheManager->LoadCache(path, internal, excludes, includes);
+}
+
+bool cmake::SaveCache(const std::string& path)
+{
+  return this->CacheManager->SaveCache(path);
+}
+
+bool cmake::DeleteCache(const std::string& path)
+{
+  return this->CacheManager->DeleteCache(path);
+}
+
 void cmake::SetProgressCallback(ProgressCallbackType f, void *cd)
 {
   this->ProgressCallback = f;
@@ -2764,9 +2794,8 @@ int cmake::Build(const std::string& dir,
     }
   std::string cachePath = dir;
   cmSystemTools::ConvertToUnixSlashes(cachePath);
-  cmCacheManager* cachem = this->GetCacheManager();
-  cmCacheManager::CacheIterator it = cachem->NewIterator();
-  if(!cachem->LoadCache(cachePath))
+  cmCacheManager::CacheIterator it = this->GetCacheManager()->NewIterator();
+  if(!this->LoadCache(cachePath))
     {
     std::cerr << "Error: could not load cache\n";
     return 1;
diff --git a/Source/cmake.h b/Source/cmake.h
index c22b329..3acf4a8 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -18,11 +18,11 @@
 #include "cmPropertyDefinitionMap.h"
 #include "cmPropertyMap.h"
 #include "cmInstalledFile.h"
+#include "cmCacheManager.h"
 
 class cmGlobalGeneratorFactory;
 class cmGlobalGenerator;
 class cmLocalGenerator;
-class cmCacheManager;
 class cmMakefile;
 class cmCommand;
 class cmVariableWatch;
@@ -173,7 +173,19 @@ class cmake
   int Configure();
   int ActualConfigure();
 
+  ///! Break up a line like VAR:type="value" into var, type and value
+  static bool ParseCacheEntry(const std::string& entry,
+                         std::string& var,
+                         std::string& value,
+                         cmCacheManager::CacheEntryType& type);
+
   int LoadCache();
+  bool LoadCache(const std::string& path);
+  bool LoadCache(const std::string& path, bool internal,
+                 std::set<std::string>& excludes,
+                 std::set<std::string>& includes);
+  bool SaveCache(const std::string& path);
+  bool DeleteCache(const std::string& path);
   void PreLoadCMakeFiles();
 
   ///! Create a GlobalGenerator

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1f2c12ebd196f3d23aa40d85c965654dbc36d0ad
commit 1f2c12ebd196f3d23aa40d85c965654dbc36d0ad
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Apr 6 13:32:00 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 7 23:25:35 2015 +0200

    cmMakefile: Remove cache version accessors.
    
    They are only used by legacy code. Inline them there to simplify
    cmMakefile.

diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 691d80d..987a7b1 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -51,12 +51,14 @@ void CCONV cmSetError(void *info, const char *err)
 unsigned int CCONV  cmGetCacheMajorVersion(void *arg)
 {
   cmMakefile *mf = static_cast<cmMakefile *>(arg);
-  return mf->GetCacheMajorVersion();
+  cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
+  return manager->GetCacheMajorVersion();
 }
 unsigned int CCONV cmGetCacheMinorVersion(void *arg)
 {
   cmMakefile *mf = static_cast<cmMakefile *>(arg);
-  return mf->GetCacheMinorVersion();
+  cmCacheManager *manager = mf->GetCMakeInstance()->GetCacheManager();
+  return manager->GetCacheMinorVersion();
 }
 
 unsigned int CCONV cmGetMajorVersion(void *)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 7f44da2..ad4ad7c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -174,16 +174,6 @@ void cmMakefile::Initialize()
   this->CheckCMP0000 = false;
 }
 
-unsigned int cmMakefile::GetCacheMajorVersion() const
-{
-  return this->GetCacheManager()->GetCacheMajorVersion();
-}
-
-unsigned int cmMakefile::GetCacheMinorVersion() const
-{
-  return this->GetCacheManager()->GetCacheMinorVersion();
-}
-
 cmMakefile::~cmMakefile()
 {
   cmDeleteAll(this->InstallGenerators);
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 920b6b7..5209891 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -62,14 +62,6 @@ class cmMakefile
   class Internals;
   cmsys::auto_ptr<Internals> Internal;
 public:
-  /**
-   * Return the major and minor version of the cmake that
-   * was used to write the currently loaded cache, note
-   * this method will not work before the cache is loaded.
-   */
-  unsigned int GetCacheMajorVersion() const;
-  unsigned int GetCacheMinorVersion() const;
-
   /* Check for unused variables in this scope */
   void CheckForUnusedVariables() const;
   /* Mark a variable as used */
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index ee1ff29..2799a9b 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -52,11 +52,13 @@ bool cmUtilitySourceCommand
     }
   else
     {
+    cmCacheManager *manager =
+        this->Makefile->GetCMakeInstance()->GetCacheManager();
     haveCacheValue = (cacheValue &&
      (strstr(cacheValue, "(IntDir)") == 0 ||
       (intDir && strcmp(intDir, "$(IntDir)") == 0)) &&
-     (this->Makefile->GetCacheMajorVersion() != 0 &&
-      this->Makefile->GetCacheMinorVersion() != 0 ));
+     (manager->GetCacheMajorVersion() != 0 &&
+      manager->GetCacheMinorVersion() != 0 ));
     }
 
   if(haveCacheValue)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97c50a8dbd9f1ca5026f60e4a224e9a087e01f0e
commit 97c50a8dbd9f1ca5026f60e4a224e9a087e01f0e
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Apr 6 12:30:21 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Apr 7 23:25:31 2015 +0200

    cmMakefile: Simplify GetDefinitions implementation.

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 215ee16..7f44da2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2501,20 +2501,20 @@ const char* cmMakefile::GetSafeDefinition(const std::string& def) const
 std::vector<std::string> cmMakefile
 ::GetDefinitions(int cacheonly /* = 0 */) const
 {
-  std::set<std::string> definitions;
+  std::vector<std::string> res;
   if ( !cacheonly )
     {
-    definitions = this->Internal->VarStack.top().ClosureKeys();
+    std::set<std::string> definitions =
+        this->Internal->VarStack.top().ClosureKeys();
+    res.insert(res.end(), definitions.begin(), definitions.end());
     }
   cmCacheManager::CacheIterator cit =
     this->GetCacheManager()->GetCacheIterator();
   for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
     {
-    definitions.insert(cit.GetName());
+    res.push_back(cit.GetName());
     }
-
-  std::vector<std::string> res;
-  res.insert(res.end(), definitions.begin(), definitions.end());
+  std::sort(res.begin(), res.end());
   return res;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 Source/CTest/cmCTestBuildAndTestHandler.cxx        |    3 +-
 .../CursesDialog/cmCursesCacheEntryComposite.cxx   |   35 +++--
 Source/CursesDialog/cmCursesCacheEntryComposite.h  |    2 +-
 Source/CursesDialog/cmCursesMainForm.cxx           |  151 +++++++++++-------
 Source/QtDialog/QCMake.cxx                         |   85 +++++-----
 Source/cmCPluginAPI.cxx                            |    6 +-
 Source/cmCTest.cxx                                 |    2 +-
 Source/cmCacheManager.cxx                          |   16 +-
 Source/cmCacheManager.h                            |   79 +++++++++-
 Source/cmCommandArgumentParserHelper.cxx           |    3 +-
 Source/cmExtraEclipseCDT4Generator.cxx             |    6 +-
 Source/cmFindBase.cxx                              |   13 +-
 Source/cmGetPropertyCommand.cxx                    |    7 +-
 Source/cmGlobalGenerator.cxx                       |   14 +-
 Source/cmGlobalXCodeGenerator.cxx                  |    2 +-
 Source/cmLoadCacheCommand.cxx                      |    6 +-
 Source/cmMakefile.cxx                              |   54 +++----
 Source/cmMakefile.h                                |    8 -
 Source/cmMarkAsAdvancedCommand.cxx                 |   15 +-
 Source/cmOptionCommand.cxx                         |   12 +-
 Source/cmSetCommand.cxx                            |    7 +-
 Source/cmSetPropertyCommand.cxx                    |   19 ++-
 Source/cmSetPropertyCommand.h                      |    2 +-
 Source/cmTryRunCommand.cxx                         |   19 ++-
 Source/cmUtilitySourceCommand.cxx                  |    6 +-
 Source/cmVariableRequiresCommand.cxx               |    6 +-
 Source/cmake.cxx                                   |  166 ++++++++++++--------
 Source/cmake.h                                     |   14 +-
 Source/cmakemain.cxx                               |   26 +--
 29 files changed, 473 insertions(+), 311 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list