Classes | Macros
Option Parsing

Classes

struct  OptionContext
 Information about the nested operations being performed by the parser, for use in printing errors. A default-constructed OptionContext is printed as an empty string. This struct is primarily used as an argument to PARSE_ERROR for reporting input file parsing errors. Users outside of the core option parsing code should not need to manipulate the contents. More...
 
class  Option
 The type that options are passed around as. Contains YAML node data and an OptionContext. More...
 
struct  create_from_yaml< T >
 Used by the parser to create an object. The default action is to parse options using T::options. This struct may be specialized to change that behavior for specific types. More...
 
class  Options< OptionList >
 Class that handles parsing an input file. More...
 

Macros

#define PARSE_ERROR(context, m)
 Like ERROR("\n" << (context) << m), but instead throws an exception that will be caught in a higher level Options if not passed a top-level context. This is used to print a parsing "backtrace" since we can't pass any extra data through the yaml-cpp code. More...
 

Detailed Description

Things related to parsing YAML input files.

Macro Definition Documentation

◆ PARSE_ERROR

#define PARSE_ERROR (   context,
 
)
Value:
do { \
if ((context).top_level) { \
/* clang-tidy: macro arg in parentheses */ \
ERROR("\n" << (context) << m); /* NOLINT */ \
} else { \
std::ostringstream avoid_name_collisions_PARSE_ERROR; \
/* clang-tidy: macro arg in parentheses */ \
avoid_name_collisions_PARSE_ERROR << (context) << m; /* NOLINT */ \
throw Options_detail::propagate_context( \
avoid_name_collisions_PARSE_ERROR.str()); \
} \
} while (false)

Like ERROR("\n" << (context) << m), but instead throws an exception that will be caught in a higher level Options if not passed a top-level context. This is used to print a parsing "backtrace" since we can't pass any extra data through the yaml-cpp code.

Parameters
contextOptionContext used to print a parsing traceback
merror message, as for ERROR