Aaron Jacobs | e3d0eca | 2011-05-24 01:03:22 +0000 | [diff] [blame] | 1 | // Copyright 2007-2010 Baptiste Lepilleur |
| 2 | // Distributed under MIT license, or public domain if desired and |
| 3 | // recognized in your jurisdiction. |
| 4 | // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE |
| 5 | |
| 6 | #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED |
| 7 | # define CPPTL_JSON_ASSERTIONS_H_INCLUDED |
| 8 | |
| 9 | #if !defined(JSON_IS_AMALGAMATION) |
| 10 | # include <json/config.h> |
| 11 | #endif // if !defined(JSON_IS_AMALGAMATION) |
| 12 | |
| 13 | #if defined(JSON_USE_EXCEPTION) |
| 14 | #define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw |
| 15 | #define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message ); |
| 16 | #else // defined(JSON_USE_EXCEPTION) |
| 17 | #define JSON_ASSERT( condition ) assert( condition ); |
| 18 | #define JSON_FAIL_MESSAGE( message ) { std::cerr << message; exit(123); } |
| 19 | #endif |
| 20 | |
| 21 | #define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) } |
| 22 | |
| 23 | #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED |