remove plugin usage of lexical cast - refs #1055

This commit is contained in:
Dane Springmeyer 2012-06-22 16:49:53 -04:00
parent 63bd634536
commit 39bae3825e
6 changed files with 15 additions and 41 deletions

View file

@ -25,7 +25,6 @@
// boost
#include <boost/make_shared.hpp>
#include <boost/tokenizer.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
@ -38,6 +37,7 @@
#include <mapnik/memory_featureset.hpp>
#include <mapnik/wkt/wkt_factory.hpp>
#include <mapnik/util/geometry_to_ds_type.hpp>
#include <mapnik/util/conversions.hpp>
#include <mapnik/boolean.hpp>
// stl
@ -83,7 +83,6 @@ csv_datasource::csv_datasource(parameters const& params, bool bind)
- creates opportunity to filter attributes by map query
speed:
- add properties for wkt/lon/lat at parse time
- remove boost::lexical_cast
- add ability to pass 'filter' keyword to drop attributes at layer init
- create quad tree on the fly for small/med size files
- memory map large files for reading
@ -584,12 +583,11 @@ void csv_datasource::parse_csv(T& stream,
break;
}
try
if (mapnik::util::string2double(value,x))
{
x = boost::lexical_cast<double>(value);
parsed_x = true;
}
catch(boost::bad_lexical_cast & ex)
else
{
std::ostringstream s;
s << "CSV Plugin: expected a float value for longitude: could not parse row "
@ -617,12 +615,11 @@ void csv_datasource::parse_csv(T& stream,
break;
}
try
if (mapnik::util::string2double(value,y))
{
y = boost::lexical_cast<double>(value);
parsed_y = true;
}
catch(boost::bad_lexical_cast & ex)
else
{
std::ostringstream s;
s << "CSV Plugin: expected a float value for latitude: could not parse row "

View file

@ -38,7 +38,6 @@
// boost
#include <boost/algorithm/string.hpp>
#include <boost/limits.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/make_shared.hpp>
@ -46,9 +45,6 @@
// geos
#include <geos_c.h>
using boost::lexical_cast;
using boost::bad_lexical_cast;
using mapnik::box2d;
using mapnik::coord2d;
using mapnik::query;

View file

@ -37,7 +37,6 @@
// boost
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
@ -51,9 +50,6 @@
#define MAX_KISMET_LINE 1024 // maximum length of a kismet command (assumed)
#define KISMET_COMMAND "*NETWORK: \001%1024[^\001]\001 %1024s %d %lf %lf"
using boost::lexical_cast;
using boost::bad_lexical_cast;
using mapnik::datasource;
using mapnik::parameters;

View file

@ -21,7 +21,6 @@
*****************************************************************************/
// boost
#include <boost/lexical_cast.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/make_shared.hpp>
@ -34,8 +33,6 @@
#include "raster_info.hpp"
#include "raster_datasource.hpp"
using boost::lexical_cast;
using boost::bad_lexical_cast;
using mapnik::layer_descriptor;
using mapnik::featureset_ptr;
using mapnik::query;

View file

@ -37,7 +37,6 @@
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem/operations.hpp>
// sqlite
@ -508,22 +507,12 @@ public:
{
if (! rs->column_isnull(0))
{
try
{
double xmin = boost::lexical_cast<double>(rs->column_double(0));
double ymin = boost::lexical_cast<double>(rs->column_double(1));
double xmax = boost::lexical_cast<double>(rs->column_double(2));
double ymax = boost::lexical_cast<double>(rs->column_double(3));
extent.init(xmin, ymin, xmax, ymax);
return true;
}
catch (boost::bad_lexical_cast& ex)
{
std::ostringstream ss;
ss << "SQLite Plugin: warning: could not determine extent from query: "
<< "'" << s.str() << "' \n problem was: " << ex.what() << std::endl;
std::clog << ss.str();
}
double xmin = rs->column_double(0);
double ymin = rs->column_double(1);
double xmax = rs->column_double(2);
double ymax = rs->column_double(3);
extent.init (xmin, ymin, xmax, ymax);
return true;
}
}
}
@ -535,10 +524,10 @@ public:
boost::shared_ptr<sqlite_resultset> rs(ds->execute_query(s.str()));
if (rs->is_valid() && rs->step_next())
{
double xmin = rs->column_double (0);
double ymin = rs->column_double (1);
double xmax = rs->column_double (2);
double ymax = rs->column_double (3);
double xmin = rs->column_double(0);
double ymin = rs->column_double(1);
double xmax = rs->column_double(2);
double ymax = rs->column_double(3);
extent.init (xmin, ymin, xmax, ymax);
return true;
}

View file

@ -36,7 +36,6 @@
#include <boost/fusion/include/std_pair.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <string>