COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ArgsParser.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef __ARGS_PARSER_H_
9 #define __ARGS_PARSER_H_
10 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11 // CLASS ArgsParser
12 //
13 // Initial version: 2003-01-27 [we]
14 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 // (C) 2001 by VirCinity IT Consulting
16 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 // Changes:
18 //
19 
25 namespace covise
26 {
27 
29 {
30 public:
31  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32  // ++ Constructors / Destructor
33  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
34 
38  ArgsParser(int argc, const char *const *argv);
39 
41  virtual ~ArgsParser();
42 
43  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
44  // ++ Operations
45  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
46 
50  const char *getOpt(const char *shortOpt, const char *longOpt,
51  const char *defaultVal);
52 
54  bool getSwitch(const char *shortOpt, const char *longOpt);
55 
57  // @@@ assume all short-opts have 1 parameter so far
58  const char *operator[](int idx);
59 
61  int numArgs();
62 
63  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
64  // ++ Attribute request/set functions
65  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
66 
67 protected:
68  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69  // ++ Attributes
70  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 
72  // argc from argument list
73  int d_argc;
74 
75  // argv from argument list
76  char **d_argv;
77 
78  // index of 1st non-Option string
80 
81 private:
82  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
83  // ++ Internally used functions
84  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
85 
86  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
87  // ++ prevent auto-generated bit copy routines by default
88  // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89 
91  ArgsParser(const ArgsParser &);
92 
95 
97  ArgsParser();
98 };
99 }
100 #endif
int numArgs()
number of non-optoion arguments
Definition: ArgsParser.cpp:156
int d_argc
Definition: ArgsParser.h:73
char ** d_argv
Definition: ArgsParser.h:76
Definition: ArgsParser.h:28
ArgsParser & operator=(const ArgsParser &)
Assignment operator: NOT IMPLEMENTED, checked by assert.
int d_firstArg
Definition: ArgsParser.h:79
ArgsParser()
Default constructor: NOT IMPLEMENTED, checked by assert.
const char * operator[](int idx)
Access non-option parameters.
Definition: ArgsParser.cpp:146
const char * getOpt(const char *shortOpt, const char *longOpt, const char *defaultVal)
Definition: ArgsParser.cpp:78
bool getSwitch(const char *shortOpt, const char *longOpt)
return whether switch is set: true if set
Definition: ArgsParser.cpp:122
virtual ~ArgsParser()
Destructor : virtual in case we derive objects.
Definition: ArgsParser.cpp:66