C++ Utilities 5.24.7
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
CppUtilities::ArgumentOccurrence Struct Reference

The ArgumentOccurrence struct holds argument values for an occurrence of an argument. More...

#include <argumentparser.h>

Collaboration diagram for CppUtilities::ArgumentOccurrence:
[legend]

Public Member Functions

 ArgumentOccurrence (std::size_t index)
 Constructs an argument occurrence for the specified index.
 
 ArgumentOccurrence (std::size_t index, const std::vector< Argument * > parentPath, Argument *parent)
 Constructs an argument occurrence.
 
template<typename... RemainingTargetTypes>
std::tuple< RemainingTargetTypes... > convertValues () const
 Converts the present values to the specified target types.
 

Public Attributes

std::size_t index
 The index of the occurrence.
 
std::vector< const char * > values
 The parameter values which have been specified after the occurrence of the argument.
 
std::vector< Argument * > path
 The "path" of the occurrence (the parent elements which have been specified before).
 

Detailed Description

The ArgumentOccurrence struct holds argument values for an occurrence of an argument.

Definition at line 194 of file argumentparser.h.

Constructor & Destructor Documentation

◆ ArgumentOccurrence() [1/2]

CppUtilities::ArgumentOccurrence::ArgumentOccurrence ( std::size_t index)
inline

Constructs an argument occurrence for the specified index.

Definition at line 241 of file argumentparser.h.

◆ ArgumentOccurrence() [2/2]

CppUtilities::ArgumentOccurrence::ArgumentOccurrence ( std::size_t index,
const std::vector< Argument * > parentPath,
Argument * parent )
inline

Constructs an argument occurrence.

Parameters
indexSpecifies the index.
parentPathSpecifies the path of parent.
parentSpecifies the parent which might be nullptr for top-level occurrences.

The path of the new occurrence is built from the specified parentPath and parent.

Definition at line 254 of file argumentparser.h.

Member Function Documentation

◆ convertValues()

template<typename... RemainingTargetTypes>
std::tuple< RemainingTargetTypes... > CppUtilities::ArgumentOccurrence::convertValues ( ) const

Converts the present values to the specified target types.

There must be as many values present as types are specified.

Exceptions
ThrowsArgumentUtilities::Failure when the number of present values is not sufficient or a conversion error occurs.
Remarks
Still experimental. Might be removed/adjusted in next minor release.

Definition at line 225 of file argumentparser.h.

Member Data Documentation

◆ index

std::size_t CppUtilities::ArgumentOccurrence::index

The index of the occurrence.

This is not necessarily the index in the argv array.

Definition at line 201 of file argumentparser.h.

◆ path

std::vector<Argument *> CppUtilities::ArgumentOccurrence::path

The "path" of the occurrence (the parent elements which have been specified before).

Remarks
Empty for top-level occurrences.

Definition at line 212 of file argumentparser.h.

◆ values

std::vector<const char *> CppUtilities::ArgumentOccurrence::values

The parameter values which have been specified after the occurrence of the argument.

Definition at line 206 of file argumentparser.h.


The documentation for this struct was generated from the following files: