mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Split ripple_json to its own module
This commit is contained in:
@@ -378,6 +378,7 @@ Value::Value ( const std::string& value )
|
||||
(unsigned int)value.length () );
|
||||
|
||||
}
|
||||
|
||||
Value::Value (beast::String const& beastString)
|
||||
: type_ ( stringValue )
|
||||
, allocated_ ( true )
|
||||
@@ -750,7 +751,7 @@ Value::asString () const
|
||||
return value_.bool_ ? "true" : "false";
|
||||
|
||||
case intValue:
|
||||
return lexicalCastThrow <std::string> (value_.int_);
|
||||
return beast::lexicalCastThrow <std::string> (value_.int_);
|
||||
|
||||
case uintValue:
|
||||
case realValue:
|
||||
@@ -796,7 +797,7 @@ Value::asInt () const
|
||||
return value_.bool_ ? 1 : 0;
|
||||
|
||||
case stringValue:
|
||||
return lexicalCastThrow <int> (value_.string_);
|
||||
return beast::lexicalCastThrow <int> (value_.string_);
|
||||
|
||||
case arrayValue:
|
||||
case objectValue:
|
||||
@@ -832,7 +833,7 @@ Value::asUInt () const
|
||||
return value_.bool_ ? 1 : 0;
|
||||
|
||||
case stringValue:
|
||||
return lexicalCastThrow <unsigned int> (value_.string_);
|
||||
return beast::lexicalCastThrow <unsigned int> (value_.string_);
|
||||
|
||||
case arrayValue:
|
||||
case objectValue:
|
||||
33
src/ripple/json/ripple_json.cpp
Normal file
33
src/ripple/json/ripple_json.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "BeastConfig.h"
|
||||
|
||||
#include "beast/modules/beast_core/beast_core.h"
|
||||
|
||||
#include "ripple_json.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
// For json/
|
||||
//
|
||||
#ifdef JSON_USE_CPPTL
|
||||
# include <cpptl/conststring.h>
|
||||
#endif
|
||||
#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
||||
#include "impl/json_batchallocator.h"
|
||||
#endif
|
||||
|
||||
#define JSON_ASSERT_UNREACHABLE assert( false )
|
||||
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
|
||||
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
|
||||
|
||||
#include "impl/json_reader.cpp"
|
||||
#include "impl/json_value.cpp"
|
||||
#include "impl/json_writer.cpp"
|
||||
35
src/ripple/json/ripple_json.h
Normal file
35
src/ripple/json/ripple_json.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_JSON_H_INCLUDED
|
||||
#define RIPPLE_JSON_H_INCLUDED
|
||||
|
||||
#include "beast/beast/Config.h"
|
||||
|
||||
#include <deque>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
// For json/
|
||||
//
|
||||
// VFALCO TODO Clean up these one-offs
|
||||
#include "api/json_config.h" // Needed before these cpptl includes
|
||||
#ifndef JSON_USE_CPPTL_SMALLMAP
|
||||
# include <map>
|
||||
#else
|
||||
# include <cpptl/smallmap.h>
|
||||
#endif
|
||||
#ifdef JSON_USE_CPPTL
|
||||
# include <cpptl/forwards.h>
|
||||
#endif
|
||||
|
||||
#include "api/json_forwards.h"
|
||||
#include "api/json_features.h"
|
||||
#include "api/json_value.h"
|
||||
#include "api/json_reader.h"
|
||||
#include "api/json_writer.h"
|
||||
|
||||
#endif
|
||||
@@ -31,21 +31,6 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// For json/
|
||||
//
|
||||
#ifdef JSON_USE_CPPTL
|
||||
# include <cpptl/conststring.h>
|
||||
#endif
|
||||
#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
|
||||
#include "json/json_batchallocator.h"
|
||||
#endif
|
||||
|
||||
#define JSON_ASSERT_UNREACHABLE assert( false )
|
||||
#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
|
||||
#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// For random numbers
|
||||
//
|
||||
// VFALCO TODO Replace OpenSSL randomness with a dependency-free implementation
|
||||
@@ -75,10 +60,6 @@ namespace ripple
|
||||
#include "containers/RangeSet.cpp"
|
||||
#include "containers/TaggedCache.cpp"
|
||||
|
||||
#include "json/json_reader.cpp"
|
||||
#include "json/json_value.cpp"
|
||||
#include "json/json_writer.cpp"
|
||||
|
||||
#include "log/Log.cpp"
|
||||
#include "log/LogFile.cpp"
|
||||
#include "log/LogJournal.cpp"
|
||||
|
||||
@@ -24,21 +24,6 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// For json/
|
||||
//
|
||||
// VFALCO TODO Clean up these one-offs
|
||||
#include "json/json_config.h" // Needed before these cpptl includes
|
||||
#ifndef JSON_USE_CPPTL_SMALLMAP
|
||||
# include <map>
|
||||
#else
|
||||
# include <cpptl/smallmap.h>
|
||||
#endif
|
||||
#ifdef JSON_USE_CPPTL
|
||||
# include <cpptl/forwards.h>
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "beast/modules/beast_core/system/BeforeBoost.h" // must come first
|
||||
#include "system/BoostIncludes.h"
|
||||
|
||||
@@ -124,12 +109,6 @@ using namespace beast;
|
||||
#include "containers/SecureAllocator.h"
|
||||
#include "containers/TaggedCache.h"
|
||||
|
||||
#include "json/json_forwards.h"
|
||||
#include "json/json_features.h"
|
||||
#include "json/json_value.h"
|
||||
#include "json/json_reader.h"
|
||||
#include "json/json_writer.h"
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
// additional hierarchy via directories.
|
||||
#include "ripple.pb.h"
|
||||
|
||||
#include "../ripple/json/ripple_json.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user