我正在使用Boost库1.55版。
我有以下对象myRule
:
#include <boost/spirit/include/qi.hpp>
namespace qi = boost::spirit::qi;
typedef qi::rule<std::string::iterator, qi::blank_type> Rule;
Rule myRule %= qi::string("Hello world");
如何将其序列化为字符串对象?
我有以下对象myGrammar
:
#include <boost/spirit/include/qi.hpp>
namespace qi = boost::spirit::qi;
typedef qi::rule<std::string::iterator, qi::blank_type> Rule;
typedef qi::grammar<std::string::iterator, qi::blank_type> Grammar;
class MyGrammar : Grammar
{
// Constructor/Destructor
MyGrammar()::base_type(myRule)
{
myRule %= qi::string("Hello world");
}
~MyGrammar() { }
// Attributes
Rule myRule;
};
MyGrammar myGrammar;
如何将其序列化为字符串对象?