kaycxx-cli
C++ CLI library
Loading...
Searching...
No Matches
Concepts | Functions
parse_value.hpp File Reference

Defines value parsing support used by typed options and positional parameters. More...

#include <charconv>
#include <concepts>
#include <exception>
#include <format>
#include <string_view>
#include <system_error>
#include <type_traits>
#include <kaycxx/cli/parse_error.hpp>
Include dependency graph for parse_value.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Concepts

concept  kaycxx::cli::from_chars_parseable
 Checks whether a type can be parsed with std::from_chars.
 
concept  kaycxx::cli::string_view_constructible
 Checks whether a type can be constructed from std::string_view.
 
concept  kaycxx::cli::from_string_parseable
 Checks whether a type can be parsed with an ADL-discovered from_string function.
 
concept  kaycxx::cli::parseable_value
 Checks whether a type can be used as a command line value.
 

Functions

template<parseable_value T>
T kaycxx::cli::detail::parse_value (std::string_view text)
 Parses a command line value.
 

Detailed Description

Defines value parsing support used by typed options and positional parameters.

Function Documentation

◆ parse_value()

template<parseable_value T>
T kaycxx::cli::detail::parse_value ( std::string_view  text)

Parses a command line value.

Parsing tries std::from_chars first, then ADL from_string, and finally construction from std::string_view.

Template Parameters
TValue type to parse.
Parameters
textValue text to parse.
Returns
Parsed value.
Exceptions
parse_errorWhen the value is syntactically invalid.