diff --git a/src/datatypes/organization.cpp b/src/datatypes/organization.cpp index 7a570ab..2f6aafd 100644 --- a/src/datatypes/organization.cpp +++ b/src/datatypes/organization.cpp @@ -1,81 +1,87 @@ /* Copyright (C) 2018 Luca Beltrame This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "organization.h" #include "datatypes_p.h" #include using namespace KItinerary; namespace KItinerary { class OrganizationPrivate: public QSharedData { KITINERARY_PRIVATE_BASE_GADGET(Organization) public: QString name; + QString description; + QUrl image; QString email; QString telephone; QUrl url; PostalAddress address; GeoCoordinates geo; + QVariantList potentialAction; }; KITINERARY_MAKE_BASE_CLASS(Organization) KITINERARY_MAKE_PROPERTY(Organization, QString, name, setName) +KITINERARY_MAKE_PROPERTY(Organization, QString, description, setDescription) +KITINERARY_MAKE_PROPERTY(Organization, QUrl, image, setImage) KITINERARY_MAKE_PROPERTY(Organization, QString, email, setEmail) KITINERARY_MAKE_PROPERTY(Organization, QString, telephone, setTelephone) KITINERARY_MAKE_PROPERTY(Organization, QUrl, url, setUrl) KITINERARY_MAKE_PROPERTY(Organization, PostalAddress, address, setAddress) KITINERARY_MAKE_PROPERTY(Organization, KItinerary::GeoCoordinates, geo, setGeo) +KITINERARY_MAKE_PROPERTY(Organization, QVariantList, potentialAction, setPotentialAction) KITINERARY_MAKE_OPERATOR(Organization) class AirlinePrivate : public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(Airline) public: QString iataCode; }; KITINERARY_MAKE_SUB_CLASS(Airline, Organization) KITINERARY_MAKE_PROPERTY(Airline, QString, iataCode, setIataCode) KITINERARY_MAKE_OPERATOR(Airline) class FoodEstablishmentPrivate: public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(FoodEstablishment) }; KITINERARY_MAKE_SUB_CLASS(FoodEstablishment, Organization) KITINERARY_MAKE_OPERATOR(FoodEstablishment) class LodgingBusinessPrivate : public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(LodgingBusiness) }; KITINERARY_MAKE_SUB_CLASS(LodgingBusiness, Organization) KITINERARY_MAKE_OPERATOR(LodgingBusiness) } template <> KItinerary::OrganizationPrivate *QExplicitlySharedDataPointer::clone() { return d->clone(); } #include "moc_organization.cpp" diff --git a/src/datatypes/organization.h b/src/datatypes/organization.h index c44fe02..f0bd152 100644 --- a/src/datatypes/organization.h +++ b/src/datatypes/organization.h @@ -1,91 +1,94 @@ /* Copyright (C) 2018 Luca Beltrame This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef KITINERARY_ORGANIZATION_H #define KITINERARY_ORGANIZATION_H #include "kitinerary_export.h" #include "datatypes.h" #include "place.h" class QUrl; namespace KItinerary { class OrganizationPrivate; /** An organization. * * This slightly deviates from the schema.org definition and also includes * properties of Place that its sub-classes need. This is a simplification * to avoid having to use multi-inheritance. * * @see https://schema.org/Organization */ class KITINERARY_EXPORT Organization { KITINERARY_BASE_GADGET(Organization) KITINERARY_PROPERTY(QString, name, setName) + KITINERARY_PROPERTY(QString, description, setDescription) + KITINERARY_PROPERTY(QUrl, image, setImage) KITINERARY_PROPERTY(QString, email, setEmail) KITINERARY_PROPERTY(QString, telephone, setTelephone) KITINERARY_PROPERTY(QUrl, url, setUrl) KITINERARY_PROPERTY(KItinerary::PostalAddress, address, setAddress) KITINERARY_PROPERTY(KItinerary::GeoCoordinates, geo, setGeo) + KITINERARY_PROPERTY(QVariantList, potentialAction, setPotentialAction) protected: ///@cond internal QExplicitlySharedDataPointer d; ///@endcond }; class AirlinePrivate; /** An airline. * @see https://schema.org/Airline */ class KITINERARY_EXPORT Airline : public Organization { KITINERARY_GADGET(Airline) KITINERARY_PROPERTY(QString, iataCode, setIataCode) }; /** Hotel. * @see https://schema.org/LodgingBusiness */ class KITINERARY_EXPORT LodgingBusiness: public Organization { KITINERARY_GADGET(LodgingBusiness) }; /** Food-related business (such as a restaurant, or a bakery). * @see https://schema.org/FoodEstablishment */ class KITINERARY_EXPORT FoodEstablishment: public Organization { KITINERARY_GADGET(FoodEstablishment) }; } // namespace KItinerary Q_DECLARE_METATYPE(KItinerary::Organization) Q_DECLARE_METATYPE(KItinerary::Airline) Q_DECLARE_METATYPE(KItinerary::FoodEstablishment) Q_DECLARE_METATYPE(KItinerary::LodgingBusiness) #endif // KITINERARY_ORGANIZATION_H