diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,7 @@ set(kitinerary_lib_srcs datatypes/action.cpp + datatypes/brand.cpp datatypes/bustrip.cpp datatypes/event.cpp datatypes/flight.cpp @@ -121,6 +122,7 @@ ecm_generate_headers(KItinerary_Datatypes_FORWARDING_HEADERS HEADER_NAMES Action + Brand BusTrip Datatypes Event diff --git a/src/datatypes/rentalcar.h b/src/datatypes/brand.h copy from src/datatypes/rentalcar.h copy to src/datatypes/brand.h --- a/src/datatypes/rentalcar.h +++ b/src/datatypes/brand.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018 Benjamin Port 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 @@ -15,31 +15,30 @@ along with this program. If not, see . */ -#ifndef KITINERARY_RENTALCAR_H -#define KITINERARY_RENTALCAR_H +#ifndef KITINERARY_BRAND_H +#define KITINERARY_BRAND_H #include "kitinerary_export.h" #include "datatypes.h" namespace KItinerary { -class RentalCarPrivate; +class BrandPrivate; -/** An event. - * @see https://developers.google.com/gmail/markup/reference/event-reservation +/** A brand + * @see https://schema.org/Brand */ -class KITINERARY_EXPORT RentalCar +class KITINERARY_EXPORT Brand { - KITINERARY_GADGET(RentalCar) + KITINERARY_GADGET(Brand) KITINERARY_PROPERTY(QString, name, setName) - KITINERARY_PROPERTY(QString, model, setModel) - //Add more info : brand/rentalcompany + private: - QExplicitlySharedDataPointer d; + QExplicitlySharedDataPointer d; }; } -Q_DECLARE_METATYPE(KItinerary::RentalCar) +Q_DECLARE_METATYPE(KItinerary::Brand) -#endif // KITINERARY_RENTALCAR_H +#endif // KITINERARY_BRAND_H diff --git a/src/datatypes/rentalcar.cpp b/src/datatypes/brand.cpp copy from src/datatypes/rentalcar.cpp copy to src/datatypes/brand.cpp --- a/src/datatypes/rentalcar.cpp +++ b/src/datatypes/brand.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Laurent Montel + Copyright (C) 2018 Benjamin Port 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 @@ -15,26 +15,22 @@ along with this program. If not, see . */ -#include "rentalcar.h" +#include "brand.h" #include "datatypes_p.h" -#include -#include - using namespace KItinerary; namespace KItinerary { -class RentalCarPrivate: public QSharedData { - +class BrandPrivate : public QSharedData +{ public: QString name; - QString model; }; -KITINERARY_MAKE_SIMPLE_CLASS(RentalCar) -KITINERARY_MAKE_PROPERTY(RentalCar, QString, name, setName) -KITINERARY_MAKE_PROPERTY(RentalCar, QString, model, setModel) +KITINERARY_MAKE_SIMPLE_CLASS(Brand) +KITINERARY_MAKE_PROPERTY(Brand, QString, name, setName) + } -#include "moc_rentalcar.cpp" +#include "moc_brand.cpp" diff --git a/src/datatypes/place.h b/src/datatypes/place.h --- a/src/datatypes/place.h +++ b/src/datatypes/place.h @@ -81,6 +81,7 @@ KITINERARY_PROPERTY(QString, name, setName) KITINERARY_PROPERTY(KItinerary::PostalAddress, address, setAddress) KITINERARY_PROPERTY(KItinerary::GeoCoordinates, geo, setGeo) + KITINERARY_PROPERTY(QString, telephone, setTelephone) /** Identifier. * We use the following schemas currently: * - 'uic:', UIC station code (see https://www.wikidata.org/wiki/Property:P722) diff --git a/src/datatypes/place.cpp b/src/datatypes/place.cpp --- a/src/datatypes/place.cpp +++ b/src/datatypes/place.cpp @@ -73,13 +73,15 @@ QString name; PostalAddress address; GeoCoordinates geo; + QString telephone; QString identifier; }; KITINERARY_MAKE_BASE_CLASS(Place) KITINERARY_MAKE_PROPERTY(Place, QString, name, setName) KITINERARY_MAKE_PROPERTY(Place, PostalAddress, address, setAddress) KITINERARY_MAKE_PROPERTY(Place, GeoCoordinates, geo, setGeo) +KITINERARY_MAKE_PROPERTY(Place, QString, telephone, setTelephone) KITINERARY_MAKE_PROPERTY(Place, QString, identifier, setIdentifier) diff --git a/src/datatypes/rentalcar.h b/src/datatypes/rentalcar.h --- a/src/datatypes/rentalcar.h +++ b/src/datatypes/rentalcar.h @@ -20,20 +20,24 @@ #include "kitinerary_export.h" #include "datatypes.h" +#include "organization.h" +#include "brand.h" namespace KItinerary { class RentalCarPrivate; -/** An event. - * @see https://developers.google.com/gmail/markup/reference/event-reservation +/** A car rental. + * @see https://developers.google.com/gmail/markup/reference/rental-car */ class KITINERARY_EXPORT RentalCar { KITINERARY_GADGET(RentalCar) KITINERARY_PROPERTY(QString, name, setName) KITINERARY_PROPERTY(QString, model, setModel) - //Add more info : brand/rentalcompany + KITINERARY_PROPERTY(KItinerary::Organization, rentalCompany, setRentalCompany) + KITINERARY_PROPERTY(KItinerary::Brand, brand, setBrand) + private: QExplicitlySharedDataPointer d; }; diff --git a/src/datatypes/rentalcar.cpp b/src/datatypes/rentalcar.cpp --- a/src/datatypes/rentalcar.cpp +++ b/src/datatypes/rentalcar.cpp @@ -30,11 +30,15 @@ public: QString name; QString model; + Organization rentalCompany; + Brand brand; }; KITINERARY_MAKE_SIMPLE_CLASS(RentalCar) KITINERARY_MAKE_PROPERTY(RentalCar, QString, name, setName) KITINERARY_MAKE_PROPERTY(RentalCar, QString, model, setModel) +KITINERARY_MAKE_PROPERTY(RentalCar, Organization, rentalCompany, setRentalCompany) +KITINERARY_MAKE_PROPERTY(RentalCar, Brand, brand, setBrand) } #include "moc_rentalcar.cpp" diff --git a/src/extractorpostprocessor.cpp b/src/extractorpostprocessor.cpp --- a/src/extractorpostprocessor.cpp +++ b/src/extractorpostprocessor.cpp @@ -111,12 +111,6 @@ void ExtractorPostprocessor::process(const QVector &data) { - qDebug() << "======"; - qDebug() << JsonLdDocument::toJson(data); - qDebug() << "-----"; - qDebug() << data; - qDebug() << "~~~~"; - d->m_resultFinalized = false; d->m_data.reserve(d->m_data.size() + data.size()); for (auto elem : data) { @@ -413,7 +407,6 @@ RentalCarReservation ExtractorPostprocessorPrivate::processRentalCarReservation(RentalCarReservation res) const { - qDebug() << JsonLdDocument::toJson({res}); res.setPickupLocation(processPlace(res.pickupLocation())); res.setDropoffLocation(processPlace(res.dropoffLocation())); return processReservation(res); diff --git a/src/jsonlddocument.cpp b/src/jsonlddocument.cpp --- a/src/jsonlddocument.cpp +++ b/src/jsonlddocument.cpp @@ -22,6 +22,7 @@ #include "logging.h" #include +#include #include #include #include @@ -162,6 +163,7 @@ MAKE_FACTORY(Action); MAKE_FACTORY(Airline); MAKE_FACTORY(Airport); + MAKE_FACTORY(Brand); MAKE_FACTORY(BusReservation); MAKE_FACTORY(BusStation); MAKE_FACTORY(BusTrip);