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 "HexCoding.h"
10
#include "Data.h"
11

12
#include <iostream>
13
#include <vector>
14
#include <cassert>
15

16
namespace TW::WalletConsole {
17

18
using namespace std;
19

20 1
class SavedValue {
21
protected:
22
    string _val;
23
public:
24 1
    SavedValue() {}
25 1
    SavedValue(const string& v) : _val(v) {}
26 1
    string get() const { return _val; }
27
};
28

29
// Keep last result and buffer variables
30 1
class Buffer {
31
protected:
32
    ostream& _out;
33
    SavedValue _last;
34
    vector<SavedValue> _prev;
35

36
public:
37 1
    Buffer(ostream& out) : _out(out) {}
38

39
    void addResult(const string& val);
40
    /// Return the given input string, if # or #n, substitute it
41
    bool prepareInput(const string& in, string& in_out);
42
    /// Print out values
43
    void buffer() const;
44
};
45

46
} // namespace TW::WalletConsole

Read our documentation on viewing source code .

Loading