File indexing completed on 2024-11-24 04:44:34

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003     SPDX-FileContributor: Kevin Krammer <krake@kdab.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "entitycompactchangeattribute.h"
0009 
0010 #include <QDataStream>
0011 #include <QIODevice>
0012 
0013 using namespace Akonadi;
0014 
0015 class FileStore::EntityCompactChangeAttributePrivate
0016 {
0017 public:
0018     EntityCompactChangeAttributePrivate &operator=(const EntityCompactChangeAttributePrivate &other)
0019     {
0020         if (&other == this) {
0021             return *this;
0022         }
0023 
0024         mRemoteId = other.mRemoteId;
0025         mRemoteRev = other.mRemoteRev;
0026         return *this;
0027     }
0028 
0029 public:
0030     QString mRemoteId;
0031     QString mRemoteRev;
0032 };
0033 
0034 FileStore::EntityCompactChangeAttribute::EntityCompactChangeAttribute()
0035     : Attribute()
0036     , d(new EntityCompactChangeAttributePrivate())
0037 {
0038 }
0039 
0040 FileStore::EntityCompactChangeAttribute::~EntityCompactChangeAttribute() = default;
0041 
0042 void FileStore::EntityCompactChangeAttribute::setRemoteId(const QString &remoteId)
0043 {
0044     d->mRemoteId = remoteId;
0045 }
0046 
0047 QString FileStore::EntityCompactChangeAttribute::remoteId() const
0048 {
0049     return d->mRemoteId;
0050 }
0051 
0052 void FileStore::EntityCompactChangeAttribute::setRemoteRevision(const QString &remoteRev)
0053 {
0054     d->mRemoteRev = remoteRev;
0055 }
0056 
0057 QString FileStore::EntityCompactChangeAttribute::remoteRevision() const
0058 {
0059     return d->mRemoteRev;
0060 }
0061 
0062 QByteArray FileStore::EntityCompactChangeAttribute::type() const
0063 {
0064     static const QByteArray sType("ENTITYCOMPACTCHANGE");
0065     return sType;
0066 }
0067 
0068 FileStore::EntityCompactChangeAttribute *FileStore::EntityCompactChangeAttribute::clone() const
0069 {
0070     auto copy = new FileStore::EntityCompactChangeAttribute();
0071     *(copy->d) = *d;
0072     return copy;
0073 }
0074 
0075 QByteArray FileStore::EntityCompactChangeAttribute::serialized() const
0076 {
0077     QByteArray data;
0078     QDataStream stream(&data, QIODevice::WriteOnly);
0079 
0080     stream << d->mRemoteId;
0081     stream << d->mRemoteRev;
0082 
0083     return data;
0084 }
0085 
0086 void FileStore::EntityCompactChangeAttribute::deserialize(const QByteArray &data)
0087 {
0088     QDataStream stream(data);
0089     stream >> d->mRemoteId;
0090     stream >> d->mRemoteRev;
0091 }