summaryrefslogtreecommitdiff
path: root/absl/flags/internal/commandlineflag.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2020-05-06 14:06:16 -0700
committerGravatar vslashg <gfalcon@google.com>2020-05-06 17:14:07 -0400
commitbd317cae3bc2630d1b12c5f1d77036e937d1d725 (patch)
tree8a125c0d0d0fe107ee6e52a770b0b986aa15ff83 /absl/flags/internal/commandlineflag.h
parentb115744656b16bd35014f22293b87f2edcffde74 (diff)
Export of internal Abseil changes
-- 0b3113ff8d252be11c35d8a77cdb23cc03e993d2 by Benjamin Barenblat <bbaren@google.com>: Correct Apache license headers These files have always been licensed under the Apache license (per the repository LICENSE), but they lacked headers to locally indicate that fact. Add the appropriate headers. PiperOrigin-RevId: 310223650 -- 4f92b0819781279c02b48bcfce4c10d547e35a49 by Greg Falcon <gfalcon@google.com>: Internal change PiperOrigin-RevId: 310223203 -- 378cab69ce3290d20b48d839daa988c3e63ed031 by Matthew Brown <matthewbr@google.com>: Internal Change PiperOrigin-RevId: 310180198 -- 93a1851be0f3726f7435cef56afaa1b8664f40e7 by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 310003669 -- fbee3221cb1f8717fdf34e1cc0ea248a7719227a by Gennadiy Rozental <rogeeff@google.com>: Make 4 argument version of ParseFrom interface private in CommandLineFlag. Instroduce 2 argument version of this interface. PiperOrigin-RevId: 309995363 GitOrigin-RevId: 0b3113ff8d252be11c35d8a77cdb23cc03e993d2 Change-Id: Ibfdf948d3d081f5630ce7ebff992ab85c75cecba
Diffstat (limited to 'absl/flags/internal/commandlineflag.h')
-rw-r--r--absl/flags/internal/commandlineflag.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/absl/flags/internal/commandlineflag.h b/absl/flags/internal/commandlineflag.h
index f60204dd..af5e05d5 100644
--- a/absl/flags/internal/commandlineflag.h
+++ b/absl/flags/internal/commandlineflag.h
@@ -140,6 +140,17 @@ class CommandLineFlag {
// Sets the value of the flag based on specified string `value`. If the flag
// was successfully set to new value, it returns true. Otherwise, sets `error`
+ // to indicate the error, leaves the flag unchanged, and returns false.
+ bool ParseFrom(absl::string_view value, std::string* error);
+
+ protected:
+ ~CommandLineFlag() = default;
+
+ private:
+ friend class PrivateHandleInterface;
+
+ // Sets the value of the flag based on specified string `value`. If the flag
+ // was successfully set to new value, it returns true. Otherwise, sets `error`
// to indicate the error, leaves the flag unchanged, and returns false. There
// are three ways to set the flag's value:
// * Update the current flag value
@@ -151,12 +162,6 @@ class CommandLineFlag {
flags_internal::ValueSource source,
std::string* error) = 0;
- protected:
- ~CommandLineFlag() = default;
-
- private:
- friend class PrivateHandleInterface;
-
// Returns id of the flag's value type.
virtual FlagFastTypeId TypeId() const = 0;
@@ -168,7 +173,6 @@ class CommandLineFlag {
// the dst based on the current flag's value.
virtual void Read(void* dst) const = 0;
- // Interfaces to operate on validators.
// Validates supplied value usign validator or parseflag routine
virtual bool ValidateInputValue(absl::string_view value) const = 0;
@@ -194,6 +198,10 @@ class PrivateHandleInterface {
// Access to CommandLineFlag::CheckDefaultValueParsingRoundtrip.
static void CheckDefaultValueParsingRoundtrip(const CommandLineFlag& flag);
+
+ static bool ParseFrom(CommandLineFlag* flag, absl::string_view value,
+ flags_internal::FlagSettingMode set_mode,
+ flags_internal::ValueSource source, std::string* error);
};
// This macro is the "source of truth" for the list of supported flag built-in