Monado OpenXR Runtime
u_json.hpp File Reference

C++ wrapper for cJSON. More...

#include "util/u_file.h"
#include "util/u_debug.h"
#include "cjson/cJSON.h"
#include <cassert>
#include <stack>
#include <vector>
#include <map>
#include <memory>
#include <variant>
#include <fstream>
#include <sstream>
Include dependency graph for u_json.hpp:

Go to the source code of this file.

Data Structures

class  xrt::auxiliary::util::json::JSONNode
 A JSONNode wraps a cJSON object and presents useful functions for accessing the different properties of the json structure like operator[], isType() and asType() methods. More...
 
class  xrt::auxiliary::util::json::JSONBuilder
 Helper class for building cJSON trees through operator<< More...
 

Macros

#define JSON_TRACE(...)   U_LOG_IFL_T(debug_get_log_option_json_log(), __VA_ARGS__)
 
#define JSON_DEBUG(...)   U_LOG_IFL_D(debug_get_log_option_json_log(), __VA_ARGS__)
 
#define JSON_INFO(...)   U_LOG_IFL_I(debug_get_log_option_json_log(), __VA_ARGS__)
 
#define JSON_WARN(...)   U_LOG_IFL_W(debug_get_log_option_json_log(), __VA_ARGS__)
 
#define JSON_ERROR(...)   U_LOG_IFL_E(debug_get_log_option_json_log(), __VA_ARGS__)
 
#define JSON_ASSERT(fatal, predicate, ...)
 
#define JSON_ASSERTF(predicate, ...)   JSON_ASSERT(true, predicate, __VA_ARGS__)
 
#define JSON_ASSERTF_(predicate)   JSON_ASSERT(true, predicate, "Assertion failed " #predicate)
 
#define JSON_ASSERTW(predicate, ...)   JSON_ASSERT(false, predicate, __VA_ARGS__)
 

Detailed Description

C++ wrapper for cJSON.

Author
Mateo de Mayo mateo.nosp@m..dem.nosp@m.ayo@c.nosp@m.olla.nosp@m.bora..nosp@m.com

Macro Definition Documentation

◆ JSON_ASSERT

#define JSON_ASSERT (   fatal,
  predicate,
  ... 
)
Value:
do { \
bool p = predicate; \
if (!p) { \
JSON_ERROR(__VA_ARGS__); \
if (fatal) { \
assert(false && "Assertion failed: " #predicate); \
exit(EXIT_FAILURE); \
} \
} \
} while (false);