blob: eb8701027523d15540a9d06c692257565b990e64 [file] [log] [blame]
Aaron Jacobse3d0eca2011-05-24 01:03:22 +00001// 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
Aaron Jacobsa7615302011-05-24 06:27:36 +00009#include <stdlib.h>
10#include <iostream>
11
Aaron Jacobse3d0eca2011-05-24 01:03:22 +000012#if !defined(JSON_IS_AMALGAMATION)
13# include <json/config.h>
14#endif // if !defined(JSON_IS_AMALGAMATION)
15
16#if defined(JSON_USE_EXCEPTION)
17#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
18#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
19#else // defined(JSON_USE_EXCEPTION)
20#define JSON_ASSERT( condition ) assert( condition );
21#define JSON_FAIL_MESSAGE( message ) { std::cerr << message; exit(123); }
22#endif
23
24#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) }
25
26#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED