Ticket #1914: boost_ptree_spirit_ns.patch

File boost_ptree_spirit_ns.patch, 2.3 KB (added by ramon.casellas@…, 14 years ago)

Simple patch to solve PTree JSON parser read issue with new Spirit

  • /opt/boost-svn/include/boost-1_35/boost/property_tree/detail/json_parser_read.hpp

    old new  
    1515#include <boost/property_tree/ptree.hpp>
    1616#include <boost/property_tree/detail/ptree_utils.hpp>
    1717#include <boost/property_tree/detail/json_parser_error.hpp>
    18 #include <boost/spirit.hpp>
     18#include <boost/spirit/include/classic.hpp>
    1919#include <string>
    2020#include <locale>
    2121#include <istream>
     
    2424
    2525namespace boost { namespace property_tree { namespace json_parser
    2626{
     27    using namespace BOOST_SPIRIT_CLASSIC_NS;
    2728
    2829    ///////////////////////////////////////////////////////////////////////
    2930    // Json parser context
     
    155156    // Json grammar
    156157       
    157158    template<class Ptree>
    158     struct json_grammar: public boost::spirit::grammar<json_grammar<Ptree> >
     159    struct json_grammar: public grammar<json_grammar<Ptree> >
    159160    {
    160161       
    161162        typedef context<Ptree> Context;
     
    167168        struct definition
    168169        {
    169170           
    170             boost::spirit::rule<Scanner> root, object, member, array, item, value, string, number;
    171             boost::spirit::rule<typename boost::spirit::lexeme_scanner<Scanner>::type> character, escape;
     171            rule<Scanner> root, object, member, array, item, value, string, number;
     172            rule<typename lexeme_scanner<Scanner>::type> character, escape;
    172173
    173174            definition(const json_grammar &self)
    174175            {
    175                
    176                 using namespace boost::spirit;
    177 
    178176                // Assertions
    179177                assertion<std::string> expect_object("expected object");
    180178                assertion<std::string> expect_eoi("expected end of input");
     
    259257
    260258            }
    261259
    262             const boost::spirit::rule<Scanner> &start() const
     260            const rule<Scanner> &start() const
    263261            {
    264262                return root;
    265263            }
     
    279277                            Ptree &pt,
    280278                            const std::string &filename)
    281279    {
    282 
    283         using namespace boost::spirit;
    284280        typedef typename Ptree::key_type::value_type Ch;
    285281        typedef typename std::vector<Ch>::iterator It;
    286282