mirror of
https://github.com/monero-project/monero.git
synced 2025-05-08 00:44:58 -04:00
Add byte_stream for zero-copy serialization, and add support in ZMQ-JSON.
This commit is contained in:
parent
8185054db7
commit
c26c93019a
14 changed files with 806 additions and 171 deletions
|
@ -3,10 +3,10 @@
|
|||
#include <boost/range/adaptor/indexed.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/writer.h>
|
||||
#include <vector>
|
||||
|
||||
#include "byte_stream.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "cryptonote_basic/account.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
|
@ -86,14 +86,14 @@ namespace
|
|||
template<typename T>
|
||||
T test_json(const T& value)
|
||||
{
|
||||
rapidjson::StringBuffer buffer;
|
||||
epee::byte_stream buffer;
|
||||
{
|
||||
rapidjson::Writer<rapidjson::StringBuffer> dest{buffer};
|
||||
rapidjson::Writer<epee::byte_stream> dest{buffer};
|
||||
cryptonote::json::toJsonValue(dest, value);
|
||||
}
|
||||
|
||||
rapidjson::Document doc;
|
||||
doc.Parse(buffer.GetString());
|
||||
doc.Parse(reinterpret_cast<const char*>(buffer.data()), buffer.size());
|
||||
if (doc.HasParseError() || !doc.IsObject())
|
||||
{
|
||||
throw cryptonote::json::PARSE_FAIL();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue