arg_exception.hpp
Go to the documentation of this file.
1 
11 /*****************************************************************************
12 ** Ifdefs
13 *****************************************************************************/
14 
15 #ifndef TCLAP_ARG_EXCEPTION_H
16 #define TCLAP_ARG_EXCEPTION_H
17 
18 #include <string>
19 #include <exception>
20 
21 namespace ecl {
22 
23 
30 class ArgException : public std::exception
31 {
32  public:
33 
41  ArgException( const std::string& text = "undefined exception",
42  const std::string& id = "undefined",
43  const std::string& td = "Generic ArgException")
44  : std::exception(),
45  _errorText(text),
46  _argId( id ),
48  { }
49 
53  virtual ~ArgException() throw() { }
54 
58  std::string error() const { return ( _errorText ); }
59 
63  std::string argId() const
64  {
65  if ( _argId == "undefined" )
66  return " ";
67  else
68  return ( "Argument: " + _argId );
69  }
70 
74  const char* what() const throw()
75  {
76  static std::string ex;
77  ex = _argId + " -- " + _errorText;
78  return ex.c_str();
79  }
80 
85  std::string typeDescription() const
86  {
87  return _typeDescription;
88  }
89 
90 
91  private:
92 
96  std::string _errorText;
97 
101  std::string _argId;
102 
107  std::string _typeDescription;
108 
109 };
110 
118 {
119  public:
126  ArgParseException( const std::string& text = "undefined exception",
127  const std::string& id = "undefined" )
128  : ArgException( text,
129  id,
130  std::string( "Exception found while parsing " ) +
131  std::string( "the value the Arg has been passed." ))
132  { }
133 };
134 
142 {
143  public:
150  CmdLineParseException( const std::string& text = "undefined exception",
151  const std::string& id = "undefined" )
152  : ArgException( text,
153  id,
154  std::string( "Exception found when the values ") +
155  std::string( "on the command line do not meet ") +
156  std::string( "the requirements of the defined ") +
157  std::string( "Args." ))
158  { }
159 };
160 
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 }; // namespace ecl
188 
189 
190 #endif
191 
std::string _errorText
std::string typeDescription() const
std::string error() const
virtual ~ArgException()
Defines the exception that is thrown when an argument is improperly parsed.
SpecificationException(const std::string &text="undefined exception", const std::string &id="undefined")
Defines the exception that is thrown whenever a command line is created and parsed.
const char * what() const
CmdLineParseException(const std::string &text="undefined exception", const std::string &id="undefined")
std::string _typeDescription
ArgParseException(const std::string &text="undefined exception", const std::string &id="undefined")
Defines the exception when an argument is improperly specified.
std::string argId() const
ArgException(const std::string &text="undefined exception", const std::string &id="undefined", const std::string &td="Generic ArgException")
Defines the exception that is thrown whenever a conflict in arguments occurs.


ecl_command_line
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:23