PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
OptionMode.h
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #ifndef __POPTIONMODE_H__
8 #define __POPTIONMODE_H__
9 
10 #include "Option.h"
11 
13 class OptionMode{
14  public:
15  OptionMode(const PString & name = "");
16  OptionMode(const OptionMode & other);
17 
18  virtual ~OptionMode();
19  OptionMode & operator = (const OptionMode & other);
20 
21  bool parseOption(ArgParser & parser);
22  bool parseOption(ArgParser & parser, Option *& partialOption);
23 
24  void print() const;
25 
26  void setName(const PString & name);
27  void setVecOption(const VecOption & vecOption);
28  void addOption(const Option & option);
29  void clearOption();
30  void setEnableHelpOption(bool b);
31  void setProgramVersion(const PString & programVersion);
32 
33  const PString & getName() const;
34  PString & getName();
35 
36  const VecOption & getVecOption() const;
38 
39  bool checkArgument() const;
40  bool isCurrentlyParsed() const;
41  bool isParsed() const;
42  const PString & getExtraArgument() const;
43 
44  template<typename T>
45  bool getValue(T & value, const PString & optionName) const;
46 
47  bool isOptionExist(const PString & optionName) const;
48 
49  void getPossibleOption(PString & possibleOption, const PString & cursorOption) const;
50  void getPossibleMode(PString & possibleOption, const PString & cursorOption) const;
51 
52  protected:
53  void copyOptionMode(const OptionMode & other);
54  private:
56  bool getOption(Option & option, const PString & optionName) const;
57  void iterGetPossibleOption(PString & possibleOption, const PString & cursorOption) const;
58 
66  bool p_isParsed;
73 };
74 
76 typedef std::vector<OptionMode> VecMode;
77 
78 #include "OptionMode_impl.h"
79 
80 #endif
81 
std::vector< OptionMode > VecMode
Vector of mode.
Definition: OptionMode.h:76
std::vector< Option > VecOption
Vector of option.
Definition: Option.h:90
Parse the list of arguments passed to a program.
Definition: ArgParser.h:13
Describe a mode in the program arguments.
Definition: OptionMode.h:13
bool getOption(Option &option, const PString &optionName) const
Get the option with its name.
Definition: OptionMode.cpp:273
void setName(const PString &name)
Set the name of the OptionMode.
Definition: OptionMode.cpp:126
bool p_isCurrentlyParsed
True if the OptionMode is currently parsed but not totally.
Definition: OptionMode.h:64
void print() const
Print the option of the mode.
Definition: OptionMode.cpp:112
void setVecOption(const VecOption &vecOption)
Set the vector of options of the OptionMode.
Definition: OptionMode.cpp:131
OptionMode & operator=(const OptionMode &other)
Definition of equal operator of OptionMode.
Definition: OptionMode.cpp:34
void getPossibleOption(PString &possibleOption, const PString &cursorOption) const
Get the possible options for the bash completion.
Definition: OptionMode.cpp:225
void iterGetPossibleOption(PString &possibleOption, const PString &cursorOption) const
Iterates over the possible options of the current mode.
Definition: OptionMode.cpp:289
void initialisationOptionMode()
Initialisation function of the class OptionMode.
Definition: OptionMode.cpp:262
void setEnableHelpOption(bool b)
Set the attribtue which enables help option.
Definition: OptionMode.cpp:144
bool isCurrentlyParsed() const
Say if the OptionMode is currently parsed (but maybe not totally)
Definition: OptionMode.cpp:188
const PString & getExtraArgument() const
Get Extra argument.
Definition: OptionMode.cpp:202
VecOption p_vecOption
Vector of all the options of the OptionMode.
Definition: OptionMode.h:62
void getPossibleMode(PString &possibleOption, const PString &cursorOption) const
Get the possible mode.
Definition: OptionMode.cpp:240
bool isOptionExist(const PString &optionName) const
Say if the given option has been passed to the program.
Definition: OptionMode.cpp:210
void addOption(const Option &option)
Add an option into the OptionMode.
Definition: OptionMode.cpp:136
void setProgramVersion(const PString &programVersion)
Set the program version.
Definition: OptionMode.cpp:149
const VecOption & getVecOption() const
Get the vector of options of the OptionMode.
Definition: OptionMode.cpp:164
bool parseOption(ArgParser &parser)
Parse the options in the current OptionMode.
Definition: OptionMode.cpp:44
void copyOptionMode(const OptionMode &other)
Copy function of OptionMode.
Definition: OptionMode.cpp:251
const PString & getName() const
Get the name of the OptionMode.
Definition: OptionMode.cpp:154
bool isParsed() const
Say if the OptionMode contains option which are parsed.
Definition: OptionMode.cpp:195
PString p_extraArgument
Extra argument passed to the OptionMode.
Definition: OptionMode.h:72
bool checkArgument() const
Check the argument of the parser.
Definition: OptionMode.cpp:174
virtual ~OptionMode()
Destructeur of OptionMode.
Definition: OptionMode.cpp:26
void clearOption()
Remove all the options of the OptionMode.
Definition: OptionMode.cpp:139
bool p_isParsed
Say if the mode contains options which are parsed.
Definition: OptionMode.h:66
bool getValue(T &value, const PString &optionName) const
Get the value of the option.
bool p_enableHelpOption
True to enable automatically the printing of the help option when the program is called with –help or...
Definition: OptionMode.h:68
PString p_programVersion
Program version to be printed on –version or -v option.
Definition: OptionMode.h:70
OptionMode(const PString &name="")
Default constructeur of OptionMode.
Definition: OptionMode.cpp:12
PString p_name
name of the OptionMode
Definition: OptionMode.h:60
Describes an option passed to a program.
Definition: Option.h:14
Extends the std::string.
Definition: PString.h:16