Minetest  5.4.0
Settings Class Reference

#include <settings.h>

+ Collaboration diagram for Settings:

Public Member Functions

SettingsLayer getLayerType () const
 
 Settings (const std::string &end_tag="")
 
 ~Settings ()
 
Settingsoperator+= (const Settings &other)
 
Settingsoperator= (const Settings &other)
 
bool readConfigFile (const char *filename)
 
bool updateConfigFile (const char *filename)
 
bool parseCommandLine (int argc, char *argv[], std::map< std::string, ValueSpec > &allowed_options)
 
bool parseConfigLines (std::istream &is)
 
void writeLines (std::ostream &os, u32 tab_depth=0) const
 
SettingsgetGroup (const std::string &name) const
 
const std::string & get (const std::string &name) const
 
bool getBool (const std::string &name) const
 
u16 getU16 (const std::string &name) const
 
s16 getS16 (const std::string &name) const
 
u32 getU32 (const std::string &name) const
 
s32 getS32 (const std::string &name) const
 
u64 getU64 (const std::string &name) const
 
float getFloat (const std::string &name) const
 
v2f getV2F (const std::string &name) const
 
v3f getV3F (const std::string &name) const
 
u32 getFlagStr (const std::string &name, const FlagDesc *flagdesc, u32 *flagmask) const
 
bool getNoiseParams (const std::string &name, NoiseParams &np) const
 
bool getNoiseParamsFromValue (const std::string &name, NoiseParams &np) const
 
bool getNoiseParamsFromGroup (const std::string &name, NoiseParams &np) const
 
std::vector< std::string > getNames () const
 
bool exists (const std::string &name) const
 
bool getGroupNoEx (const std::string &name, Settings *&val) const
 
bool getNoEx (const std::string &name, std::string &val) const
 
bool getFlag (const std::string &name) const
 
bool getU16NoEx (const std::string &name, u16 &val) const
 
bool getS16NoEx (const std::string &name, s16 &val) const
 
bool getS32NoEx (const std::string &name, s32 &val) const
 
bool getU64NoEx (const std::string &name, u64 &val) const
 
bool getFloatNoEx (const std::string &name, float &val) const
 
bool getV2FNoEx (const std::string &name, v2f &val) const
 
bool getV3FNoEx (const std::string &name, v3f &val) const
 
bool getFlagStrNoEx (const std::string &name, u32 &val, const FlagDesc *flagdesc) const
 
bool setEntry (const std::string &name, const void *entry, bool set_group)
 
bool set (const std::string &name, const std::string &value)
 
bool setDefault (const std::string &name, const std::string &value)
 
bool setGroup (const std::string &name, const Settings &group)
 
bool setBool (const std::string &name, bool value)
 
bool setS16 (const std::string &name, s16 value)
 
bool setU16 (const std::string &name, u16 value)
 
bool setS32 (const std::string &name, s32 value)
 
bool setU64 (const std::string &name, u64 value)
 
bool setFloat (const std::string &name, float value)
 
bool setV2F (const std::string &name, v2f value)
 
bool setV3F (const std::string &name, v3f value)
 
bool setFlagStr (const std::string &name, u32 flags, const FlagDesc *flagdesc=nullptr, u32 flagmask=U32_MAX)
 
bool setNoiseParams (const std::string &name, const NoiseParams &np)
 
bool remove (const std::string &name)
 
void setDefault (const std::string &name, const FlagDesc *flagdesc, u32 flags)
 
const FlagDescgetFlagDescFallback (const std::string &name) const
 
void registerChangedCallback (const std::string &name, SettingsChangedCallback cbf, void *userdata=NULL)
 
void deregisterChangedCallback (const std::string &name, SettingsChangedCallback cbf, void *userdata=NULL)
 
void removeSecureSettings ()
 

Static Public Member Functions

static SettingscreateLayer (SettingsLayer sl, const std::string &end_tag="")
 
static SettingsgetLayer (SettingsLayer sl)
 

Private Member Functions

SettingsParseEvent parseConfigObject (const std::string &line, std::string &name, std::string &value)
 
bool updateConfigObject (std::istream &is, std::ostream &os, u32 tab_depth=0)
 
