support case insensitive booleans - closes #1141

This commit is contained in:
Dane Springmeyer 2012-03-23 20:08:47 -07:00
parent d6c2071ec3
commit 18774354a6

View file

@ -21,8 +21,13 @@
*****************************************************************************/
#ifndef MAPNIK_BOOLEAN_HPP
#define MAPNIK_BOOLEAN_HPP
// std
#include <istream>
// boost
#include <boost/algorithm/string.hpp>
namespace mapnik
{
/** Helper for class bool */
@ -36,16 +41,19 @@ public:
{
return b_;
}
boolean & operator = (boolean const& other)
{
b_ = other.b_;
return * this;
}
boolean & operator = (bool other)
{
b_ = other;
return * this;
}
private:
bool b_;
};
@ -57,6 +65,7 @@ operator >> ( std::basic_istream<charT, traits> & s, boolean & b )
{
std::string word;
s >> word;
boost::algorithm::to_lower(word);
if ( s )
{
if ( word == "true" || word == "yes" || word == "on" ||