Sharg 1.1.2-rc.1
The argument parser for bio-c++ tools.
Loading...
Searching...
No Matches
sharg::detail::id_pair Struct Reference

A simple struct to store a short and a long identifier for an option. More...

#include <sharg/detail/id_pair.hpp>

Public Member Functions

 id_pair ()=default
 Defaulted.
 
 id_pair (id_pair const &)=default
 Defaulted.
 
id_pairoperator= (id_pair const &)=default
 Defaulted.
 
 id_pair (id_pair &&)=default
 Defaulted.
 
id_pairoperator= (id_pair &&)=default
 Defaulted.
 
 ~id_pair ()=default
 Defaulted.
 
 id_pair (char const short_id)
 Construct an id_pair from a short ID.
 
 id_pair (std::string long_id)
 Construct an id_pair from a long ID.
 
 id_pair (char const short_id, std::string long_id)
 Construct an id_pair from a short and long ID.
 
bool empty_short_id () const noexcept
 Returns true if the short ID is empty.
 
bool empty_long_id () const noexcept
 Returns true if the long ID is empty.
 
bool empty () const noexcept
 Returns true if both IDs are empty.
 

Static Public Member Functions

template<typename id_type >
static bool empty (id_type const &id) noexcept
 Checks whether id is empty.
 
template<typename id_type >
static auto find (std::unordered_set< id_pair > const &used_ids, id_type const &id)
 Finds an id_pair in a set of used ids.
 
template<typename id_type >
static bool contains (std::unordered_set< id_pair > const &used_ids, id_type const &id)
 Checks whether an id is already contained in a set of used ids.
 

Public Attributes

char short_id {}
 The short identifier for the option.
 
std::string long_id {}
 The long identifier for the option.
 

Friends

bool operator== (id_pair const &lhs, id_pair const &rhs)
 Two id_pairs are equal if their short or long ID is equal. Empty IDs are not considered for equality. If both IDs are empty, the id_pairs are considered not equal.
 
bool operator== (id_pair const &lhs, char const &rhs)
 Compares the given short ID with the short ID of the id_pair. Returns false if the id_pair's short ID is empty.
 
bool operator== (id_pair const &lhs, std::string const &rhs)
 Compares the given long ID with the long ID of the id_pair. Returns false if the id_pair's long ID is empty.
 

Detailed Description

A simple struct to store a short and a long identifier for an option.


The documentation for this struct was generated from the following file:
Hide me