OGLplus  (0.59.0) a C++ wrapper for rendering APIs

Class wrapping the main function arguments, providing a convenient API. More...

#include <eagine/program_args.hpp>

Public Types

using value_type = string_view
 Alias for the element value type.
 
using size_type = int
 Alias for the element count type.
 
using valid_index = valid_range_index< program_args >
 Alias for valid index type.
 
using iterator = program_arg_iterator
 Alias for iterator type.
 

Public Member Functions

 program_args () noexcept=default
 Default constructor. More...
 
 program_args (span_size_t argn, char **args) noexcept
 Construction from the length and pointer to the argument list.
 
 program_args (span_size_t argn, const char **args) noexcept
 Construction from the length and const pointer to the argument list.
 
auto argc () const noexcept -> int
 Returns the number of arguments.
 
auto argv () const noexcept -> const char **
 Returns a pointer to tha list of argument C-strings.
 
auto empty () const noexcept -> bool
 Indicates if the argument list is completely empty.
 
auto none () const noexcept -> bool
 Indicates if the argument list does not contain any arguments.
 
auto size () const noexcept -> int
 Returns the count of arguments (counting in the command name)
 
auto is_valid (const valid_index &pos) const noexcept -> bool
 Tests if the specified index references a command line argument.
 
auto get (const valid_index &pos) const noexcept -> value_type
 Returns the command line argument value at the specified position. More...
 
auto operator[] (const valid_index &pos) const noexcept -> value_type
 Returns the command line argument value at the specified position. More...
 
auto command () const noexcept -> value_type
 Returns the command name.
 
auto first () const noexcept -> program_arg
 Returns first argument.
 
auto begin () const noexcept -> iterator
 Returns an iterator to the first argument (not the command name).
 
auto end () const noexcept -> iterator
 Returns an iterator past the last argument.
 
auto find (string_view what) const noexcept -> program_arg
 Finds and returns the argument with the specified value.
 
template<typename T >
auto parse_param (program_parameter< T > &param, std::ostream &errlog) const -> bool
 Parses the specified parameter, using errlog for error output.
 

Detailed Description

Class wrapping the main function arguments, providing a convenient API.

Examples
eagine/bindump.cpp, eagine/shape_topology.cpp, and eagine/sudoku_solver.cpp.

Constructor & Destructor Documentation

◆ program_args()

eagine::program_args::program_args ( )
defaultnoexcept

Default constructor.

Postcondition
empty()

Member Function Documentation

◆ get()

auto eagine::program_args::get ( const valid_index pos) const -> value_type
inlinenoexcept

Returns the command line argument value at the specified position.

Precondition
is_valid(pos)

◆ operator[]()

auto eagine::program_args::operator[] ( const valid_index pos) const -> value_type
inlinenoexcept

Returns the command line argument value at the specified position.

Precondition
is_valid(pos)

The documentation for this class was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).