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

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 <QList>
0010 #include <QXmlStreamWriter>
0011 
0012 #include "ewspropertyfield.h"
0013 #include "ewstypes.h"
0014 
0015 class EwsFolderShape
0016 {
0017 public:
0018     explicit EwsFolderShape(EwsBaseShape shape = EwsShapeDefault)
0019         : mBaseShape(shape)
0020     {
0021     }
0022 
0023     ~EwsFolderShape()
0024     {
0025     }
0026 
0027     EwsFolderShape(const EwsFolderShape &other)
0028         : mBaseShape(other.mBaseShape)
0029         , mProps(other.mProps)
0030     {
0031     }
0032 
0033     EwsFolderShape(EwsFolderShape &&other)
0034         : mBaseShape(other.mBaseShape)
0035         , mProps(other.mProps)
0036     {
0037     }
0038 
0039     EwsFolderShape &operator=(EwsFolderShape &&other)
0040     {
0041         mBaseShape = other.mBaseShape;
0042         mProps = std::move(other.mProps);
0043         return *this;
0044     }
0045 
0046     EwsFolderShape &operator=(const EwsFolderShape &other)
0047     {
0048         mBaseShape = other.mBaseShape;
0049         mProps = other.mProps;
0050         return *this;
0051     }
0052 
0053     void write(QXmlStreamWriter &writer) const;
0054 
0055     friend EwsFolderShape &operator<<(EwsFolderShape &shape, const EwsPropertyField &prop);
0056 
0057 protected:
0058     void writeBaseShape(QXmlStreamWriter &writer) const;
0059     void writeProperties(QXmlStreamWriter &writer) const;
0060 
0061     EwsBaseShape mBaseShape;
0062     QList<EwsPropertyField> mProps;
0063 };
0064 
0065 inline EwsFolderShape &operator<<(EwsFolderShape &shape, const EwsPropertyField &prop)
0066 {
0067     shape.mProps.append(prop);
0068     return shape;
0069 }