Method Configuration Files (INI)
Format: Standard INI file format.
[section_name] ; Corresponds to the GetType() return value of the method or behavior key1 = value1 key2 = value2 # Comments supported # Empty lines and comment lines are ignored @inherit = /path/to/base_config.ini ; Optional: inheritance directive
Loading Mechanism (
MethodPreset::InitializeDefaultConfigPath,LoadMethodOptions):Priority: Runtime settings >
method_options_in code > current directoryconfigs/methods/> build directoryconfigs/methods/> installation directoryconfigs/methods/.Auto-loading:
MethodPresetconstructor attempts to load.inifiles with the same name asGetType()in the above priority order.Inheritance: Supports
@inheritdirective to load base configuration, current configuration overrides inherited configuration.Specific Configuration Loading:
LoadMethodOptionscan accept a second parameter to load a specific section from the INI file as configuration.
Reading Configuration (
GetOption*intypes.hpp):In plugin code, use the
method_options_member variable to access configuration.Use helper functions
GetOptionAsString,GetOptionAsIndexT,GetOptionAsFloat,GetOptionAsBoolto safely read configuration values with default values.
Writing Configuration (
ConfigurationTools):Although
MethodPresetis mainly for reading, theConfigurationToolsclass (inifile.hpp) provides functionality to write INI files (WriteItem,WriteFile). Can be used to save user-modified configurations.