X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Finifile.h;h=6bcf86beb6f7d234f0959aeb4aede742e5c95351;hb=HEAD;hp=21a1bc4346ac293b8d96b03992242210efce013a;hpb=b280102618ec2ced838a092ba7673964ab272569;p=evaf
diff --git a/src/libs/Common/inifile.h b/src/libs/Common/inifile.h
index 21a1bc4..6bcf86b 100644
--- a/src/libs/Common/inifile.h
+++ b/src/libs/Common/inifile.h
@@ -3,7 +3,7 @@
* @brief Class for reading and writing parameter values in INI files.
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
namespace eVaf {
namespace Common {
@@ -47,7 +48,10 @@ namespace Internal {
* @code
* [main]
* # The full name of this parameter is 'main/name'
- * name = MyApplication
+ * name = "My Application"
+ *
+ * # 4-byte binary version number 1.0.7.10 with the name 'main/version'
+ * version =
*
* [extensions/about]
* # The full name of this parameter is 'extensions/about/module'
@@ -59,14 +63,21 @@ namespace Internal {
* of different data types:
*
* @li Bool - '0', 'false', 'off', 'no' are equal to false and '1', 'true', 'on', 'yes' are equal to true;
- * @li Char - a single character or an ASCII code as '\0NNN' (oct) or '\0xNN' (hex);
+ * @li Char - a single character or an UTF-16 code as '\0NNNNNN' (oct) or '\0xNNNN' (hex);
* @li Date - date string in the ISO 8601 format YYYY-MM-DD;
* @li DateTime - date and time string in the ISO 8601 format YYY-MM-DDTHH:MM:SSTZD;
* @li Double - the decimal point is always '.' regardless of the locale;
* @li Int - only base 10 (decimal) is allowed;
* @li Time - 24h time string in the format HH:MM:SS
* @li UInt - base 16 (hex) if the string is prefixed with '0x'; base 8 if the string starts with '0'; otherwise
- * the value is expected to be base 10 (decimal).
+ * the value is expected to be base 10 (decimal);
+ * @li ByteArray - non-printable bytes and special characters are encoded as numeric character or character entity references;
+ * @li String - non-printable and special characters are encoded as numeric character or character entity references.
+ *
+ * Strings and Byte array values can be enclosed in single or double quotes. The IniFile class does this automatically when
+ * saving String or Byte array values with leading or trailing spaces. Quotes are removed from the parameter value prior
+ * returning the value to the application. Use character entity references """ and "'" if quotes should be part of
+ * the parameter value.
*/
class COMMON_EXPORT IniFile
{
@@ -119,7 +130,7 @@ public:
*
* @sa eVaf::Common::toVariant()
*/
- QVariant getValue(QString const & paramName, QVariant const & defaultValue = QVariant::Invalid);
+ QVariant getValue(QByteArray const & paramName, QVariant const & defaultValue = QVariant::Invalid);
/**
* Writes a value to the INI file.
@@ -134,13 +145,13 @@ public:
* The method returns true if the parameter value was written into the INI file and false if not. Use the errorString() method
* to get a human-readable error string if writing to the INI file fails.
*/
- bool setValue(QString const & paramName, QVariant const & value);
+ bool setValue(QByteArray const & paramName, QVariant const & value);
private:
/// Pointer to the internal implementation of the class
- Internal::IniFileImpl * d;
+ QScopedPointer d;
};