diff options
author | Brad King <brad.king@kitware.com> | 2022-07-06 15:45:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-07-07 13:49:04 (GMT) |
commit | f46b2e914256322fc8d33b425ec01e9d9c1496ba (patch) | |
tree | c52e8e524354fa7c7248ea5ed14802e470a6933b /Source/cmArgumentParser.cxx | |
parent | e6d1e29ffa6bd3141a769d1281f3407ed0774139 (diff) | |
download | CMake-f46b2e914256322fc8d33b425ec01e9d9c1496ba.zip CMake-f46b2e914256322fc8d33b425ec01e9d9c1496ba.tar.gz CMake-f46b2e914256322fc8d33b425ec01e9d9c1496ba.tar.bz2 |
cmArgumentParser: Model maybe-missing string with wrapper type
Bindings to `std::string` require one value. Some clients have been
filtering `keywordsMissingValue` to support keywords that tolerate a
missing value. Offer them a type-safe way to achieve this instead.
Diffstat (limited to 'Source/cmArgumentParser.cxx')
-rw-r--r-- | Source/cmArgumentParser.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx index 1bb9051..f0c4cfc 100644 --- a/Source/cmArgumentParser.cxx +++ b/Source/cmArgumentParser.cxx @@ -46,6 +46,13 @@ void Instance::Bind(std::string& val) this->ExpectValue = true; } +void Instance::Bind(Maybe<std::string>& val) +{ + this->CurrentString = &val; + this->CurrentList = nullptr; + this->ExpectValue = false; +} + void Instance::Bind(MaybeEmpty<std::vector<std::string>>& val) { this->CurrentString = nullptr; |