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

class to hold a list of options that are to be handled by a foreign option parser More...

#include <OptionsWithForeignParser.h>

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

Public Member Functions

 ForeignApplicationOptions (const char *aName)
 construct an object of typs ForeignApplicationOptions More...
 
void fRegister (const ForeignOption *aOption)
 add aOption to the list of options that were set. More...
 
void fFinalize ()
 build the internal argument vector for the call to the external parser More...
 
template<typename InputIt >
void fFinalize (InputIt from, InputIt to)
 build the internal argument vector for the call to the external parser and adds strings from the iterators in the range [from,to) More...
 
void fAddToArgc (const char *aString)
 add string to the argument vector for the external parser More...
 
void fAddToArgc (const std::string &aString)
 add string to the argument vector for the external parser More...
 
char ** Argv ()
 return an argument vector for use with the external parser More...
 
int * Argc ()
 return a pointer to the argument count for use with the external parser More...
 

Private Attributes

std::vector< const ForeignOption * > lOptions
 
std::string lName
 
std::vector< char * > lArgv
 
int lArgc
 

Detailed Description

class to hold a list of options that are to be handled by a foreign option parser

Definition at line 10 of file OptionsWithForeignParser.h.

Constructor & Destructor Documentation

◆ ForeignApplicationOptions()

options::ForeignApplicationOptions::ForeignApplicationOptions ( const char *  aName)

construct an object of typs ForeignApplicationOptions

in a derived class the constructor should generete via new the ForeignOption objects that are recognized by the corresponing parser.

Definition at line 8 of file OptionsWithForeignParser.cpp.

8  :
9  lName(aName) {
10  lArgc = 0;
11  }

References lArgc.

Member Function Documentation

◆ Argc()

int * options::ForeignApplicationOptions::Argc ( )

return a pointer to the argument count for use with the external parser

Definition at line 44 of file OptionsWithForeignParser.cpp.

44  {
45  return &lArgc;
46  }

References lArgc.

◆ Argv()

char ** options::ForeignApplicationOptions::Argv ( )

return an argument vector for use with the external parser

Definition at line 40 of file OptionsWithForeignParser.cpp.

40  {
41  return lArgv.data();
42  }

References lArgv.

◆ fAddToArgc() [1/2]

void options::ForeignApplicationOptions::fAddToArgc ( const char *  aString)

add string to the argument vector for the external parser

Definition at line 30 of file OptionsWithForeignParser.cpp.

30  {
31  lArgv.push_back(const_cast<char*>(aString));
32  lArgc = lArgv.size();
33  }

References lArgc, and lArgv.

Referenced by options::ForeignOption::fAddArgs(), and fFinalize().

Here is the caller graph for this function:

◆ fAddToArgc() [2/2]

void options::ForeignApplicationOptions::fAddToArgc ( const std::string &  aString)

add string to the argument vector for the external parser

Definition at line 35 of file OptionsWithForeignParser.cpp.

35  {
36  lArgv.push_back(const_cast<char*>(aString.data()));
37  lArgc = lArgv.size();
38  }

References lArgc, and lArgv.

◆ fFinalize() [1/2]

void options::ForeignApplicationOptions::fFinalize ( )

build the internal argument vector for the call to the external parser

This function must be called before Argc() and Argv() may be called. it adds all the canonical forms of the options thate were set to the argument vector.

Definition at line 22 of file OptionsWithForeignParser.cpp.

22  {
23  lArgv.clear();
24  lArgv.push_back(const_cast<char*>(lName.data()));
25  for (auto opt : lOptions) {
26  opt->fAddArgs();
27  }
28  }

References lArgv, lName, and lOptions.

Referenced by fFinalize(), and main().

Here is the caller graph for this function:

◆ fFinalize() [2/2]

template<typename InputIt >
void options::ForeignApplicationOptions::fFinalize ( InputIt  from,
InputIt  to 
)
inline

build the internal argument vector for the call to the external parser and adds strings from the iterators in the range [from,to)

This function must be called before Argc() and Argv() may be called. it adds all the canonical forms of the options thate were set to the argument vector. and adds strings from the iterators in the range [from,to)

Definition at line 21 of file OptionsWithForeignParser.h.

21  {
22  fFinalize();
23  for (auto it = from; it != to; ++it) {
24  fAddToArgc(*it);
25  }
26  }

References fAddToArgc(), and fFinalize().

Here is the call graph for this function:

◆ fRegister()

void options::ForeignApplicationOptions::fRegister ( const ForeignOption aOption)

add aOption to the list of options that were set.

Definition at line 14 of file OptionsWithForeignParser.cpp.

14  {
15  lOptions.push_back(aOption);
16  }

References lOptions.

Referenced by options::ForeignOption::fSetMe(), and options::ForeignOption::fSetMeNoarg().

Here is the caller graph for this function:

Member Data Documentation

◆ lArgc

int options::ForeignApplicationOptions::lArgc
private

Definition at line 15 of file OptionsWithForeignParser.h.

Referenced by Argc(), fAddToArgc(), and ForeignApplicationOptions().

◆ lArgv

std::vector<char *> options::ForeignApplicationOptions::lArgv
private

Definition at line 14 of file OptionsWithForeignParser.h.

Referenced by Argv(), fAddToArgc(), and fFinalize().

◆ lName

std::string options::ForeignApplicationOptions::lName
private

Definition at line 13 of file OptionsWithForeignParser.h.

Referenced by fFinalize().

◆ lOptions

std::vector<const ForeignOption*> options::ForeignApplicationOptions::lOptions
private

Definition at line 12 of file OptionsWithForeignParser.h.

Referenced by fFinalize(), and fRegister().


The documentation for this class was generated from the following files:
options::ForeignApplicationOptions::fFinalize
void fFinalize()
build the internal argument vector for the call to the external parser
Definition: OptionsWithForeignParser.cpp:22
options::ForeignApplicationOptions::lArgc
int lArgc
Definition: OptionsWithForeignParser.h:15
options::ForeignApplicationOptions::fAddToArgc
void fAddToArgc(const char *aString)
add string to the argument vector for the external parser
Definition: OptionsWithForeignParser.cpp:30
options::ForeignApplicationOptions::lOptions
std::vector< const ForeignOption * > lOptions
Definition: OptionsWithForeignParser.h:12
options::ForeignApplicationOptions::lArgv
std::vector< char * > lArgv
Definition: OptionsWithForeignParser.h:14
options::ForeignApplicationOptions::lName
std::string lName
Definition: OptionsWithForeignParser.h:13