DAW JSON Link
Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Functions | Variables
daw_json_assert.h File Reference
#include "daw/json/impl/version.h"
#include "daw/json/daw_json_exception.h"
#include <daw/daw_attributes.h>
#include <daw/daw_cpp_feature_check.h>
#include <daw/daw_likely.h>
#include <daw/daw_not_null.h>
#include <daw/daw_static_warn_if.h>
#include <cstddef>
#include <daw/stdinc/move_fwd_exch.h>
#include <exception>
#include <string_view>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  daw
 
namespace  daw::json
 string_writer grows its string with resize_and_overwrite, leaving the new bytes uninitialized, when the standard library has it. That skips zero filling memory that is overwritten right away, but the bytes past what was written are never initialized, which resize_and_overwrite's precondition does not allow. Define DAW_JSON_NO_LESS_SAFE_STRING_WRITER to grow with resize( ) instead
 
namespace  daw::json::anonymous_namespace{daw_json_assert.h}
 

Macros

#define daw_json_assert_weak(Bool, ...)
 Assert that Bool is true when in Checked Input mode If false pass rest of args to daw_json_error.
 
#define daw_json_dbg_ensure(Bool, ...)
 
#define daw_json_ensure(Bool, ...)
 Ensure that Bool is true. If false pass rest of args to daw_json_error.
 

Typedefs

using daw::json::daw_json_error_handler_t = daw::not_null< void(*)(json_exception &&, void *)>
 

Functions

DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, ErrorReason reason)
 
template<typename ParseState >
DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, ErrorReason reason, ParseState const &location)
 
DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, json_details::missing_member reason)
 
template<typename ParseState >
DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, json_details::missing_member reason, ParseState const &location)
 
DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, json_details::missing_token reason)
 
template<typename ParseState >
DAW_ATTRIB_NOINLINE void daw::json::anonymous_namespace{daw_json_assert.h}::daw_json_error (bool b, json_details::missing_token reason, ParseState const &location)
 
DAW_ATTRIB_NOINLINE void daw::json::default_error_handler_terminating (json_exception &&jex, void *)
 

Variables

thread_local daw_json_error_handler_t daw::json::daw_json_error_handler
 
thread_local void * daw::json::daw_json_error_handler_data = nullptr
 
constexpr bool daw::json::use_daw_json_exceptions_v = false
 

Macro Definition Documentation

◆ daw_json_assert_weak

#define daw_json_assert_weak (   Bool,
  ... 
)
Value:
do { \
if constexpr( not ParseState::is_unchecked_input ) { \
if( DAW_UNLIKELY( not( Bool ) ) ) { \
daw_static_warn_if( not( Bool ), \
"Error handler will always be called: " #Bool ); \
daw_json_error( not( Bool ), __VA_ARGS__ ); \
} \
} \
} while( false )

Assert that Bool is true when in Checked Input mode If false pass rest of args to daw_json_error.

Definition at line 232 of file daw_json_assert.h.

◆ daw_json_dbg_ensure

#define daw_json_dbg_ensure (   Bool,
  ... 
)
Value:
do { \
if( DAW_UNLIKELY( not( Bool ) ) ) { \
daw_static_warn_if( not( Bool ), \
"Error handler will always be called: " #Bool ); \
daw_json_error( not( Bool ), __VA_ARGS__ ); \
} \
} while( false )

Definition at line 245 of file daw_json_assert.h.

◆ daw_json_ensure

#define daw_json_ensure (   Bool,
  ... 
)
Value:
do { \
if( DAW_UNLIKELY( not( Bool ) ) ) { \
daw_static_warn_if( not( Bool ), \
"Error handler will always be called: " #Bool ); \
daw_json_error( not( Bool ), __VA_ARGS__ ); \
} \
} while( false )

Ensure that Bool is true. If false pass rest of args to daw_json_error.

Definition at line 186 of file daw_json_assert.h.