Removed stuff'
This commit is contained in:
@@ -14,8 +14,6 @@
|
||||
#include "serialization/variant.h"
|
||||
#include "serialization/vector.h"
|
||||
#include "serialization/binary_archive.h"
|
||||
#include "serialization/json_archive.h"
|
||||
#include "serialization/debug_archive.h"
|
||||
#include "serialization/crypto.h"
|
||||
#include "serialization/pricing_record.h"
|
||||
#include "serialization/keyvalue_serialization.h" // eepe named serialization
|
||||
@@ -658,33 +656,3 @@ VARIANT_TAG(binary_archive, cryptonote::txout_offshore, 0x3);
|
||||
VARIANT_TAG(binary_archive, cryptonote::txout_xasset, 0x5);
|
||||
VARIANT_TAG(binary_archive, cryptonote::transaction, 0xcc);
|
||||
VARIANT_TAG(binary_archive, cryptonote::block, 0xbb);
|
||||
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_gen, "gen");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_to_script, "script");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_to_scripthash, "scripthash");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_to_key, "key");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_offshore, "offshore");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_onshore, "onshore");
|
||||
VARIANT_TAG(json_archive, cryptonote::txin_xasset, "xasset");
|
||||
VARIANT_TAG(json_archive, cryptonote::txout_to_script, "script");
|
||||
VARIANT_TAG(json_archive, cryptonote::txout_to_scripthash, "scripthash");
|
||||
VARIANT_TAG(json_archive, cryptonote::txout_to_key, "key");
|
||||
VARIANT_TAG(json_archive, cryptonote::txout_offshore, "offshore");
|
||||
VARIANT_TAG(json_archive, cryptonote::txout_xasset, "xasset");
|
||||
VARIANT_TAG(json_archive, cryptonote::transaction, "tx");
|
||||
VARIANT_TAG(json_archive, cryptonote::block, "block");
|
||||
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_gen, "gen");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_to_script, "script");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_to_scripthash, "scripthash");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_to_key, "key");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_offshore, "offshore");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_onshore, "onshore");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txin_xasset, "xasset");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txout_to_script, "script");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txout_to_scripthash, "scripthash");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txout_to_key, "key");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txout_offshore, "offshore");
|
||||
VARIANT_TAG(debug_archive, cryptonote::txout_xasset, "xasset");
|
||||
VARIANT_TAG(debug_archive, cryptonote::transaction, "tx");
|
||||
VARIANT_TAG(debug_archive, cryptonote::block, "block");
|
||||
|
||||
@@ -138,16 +138,6 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template <typename T>
|
||||
std::string obj_to_json_str(T& obj)
|
||||
{
|
||||
std::stringstream ss;
|
||||
json_archive<true> ar(ss, true);
|
||||
bool r = ::serialization::serialize(ar, obj);
|
||||
CHECK_AND_ASSERT_MES(r, "", "obj_to_json_str failed: serialization::serialize returned false");
|
||||
return ss.str();
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
// 62387455827 -> 455827 + 7000000 + 80000000 + 300000000 + 2000000000 + 60000000000, where 455827 <= dust_threshold
|
||||
template<typename chunk_handler_t, typename dust_handler_t>
|
||||
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t& chunk_handler, const dust_handler_t& dust_handler)
|
||||
|
||||
@@ -50,9 +50,7 @@ extern "C" {
|
||||
#include "span.h"
|
||||
#include "memwipe.h"
|
||||
#include "serialization/vector.h"
|
||||
#include "serialization/debug_archive.h"
|
||||
#include "serialization/binary_archive.h"
|
||||
#include "serialization/json_archive.h"
|
||||
|
||||
|
||||
//Define this flag when debugging to get additional info on the console
|
||||
@@ -739,23 +737,6 @@ BLOB_SERIALIZER(rct::ctkey);
|
||||
BLOB_SERIALIZER(rct::multisig_kLRki);
|
||||
BLOB_SERIALIZER(rct::boroSig);
|
||||
|
||||
VARIANT_TAG(debug_archive, rct::key, "rct::key");
|
||||
VARIANT_TAG(debug_archive, rct::key64, "rct::key64");
|
||||
VARIANT_TAG(debug_archive, rct::keyV, "rct::keyV");
|
||||
VARIANT_TAG(debug_archive, rct::keyM, "rct::keyM");
|
||||
VARIANT_TAG(debug_archive, rct::ctkey, "rct::ctkey");
|
||||
VARIANT_TAG(debug_archive, rct::ctkeyV, "rct::ctkeyV");
|
||||
VARIANT_TAG(debug_archive, rct::ctkeyM, "rct::ctkeyM");
|
||||
VARIANT_TAG(debug_archive, rct::ecdhTuple, "rct::ecdhTuple");
|
||||
VARIANT_TAG(debug_archive, rct::mgSig, "rct::mgSig");
|
||||
VARIANT_TAG(debug_archive, rct::rangeSig, "rct::rangeSig");
|
||||
VARIANT_TAG(debug_archive, rct::boroSig, "rct::boroSig");
|
||||
VARIANT_TAG(debug_archive, rct::rctSig, "rct::rctSig");
|
||||
VARIANT_TAG(debug_archive, rct::Bulletproof, "rct::bulletproof");
|
||||
VARIANT_TAG(debug_archive, rct::multisig_kLRki, "rct::multisig_kLRki");
|
||||
VARIANT_TAG(debug_archive, rct::multisig_out, "rct::multisig_out");
|
||||
VARIANT_TAG(debug_archive, rct::clsag, "rct::clsag");
|
||||
|
||||
VARIANT_TAG(binary_archive, rct::key, 0x90);
|
||||
VARIANT_TAG(binary_archive, rct::key64, 0x91);
|
||||
VARIANT_TAG(binary_archive, rct::keyV, 0x92);
|
||||
@@ -773,21 +754,4 @@ VARIANT_TAG(binary_archive, rct::multisig_kLRki, 0x9d);
|
||||
VARIANT_TAG(binary_archive, rct::multisig_out, 0x9e);
|
||||
VARIANT_TAG(binary_archive, rct::clsag, 0x9f);
|
||||
|
||||
VARIANT_TAG(json_archive, rct::key, "rct_key");
|
||||
VARIANT_TAG(json_archive, rct::key64, "rct_key64");
|
||||
VARIANT_TAG(json_archive, rct::keyV, "rct_keyV");
|
||||
VARIANT_TAG(json_archive, rct::keyM, "rct_keyM");
|
||||
VARIANT_TAG(json_archive, rct::ctkey, "rct_ctkey");
|
||||
VARIANT_TAG(json_archive, rct::ctkeyV, "rct_ctkeyV");
|
||||
VARIANT_TAG(json_archive, rct::ctkeyM, "rct_ctkeyM");
|
||||
VARIANT_TAG(json_archive, rct::ecdhTuple, "rct_ecdhTuple");
|
||||
VARIANT_TAG(json_archive, rct::mgSig, "rct_mgSig");
|
||||
VARIANT_TAG(json_archive, rct::rangeSig, "rct_rangeSig");
|
||||
VARIANT_TAG(json_archive, rct::boroSig, "rct_boroSig");
|
||||
VARIANT_TAG(json_archive, rct::rctSig, "rct_rctSig");
|
||||
VARIANT_TAG(json_archive, rct::Bulletproof, "rct_bulletproof");
|
||||
VARIANT_TAG(json_archive, rct::multisig_kLRki, "rct_multisig_kLR");
|
||||
VARIANT_TAG(json_archive, rct::multisig_out, "rct_multisig_out");
|
||||
VARIANT_TAG(json_archive, rct::clsag, "rct_clsag");
|
||||
|
||||
#endif /* RCTTYPES_H */
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "json_archive.h"
|
||||
#include "variant.h"
|
||||
|
||||
template <bool W>
|
||||
struct debug_archive : public json_archive<W> {
|
||||
typedef typename json_archive<W>::stream_type stream_type;
|
||||
|
||||
debug_archive(stream_type &s) : json_archive<W>(s) { }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct serializer<debug_archive<true>, T>
|
||||
{
|
||||
static void serialize(debug_archive<true> &ar, T &v)
|
||||
{
|
||||
ar.begin_object();
|
||||
ar.tag(variant_serialization_traits<debug_archive<true>, T>::get_tag());
|
||||
serializer<json_archive<true>, T>::serialize(ar, v);
|
||||
ar.end_object();
|
||||
ar.stream() << std::endl;
|
||||
}
|
||||
};
|
||||
@@ -1,145 +0,0 @@
|
||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
/* json_archive.h
|
||||
*
|
||||
* JSON archive */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "serialization.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
template <class Stream, bool IsSaving>
|
||||
struct json_archive_base
|
||||
{
|
||||
typedef Stream stream_type;
|
||||
typedef json_archive_base<Stream, IsSaving> base_type;
|
||||
typedef boost::mpl::bool_<IsSaving> is_saving;
|
||||
|
||||
typedef const char *variant_tag_type;
|
||||
|
||||
json_archive_base(stream_type &s, bool indent = false) : stream_(s), indent_(indent), object_begin(false), depth_(0) { }
|
||||
|
||||
void tag(const char *tag) {
|
||||
if (!object_begin)
|
||||
stream_ << ", ";
|
||||
make_indent();
|
||||
stream_ << '"' << tag << "\": ";
|
||||
object_begin = false;
|
||||
}
|
||||
|
||||
void begin_object()
|
||||
{
|
||||
stream_ << "{";
|
||||
++depth_;
|
||||
object_begin = true;
|
||||
}
|
||||
|
||||
void end_object()
|
||||
{
|
||||
--depth_;
|
||||
make_indent();
|
||||
stream_ << "}";
|
||||
}
|
||||
|
||||
void begin_variant() { begin_object(); }
|
||||
void end_variant() { end_object(); }
|
||||
Stream &stream() { return stream_; }
|
||||
|
||||
protected:
|
||||
void make_indent()
|
||||
{
|
||||
if (indent_)
|
||||
{
|
||||
stream_ << '\n' << std::string(2 * depth_, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
stream_type &stream_;
|
||||
bool indent_;
|
||||
bool object_begin;
|
||||
size_t depth_;
|
||||
};
|
||||
|
||||
template <bool W>
|
||||
struct json_archive;
|
||||
|
||||
template <>
|
||||
struct json_archive<true> : public json_archive_base<std::ostream, true>
|
||||
{
|
||||
json_archive(stream_type &s, bool indent = false) : base_type(s, indent) { }
|
||||
|
||||
template<typename T>
|
||||
static auto promote_to_printable_integer_type(T v) -> decltype(+v)
|
||||
{
|
||||
// Unary operator '+' performs integral promotion on type T [expr.unary.op].
|
||||
// If T is signed or unsigned char, it's promoted to int and printed as number.
|
||||
return +v;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void serialize_int(T v)
|
||||
{
|
||||
stream_ << std::dec << promote_to_printable_integer_type(v);
|
||||
}
|
||||
|
||||
void serialize_blob(void *buf, size_t len, const char *delimiter="\"") {
|
||||
begin_string(delimiter);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
unsigned char c = ((unsigned char *)buf)[i];
|
||||
stream_ << std::hex << std::setw(2) << std::setfill('0') << (int)c;
|
||||
}
|
||||
end_string(delimiter);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void serialize_varint(T &v)
|
||||
{
|
||||
stream_ << std::dec << promote_to_printable_integer_type(v);
|
||||
}
|
||||
|
||||
void begin_string(const char *delimiter="\"")
|
||||
{
|
||||
stream_ << delimiter;
|
||||
}
|
||||
|
||||
void end_string(const char *delimiter="\"")
|
||||
{
|
||||
stream_ << delimiter;
|
||||
}
|
||||
|
||||
void begin_array(size_t s=0)
|
||||
{
|
||||
inner_array_size_ = s;
|
||||
++depth_;
|
||||
stream_ << "[ ";
|
||||
}
|
||||
|
||||
void delimit_array()
|
||||
{
|
||||
stream_ << ", ";
|
||||
}
|
||||
|
||||
void end_array()
|
||||
{
|
||||
--depth_;
|
||||
if (0 < inner_array_size_)
|
||||
{
|
||||
make_indent();
|
||||
}
|
||||
stream_ << "]";
|
||||
}
|
||||
|
||||
void write_variant_tag(const char *t)
|
||||
{
|
||||
tag(t);
|
||||
}
|
||||
|
||||
private:
|
||||
size_t inner_array_size_;
|
||||
};
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include "json_archive.h"
|
||||
|
||||
namespace serialization {
|
||||
|
||||
template<class T>
|
||||
std::string dump_json(T &v)
|
||||
{
|
||||
std::stringstream ostr;
|
||||
json_archive<true> oar(ostr);
|
||||
assert(serialization::serialize(oar, v));
|
||||
return ostr.str();
|
||||
};
|
||||
|
||||
} // namespace serialization
|
||||
Reference in New Issue
Block a user