rippled
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::zero;
66}
67
70to_string(Currency const& c);
71
79bool
81
90
91inline std::ostream&
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:66
hardened_hash<> hasher
Value hashing function.
Definition base_uint.h:146
Seed functor once per construction.
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
base_uint< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:36
bool isXRP(AccountID const &c)
Definition AccountID.h:70
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:597
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
Definition base_uint.h:612
Currency const & xrpCurrency()
XRP currency.
Definition UintTypes.cpp:96
Currency const & noCurrency()
A placeholder for empty currencies.
bool to_currency(Currency &, std::string const &)
Tries to convert a string to a Currency, returns true on success.
Definition UintTypes.cpp:62
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...