diff options
| author | Stijn Buys <ingar@osirion.org> | 2008-07-28 19:37:31 +0000 | 
|---|---|---|
| committer | Stijn Buys <ingar@osirion.org> | 2008-07-28 19:37:31 +0000 | 
| commit | d389a31f9816b55d8c7685ec24b9ab814252d693 (patch) | |
| tree | 9b2577692e543fa6c59fcda508f92c3eb839ac7a /src/filesystem/inifile.cc | |
| parent | 17408276791033e8122819185abf3bcb01740105 (diff) | |
zone support
Diffstat (limited to 'src/filesystem/inifile.cc')
| -rw-r--r-- | src/filesystem/inifile.cc | 33 | 
1 files changed, 33 insertions, 0 deletions
diff --git a/src/filesystem/inifile.cc b/src/filesystem/inifile.cc index 0cc690f..47baebf 100644 --- a/src/filesystem/inifile.cc +++ b/src/filesystem/inifile.cc @@ -187,6 +187,39 @@ bool IniFile::got_key_color(const char * keylabel, math::Color & color) {  	}  } +bool IniFile::got_key_bool(const char * keylabel, bool & b) +{ +	if (last_read_was_key && (key_current.compare(keylabel) == 0 )) { +		std::istringstream is(value_current); + +		unsigned int i; +		if (is >> i) { +			if (i) b = true; else b = false; +			return true; +		} + +		std::string val(value_current); +		aux::trim(val); +		aux::lowercase(val); + +		if (val.compare("yes") == 0) { +			b = true; +			return true; +		} else if (val.compare("true") == 0) { +			b = true; +			return true; +		} else if (val.compare("no") == 0) { +			b = false; +			return true; +		} else if (val.compare("false") == 0) { +			b = false; +			return true; +		} +	} + +	return false; +} +  void IniFile::close()  {  	inifile_ifs.close();  | 
