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

View file

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

View file

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

View file

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

View file

@ -37,7 +37,6 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
// sqlite // sqlite
@ -508,22 +507,12 @@ public:
{ {
if (! rs->column_isnull(0)) if (! rs->column_isnull(0))
{ {
try double xmin = rs->column_double(0);
{ double ymin = rs->column_double(1);
double xmin = boost::lexical_cast<double>(rs->column_double(0)); double xmax = rs->column_double(2);
double ymin = boost::lexical_cast<double>(rs->column_double(1)); double ymax = rs->column_double(3);
double xmax = boost::lexical_cast<double>(rs->column_double(2)); extent.init (xmin, ymin, xmax, ymax);
double ymax = boost::lexical_cast<double>(rs->column_double(3)); return true;
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();
}
} }
} }
} }
@ -535,10 +524,10 @@ public:
boost::shared_ptr<sqlite_resultset> rs(ds->execute_query(s.str())); boost::shared_ptr<sqlite_resultset> rs(ds->execute_query(s.str()));
if (rs->is_valid() && rs->step_next()) if (rs->is_valid() && rs->step_next())
{ {
double xmin = rs->column_double (0); double xmin = rs->column_double(0);
double ymin = rs->column_double (1); double ymin = rs->column_double(1);
double xmax = rs->column_double (2); double xmax = rs->column_double(2);
double ymax = rs->column_double (3); double ymax = rs->column_double(3);
extent.init (xmin, ymin, xmax, ymax); extent.init (xmin, ymin, xmax, ymax);
return true; return true;
} }

View file

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