// // json_exception.h // json // // Created by Sam Jaffe on 11/17/18. // Copyright © 2018 Sam Jaffe. All rights reserved. // #pragma once #include #include namespace json { class malformed_json_exception : public std::domain_error { using std::domain_error::domain_error; }; struct not_an_object_exception : public malformed_json_exception { template not_an_object_exception(T const &) : not_an_object_exception(typeid(T).name()) {} not_an_object_exception(char const * tname); }; class not_an_array_exception : public malformed_json_exception { public: template not_an_array_exception(T const &) : not_an_array_exception(typeid(T).name()) {} private: not_an_array_exception(char const * tname); }; struct malformed_object_key : public malformed_json_exception { malformed_object_key(char instead); }; struct malformed_object_association : public malformed_json_exception { malformed_object_association(char instead); }; class unterminated_json_exception : public malformed_json_exception { using malformed_json_exception::malformed_json_exception; }; struct unterminated_json_array : public unterminated_json_exception { unterminated_json_array(); }; struct unterminated_json_object : public unterminated_json_exception { unterminated_json_object(); }; class json_numeric_exception : public std::domain_error { using std::domain_error::domain_error; }; class json_numeric_width_exception : public json_numeric_exception { using json_numeric_exception::json_numeric_exception; }; }