ewmscp  ..
Public Member Functions | List of all members
options::internal::OptionReadCfgFile< mayBeMissing > Class Template Reference

special derived class used to read in config files More...

Inheritance diagram for options::internal::OptionReadCfgFile< mayBeMissing >:
[legend]
Collaboration diagram for options::internal::OptionReadCfgFile< mayBeMissing >:
[legend]

Public Member Functions

 OptionReadCfgFile (const char *name, const char *description)
 
void fSetMe (std::istream &aStream, const sourceItem &aSource) override
 function to set the value from a string, remembering the source More...
 
void fWriteCfgLines (std::ostream &aStream, const char *) const override
 
- Public Member Functions inherited from options::single< std::string >
 single (char aShortName, const std::string &aLongName, const std::string &aExplanation, std::string aDefault, const std::vector< std::string > &aRange={})
 construct an object of single<T> More...
 
 single (char aShortName, const std::string &aLongName, const std::string &aExplanation)
 
 single (const single &)=delete
 
std::string operator= (const std::string &aValue)
 
void fAddDefaultFromStream (std::istream &aStream) override
 special for use in the shellScriptOptionParser More...
 
void fWriteValue (std::ostream &aStream) const override
 write textual representation of value to a std::ostream More...
 
void fCheckRange () const override
 
void fSetMe (std::istream &aStream, const internal::sourceItem &aSource) override
 function to set the value from a string, remembering the source More...
 
const std::string & fGetValue () const
 
- Public Member Functions inherited from options::internal::typed_base< std::string >
 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 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...
 
virtual bool fIsSet () const
 check if this option was set, regardless of from command line or config file More...
 
virtual bool fIsContainer () const
 
const std::string & fGetLongName () const
 returns long name of option, usually only for internal use. More...
 

Additional Inherited Members

- Public Types inherited from options::single< std::string >
typedef std::conditional< std::is_fundamental< std::string >::value||std::is_same< std::string, const char * >::value, fundamental_wrapper< std::string >, std::string >::type deriveFromType
 
- Public Types inherited from options::internal::typed_base< std::string >
typedef std::string valueType
 
typedef std::conditional< std::is_same< std::string, const char * >::value||false, std::string, std::string >::type rangeValueType
 
typedef std::conditional< false, std::string, std::string >::type compareValueType
 
- Protected Member Functions inherited from options::base
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 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 ()
 
- Protected Attributes inherited from options::internal::typed_base< std::string >
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
 

Detailed Description

template<bool mayBeMissing>
class options::internal::OptionReadCfgFile< mayBeMissing >

special derived class used to read in config files

Definition at line 969 of file Options.cpp.

Constructor & Destructor Documentation

◆ OptionReadCfgFile()

template<bool mayBeMissing>
options::internal::OptionReadCfgFile< mayBeMissing >::OptionReadCfgFile ( const char *  name,
const char *  description 
)
inline

Definition at line 971 of file Options.cpp.

971  :
972  single('\0', name, description, "") {
973  }

Member Function Documentation

◆ fSetMe()

template<bool mayBeMissing>
void options::internal::OptionReadCfgFile< mayBeMissing >::fSetMe ( std::istream &  aStream,
const sourceItem aSource 
)
inlineoverridevirtual

function to set the value from a string, remembering the source

Implements options::base.

Definition at line 974 of file Options.cpp.

974  {
975  single<std::string>::fSetMe(aStream, aSource);
976  if (gNoCfgFileRecursion && aSource.fGetFile() != &sourceFile::gCmdLine) {
977  return;
978  }
979  parser::fGetInstance()->fReadCfgFile(*this, aSource, mayBeMissing);
980  };

References options::internal::sourceItem::fGetFile(), options::parser::fGetInstance(), options::parser::fReadCfgFile(), options::single< T >::fSetMe(), options::internal::sourceFile::gCmdLine, and options::internal::gNoCfgFileRecursion.

Here is the call graph for this function:

◆ fWriteCfgLines()

template<bool mayBeMissing>
void options::internal::OptionReadCfgFile< mayBeMissing >::fWriteCfgLines ( std::ostream &  aStream,
const char *   
) const
inlineoverridevirtual

Reimplemented from options::base.

Definition at line 981 of file Options.cpp.

981  {
983  };

References options::base::fWriteCfgLines(), and options::internal::gNoCfgFileRecursion.

Here is the call graph for this function:

The documentation for this class was generated from the following file:
options::base::fWriteCfgLines
virtual void fWriteCfgLines(std::ostream &aStream, const char *aPrefix) const
Definition: Options.cpp:580
options::single::fSetMe
void fSetMe(std::istream &aStream, const internal::sourceItem &aSource) override
function to set the value from a string, remembering the source
Definition: Options.h:578
options::parser::fReadCfgFile
void fReadCfgFile(const std::string &aFileName, const options::internal::sourceItem &aSource, bool aMayBeAbsent=false)
Definition: Options.cpp:819
options::internal::gNoCfgFileRecursion
static NoCfgFileRecursion gNoCfgFileRecursion
Definition: Options.cpp:643
options::single< std::string >::single
single(char aShortName, const std::string &aLongName, const std::string &aExplanation, std::string aDefault, const std::vector< std::string > &aRange={})
construct an object of single<T>
Definition: Options.h:546
options::internal::sourceFile::gCmdLine
static const sourceFile gCmdLine
Definition: Options.h:42
options::parser::fGetInstance
static parser * fGetInstance()
get the only allwed instance of the option parser.
Definition: Options.cpp:144