1
// Copyright © 2017-2020 Trust Wallet.
2
//
3
// This file is part of Trust. The full Trust copyright notice, including
4
// terms governing use, modification, and redistribution, is contained in the
5
// file LICENSE at the root of the source code distribution tree.
6

7
#pragma once
8

9
#include <cctype>
10

11
#include "../Data.h"
12
#include "../BinaryCoding.h"
13

14
namespace TW {
15

16
Data readBytes(const Data& from, int max, int initial_pos = 0);
17
Data readVarBytes(const Data& from, int initial_pos = 0, uint32_t* dataRead = nullptr);
18

19
template<class T> T readVar(const TW::Data& from, int initial_pos = 0, const T& max = INT_MAX);
20
template<> int64_t readVar(const TW::Data& from, int initial_pos, const int64_t& max);
21
template<> uint64_t readVar(const TW::Data& from, int initial_pos, const uint64_t& max);
22

23
Data writeVarBytes(const Data& from, int initial_pos = 0);
24

25
template<class T>
26 1
static std::vector<T> concat(const std::vector<T>& v1, const std::vector<T>& v2) {
27 1
    std::vector<T> v(v1);
28 1
    v.insert(v.end(), v2.begin(), v2.end());
29 1
    return std::move(v);
30
}
31

32
} // namespace TW

Read our documentation on viewing source code .

Loading