xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
UintTypes.h
1
#pragma once
2
3
#include <xrpl/basics/base_uint.h>
4
#include <xrpl/beast/utility/Zero.h>
5
6
#include <
functional
>
7
#include <
ostream
>
8
#include <
string
>
9
10
namespace
xrpl
{
11
namespace
detail
{
12
13
class
CurrencyTag
14
{
15
public
:
16
explicit
CurrencyTag
() =
default
;
17
};
18
19
class
DirectoryTag
20
{
21
public
:
22
explicit
DirectoryTag
() =
default
;
23
};
24
25
class
NodeIDTag
26
{
27
public
:
28
explicit
NodeIDTag
() =
default
;
29
};
30
31
}
// namespace detail
32
37
using
Directory
=
BaseUInt<256, detail::DirectoryTag>
;
38
42
using
Currency
=
BaseUInt<160, detail::CurrencyTag>
;
43
47
using
NodeID
=
BaseUInt<160, detail::NodeIDTag>
;
48
54
using
MPTID
=
BaseUInt<192>
;
55
59
using
Domain
=
BaseUInt<256>
;
60
64
Currency
const
&
65
xrpCurrency
();
66
70
Currency
const
&
71
noCurrency
();
72
77
Currency
const
&
78
badCurrency
();
79
80
inline
bool
81
isXRP
(
Currency
const
& c)
82
{
83
return
c ==
beast::kZero
;
84
}
85
89
std::string
90
to_string
(
Currency
const
& c);
91
100
bool
101
toCurrency
(
Currency
&,
std::string
const
&);
102
110
Currency
111
toCurrency
(
std::string
const
&);
112
113
inline
std::ostream
&
114
operator<<
(
std::ostream
& os,
Currency
const
& x)
115
{
116
os <<
to_string
(x);
117
return
os;
118
}
119
120
}
// namespace xrpl
121
122
namespace
std
{
123
124
template
<>
125
struct
hash
<
xrpl
::Currency> :
xrpl::Currency::hasher
126
{
127
hash
() =
default
;
128
};
129
130
template
<>
131
struct
hash
<
xrpl
::NodeID> :
xrpl::NodeID::hasher
132
{
133
hash
() =
default
;
134
};
135
136
template
<>
137
struct
hash
<
xrpl
::Directory> :
xrpl::Directory::hasher
138
{
139
hash
() =
default
;
140
};
141
142
template
<>
143
struct
hash
<
xrpl
::UInt256> :
xrpl::UInt256::hasher
144
{
145
hash
() =
default
;
146
};
147
148
}
// namespace std
std::ostream
std::string
xrpl::BaseUInt
Integers of any length that is a multiple of 32-bits.
Definition
base_uint.h:82
xrpl::BaseUInt< 160, detail::CurrencyTag >::hasher
HardenedHash<> hasher
Definition
base_uint.h:163
xrpl::detail::CurrencyTag::CurrencyTag
CurrencyTag()=default
xrpl::detail::DirectoryTag::DirectoryTag
DirectoryTag()=default
xrpl::detail::NodeIDTag::NodeIDTag
NodeIDTag()=default
functional
beast::kZero
constexpr Zero kZero
Definition
Zero.h:30
std
STL namespace.
xrpl::detail
Definition
base_uint.h:37
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::isXRP
bool isXRP(AccountID const &c)
Definition
AccountID.h:84
xrpl::Directory
BaseUInt< 256, detail::DirectoryTag > Directory
Directory is an index into the directory of offer books.
Definition
UintTypes.h:37
xrpl::Domain
BaseUInt< 256 > Domain
Domain is a 256-bit hash representing a specific domain.
Definition
UintTypes.h:59
xrpl::Currency
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition
UintTypes.h:42
xrpl::toCurrency
bool toCurrency(Currency &, std::string const &)
Tries to convert a string to a Currency, returns true on success.
Definition
UintTypes.cpp:65
xrpl::operator<<
std::ostream & operator<<(std::ostream &out, BaseUInt< Bits, Tag > const &u)
Definition
base_uint.h:672
xrpl::xrpCurrency
Currency const & xrpCurrency()
XRP currency.
Definition
UintTypes.cpp:99
xrpl::to_string
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition
base_uint.h:657
xrpl::MPTID
BaseUInt< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition
UintTypes.h:54
xrpl::noCurrency
Currency const & noCurrency()
A placeholder for empty currencies.
Definition
UintTypes.cpp:106
xrpl::badCurrency
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
Definition
UintTypes.cpp:113
xrpl::NodeID
BaseUInt< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
Definition
UintTypes.h:47
ostream
string
std::hash< xrpl::Currency >::hash
hash()=default
std::hash< xrpl::Directory >::hash
hash()=default
std::hash< xrpl::NodeID >::hash
hash()=default
std::hash< xrpl::UInt256 >::hash
hash()=default
Generated by
1.17.0