xrpld
Loading...
Searching...
No Matches
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
10namespace xrpl {
11namespace detail {
12
14{
15public:
16 explicit CurrencyTag() = default;
17};
18
20{
21public:
22 explicit DirectoryTag() = default;
23};
24
26{
27public:
28 explicit NodeIDTag() = default;
29};
30
31} // namespace detail
32
38
43
48
55
60
64Currency const&
66
70Currency const&
72
77Currency const&
79
80inline bool
81isXRP(Currency const& c)
82{
83 return c == beast::kZero;
84}
85
90to_string(Currency const& c);
91
100bool
102
111toCurrency(std::string const&);
112
114operator<<(std::ostream& os, Currency const& x)
115{
116 os << to_string(x);
117 return os;
118}
119
120} // namespace xrpl
121
122namespace std {
123
124template <>
126{
127 hash() = default;
128};
129
130template <>
132{
133 hash() = default;
134};
135
136template <>
138{
139 hash() = default;
140};
141
142template <>
144{
145 hash() = default;
146};
147
148} // namespace std
Integers of any length that is a multiple of 32-bits.
Definition base_uint.h:82
constexpr Zero kZero
Definition Zero.h:30
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:84
BaseUInt< 256, detail::DirectoryTag > Directory
Directory is an index into the directory of offer books.
Definition UintTypes.h:37
BaseUInt< 256 > Domain
Domain is a 256-bit hash representing a specific domain.
Definition UintTypes.h:59
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:42
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:666
Currency const & xrpCurrency()
XRP currency.
Definition UintTypes.cpp:99
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition base_uint.h:651
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
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:47