remove uneeded usage of boost::lexical_cast - refs #1687

This commit is contained in:
Dane Springmeyer 2013-01-11 11:11:20 -08:00
parent ce4d0fcd9e
commit 0e8d224ecb
2 changed files with 17 additions and 55 deletions

View File

@ -32,7 +32,6 @@
// boost
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/make_shared.hpp>
@ -43,9 +42,6 @@
#include <sstream>
#include <iomanip>
using boost::lexical_cast;
using boost::bad_lexical_cast;
using mapnik::datasource;
using mapnik::parameters;
using mapnik::query;
@ -379,19 +375,12 @@ box2d<double> occi_datasource::envelope() const
ResultSet* rs = conn.execute_query(s.str());
if (rs && rs->next())
{
try
{
lox = lexical_cast<double>(rs->getDouble(1));
loy = lexical_cast<double>(rs->getDouble(2));
hix = lexical_cast<double>(rs->getDouble(3));
hiy = lexical_cast<double>(rs->getDouble(4));
extent_.init(lox, loy, hix, hiy);
extent_initialized_ = true;
}
catch (bad_lexical_cast& ex)
{
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
}
lox = rs->getDouble(1);
loy = rs->getDouble(2);
hix = rs->getDouble(3);
hiy = rs->getDouble(4);
extent_.init(lox, loy, hix, hiy);
extent_initialized_ = true;
}
}
catch (SQLException& ex)
@ -427,30 +416,15 @@ box2d<double> occi_datasource::envelope() const
{
if (rs->next())
{
try
{
lox = lexical_cast<double>(rs->getDouble(1));
hix = lexical_cast<double>(rs->getDouble(2));
}
catch (bad_lexical_cast& ex)
{
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
}
lox = rs->getDouble(1);
hix = rs->getDouble(2);
}
if (rs->next())
{
try
{
loy = lexical_cast<double>(rs->getDouble(1));
hiy = lexical_cast<double>(rs->getDouble(2));
}
catch (bad_lexical_cast& ex)
{
MAPNIK_LOG_WARN(occi) << "OCCI Plugin: " << ex.what();
}
loy = rs->getDouble(1);
hiy = rs->getDouble(2);
}
extent_.init(lox, loy, hix, hiy);
extent_initialized_ = true;
}

View File

@ -25,20 +25,19 @@
// mapnik
#include <mapnik/datasource.hpp>
#include <mapnik/wkb.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/global.hpp>
#include <mapnik/sql_utils.hpp>
#include <mapnik/util/conversions.hpp>
#include "connection_manager.hpp"
#include "cursorresultset.hpp"
// boost
#include <boost/cstdint.hpp>
#include <boost/optional.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
//stl
#include <iostream>
@ -213,14 +212,7 @@ void pgsql2sqlite(Connection conn,
if ( rs->next())
{
try
{
srid = boost::lexical_cast<int>(rs->getValue("srid"));
}
catch (boost::bad_lexical_cast &ex)
{
std::clog << ex.what() << std::endl;
}
mapnik::util::string2int(rs->getValue("srid"),srid);
geom_col = rs->getValue("f_geometry_column");
geom_type = rs->getValue("type");
}
@ -376,15 +368,11 @@ void pgsql2sqlite(Connection conn,
case 1700:
{
std::string str = numeric2string(buf);
try
double val;
if (mapnik::util::string2double(str,val))
{
double val = boost::lexical_cast<double>(str);
output_rec.push_back(sqlite::value_type(val));
}
catch (boost::bad_lexical_cast & ex)
{
std::clog << ex.what() << "\n";
}
break;
}