GteCommand.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <GTEngineDEF.h>
11 #include <string>
12 #include <vector>
13 
14 namespace gte
15 {
16 
18 {
19 public:
20  // Construction and destruction.
21  ~Command ();
22  Command (int numArguments, char const* arguments[]);
23 
24  // The return value is the index of the first excess argument.
25  int ExcessArguments () const;
26 
27  // Set bounds for numerical arguments. If bounds are required, they must
28  // be set for each argument.
29  Command& Min (double value);
30  Command& Max (double value);
31  Command& Inf (double value);
32  Command& Sup (double value);
33 
34  // The return value of each of the following methods is the option index
35  // within the argument array.
36 
37  // Use the bool methods for options which take no argument, for
38  // example in
39  // myprogram -debug -x 10 -y 20 filename
40  // the option -debug has no argument.
41 
42  int GetBoolean (std::string const& name); // returns existence of option
43  int GetBoolean (std::string const& name, bool& value);
44  int GetInteger (std::string const& name, int& value);
45  int GetFloat (std::string const& name, float& value);
46  int GetDouble (std::string const& name, double& value);
47  int GetString (std::string const& name, std::string& value);
48  int GetFilename (std::string& value, int startArgIndex = 1);
49 
50  // Last-error reporting.
51  std::string GetLastError () const;
52 
53 private:
54  // The member mArguments contains the array of input strings. The member
55  // mProcessed indicates those arguments that have been processed by the
56  // parser.
57  std::vector<std::string> mArguments;
58  std::vector<bool> mProcessed;
59 
60  // Parameters for bounds checking.
61  double mSmall; // lower bound for numerical argument (min or inf)
62  double mLarge; // upper bound for numerical argument (max or sup)
63  bool mMinSet; // if true, compare: small <= arg
64  bool mMaxSet; // if true, compare: arg <= large
65  bool mInfSet; // if true, compare: small < arg
66  bool mSupSet; // if true, compare: arg < large
67 
68  // Last-error strings.
70  static std::string const msOptNotFound;
71  static std::string const msArgRequired;
74  static std::string const msDash;
75 };
76 
77 }
std::vector< bool > mProcessed
Definition: GteCommand.h:58
double mSmall
Definition: GteCommand.h:61
double mLarge
Definition: GteCommand.h:62
static std::string const msArgOutOfRange
Definition: GteCommand.h:72
GLsizei const GLfloat * value
Definition: glcorearb.h:819
GLuint const GLchar * name
Definition: glcorearb.h:781
std::vector< std::string > mArguments
Definition: GteCommand.h:57
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
bool mInfSet
Definition: GteCommand.h:65
static std::string const msFilenameNotFound
Definition: GteCommand.h:73
bool mMaxSet
Definition: GteCommand.h:64
static std::string const msDash
Definition: GteCommand.h:74
static std::string const msOptNotFound
Definition: GteCommand.h:70
bool mMinSet
Definition: GteCommand.h:63
bool mSupSet
Definition: GteCommand.h:66
static std::string const msArgRequired
Definition: GteCommand.h:71
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
std::string mLastError
Definition: GteCommand.h:69


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59