Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
 
Loading...
Searching...
No Matches
parser.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <nlohmann/json.hpp>
4using json = nlohmann::json;
5
6#include <google/protobuf/util/json_util.h>
7
8#include "parse_error.hpp"
9
10namespace dcn::parse
11{
18
24 struct use_json_t{};
25
31 static constexpr use_protobuf_t use_protobuf{};
32
38 static constexpr use_json_t use_json{};
39
46 template<class T>
48
55 template<class T>
56 Result<T> parseFromJson(std::string json_str, use_protobuf_t);
57
64 template<class T>
66
73 template<class T>
75}
Definition auth.cpp:4
Result< json > parseToJson(T message, use_json_t)
Converts a T to a JSON object using JSON.
std::expected< T, ParseError > Result
Definition parse_error.hpp:26
Result< T > parseFromJson(json json, use_json_t)
Converts a JSON string to a T using JSON.
nlohmann::json json
Definition parser.hpp:4
A tag type to indicate whether to use Protobuf or JSON for parsing.
Definition parser.hpp:24
A tag type to indicate whether to use Protobuf or JSON for parsing.
Definition parser.hpp:17