JsonCpp project page JsonCpp home page

Defines

include/json/assertions.h File Reference

#include <stdlib.h>
#include <sstream>
#include "config.h"

Go to the source code of this file.

Defines

#define JSON_ASSERT(condition)   {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
 It should not be possible for a maliciously designed file to cause an abort() or seg-fault, so these macros are used only for pre-condition violations and internal logic errors.
#define JSON_FAIL_MESSAGE(message)
#define JSON_ASSERT_MESSAGE(condition, message)

Define Documentation

#define JSON_ASSERT (   condition  )     {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}

It should not be possible for a maliciously designed file to cause an abort() or seg-fault, so these macros are used only for pre-condition violations and internal logic errors.

Definition at line 23 of file assertions.h.

#define JSON_ASSERT_MESSAGE (   condition,
  message 
)
Value:
if (!(condition)) {                                                          \
    JSON_FAIL_MESSAGE(message);                                                \
  }

Definition at line 49 of file assertions.h.

Referenced by Json::Value::asInt(), Json::Value::asInt64(), Json::duplicateAndPrefixStringValue(), and Json::Value::getMemberNames().

#define JSON_FAIL_MESSAGE (   message  ) 
Value:
{                                                                            \
    std::ostringstream oss; oss << message;                                    \
    Json::throwLogicError(oss.str());                                          \
    abort();                                                                   \
  }

Definition at line 26 of file assertions.h.

Referenced by Json::Value::asInt(), and Json::Value::asInt64().