Option++  2.0
C++ library for reading command-line options
Namespaces | Classes | Typedefs | Functions
optionpp Namespace Reference

Library namespace. More...

Namespaces

 utility
 Namespace for utility functions.
 

Classes

class  bad_dereference
 Exception indicating an invalid iterator was dereferenced. More...
 
class  error
 Base class for library exceptions. More...
 
class  option
 Describes a valid program command-line option. More...
 
class  option_group
 Holds a group of program options. More...
 
class  out_of_range
 Exception indicating out of range access. More...
 
class  parse_error
 Exception class indicating an invalid option. More...
 
struct  parsed_entry
 Holds data parsed from the command line. More...
 
class  parser
 Parses program options. More...
 
class  parser_result
 Holds data that was parsed from the program command line. More...
 
class  result_iterator
 Iterator over parser_result arguments. More...
 
class  type_error
 Exception indicating a type error. More...
 

Typedefs

using option_iterator = result_iterator< parser_result, parsed_entry *, parsed_entry &, true >
 Iterator over option entries in a parser_result.
 
using option_const_iterator = result_iterator< const parser_result, const parsed_entry *, const parsed_entry &, true >
 const_iterator over non-option entries in a parser_result.
 
using non_option_iterator = result_iterator< parser_result, parsed_entry *, parsed_entry &, false >
 Iterator over non-option entries in a parser_result.
 
using non_option_const_iterator = result_iterator< const parser_result, const parsed_entry *, const parsed_entry &, false >
 const_iterator over non-option entries in a parser_result.
 

Functions

std::ostream & operator<< (std::ostream &os, const parser &parser)
 Output operator. More...
 
template<typename T , typename Ptr , typename Ref , bool IsOption>
result_iterator< T, Ptr, Ref, IsOption > begin (result_iterator< T, Ptr, Ref, IsOption > it) noexcept
 begin function for range for loop support. More...
 
template<typename T , typename Ptr , typename Ref , bool IsOption>
result_iterator< T, Ptr, Ref, IsOption > end (const result_iterator< T, Ptr, Ref, IsOption > &) noexcept
 end function for range for loop support. More...
 

Detailed Description

Library namespace.

This namespace encloses all Option++ library definitions.

Function Documentation

◆ begin()

template<typename T , typename Ptr , typename Ref , bool IsOption>
result_iterator<T, Ptr, Ref, IsOption> optionpp::begin ( result_iterator< T, Ptr, Ref, IsOption >  it)
inlinenoexcept

begin function for range for loop support.

Parameters
itA non_option_iterator.
Returns
The unchanged iterator it

◆ end()

template<typename T , typename Ptr , typename Ref , bool IsOption>
result_iterator<T, Ptr, Ref, IsOption> optionpp::end ( const result_iterator< T, Ptr, Ref, IsOption > &  )
inlinenoexcept

end function for range for loop support.

Returns
The end iterator.

◆ operator<<()

std::ostream & optionpp::operator<< ( std::ostream &  os,
const parser parser 
)

Output operator.

Writes program help text to an output stream using the default options for printing. For finer control, use parser::print_help.

By default, options are presented in the same order that they were inserted within each group. If desired, you can call parser::sort_options first to sort by name.

Parameters
osOutput stream to write output to.
parserParser containing the program option information.
Returns
The given output stream.