Messagelib
9 #include "core/optionset.h" 13 #include <QDataStream> 15 static const int gOptionSetInitialMarker = 0xcafe;
16 static const int gOptionSetFinalMarker = 0xbabe;
18 static const int gOptionSetWithReadOnLyModeVersion = 0x1002;
22 OptionSet::OptionSet()
28 OptionSet::OptionSet(
const OptionSet &
set)
31 , mDescription(set.mDescription)
32 , mReadOnly(set.mReadOnly)
36 OptionSet::OptionSet(
const QString &name,
const QString &description,
bool readOnly)
38 , mDescription(description)
44 OptionSet::~OptionSet()
48 void OptionSet::generateUniqueId()
50 static int nextUniqueId = 0;
52 mId = QStringLiteral(
"%1-%2").arg((
unsigned int)::time(
nullptr)).arg(nextUniqueId);
62 s << gOptionSetInitialMarker;
63 s << gOptionSetWithReadOnLyModeVersion;
71 s << gOptionSetFinalMarker;
77 bool OptionSet::loadFromString(
const QString &data)
87 if (marker != gOptionSetInitialMarker) {
95 if (currentVersion > gOptionSetWithReadOnLyModeVersion) {
107 if (mName.isEmpty()) {
113 bool readOnly =
false;
114 if (currentVersion == gOptionSetWithReadOnLyModeVersion) {
117 mReadOnly = readOnly;
125 if (marker != gOptionSetFinalMarker) {
A set of options that can be applied to the MessageList in one shot.
QByteArray toHex() const const
The implementation independent part of the MessageList library.
QByteArray fromHex(const QByteArray &hexEncoded)
QByteArray toLatin1() const const
QString fromLatin1(const char *str, int size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 16 2021 23:16:35 by
doxygen 1.8.11 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.