Bash++
Bash++ compiler internal documentation
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
XGetOpt::OptionSequence Class Reference

Represents a sequence of parsed options and non-option arguments. More...

#include <xgetopt.h>

Public Member Functions

void addOption (const ParsedOption &opt)
 
void addNonOptionArgument (std::string_view arg)
 
OptionSequenceoperator+= (const OptionSequence &rhs)
 
auto begin () const
 
auto end () const
 
size_t size () const
 
bool empty () const
 
const ParsedOptionoperator[] (size_t index) const
 
const ParsedOptionat (size_t index) const
 
bool hasOption (int shortopt) const
 Check if an option with the given shortopt was provided.
 
const std::vector< std::string_view > & getNonOptionArguments () const
 Get a std::vector of all non-option arguments provided, in the order they were given.
 

Private Member Functions

void add (const OptionSequence &other)
 Add another OptionSequence to this one.
 

Private Attributes

std::vector< ParsedOptionoptions
 
std::vector< std::string_view > nonOptionArguments
 

Friends

OptionSequence operator+ (OptionSequence lhs, const OptionSequence &rhs)
 

Detailed Description

Represents a sequence of parsed options and non-option arguments.

Member Function Documentation

◆ add()

void XGetOpt::OptionSequence::add ( const OptionSequence other)
inlineprivate

Add another OptionSequence to this one.

The options and non-option arguments from the other sequence are appended to this one. This is accessible via operator+= and operator+.

Parameters
otherThe other OptionSequence to add

◆ addNonOptionArgument()

void XGetOpt::OptionSequence::addNonOptionArgument ( std::string_view  arg)
inline

◆ addOption()

void XGetOpt::OptionSequence::addOption ( const ParsedOption opt)
inline

◆ at()

const ParsedOption & XGetOpt::OptionSequence::at ( size_t  index) const
inline

◆ begin()

auto XGetOpt::OptionSequence::begin ( ) const
inline

◆ empty()

bool XGetOpt::OptionSequence::empty ( ) const
inline

◆ end()

auto XGetOpt::OptionSequence::end ( ) const
inline

◆ getNonOptionArguments()

const std::vector< std::string_view > & XGetOpt::OptionSequence::getNonOptionArguments ( ) const
inline

Get a std::vector of all non-option arguments provided, in the order they were given.

Returns
const std::vector<std::string_view>& The vector of non-option arguments

◆ hasOption()

bool XGetOpt::OptionSequence::hasOption ( int  shortopt) const
inline

Check if an option with the given shortopt was provided.

Parameters
shortoptThe shortopt character or unique integer identifier to check for
Returns
true if the option was provided
false if the option was not provided

◆ operator+=()

OptionSequence & XGetOpt::OptionSequence::operator+= ( const OptionSequence rhs)
inline

◆ operator[]()

const ParsedOption & XGetOpt::OptionSequence::operator[] ( size_t  index) const
inline

◆ size()

size_t XGetOpt::OptionSequence::size ( ) const
inline

Friends And Related Symbol Documentation

◆ operator+

OptionSequence operator+ ( OptionSequence  lhs,
const OptionSequence rhs 
)
friend

Member Data Documentation

◆ nonOptionArguments

std::vector<std::string_view> XGetOpt::OptionSequence::nonOptionArguments
private

◆ options

std::vector<ParsedOption> XGetOpt::OptionSequence::options
private

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