File indexing completed on 2024-05-05 16:49:22

0001 /*
0002  * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com>
0003  * SPDX-FileCopyrightText: 2020 Devin Lin <espidev@gmail.com>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 #include <QMetaType>
0010 #include <QString>
0011 #include <kweathercore/kweathercore_export.h>
0012 #include <memory>
0013 namespace KWeatherCore
0014 {
0015 /**
0016  * @short Class represents location query result
0017  *
0018  * This is a class to hold general information about a location
0019  *
0020  * @see LocationQuery
0021  *
0022  * @author Han Young <hanyoung@protonmail.com>
0023  */
0024 class KWEATHERCORE_EXPORT LocationQueryResult
0025 {
0026     Q_GADGET
0027     Q_PROPERTY(qreal latitude READ latitude)
0028     Q_PROPERTY(qreal longitude READ longitude)
0029     Q_PROPERTY(QString toponymName READ toponymName)
0030     Q_PROPERTY(QString name READ name)
0031     Q_PROPERTY(QString countryCode READ countryCode)
0032     Q_PROPERTY(QString countryName READ countryName)
0033     Q_PROPERTY(QString geonameId READ geonameId)
0034 public:
0035     // for QMetaType
0036     LocationQueryResult();
0037     /**
0038      * LocationQueryResult construct location result with given data
0039      * @param latitude latitude
0040      * @param longitude longitude
0041      * @param toponymName toponym name of location, detailed
0042      * @param name display name, short
0043      * @param countryCode country code, follow no standard but should be unique
0044      * @param countryName country name
0045      * @param geonameId internal unique id
0046      */
0047     LocationQueryResult(double latitude,
0048                         double longitude,
0049                         QString toponymName = QString(),
0050                         QString name = QString(),
0051                         QString countryCode = QString(),
0052                         QString countryName = QString(),
0053                         QString geonameId = QString());
0054     LocationQueryResult(const LocationQueryResult &other);
0055     LocationQueryResult(LocationQueryResult &&other);
0056     ~LocationQueryResult();
0057     LocationQueryResult &operator=(const LocationQueryResult &other);
0058     LocationQueryResult &operator=(LocationQueryResult &&other);
0059     double latitude() const;
0060 
0061     double longitude() const;
0062     /**
0063      * toponym name of location, detailed
0064      */
0065     const QString &toponymName() const;
0066     /**
0067      * display name, short
0068      */
0069     const QString &name() const;
0070     /**
0071      * country code, follow no standard but should be unique
0072      */
0073     const QString &countryCode() const;
0074     /**
0075      * country name
0076      */
0077     const QString &countryName() const;
0078     /**
0079      * internal unique id
0080      */
0081     const QString &geonameId() const;
0082 
0083 private:
0084     class LocationQueryResultPrivate;
0085     std::unique_ptr<LocationQueryResultPrivate> d;
0086 };
0087 }
0088 Q_DECLARE_METATYPE(KWeatherCore::LocationQueryResult)