ArgException.h
Go to the documentation of this file.
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2 
3 /******************************************************************************
4  *
5  * file: ArgException.h
6  *
7  * Copyright (c) 2003, Michael E. Smoot .
8  * All rights reverved.
9  *
10  * See the file COPYING in the top directory of this distribution for
11  * more information.
12  *
13  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
14  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19  * DEALINGS IN THE SOFTWARE.
20  *
21  *****************************************************************************/
22 
23 
24 #ifndef TCLAP_ARG_EXCEPTION_H
25 #define TCLAP_ARG_EXCEPTION_H
26 
27 #include <string>
28 #include <exception>
29 
30 namespace TCLAP {
31 
36 class ArgException : public std::exception
37 {
38  public:
39 
47  ArgException( const std::string& text = "undefined exception",
48  const std::string& id = "undefined",
49  const std::string& td = "Generic ArgException")
50  : std::exception(),
51  _errorText(text),
52  _argId( id ),
54  { }
55 
59  virtual ~ArgException() throw() { }
60 
64  std::string error() const { return ( _errorText ); }
65 
69  std::string argId() const
70  {
71  if ( _argId == "undefined" )
72  return " ";
73  else
74  return ( "Argument: " + _argId );
75  }
76 
80  const char* what() const throw()
81  {
82  static std::string ex;
83  ex = _argId + " -- " + _errorText;
84  return ex.c_str();
85  }
86 
92  {
93  return _typeDescription;
94  }
95 
96 
97  private:
98 
103 
108 
114 
115 };
116 
122 {
123  public:
130  ArgParseException( const std::string& text = "undefined exception",
131  const std::string& id = "undefined" )
132  : ArgException( text,
133  id,
134  std::string( "Exception found while parsing " ) +
135  std::string( "the value the Arg has been passed." ))
136  { }
137 };
138 
144 {
145  public:
152  CmdLineParseException( const std::string& text = "undefined exception",
153  const std::string& id = "undefined" )
154  : ArgException( text,
155  id,
156  std::string( "Exception found when the values ") +
157  std::string( "on the command line do not meet ") +
158  std::string( "the requirements of the defined ") +
159  std::string( "Args." ))
160  { }
161 };
162 
168 {
169  public:
176  SpecificationException( const std::string& text = "undefined exception",
177  const std::string& id = "undefined" )
178  : ArgException( text,
179  id,
180  std::string("Exception found when an Arg object ")+
181  std::string("is improperly defined by the ") +
182  std::string("developer." ))
183  { }
184 
185 };
186 
188 public:
189  ExitException(int estat) : _estat(estat) {}
190 
191  int getExitStatus() const { return _estat; }
192 
193 private:
194  int _estat;
195 };
196 
197 } // namespace TCLAP
198 
199 #endif
200 
SpecificationException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:176
const char * what() const
Definition: ArgException.h:80
int getExitStatus() const
Definition: ArgException.h:191
virtual ~ArgException()
Definition: ArgException.h:59
ArgException(const std::string &text="undefined exception", const std::string &id="undefined", const std::string &td="Generic ArgException")
Definition: ArgException.h:47
ExitException(int estat)
Definition: ArgException.h:189
GLsizei const GLchar *const * string
GLenum GLuint id
ArgParseException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:130
std::string typeDescription() const
Definition: ArgException.h:91
std::string error() const
Definition: ArgException.h:64
std::string _errorText
Definition: ArgException.h:102
CmdLineParseException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:152
std::string argId() const
Definition: ArgException.h:69
Definition: Arg.h:57
std::string _typeDescription
Definition: ArgException.h:113
std::string _argId
Definition: ArgException.h:107


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:45:06