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 11
11
#endif // if !defined(JSON_IS_AMALGAMATION)
12
12
#include < string>
13
13
#include < vector>
14
+ #include < exception>
14
15
15
16
#ifndef JSON_USE_CPPTL_SMALLMAP
16
17
#include < map>
32
33
*/
33
34
namespace Json {
34
35
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
+
35
48
/* * \brief Type of the value held by a Value object.
36
49
*/
37
50
enum ValueType {
Original file line number Diff line number Diff line change @@ -152,6 +152,18 @@ static inline void releaseStringValue(char* value) { free(value); }
152
152
153
153
namespace Json {
154
154
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
+
155
167
// //////////////////////////////////////////////////////////////////
156
168
// //////////////////////////////////////////////////////////////////
157
169
// //////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments