[#BloombergLP-balcl-TypeInfoUtil-parseAndValidate]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balcl.adoc[balcl]::xref:BloombergLP/balcl/TypeInfoUtil.adoc[TypeInfoUtil]::parseAndValidate
:relfileprefix: ../../../
:mrdocs:

Load into the specified `element` the result of parsing the specified `input` as a value of the `element&hyphen;&gt;type()`&period; Return `true` if `input` is parsed without error and the value satisfies the constraint of the specified `typeInfo` object (if any), and `false` with no effect on `element` otherwise&period; If the operation fails, a descriptive error message indicating the reason for the failure is written to the specified `stream&period; If `typeInfo&apos; holds no constraint that validation is considered `true`&semi; nevertheless, the parse might still fail due to problems with the input format&period; Optionally specify `inputSource` indicating the source of the option text being parsed&period; If `inputSource` is not provided, `input` is treated as if it came from the command line&period; `inputSource` is used in handling boolean options&period; Boolean options supplied by command line should not have associated text, where as boolean options supplied by the environment should have the values &quot;0&quot;, &quot;1&quot;, &quot;true&quot;, or &quot;false&quot;&period; The behavior is undefined unless `element&hyphen;&gt;type() &equals;&equals; typeInfo&period;type()`&period;

== Synopsis

Declared in `&lt;balcl&lowbar;typeinfo&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
bool
parseAndValidate(
    xref:BloombergLP/balcl/OptionValue.adoc[OptionValue]* element,
    std::string&lowbar;view const& input,
    xref:BloombergLP/balcl/TypeInfo.adoc[TypeInfo] const& typeInfo,
    std::ostream& stream,
    xref:BloombergLP/balcl/TypeInfo/ParseInputSource.adoc[TypeInfo::ParseInputSource] inputSource = TypeInfo&colon;&colon;e&lowbar;COMMAND&lowbar;LINE);
----


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