Add deprecation warning for enum's using _

This commit is contained in:
Dane Springmeyer 2015-05-06 06:35:17 -07:00
parent b10a6f7a92
commit 0bfb7bae7a

View file

@ -25,6 +25,7 @@
// mapnik // mapnik
#include <mapnik/config.hpp> #include <mapnik/config.hpp>
#include <mapnik/debug.hpp>
// stl // stl
#include <bitset> #include <bitset>
@ -180,7 +181,11 @@ public:
// TODO: Enum value strings with underscore are deprecated in Mapnik 3.x // TODO: Enum value strings with underscore are deprecated in Mapnik 3.x
// and support will be removed in Mapnik 4.x. // and support will be removed in Mapnik 4.x.
std::string str_copy(str); std::string str_copy(str);
std::replace(str_copy.begin(), str_copy.end(), '_', '-'); if (str_copy.find('_') != std::string::npos)
{
MAPNIK_LOG_ERROR(enumerations) << "enumeration values using \"_\" are deprecated and will be removed in Mapnik 4.x, use \"-\"instead";
std::replace(str_copy.begin(), str_copy.end(), '_', '-');
}
for (unsigned i = 0; i < THE_MAX; ++i) for (unsigned i = 0; i < THE_MAX; ++i)
{ {
if (str_copy == our_strings_[i]) if (str_copy == our_strings_[i])