Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
clara::detail Namespace Reference

Classes

class  Arg
 
class  Args
 
class  BasicResult
 
struct  BoundFlagLambda
 
struct  BoundFlagRef
 
struct  BoundFlagRefBase
 
struct  BoundLambda
 
struct  BoundRef
 
struct  BoundValueRef
 
struct  BoundValueRef< std::vector< T > >
 
struct  BoundValueRefBase
 
class  ComposableParserImpl
 
class  ExeName
 
struct  Help
 
struct  HelpColumns
 
struct  LambdaInvoker
 
struct  LambdaInvoker< void >
 
struct  NonCopyable
 
class  Opt
 
struct  Parser
 
class  ParserBase
 
class  ParserRefImpl
 
class  ParseState
 
class  ResultBase
 
class  ResultValueBase
 
class  ResultValueBase< void >
 
struct  Token
 
class  TokenStream
 
struct  UnaryLambdaTraits
 
struct  UnaryLambdaTraits< ReturnT(ClassT::*)(Args...) const >
 
struct  UnaryLambdaTraits< ReturnT(ClassT::*)(ArgT) const >
 

Typedefs

using Result = BasicResult<void>
 
using ParserResult = BasicResult<ParseResultType>
 
using InternalParseResult = BasicResult<ParseState>
 

Enumerations

enum class  TokenType { Option , Argument }
 
enum class  ParseResultType { Matched , NoMatch , ShortCircuitAll , ShortCircuitSame }
 
enum class  Optionality { Optional , Required }
 

Functions

auto isOptPrefix (char c) -> bool
 
template<typename T >
auto convertInto (std::string const &source, T &target) -> ParserResult
 
auto convertInto (std::string const &source, std::string &target) -> ParserResult
 
auto convertInto (std::string const &source, bool &target) -> ParserResult
 
template<typename ArgType , typename L >
auto invokeLambda (L const &lambda, std::string const &arg) -> ParserResult
 
auto normaliseOpt (std::string const &optName) -> std::string
 

Typedef Documentation

◆ InternalParseResult

◆ ParserResult

◆ Result

Definition at line 645 of file clara.hpp.

Enumeration Type Documentation

◆ Optionality

Enumerator
Optional 
Required 

Definition at line 805 of file clara.hpp.

805{ Optional, Required };
Unary< NodeType::optional > Optional
Definition Regexp.cpp:53

◆ ParseResultType

Enumerator
Matched 
NoMatch 
ShortCircuitAll 
ShortCircuitSame 

Definition at line 625 of file clara.hpp.

625 {
626 Matched, NoMatch, ShortCircuitAll, ShortCircuitSame
627 };

◆ TokenType

Enumerator
Option 
Argument 

Definition at line 430 of file clara.hpp.

430 {
431 Option, Argument
432 };

Function Documentation

◆ convertInto() [1/3]

auto clara::detail::convertInto ( std::string const & source,
bool & target ) -> ParserResult
inline

Definition at line 668 of file clara.hpp.

668 {
669 std::string srcLC = source;
670 std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
671 if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
672 target = true;
673 else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
674 target = false;
675 else
676 return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
677 return ParserResult::ok( ParseResultType::Matched );
678 }
const CharType(& source)[N]
Definition pointer.h:1204
Here is the call graph for this function:

◆ convertInto() [2/3]

auto clara::detail::convertInto ( std::string const & source,
std::string & target ) -> ParserResult
inline

Definition at line 664 of file clara.hpp.

664 {
665 target = source;
666 return ParserResult::ok( ParseResultType::Matched );
667 }
Here is the call graph for this function:

◆ convertInto() [3/3]

template<typename T >
auto clara::detail::convertInto ( std::string const & source,
T & target ) -> ParserResult
inline

Definition at line 655 of file clara.hpp.

655 {
656 std::stringstream ss;
657 ss << source;
658 ss >> target;
659 if( ss.fail() )
660 return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" );
661 else
662 return ParserResult::ok( ParseResultType::Matched );
663 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invokeLambda()

template<typename ArgType , typename L >
auto clara::detail::invokeLambda ( L const & lambda,
std::string const & arg ) -> ParserResult
inline

Definition at line 770 of file clara.hpp.

770 {
771 ArgType temp{};
772 auto result = convertInto( arg, temp );
773 return !result
774 ? result
775 : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );
776 }
Here is the call graph for this function:

◆ isOptPrefix()

auto clara::detail::isOptPrefix ( char c) -> bool
inline

Definition at line 438 of file clara.hpp.

438 {
439 return c == '-'
440#ifdef CLARA_PLATFORM_WINDOWS
441 || c == '/'
442#endif
443 ;
444 }

◆ normaliseOpt()

auto clara::detail::normaliseOpt ( std::string const & optName) -> std::string
inline

Definition at line 951 of file clara.hpp.

951 {
952#ifdef CLARA_PLATFORM_WINDOWS
953 if( optName[0] == '/' )
954 return "-" + optName.substr( 1 );
955 else
956#endif
957 return optName;
958 }
Here is the caller graph for this function: