Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
cli.hpp
Go to the documentation of this file.
1#pragma once
2#include <fc/io/stdio.hpp>
3#include <fc/io/json.hpp>
5#include <fc/io/sstream.hpp>
7#include <fc/thread/thread.hpp>
8
9#include <iostream>
10
11namespace fc { namespace rpc {
12
16 class cli : public api_connection
17 {
18 public:
19 ~cli();
20
21 virtual variant send_call( api_id_type api_id, string method_name, variants args = variants() );
22 virtual variant send_callback( uint64_t callback_id, variants args = variants() );
23 virtual void send_notice( uint64_t callback_id, variants args = variants() );
24
25 void start();
26 void stop();
27 void wait();
28 void format_result( const string& method, std::function<string(variant,const variants&)> formatter);
29
30 virtual void getline( const fc::string& prompt, fc::string& line );
31
32 void set_prompt( const string& prompt );
33
34 private:
35 void run();
36
37 std::string _prompt = ">>>";
38 std::map<string,std::function<string(variant,const variants&)> > _result_formatters;
39 fc::future<void> _run_complete;
40 };
41} }
virtual variant send_callback(uint64_t callback_id, variants args=variants())
Definition cli.cpp:52
virtual void getline(const fc::string &prompt, fc::string &line)
Definition cli.cpp:191
void start()
Definition cli.cpp:62
virtual variant send_call(api_id_type api_id, string method_name, variants args=variants())
Definition cli.cpp:47
void wait()
Definition cli.cpp:74
void stop()
Definition cli.cpp:68
void format_result(const string &method, std::function< string(variant, const variants &)> formatter)
Definition cli.cpp:79
virtual void send_notice(uint64_t callback_id, variants args=variants())
Definition cli.cpp:57
void set_prompt(const string &prompt)
Definition cli.cpp:84
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
namespace sysio::chain
Definition authority.cpp:3
std::string string
Definition string.hpp:10
uint32_t api_id_type
Definition api.hpp:46
std::vector< fc::variant > variants
Definition variant.hpp:173
unsigned __int64 uint64_t
Definition stdint.h:136