File indexing completed on 2024-11-10 04:40:16

0001 /*
0002     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "attribute.h"
0010 
0011 #include <QByteArray>
0012 
0013 /* Attribute used for testing by various unit tests. */
0014 class TestAttribute : public Akonadi::Attribute
0015 {
0016 public:
0017     TestAttribute() = default;
0018     QByteArray type() const override
0019     {
0020         return "EXTRA";
0021     }
0022     QByteArray serialized() const override
0023     {
0024         return data;
0025     }
0026     void deserialize(const QByteArray &ba) override
0027     {
0028         data = ba;
0029     }
0030     TestAttribute *clone() const override
0031     {
0032         auto a = new TestAttribute;
0033         a->data = data;
0034         return a;
0035     }
0036     QByteArray data;
0037 };
0038 
0039 class TestAttribute2 : public Akonadi::Attribute
0040 {
0041 public:
0042     TestAttribute2() = default;
0043     QByteArray type() const override
0044     {
0045         return "EXTRA2";
0046     }
0047     QByteArray serialized() const override
0048     {
0049         return data;
0050     }
0051     void deserialize(const QByteArray &ba) override
0052     {
0053         data = ba;
0054     }
0055     Attribute *clone() const override
0056     {
0057         auto a = new TestAttribute2;
0058         a->data = data;
0059         return a;
0060     }
0061     QByteArray data;
0062 };