load_map_string: do not pass optional arg by const& and better error if string is empty

This commit is contained in:
Dane Springmeyer 2012-03-05 10:44:20 -08:00
parent ab4c9da7ad
commit 232256e136
2 changed files with 7 additions and 2 deletions

View file

@ -32,7 +32,7 @@
namespace mapnik
{
MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false);
MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string const& base_path="");
MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string base_path="");
}
#endif // MAPNIK_LOAD_MAP_HPP

View file

@ -184,8 +184,13 @@ void load_map(Map & map, std::string const& filename, bool strict)
parser.parse_map(map, pt);
}
void load_map_string(Map & map, std::string const& str, bool strict, std::string const& base_path)
void load_map_string(Map & map, std::string const& str, bool strict, std::string base_path)
{
if (str.empty())
{
throw config_error( "Cannot load map, XML string is empty" ) ;
}
ptree pt;
#ifdef HAVE_LIBXML2
if (!base_path.empty())