34#include <OgreConfigFile.h>
35#include <OgreString.h>
36#include <OgreStringConverter.h>
42 return Ogre::StringConverter::parseReal(Ogre::ConfigFile::getSetting(key, section), defaultValue);
47 Ogre::ColourValue result;
48 Ogre::String value = Ogre::ConfigFile::getSetting(key, section);
49 if (Ogre::StringConverter::parse(value, result))
56 fmt::format(
"Could not parse '{}/{}' ({}) as color, format must be 'R G B A' or 'R G B', falling back to '{}'",
57 section, key, value, Ogre::StringConverter::toString(defaultValue)));
62Ogre::Vector3
ConfigFile::getVector3(Ogre::String
const& key, Ogre::String
const& section, Ogre::Vector3
const& defaultValue)
65 Ogre::String value = Ogre::ConfigFile::getSetting(key, section);
66 if (Ogre::StringConverter::parse(value, result))
73 fmt::format(
"Could not parse '{}/{}' ({}) as vector3, format must be 'X Y Z', falling back to '{}'",
74 section, key, value, Ogre::StringConverter::toString(defaultValue)));
81 return Ogre::StringConverter::parseInt(Ogre::ConfigFile::getSetting(key, section), defaultValue);
86 return Ogre::StringConverter::parseBool(Ogre::ConfigFile::getSetting(key, section), defaultValue);
89Ogre::String
ConfigFile::getString(Ogre::String
const& key, Ogre::String
const& section, Ogre::String
const& defaultValue)
91 auto setting = Ogre::ConfigFile::getSetting(key, section);
101 SettingsMultiMap* set = mSettingsPtr[section];
105 set =
new SettingsMultiMap();
106 mSettingsPtr[section] = set;
114 set->insert(std::multimap<Ogre::String, Ogre::String>::value_type(key, value));
121 return this->getSettingsBySection().find(name) != this->getSettingsBySection().end();
126 auto section = this->getSettingsBySection().find(name);
127 if (section == this->getSettingsBySection().end())
131 return section->second.find(key) != section->second.end();
Central state/object manager and communications hub.
void LOG(const char *msg)
Legacy alias - formerly a macro.
bool getBool(Ogre::String const &key, bool defaultValue=false)
float getFloat(Ogre::String const &key, float defaultValue=0.f)
void logMessage(std::string const &msg)
bool HasSection(std::string const &name)
std::string m_log_filename
void SetString(Ogre::String key, Ogre::String value, Ogre::String section=Ogre::BLANKSTRING)
Ogre::String getString(Ogre::String const &key, Ogre::String const §ion, Ogre::String const &defaultValue="")
Ogre::Vector3 getVector3(Ogre::String const &key, Ogre::String const §ion, Ogre::Vector3 const &defaultValue=Ogre::Vector3::ZERO)
int getInt(Ogre::String const &key, int defaultValue=0)
Ogre::ColourValue getColourValue(Ogre::String const &key, Ogre::ColourValue const &defaultValue=Ogre::ColourValue())
bool HasSetting(std::string const §ion, std::string const &key)
std::string SanitizeUtf8String(std::string const &str_in)