support case insensitive booleans - closes #1141
This commit is contained in:
parent
d6c2071ec3
commit
18774354a6
1 changed files with 9 additions and 0 deletions
|
@ -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" ||
|
||||
|
|
Loading…
Add table
Reference in a new issue