ewmscp  ..
Public Member Functions | Private Attributes | List of all members
options::ForeignOption Class Reference

special type of option that is not really parsed but used to feed an additional option parser More...

#include <OptionsWithForeignParser.h>

Inheritance diagram for options::ForeignOption:
[legend]
Collaboration diagram for options::ForeignOption:
[legend]

Public Member Functions

 ForeignOption (ForeignApplicationOptions *aForeignApplication, char aShortName, std::string aLongName, std::string aExplanation, short aNargs, const char *aCanonicalForm)
 
void fSetMe (std::istream &aArg, const internal::sourceItem &aSource) override
 remember argument ad register in list of options that were set. More...
 
void fSetMeNoarg (const internal::sourceItem &aSource) override
 
void fCheckRange () const override
 range checking does not work, we know no ranges More...
 
void fAddToRangeFromStream (std::istream &aStream) override
 just read away the line, we cannot do anything sensible here More...
 
void fAddDefaultFromStream (std::istream &aStream) override
 just read away the line, we cannot do anything sensible here More...
 
void fWriteValue (std::ostream &aStream) const override
 write textual representation of value to a std::ostream More...
 
virtual ~ForeignOption ()
 
virtual void fAddArgs () const
 add args of this option tho the argument vector of the option list More...
 
- 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...
 

Private Attributes

std::string lCanonical
 
std::string lArg
 
ForeignApplicationOptionslOptions
 

Additional Inherited Members

- Protected Member Functions inherited from options::base
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 fWriteRange (std::ostream &) const
 
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::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

special type of option that is not really parsed but used to feed an additional option parser

Definition at line 34 of file OptionsWithForeignParser.h.

Constructor & Destructor Documentation

◆ ForeignOption()

options::ForeignOption::ForeignOption ( ForeignApplicationOptions aForeignApplication,
char  aShortName,
std::string  aLongName,
std::string  aExplanation,
short  aNargs,
const char *  aCanonicalForm 
)

The newly created object is inserted into the maps sorted by long name and by short name, (short name only if it is not '\0') If a clash wopuld occur, i.e. either long or short name is already taken an exception is thrown.

Parameters
[in]aShortNameshort option without the -, use '\0' to have only a long form
[in]aLongNamelong option without the –, must always be given
[in]aExplanationexplanation for help output
[in]aNargsnumber of arguments/parameters. May be 0 ot 1.
[in]aForeignApplicationrequired pointer to the ForeignApplicationOptions object that this option shall belong to
[in]aCanonicalFormcanonical form of the option, including leading - signs to be given to the other parser

Definition at line 51 of file OptionsWithForeignParser.cpp.

53  :
54  base(aShortName, aLongName, aExplanation, aNargs),
55  lCanonical(aCanonicalForm), lOptions(aForeignApplication) {
56  }

◆ ~ForeignOption()

options::ForeignOption::~ForeignOption ( )
virtual

Definition at line 57 of file OptionsWithForeignParser.cpp.

57 {}

Member Function Documentation

◆ fAddArgs()

void options::ForeignOption::fAddArgs ( ) const
virtual

add args of this option tho the argument vector of the option list

Definition at line 70 of file OptionsWithForeignParser.cpp.

70  {
72  if (lNargs == 1) {
74  }
75  }

References options::ForeignApplicationOptions::fAddToArgc(), lArg, lCanonical, options::base::lNargs, and lOptions.

Here is the call graph for this function:

◆ fAddDefaultFromStream()

void options::ForeignOption::fAddDefaultFromStream ( std::istream &  aStream)
overridevirtual

just read away the line, we cannot do anything sensible here

Implements options::base.

Definition at line 85 of file OptionsWithForeignParser.cpp.

85  {
86  aStream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
87  }

◆ fAddToRangeFromStream()

void options::ForeignOption::fAddToRangeFromStream ( std::istream &  aStream)
overridevirtual

just read away the line, we cannot do anything sensible here

Implements options::base.

Definition at line 81 of file OptionsWithForeignParser.cpp.

81  {
82  aStream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
83  }

◆ fCheckRange()

void options::ForeignOption::fCheckRange ( ) const
overridevirtual

range checking does not work, we know no ranges

Implements options::base.

Definition at line 77 of file OptionsWithForeignParser.cpp.

77  {
78  return;
79  }

◆ fSetMe()

void options::ForeignOption::fSetMe ( std::istream &  aArg,
const internal::sourceItem aSource 
)
overridevirtual

remember argument ad register in list of options that were set.

Implements options::base.

Definition at line 59 of file OptionsWithForeignParser.cpp.

59  {
60  using escapedIO::operator>>;
61  aStream >> lArg;
62  fSetSource(aSource);
63  lOptions->fRegister(this);
64  }

References options::ForeignApplicationOptions::fRegister(), options::base::fSetSource(), lArg, and lOptions.

Here is the call graph for this function:

◆ fSetMeNoarg()

void options::ForeignOption::fSetMeNoarg ( const internal::sourceItem aSource)
overridevirtual

Reimplemented from options::base.

Definition at line 65 of file OptionsWithForeignParser.cpp.

65  {
66  fSetSource(aSource);
67  lOptions->fRegister(this);
68  }

References options::ForeignApplicationOptions::fRegister(), options::base::fSetSource(), and lOptions.

Here is the call graph for this function:

◆ fWriteValue()

void options::ForeignOption::fWriteValue ( std::ostream &  aStream) const
overridevirtual

write textual representation of value to a std::ostream

Implements options::base.

Definition at line 88 of file OptionsWithForeignParser.cpp.

88  {
89  aStream << lArg;
90  }

References lArg.

Member Data Documentation

◆ lArg

std::string options::ForeignOption::lArg
private

Definition at line 37 of file OptionsWithForeignParser.h.

Referenced by fAddArgs(), fSetMe(), and fWriteValue().

◆ lCanonical

std::string options::ForeignOption::lCanonical
private

Definition at line 36 of file OptionsWithForeignParser.h.

Referenced by fAddArgs().

◆ lOptions

ForeignApplicationOptions* options::ForeignOption::lOptions
private

Definition at line 38 of file OptionsWithForeignParser.h.

Referenced by fAddArgs(), fSetMe(), and fSetMeNoarg().


The documentation for this class was generated from the following files:
options::ForeignOption::lArg
std::string lArg
Definition: OptionsWithForeignParser.h:37
options::ForeignOption::lCanonical
std::string lCanonical
Definition: OptionsWithForeignParser.h:36
options::ForeignOption::lOptions
ForeignApplicationOptions * lOptions
Definition: OptionsWithForeignParser.h:38
options::base::base
base(char aShortName, const std::string &aLongName, const std::string &aExplanation, short aNargs)
construct an object of type base
Definition: Options.cpp:529
options::ForeignApplicationOptions::fAddToArgc
void fAddToArgc(const char *aString)
add string to the argument vector for the external parser
Definition: OptionsWithForeignParser.cpp:30
options::ForeignApplicationOptions::fRegister
void fRegister(const ForeignOption *aOption)
add aOption to the list of options that were set.
Definition: OptionsWithForeignParser.cpp:14
options::base::lNargs
short lNargs
Definition: Options.h:209
options::base::fSetSource
virtual void fSetSource(const internal::sourceItem &aSource)
remember the source that provided the value, e.g. commandline or a config file
Definition: Options.cpp:561