File indexing completed on 2024-05-12 04:42:42
0001 /* 0002 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KPUBLICTRANSPORT_EQUIPMENT_H 0008 #define KPUBLICTRANSPORT_EQUIPMENT_H 0009 0010 #include "kpublictransport_export.h" 0011 0012 #include "datatypes.h" 0013 #include "disruption.h" 0014 0015 #include <QStringList> 0016 0017 class QJsonObject; 0018 0019 namespace KPublicTransport { 0020 0021 class EquipmentPrivate; 0022 0023 /** Status information about equipment such as elevators or escalators. */ 0024 class KPUBLICTRANSPORT_EXPORT Equipment 0025 { 0026 KPUBLICTRANSPORT_GADGET(Equipment) 0027 public: 0028 /** Type of equipment. */ 0029 enum Type { 0030 Unknown, 0031 Elevator, 0032 Escalator, 0033 }; 0034 Q_ENUM(Type) 0035 KPUBLICTRANSPORT_PROPERTY(Type, type, setType) 0036 0037 /** Disruption effect on this section, if any. */ 0038 KPUBLICTRANSPORT_PROPERTY(KPublicTransport::Disruption::Effect, disruptionEffect, setDisruptionEffect) 0039 /** General human-readable notes on this service, e.g. details about a disruption. */ 0040 KPUBLICTRANSPORT_PROPERTY(QStringList, notes, setNotes) 0041 0042 public: 0043 /** Adds a note. This will check for duplicates and normalize the notes. */ 0044 void addNote(const QString ¬e); 0045 0046 /** Serializes one object to JSON. */ 0047 static QJsonObject toJson(const Equipment &equipment); 0048 /** Deserialize an object from JSON. */ 0049 static Equipment fromJson(const QJsonObject &obj); 0050 }; 0051 0052 } 0053 0054 Q_DECLARE_METATYPE(KPublicTransport::Equipment) 0055 0056 #endif // KPUBLICTRANSPORT_EQUIPMENT_H