JsonCpp project page | JsonCpp home page

Macros
assertions.h File Reference
`#include <stdlib.h>`
`#include <sstream>`
`#include "config.h"`
Include dependency graph for assertions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#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. More...
#define | JSON_FAIL_MESSAGE(message)
#define | JSON_ASSERT_MESSAGE(condition, message)

## Macro Definition Documentation

## ◆ JSON_ASSERT

#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.

Referenced by Json::__declspec(), Json::Value::operator<(), Json::Value::operator==(), and Json::Value::resize().

## ◆ JSON_ASSERT_MESSAGE

#define JSON_ASSERT_MESSAGE | ( |  | condition,
|  |  | message
| ) |  |

Value:
if (!(condition)) { \
JSON_FAIL_MESSAGE(message); \
}

Definition at line 49 of file assertions.h.

Referenced by Json::__declspec(), Json::Value::asCString(), Json::Value::asInt(), Json::Value::asInt64(), Json::Value::asUInt(), Json::Value::asUInt64(), Json::Value::clear(), Json::duplicateAndPrefixStringValue(), Json::Value::find(), Json::Value::getMemberNames(), Json::Value::operator[](), Json::Value::removeMember(), Json::Value::resize(), and Json::Value::Value().

## ◆ JSON_FAIL_MESSAGE

#define JSON_FAIL_MESSAGE | ( |  | message | ) |

Value:
{ \
JSONCPP_OSTRINGSTREAM oss; oss << message; \
Json::throwLogicError(oss.str()); \
abort(); \
}

Definition at line 26 of file assertions.h.

Referenced by Json::Value::asBool(), Json::Value::asDouble(), Json::Value::asFloat(), Json::Value::asInt(), Json::Value::asInt64(), Json::Value::asString(), Json::Value::asUInt(), and Json::Value::asUInt64().