xrpld
Loading...
Searching...
No Matches
UintTypes.h
1#pragma once
2
3#include <xrpl/basics/UnorderedContainers.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/utility/Zero.h>
6#include <xrpl/protocol/AccountID.h>
7
8namespace xrpl {
9namespace detail {
10
12{
13public:
14 explicit CurrencyTag() = default;
15};
16
18{
19public:
20 explicit DirectoryTag() = default;
21};
22
24{
25public:
26 explicit NodeIDTag() = default;
27};
28
29} // namespace detail
30
34
37
40
45
48
50Currency const&
52
54Currency const&
56
59Currency const&
61
62inline bool
63isXRP(Currency const& c)
64{
65 return c == beast::kZero;
66}
67
70to_string(Currency const& c);
71
79bool
81
90
92operator<<(std::ostream& os, Currency const& x)
93{
94 os << to_string(x);
95 return os;
96}
97
98} // namespace xrpl
99
100namespace std {
101
102template <>
104{
105 hash() = default;
106};
107
108template <>
110{
111 hash() = default;
112};
113
114template <>
116{
117 hash() = default;
118};
119
120template <>
122{
123 hash() = default;
124};
125
126} // namespace std
Integers of any length that is a multiple of 32-bits.
Definition base_uint.h:71
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
bool isXRP(AccountID const &c)
Definition AccountID.h:70
BaseUInt< 256, detail::DirectoryTag > Directory
Directory is an index into the directory of offer books.
Definition UintTypes.h:33
BaseUInt< 256 > Domain
Domain is a 256-bit hash representing a specific domain.
Definition UintTypes.h:47
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:36
bool toCurrency(Currency &, std::string const &)
Tries to convert a string to a Currency, returns true on success.
Definition UintTypes.cpp:65
std::ostream & operator<<(std::ostream &out, BaseUInt< Bits, Tag > const &u)
Definition base_uint.h:648
Currency const & xrpCurrency()
XRP currency.
Definition UintTypes.cpp:99
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:633
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:44
Currency const & noCurrency()
A placeholder for empty currencies.
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
BaseUInt< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
Definition UintTypes.h:39