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

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 <QSharedDataPointer>
0010 #include <QXmlStreamWriter>
0011 
0012 #include "ewstypes.h"
0013 
0014 class EwsPropertyFieldPrivate;
0015 
0016 class EwsPropertyField
0017 {
0018 public:
0019     enum Type {
0020         Field,
0021         ExtendedField,
0022         IndexedField,
0023         UnknownField,
0024     };
0025 
0026     EwsPropertyField();
0027     explicit EwsPropertyField(const QString &uri); // FieldURI
0028     EwsPropertyField(const QString &uri, unsigned index); // IndexedFieldURI
0029     EwsPropertyField(EwsDistinguishedPropSetId psid, unsigned id, EwsPropertyType type);
0030     EwsPropertyField(EwsDistinguishedPropSetId psid, const QString &name, EwsPropertyType type);
0031     EwsPropertyField(const QString &psid, unsigned id, EwsPropertyType type);
0032     EwsPropertyField(const QString &psid, const QString &name, EwsPropertyType type);
0033     EwsPropertyField(unsigned tag, EwsPropertyType type);
0034     EwsPropertyField(const EwsPropertyField &other);
0035     ~EwsPropertyField();
0036 
0037     EwsPropertyField &operator=(const EwsPropertyField &other);
0038     bool operator==(const EwsPropertyField &other) const;
0039 
0040     EwsPropertyField(EwsPropertyField &&other);
0041     EwsPropertyField &operator=(EwsPropertyField &&other);
0042 
0043     void write(QXmlStreamWriter &writer) const;
0044     bool read(QXmlStreamReader &reader);
0045 
0046     bool writeWithValue(QXmlStreamWriter &writer, const QVariant &value) const;
0047     void writeValue(QXmlStreamWriter &writer, const QVariant &value) const;
0048     void writeExtendedValue(QXmlStreamWriter &writer, const QVariant &value) const;
0049 
0050     Type type() const;
0051     QString uri() const;
0052 
0053 private:
0054     QSharedDataPointer<EwsPropertyFieldPrivate> d;
0055 
0056     friend uint qHash(const EwsPropertyField &prop, uint seed);
0057     friend QDebug operator<<(QDebug debug, const EwsPropertyField &prop);
0058 };
0059 
0060 uint qHash(const EwsPropertyField &prop, uint seed);
0061 
0062 QDebug operator<<(QDebug debug, const EwsPropertyField &prop);