SettingsgetParent () const
 
const SettingsEntrygetEntry (const std::string &name) const
 
void updateNoLock (const Settings &other)
 
void clearNoLock ()
 
void clearDefaultsNoLock ()
 
void doCallbacks (const std::string &name) const
 

Static Private Member Functions

static bool checkNameValid (const std::string &name)
 
static bool checkValueValid (const std::string &value)
 
static std::string getMultiline (std::istream &is, size_t *num_lines=NULL)
 
static void printEntry (std::ostream &os, const std::string &name, const SettingsEntry &entry, u32 tab_depth=0)
 

Private Attributes

SettingEntries m_settings
 
SettingsCallbackMap m_callbacks
 
std::string m_end_tag
 
std::mutex m_callback_mutex
 
std::mutex m_mutex
 
SettingsLayer m_settingslayer = SL_TOTAL_COUNT
 

Static Private Attributes

static Settingss_layers [SL_TOTAL_COUNT] = {0}
 
static std::unordered_map< std::string, const FlagDesc * > s_flags
 

Friends

class TestSettings
 

Constructor & Destructor Documentation

◆ Settings()

Settings::Settings ( const std::string &  end_tag = "")
inline

Referenced by createLayer(), parseConfigLines(), setGroup(), and setNoiseParams().

+ Here is the caller graph for this function:

◆ ~Settings()

Settings::~Settings ( )

References clearNoLock(), g_settings, m_mutex, m_settingslayer, s_layers, SL_GLOBAL, and SL_TOTAL_COUNT.

+ Here is the call graph for this function:

Member Function Documentation

◆ checkNameValid()

bool Settings::checkNameValid ( const std::string &  name)
staticprivate

References errorstream.

Referenced by setEntry().

+ Here is the caller graph for this function:

◆ checkValueValid()

bool Settings::checkValueValid ( const std::string &  value)
staticprivate

References errorstream.

Referenced by setEntry().

+ Here is the caller graph for this function:

◆ clearDefaultsNoLock()

void Settings::clearDefaultsNoLock ( )
private

◆ clearNoLock()

void Settings::clearNoLock ( )
private

References m_settings.

Referenced by ~Settings(), and operator=().

+ Here is the caller graph for this function:

◆ createLayer()

Settings * Settings::createLayer ( SettingsLayer  sl,
const std::string &  end_tag = "" 
)
static

References Settings(), g_settings, m_settingslayer, s_layers, SL_GLOBAL, and SL_TOTAL_COUNT.

Referenced by MapSettingsManager::MapSettingsManager(), Server::init(), init_common(), loadGameConfAndInitWorld(), TestMapSettingsManager::makeUserConfig(), set_default_settings(), TestSettings::testDefaults(), and TestSettings::testFlagDesc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deregisterChangedCallback()

void Settings::deregisterChangedCallback ( const std::string &  name,
SettingsChangedCallback  cbf,
void *  userdata = NULL 
)

References m_callback_mutex, and m_callbacks.

Referenced by Clouds::~Clouds(), Game::~Game(), GameGlobalShaderConstantSetter::~GameGlobalShaderConstantSetter(), and Player::~Player().

+ Here is the caller graph for this function:

◆ doCallbacks()

void Settings::doCallbacks ( const std::string &  name) const
private

References m_callback_mutex, and m_callbacks.

Referenced by remove(), and set().

+ Here is the caller graph for this function:

◆ exists()

◆ get()

const std::string & Settings::get ( const std::string &  name) const

References getEntry(), SettingsEntry::is_group, and SettingsEntry::value.

