File indexing completed on 2024-12-29 04:49:57
0001 /* 0002 SPDX-FileCopyrightText: 2018 Luca Beltrame <lbeltrame@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "organization.h" 0008 #include "datatypes_p.h" 0009 #include "locationutil.h" 0010 0011 #include <QUrl> 0012 0013 using namespace KItinerary; 0014 0015 namespace KItinerary { 0016 0017 class OrganizationPrivate: public QSharedData 0018 { 0019 KITINERARY_PRIVATE_BASE_GADGET(Organization) 0020 public: 0021 QString name; 0022 QString identifier; 0023 QString description; 0024 QUrl image; 0025 QUrl logo; 0026 QString email; 0027 QString telephone; 0028 QUrl url; 0029 PostalAddress address; 0030 GeoCoordinates geo; 0031 QVariantList potentialAction; 0032 }; 0033 0034 KITINERARY_MAKE_CLASS(Organization) 0035 KITINERARY_MAKE_PROPERTY(Organization, QString, name, setName) 0036 KITINERARY_MAKE_PROPERTY(Organization, QString, identifier, setIdentifier) 0037 KITINERARY_MAKE_PROPERTY(Organization, QString, description, setDescription) 0038 KITINERARY_MAKE_PROPERTY(Organization, QUrl, image, setImage) 0039 KITINERARY_MAKE_PROPERTY(Organization, QUrl, logo, setLogo) 0040 KITINERARY_MAKE_PROPERTY(Organization, QString, email, setEmail) 0041 KITINERARY_MAKE_PROPERTY(Organization, QString, telephone, setTelephone) 0042 KITINERARY_MAKE_PROPERTY(Organization, QUrl, url, setUrl) 0043 KITINERARY_MAKE_PROPERTY(Organization, PostalAddress, address, setAddress) 0044 KITINERARY_MAKE_PROPERTY(Organization, KItinerary::GeoCoordinates, geo, setGeo) 0045 KITINERARY_MAKE_PROPERTY(Organization, QVariantList, potentialAction, setPotentialAction) 0046 KITINERARY_MAKE_OPERATOR(Organization) 0047 0048 QUrl Organization::geoUri() const 0049 { 0050 return LocationUtil::geoUri(*this); 0051 } 0052 0053 class AirlinePrivate : public OrganizationPrivate 0054 { 0055 KITINERARY_PRIVATE_GADGET(Airline) 0056 public: 0057 QString iataCode; 0058 }; 0059 0060 KITINERARY_MAKE_DERIVED_CLASS(Airline, Organization) 0061 KITINERARY_MAKE_PROPERTY(Airline, QString, iataCode, setIataCode) 0062 KITINERARY_MAKE_OPERATOR(Airline) 0063 0064 class LocalBusinessPrivate : public OrganizationPrivate 0065 { 0066 KITINERARY_PRIVATE_GADGET(LocalBusiness) 0067 }; 0068 KITINERARY_MAKE_DERIVED_CLASS(LocalBusiness, Organization) 0069 KITINERARY_MAKE_OPERATOR(LocalBusiness) 0070 0071 class FoodEstablishmentPrivate: public LocalBusinessPrivate 0072 { 0073 KITINERARY_PRIVATE_GADGET(FoodEstablishment) 0074 }; 0075 KITINERARY_MAKE_DERIVED_CLASS(FoodEstablishment, LocalBusiness) 0076 KITINERARY_MAKE_OPERATOR(FoodEstablishment) 0077 0078 class LodgingBusinessPrivate : public LocalBusinessPrivate 0079 { 0080 KITINERARY_PRIVATE_GADGET(LodgingBusiness) 0081 }; 0082 KITINERARY_MAKE_DERIVED_CLASS(LodgingBusiness, LocalBusiness) 0083 KITINERARY_MAKE_OPERATOR(LodgingBusiness) 0084 0085 } 0086 0087 template <> 0088 KItinerary::OrganizationPrivate *QExplicitlySharedDataPointer<KItinerary::OrganizationPrivate>::clone() 0089 { 0090 return d->clone(); 0091 } 0092 0093 #include "moc_organization.cpp"