summaryrefslogtreecommitdiffstats
path: root/examples/demos/addressbook/contactentry.h
blob: e70e629faa4ee0d8efae1a04b56410e51a3d3769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef TYPES_H
#define TYPES_H

#include <QJsonObject>
#include <QString>

struct ContactEntry
{
    qint64 id;
    QString name;
    QString address;

    QJsonObject toJson() const
    {
        return QJsonObject{ { "id", id }, { "name", name }, { "address", address } };
    }

    static constexpr qsizetype size() { return 3; }

    bool operator==(const ContactEntry &other) const
    {
        return name == other.name && address == other.address;
    }
};

#endif // TYPES_H