Electroneum
Loading...
Searching...
No Matches
json_object.h File Reference
Include dependency graph for json_object.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cryptonote::json::JSON_ERROR
struct  cryptonote::json::MISSING_KEY
struct  cryptonote::json::WRONG_TYPE
struct  cryptonote::json::BAD_INPUT
struct  cryptonote::json::PARSE_FAIL

Namespaces

namespace  cryptonote
 Holds cryptonote related classes and helpers.
namespace  cryptonote::json

Macros

#define OBJECT_HAS_MEMBER_OR_THROW(val, key)
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
#define GET_FROM_JSON_OBJECT(source, dst, key)

Functions

template<typename Type>
constexpr bool cryptonote::json::is_to_hex ()
template<class Type>
std::enable_if< is_to_hex< Type >()>::type cryptonote::json::toJsonValue (rapidjson::Document &doc, const Type &pod, rapidjson::Value &value)
template<class Type>
std::enable_if< is_to_hex< Type >()>::type cryptonote::json::fromJsonValue (const rapidjson::Value &val, Type &t)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const std::string &i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, std::string &str)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, bool i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, bool &b)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, unsigned char &i)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, signed char &i)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, char &i)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, unsigned short &i)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, short &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const unsigned i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, unsigned &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const int i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, int &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const unsigned long long i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, unsigned long long &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const long long i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, long long &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const unsigned long i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, unsigned long &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const long i, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, long &i)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::transaction &tx, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::transaction &tx)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::block &b, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::block &b)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_v &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_v &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_gen &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_gen &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_script &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_script &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_scripthash &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_scripthash &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_key &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_key &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_key_public &txin, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_key_public &txin)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txout_target_v &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txout_target_v &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_script &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_script &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_scripthash &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_scripthash &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_key &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_key &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_key_public &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_key_public &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::tx_out &txout, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::tx_out &txout)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::connection_info &info, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::connection_info &info)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::block_complete_entry &blk, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::block_complete_entry &blk)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::block_with_transactions &blk, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::block_with_transactions &blk)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::transaction_info &tx_info, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::transaction_info &tx_info)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_key_and_amount_index &out, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_key_and_amount_index &out)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::amount_with_random_outputs &out, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::amount_with_random_outputs &out)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::peer &peer, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::peer &peer)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::tx_in_pool &tx, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::tx_in_pool &tx)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::hard_fork_info &info, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::hard_fork_info &info)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_amount_count &out, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_amount_count &out)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_amount_and_index &out, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_amount_and_index &out)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_key_mask_unlocked &out, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_key_mask_unlocked &out)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::error &err, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::error &error)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::BlockHeaderResponse &response, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::BlockHeaderResponse &response)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::rctSig &sig, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::rctSig &sig)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::ecdhTuple &tuple, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::ecdhTuple &tuple)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::rangeSig &sig, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::rangeSig &sig)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::Bulletproof &p, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::Bulletproof &p)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::boroSig &sig, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::boroSig &sig)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const rct::mgSig &sig, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, rct::mgSig &sig)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::DaemonInfo &info, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::DaemonInfo &info)
void cryptonote::json::toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_distribution &dist, rapidjson::Value &val)
void cryptonote::json::fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_distribution &dist)
template<typename Map>
std::enable_if< sfinae::is_map_like< Map >::value, void >::type cryptonote::json::toJsonValue (rapidjson::Document &doc, const Map &map, rapidjson::Value &val)
template<typename Map>
std::enable_if< sfinae::is_map_like< Map >::value, void >::type cryptonote::json::fromJsonValue (const rapidjson::Value &val, Map &map)
template<typename Vec>
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type cryptonote::json::toJsonValue (rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
template<typename Vec>
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type cryptonote::json::fromJsonValue (const rapidjson::Value &val, Vec &vec)

Macro Definition Documentation

◆ GET_FROM_JSON_OBJECT

#define GET_FROM_JSON_OBJECT ( source,
dst,
key )
Value:
decltype(dst) dstVal##key; \
cryptonote::json::fromJsonValue(source[#key], dstVal##key); \
dst = dstVal##key;
const char * key
#define OBJECT_HAS_MEMBER_OR_THROW(val, key)
Definition json_object.h:38
const CharType(& source)[N]
Definition pointer.h:1147

Definition at line 52 of file json_object.h.

52#define GET_FROM_JSON_OBJECT(source, dst, key) \
53 OBJECT_HAS_MEMBER_OR_THROW(source, #key) \
54 decltype(dst) dstVal##key; \
55 cryptonote::json::fromJsonValue(source[#key], dstVal##key); \
56 dst = dstVal##key;

◆ INSERT_INTO_JSON_OBJECT

#define INSERT_INTO_JSON_OBJECT ( jsonVal,
doc,
key,
source )
Value:
rapidjson::Value key##Val; \
cryptonote::json::toJsonValue(doc, source, key##Val); \
jsonVal.AddMember(#key, key##Val, doc.GetAllocator());

Definition at line 47 of file json_object.h.

47#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source) \
48 rapidjson::Value key##Val; \
49 cryptonote::json::toJsonValue(doc, source, key##Val); \
50 jsonVal.AddMember(#key, key##Val, doc.GetAllocator());

◆ OBJECT_HAS_MEMBER_OR_THROW

#define OBJECT_HAS_MEMBER_OR_THROW ( val,
key )
Value:
do \
{ \
if (!val.HasMember(key)) \
{ \
throw cryptonote::json::MISSING_KEY(key); \
} \
} while (0);

Definition at line 38 of file json_object.h.

38#define OBJECT_HAS_MEMBER_OR_THROW(val, key) \
39 do \
40 { \
41 if (!val.HasMember(key)) \
42 { \
43 throw cryptonote::json::MISSING_KEY(key); \
44 } \
45 } while (0);