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 
121 class ArgParseException : public ArgException
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 
187 class ExitException {
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 
TCLAP::ExitException
Definition: ArgException.h:205
TCLAP::ArgException::typeDescription
std::string typeDescription() const
Definition: ArgException.h:127
TCLAP::ArgException::argId
std::string argId() const
Definition: ArgException.h:105
id
GLenum GLuint id
Definition: glad/glad/glad.h:135
TCLAP::ArgException::~ArgException
virtual ~ArgException()
Definition: ArgException.h:95
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
TCLAP::ArgException::_typeDescription
std::string _typeDescription
Definition: ArgException.h:149
TCLAP::CmdLineParseException
Definition: ArgException.h:161
TCLAP::ExitException::getExitStatus
int getExitStatus() const
Definition: ArgException.h:209
TCLAP::ArgException
Definition: ArgException.h:54
TCLAP::CmdLineParseException::CmdLineParseException
CmdLineParseException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:170
TCLAP::ArgException::_argId
std::string _argId
Definition: ArgException.h:143
TCLAP::ArgParseException
Definition: ArgException.h:139
TCLAP::ArgException::error
std::string error() const
Definition: ArgException.h:100
TCLAP::SpecificationException::SpecificationException
SpecificationException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:194
TCLAP::ArgException::ArgException
ArgException(const std::string &text="undefined exception", const std::string &id="undefined", const std::string &td="Generic ArgException")
Definition: ArgException.h:83
TCLAP::ArgParseException::ArgParseException
ArgParseException(const std::string &text="undefined exception", const std::string &id="undefined")
Definition: ArgException.h:148
std
Definition: android_helpers.h:13
TCLAP::SpecificationException
Definition: ArgException.h:185
TCLAP::ExitException::_estat
int _estat
Definition: ArgException.h:212
TCLAP::ExitException::ExitException
ExitException(int estat)
Definition: ArgException.h:207
TCLAP::ArgException::_errorText
std::string _errorText
Definition: ArgException.h:138
TCLAP::ArgException::what
const char * what() const
Definition: ArgException.h:116
TCLAP
Definition: Arg.h:57


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Mon Apr 22 2024 02:12:55