driver.cpp

来自「Boost provides free peer-reviewed portab」· C++ 代码 · 共 45 行

CPP
45
字号
//  Copyright (c) 2005 Carl Barron. Distributed under the Boost//  Software License, Version 1.0. (See accompanying file//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)#include "xml_g.hpp"#include <boost/spirit/include/classic_utility.hpp>#include <iostream>namespace std{    std::ostream & operator << (std::ostream &os,std::pair<std::string,std::string> const &p)    {        return os << p.first << '=' << p.second;    }        std::ostream & operator << (std::ostream &os,const tag &t)    {        return os << t.id;    }    }        int main(){    const char *test =     //  "<A x=\"1\" y=\"2\"> test 1 </A>"    //  "<B x=\"3\" y= \"4\" z = \"10\"> test 3 </B>"    //  "<C><A></A><V><W></W></V></C>"    //  "<D x=\"4\"/>"        "<E>xxx<F>yyy</F>zzz</E>"        ;    std::list<tag>  tags;    xml_g   g(tags);        if(SP::parse(test,g,SP::comment_p("<---","--->")).full)    {        std::for_each(tags.begin(),tags.end(),walk_data());    }    else    {        std::cout << "parse failed\n";    }}            

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?