rippled
Loading...
Searching...
No Matches
owners.h
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#ifndef RIPPLE_TEST_JTX_OWNERS_H_INCLUDED
21#define RIPPLE_TEST_JTX_OWNERS_H_INCLUDED
22
23#include <test/jtx/Env.h>
24
25#include <xrpl/ledger/View.h>
26#include <xrpl/protocol/LedgerFormats.h>
27#include <xrpl/protocol/UintTypes.h>
28
29#include <cstdint>
30
31namespace ripple {
32
33namespace detail {
34
36owned_count_of(ReadView const& view, AccountID const& id, LedgerEntryType type);
37
38void
40 test::jtx::Env& env,
41 AccountID const& id,
42 LedgerEntryType type,
43 std::uint32_t value);
44
45} // namespace detail
46
47namespace test {
48namespace jtx {
49
50// Helper for aliases
51template <LedgerEntryType Type>
53{
54private:
57
58public:
59 owner_count(Account const& account, std::uint32_t value)
60 : account_(account), value_(value)
61 {
62 }
63
64 void
65 operator()(Env& env) const
66 {
68 }
69};
70
72class owners
73{
74private:
77
78public:
79 owners(Account const& account, std::uint32_t value)
80 : account_(account), value_(value)
81 {
82 }
83
84 void
85 operator()(Env& env) const;
86};
87
90
93
94} // namespace jtx
95} // namespace test
96} // namespace ripple
97
98#endif
Immutable cryptographic account descriptor.
Definition Account.h:39
AccountID id() const
Returns the Account ID.
Definition Account.h:111
A transaction testing environment.
Definition Env.h:121
void operator()(Env &env) const
Definition owners.h:65
owner_count(Account const &account, std::uint32_t value)
Definition owners.h:59
Match the number of items in the account's owner directory.
Definition owners.h:73
owners(Account const &account, std::uint32_t value)
Definition owners.h:79
std::uint32_t value_
Definition owners.h:76
void operator()(Env &env) const
Definition owners.cpp:53
void owned_count_helper(test::jtx::Env &env, AccountID const &id, LedgerEntryType type, std::uint32_t value)
Definition owners.cpp:38
std::uint32_t owned_count_of(ReadView const &view, AccountID const &id, LedgerEntryType type)
Definition owners.cpp:26
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:48
LedgerEntryType
Identifiers for on-ledger objects.