Referenced by Database_Redis::Database_Redis(), Hud::Hud(), RenderingEngine::RenderingEngine(), ServerMap::ServerMap(), Server::~Server(), RenderingEngine::_initialize(), ModConfiguration::addModsFromConfig(), compare_settings(), Game::createSingleplayerServer(), PlayerDatabaseFiles::deSerialize(), determine_subgame(), findSubgame(), findWorldSubgame(), get_deprecated_handling_mode(), get_game_from_cmdline(), get_world_from_cmdline(), get_world_from_config(), getBool(), getFlagStr(), getFloat(), getKeySetting(), getNoEx(), getS16(), getS32(), getShaderPath(), Server::getStatusString(), getTextureDirs(), getU16(), getU32(), getU64(), getV2F(), getV3F(), getWorldGameId(), getWorldName(), Server::handleCommand_Init(), id2keycode(), Server::init(), ClientLauncher::init_args(), init_common(), init_log_streams(), FontEngine::initFont(), FontEngine::initSimpleFont(), LuaSettings::l_get(), ModApiHttp::l_request_http_api(), ModApiUtil::l_request_insecure_environment(), LuaSettings::l_to_table(), ClientLauncher::launch_game(), GUIEngine::loadMainMenuScript(), ServerEnvironment::loadMeta(), main(), Client::makeScreenshot(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), ServerEnvironment::migratePlayersDatabase(), JoystickController::onJoystickConnect(), parseContentInfo(), parseModContents(), read_config_file(), TextureSettings::readSettings(), run_dedicated_server(), ServerList::sendAnnounce(), Server::sendMediaAnnouncement(), setup_log_params(), Game::showPauseMenu(), Game::shutdown(), Server::step(), TestSettings::testAllSettings(), TestConnection::testConnectSendReceive(), TestSettings::testDefaults(), TestSocket::testIPv4Socket(), LogOutputBuffer::updateLogLevel(), and FontEngine::updateSkin().

+ Here is the call graph for this function:

◆ getBool()

bool Settings::getBool ( const std::string &  name) const

References get(), and is_yes().

Referenced by Camera::Camera(), Client::Client(), ClientMap::ClientMap(), EmergeManager::EmergeManager(), Environment::Environment(), GameGlobalShaderConstantSetter::GameGlobalShaderConstantSetter(), GUIEngine::GUIEngine(), GUIFormSpecMenu::GUIFormSpecMenu(), HTTPFetchOngoing::HTTPFetchOngoing(), Hud::Hud(), MapBlockMesh::MapBlockMesh(), MapblockMeshGenerator::MapblockMeshGenerator(), MeshUpdateQueue::MeshUpdateQueue(), Minimap::Minimap(), PlayerSAO::PlayerSAO(), RenderingEngine::RenderingEngine(), ServerScripting::ServerScripting(), Sky::Sky(), TextureSource::TextureSource(), TouchScreenGUI::TouchScreenGUI(), WieldMeshSceneNode::WieldMeshSceneNode(), RenderingEngine::_draw_load_screen(), RenderingEngine::_draw_menu_scene(), ClientMediaDownloader::addRemoteServer(), Server::AsyncRunStep(), PlayerSAO::checkMovementCheat(), Game::connectToServer(), Game::createSingleplayerServer(), GUIFormSpecMenu::createTextField(), dedicated_server_loop(), PlayerDatabaseFiles::deSerialize(), drawItemStack(), TextureSource::generateImagePart(), ShaderSource::generateShader(), getFlag(), Game::getServerContent(), TextureSource::getTextureForMesh(), guiScalingCache(), guiScalingResizeCached(), Server::handleChat(), Server::handleCommand_FirstSrp(), Client::handleCommand_Hello(), Server::handleCommand_Init(), Server::handleCommand_Interact(), Server::handleCommand_ModChannelJoin(), Server::handleCommand_ModChannelLeave(), Server::handleCommand_ModChannelMsg(), Game::handleDigging(), Server::init(), ClientLauncher::init_args(), ClientLauncher::init_input(), GameUI::initFlags(), GenericCAO::initialize(), Client::initLocalMapSaving(), Game::initSound(), LuaSettings::l_get_bool(), ObjectRef::l_set_armor_groups(), LuaMinimap::l_show(), load_button_texture(), ServerMap::loadBlock(), loadGameConfAndInitWorld(), Client::loadMods(), LogOutputBuffer::logRaw(), main(), Game::nodePlacement(), GameGlobalShaderConstantSetter::onSettingsChange(), RenderingEngine::print_video_modes(), Game::processKeyInput(), Game::processPlayerInteraction(), PlayerSAO::punch(), PlayerSettings::readGlobalSettings(), Clouds::readSettings(), FontEngine::readSettings(), Game::readSettings(), TextureSettings::readSettings(), GUIKeyChangeMenu::regenerateGui(), GUIVolumeChange::regenerateGui(), ClientMap::renderPostFx(), Address::Resolve(), Game::run(), GUIEngine::run(), ClientLauncher::run(), run_dedicated_server(), TestSocket::runTests(), Server::SendActiveObjectRemoveAdd(), ServerList::sendAnnounce(), Game::showPauseMenu(), Game::startup(), ClientEnvironment::step(), Server::step(), GenericCAO::step(), Game::toggleAutoforward(), Game::toggleCinematic(), Game::toggleFast(), Game::toggleFog(), Game::toggleFreeMove(), Game::toggleMinimap(), Game::toggleNoClip(), Game::togglePitchMove(), Camera::update(), ClientMap::updateDrawList(), updateFastFaceRow(), Game::updateFrame(), Game::updatePointedThing(), Game::updateSound(), and GenericCAO::updateTextures().

