32 #ifndef LEDGER_CORE_ABSTRACTBLOCKPARSER_H 33 #define LEDGER_CORE_ABSTRACTBLOCKPARSER_H 35 #include <rapidjson/reader.h> 37 #include <collections/collections.hpp> 38 #include <math/BigInt.h> 39 #include <net/HttpClient.hpp> 40 #include <utils/DateUtils.hpp> 44 template <
typename BlockchainExplorerTransactionBlock>
60 bool Uint(
unsigned i) {
64 bool Int64(int64_t i) {
68 bool Uint64(uint64_t i) {
72 bool Double(
double d) {
76 bool RawNumber(
const rapidjson::Reader::Ch *str, rapidjson::SizeType length,
bool copy) {
77 if (getLastKey() ==
"height") {
78 std::string number(str, length);
79 BigInt value = BigInt::fromString(number);
80 _block->height = value.toUint64();
85 bool String(
const rapidjson::Reader::Ch *str, rapidjson::SizeType length,
bool copy) {
86 std::string value = std::string(str, length);
87 if (getLastKey() ==
"hash") {
89 }
else if (getLastKey() ==
"time") {
90 _block->time = DateUtils::fromJSON(value);
99 bool Key(
const rapidjson::Reader::Ch *str, rapidjson::SizeType length,
bool copy) {
103 bool EndObject(rapidjson::SizeType memberCount) {
111 bool EndArray(rapidjson::SizeType elementCount) {
115 void init(BlockchainExplorerTransactionBlock *block) {
120 virtual std::string &getLastKey() = 0;
121 BlockchainExplorerTransactionBlock* _block;
126 #endif //LEDGER_CORE_ABSTRACTBLOCKPARSER_H Definition: AbstractBlockParser.h:45
Definition: Account.cpp:8