avoid direct usage of spirit in csv plugin

This commit is contained in:
Dane Springmeyer 2013-01-03 16:26:09 -08:00
parent ec47745abf
commit ebfc3161c1

View file

@ -27,8 +27,6 @@
#include <boost/make_shared.hpp>
#include <boost/tokenizer.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
// mapnik
#include <mapnik/debug.hpp>
@ -52,7 +50,6 @@
using mapnik::datasource;
using mapnik::parameters;
using namespace boost::spirit;
DATASOURCE_PLUGIN(csv_datasource)
@ -685,10 +682,7 @@ void csv_datasource::parse_csv(T & stream,
if (has_dot || has_e)
{
double float_val = 0.0;
std::string::const_iterator str_beg = value.begin();
std::string::const_iterator str_end = value.end();
if (qi::phrase_parse(str_beg,str_end,qi::double_,ascii::space,float_val)
&& (str_beg == str_end))
if (mapnik::util::string2double(value,float_val))
{
matched = true;
feature->put(fld_name,float_val);
@ -703,10 +697,7 @@ void csv_datasource::parse_csv(T & stream,
else
{
mapnik::value_integer int_val = 0;
std::string::const_iterator str_beg = value.begin();
std::string::const_iterator str_end = value.end();
if (qi::phrase_parse(str_beg,str_end,qi::long_long,ascii::space,int_val)
&& (str_beg == str_end))
if (mapnik::util::string2longlong(value,int_val))
{
matched = true;
feature->put(fld_name,int_val);
@ -926,7 +917,6 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
break;
}
}
if (! found_name)
{
std::ostringstream s;
@ -936,7 +926,6 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
}
++pos;
}
return boost::make_shared<mapnik::memory_featureset>(q.get_bbox(),features_);
}