diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-22 17:38:09 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-22 17:38:09 +0200 |
commit | 8bed00ab34e31f2b9c70026d418d923913325798 (patch) | |
tree | f289c15575415a36bc19c047a2037998e9b11ce8 /src/core/kconfigdata.h | |
parent | 186755fd56b58dc97250846c5305ef89f9487f86 (diff) | |
download | kconfig-8bed00ab34e31f2b9c70026d418d923913325798.tar.gz kconfig-8bed00ab34e31f2b9c70026d418d923913325798.tar.bz2 |
Run clang-format on all cpp/h files
NO_CHANGELOG
Diffstat (limited to 'src/core/kconfigdata.h')
-rw-r--r-- | src/core/kconfigdata.h | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/src/core/kconfigdata.h b/src/core/kconfigdata.h index 36d90335..bb9ee717 100644 --- a/src/core/kconfigdata.h +++ b/src/core/kconfigdata.h @@ -11,9 +11,9 @@ #define KCONFIGDATA_H #include <QByteArray> -#include <QString> -#include <QMap> #include <QDebug> +#include <QMap> +#include <QString> /** * map/dict/list config node entry. @@ -22,60 +22,67 @@ struct KEntry { /** Constructor. @internal */ KEntry() - : mValue(), bDirty(false), - bGlobal(false), bImmutable(false), bDeleted(false), bExpand(false), bReverted(false), - bLocalizedCountry(false), bNotify(false), bOverridesGlobal(false) {} + : mValue() + , bDirty(false) + , bGlobal(false) + , bImmutable(false) + , bDeleted(false) + , bExpand(false) + , bReverted(false) + , bLocalizedCountry(false) + , bNotify(false) + , bOverridesGlobal(false) + { + } /** @internal */ QByteArray mValue; /** * Must the entry be written back to disk? */ - bool bDirty : 1; + bool bDirty : 1; /** * Entry should be written to the global config file */ - bool bGlobal: 1; + bool bGlobal : 1; /** * Entry can not be modified. */ - bool bImmutable: 1; + bool bImmutable : 1; /** * Entry has been deleted. */ - bool bDeleted: 1; + bool bDeleted : 1; /** * Whether to apply dollar expansion or not. */ - bool bExpand: 1; + bool bExpand : 1; /** * Entry has been reverted to its default value (from a more global file). */ - bool bReverted: 1; + bool bReverted : 1; /** * Entry is for a localized key. If @c false the value references just language e.g. "de", * if @c true the value references language and country, e.g. "de_DE". **/ - bool bLocalizedCountry: 1; + bool bLocalizedCountry : 1; - bool bNotify: 1; + bool bNotify : 1; /** * Entry will need to be written on a non global file even if it matches default value */ - bool bOverridesGlobal: 1; + bool bOverridesGlobal : 1; }; // These operators are used to check whether an entry which is about // to be written equals the previous value. As such, this intentionally // omits the dirty/notify flag from the comparison. -inline bool operator ==(const KEntry &k1, const KEntry &k2) +inline bool operator==(const KEntry &k1, const KEntry &k2) { - return k1.bGlobal == k2.bGlobal && k1.bImmutable == k2.bImmutable - && k1.bDeleted == k2.bDeleted && k1.bExpand == k2.bExpand - && k1.mValue == k2.mValue; + return k1.bGlobal == k2.bGlobal && k1.bImmutable == k2.bImmutable && k1.bDeleted == k2.bDeleted && k1.bExpand == k2.bExpand && k1.mValue == k2.mValue; } -inline bool operator !=(const KEntry &k1, const KEntry &k2) +inline bool operator!=(const KEntry &k1, const KEntry &k2) { return !(k1 == k2); } @@ -87,9 +94,12 @@ inline bool operator !=(const KEntry &k1, const KEntry &k2) */ struct KEntryKey { /** Constructor. @internal */ - KEntryKey(const QByteArray &_group = QByteArray(), - const QByteArray &_key = QByteArray(), bool isLocalized = false, bool isDefault = false) - : mGroup(_group), mKey(_key), bLocal(isLocalized), bDefault(isDefault), bRaw(false) + KEntryKey(const QByteArray &_group = QByteArray(), const QByteArray &_key = QByteArray(), bool isLocalized = false, bool isDefault = false) + : mGroup(_group) + , mKey(_key) + , bLocal(isLocalized) + , bDefault(isDefault) + , bRaw(false) { ; } @@ -104,16 +114,16 @@ struct KEntryKey { /** * Entry is localised or not */ - bool bLocal : 1; + bool bLocal : 1; /** * Entry indicates if this is a default value. */ - bool bDefault: 1; + bool bDefault : 1; /** @internal * Key is a raw unprocessed key. * @warning this should only be set during merging, never for normal use. */ - bool bRaw: 1; + bool bRaw : 1; }; /** @@ -121,7 +131,7 @@ struct KEntryKey { * non-localized, non-localized-default * @internal */ -inline bool operator <(const KEntryKey &k1, const KEntryKey &k2) +inline bool operator<(const KEntryKey &k1, const KEntryKey &k2) { int result = qstrcmp(k1.mGroup, k2.mGroup); if (result != 0) { @@ -172,45 +182,38 @@ public: }; Q_DECLARE_FLAGS(EntryOptions, EntryOption) - Iterator findExactEntry(const QByteArray &group, const QByteArray &key = QByteArray(), - SearchFlags flags = SearchFlags()); + Iterator findExactEntry(const QByteArray &group, const QByteArray &key = QByteArray(), SearchFlags flags = SearchFlags()); - Iterator findEntry(const QByteArray &group, const QByteArray &key = QByteArray(), - SearchFlags flags = SearchFlags()); + Iterator findEntry(const QByteArray &group, const QByteArray &key = QByteArray(), SearchFlags flags = SearchFlags()); - ConstIterator findEntry(const QByteArray &group, const QByteArray &key = QByteArray(), - SearchFlags flags = SearchFlags()) const; + ConstIterator findEntry(const QByteArray &group, const QByteArray &key = QByteArray(), SearchFlags flags = SearchFlags()) const; /** * Returns true if the entry gets dirtied or false in other case */ - bool setEntry(const QByteArray &group, const QByteArray &key, - const QByteArray &value, EntryOptions options); + bool setEntry(const QByteArray &group, const QByteArray &key, const QByteArray &value, EntryOptions options); - void setEntry(const QByteArray &group, const QByteArray &key, - const QString &value, EntryOptions options) + void setEntry(const QByteArray &group, const QByteArray &key, const QString &value, EntryOptions options) { setEntry(group, key, value.toUtf8(), options); } - QString getEntry(const QByteArray &group, const QByteArray &key, + QString getEntry(const QByteArray &group, + const QByteArray &key, const QString &defaultValue = QString(), SearchFlags flags = SearchFlags(), bool *expand = nullptr) const; - bool hasEntry(const QByteArray &group, const QByteArray &key = QByteArray(), - SearchFlags flags = SearchFlags()) const; + bool hasEntry(const QByteArray &group, const QByteArray &key = QByteArray(), SearchFlags flags = SearchFlags()) const; bool getEntryOption(const ConstIterator &it, EntryOption option) const; - bool getEntryOption(const QByteArray &group, const QByteArray &key, - SearchFlags flags, EntryOption option) const + bool getEntryOption(const QByteArray &group, const QByteArray &key, SearchFlags flags, EntryOption option) const { return getEntryOption(findEntry(group, key, flags), option); } void setEntryOption(Iterator it, EntryOption option, bool bf); - void setEntryOption(const QByteArray &group, const QByteArray &key, SearchFlags flags, - EntryOption option, bool bf) + void setEntryOption(const QByteArray &group, const QByteArray &key, SearchFlags flags, EntryOption option, bool bf) { setEntryOption(findEntry(group, key, flags), option, bf); } |