+ Here is the call graph for this function:

◆ getEntry()

const SettingsEntry & Settings::getEntry ( const std::string &  name) const
private

References getParent(), m_mutex, and m_settings.

Referenced by get(), getGroup(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFlag()

bool Settings::getFlag ( const std::string &  name) const

References getBool().

Referenced by ClientLauncher::init_args(), main(), ClientLauncher::run(), and setup_log_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFlagDescFallback()

const FlagDesc * Settings::getFlagDescFallback ( const std::string &  name) const

References s_flags.

Referenced by getFlagStrNoEx(), LuaSettings::l_get_flags(), and setFlagStr().

+ Here is the caller graph for this function:

◆ getFlagStr()

u32 Settings::getFlagStr ( const std::string &  name,
const FlagDesc flagdesc,
u32 *  flagmask 
) const

References get(), getParent(), m_settings, readFlagString(), stoi, and U32_MAX.

Referenced by getFlagStrNoEx(), and TestSettings::testFlagDesc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFlagStrNoEx()

bool Settings::getFlagStrNoEx ( const std::string &  name,
u32 &  val,
const FlagDesc flagdesc 
) const

References getFlagDescFallback(), and getFlagStr().

Referenced by getNoiseParamsFromGroup(), LuaSettings::l_get_flags(), MapgenParams::readParams(), MapgenCarpathianParams::readParams(), MapgenFlatParams::readParams(), MapgenFractalParams::readParams(), MapgenV5Params::readParams(), MapgenV6Params::readParams(), MapgenV7Params::readParams(), and MapgenValleysParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFloat()

◆ getFloatNoEx()

bool Settings::getFloatNoEx ( const std::string &  name,
float &  val 
) const

References getFloat().

Referenced by getNoiseParamsFromGroup(), MapgenCarpathianParams::readParams(), MapgenFlatParams::readParams(), MapgenFractalParams::readParams(), MapgenV5Params::readParams(), MapgenV6Params::readParams(), MapgenV7Params::readParams(), and MapgenValleysParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroup()

Settings * Settings::getGroup ( const std::string &  name) const

References getEntry(), SettingsEntry::group, and SettingsEntry::is_group.

Referenced by getGroupNoEx(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupNoEx()

bool Settings::getGroupNoEx ( const std::string &  name,
Settings *&  val 
) const

References getGroup().

Referenced by compare_settings(), getNoiseParamsFromGroup(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLayer()

◆ getLayerType()

SettingsLayer Settings::getLayerType ( ) const
inline

References m_settingslayer.

◆ getMultiline()

std::string Settings::getMultiline ( std::istream &  is,
size_t *  num_lines = NULL 
)
staticprivate

Referenced by parseConfigLines(), and updateConfigObject().

+ Here is the caller graph for this function:

◆ getNames()

std::vector< std::string > Settings::getNames ( ) const

References m_mutex, and m_settings.

Referenced by ModConfiguration::addModsFromConfig(), compare_settings(), LuaSettings::l_get_names(), LuaSettings::l_to_table(), and removeSecureSettings().

+ Here is the caller graph for this function:

◆ getNoEx()

bool Settings::getNoEx ( const std::string &  name,
std::string &  val 
) const

References get().

Referenced by ServerEnvironment::ServerEnvironment(), GUIKeyChangeMenu::acceptInput(), compare_settings(), ServerMap::createDatabase(), MapSettingsManager::getMapSetting(), getNoiseParamsFromValue(), ServerEnvironment::openAuthDatabase(), ServerEnvironment::openPlayerDatabase(), and MapgenParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoiseParams()

bool Settings::getNoiseParams ( const std::string &  name,
NoiseParams np 
) const

References getNoiseParamsFromGroup(), getNoiseParamsFromValue(), and getParent().

Referenced by MapSettingsManager::getMapSettingNoiseParams(), ModApiMapgen::l_get_noiseparams(), LuaSettings::l_get_np_group(), MapgenCarpathianParams::readParams(), MapgenFlatParams::readParams(), MapgenFractalParams::readParams(), MapgenV5Params::readParams(), MapgenV6Params::readParams(), MapgenV7Params::readParams(), MapgenValleysParams::readParams(), BiomeParamsOriginal::readParams(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoiseParamsFromGroup()

bool Settings::getNoiseParamsFromGroup ( const std::string &  name,
NoiseParams np 
) const

References flagdesc_noiseparams, NoiseParams::flags, getFlagStrNoEx(), getFloatNoEx(), getGroupNoEx(), getS32NoEx(), getU16NoEx(), getV3FNoEx(), NoiseParams::lacunarity, NOISE_FLAG_DEFAULTS, NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, NoiseParams::scale, NoiseParams::seed, and NoiseParams::spread.

Referenced by getNoiseParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoiseParamsFromValue()

bool Settings::getNoiseParamsFromValue ( const std::string &  name,
NoiseParams np 
) const

References getNoEx(), NoiseParams::lacunarity, BasicStrfnd< T >::next(), NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, NoiseParams::scale, NoiseParams::seed, NoiseParams::spread, stof, and stoi.

Referenced by getNoiseParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

Settings * Settings::getParent ( ) const
private

References m_settingslayer, s_layers, and SL_TOTAL_COUNT.

Referenced by exists(), getEntry(), getFlagStr(), and getNoiseParams().

+ Here is the caller graph for this function:

◆ getS16()

s16 Settings::getS16 ( const std::string &  name) const

References get(), and stoi.

Referenced by Hud::Hud(), ServerMap::ServerMap(), Game::decreaseViewRange(), getS16NoEx(), Game::increaseViewRange(), Server::SendActiveObjectRemoveAdd(), Server::SendAddParticleSpawner(), ServerList::sendAnnounce(), Server::SendBlockNoLock(), Client::sendChatMessage(), Server::SendSpawnParticle(), ServerEnvironment::step(), ParticleSpawner::step(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getS16NoEx()

bool Settings::getS16NoEx ( const std::string &  name,
s16 &  val 
) const

References getS16().

Referenced by EmergeManager::EmergeManager(), MapgenParams::readParams(), MapgenCarpathianParams::readParams(), MapgenFlatParams::readParams(), MapgenFractalParams::readParams(), MapgenV5Params::readParams(), MapgenV6Params::readParams(), MapgenV7Params::readParams(), and MapgenValleysParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getS32()

s32 Settings::getS32 ( const std::string &  name) const

References get(), and stoi.

Referenced by GUIChatConsole::GUIChatConsole(), GUIFormSpecMenu::GUIFormSpecMenu(), Hud::Hud(), MeshUpdateQueue::MeshUpdateQueue(), ServerEnvironment::clearObjects(), GUIEngine::downloadFile(), findSubgame(), TextureSource::generateImagePart(), getS32NoEx(), TextureSource::getTextureForMesh(), init_common(), ClientMediaDownloader::initialStep(), Client::makeScreenshot(), JoystickController::onJoystickConnect(), parseContentInfo(), parseModContents(), GUIFormSpecMenu::regenerateGui(), Client::step(), TestSettings::testAllSettings(), and Map::transformLiquids().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getS32NoEx()

bool Settings::getS32NoEx ( const std::string &  name,
s32 &  val 
) const

References getS32().

Referenced by getNoiseParamsFromGroup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getU16()

◆ getU16NoEx()

bool Settings::getU16NoEx ( const std::string &  name,
u16 &  val 
) const

References getU16().

Referenced by EmergeManager::EmergeManager(), getNoiseParamsFromGroup(), FontEngine::initFont(), MapgenCarpathianParams::readParams(), MapgenFlatParams::readParams(), MapgenFractalParams::readParams(), MapgenV5Params::readParams(), MapgenV7Params::readParams(), and MapgenValleysParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getU32()

u32 Settings::getU32 ( const std::string &  name) const

References get(), and stoi.

Referenced by Environment::Environment(), ChatBackend::applySettings(), Server::init(), and Server::SendBlocks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getU64()

u64 Settings::getU64 ( const std::string &  name) const

References get().

Referenced by getU64NoEx(), Server::init(), init_log_streams(), and ServerEnvironment::loadMeta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getU64NoEx()

bool Settings::getU64NoEx ( const std::string &  name,
u64 &  val 
) const

References getU64().

+ Here is the call graph for this function:

◆ getV2F()

v2f Settings::getV2F ( const std::string &  name) const

References get(), BasicStrfnd< T >::next(), and stof.

Referenced by getV2FNoEx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getV2FNoEx()

bool Settings::getV2FNoEx ( const std::string &  name,
v2f val 
) const

References getV2F().

+ Here is the call graph for this function:

◆ getV3F()

v3f Settings::getV3F ( const std::string &  name) const

References get(), BasicStrfnd< T >::next(), and stof.

Referenced by GUIChatConsole::GUIChatConsole(), Hud::Hud(), PlayerDatabaseFiles::deSerialize(), getV3FNoEx(), GUIFormSpecMenu::regenerateGui(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getV3FNoEx()

bool Settings::getV3FNoEx ( const std::string &  name,
v3f val 
) const

References getV3F().

Referenced by Server::findSpawnPos(), getNoiseParamsFromGroup(), and MapgenFractalParams::readParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator+=()

Settings& Settings::operator+= ( const Settings other)

◆ operator=()

Settings & Settings::operator= ( const Settings other)

References clearNoLock(), FATAL_ERROR_IF, m_callbacks, m_mutex, m_settings, m_settingslayer, and SL_TOTAL_COUNT.

+ Here is the call graph for this function:

◆ parseCommandLine()

bool Settings::parseCommandLine ( int  argc,
char *  argv[],
std::map< std::string, ValueSpec > &  allowed_options 
)

References allowed_options, errorstream, itos(), set(), and VALUETYPE_FLAG.

Referenced by get_cmdline_opts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseConfigLines()

bool Settings::parseConfigLines ( std::istream &  is)

References Settings(), getMultiline(), m_end_tag, m_mutex, m_settings, parseConfigLines(), parseConfigObject(), SPE_COMMENT, SPE_END, SPE_GROUP, SPE_INVALID, SPE_KVPAIR, SPE_MULTILINE, and SPE_NONE.

Referenced by PlayerDatabaseFiles::deSerialize(), MapSettingsManager::loadMapMeta(), ServerEnvironment::loadMeta(), parseConfigLines(), readConfigFile(), and TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseConfigObject()

SettingsParseEvent Settings::parseConfigObject ( const std::string &  line,
std::string &  name,
std::string &  value 
)
private

References m_end_tag, SPE_COMMENT, SPE_END, SPE_GROUP, SPE_INVALID, SPE_KVPAIR, SPE_MULTILINE, SPE_NONE, and trim().

Referenced by parseConfigLines(), and updateConfigObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printEntry()

void Settings::printEntry ( std::ostream &  os,
const std::string &  name,
const SettingsEntry entry,
u32  tab_depth = 0 
)
staticprivate

References SettingsEntry::group, SettingsEntry::is_group, SettingsEntry::value, and writeLines().

Referenced by updateConfigObject(), and writeLines().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readConfigFile()

bool Settings::readConfigFile ( const char *  filename)

References parseConfigLines().

Referenced by LuaSettings::LuaSettings(), ServerEnvironment::ServerEnvironment(), ServerMap::ServerMap(), ModConfiguration::addModsFromConfig(), findSubgame(), findWorldSubgame(), getAvailableGameIds(), getWorldGameId(), getWorldName(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), ServerEnvironment::migratePlayersDatabase(), parseContentInfo(), parseModContents(), and read_config_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerChangedCallback()

void Settings::registerChangedCallback ( const std::string &  name,
SettingsChangedCallback  cbf,
void *  userdata = NULL 
)

References m_callback_mutex, and m_callbacks.

Referenced by Clouds::Clouds(), FontEngine::FontEngine(), Game::Game(), GameGlobalShaderConstantSetter::GameGlobalShaderConstantSetter(), and Player::Player().

+ Here is the caller graph for this function:

◆ remove()

bool Settings::remove ( const std::string &  name)

References doCallbacks(), m_mutex, and m_settings.

Referenced by GUIKeyChangeMenu::acceptInput(), LuaSettings::l_remove(), and removeSecureSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSecureSettings()

void Settings::removeSecureSettings ( )

References errorstream, getNames(), and remove().

Referenced by loadGameConfAndInitWorld().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set()

◆ setBool()

bool Settings::setBool ( const std::string &  name,
bool  value 
)

References set().

Referenced by GUIKeyChangeMenu::acceptInput(), ModConfiguration::addModsFromConfig(), LuaSettings::l_set_bool(), loadGameConfAndInitWorld(), GUIVolumeChange::OnEvent(), Game::processKeyInput(), Minimap::setMinimapShape(), Game::toggleFog(), and Minimap::toggleMinimapShape().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefault() [1/2]

void Settings::setDefault ( const std::string &  name,
const FlagDesc flagdesc,
u32  flags 
)

References s_flags, setDefault(), U32_MAX, and writeFlagString().

+ Here is the call graph for this function:

◆ setDefault() [2/2]

bool Settings::setDefault ( const std::string &  name,
const std::string &  value 
)

References getLayer(), set(), and SL_DEFAULTS.

Referenced by set_default_settings(), setDefault(), Mapgen::setDefaultSettings(), MapgenCarpathianParams::setDefaultSettings(), MapgenFlatParams::setDefaultSettings(), MapgenFractalParams::setDefaultSettings(), MapgenV5Params::setDefaultSettings(), MapgenV6Params::setDefaultSettings(), MapgenV7Params::setDefaultSettings(), MapgenValleysParams::setDefaultSettings(), and TestSettings::testFlagDesc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEntry()

bool Settings::setEntry ( const std::string &  name,
const void *  entry,
bool  set_group 
)

References checkNameValid(), checkValueValid(), SettingsEntry::group, SettingsEntry::is_group, m_end_tag, m_mutex, m_settings, and SettingsEntry::value.

Referenced by set(), setGroup(), and setNoiseParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFlagStr()

bool Settings::setFlagStr ( const std::string &  name,
u32  flags,
const FlagDesc flagdesc = nullptr,
u32  flagmask = U32_MAX 
)

References getFlagDescFallback(), set(), and writeFlagString().

Referenced by setNoiseParams(), MapgenParams::writeParams(), MapgenCarpathianParams::writeParams(), MapgenFlatParams::writeParams(), MapgenFractalParams::writeParams(), MapgenV5Params::writeParams(), MapgenV6Params::writeParams(), MapgenV7Params::writeParams(), and MapgenValleysParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFloat()

bool Settings::setFloat ( const std::string &  name,
float  value 
)

References ftos(), and set().

Referenced by GUIVolumeChange::OnEvent(), Game::processKeyInput(), PlayerDatabaseFiles::serialize(), setNoiseParams(), TestSettings::testAllSettings(), Game::updateSound(), MapgenCarpathianParams::writeParams(), MapgenFlatParams::writeParams(), MapgenFractalParams::writeParams(), MapgenV5Params::writeParams(), MapgenV6Params::writeParams(), MapgenV7Params::writeParams(), and MapgenValleysParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGroup()

bool Settings::setGroup ( const std::string &  name,
const Settings group 
)

References Settings(), and setEntry().

Referenced by TestSettings::testAllSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setNoiseParams()

bool Settings::setNoiseParams ( const std::string &  name,
const NoiseParams np 
)

◆ setS16()

bool Settings::setS16 ( const std::string &  name,
s16  value 
)

References itos(), and set().

Referenced by TestSettings::testAllSettings(), MapgenParams::writeParams(), MapgenCarpathianParams::writeParams(), MapgenFlatParams::writeParams(), MapgenFractalParams::writeParams(), MapgenV5Params::writeParams(), MapgenV6Params::writeParams(), MapgenV7Params::writeParams(), and MapgenValleysParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setS32()

bool Settings::setS32 ( const std::string &  name,
s32  value 
)

References itos(), and set().

Referenced by PlayerDatabaseFiles::serialize(), and setNoiseParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setU16()

bool Settings::setU16 ( const std::string &  name,
u16  value 
)

References itos(), and set().

Referenced by Game::run(), GUIEngine::run(), PlayerDatabaseFiles::serialize(), setNoiseParams(), MapgenCarpathianParams::writeParams(), MapgenFlatParams::writeParams(), MapgenFractalParams::writeParams(), MapgenV5Params::writeParams(), MapgenV7Params::writeParams(), and MapgenValleysParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setU64()

bool Settings::setU64 ( const std::string &  name,
u64  value 
)

References set().

Referenced by ServerEnvironment::saveMeta(), and MapgenParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setV2F()

bool Settings::setV2F ( const std::string &  name,
v2f  value 
)

References set().

+ Here is the call graph for this function:

◆ setV3F()

bool Settings::setV3F ( const std::string &  name,
v3f  value 
)

References set().

Referenced by PlayerDatabaseFiles::serialize(), setNoiseParams(), TestSettings::testAllSettings(), and MapgenFractalParams::writeParams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateConfigFile()

bool Settings::updateConfigFile ( const char *  filename)

References errorstream, m_mutex, fs::safeWriteToFile(), and updateConfigObject().

Referenced by ServerEnvironment::ServerEnvironment(), ServerMap::ServerMap(), ModConfiguration::addModsFromConfig(), LuaSettings::l_write(), loadGameConfAndInitWorld(), main(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), ServerEnvironment::migratePlayersDatabase(), ClientLauncher::run(), MapSettingsManager::saveMapMeta(), and TestServerModManager::testCreation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateConfigObject()

bool Settings::updateConfigObject ( std::istream &  is,
std::ostream &  os,
u32  tab_depth = 0 
)
private

References getMultiline(), m_end_tag, m_settings, parseConfigObject(), printEntry(), sanity_check, SPE_END, SPE_GROUP, SPE_KVPAIR, SPE_MULTILINE, and updateConfigObject().

Referenced by TestSettings::testAllSettings(), updateConfigFile(), and updateConfigObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateNoLock()

void Settings::updateNoLock ( const Settings other)
private

◆ writeLines()

void Settings::writeLines ( std::ostream &  os,
u32  tab_depth = 0 
) const

References m_end_tag, m_mutex, m_settings, and printEntry().

Referenced by loadGameConfAndInitWorld(), printEntry(), ServerEnvironment::saveMeta(), and PlayerDatabaseFiles::serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ TestSettings

friend class TestSettings
friend

Member Data Documentation

◆ m_callback_mutex

std::mutex Settings::m_callback_mutex
mutableprivate

◆ m_callbacks

◆ m_end_tag

std::string Settings::m_end_tag
private

◆ m_mutex

std::mutex Settings::m_mutex
mutableprivate

◆ m_settings

◆ m_settingslayer

SettingsLayer Settings::m_settingslayer = SL_TOTAL_COUNT
private

◆ s_flags

std::unordered_map< std::string, const FlagDesc * > Settings::s_flags
staticprivate

Referenced by getFlagDescFallback(), and setDefault().

◆ s_layers

Settings * Settings::s_layers = {0}
staticprivate

The documentation for this class was generated from the following files: