diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index d19d7a975..2285d716f 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -2267,10 +2267,19 @@
True
True
+
+ True
+
+
+ True
+
True
True
+
+ True
+
@@ -2281,12 +2290,27 @@
+
+
+
+
True
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+
@@ -3116,16 +3140,6 @@
-
- True
-
-
-
-
- True
-
-
-
True
@@ -3168,11 +3182,6 @@
True
-
- True
-
-
-
True
@@ -3180,8 +3189,6 @@
-
-
@@ -3193,15 +3200,9 @@
True
-
- True
-
True
-
- True
-
True
@@ -3210,9 +3211,6 @@
-
- True
-
True
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index 0717201e1..0631a09b5 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -3024,9 +3024,18 @@
ripple\json\impl
+
+ ripple\json\impl
+
+
+ ripple\json\impl
+
ripple\json\impl
+
+ ripple\json\impl
+
ripple\json
@@ -3042,12 +3051,30 @@
ripple\json
+
+ ripple\json
+
+
+ ripple\json
+
ripple\json\tests
+
+ ripple\json\tests
+
+
+ ripple\json\tests
+
+
+ ripple\json\tests
+
ripple\json
+
+ ripple\json
+
ripple\net
@@ -3876,18 +3903,6 @@
ripple\rpc\impl
-
- ripple\rpc\impl
-
-
- ripple\rpc\impl
-
-
- ripple\rpc\impl
-
-
- ripple\rpc\impl
-
ripple\rpc\impl
@@ -3936,12 +3951,6 @@
ripple\rpc\impl
-
- ripple\rpc\impl
-
-
- ripple\rpc\impl
-
ripple\rpc\impl
@@ -3951,9 +3960,6 @@
ripple\rpc
-
- ripple\rpc
-
ripple\rpc
@@ -3969,15 +3975,9 @@
ripple\rpc\tests
-
- ripple\rpc\tests
-
ripple\rpc\tests
-
- ripple\rpc\tests
-
ripple\rpc\tests
@@ -3987,9 +3987,6 @@
ripple\rpc\tests
-
- ripple\rpc\tests
-
ripple\rpc\tests
diff --git a/src/ripple/app/ledger/LedgerToJson.h b/src/ripple/app/ledger/LedgerToJson.h
index 45e9072b1..6ba70d00b 100644
--- a/src/ripple/app/ledger/LedgerToJson.h
+++ b/src/ripple/app/ledger/LedgerToJson.h
@@ -25,7 +25,7 @@
#include
#include
#include
-#include
+#include
#include
namespace ripple {
@@ -118,7 +118,7 @@ void fillJson (Object& json, LedgerFill const& fill)
auto &transactionMap = ledger.peekTransactionMap();
if (transactionMap && (bFull || fill.options & LedgerFill::dumpTxrp))
{
- auto&& txns = RPC::setArray (json, jss::transactions);
+ auto&& txns = Json::setArray (json, jss::transactions);
SHAMapTreeNode::TNType type;
RPC::CountedYield count (
@@ -163,7 +163,7 @@ void fillJson (Object& json, LedgerFill const& fill)
auto& accountStateMap = ledger.peekAccountStateMap();
if (accountStateMap && (bFull || fill.options & LedgerFill::dumpState))
{
- auto&& array = RPC::setArray (json, jss::accountState);
+ auto&& array = Json::setArray (json, jss::accountState);
RPC::CountedYield count (
fill.yieldStrategy.accountYieldCount, fill.yield);
if (bFull || bExpand)
@@ -191,7 +191,7 @@ void fillJson (Object& json, LedgerFill const& fill)
template
void addJson (Object& json, LedgerFill const& fill)
{
- auto&& object = RPC::addObject (json, jss::ledger);
+ auto&& object = Json::addObject (json, jss::ledger);
fillJson (object, fill);
}
diff --git a/src/ripple/rpc/impl/JsonObject.h b/src/ripple/json/Object.h
similarity index 99%
rename from src/ripple/rpc/impl/JsonObject.h
rename to src/ripple/json/Object.h
index afad6cf00..5aa9057c6 100644
--- a/src/ripple/rpc/impl/JsonObject.h
+++ b/src/ripple/json/Object.h
@@ -20,10 +20,10 @@
#ifndef RIPPLE_RPC_JSONOBJECT_H_INCLUDED
#define RIPPLE_RPC_JSONOBJECT_H_INCLUDED
-#include
+#include
+#include
-namespace ripple {
-namespace RPC {
+namespace Json {
/**
Collection is a base class for Array and Object, classes which provide the
@@ -489,7 +489,6 @@ Object appendObject (Array& json)
return json.appendObject ();
}
-} // RPC
-} // ripple
+} // Json
#endif
diff --git a/src/ripple/rpc/impl/WriteJson.h b/src/ripple/json/Output.h
similarity index 77%
rename from src/ripple/rpc/impl/WriteJson.h
rename to src/ripple/json/Output.h
index ec31fd4f2..aa8c400ef 100644
--- a/src/ripple/rpc/impl/WriteJson.h
+++ b/src/ripple/json/Output.h
@@ -17,27 +17,35 @@
*/
//==============================================================================
-#ifndef RIPPLE_RPC_WRITEJSON_H_INCLUDED
-#define RIPPLE_RPC_WRITEJSON_H_INCLUDED
+#ifndef RIPPLE_JSON_OUTPUT_H_INCLUDED
+#define RIPPLE_JSON_OUTPUT_H_INCLUDED
-namespace ripple {
-namespace RPC {
+#include
+
+namespace Json {
+
+using Output = std::function ;
+
+inline
+Output stringOutput (std::string& s)
+{
+ return [&](boost::string_ref const& b) { s.append (b.data(), b.size()); };
+}
/** Writes a minimal representation of a Json value to an Output in O(n) time.
Data is streamed right to the output, so only a marginal amount of memory is
used. This can be very important for a very large Json::Value.
*/
-void writeJson (Json::Value const&, Output const&);
+void outputJson (Json::Value const&, Output const&);
/** Return the minimal string representation of a Json::Value in O(n) time.
This requires a memory allocation for the full size of the output.
- If possible, use write().
+ If possible, use outputJson().
*/
std::string jsonAsString (Json::Value const&);
-} // RPC
-} // ripple
+} // Json
#endif
diff --git a/src/ripple/rpc/impl/JsonWriter.h b/src/ripple/json/Writer.h
similarity index 97%
rename from src/ripple/rpc/impl/JsonWriter.h
rename to src/ripple/json/Writer.h
index d6711246f..ed66af298 100644
--- a/src/ripple/rpc/impl/JsonWriter.h
+++ b/src/ripple/json/Writer.h
@@ -21,12 +21,12 @@
#define RIPPLE_RPC_JSONWRITER_H_INCLUDED
#include
+#include
#include
-#include
#include
+#include
-namespace ripple {
-namespace RPC {
+namespace Json {
/**
* Writer implements an O(1)-space, O(1)-granular output JSON writer.
@@ -204,11 +204,11 @@ public:
template
void output (Type t)
{
- implOutput (to_string (t));
+ implOutput (ripple::to_string (t));
}
/** Output an error code. */
- void output (error_code_i t)
+ void output (ripple::error_code_i t)
{
output (int(t));
}
@@ -244,7 +244,6 @@ inline void check (bool condition, std::string const& message)
throw JsonException (message);
}
-} // RPC
-} // ripple
+} // Json
#endif
diff --git a/src/ripple/rpc/impl/JsonObject.cpp b/src/ripple/json/impl/Object.cpp
similarity index 97%
rename from src/ripple/rpc/impl/JsonObject.cpp
rename to src/ripple/json/impl/Object.cpp
index 59f72b118..74040ffec 100644
--- a/src/ripple/rpc/impl/JsonObject.cpp
+++ b/src/ripple/json/impl/Object.cpp
@@ -18,10 +18,9 @@
//==============================================================================
#include
-#include
+#include
-namespace ripple {
-namespace RPC {
+namespace Json {
Collection::Collection (Collection* parent, Writer* writer)
: parent_ (parent), writer_ (writer), enabled_ (true)
@@ -157,5 +156,4 @@ WriterObject stringWriterObject (std::string& s)
return WriterObject (stringOutput (s));
}
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/rpc/impl/WriteJson.cpp b/src/ripple/json/impl/Output.cpp
similarity index 85%
rename from src/ripple/rpc/impl/WriteJson.cpp
rename to src/ripple/json/impl/Output.cpp
index 700870b5b..a80b16bdc 100644
--- a/src/ripple/rpc/impl/WriteJson.cpp
+++ b/src/ripple/json/impl/Output.cpp
@@ -18,15 +18,14 @@
//==============================================================================
#include
-#include
-#include
+#include
+#include
-namespace ripple {
-namespace RPC {
+namespace Json {
namespace {
-void writeJson (Json::Value const& value, Writer& writer)
+void outputJson (Json::Value const& value, Writer& writer)
{
switch (value.type())
{
@@ -72,7 +71,7 @@ void writeJson (Json::Value const& value, Writer& writer)
for (auto const& i: value)
{
writer.rawAppend();
- writeJson (i, writer);
+ outputJson (i, writer);
}
writer.finish();
break;
@@ -85,7 +84,7 @@ void writeJson (Json::Value const& value, Writer& writer)
for (auto const& tag: members)
{
writer.rawSet (tag);
- writeJson (value[tag], writer);
+ outputJson (value[tag], writer);
}
writer.finish();
break;
@@ -95,19 +94,18 @@ void writeJson (Json::Value const& value, Writer& writer)
} // namespace
-void writeJson (Json::Value const& value, Output const& out)
+void outputJson (Json::Value const& value, Output const& out)
{
Writer writer (out);
- writeJson (value, writer);
+ outputJson (value, writer);
}
std::string jsonAsString (Json::Value const& value)
{
std::string s;
Writer writer (stringOutput (s));
- writeJson (value, writer);
+ outputJson (value, writer);
return s;
}
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/rpc/impl/JsonWriter.cpp b/src/ripple/json/impl/Writer.cpp
similarity index 96%
rename from src/ripple/rpc/impl/JsonWriter.cpp
rename to src/ripple/json/impl/Writer.cpp
index 91ef8cc8f..c69374ce0 100644
--- a/src/ripple/rpc/impl/JsonWriter.cpp
+++ b/src/ripple/json/impl/Writer.cpp
@@ -18,12 +18,11 @@
//==============================================================================
#include
-#include
-#include
+#include
+#include
#include
-namespace ripple {
-namespace RPC {
+namespace Json {
namespace {
@@ -244,20 +243,20 @@ void Writer::output (std::string const& s)
void Writer::output (Json::Value const& value)
{
impl_->markStarted();
- writeJson (value, impl_->getOutput());
+ outputJson (value, impl_->getOutput());
}
template <>
void Writer::output (float f)
{
- auto s = to_string (f);
+ auto s = ripple::to_string (f);
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
}
template <>
void Writer::output (double f)
{
- auto s = to_string (f);
+ auto s = ripple::to_string (f);
impl_->output ({s.data (), lengthWithoutTrailingZeros (s)});
}
@@ -315,5 +314,4 @@ void Writer::finish ()
impl_->finish ();
}
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/json/impl/json_writer.cpp b/src/ripple/json/impl/json_writer.cpp
index 433e53a01..9cf57f1ba 100644
--- a/src/ripple/json/impl/json_writer.cpp
+++ b/src/ripple/json/impl/json_writer.cpp
@@ -178,13 +178,6 @@ std::string valueToQuotedString ( const char* value )
return result;
}
-// Class Writer
-// //////////////////////////////////////////////////////////////////
-Writer::~Writer ()
-{
-}
-
-
// Class FastWriter
// //////////////////////////////////////////////////////////////////
diff --git a/src/ripple/json/json_writer.h b/src/ripple/json/json_writer.h
index 41c6bd94c..e9ff9746f 100644
--- a/src/ripple/json/json_writer.h
+++ b/src/ripple/json/json_writer.h
@@ -31,11 +31,10 @@ class Value;
/** \brief Abstract class for writers.
*/
-class Writer
+class WriterBase
{
public:
- virtual ~Writer ();
-
+ virtual ~WriterBase () {}
virtual std::string write ( const Value& root ) = 0;
};
@@ -45,7 +44,8 @@ public:
* but may be usefull to support feature such as RPC where bandwith is limited.
* \sa Reader, Value
*/
-class FastWriter : public Writer
+
+class FastWriter : public WriterBase
{
public:
FastWriter ();
@@ -78,7 +78,7 @@ private:
*
* \sa Reader, Value, Value::setComment()
*/
-class StyledWriter: public Writer
+class StyledWriter: public WriterBase
{
public:
StyledWriter ();
diff --git a/src/ripple/rpc/tests/JsonObject.test.cpp b/src/ripple/json/tests/Object.test.cpp
similarity index 97%
rename from src/ripple/rpc/tests/JsonObject.test.cpp
rename to src/ripple/json/tests/Object.test.cpp
index 06f791502..5e9f51276 100644
--- a/src/ripple/rpc/tests/JsonObject.test.cpp
+++ b/src/ripple/json/tests/Object.test.cpp
@@ -18,14 +18,13 @@
//==============================================================================
#include
-#include
+#include
#include
#include
-namespace ripple {
-namespace RPC {
+namespace Json {
-class JsonObject_test : public TestOutputSuite
+class JsonObject_test : public ripple::RPC::TestOutputSuite
{
void setup (std::string const& testName)
{
@@ -240,5 +239,4 @@ public:
BEAST_DEFINE_TESTSUITE(JsonObject, ripple_basics, ripple);
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/rpc/tests/WriteJson.test.cpp b/src/ripple/json/tests/Output.test.cpp
similarity index 90%
rename from src/ripple/rpc/tests/WriteJson.test.cpp
rename to src/ripple/json/tests/Output.test.cpp
index 2540fde3e..78883e1bb 100644
--- a/src/ripple/rpc/tests/WriteJson.test.cpp
+++ b/src/ripple/json/tests/Output.test.cpp
@@ -18,13 +18,12 @@
//==============================================================================
#include
-#include
+#include
#include
-namespace ripple {
-namespace RPC {
+namespace Json {
-struct WriteJson_test : TestOutputSuite
+struct Output_test : ripple::RPC::TestOutputSuite
{
void runTest (std::string const& name, std::string const& valueDesc)
{
@@ -32,7 +31,7 @@ struct WriteJson_test : TestOutputSuite
Json::Value value;
expect (Json::Reader().parse (valueDesc, value));
auto out = stringOutput (output_);
- writeJson (value, out);
+ outputJson (value, out);
// Compare with the original version.
auto expected = Json::FastWriter().write (value);
@@ -63,7 +62,6 @@ struct WriteJson_test : TestOutputSuite
}
};
-BEAST_DEFINE_TESTSUITE(WriteJson, ripple_basics, ripple);
+BEAST_DEFINE_TESTSUITE(Output, ripple_basics, ripple);
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/rpc/tests/JsonWriter.test.cpp b/src/ripple/json/tests/Writer.test.cpp
similarity index 97%
rename from src/ripple/rpc/tests/JsonWriter.test.cpp
rename to src/ripple/json/tests/Writer.test.cpp
index db4900b66..3fb7933cb 100644
--- a/src/ripple/rpc/tests/JsonWriter.test.cpp
+++ b/src/ripple/json/tests/Writer.test.cpp
@@ -19,14 +19,13 @@
#include
#include
-#include
+#include
#include
#include
-namespace ripple {
-namespace RPC {
+namespace Json {
-class JsonWriter_test : public TestOutputSuite
+class JsonWriter_test : public ripple::RPC::TestOutputSuite
{
public:
void testTrivial ()
@@ -203,5 +202,4 @@ public:
BEAST_DEFINE_TESTSUITE(JsonWriter, ripple_basics, ripple);
-} // RPC
-} // ripple
+} // Json
diff --git a/src/ripple/rpc/RPCVersion.h b/src/ripple/rpc/RPCVersion.h
index f63a7c9d2..52065000c 100644
--- a/src/ripple/rpc/RPCVersion.h
+++ b/src/ripple/rpc/RPCVersion.h
@@ -22,7 +22,7 @@
#include
#include
-#include
+#include
namespace ripple {
namespace RPC {
diff --git a/src/ripple/rpc/Yield.h b/src/ripple/rpc/Yield.h
index 8c4f8c4db..cf61d276d 100644
--- a/src/ripple/rpc/Yield.h
+++ b/src/ripple/rpc/Yield.h
@@ -20,7 +20,7 @@
#ifndef RIPPLE_RPC_YIELD_H_INCLUDED
#define RIPPLE_RPC_YIELD_H_INCLUDED
-#include
+#include
#include
#include
@@ -49,8 +49,8 @@ using Yield = std::function ;
data. This is to avoid the case where you yield after outputting data, but
then never send more data.
*/
-Output chunkedYieldingOutput (
- Output const&, Yield const&, std::size_t chunkSize);
+Json::Output chunkedYieldingOutput (
+ Json::Output const&, Yield const&, std::size_t chunkSize);
/** Yield every yieldCount calls. If yieldCount is 0, never yield. */
class CountedYield
diff --git a/src/ripple/rpc/handlers/Ledger.cpp b/src/ripple/rpc/handlers/Ledger.cpp
index 8792f6217..b06ca4661 100644
--- a/src/ripple/rpc/handlers/Ledger.cpp
+++ b/src/ripple/rpc/handlers/Ledger.cpp
@@ -20,9 +20,9 @@
#include
#include
#include
+#include
#include
#include
-#include
#include
namespace ripple {
diff --git a/src/ripple/rpc/handlers/Ledger.h b/src/ripple/rpc/handlers/Ledger.h
index ff75b5c37..de9f919c6 100644
--- a/src/ripple/rpc/handlers/Ledger.h
+++ b/src/ripple/rpc/handlers/Ledger.h
@@ -22,14 +22,16 @@
#include
#include
-#include
+#include
#include
+namespace Json {
+class Object;
+}
+
namespace ripple {
namespace RPC {
-class Object;
-
// ledger [id|index|current|closed] [full]
// {
// ledger: 'current' | 'closed' | | , // optional
@@ -77,7 +79,7 @@ void LedgerHandler::writeResult (Object& value)
{
if (ledger_)
{
- RPC::copyFrom (value, result_);
+ Json::copyFrom (value, result_);
addJson (value, {*ledger_, options_, context_.yield});
}
else
@@ -85,11 +87,11 @@ void LedgerHandler::writeResult (Object& value)
auto& master = getApp().getLedgerMaster ();
auto& yield = context_.yield;
{
- auto&& closed = RPC::addObject (value, jss::closed);
+ auto&& closed = Json::addObject (value, jss::closed);
addJson (closed, {*master.getClosedLedger(), 0, yield});
}
{
- auto&& open = RPC::addObject (value, jss::open);
+ auto&& open = Json::addObject (value, jss::open);
addJson (open, {*master.getCurrentLedger(), 0, yield});
}
}
diff --git a/src/ripple/rpc/handlers/WalletPropose.h b/src/ripple/rpc/handlers/WalletPropose.h
index b53042cb3..a3bafc2f5 100644
--- a/src/ripple/rpc/handlers/WalletPropose.h
+++ b/src/ripple/rpc/handlers/WalletPropose.h
@@ -20,7 +20,7 @@
#ifndef RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
#define RIPPLED_RIPPLE_RPC_HANDLERS_WALLETPROPOSE_H
-#include
+#include
namespace ripple {
diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp
index e58bb1a08..1e6ef9b14 100644
--- a/src/ripple/rpc/impl/Handler.cpp
+++ b/src/ripple/rpc/impl/Handler.cpp
@@ -85,11 +85,11 @@ class HandlerTable {
assert (table_.find(HandlerImpl::name()) == table_.end());
Handler h;
- h.name_ = HandlerImpl::name(),
- h.valueMethod_ = &handle,
- h.role_ = HandlerImpl::role(),
- h.condition_ = HandlerImpl::condition(),
- h.objectMethod_ = &handle