@eosrio/node-abieos 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/abieos.node +0 -0
- package/lib/abieos.d.ts +19 -0
- package/lib/abieos.d.ts.map +1 -0
- package/lib/abieos.js +100 -0
- package/lib/abieos.ts +107 -0
- package/package.json +13 -8
- package/.idea/modules.xml +0 -8
- package/.idea/node-abieos.iml +0 -12
- package/.idea/vcs.xml +0 -9
- package/.idea/workspace.xml +0 -66
- package/CMakeLists.txt +0 -35
- package/abieos.d.ts +0 -21
- package/abieos.js +0 -59
- package/eosio.json +0 -1596
- package/include/.clang-format +0 -76
- package/include/eosio/abi.hpp +0 -393
- package/include/eosio/asset.hpp +0 -458
- package/include/eosio/bytes.hpp +0 -27
- package/include/eosio/chain_conversions.hpp +0 -450
- package/include/eosio/chain_types.hpp +0 -14
- package/include/eosio/check.hpp +0 -178
- package/include/eosio/convert.hpp +0 -95
- package/include/eosio/crypto.hpp +0 -148
- package/include/eosio/eosio_outcome.hpp +0 -41
- package/include/eosio/fixed_bytes.hpp +0 -250
- package/include/eosio/float.hpp +0 -35
- package/include/eosio/for_each_field.hpp +0 -48
- package/include/eosio/fpconv.c +0 -336
- package/include/eosio/fpconv.h +0 -41
- package/include/eosio/fpconv.license +0 -23
- package/include/eosio/from_bin.hpp +0 -272
- package/include/eosio/from_json.hpp +0 -749
- package/include/eosio/from_string.hpp +0 -28
- package/include/eosio/map_macro.h +0 -64
- package/include/eosio/murmur.hpp +0 -55
- package/include/eosio/name.hpp +0 -178
- package/include/eosio/opaque.hpp +0 -184
- package/include/eosio/operators.hpp +0 -71
- package/include/eosio/powers.h +0 -76
- package/include/eosio/reflection.hpp +0 -61
- package/include/eosio/ship_protocol.hpp +0 -971
- package/include/eosio/stream.hpp +0 -235
- package/include/eosio/symbol.hpp +0 -300
- package/include/eosio/time.hpp +0 -264
- package/include/eosio/to_bin.hpp +0 -189
- package/include/eosio/to_json.hpp +0 -334
- package/include/eosio/to_key.hpp +0 -305
- package/include/eosio/types.hpp +0 -103
- package/include/eosio/varint.hpp +0 -452
- package/include/outcome-basic.hpp +0 -6836
- package/include/rapidjson/allocators.h +0 -284
- package/include/rapidjson/cursorstreamwrapper.h +0 -78
- package/include/rapidjson/document.h +0 -2646
- package/include/rapidjson/encodedstream.h +0 -299
- package/include/rapidjson/encodings.h +0 -716
- package/include/rapidjson/error/en.h +0 -74
- package/include/rapidjson/error/error.h +0 -161
- package/include/rapidjson/filereadstream.h +0 -99
- package/include/rapidjson/filewritestream.h +0 -104
- package/include/rapidjson/fwd.h +0 -151
- package/include/rapidjson/internal/biginteger.h +0 -290
- package/include/rapidjson/internal/diyfp.h +0 -271
- package/include/rapidjson/internal/dtoa.h +0 -245
- package/include/rapidjson/internal/ieee754.h +0 -78
- package/include/rapidjson/internal/itoa.h +0 -308
- package/include/rapidjson/internal/meta.h +0 -186
- package/include/rapidjson/internal/pow10.h +0 -55
- package/include/rapidjson/internal/regex.h +0 -732
- package/include/rapidjson/internal/stack.h +0 -231
- package/include/rapidjson/internal/strfunc.h +0 -69
- package/include/rapidjson/internal/strtod.h +0 -290
- package/include/rapidjson/internal/swap.h +0 -46
- package/include/rapidjson/istreamwrapper.h +0 -113
- package/include/rapidjson/memorybuffer.h +0 -70
- package/include/rapidjson/memorystream.h +0 -71
- package/include/rapidjson/msinttypes/inttypes.h +0 -316
- package/include/rapidjson/msinttypes/stdint.h +0 -300
- package/include/rapidjson/ostreamwrapper.h +0 -81
- package/include/rapidjson/pointer.h +0 -1357
- package/include/rapidjson/prettywriter.h +0 -277
- package/include/rapidjson/rapidjson.h +0 -654
- package/include/rapidjson/reader.h +0 -2230
- package/include/rapidjson/schema.h +0 -2494
- package/include/rapidjson/stream.h +0 -223
- package/include/rapidjson/stringbuffer.h +0 -121
- package/include/rapidjson/writer.h +0 -710
- package/src/abi.cpp +0 -274
- package/src/abieos.cpp +0 -334
- package/src/abieos.h +0 -91
- package/src/abieos.hpp +0 -1011
- package/src/abieos_exception.hpp +0 -89
- package/src/abieos_numeric.hpp +0 -94
- package/src/abieos_ripemd160.hpp +0 -417
- package/src/crypto.cpp +0 -215
- package/src/main.cpp +0 -242
- package/src/ship.abi.cpp +0 -695
- package/tools/CMakeLists.txt +0 -9
- package/tools/name.cpp +0 -86
package/include/eosio/types.hpp
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <array>
|
|
4
|
-
#include <cstdint>
|
|
5
|
-
#include <optional>
|
|
6
|
-
#include <string>
|
|
7
|
-
#include <variant>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
namespace eosio {
|
|
11
|
-
|
|
12
|
-
constexpr const char* get_type_name(bool*) { return "bool"; }
|
|
13
|
-
constexpr const char* get_type_name(std::int8_t*) { return "int8"; }
|
|
14
|
-
constexpr const char* get_type_name(std::uint8_t*) { return "uint8"; }
|
|
15
|
-
constexpr const char* get_type_name(std::int16_t*) { return "int16"; }
|
|
16
|
-
constexpr const char* get_type_name(std::uint16_t*) { return "uint16"; }
|
|
17
|
-
constexpr const char* get_type_name(std::int32_t*) { return "int32"; }
|
|
18
|
-
constexpr const char* get_type_name(std::uint32_t*) { return "uint32"; }
|
|
19
|
-
constexpr const char* get_type_name(std::int64_t*) { return "int64"; }
|
|
20
|
-
constexpr const char* get_type_name(std::uint64_t*) { return "uint64"; }
|
|
21
|
-
constexpr const char* get_type_name(float*) { return "float32"; }
|
|
22
|
-
constexpr const char* get_type_name(double*) { return "float64"; }
|
|
23
|
-
constexpr const char* get_type_name(std::string*) { return "string"; }
|
|
24
|
-
|
|
25
|
-
#ifndef ABIEOS_NO_INT128
|
|
26
|
-
constexpr const char* get_type_name(__int128*) { return "int128"; }
|
|
27
|
-
constexpr const char* get_type_name(unsigned __int128*) { return "uint128"; }
|
|
28
|
-
#endif
|
|
29
|
-
|
|
30
|
-
#ifdef __eosio_cdt__
|
|
31
|
-
constexpr const char* get_type_name(long double*) { return "float128"; }
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
template <std::size_t N, std::size_t M>
|
|
35
|
-
constexpr std::array<char, N + M> array_cat(std::array<char, N> lhs, std::array<char, M> rhs) {
|
|
36
|
-
std::array<char, N + M> result{};
|
|
37
|
-
for (std::size_t i = 0; i < N; ++i) { result[i] = lhs[i]; }
|
|
38
|
-
for (std::size_t i = 0; i < M; ++i) { result[i + N] = rhs[i]; }
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
template <std::size_t N>
|
|
43
|
-
constexpr std::array<char, N> to_array(std::string_view s) {
|
|
44
|
-
std::array<char, N> result{};
|
|
45
|
-
for (std::size_t i = 0; i < N; ++i) { result[i] = s[i]; }
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
template <typename T, std::size_t N>
|
|
50
|
-
constexpr auto append_type_name(const char (&suffix)[N]) {
|
|
51
|
-
constexpr std::string_view name = get_type_name((T*)nullptr);
|
|
52
|
-
return array_cat(to_array<name.size()>(name), to_array<N>({ suffix, N }));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
template <typename T>
|
|
56
|
-
constexpr auto vector_type_name = append_type_name<T>("[]");
|
|
57
|
-
|
|
58
|
-
template <typename T>
|
|
59
|
-
constexpr auto optional_type_name = append_type_name<T>("?");
|
|
60
|
-
|
|
61
|
-
template <typename T>
|
|
62
|
-
constexpr const char* get_type_name(std::vector<T>*) {
|
|
63
|
-
return vector_type_name<T>.data();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
template <typename T>
|
|
67
|
-
constexpr const char* get_type_name(std::optional<T>*) {
|
|
68
|
-
return optional_type_name<T>.data();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
struct variant_type_appender {
|
|
72
|
-
char* buf;
|
|
73
|
-
constexpr variant_type_appender operator+(std::string_view s) {
|
|
74
|
-
*buf++ = '_';
|
|
75
|
-
for (auto ch : s) *buf++ = ch;
|
|
76
|
-
return *this;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
template <typename... T>
|
|
81
|
-
constexpr auto get_variant_type_name() {
|
|
82
|
-
constexpr std::size_t size = sizeof("variant") + ((std::string_view(get_type_name((T*)nullptr)).size() + 1) + ...);
|
|
83
|
-
std::array<char, size> buffer{ 'v', 'a', 'r', 'i', 'a', 'n', 't' };
|
|
84
|
-
(variant_type_appender{ buffer.data() + 7 } + ... + std::string_view(get_type_name((T*)nullptr)));
|
|
85
|
-
buffer[buffer.size() - 1] = '\0';
|
|
86
|
-
return buffer;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
template <typename... T>
|
|
90
|
-
constexpr auto variant_type_name = get_variant_type_name<T...>();
|
|
91
|
-
|
|
92
|
-
} // namespace eosio
|
|
93
|
-
|
|
94
|
-
namespace std {
|
|
95
|
-
// For all the types defined in ship_protocal.hpp, it relies on the argument-dependent name lookup
|
|
96
|
-
// to work; that is, the get_type_name() should be defined in the namespace which is the same namespace of
|
|
97
|
-
// the first argument. For variant, it is defined in the namespace; therefore, we need to define get_type_name()
|
|
98
|
-
// in the std namespace.
|
|
99
|
-
template <typename... T>
|
|
100
|
-
constexpr const char* get_type_name(std::variant<T...>*) {
|
|
101
|
-
return eosio::variant_type_name<T...>.data();
|
|
102
|
-
}
|
|
103
|
-
}
|
package/include/eosio/varint.hpp
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file
|
|
3
|
-
* @copyright defined in eos/LICENSE
|
|
4
|
-
*/
|
|
5
|
-
#pragma once
|
|
6
|
-
|
|
7
|
-
#include "from_bin.hpp"
|
|
8
|
-
#include "from_json.hpp"
|
|
9
|
-
#include "to_bin.hpp"
|
|
10
|
-
#include "to_json.hpp"
|
|
11
|
-
|
|
12
|
-
namespace eosio {
|
|
13
|
-
/**
|
|
14
|
-
* @defgroup varint Variable Length Integer Type
|
|
15
|
-
* @ingroup core
|
|
16
|
-
* @ingroup types
|
|
17
|
-
* @brief Defines variable length integer type which provides more efficient serialization
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Variable Length Unsigned Integer. This provides more efficient serialization of 32-bit unsigned int.
|
|
22
|
-
* It serialuzes a 32-bit unsigned integer in as few bytes as possible
|
|
23
|
-
* `varuint32` is unsigned and uses [VLQ or Base-128 encoding](https://en.wikipedia.org/wiki/Variable-length_quantity)
|
|
24
|
-
*
|
|
25
|
-
* @ingroup varint
|
|
26
|
-
*/
|
|
27
|
-
struct unsigned_int {
|
|
28
|
-
/**
|
|
29
|
-
* Construct a new unsigned int object
|
|
30
|
-
*
|
|
31
|
-
* @param v - Source
|
|
32
|
-
*/
|
|
33
|
-
unsigned_int(uint32_t v = 0) : value(v) {}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Construct a new unsigned int object from a type that is convertible to uint32_t
|
|
37
|
-
*
|
|
38
|
-
* @tparam T - Type of the source
|
|
39
|
-
* @param v - Source
|
|
40
|
-
* @pre T must be convertible to uint32_t
|
|
41
|
-
*/
|
|
42
|
-
template <typename T>
|
|
43
|
-
unsigned_int(T v) : value(v) {}
|
|
44
|
-
|
|
45
|
-
// operator uint32_t()const { return value; }
|
|
46
|
-
// operator uint64_t()const { return value; }
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Convert unsigned_int as T
|
|
50
|
-
*
|
|
51
|
-
* @tparam T - Target type of conversion
|
|
52
|
-
* @return T - Converted target
|
|
53
|
-
*/
|
|
54
|
-
template <typename T>
|
|
55
|
-
operator T() const {
|
|
56
|
-
return static_cast<T>(value);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/// @cond OPERATORS
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Assign 32-bit unsigned integer
|
|
63
|
-
*
|
|
64
|
-
* @param v - Soruce
|
|
65
|
-
* @return unsigned_int& - Reference to this object
|
|
66
|
-
*/
|
|
67
|
-
unsigned_int& operator=(uint32_t v) {
|
|
68
|
-
value = v;
|
|
69
|
-
return *this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/// @endcond
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Contained value
|
|
76
|
-
*/
|
|
77
|
-
uint32_t value;
|
|
78
|
-
|
|
79
|
-
/// @cond OPERATORS
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Check equality between a unsigned_int object and 32-bit unsigned integer
|
|
83
|
-
*
|
|
84
|
-
* @param i - unsigned_int object to compare
|
|
85
|
-
* @param v - 32-bit unsigned integer to compare
|
|
86
|
-
* @return true - if equal
|
|
87
|
-
* @return false - otherwise
|
|
88
|
-
*/
|
|
89
|
-
friend bool operator==(const unsigned_int& i, const uint32_t& v) { return i.value == v; }
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Check equality between 32-bit unsigned integer and a unsigned_int object
|
|
93
|
-
*
|
|
94
|
-
* @param i - 32-bit unsigned integer to compare
|
|
95
|
-
* @param v - unsigned_int object to compare
|
|
96
|
-
* @return true - if equal
|
|
97
|
-
* @return false - otherwise
|
|
98
|
-
*/
|
|
99
|
-
friend bool operator==(const uint32_t& i, const unsigned_int& v) { return i == v.value; }
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Check equality between two unsigned_int objects
|
|
103
|
-
*
|
|
104
|
-
* @param i - First unsigned_int object to compare
|
|
105
|
-
* @param v - Second unsigned_int object to compare
|
|
106
|
-
* @return true - if equal
|
|
107
|
-
* @return false - otherwise
|
|
108
|
-
*/
|
|
109
|
-
friend bool operator==(const unsigned_int& i, const unsigned_int& v) { return i.value == v.value; }
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Check inequality between a unsigned_int object and 32-bit unsigned integer
|
|
113
|
-
*
|
|
114
|
-
* @param i - unsigned_int object to compare
|
|
115
|
-
* @param v - 32-bit unsigned integer to compare
|
|
116
|
-
* @return true - if inequal
|
|
117
|
-
* @return false - otherwise
|
|
118
|
-
*/
|
|
119
|
-
friend bool operator!=(const unsigned_int& i, const uint32_t& v) { return i.value != v; }
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Check inequality between 32-bit unsigned integer and a unsigned_int object
|
|
123
|
-
*
|
|
124
|
-
* @param i - 32-bit unsigned integer to compare
|
|
125
|
-
* @param v - unsigned_int object to compare
|
|
126
|
-
* @return true - if unequal
|
|
127
|
-
* @return false - otherwise
|
|
128
|
-
*/
|
|
129
|
-
friend bool operator!=(const uint32_t& i, const unsigned_int& v) { return i != v.value; }
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Check inequality between two unsigned_int objects
|
|
133
|
-
*
|
|
134
|
-
* @param i - First unsigned_int object to compare
|
|
135
|
-
* @param v - Second unsigned_int object to compare
|
|
136
|
-
* @return true - if inequal
|
|
137
|
-
* @return false - otherwise
|
|
138
|
-
*/
|
|
139
|
-
friend bool operator!=(const unsigned_int& i, const unsigned_int& v) { return i.value != v.value; }
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Check if the given unsigned_int object is less than the given 32-bit unsigned integer
|
|
143
|
-
*
|
|
144
|
-
* @param i - unsigned_int object to compare
|
|
145
|
-
* @param v - 32-bit unsigned integer to compare
|
|
146
|
-
* @return true - if i less than v
|
|
147
|
-
* @return false - otherwise
|
|
148
|
-
*/
|
|
149
|
-
friend bool operator<(const unsigned_int& i, const uint32_t& v) { return i.value < v; }
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Check if the given 32-bit unsigned integer is less than the given unsigned_int object
|
|
153
|
-
*
|
|
154
|
-
* @param i - 32-bit unsigned integer to compare
|
|
155
|
-
* @param v - unsigned_int object to compare
|
|
156
|
-
* @return true - if i less than v
|
|
157
|
-
* @return false - otherwise
|
|
158
|
-
*/
|
|
159
|
-
friend bool operator<(const uint32_t& i, const unsigned_int& v) { return i < v.value; }
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Check if the first given unsigned_int is less than the second given unsigned_int object
|
|
163
|
-
*
|
|
164
|
-
* @param i - First unsigned_int object to compare
|
|
165
|
-
* @param v - Second unsigned_int object to compare
|
|
166
|
-
* @return true - if i less than v
|
|
167
|
-
* @return false - otherwise
|
|
168
|
-
*/
|
|
169
|
-
friend bool operator<(const unsigned_int& i, const unsigned_int& v) { return i.value < v.value; }
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Check if the given unsigned_int object is greater or equal to the given 32-bit unsigned integer
|
|
173
|
-
*
|
|
174
|
-
* @param i - unsigned_int object to compare
|
|
175
|
-
* @param v - 32-bit unsigned integer to compare
|
|
176
|
-
* @return true - if i is greater or equal to v
|
|
177
|
-
* @return false - otherwise
|
|
178
|
-
*/
|
|
179
|
-
friend bool operator>=(const unsigned_int& i, const uint32_t& v) { return i.value >= v; }
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Check if the given 32-bit unsigned integer is greater or equal to the given unsigned_int object
|
|
183
|
-
*
|
|
184
|
-
* @param i - 32-bit unsigned integer to compare
|
|
185
|
-
* @param v - unsigned_int object to compare
|
|
186
|
-
* @return true - if i is greater or equal to v
|
|
187
|
-
* @return false - otherwise
|
|
188
|
-
*/
|
|
189
|
-
friend bool operator>=(const uint32_t& i, const unsigned_int& v) { return i >= v.value; }
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Check if the first given unsigned_int is greater or equal to the second given unsigned_int object
|
|
193
|
-
*
|
|
194
|
-
* @param i - First unsigned_int object to compare
|
|
195
|
-
* @param v - Second unsigned_int object to compare
|
|
196
|
-
* @return true - if i is greater or equal to v
|
|
197
|
-
* @return false - otherwise
|
|
198
|
-
*/
|
|
199
|
-
friend bool operator>=(const unsigned_int& i, const unsigned_int& v) { return i.value >= v.value; }
|
|
200
|
-
|
|
201
|
-
/// @endcond
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
using varuint32 = unsigned_int;
|
|
205
|
-
EOSIO_REFLECT(varuint32, value);
|
|
206
|
-
|
|
207
|
-
template <typename F>
|
|
208
|
-
void convert(const varuint32& src, uint32_t& dst, F&& chooser) {
|
|
209
|
-
dst = src.value;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
template <typename S>
|
|
213
|
-
void from_bin(varuint32& obj, S& stream) {
|
|
214
|
-
return varuint32_from_bin(obj.value, stream);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
template <typename S>
|
|
218
|
-
void to_bin(const varuint32& obj, S& stream) {
|
|
219
|
-
return varuint32_to_bin(obj.value, stream);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
template <typename S>
|
|
223
|
-
void from_json(varuint32& obj, S& stream) {
|
|
224
|
-
return from_json(obj.value, stream);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
template <typename S>
|
|
228
|
-
void to_json(const varuint32& obj, S& stream) {
|
|
229
|
-
return to_json(obj.value, stream);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
template <typename S>
|
|
233
|
-
void to_key(const varuint32& obj, S& stream) {
|
|
234
|
-
return to_key_varuint32(obj.value, stream);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Variable Length Signed Integer. This provides more efficient serialization of 32-bit signed int.
|
|
239
|
-
* It serializes a 32-bit signed integer in as few bytes as possible.
|
|
240
|
-
*
|
|
241
|
-
* @ingroup varint
|
|
242
|
-
* @note `varint32' is signed and uses [Zig-Zag
|
|
243
|
-
* encoding](https://developers.google.com/protocol-buffers/docs/encoding#signed-integers)
|
|
244
|
-
*/
|
|
245
|
-
struct signed_int {
|
|
246
|
-
/**
|
|
247
|
-
* Construct a new signed int object
|
|
248
|
-
*
|
|
249
|
-
* @param v - Source
|
|
250
|
-
*/
|
|
251
|
-
signed_int(int32_t v = 0) : value(v) {}
|
|
252
|
-
|
|
253
|
-
/// @cond OPERATORS
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Convert signed_int to primitive 32-bit signed integer
|
|
257
|
-
*
|
|
258
|
-
* @return int32_t - The converted result
|
|
259
|
-
*/
|
|
260
|
-
operator int32_t() const { return value; }
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Assign an object that is convertible to int32_t
|
|
264
|
-
*
|
|
265
|
-
* @tparam T - Type of the assignment object
|
|
266
|
-
* @param v - Source
|
|
267
|
-
* @return unsigned_int& - Reference to this object
|
|
268
|
-
*/
|
|
269
|
-
template <typename T>
|
|
270
|
-
signed_int& operator=(const T& v) {
|
|
271
|
-
value = v;
|
|
272
|
-
return *this;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Increment operator
|
|
277
|
-
*
|
|
278
|
-
* @return signed_int - New signed_int with value incremented from the current object's value
|
|
279
|
-
*/
|
|
280
|
-
signed_int operator++(int) { return value++; }
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Increment operator
|
|
284
|
-
*
|
|
285
|
-
* @return signed_int - Reference to current object
|
|
286
|
-
*/
|
|
287
|
-
signed_int& operator++() {
|
|
288
|
-
++value;
|
|
289
|
-
return *this;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/// @endcond
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Contained value
|
|
296
|
-
*/
|
|
297
|
-
int32_t value;
|
|
298
|
-
|
|
299
|
-
/// @cond OPERATORS
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Check equality between a signed_int object and 32-bit integer
|
|
303
|
-
*
|
|
304
|
-
* @param i - signed_int object to compare
|
|
305
|
-
* @param v - 32-bit integer to compare
|
|
306
|
-
* @return true - if equal
|
|
307
|
-
* @return false - otherwise
|
|
308
|
-
*/
|
|
309
|
-
friend bool operator==(const signed_int& i, const int32_t& v) { return i.value == v; }
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Check equality between 32-bit integer and a signed_int object
|
|
313
|
-
*
|
|
314
|
-
* @param i - 32-bit integer to compare
|
|
315
|
-
* @param v - signed_int object to compare
|
|
316
|
-
* @return true - if equal
|
|
317
|
-
* @return false - otherwise
|
|
318
|
-
*/
|
|
319
|
-
friend bool operator==(const int32_t& i, const signed_int& v) { return i == v.value; }
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Check equality between two signed_int objects
|
|
323
|
-
*
|
|
324
|
-
* @param i - First signed_int object to compare
|
|
325
|
-
* @param v - Second signed_int object to compare
|
|
326
|
-
* @return true - if equal
|
|
327
|
-
* @return false - otherwise
|
|
328
|
-
*/
|
|
329
|
-
friend bool operator==(const signed_int& i, const signed_int& v) { return i.value == v.value; }
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Check inequality between a signed_int object and 32-bit integer
|
|
333
|
-
*
|
|
334
|
-
* @param i - signed_int object to compare
|
|
335
|
-
* @param v - 32-bit integer to compare
|
|
336
|
-
* @return true - if inequal
|
|
337
|
-
* @return false - otherwise
|
|
338
|
-
*/
|
|
339
|
-
friend bool operator!=(const signed_int& i, const int32_t& v) { return i.value != v; }
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Check inequality between 32-bit integer and a signed_int object
|
|
343
|
-
*
|
|
344
|
-
* @param i - 32-bit integer to compare
|
|
345
|
-
* @param v - signed_int object to compare
|
|
346
|
-
* @return true - if unequal
|
|
347
|
-
* @return false - otherwise
|
|
348
|
-
*/
|
|
349
|
-
friend bool operator!=(const int32_t& i, const signed_int& v) { return i != v.value; }
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Check inequality between two signed_int objects
|
|
353
|
-
*
|
|
354
|
-
* @param i - First signed_int object to compare
|
|
355
|
-
* @param v - Second signed_int object to compare
|
|
356
|
-
* @return true - if inequal
|
|
357
|
-
* @return false - otherwise
|
|
358
|
-
*/
|
|
359
|
-
friend bool operator!=(const signed_int& i, const signed_int& v) { return i.value != v.value; }
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Check if the given signed_int object is less than the given 32-bit integer
|
|
363
|
-
*
|
|
364
|
-
* @param i - signed_int object to compare
|
|
365
|
-
* @param v - 32-bit integer to compare
|
|
366
|
-
* @return true - if i less than v
|
|
367
|
-
* @return false - otherwise
|
|
368
|
-
*/
|
|
369
|
-
friend bool operator<(const signed_int& i, const int32_t& v) { return i.value < v; }
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Check if the given 32-bit integer is less than the given signed_int object
|
|
373
|
-
*
|
|
374
|
-
* @param i - 32-bit integer to compare
|
|
375
|
-
* @param v - signed_int object to compare
|
|
376
|
-
* @return true - if i less than v
|
|
377
|
-
* @return false - otherwise
|
|
378
|
-
*/
|
|
379
|
-
friend bool operator<(const int32_t& i, const signed_int& v) { return i < v.value; }
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Check if the first given signed_int is less than the second given signed_int object
|
|
383
|
-
*
|
|
384
|
-
* @param i - First signed_int object to compare
|
|
385
|
-
* @param v - Second signed_int object to compare
|
|
386
|
-
* @return true - if i less than v
|
|
387
|
-
* @return false - otherwise
|
|
388
|
-
*/
|
|
389
|
-
friend bool operator<(const signed_int& i, const signed_int& v) { return i.value < v.value; }
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Check if the given signed_int object is greater or equal to the given 32-bit integer
|
|
393
|
-
*
|
|
394
|
-
* @param i - signed_int object to compare
|
|
395
|
-
* @param v - 32-bit integer to compare
|
|
396
|
-
* @return true - if i is greater or equal to v
|
|
397
|
-
* @return false - otherwise
|
|
398
|
-
*/
|
|
399
|
-
friend bool operator>=(const signed_int& i, const int32_t& v) { return i.value >= v; }
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Check if the given 32-bit integer is greater or equal to the given signed_int object
|
|
403
|
-
*
|
|
404
|
-
* @param i - 32-bit integer to compare
|
|
405
|
-
* @param v - signed_int object to compare
|
|
406
|
-
* @return true - if i is greater or equal to v
|
|
407
|
-
* @return false - otherwise
|
|
408
|
-
*/
|
|
409
|
-
friend bool operator>=(const int32_t& i, const signed_int& v) { return i >= v.value; }
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Check if the first given signed_int is greater or equal to the second given signed_int object
|
|
413
|
-
*
|
|
414
|
-
* @param i - First signed_int object to compare
|
|
415
|
-
* @param v - Second signed_int object to compare
|
|
416
|
-
* @return true - if i is greater or equal to v
|
|
417
|
-
* @return false - otherwise
|
|
418
|
-
*/
|
|
419
|
-
friend bool operator>=(const signed_int& i, const signed_int& v) { return i.value >= v.value; }
|
|
420
|
-
|
|
421
|
-
/// @endcond
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
using varint32 = signed_int;
|
|
425
|
-
EOSIO_REFLECT(varint32, value);
|
|
426
|
-
|
|
427
|
-
template <typename S>
|
|
428
|
-
void from_bin(varint32& obj, S& stream) {
|
|
429
|
-
return varint32_from_bin(obj.value, stream);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
template <typename S>
|
|
433
|
-
void to_bin(const varint32& obj, S& stream) {
|
|
434
|
-
return varuint32_to_bin((uint32_t(obj.value) << 1) ^ uint32_t(obj.value >> 31), stream);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
template <typename S>
|
|
438
|
-
void from_json(varint32& obj, S& stream) {
|
|
439
|
-
return from_json(obj.value, stream);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
template <typename S>
|
|
443
|
-
void to_json(const varint32& obj, S& stream) {
|
|
444
|
-
return to_json(obj.value, stream);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
template <typename S>
|
|
448
|
-
void to_key(const varint32& obj, S& stream) {
|
|
449
|
-
return to_key_varint32(obj.value, stream);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
} // namespace eosio
|