From 80e982d7ad571ce308708d36a531df7a91ffe0f8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 7 Mar 2017 15:16:17 -0500 Subject: [PATCH] VS: Add method to take a value out of the option parser flag map Remove a flag from the map and return its value. --- Source/cmVisualStudioGeneratorOptions.cxx | 12 ++++++++++++ Source/cmVisualStudioGeneratorOptions.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 1d20d44d2a..3007f14e32 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/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::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; diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 700b877376..e79c977aad 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -91,6 +91,8 @@ private: std::string UnknownFlagField; virtual void StoreUnknownFlag(const char* flag); + + FlagValue TakeFlag(std::string const& key); }; #endif