The Vish Visualization Shell 0.3
Vish
Public Member Functions | Public Attributes | List of all members
Wizt::FlagList Class Reference

A set of strings associated with a boolean, good to store true/false properties for each string. More...

#include <ocean/shrimp/VFlagList.hpp>

Inheritance diagram for Wizt::FlagList:

Public Member Functions

template<typename... Arguments>
bool addFlag (const string &Value, Arguments... parameters)
 Recursive handling of parameter pack.
 
bool contains (const string &flagvalue) const
 Check if a flag is contained here at all.
 
 FlagList ()
 Constructor, makes an empty list.
 
 FlagList (const string &s, const char sep=' ')
 Constructor, constructs from encoded string.
 
template<typename... Arguments>
 FlagList (const string &s1, const string &s2, Arguments... parameter_pack)
 Specify options as multiple arguments, each of them must be a string (or convertible to a string) and start with a + or - to indicate true or false for this item.
 
bool operator() (const string &flagvalue) const
 Shortcut version of flag testing, ignoring the found status.
 
bool operator() (const string &flagvalue, bool &found) const
 Get the current boolean value associated with a specific flag.
 
 ~FlagList ()
 Destructor, cleans up the list.
 

Public Attributes

bool default_value = false
 The default return value used when querying the flag of an string that is not contained in this list.
 

Detailed Description

A set of strings associated with a boolean, good to store true/false properties for each string.

Member Function Documentation

◆ operator()() [1/2]

bool Wizt::FlagList::operator() ( const string &  flagvalue) const
inline

Shortcut version of flag testing, ignoring the found status.

Use with care.

◆ operator()() [2/2]

bool Wizt::FlagList::operator() ( const string &  flagvalue,
bool &  found 
) const

Get the current boolean value associated with a specific flag.

If the flag is not found, then return the default_value. It is highly recommended to test the found flag.

References default_value.