[#absl-CommandLineFlag]
= xref:absl.adoc[absl]::CommandLineFlag
:relfileprefix: ../
:mrdocs:

A type&hyphen;erased handle for an instance of an Abseil Flag and holds reflection information pertaining to that flag&period; Use `CommandLineFlag` to access a flag&apos;s name, location, help string etc&period;

== Synopsis

Declared in `&lt;absl&sol;flags&sol;commandlineflag&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CommandLineFlag;
----

== Description

To obtain an `absl&colon;&colon;CommandLineFlag`, invoke `absl&colon;&colon;FindCommandLineFlag()` passing it the flag name string&period;

Example&colon;

&sol;&sol; Obtain reflection handle for a flag named &quot;flagname&quot;&period; const absl&colon;&colon;CommandLineFlag&ast; my&lowbar;flag&lowbar;data &equals; absl&colon;&colon;FindCommandLineFlag(&quot;flagname&quot;)&semi;

&sol;&sol; Now you can get flag info from that reflection handle&period; std&colon;&colon;string flag&lowbar;location &equals; my&lowbar;flag&lowbar;data&hyphen;&gt;Filename()&semi; &period;&period;&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/CommandLineFlag/2constructor-0b.adoc[`CommandLineFlag`]         [.small]#[constructor]#
| Constructors
| xref:absl/CommandLineFlag/operator_assign.adoc[`operator&equals;`]  [.small]#[deleted]#
| Not assignable&period;
| xref:absl/CommandLineFlag/CurrentValue.adoc[`CurrentValue`]  [.small]#[virtual]#
| Returns the current value for this flag&period;
| xref:absl/CommandLineFlag/DefaultValue.adoc[`DefaultValue`]  [.small]#[virtual]#
| Returns the default value for this flag&period;
| xref:absl/CommandLineFlag/Filename.adoc[`Filename`]  [.small]#[virtual]#
| Returns name of the file where this flag is defined&period;
| xref:absl/CommandLineFlag/Help.adoc[`Help`]  [.small]#[virtual]#
| Returns help message associated with this flag&period;
| xref:absl/CommandLineFlag/IsOfType.adoc[`IsOfType`] 
| Returns true if the flag has type `T`&period;
| xref:absl/CommandLineFlag/IsRetired.adoc[`IsRetired`]  [.small]#[virtual]#
| Returns true iff this object corresponds to retired flag&period;
| xref:absl/CommandLineFlag/Name.adoc[`Name`]  [.small]#[virtual]#
| Returns name of this flag&period;
| xref:absl/CommandLineFlag/ParseFrom.adoc[`ParseFrom`] 
| Sets the value of the flag based on specified string `value`&period; If the flag was successfully set to new value, it returns true&period; Otherwise, sets `error` to indicate the error, leaves the flag unchanged, and returns false&period;
| xref:absl/CommandLineFlag/TryGet.adoc[`TryGet`] 
| Attempts to retrieve the flag value&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/CommandLineFlag/2destructor.adoc[`&#126;CommandLineFlag`] [.small]#[destructor]#
| Destroys this handle&period; Protected so only derived types may be destroyed&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:absl/FindCommandLineFlag.adoc[`FindCommandLineFlag`]
| Returns the reflection handle of an Abseil flag of the specified name, or `nullptr` if not found&period; This function will emit a warning if the name of a &apos;retired&apos; flag is specified&period;
| xref:absl/GetFlagReflectionHandle.adoc[`GetFlagReflectionHandle`]
| Returns the reflection handle corresponding to specified Abseil Flag instance&period; Use this handle to access flag&apos;s reflection information, like name, location, default value etc&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
