rippled
memo.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/basics/StringUtilities.h>
21 #include <ripple/protocol/jss.h>
22 #include <test/jtx/memo.h>
23 
24 namespace ripple {
25 namespace test {
26 namespace jtx {
27 
28 void
29 memo::operator()(Env&, JTx& jt) const
30 {
31  auto& jv = jt.jv;
32  auto& ma = jv["Memos"];
33  auto& mi = ma[ma.size()];
34  auto& m = mi["Memo"];
35  m["MemoData"] = strHex(data_);
36  m["MemoFormat"] = strHex(format_);
37  m["MemoType"] = strHex(type_);
38 }
39 
40 void
42 {
43  auto& jv = jt.jv;
44  auto& ma = jv["Memos"];
45  auto& mi = ma[ma.size()];
46  auto& m = mi["Memo"];
47  m["MemoData"] = strHex(s_);
48 }
49 
50 void
52 {
53  auto& jv = jt.jv;
54  auto& ma = jv["Memos"];
55  auto& mi = ma[ma.size()];
56  auto& m = mi["Memo"];
57  m["MemoFormat"] = strHex(s_);
58 }
59 
60 void
62 {
63  auto& jv = jt.jv;
64  auto& ma = jv["Memos"];
65  auto& mi = ma[ma.size()];
66  auto& m = mi["Memo"];
67  m["MemoType"] = strHex(s_);
68 }
69 
70 void
72 {
73  auto& jv = jt.jv;
74  auto& ma = jv["Memos"];
75  auto& mi = ma[ma.size()];
76  auto& m = mi["Memo"];
77  m["MemoFormat"] = strHex(format_);
78  m["MemoType"] = strHex(type_);
79 }
80 
81 void
83 {
84  auto& jv = jt.jv;
85  auto& ma = jv["Memos"];
86  auto& mi = ma[ma.size()];
87  auto& m = mi["Memo"];
88  m["MemoData"] = strHex(data_);
89  m["MemoType"] = strHex(type_);
90 }
91 
92 void
94 {
95  auto& jv = jt.jv;
96  auto& ma = jv["Memos"];
97  auto& mi = ma[ma.size()];
98  auto& m = mi["Memo"];
99  m["MemoData"] = strHex(data_);
100  m["MemoFormat"] = strHex(format_);
101 }
102 
103 } // namespace jtx
104 } // namespace test
105 } // namespace ripple
ripple::test::jtx::memoformat::s_
std::string s_
Definition: memo.h:71
ripple::test::jtx::memondata::format_
std::string format_
Definition: memo.h:99
ripple::test::jtx::memotype::s_
std::string s_
Definition: memo.h:85
ripple::test::jtx::memontype::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:93
ripple::test::jtx::memontype::data_
std::string data_
Definition: memo.h:131
ripple::test::jtx::memo::data_
std::string data_
Definition: memo.h:37
ripple::test::jtx::memo::format_
std::string format_
Definition: memo.h:38
ripple::test::jtx::memoformat::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:51
ripple::test::jtx::memodata::s_
std::string s_
Definition: memo.h:57
ripple::test::jtx::memo::type_
std::string type_
Definition: memo.h:39
ripple::test::jtx::memondata::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:71
ripple::test::jtx::JTx
Execution context for applying a JSON transaction.
Definition: JTx.h:42
ripple::test::jtx::JTx::jv
Json::Value jv
Definition: JTx.h:44
ripple::test::jtx::memotype::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:61
ripple::test::jtx::memo::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:29
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::jtx::memonformat::data_
std::string data_
Definition: memo.h:115
ripple::test::jtx::memonformat::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:82
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::test::jtx::memontype::format_
std::string format_
Definition: memo.h:132
ripple::test::jtx::memondata::type_
std::string type_
Definition: memo.h:100
ripple::test::jtx::memonformat::type_
std::string type_
Definition: memo.h:116
ripple::test::jtx::Env
A transaction testing environment.
Definition: Env.h:116
ripple::test::jtx::memodata::operator()
void operator()(Env &, JTx &jt) const
Definition: memo.cpp:41