X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Flibs%2FCommon%2Finifile_p.h;h=e886bb342ec22d946faabeb44065b2159ae58d4b;hb=4c0329c5c2690bde28212c89029015a5da4c7e34;hp=b7826270f25239bc64c0013f0949d7c031ee54cc;hpb=6230ebd0a05134031e52001c15473c3c3e6c7c1b;p=evaf
diff --git a/src/libs/Common/inifile_p.h b/src/libs/Common/inifile_p.h
index b782627..e886bb3 100644
--- a/src/libs/Common/inifile_p.h
+++ b/src/libs/Common/inifile_p.h
@@ -3,7 +3,7 @@
* @brief Internal implementation of the 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.
*
@@ -40,7 +40,7 @@ class IniFileValue : public QSharedData
{
public:
- IniFileValue(quint64 pos)
+ IniFileValue(qint64 pos)
: QSharedData()
, filePos(pos)
, thisOsOnly(false)
@@ -52,17 +52,22 @@ public:
* Offset of the parameter in the INI file. By seeking the file to this offset value,
* the next character read or written will be the beginning of the key name.
*/
- quint64 filePos;
+ qint64 filePos;
/**
* Key name of the parameter
*/
- QString name;
+ QByteArray name;
/**
* Value from the INI file
*/
- QString paramValue;
+ QByteArray paramValue;
+
+ /**
+ * Value converted to the final type (defaults to QVariant::Invalid
+ */
+ QVariant value;
/**
* Flag indicating that this value is valid on this OS only
@@ -77,7 +82,7 @@ class IniFileSection : public QSharedData
{
public:
- IniFileSection(quint64 pos)
+ IniFileSection(qint64 pos)
: QSharedData()
, filePos(pos)
{}
@@ -88,19 +93,19 @@ public:
* Offset of the section in the INI file. By seeking the file to this offset value,
* the next character read or written will be the first character of the section.
*/
- quint64 filePos;
+ qint64 filePos;
/**
* Name of the section
*/
- QString name;
+ QByteArray name;
/**
* List of all the known parameter values in this section
*
* The key to the hash table is the name of the key for the parameters value.
*/
- QHash > values;
+ QHash > values;
};
@@ -115,9 +120,9 @@ public:
~IniFileImpl();
- QVariant getValue(QString const & paramName, QVariant const & defaultValue);
+ QVariant getValue(QByteArray const & paramName, QVariant const & defaultValue);
- bool setValue(QString const & paramName, QVariant const & value);
+ bool setValue(QByteArray const & paramName, QVariant const & value);
inline bool isValid() const { return mValid; }
@@ -145,7 +150,7 @@ private: // Members
*
* The key to the hash table is the name of the section.
*/
- QHash > mCache;
+ QHash > mCache;
/// When was the INI file modified.
QDateTime mLastModified;
@@ -162,7 +167,7 @@ private: /// Methods
* Sections and parameters that come after the modified parameter value are shifted and their file
* positions changed. This method updates items in the internal cache after changes to the INI file.
*/
- void updateCache(quint64 pos, qint64 diff);
+ void updateCache(qint64 pos, qint64 diff);
/**
* Looks for a section in the INI file
@@ -178,7 +183,7 @@ private: /// Methods
* The file object is expected to be opened if the mValid flag is true. If the mValid flag is false, looks
* only in the cache.
*/
- QExplicitlySharedDataPointer getSection(QFile & file, QString const & sectionName);
+ QExplicitlySharedDataPointer getSection(QFile & file, QByteArray const & sectionName);
/**
* Looks for a parameter in the INI file
@@ -195,7 +200,7 @@ private: /// Methods
* The file object is expected to be opened if the mValid flag is true. If the mValid flag is false, looks
* only in the cache.
*/
- QExplicitlySharedDataPointer getParameter(QFile & file, IniFileSection & section, QString const & paramName);
+ QExplicitlySharedDataPointer getParameter(QFile & file, IniFileSection & section, QByteArray const & paramName);
};