File indexing completed on 2024-12-22 04:57:02

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ewsid.h"
0010 #include <QHash>
0011 #include <QSharedData>
0012 
0013 class EwsItemBasePrivate : public QSharedData
0014 {
0015 public:
0016     typedef QHash<EwsPropertyField, QVariant> PropertyHash;
0017 
0018     EwsItemBasePrivate();
0019     virtual ~EwsItemBasePrivate();
0020 
0021     virtual EwsItemBasePrivate *clone() const = 0;
0022 
0023     static bool extendedPropertyReader(QXmlStreamReader &reader, QVariant &val);
0024     static bool extendedPropertyWriter(QXmlStreamWriter &writer, const QVariant &val);
0025 
0026     // When the item, is first constructed it will only contain the id and will therefore be
0027     // invalid. Once updated through EWS the remaining data will be populated and the item will
0028     // be valid.
0029     bool mValid;
0030 
0031     QHash<EwsItemFields, QVariant> mFields;
0032 
0033     bool operator==(const EwsItemBasePrivate &other) const;
0034 };
0035 
0036 template<>
0037 Q_INLINE_TEMPLATE EwsItemBasePrivate *QSharedDataPointer<EwsItemBasePrivate>::clone()
0038 {
0039     return d->clone();
0040 }
0041 
0042 Q_DECLARE_METATYPE(EwsItemBasePrivate::PropertyHash)