mirror of
https://github.com/mapnik/mapnik.git
synced 2026-02-01 17:36:36 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
97f5d7c437
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user