annotate 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
rev   line source
ian@0 1 // Copyright 2007-2010 Baptiste Lepilleur
ian@0 2 // Distributed under MIT license, or public domain if desired and
ian@0 3 // recognized in your jurisdiction.
ian@0 4 // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
ian@0 5
ian@0 6 #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
ian@0 7 # define CPPTL_JSON_ASSERTIONS_H_INCLUDED
ian@0 8
ian@0 9 #include <stdlib.h>
ian@0 10 #include <iostream>
ian@0 11
ian@0 12 #if !defined(JSON_IS_AMALGAMATION)
ian@0 13 # include <json/config.h>
ian@0 14 #endif // if !defined(JSON_IS_AMALGAMATION)
ian@0 15
ian@0 16 #if defined(JSON_USE_EXCEPTION)
ian@0 17 #define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
ian@0 18 #define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
ian@0 19 #else // defined(JSON_USE_EXCEPTION)
ian@0 20 #define JSON_ASSERT( condition ) assert( condition );
ian@0 21 #define JSON_FAIL_MESSAGE( message ) { std::cerr << std::endl << message << std::endl; exit(123); }
ian@0 22 #endif
ian@0 23
ian@0 24 #define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) { JSON_FAIL_MESSAGE( message ) }
ian@0 25
ian@0 26 #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED