DAW JSON Link
Macros | Functions | Variables
daw_json_assert.h File Reference
#include "../daw_json_exception.h"
#include <daw/daw_hide.h>
#include <daw/daw_string_view.h>
#include <algorithm>
#include <ciso646>
#include <cstdio>
#include <cstdlib>
#include <memory>
#include <numeric>
#include <string>
#include <string_view>

Go to the source code of this file.

Macros

#define daw_json_assert(Bool, ...)
 
#define daw_json_assert_weak(Bool, ...)
 
#define DAW_JSON_LIKELY(Bool)   !!( Bool )
 
#define DAW_JSON_NOINLINE   __attribute__( ( noinline ) )
 
#define DAW_JSON_UNLIKELY(Bool)   !!( Bool )
 
#define DAW_USE_JSON_EXCEPTIONS
 

Functions

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error (daw::json::ErrorReason reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error (daw::json::ErrorReason reason, Range const &location)
 
template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error (daw::json::json_details::missing_member reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error (daw::json::json_details::missing_member reason, Range const &location)
 
template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error (daw::json::json_details::missing_token reason)
 
template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error (daw::json::json_details::missing_token reason, Range const &location)
 

Variables

constexpr bool use_daw_json_exceptions_v = true
 

Macro Definition Documentation

◆ daw_json_assert

#define daw_json_assert (   Bool,
  ... 
)
Value:
if( DAW_JSON_UNLIKELY( not( Bool ) ) ) { \
daw_json_error( __VA_ARGS__ ); \
} \
while( false )

◆ daw_json_assert_weak

#define daw_json_assert_weak (   Bool,
  ... 
)
Value:
if constexpr( not Range::is_unchecked_input ) { \
if( DAW_JSON_UNLIKELY( not( Bool ) ) ) { \
daw_json_error( __VA_ARGS__ ); \
} \
} \
while( false )

◆ DAW_JSON_LIKELY

#define DAW_JSON_LIKELY (   Bool)    !!( Bool )

◆ DAW_JSON_NOINLINE

#define DAW_JSON_NOINLINE   __attribute__( ( noinline ) )

◆ DAW_JSON_UNLIKELY

#define DAW_JSON_UNLIKELY (   Bool)    !!( Bool )

◆ DAW_USE_JSON_EXCEPTIONS

#define DAW_USE_JSON_EXCEPTIONS

Function Documentation

◆ daw_json_error() [1/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::ErrorReason  reason)
static

◆ daw_json_error() [2/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::ErrorReason  reason,
Range const &  location 
)
static

◆ daw_json_error() [3/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::json_details::missing_member  reason)
static

◆ daw_json_error() [4/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::json_details::missing_member  reason,
Range const &  location 
)
static

◆ daw_json_error() [5/6]

template<bool ShouldThrow = use_daw_json_exceptions_v>
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::json_details::missing_token  reason)
static

◆ daw_json_error() [6/6]

template<bool ShouldThrow = use_daw_json_exceptions_v, typename Range >
static DAW_JSON_NOINLINE void daw_json_error ( daw::json::json_details::missing_token  reason,
Range const &  location 
)
static

Variable Documentation

◆ use_daw_json_exceptions_v

constexpr bool use_daw_json_exceptions_v = true
inlineconstexpr
DAW_JSON_UNLIKELY
#define DAW_JSON_UNLIKELY(Bool)
Definition: daw_json_assert.h:35