A type-erased handle for an instance of an Abseil Flag and holds reflection information pertaining to that flag. Use CommandLineFlag to access a flag's name, location, help string etc.
Declared in <absl/flags/commandlineflag.h>
class CommandLineFlag;
To obtain an absl::CommandLineFlag, invoke absl::FindCommandLineFlag() passing it the flag name string.
Example:
// Obtain reflection handle for a flag named "flagname". const absl::CommandLineFlag* my_flag_data = absl::FindCommandLineFlag("flagname");
// Now you can get flag info from that reflection handle. std::string flag_location = my_flag_data->Filename(); ...
| Name | Description |
|---|---|
CommandLineFlag [constructor] | Constructors |
operator= [deleted] | Not assignable. |
CurrentValue [virtual] | Returns the current value for this flag. |
DefaultValue [virtual] | Returns the default value for this flag. |
Filename [virtual] | Returns name of the file where this flag is defined. |
Help [virtual] | Returns help message associated with this flag. |
IsOfType | Returns true if the flag has type T. |
IsRetired [virtual] | Returns true iff this object corresponds to retired flag. |
Name [virtual] | Returns name of this flag. |
ParseFrom | 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. |
TryGet | Attempts to retrieve the flag value. |
| Name | Description |
|---|---|
~CommandLineFlag [destructor] | Destroys this handle. Protected so only derived types may be destroyed. |
| Name | Description |
|---|---|
FindCommandLineFlag | Returns the reflection handle of an Abseil flag of the specified name, or nullptr if not found. This function will emit a warning if the name of a 'retired' flag is specified. |
GetFlagReflectionHandle | Returns the reflection handle corresponding to specified Abseil Flag instance. Use this handle to access flag's reflection information, like name, location, default value etc. |