bool parse_transform(transform_list& transform,
                     std::string const& str,
                     transform_expression_grammar__string const& g)
{
    std::string::const_iterator itr = str.begin();
    std::string::const_iterator end = str.end();
    bool r = qi::phrase_parse(itr, end, g, space_type(), transform);

#ifdef MAPNIK_LOG
    MAPNIK_LOG_DEBUG(load_map) << "map_parser: Parsed transform [ "
                               << transform_processor_type::to_string(transform) << " ]";
#endif

    return (r && itr==end);
}
Example #2
0
transform_list_ptr parse_transform(std::string const& str, std::string const& encoding)
{
    static const transform_expression_grammar<std::string::const_iterator> g;
    transform_list_ptr tl = std::make_shared<transform_list>();
    std::string::const_iterator itr = str.begin();
    std::string::const_iterator end = str.end();
    bool r = qi::phrase_parse(itr, end, g, space_type(), *tl);
    if (r && itr == end)
    {
        return tl;
    }
    else
    {
        throw std::runtime_error("Failed to parse transform: \"" + str + "\"");
    }
}