Merge commit '054cb132314accb7d3e81d0ccc22fd1cd5900687' into harfbuzz

This commit is contained in:
Hermann Kraus 2013-03-16 18:18:42 +01:00
commit 3f989cffb0
5 changed files with 23 additions and 25 deletions

View file

@ -32,22 +32,28 @@
namespace mapnik { namespace util {
MAPNIK_DECL bool string2bool(const char * value, bool & result);
MAPNIK_DECL bool string2bool(std::string const& value, bool & result);
/*
Note: this file intentionally provides non-templated methods
to avoid the compile time overhead given it is included
by many other headers inside mapnik.
*/
MAPNIK_DECL bool string2bool(std::string const& value, bool & result);
MAPNIK_DECL bool string2bool(const char * iter, const char * end, bool & result);
MAPNIK_DECL bool string2int(const char * value, int & result);
MAPNIK_DECL bool string2int(std::string const& value, int & result);
MAPNIK_DECL bool string2int(const char * iter, const char * end, int & result);
#ifdef BIGINT
MAPNIK_DECL bool string2int(const char * value, mapnik::value_integer & result);
MAPNIK_DECL bool string2int(std::string const& value, mapnik::value_integer & result);
MAPNIK_DECL bool string2int(const char * iter, const char * end, mapnik::value_integer & result);
#endif
MAPNIK_DECL bool string2double(std::string const& value, double & result);
MAPNIK_DECL bool string2double(const char * value, double & result);
MAPNIK_DECL bool string2double(const char * iter, const char * end, double & result);
MAPNIK_DECL bool string2float(std::string const& value, float & result);
MAPNIK_DECL bool string2float(const char * value, float & result);
MAPNIK_DECL bool string2float(const char * iter, const char * end, float & result);
MAPNIK_DECL bool to_string(std::string & str, int value);
#ifdef BIGINT

View file

@ -33,7 +33,7 @@
namespace mapnik { namespace util {
void to_ds_type(mapnik::geometry_container const& paths,
static inline void to_ds_type(mapnik::geometry_container const& paths,
boost::optional<mapnik::datasource::geometry_t> & result)
{
if (paths.size() == 1)

View file

@ -29,7 +29,7 @@
namespace csv_utils
{
static void fix_json_quoting(std::string & csv_line)
static inline void fix_json_quoting(std::string & csv_line)
{
std::string wrapping_char;
std::string::size_type j_idx = std::string::npos;

View file

@ -178,7 +178,8 @@ postgis_datasource::postgis_datasource(parameters const& params)
if (srid_c != NULL)
{
int result = 0;
if (mapnik::util::string2int(srid_c, result))
const char * end = srid_c + std::strlen(srid_c);
if (mapnik::util::string2int(srid_c, end, result))
{
srid_ = result;
}
@ -209,7 +210,8 @@ postgis_datasource::postgis_datasource(parameters const& params)
if (srid_c != NULL)
{
int result = 0;
if (mapnik::util::string2int(srid_c, result))
const char * end = srid_c + std::strlen(srid_c);
if (mapnik::util::string2int(srid_c, end, result))
{
srid_ = result;
}

View file

@ -78,11 +78,9 @@ struct bool_symbols : qi::symbols<char,bool>
}
};
bool string2bool(const char * value, bool & result)
bool string2bool(const char * iter, const char * end, bool & result)
{
using boost::spirit::qi::no_case;
const char *iter = value;
const char *end = value + std::strlen(value);
bool r = qi::phrase_parse(iter,end, no_case[bool_symbols()] ,ascii::space,result);
return r && (iter == end);
}
@ -96,10 +94,8 @@ bool string2bool(std::string const& value, bool & result)
return r && (str_beg == str_end);
}
bool string2int(const char * value, int & result)
bool string2int(const char * iter, const char * end, int & result)
{
const char *iter = value;
const char *end = value + std::strlen(value);
bool r = qi::phrase_parse(iter,end,INTEGER,ascii::space,result);
return r && (iter == end);
}
@ -113,10 +109,8 @@ bool string2int(std::string const& value, int & result)
}
#ifdef BIGINT
bool string2int(const char * value, mapnik::value_integer & result)
bool string2int(const char * iter, const char * end, mapnik::value_integer & result)
{
const char *iter = value;
const char *end = value + std::strlen(value);
bool r = qi::phrase_parse(iter,end,LONGLONG,ascii::space,result);
return r && (iter == end);
}
@ -138,10 +132,8 @@ bool string2double(std::string const& value, double & result)
return r && (str_beg == str_end);
}
bool string2double(const char * value, double & result)
bool string2double(const char * iter, const char * end, double & result)
{
const char *iter = value;
const char *end = value + std::strlen(value);
bool r = qi::phrase_parse(iter,end,DOUBLE,ascii::space,result);
return r && (iter == end);
}
@ -154,10 +146,8 @@ bool string2float(std::string const& value, float & result)
return r && (str_beg == str_end);
}
bool string2float(const char * value, float & result)
bool string2float(const char * iter, const char * end, float & result)
{
const char *iter = value;
const char *end = value + std::strlen(value);
bool r = qi::phrase_parse(iter,end,FLOAT,ascii::space,result);
return r && (iter == end);
}