Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
Settings Class Reference

#include <settings.h>

+ Collaboration diagram for Settings:

Public Member Functions

 Settings (std::string_view end_tag="")
 
 Settings (std::string_view end_tag, SettingsHierarchy *h, int settings_layer)
 
 ~Settings ()
 
Settingsoperator= (const Settings &other)
 
bool readConfigFile (const char *filename)
 
bool updateConfigFile (const char *filename)
 
bool parseCommandLine (int argc, char *argv[], const 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
 
float getFloat (const std::string &name, float min, float max) 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 existsLocal (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 getU32NoEx (const std::string &name, u32 &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 ()
 
int getLayer () const
 

Static Public Member Functions

static SettingscreateLayer (SettingsLayer sl, std::string_view 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 clearNoLock ()
 
void doCallbacks (const std::string &name) const
 

Static Private Member Functions

static bool checkNameValid (std::string_view name)
 
static bool checkValueValid (std::string_view 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
 
SettingsHierarchym_hierarchy = nullptr
 
int m_settingslayer = -1
 

Static Private Attributes

static std::unordered_map< std::string, const FlagDesc * > s_flags
 

Friends

class TestSettings
 
class LuaSettings
 

Constructor & Destructor Documentation

◆ Settings() [1/2]

Settings::Settings ( std::string_view  end_tag = "")
inline

◆ Settings() [2/2]

Settings::Settings ( std::string_view  end_tag,
SettingsHierarchy h,
int  settings_layer 
)

References m_hierarchy, m_settingslayer, and SettingsHierarchy::onLayerCreated().

+ Here is the call graph for this function:

◆ ~Settings()

Settings::~Settings ( )

References clearNoLock(), m_hierarchy, m_mutex, m_settingslayer, and SettingsHierarchy::onLayerRemoved().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkNameValid()

bool Settings::checkNameValid ( std::string_view  name)
staticprivate

References errorstream.

Referenced by setEntry().

+ Here is the caller graph for this function:

◆ checkValueValid()

bool Settings::checkValueValid ( std::string_view  value)
staticprivate

References errorstream.

Referenced by setEntry().

+ Here is the caller graph for this function:

◆ 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,
std::string_view  end_tag = "" 
)
static

References g_hierarchy.

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

+ 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 ClientMap::~ClientMap(), Clouds::~Clouds(), Game::~Game(), GameGlobalShaderConstantSetter::~GameGlobalShaderConstantSetter(), Hud::~Hud(), and PlayerSettings::deregisterSettingsCallback().

+ 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()

◆ existsLocal()

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

References m_mutex, and m_settings.

Referenced by exists(), ModApiMainMenu::l_create_world(), and LuaSettings::l_has().

+ Here is the caller graph for this function:

◆ get()

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

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

Referenced by sound::ALExtensions::ALExtensions(), ChatBuffer::ChatBuffer(), ClientMap::ClientMap(), Database_Redis::Database_Redis(), HTTPFetchOngoing::HTTPFetchOngoing(), Hud::Hud(), RenderingEngine::RenderingEngine(), ServerMap::ServerMap(), Server::~Server(), ModConfiguration::addModsFromConfig(), addPostProcessing(), checkModNameWhitelisted(), chooseVideoDriver(), compare_settings(), Game::createSingleplayerServer(), PlayerDatabaseFiles::deSerialize(), findSubgame(), findWorldSubgame(), ShaderSource::generateShader(), get_deprecated_handling_mode(), get_game_from_cmdline(), get_world_from_cmdline(), get_world_from_config(), getBool(), getFlagStr(), getFloat(), getKeySetting(), TouchInteraction::getMode(), getNoEx(), getS16(), getS32(), getShaderPath(), Server::getStatusString(), getTextureDirs(), getU16(), getU32(), getU64(), getV2F(), getV3F(), getWorldGameId(), getWorldName(), Server::handleCommand_Init(), id_to_keycode(), Server::init(), ClientLauncher::init_args(), init_common(), init_log_streams(), FontEngine::initFont(), RenderingEngine::initialize(), ModApiMainMenu::l_create_world(), LuaSettings::l_get(), ClientLauncher::launch_game(), loadGameConfAndInitWorld(), GUIEngine::loadMainMenuScript(), ServerEnvironment::loadMeta(), main(), Client::makeScreenshot(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), Server::migrateModStorageDatabase(), ServerEnvironment::migratePlayersDatabase(), JoystickController::onJoystickConnect(), ClientMap::onSettingChanged(), Server::openModStorageDatabase(), parseContentInfo(), parseModContents(), read_config_file(), TextureSettings::readSettings(), recompress_map_database(), run_dedicated_server(), ServerList::sendAnnounce(), Server::sendMediaAnnouncement(), setup_log_params(), Game::showPauseMenu(), Server::step(), TestSettings::testAllSettings(), TestConnection::testConnectSendReceive(), TestSettings::testDefaults(), TestSocket::testIPv4Socket(), and LogOutputBuffer::updateLogLevel().

+ Here is the call graph for this function:

◆ getBool()

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

References get(), and is_yes().

Referenced by AsyncWorkerThread::AsyncWorkerThread(), Camera::Camera(), ChatBuffer::ChatBuffer(), Client::Client(), ClientMap::ClientMap(), Clouds::Clouds(), EmergeManager::EmergeManager(), EmergeScripting::EmergeScripting(), Environment::Environment(), GameGlobalShaderConstantSetter::GameGlobalShaderConstantSetter(), GUIChatConsole::GUIChatConsole(), GUIEngine::GUIEngine(), GUIFormSpecMenu::GUIFormSpecMenu(), GUIModalMenu::GUIModalMenu(), HTTPFetchOngoing::HTTPFetchOngoing(), Hud::Hud(), MapBlockMesh::MapBlockMesh(), MeshUpdateQueue::MeshUpdateQueue(), Minimap::Minimap(), PlayerSAO::PlayerSAO(), RenderingEngine::RenderingEngine(), ServerScripting::ServerScripting(), ShadowRenderer::ShadowRenderer(), Sky::Sky(), TextureSource::TextureSource(), TouchScreenGUI::TouchScreenGUI(), WieldMeshSceneNode::WieldMeshSceneNode(), addPostProcessing(), ClientMediaDownloader::addRemoteServer(), SingleMediaDownloader::addRemoteServer(), addUpscaling(), Server::AsyncRunStep(), RenderingEngine::autosaveScreensizeAndCo(), ClientDynamicInfo::calculateMaxFSSize(), PlayerSAO::checkMovementCheat(), Game::connectToServer(), create3DStage(), createShadowRenderer(), Game::createSingleplayerServer(), dedicated_server_loop(), PlayerDatabaseFiles::deSerialize(), RenderingEngine::draw_load_screen(), drawItemStack(), ShaderSource::generateShader(), getFlag(), Server::getProtocolVersionMax(), Server::getProtocolVersionMin(), Game::getServerContent(), guiScalingCache(), guiScalingResizeCached(), Server::handleChat(), Server::handleCommand_FirstSrp(), Server::handleCommand_Interact(), Server::handleCommand_ModChannelJoin(), Server::handleCommand_ModChannelLeave(), Server::handleCommand_ModChannelMsg(), Game::handleDigging(), Server::init(), ClientLauncher::init_args(), ClientLauncher::init_input(), GameUI::initFlags(), Game::initGui(), GenericCAO::initialize(), Client::initLocalMapSaving(), Game::initSound(), LuaSettings::l_get_bool(), ObjectRef::l_set_armor_groups(), LuaMinimap::l_show(), ServerMap::loadBlock(), loadGameConfAndInitWorld(), Client::loadMods(), LogOutputBuffer::logRaw(), main(), Game::nodePlacement(), ClientMap::onSettingChanged(), GUIFormSpecMenu::parseSize(), ShadowRenderer::preInit(), Game::processKeyInput(), Game::processPlayerInteraction(), PlayerSAO::punch(), PlayerSettings::readGlobalSettings(), Clouds::readSettings(), FontEngine::readSettings(), Game::readSettings(), TextureSettings::readSettings(), GUIFormSpecMenu::regenerateGui(), GUIKeyChangeMenu::regenerateGui(), GUIVolumeChange::regenerateGui(), Address::Resolve(), Game::run(), GUIEngine::run(), ClientLauncher::run(), run_dedicated_server(), TestSocket::runTests(), Server::SendActiveObjectRemoveAdd(), ServerList::sendAnnounce(), Game::showPauseMenu(), sound_volume_control(), Game::startup(), Server::step(), ClientEnvironment::step(), GenericCAO::step(), TestAddress::testResolve(), Game::toggleAutoforward(), Game::toggleCinematic(), Game::toggleFast(), Game::toggleFog(), Game::toggleFreeMove(), Game::toggleMinimap(), Game::toggleNoClip(), Game::togglePitchMove(), Camera::update(), MeshUpdateManager::updateBlock(), Game::updatePointedThing(), 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(), run_dedicated_server(), setup_log_params(), and MeshUpdateManager::updateBlock().

+ 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() [1/2]

float Settings::getFloat ( const std::string &  name) const

References get(), and stof.

Referenced by Camera::Camera(), Environment::Environment(), GameGlobalShaderConstantSetter::GameGlobalShaderConstantSetter(), GUIModalMenu::GUIModalMenu(), JoystickController::JoystickController(), OffsetCameraStep::OffsetCameraStep(), RemotePlayer::RemotePlayer(), Server::Server(), ShadowRenderer::ShadowRenderer(), Sky::Sky(), TouchScreenGUI::TouchScreenGUI(), Server::acceptAuth(), Server::AsyncRunStep(), dedicated_server_loop(), PlayerDatabaseFiles::deSerialize(), RenderingEngine::draw_load_screen(), Hud::drawHotbar(), ShaderSource::generateShader(), ClientDynamicInfo::getCurrent(), RenderingEngine::getDisplayDensity(), getFloatNoEx(), RemoteClient::GetNextBlocks(), getSmoothLightCombined(), Server::handleChat(), Game::handleClientEvent_SetSky(), Server::handleCommand_Init2(), Server::init(), ClientLauncher::init_guienv(), FontEngine::initFont(), FpsControl::limit(), GameGlobalShaderConstantSetter::onSettingsChange(), Game::processKeyInput(), Hud::readScalingSetting(), Game::readSettings(), GUIFormSpecMenu::regenerateGui(), GUIVolumeChange::regenerateGui(), Game::run(), ClientLauncher::run(), TestSAO::runTests(), Server::SendMovement(), set_light_table(), sound_volume_control(), Game::step(), ServerEnvironment::step(), Client::step(), TestSettings::testAllSettings(), TouchScreenGUI::translateEvent(), Game::updateProfilers(), and Camera::updateViewingRange().

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

◆ getFloat() [2/2]

float Settings::getFloat ( const std::string &  name,
float  min,
float  max 
) const

References get(), rangelim, and stof.

+ Here is the call graph for this function:

◆ 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(), push_settings_table(), and TestSettings::testAllSettings().

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

◆ getLayer() [1/2]

int Settings::getLayer ( ) const
inline

◆ getLayer() [2/2]

Settings * Settings::getLayer ( SettingsLayer  sl)
static

References g_hierarchy, and SettingsHierarchy::getLayer().

+ Here is the call graph for this function:

◆ 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(), push_settings_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 compare_settings(), ServerMap::createDatabase(), MapSettingsManager::getMapSetting(), getNoiseParamsFromValue(), ServerEnvironment::init(), ServerEnvironment::openAuthDatabase(), Server::openModStorageDatabase(), ServerEnvironment::openPlayerDatabase(), push_settings_table(), 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 SettingsHierarchy::getParent(), m_hierarchy, and m_settingslayer.

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

+ Here is the call graph for this function:
+ 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(), ShadowRenderer::ShadowRenderer(), Game::decreaseViewRange(), getS16NoEx(), Game::handleClientEvent_SetSky(), 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

◆ 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 getNoiseParamsFromGroup(), ServerEnvironment::init(), 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 EmergeManager::EmergeManager(), Environment::Environment(), ChatBackend::applySettings(), getU32NoEx(), Server::init(), ServerEnvironment::loadMeta(), and Server::SendBlocks().

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

◆ getU32NoEx()

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

References getU32().

Referenced by EmergeManager::EmergeManager().

+ 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(), and str_to_v3f().

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)

References clearNoLock(), FATAL_ERROR_IF, m_callbacks, m_hierarchy, m_mutex, and m_settings.

+ Here is the call graph for this function:

◆ parseCommandLine()

bool Settings::parseCommandLine ( int  argc,
char *  argv[],
const 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 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(), ServerMap::ServerMap(), ModConfiguration::addModsFromConfig(), findSubgame(), findWorldSubgame(), getAvailableGameIds(), getWorldGameId(), getWorldName(), ServerEnvironment::init(), loadGameConfAndInitWorld(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), Server::migrateModStorageDatabase(), ServerEnvironment::migratePlayersDatabase(), Server::openModStorageDatabase(), parseContentInfo(), parseModContents(), read_config_file(), and recompress_map_database().

+ 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 ClientMap::ClientMap(), Clouds::Clouds(), FontEngine::FontEngine(), Game::Game(), GameGlobalShaderConstantSetter::GameGlobalShaderConstantSetter(), Hud::Hud(), and PlayerSettings::registerSettingsCallback().

+ 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(), ModApiMainMenu::l_create_world(), 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(), RenderingEngine::autosaveScreensizeAndCo(), createShadowRenderer(), 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 FATAL_ERROR_IF, g_hierarchy, getLayer(), m_hierarchy, 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(), sound_volume_control(), TestSettings::testAllSettings(), 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 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 RenderingEngine::autosaveScreensizeAndCo(), 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 ServerMap::ServerMap(), ModConfiguration::addModsFromConfig(), ServerEnvironment::init(), Java_net_minetest_minetest_GameActivity_saveSettings(), LuaSettings::l_write(), loadGameConfAndInitWorld(), main(), ClientLauncher::main_menu(), migrate_map_database(), ServerEnvironment::migrateAuthDatabase(), Server::migrateModStorageDatabase(), 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:

◆ writeLines()

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

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

Referenced by 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

◆ LuaSettings

friend class LuaSettings
friend

◆ 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_hierarchy

SettingsHierarchy* Settings::m_hierarchy = nullptr
private

◆ m_mutex

std::mutex Settings::m_mutex
mutableprivate

◆ m_settings

◆ m_settingslayer

int Settings::m_settingslayer = -1
private

◆ s_flags

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

Referenced by getFlagDescFallback(), and setDefault().


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