IValue< nam, cnst, T > Struct Template Referenceabstract

A leaf that holds a value. More...

#include "IOption.hpp"

+ Inheritance diagram for IValue< nam, cnst, T >:

Public Types

using Name = NameT< nam >
 
using Node = NodeT< Nodes::value >
 

Public Member Functions

virtual UsageLevel usageLevel () const =0
 Frequency / expected skills of users that access this leaf.
 
virtual ValueSource valueSource () const =0
 The context in which the value has been set.
 
virtual bool empty () const =0
 If its value has not been set, a leaf is considered empty. More...
 
virtual operator bool () const =0
 Returns !empty()
 
virtual const T & get () const =0
 Get the value.
 
virtual T getOr (T &&default_) const =0
 Get the value or default_ if empty.
 
virtual const T & getOr (const T &default_) const =0
 
- Public Member Functions inherited from IBase
virtual Names enumerator () const =0
 The option name as enumerator.
 
virtual String name () const =0
 The option name as string.
 
virtual String path () const =0
 The option name as string, preceded by the names of its parents, if any, interspersed with '.'.
 
virtual String shortDescription () const =0
 One-liner that describes this option.
 
virtual String longDescription () const =0
 Longer text that describes this option in more detail.
 
virtual UsageLevel minUsageLevel () const =0
 For a leaf, this is its own usage level. Otherwise, this is the minimum usage level of all descendants: basic < mid < pro.
 
virtual Nodes node () const =0
 The node type of this option.
 

Detailed Description

template<Names nam, bool cnst, class T>
struct opals::opts::IValue< nam, cnst, T >

A leaf that holds a value.

Template Parameters
namThe value name.
cnstIf true, then the value may not be changed.
TThe value type.

Member Function Documentation

◆ empty()

virtual bool empty ( ) const
pure virtual

If its value has not been set, a leaf is considered empty.

Accessing its value then raises an exception.