xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
jtx
impl
jtx_json.cpp
1
#include <test/jtx/jtx_json.h>
2
3
#include <test/jtx/Env.h>
4
#include <test/jtx/JTx.h>
5
#include <test/jtx/utility.h>
6
7
#include <xrpl/basics/contract.h>
8
#include <xrpl/json/json_reader.h>
9
#include <xrpl/json/json_value.h>
10
11
#include <
string
>
12
#include <
utility
>
13
14
namespace
xrpl::test::jtx
{
15
16
Json::Json
(
std::string
const
& s)
17
{
18
if
(!
json::Reader
().
parse
(s,
jv_
))
19
Throw<ParseError>
(
"bad json"
);
20
}
21
22
Json::Json
(
char
const
* s) :
Json
(
std
::string(s))
23
{
24
}
25
26
Json::Json
(
json::Value
jv) :
jv_
(
std
::move(jv))
27
{
28
}
29
30
void
31
Json::operator()
(
Env
&,
JTx
& jt)
const
32
{
33
auto
& jv = jt.
jv
;
34
for
(
auto
iter =
jv_
.begin(); iter !=
jv_
.end(); ++iter)
35
jv[iter.key().asString()] = *iter;
36
}
37
38
}
// namespace xrpl::test::jtx
std::string
json::Reader
Unserialize a JSON document into a Value.
Definition
json_reader.h:20
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::test::jtx::Env
A transaction testing environment.
Definition
Env.h:161
xrpl::test::jtx::Json::jv_
::json::Value jv_
Definition
jtx_json.h:18
xrpl::test::jtx::Json::operator()
void operator()(Env &, JTx &jt) const
Definition
jtx_json.cpp:31
xrpl::test::jtx::Json::Json
Json(std::string const &)
Definition
jtx_json.cpp:16
std
STL namespace.
xrpl::test::jtx
Definition
Oracle_test.cpp:34
xrpl::test::jtx::parse
STObject parse(json::Value const &jv)
Convert JSON to STObject.
Definition
utility.cpp:33
xrpl::Throw
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Definition
contract.h:52
string
xrpl::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition
JTx.h:27
xrpl::test::jtx::JTx::jv
json::Value jv
Definition
JTx.h:28
utility
Generated by
1.17.0