MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / set

Method set

Source/3rdParty/bx/src/settings.cpp:92–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void Settings::set(const StringView& _name, const StringView& _value)
93{
94 ini_t* ini = INI_T(m_ini);
95
96 FilePath uri(_name);
97 const StringView path(strTrim(uri.getPath(), "/") );
98 const StringView& fileName(uri.getFileName() );
99
100 int32_t section = INI_GLOBAL_SECTION;
101
102 if (!path.isEmpty() )
103 {
104 section = ini_find_section(ini, path.getPtr(), path.getLength() );
105 if (INI_NOT_FOUND == section)
106 {
107 section = ini_section_add(ini, path.getPtr(), path.getLength() );
108 }
109 }
110
111 int32_t property = ini_find_property(ini, section, fileName.getPtr(), fileName.getLength() );
112 if (INI_NOT_FOUND == property)
113 {
114 ini_property_add(
115 ini
116 , section
117 , fileName.getPtr()
118 , fileName.getLength()
119 , _value.getPtr()
120 , _value.getLength()
121 );
122 }
123 else
124 {
125 ini_property_value_set(
126 ini
127 , section
128 , property
129 , _value.getPtr()
130 , _value.getLength()
131 );
132 }
133}
134
135void Settings::remove(const StringView& _name) const
136{

Callers

nothing calls this directly

Calls 9

strTrimFunction · 0.85
ini_find_sectionFunction · 0.85
ini_section_addFunction · 0.85
ini_find_propertyFunction · 0.85
ini_property_addFunction · 0.85
ini_property_value_setFunction · 0.85
getPathMethod · 0.65
isEmptyMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected