comparison third_party/json/assertions.h @ 0:add35537fdbb tip

Initial import
author irh <ian.r.hobson@gmail.com>
date Thu, 25 Aug 2011 11:05:55 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:add35537fdbb
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 #include <stdlib.h>
10 #include <iostream>
11
12 #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 << std::endl << message << std::endl; 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