📄 cli.hpp
字号:
#ifndef _CLI_HPP_
#define _CLI_HPP_
#include <boost/spirit/core.hpp>
#include <iostream>
#include <string>
#include "stock.h"
///////////////////////////////////////////////////////////////////////////////
using namespace std;
using namespace boost::spirit;
#if 0
struct cli_action
{
template <typename IteratorT>
void
operator()( IteratorT first, IteratorT last ) const
{
string s( first, last );
cout << "\tMy Action got: " << s << endl;
}
};
#endif
///////////////////////////////////////////////////////////////////////////////
//
// My grammar
//
///////////////////////////////////////////////////////////////////////////////
struct cli_grammar : public grammar<cli_grammar>
{
template <typename ScannerT>
struct definition
{
definition( cli_grammar const & self )
{
node1 = str_p("show");
node2 = space_p >> str_p("request");
node3 = str_p("test");
root = node1 >> node2[&show_curr_bid];
}
rule<ScannerT> root;
rule<ScannerT> node1;
rule<ScannerT> node2;
rule<ScannerT> node3;
rule<ScannerT> node4;
rule<ScannerT> const &
start() const
{
return root;
}
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -