浏览代码

VS: Add method to take a value out of the option parser flag map

Remove a flag from the map and return its value.
Brad King 8 年之前
父节点
当前提交
80e982d7ad
共有 2 个文件被更改,包括 14 次插入0 次删除
  1. 12 0
      Source/cmVisualStudioGeneratorOptions.cxx
  2. 2 0
      Source/cmVisualStudioGeneratorOptions.h

+ 12 - 0
Source/cmVisualStudioGeneratorOptions.cxx

@@ -274,6 +274,18 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag)
   this->AppendFlagString(this->UnknownFlagField, opts);
 }
 
+cmIDEOptions::FlagValue cmVisualStudioGeneratorOptions::TakeFlag(
+  std::string const& key)
+{
+  FlagValue value;
+  std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key);
+  if (i != this->FlagMap.end()) {
+    value = i->second;
+    this->FlagMap.erase(i);
+  }
+  return value;
+}
+
 void cmVisualStudioGeneratorOptions::SetConfiguration(const char* config)
 {
   this->Configuration = config;

+ 2 - 0
Source/cmVisualStudioGeneratorOptions.h

@@ -91,6 +91,8 @@ private:
   std::string UnknownFlagField;
 
   virtual void StoreUnknownFlag(const char* flag);
+
+  FlagValue TakeFlag(std::string const& key);
 };
 
 #endif