arg_exception.hpp
Go to the documentation of this file.
00001 
00011 /*****************************************************************************
00012 ** Ifdefs
00013 *****************************************************************************/
00014 
00015 #ifndef TCLAP_ARG_EXCEPTION_H
00016 #define TCLAP_ARG_EXCEPTION_H
00017 
00018 #include <string>
00019 #include <exception>
00020 
00021 namespace ecl {
00022 
00023 
00030 class ArgException : public std::exception
00031 {
00032         public:
00033 
00041                 ArgException( const std::string& text = "undefined exception",
00042                                           const std::string& id = "undefined",
00043                                           const std::string& td = "Generic ArgException")
00044                         : std::exception(),
00045                           _errorText(text),
00046                           _argId( id ),
00047                           _typeDescription(td)
00048                 { }
00049 
00053                 virtual ~ArgException() throw() { }
00054 
00058                 std::string error() const { return ( _errorText ); }
00059 
00063                 std::string argId() const
00064                 {
00065                         if ( _argId == "undefined" )
00066                                 return " ";
00067                         else
00068                                 return ( "Argument: " + _argId );
00069                 }
00070 
00074                 const char* what() const throw()
00075                 {
00076                         static std::string ex;
00077                         ex = _argId + " -- " + _errorText;
00078                         return ex.c_str();
00079                 }
00080 
00085                 std::string typeDescription() const
00086                 {
00087                         return _typeDescription;
00088                 }
00089 
00090 
00091         private:
00092 
00096                 std::string _errorText;
00097 
00101                 std::string _argId;
00102 
00107                 std::string _typeDescription;
00108 
00109 };
00110 
00117 class ArgParseException : public ArgException
00118 {
00119         public:
00126                 ArgParseException( const std::string& text = "undefined exception",
00127                                                const std::string& id = "undefined" )
00128                         : ArgException( text,
00129                                         id,
00130                                                         std::string( "Exception found while parsing " ) +
00131                                                         std::string( "the value the Arg has been passed." ))
00132                         { }
00133 };
00134 
00141 class CmdLineParseException : public ArgException
00142 {
00143         public:
00150                 CmdLineParseException( const std::string& text = "undefined exception",
00151                                                    const std::string& id = "undefined" )
00152                         : ArgException( text,
00153                                         id,
00154                                                         std::string( "Exception found when the values ") +
00155                                                         std::string( "on the command line do not meet ") +
00156                                                         std::string( "the requirements of the defined ") +
00157                                                         std::string( "Args." ))
00158                 { }
00159 };
00160 
00167 class SpecificationException : public ArgException
00168 {
00169         public:
00176                 SpecificationException( const std::string& text = "undefined exception",
00177                                                     const std::string& id = "undefined" )
00178                         : ArgException( text,
00179                                         id,
00180                                                         std::string("Exception found when an Arg object ")+
00181                                                         std::string("is improperly defined by the ") +
00182                                                         std::string("developer." ))
00183                 { }
00184 
00185 };
00186 
00187 }; // namespace ecl
00188 
00189 
00190 #endif
00191 


ecl_command_line
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:17