use the std library tolower over boost::algorithm::to_lower for both better runtime and compile speed - closes #1677
This commit is contained in:
parent
c61335c277
commit
e682705a86
5 changed files with 21 additions and 12 deletions
|
@ -24,9 +24,8 @@
|
|||
|
||||
// std
|
||||
#include <istream>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -65,7 +64,7 @@ operator >> ( std::basic_istream<charT, traits> & s, boolean & b )
|
|||
{
|
||||
std::string word;
|
||||
s >> word;
|
||||
boost::algorithm::to_lower(word);
|
||||
std::transform(word.begin(), word.end(), word.begin(), ::tolower);
|
||||
if ( s )
|
||||
{
|
||||
if ( word == "true" || word == "yes" || word == "on" ||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/unicode.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
#include <mapnik/feature_factory.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
|
@ -47,6 +48,7 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
using mapnik::datasource;
|
||||
using mapnik::parameters;
|
||||
|
@ -267,7 +269,8 @@ void csv_datasource::parse_csv(T & stream,
|
|||
for (; beg != tok.end(); ++beg)
|
||||
{
|
||||
std::string val = mapnik::util::trim_copy(*beg);
|
||||
std::string lower_val = boost::algorithm::to_lower_copy(val);
|
||||
std::string lower_val = val;
|
||||
std::transform(lower_val.begin(), lower_val.end(), lower_val.begin(), ::tolower);
|
||||
if (lower_val == "wkt"
|
||||
|| (lower_val.find("geom") != std::string::npos))
|
||||
{
|
||||
|
@ -345,7 +348,8 @@ void csv_datasource::parse_csv(T & stream,
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string lower_val = boost::algorithm::to_lower_copy(val);
|
||||
std::string lower_val = val;
|
||||
std::transform(lower_val.begin(), lower_val.end(), lower_val.begin(), ::tolower);
|
||||
if (lower_val == "wkt"
|
||||
|| (lower_val.find("geom") != std::string::npos))
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
// stl
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
@ -642,7 +643,7 @@ public:
|
|||
const char* fld_name = rs->column_text(1);
|
||||
std::string fld_type(rs->column_text(2));
|
||||
sqlite_int64 fld_pk = rs->column_integer64(5);
|
||||
boost::algorithm::to_lower(fld_type);
|
||||
std::transform(fld_type.begin(), fld_type.end(), fld_type.begin(), ::tolower);
|
||||
|
||||
// TODO - how to handle primary keys on multiple columns ?
|
||||
if (key_field.empty() && ! found_pk && fld_pk != 0)
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// stl
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
// icu
|
||||
#include <unicode/ubidi.h>
|
||||
|
@ -59,7 +62,8 @@ freetype_engine::~freetype_engine()
|
|||
bool freetype_engine::is_font_file(std::string const& file_name)
|
||||
{
|
||||
/** only accept files that will be matched by freetype2's `figurefiletype()` */
|
||||
std::string const& fn = boost::algorithm::to_lower_copy(file_name);
|
||||
std::string fn = file_name;
|
||||
std::transform(fn.begin(), fn.end(), fn.begin(), ::tolower);
|
||||
return boost::algorithm::ends_with(fn,std::string(".ttf")) ||
|
||||
boost::algorithm::ends_with(fn,std::string(".otf")) ||
|
||||
boost::algorithm::ends_with(fn,std::string(".ttc")) ||
|
||||
|
|
|
@ -55,6 +55,7 @@ extern "C"
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -225,8 +226,8 @@ void save_to_stream(T const& image,
|
|||
{
|
||||
if (stream && image.width() > 0 && image.height() > 0)
|
||||
{
|
||||
//all this should go into image_writer factory
|
||||
std::string t = boost::algorithm::to_lower_copy(type);
|
||||
std::string t = type;
|
||||
std::transform(t.begin(), t.end(), t.begin(), ::tolower);
|
||||
if (t == "png" || boost::algorithm::starts_with(t, "png"))
|
||||
{
|
||||
int colors = 256;
|
||||
|
@ -286,8 +287,8 @@ void save_to_stream(T const& image,
|
|||
{
|
||||
if (stream && image.width() > 0 && image.height() > 0)
|
||||
{
|
||||
//all this should go into image_writer factory
|
||||
std::string t = boost::algorithm::to_lower_copy(type);
|
||||
std::string t = type;
|
||||
std::transform(t.begin(), t.end(), t.begin(), ::tolower);
|
||||
if (t == "png" || boost::algorithm::starts_with(t, "png"))
|
||||
{
|
||||
int colors = 256;
|
||||
|
|
Loading…
Reference in a new issue