BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
libraries
fc
include
fc
rpc
cli.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <
fc/io/stdio.hpp
>
3
#include <
fc/io/json.hpp
>
4
#include <
fc/io/buffered_iostream.hpp
>
5
#include <
fc/io/sstream.hpp
>
6
#include <
fc/rpc/api_connection.hpp
>
7
#include <
fc/thread/thread.hpp
>
8
9
#include <iostream>
10
11
namespace
fc
{
namespace
rpc {
12
16
class
cli
:
public
api_connection
17
{
18
public
:
19
cli
( uint32_t max_depth ) :
api_connection
(max_depth) {}
20
~cli
();
21
22
virtual
variant
send_call
(
api_id_type
api_id,
string
method_name,
variants
args =
variants
() );
23
virtual
variant
send_callback
( uint64_t callback_id,
variants
args =
variants
() );
24
virtual
void
send_notice
( uint64_t callback_id,
variants
args =
variants
() );
25
26
void
start
();
27
void
stop
();
28
void
cancel
();
29
void
wait
();
30
void
format_result
(
const
string
& method, std::function<
string
(
variant
,
const
variants
&)> formatter);
31
32
virtual
void
getline
(
const
std::string& prompt, std::string& line );
33
34
void
set_prompt
(
const
string
& prompt );
35
36
void
set_regex_secret
(
const
string
& expr );
37
38
private
:
39
void
run();
40
41
std::string _prompt =
">>>"
;
42
std::map<string,std::function<string(
variant
,
const
variants
&)> > _result_formatters;
43
fc::future<void>
_run_complete;
44
fc::thread
* _getline_thread =
nullptr
;
45
};
46
} }
fc::rpc::cli::~cli
~cli()
Definition:
cli.cpp:34
stdio.hpp
fc::rpc::cli::stop
void stop()
Definition:
cli.cpp:289
fc::rpc::cli::set_regex_secret
void set_regex_secret(const string &expr)
Definition:
cli.cpp:67
fc::rpc::cli::wait
void wait()
Definition:
cli.cpp:295
fc::rpc::cli
Definition:
cli.hpp:16
fc
Definition:
api.hpp:15
fc::api_id_type
uint32_t api_id_type
Definition:
api.hpp:122
api_connection.hpp
fc::rpc::cli::cancel
void cancel()
Definition:
cli.cpp:276
fc::rpc::cli::getline
virtual void getline(const std::string &prompt, std::string &line)
Definition:
cli.cpp:305
buffered_iostream.hpp
fc::rpc::cli::send_notice
virtual void send_notice(uint64_t callback_id, variants args=variants())
Definition:
cli.cpp:52
fc::variants
std::vector< variant > variants
Definition:
variant.hpp:170
fc::thread
Definition:
thread.hpp:39
sstream.hpp
thread.hpp
fc::rpc::cli::send_callback
virtual variant send_callback(uint64_t callback_id, variants args=variants())
Definition:
cli.cpp:47
fc::rpc::cli::send_call
virtual variant send_call(api_id_type api_id, string method_name, variants args=variants())
Definition:
cli.cpp:42
fc::rpc::cli::format_result
void format_result(const string &method, std::function< string(variant, const variants &)> formatter)
Definition:
cli.cpp:57
json.hpp
fc::variant
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition:
variant.hpp:198
fc::rpc::cli::start
void start()
Definition:
cli.cpp:254
fc::rpc::cli::set_prompt
void set_prompt(const string &prompt)
Definition:
cli.cpp:62
fc::api_connection
Definition:
api_connection.hpp:240
fc::future< void >
Definition:
future.hpp:283
fc::rpc::cli::cli
cli(uint32_t max_depth)
Definition:
cli.hpp:19
Generated on Fri Dec 15 2023 06:12:42 for BitShares-Core by
1.8.17