Commit d45b7240 authored by David Jarvie's avatar David Jarvie
Browse files

Add operator==()

parent a90ec341
......@@ -2,7 +2,7 @@
* collectionattribute.cpp - Akonadi attribute holding Collection characteristics
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2010-2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2010-2019 David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -30,15 +30,19 @@ namespace KAlarmCal
class Q_DECL_HIDDEN CollectionAttribute::Private
{
public:
Private()
: mEnabled(CalEvent::EMPTY),
mStandard(CalEvent::EMPTY),
mKeepFormat(false) {}
Private() {}
bool operator==(const Private& other) const
{
return mBackgroundColour == other.mBackgroundColour
&& mEnabled == other.mEnabled
&& mStandard == other.mStandard
&& mKeepFormat == other.mKeepFormat;
}
QColor mBackgroundColour; // background color for collection and its alarms
CalEvent::Types mEnabled; // which alarm types the collection is enabled for
CalEvent::Types mStandard; // whether the collection is a standard collection
bool mKeepFormat; // whether user has chosen to keep old calendar storage format
QColor mBackgroundColour; // background color for collection and its alarms
CalEvent::Types mEnabled{CalEvent::EMPTY}; // which alarm types the collection is enabled for
CalEvent::Types mStandard{CalEvent::EMPTY}; // whether the collection is a standard collection
bool mKeepFormat{false}; // whether user has chosen to keep old calendar storage format
};
CollectionAttribute::CollectionAttribute()
......@@ -66,6 +70,11 @@ CollectionAttribute &CollectionAttribute::operator=(const CollectionAttribute &o
return *this;
}
bool CollectionAttribute::operator==(const CollectionAttribute &other) const
{
return *d == *other.d;
}
CollectionAttribute *CollectionAttribute::clone() const
{
return new CollectionAttribute(*this);
......
......@@ -2,7 +2,7 @@
* collectionattribute.h - Akonadi attribute holding Collection characteristics
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2010-2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2010-2019 David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -61,6 +61,10 @@ public:
~CollectionAttribute() override;
/** Comparison operator. */
bool operator==(const CollectionAttribute &other) const;
bool operator!=(const CollectionAttribute &other) const { return !operator==(other); }
/** Return whether the collection is enabled for a specified alarm type
* (active, archived, template or displaying).
* @param type alarm type to check for.
......
......@@ -2,7 +2,7 @@
* compatibilityattribute.cpp - Akonadi attribute holding Collection compatibility
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2011-2019 David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -30,13 +30,15 @@ namespace KAlarmCal
class Q_DECL_HIDDEN CompatibilityAttribute::Private
{
public:
Private()
: mCompatibility(KACalendar::Incompatible),
mVersion(KACalendar::IncompatibleFormat)
{}
Private() {}
bool operator==(const Private& other) const
{
return mCompatibility == other.mCompatibility
&& mVersion == other.mVersion;
}
KACalendar::Compat mCompatibility; // calendar compatibility with current KAlarm format
int mVersion; // KAlarm calendar format version
KACalendar::Compat mCompatibility{KACalendar::Incompatible}; // calendar compatibility with current KAlarm format
int mVersion{KACalendar::IncompatibleFormat}; // KAlarm calendar format version
};
CompatibilityAttribute::CompatibilityAttribute()
......@@ -64,6 +66,11 @@ CompatibilityAttribute &CompatibilityAttribute::operator=(const CompatibilityAtt
return *this;
}
bool CompatibilityAttribute::operator==(const CompatibilityAttribute &other) const
{
return *d == *other.d;
}
CompatibilityAttribute *CompatibilityAttribute::clone() const
{
return new CompatibilityAttribute(*this);
......
......@@ -2,7 +2,7 @@
* compatibilityattribute.h - Akonadi attribute holding Collection compatibility
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2011 by David Jarvie <djarvie@kde.org>
* Copyright © 2011-2019 David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published
......@@ -58,6 +58,10 @@ public:
~CompatibilityAttribute() override;
/** Comparison operator. */
bool operator==(const CompatibilityAttribute &other) const;
bool operator!=(const CompatibilityAttribute &other) const { return !operator==(other); }
/** Return the compatibility status for the entity. */
KACalendar::Compat compatibility() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment