| 90 | } |
| 91 | |
| 92 | void 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 | |
| 135 | void Settings::remove(const StringView& _name) const |
| 136 | { |
nothing calls this directly
no test coverage detected