PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
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 "print_string.h"
11 
13 typedef std::vector<std::string> PVecString;
14 
16 class ArgParser{
17  public:
18  ArgParser();
19  ArgParser(int argc, char** argv);
20  ArgParser(const ArgParser & other);
21  virtual ~ArgParser();
22  ArgParser & operator = (const ArgParser & other);
23 
24  void print() const;
25  void rewind();
26 
27  void getNextOption();
28  bool isEndOfOption() const;
29 
30  const std::string & getCurrentOption() const;
31  std::string & getCurrentOption();
32 
33  size_t getNbArgument() const;
34 
35  bool isBashCompletionMode() const;
36  const std::string & getCursorOption() const;
37  const std::string & getPrevCursorOption() const;
38 
39  protected:
40  void copyArgParser(const ArgParser & other);
41 
42  private:
44 
48  size_t p_currentArg;
51 
53  std::string p_cursorOption;
55  std::string p_prevCursorOption;
56 };
57 
58 #endif
59 
60 
ArgParser::copyArgParser
void copyArgParser(const ArgParser &other)
Copy function of ArgParser.
Definition: ArgParser.cpp:135
ArgParser::initialisationArgParser
void initialisationArgParser()
Initialisation function of the class ArgParser.
Definition: ArgParser.cpp:143
ArgParser::p_vecArg
PVecString p_vecArg
Vector of arguments.
Definition: ArgParser.h:46
ArgParser::getPrevCursorOption
const std::string & getPrevCursorOption() const
Get the previous option before the cursor option.
Definition: ArgParser.cpp:128
ArgParser::getCurrentOption
const std::string & getCurrentOption() const
Get the current option.
Definition: ArgParser.cpp:93
ArgParser::p_prevCursorOption
std::string p_prevCursorOption
Previous option before the cursor option.
Definition: ArgParser.h:55
print_string.h
ArgParser::p_currentArg
size_t p_currentArg
Current argument to be parsed.
Definition: ArgParser.h:48
ArgParser::print
void print() const
Print all the input option.
Definition: ArgParser.cpp:67
ArgParser::getNbArgument
size_t getNbArgument() const
Get the number of arguments passed to the program.
Definition: ArgParser.cpp:107
ArgParser::isBashCompletionMode
bool isBashCompletionMode() const
Say if the program is in bash completion mode.
Definition: ArgParser.cpp:114
ArgParser::p_cursorOption
std::string p_cursorOption
Option which is typed right now, given to the program (in bash completion mode)
Definition: ArgParser.h:53
ArgParser::getCursorOption
const std::string & getCursorOption() const
Get the cursor option given to the program, in bash completion mode.
Definition: ArgParser.cpp:121
ArgParser::ArgParser
ArgParser()
Default constructor of ArgParser.
Definition: ArgParser.cpp:12
ArgParser::p_bashCompletionMode
bool p_bashCompletionMode
Say if the program is in bash completion mode.
Definition: ArgParser.h:50
PVecString
std::vector< std::string > PVecString
Vector of values.
Definition: ArgParser.h:13
ArgParser::isEndOfOption
bool isEndOfOption() const
Say if is it the end of the options.
Definition: ArgParser.cpp:86
ArgParser::rewind
void rewind()
Go bask to the first argument.
Definition: ArgParser.cpp:74
ArgParser::getNextOption
void getNextOption()
Move to the next option.
Definition: ArgParser.cpp:79
ArgParser::operator=
ArgParser & operator=(const ArgParser &other)
Definition of equal operator of ArgParser.
Definition: ArgParser.cpp:61
ArgParser
Parse the list of arguments passed to a program.
Definition: ArgParser.h:16
ArgParser::~ArgParser
virtual ~ArgParser()
Destructeur of ArgParser.
Definition: ArgParser.cpp:53