rippled
AccountID.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2014 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_PROTOCOL_ACCOUNTID_H_INCLUDED
21 #define RIPPLE_PROTOCOL_ACCOUNTID_H_INCLUDED
22 
23 #include <ripple/protocol/tokens.h>
24 // VFALCO Uncomment when the header issues are resolved
25 //#include <ripple/protocol/PublicKey.h>
26 #include <ripple/basics/UnorderedContainers.h>
27 #include <ripple/basics/base_uint.h>
28 #include <ripple/json/json_value.h>
29 #include <cstddef>
30 #include <mutex>
31 #include <optional>
32 #include <string>
33 
34 namespace ripple {
35 
36 namespace detail {
37 
39 {
40 public:
41  explicit AccountIDTag() = default;
42 };
43 
44 } // namespace detail
45 
48 
51 toBase58(AccountID const& v);
52 
56 template <>
58 parseBase58(std::string const& s);
59 
67 // VFALCO In PublicKey.h for now
68 // AccountID
69 // calcAccountID (PublicKey const& pk);
70 
72 AccountID const&
73 xrpAccount();
74 
76 AccountID const&
77 noAccount();
78 
83 // DEPRECATED
84 bool
86 
87 // DEPRECATED Should be checking the currency or native flag
88 inline bool
89 isXRP(AccountID const& c)
90 {
91  return c == beast::zero;
92 }
93 
94 // DEPRECATED
95 inline std::string
96 to_string(AccountID const& account)
97 {
98  return toBase58(account);
99 }
100 
101 // DEPRECATED
102 inline std::ostream&
104 {
105  os << to_string(x);
106  return os;
107 }
108 
121 void
123 
124 } // namespace ripple
125 
126 //------------------------------------------------------------------------------
127 
128 namespace std {
129 
130 // DEPRECATED
131 // VFALCO Use beast::uhash or a hardened container
132 template <>
134 {
135  explicit hash() = default;
136 };
137 
138 } // namespace std
139 
140 #endif
std::string
STL class.
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:104
ripple::operator<<
std::ostream & operator<<(std::ostream &os, TOffer< TIn, TOut > const &offer)
Definition: Offer.h:242
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:82
std::ostream
STL class.
ripple::detail::AccountIDTag::AccountIDTag
AccountIDTag()=default
cstddef
ripple::xrpAccount
AccountID const & xrpAccount()
Compute AccountID from public key.
Definition: AccountID.cpp:168
ripple::detail::AccountIDTag
Definition: AccountID.h:38
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:89
ripple::base_uint< 160, detail::AccountIDTag >::hasher
hardened_hash<> hasher
Value hashing function.
Definition: base_uint.h:167
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::initAccountIdCache
void initAccountIdCache(std::size_t count)
Initialize the global cache used to map AccountID to base58 conversions.
Definition: AccountID.cpp:97
std
STL namespace.
optional
mutex
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::parseBase58
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
Definition: AccountID.cpp:114
ripple::noAccount
AccountID const & noAccount()
A placeholder for empty accounts.
Definition: AccountID.cpp:175
std::hash
ripple::to_issuer
bool to_issuer(AccountID &, std::string const &)
Convert hex or base58 string to AccountID.
Definition: AccountID.cpp:182
string