mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-06-07 09:04:57 +02:00
parent
6ed877c77c
commit
949babd7b0
@ -37,21 +37,36 @@ namespace Json {
|
|||||||
*
|
*
|
||||||
* We use nothing but these internally. Of course, STL can throw others.
|
* We use nothing but these internally. Of course, STL can throw others.
|
||||||
*/
|
*/
|
||||||
class JSON_API Exception;
|
class JSON_API Exception : public std::exception {
|
||||||
|
public:
|
||||||
|
Exception(std::string const& msg);
|
||||||
|
virtual ~Exception() throw();
|
||||||
|
virtual char const* what() const throw();
|
||||||
|
protected:
|
||||||
|
std::string const msg_;
|
||||||
|
};
|
||||||
|
|
||||||
/** Exceptions which the user cannot easily avoid.
|
/** Exceptions which the user cannot easily avoid.
|
||||||
*
|
*
|
||||||
* E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
|
* E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
|
||||||
*
|
*
|
||||||
* \remark derived from Json::Exception
|
* \remark derived from Json::Exception
|
||||||
*/
|
*/
|
||||||
class JSON_API RuntimeError;
|
class JSON_API RuntimeError : public Exception {
|
||||||
|
public:
|
||||||
|
RuntimeError(std::string const& msg);
|
||||||
|
};
|
||||||
|
|
||||||
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
|
/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
|
||||||
*
|
*
|
||||||
* These are precondition-violations (user bugs) and internal errors (our bugs).
|
* These are precondition-violations (user bugs) and internal errors (our bugs).
|
||||||
*
|
*
|
||||||
* \remark derived from Json::Exception
|
* \remark derived from Json::Exception
|
||||||
*/
|
*/
|
||||||
class JSON_API LogicError;
|
class JSON_API LogicError : public Exception {
|
||||||
|
public:
|
||||||
|
LogicError(std::string const& msg);
|
||||||
|
};
|
||||||
|
|
||||||
/// used internally
|
/// used internally
|
||||||
void throwRuntimeError(std::string const& msg);
|
void throwRuntimeError(std::string const& msg);
|
||||||
|
@ -152,23 +152,6 @@ static inline void releaseStringValue(char* value) { free(value); }
|
|||||||
|
|
||||||
namespace Json {
|
namespace Json {
|
||||||
|
|
||||||
class JSON_API Exception : public std::exception {
|
|
||||||
public:
|
|
||||||
Exception(std::string const& msg);
|
|
||||||
virtual ~Exception() throw();
|
|
||||||
virtual char const* what() const throw();
|
|
||||||
protected:
|
|
||||||
std::string const msg_;
|
|
||||||
};
|
|
||||||
class JSON_API RuntimeError : public Exception {
|
|
||||||
public:
|
|
||||||
RuntimeError(std::string const& msg);
|
|
||||||
};
|
|
||||||
class JSON_API LogicError : public Exception {
|
|
||||||
public:
|
|
||||||
LogicError(std::string const& msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
Exception::Exception(std::string const& msg)
|
Exception::Exception(std::string const& msg)
|
||||||
: msg_(msg)
|
: msg_(msg)
|
||||||
{}
|
{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user