diff --git a/autotests/unstructureddata/aohostels_1.json b/autotests/unstructureddata/aohostels_1.json index c5d0bd9..998bc7c 100644 --- a/autotests/unstructureddata/aohostels_1.json +++ b/autotests/unstructureddata/aohostels_1.json @@ -1,29 +1,31 @@ [ { "@context": "http://schema.org", "@type": "LodgingReservation", "checkinTime": "2018-08-10T15:00:00", "checkoutTime": "2018-08-18T10:00:00", "reservationFor": { "@type": "LodgingBusiness", "address": { "@type": "PostalAddress", "addressCountry": "Österreich", "addressLocality": "Wien", "postalCode": "1100", "streetAddress": "Sonnwendgasse 11" }, "geo": { "@type": "GeoCoordinates", "latitude": 48.1828498840332, "longitude": 16.37863540649414 }, - "name": "a&o Wien Hauptbahnhof" + "email": "AO-XX-XX@aohostels.com", + "name": "a&o Wien Hauptbahnhof", + "telephone": "+43 1 602 1234 5678" }, "reservationNumber": "AOI-XX-1234567", "underName": { "@type": "Person", "name": "John Doe" } } ] diff --git a/src/datatypes/organization.cpp b/src/datatypes/organization.cpp index cd73b8f..193005d 100644 --- a/src/datatypes/organization.cpp +++ b/src/datatypes/organization.cpp @@ -1,75 +1,77 @@ /* 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 email; QString telephone; QUrl url; PostalAddress address; + GeoCoordinates geo; }; KITINERARY_MAKE_BASE_CLASS(Organization) KITINERARY_MAKE_PROPERTY(Organization, QString, name, setName) 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) class AirlinePrivate : public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(Airline) public: QString iataCode; }; KITINERARY_MAKE_SUB_CLASS(Airline, Organization) KITINERARY_MAKE_PROPERTY(Airline, QString, iataCode, setIataCode) class FoodEstablishmentPrivate: public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(FoodEstablishment) }; KITINERARY_MAKE_SUB_CLASS(FoodEstablishment, Organization) class LodgingBusinessPrivate : public OrganizationPrivate { KITINERARY_PRIVATE_GADGET(LodgingBusiness) }; KITINERARY_MAKE_SUB_CLASS(LodgingBusiness, Organization) } 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 5e5069b..712263f 100644 --- a/src/datatypes/organization.h +++ b/src/datatypes/organization.h @@ -1,85 +1,86 @@ /* 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 * @see https://schema.org/Organization */ class KITINERARY_EXPORT Organization { KITINERARY_BASE_GADGET(Organization) KITINERARY_PROPERTY(QString, name, setName) 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) 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