ewmscp  ..
Public Member Functions | Protected Attributes | List of all members
options::internal::baseForMap< T > Class Template Reference

This class is an intermediate helper class for options that are map-based. More...

#include <Options.h>

Inheritance diagram for options::internal::baseForMap< T >:
[legend]
Collaboration diagram for options::internal::baseForMap< T >:
[legend]

Public Member Functions

 baseForMap (char aShortName, std::string aLongName, std::string aExplanation, short aNargs)
 
void fAddSource (const T *aValueLocation, const internal::sourceItem &aSource)
 
const internal::sourceItem fGetSource (const T *aValueLocation) const
 
bool fIsSet () const override
 check if this option was set, regardless of from command line or config file More...
 
bool fIsContainer () const override
 
void fAddDefaultFromStream (std::istream &aStream) override
 special for use in the shellScriptOptionParser More...
 
- Public Member Functions inherited from options::internal::typed_base< T >
 typed_base (Types ... args)
 
virtual void fAddToRange (rangeValueType aValue)
 add a value to the range of allowed values More...
 
std::enable_if<(!std::is_same< rangeValueType, std::string >::value) &&std::is_same< TT, std::string >::value, void >::type fAddToRange (const TT &aString)
 
void fAddToRange (InputIt aBegin, InputIt aEnd)
 add values from the iterator range [aBegin,aEnd) to the range of allowed values More...
 
void fAddToRange (const std::vector< TT > &aRange)
 add values from a vector (may be given as initializer list) to the range of allowed values More...
 
void fAddToRangeFromStream (std::istream &aStream) override
 
void fWriteRange (std::ostream &aStream) const override
 
virtual void fCheckValueForRange (const compareValueType &aValue) const
 
- Public Member Functions inherited from options::base
 base (char aShortName, const std::string &aLongName, const std::string &aExplanation, short aNargs)
 construct an object of type base More...
 
virtual ~base ()
 
virtual void fWriteValue (std::ostream &aStream) const =0
 write textual representation of value to a std::ostream More...
 
virtual void fRequire (const base *aOtherOption)
 require aOtherOption when this option is set More...
 
virtual void fRequire (std::vector< const base * > aOtherOptions)
 add vector of other options, particlularly nice for use with initializer list More...
 
template<typename InputIt >
void fRequire (InputIt aBegin, InputIt aEnd)
 add all options from the pair of iterators [aBegin,aEnd) to the list of required options More...
 
virtual void fForbid (const base *aOtherOption)
 forbid aOtherOption when this option is set More...
 
virtual void fForbid (std::vector< const base * > aOtherOptions)
 add vector of other options, particlularly nice for use with initializer list More...
 
template<typename InputIt >
void fForbid (InputIt aBegin, InputIt aEnd)
 add all options from the pair of iterators [aBegin,aEnd) to the list of forbidden options More...
 
const std::string & fGetLongName () const
 returns long name of option, usually only for internal use. More...
 

Protected Attributes

std::map< const T *, const internal::sourceItemlSources
 
- Protected Attributes inherited from options::internal::typed_base< T >
std::multiset< rangeValueTypelRange
 
- Protected Attributes inherited from options::base
char lShortName
 
const std::string lLongName
 
const std::string lExplanation
 
internal::sourceItem lSource
 
short lNargs
 
bool lHidden
 
std::vector< std::string > * lPreserveWorthyStuff
 
std::vector< const base * > lRequiredOptions
 
std::vector< const base * > lForbiddenOptions
 

Additional Inherited Members

- Public Types inherited from options::internal::typed_base< T >
typedef T valueType
 
typedef std::conditional< std::is_same< T, const char * >::value||false, std::string, T >::type rangeValueType
 
typedef std::conditional< false, std::string, T >::type compareValueType
 
- Protected Member Functions inherited from options::base
virtual void fSetMe (std::istream &aStream, const internal::sourceItem &aSource)=0
 function to set the value from a string, remembering the source More...
 
virtual void fSetMeNoarg (const internal::sourceItem &)
 
virtual void fSetSource (const internal::sourceItem &aSource)
 remember the source that provided the value, e.g. commandline or a config file More...
 
virtual void fWriteCfgLines (std::ostream &aStream, const char *aPrefix) const
 
virtual void fCheckRange () const =0
 
void fSetPreserveWorthyStuff (std::vector< std::string > *aStuff)
 
void fHide ()
 hide option, will be respected by help More...
 
bool fIsHidden () const
 
void fDisable ()
 disable option by removing it from the maps More...
 
- Static Protected Member Functions inherited from options::base
static std::map< std::string, base * > & fGetOptionMap ()
 
static std::map< char, base * > & fGetShortOptionMap ()
 

Detailed Description

template<typename T>
class options::internal::baseForMap< T >

This class is an intermediate helper class for options that are map-based.

It is not to be used directly.

Definition at line 633 of file Options.h.

Constructor & Destructor Documentation

◆ baseForMap()

template<typename T >
options::internal::baseForMap< T >::baseForMap ( char  aShortName,
std::string  aLongName,
std::string  aExplanation,
short  aNargs 
)
inline

Definition at line 637 of file Options.h.

637  :
638  typed_base<T>(aShortName, aLongName, aExplanation, aNargs) {};

Member Function Documentation

◆ fAddDefaultFromStream()

template<typename T >
void options::internal::baseForMap< T >::fAddDefaultFromStream ( std::istream &  aStream)
inlineoverridevirtual

special for use in the shellScriptOptionParser

read a value from aStram and set that as default

Implements options::base.

Definition at line 656 of file Options.h.

656  {
657  aStream.ignore(std::numeric_limits<std::streamsize>::max(), ' ');
658  this->fSetMe(aStream, internal::sourceItem());
659  };

◆ fAddSource()

template<typename T >
void options::internal::baseForMap< T >::fAddSource ( const T *  aValueLocation,
const internal::sourceItem aSource 
)
inline

Definition at line 639 of file Options.h.

639  {
640  lSources.insert(std::make_pair(aValueLocation, aSource));
641  };

Referenced by options::map< T >::fSetMe().

Here is the caller graph for this function:

◆ fGetSource()

template<typename T >
const internal::sourceItem options::internal::baseForMap< T >::fGetSource ( const T *  aValueLocation) const
inline

Definition at line 642 of file Options.h.

642  {
643  auto it = lSources.find(aValueLocation);
644  if (it != lSources.end()) {
645  return it->second;
646  } else {
647  return internal::sourceItem();
648  }
649  };

Referenced by options::map< T >::fWriteCfgLines().

Here is the caller graph for this function:

◆ fIsContainer()

template<typename T >
bool options::internal::baseForMap< T >::fIsContainer ( ) const
inlineoverridevirtual

Reimplemented from options::base.

Definition at line 653 of file Options.h.

653  {
654  return true;
655  };

◆ fIsSet()

template<typename T >
bool options::internal::baseForMap< T >::fIsSet ( ) const
inlineoverridevirtual

check if this option was set, regardless of from command line or config file

Reimplemented from options::base.

Definition at line 650 of file Options.h.

650  {
651  return ! lSources.empty();
652  };

Member Data Documentation

◆ lSources

template<typename T >
std::map<const T*, const internal::sourceItem> options::internal::baseForMap< T >::lSources
protected

The documentation for this class was generated from the following file:
options::base::fSetMe
virtual void fSetMe(std::istream &aStream, const internal::sourceItem &aSource)=0
function to set the value from a string, remembering the source
options::internal::baseForMap::lSources
std::map< const T *, const internal::sourceItem > lSources
Definition: Options.h:635