File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1111#endif // if !defined(JSON_IS_AMALGAMATION)
1212#include < string>
1313#include < vector>
14+ #include < exception>
1415
1516#ifndef JSON_USE_CPPTL_SMALLMAP
1617#include < map>
3233 */
3334namespace Json {
3435
36+ /* * Base class for all exceptions we throw.
37+ */
38+ class Exception : public std ::exception {
39+ public:
40+ Exception (std::string const & msg);
41+ virtual ~Exception () throw ();
42+ virtual char const * what () const throw();
43+ protected:
44+ std::string const & msg_;
45+ void * future_use_;
46+ };
47+
3548/* * \brief Type of the value held by a Value object.
3649 */
3750enum ValueType {
Original file line number Diff line number Diff line change @@ -152,6 +152,18 @@ static inline void releaseStringValue(char* value) { free(value); }
152152
153153namespace Json {
154154
155+ Exception::Exception (std::string const & msg)
156+ : msg_(msg)
157+ , future_use_(NULL )
158+ {
159+ }
160+ Exception::~Exception () throw ()
161+ {}
162+ char const * Exception::what () const throw()
163+ {
164+ return msg_.c_str ();
165+ }
166+
155167// //////////////////////////////////////////////////////////////////
156168// //////////////////////////////////////////////////////////////////
157169// //////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments