PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
ArgParser.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 __PARGPARSER_H__
8 #define __PARGPARSER_H__
9 
10 #include "PString.h"
11 
13 class ArgParser{
14  public:
15  ArgParser();
16  ArgParser(int argc, char** argv);
17  ArgParser(const ArgParser & other);
18  virtual ~ArgParser();
19  ArgParser & operator = (const ArgParser & other);
20 
21  void print() const;
22  void rewind();
23 
24  void getNextOption();
25  bool isEndOfOption() const;
26 
27  const PString & getCurrentOption() const;
29 
30  size_t getNbArgument() const;
31 
32  bool isBashCompletionMode() const;
33  const PString & getCursorOption() const;
34  const PString & getPrevCursorOption() const;
36 
37  protected:
38  void copyArgParser(const ArgParser & other);
39 
40  private:
42 
46  size_t p_currentArg;
49 
54 };
55 
56 #endif
57 
58 
std::vector< PString > PVecString
Definition: PString.h:96
Parse the list of arguments passed to a program.
Definition: ArgParser.h:13
virtual ~ArgParser()
Destructeur of ArgParser.
Definition: ArgParser.cpp:51
ArgParser & operator=(const ArgParser &other)
Definition of equal operator of ArgParser.
Definition: ArgParser.cpp:59
void print() const
Print all the input option.
Definition: ArgParser.cpp:65
const PString & getCurrentOption() const
Get the current option.
Definition: ArgParser.cpp:91
size_t p_currentArg
Current argument to be parsed.
Definition: ArgParser.h:46
PVecString p_vecArg
Vector of arguments.
Definition: ArgParser.h:44
const PString & getCursorOption() const
Get the cursor option given to the program, in bash completion mode.
Definition: ArgParser.cpp:119
void rewind()
Go bask to the first argument.
Definition: ArgParser.cpp:72
bool isBashCompletionMode() const
Say if the program is in bash completion mode.
Definition: ArgParser.cpp:112
void copyArgParser(const ArgParser &other)
Copy function of ArgParser.
Definition: ArgParser.cpp:146
void getNextOption()
Move to the next option.
Definition: ArgParser.cpp:77
const PString & getPrevCursorOption() const
Get the previous option before the cursor option.
Definition: ArgParser.cpp:126
ArgParser()
Default constructor of ArgParser.
Definition: ArgParser.cpp:11
PString p_cursorOption
Option which is typed right now, given to the program (in bash completion mode)
Definition: ArgParser.h:51
bool p_bashCompletionMode
Say if the program is in bash completion mode.
Definition: ArgParser.h:48
size_t getNbArgument() const
Get the number of arguments passed to the program.
Definition: ArgParser.cpp:105
PString p_prevCursorOption
Previous option before the cursor option.
Definition: ArgParser.h:53
bool isEndOfOption() const
Say if is it the end of the options.
Definition: ArgParser.cpp:84
PString getRemainingArgument()
Get all remaining arguments of the ArgParser.
Definition: ArgParser.cpp:133
void initialisationArgParser()
Initialisation function of the class ArgParser.
Definition: ArgParser.cpp:154
Extends the std::string.
Definition: PString.h:16