cli.hpp
资源名称:stocks.rar [点击查看]
上传用户:wenyu2k02
上传日期:2016-04-13
资源大小:28k
文件大小:1k
源码类别:
金融证券系统
开发平台:
Delphi
- #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