valueObject = new IniFileValue(currentPos);
valueObject->name = name;
valueObject->paramValue = value;
+ valueObject->thisOsOnly = thisOsOnly;
section.values.insert(name, valueObject);
}
else {
valueObject = *it;
valueObject->name = name;
valueObject->paramValue = value;
+ valueObject->thisOsOnly = thisOsOnly;
}
// Is this the parameter vwe are looking for?
QVariant IniFileImpl::getValue(QString const & paramName, QVariant const & defaultValue)
{
// Locate the '/' character that separates section names from key names
- int idx = paramName.indexOf('/');
+ int idx = paramName.lastIndexOf('/');
if (idx < 0)
return defaultValue;
bool IniFileImpl::setValue(QString const & paramName, QVariant const & value)
{
// Locate the '/' character that separates section names from key names
- int idx = paramName.indexOf('/');
+ int idx = paramName.lastIndexOf('/', -1);
if (idx < 0)
return false;
if (diff)
updateCache(currentPos, diff);
+ // Update the parameter value in the internal cache
+ valueObject->paramValue = valueString;
+
}
f.close();
/**
* Class for reading and writing parameter values in INI files.
*
- * The IniFile class provides access to parameter values in a standard INI file. Every parameter value is
- * identified by a section/key name pair. Key names can be prefixed with 'windows:' or 'linux:' if the
- * parameter value is specific for the given platform. This allows entering platform-specific parameter
- * values to the INI file. INI files can contain comment lines that start with ';' or '#'. Comments are
+ * The IniFile class provides access to parameter values in a standard INI file.
+ * Every parameter value is identified by a section/key name pair. Key names can be prefixed with
+ * 'windows:' or 'linux:' if the parameter value is specific for the given platform.
+ * This allows entering platform-specific parameter values to the INI file.
+ *
+ * INI files can contain comment lines that start with ';' or '#'. Comments are
* preserved when new values are written to the INI file.
*
+ * This is a sample INI file:
+ * @code
+ * [main]
+ * # The full name of this parameter is 'main/name'
+ * name = MyApplication
+ *
+ * [extensions/about]
+ * # The full name of this parameter is 'extensions/about/module'
+ * module = libabout.so
+ * @endcode
+ *
* Values in INI files are stored as strings and the IniFile class expects them to use specific formats if
* the returned value is supposed to be of a different data type. The following list shows the expected format
* of different data types: