FACT++  1.0
bool Converter::GetBool ( std::stringstream &  line) const
private

Converts from the stringstream into bool. It allows to use lexical boolean representations like yes/no, on/off, true/false and of course 0/1. If the conversion fails the failbit is set.

Parameters
linereference to the stringstream from which the data should be interpreted
Returns
The boolean. 0 in case of failure

Definition at line 263 of file Converter.cc.

Referenced by Get().

264 {
265  string buf;
266  line >> buf;
267  transform(buf.begin(), buf.end(), buf.begin(), ::tolower);
268 
269  if (buf=="yes" || buf=="true" || buf=="on" || buf=="1")
270  return true;
271 
272  if (buf=="no" || buf=="false" || buf=="off" || buf=="0")
273  return false;
274 
275  line.clear(ios::failbit);
276 
277  return false;
278 }

+ Here is the caller graph for this function: