Files
pilotclient/src/blackmisc/weather/weatherdataplugininfo.h
Roland Winklmeier 3d7a39ed00 Fix BlackMisc header includes
* Include only what is used
* Use forward declaration when possible
* Sorted includes

refs #630
2016-05-13 17:05:49 +02:00

79 lines
2.7 KiB
C++

/* Copyright (C) 2016
* swift Project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_WEATHER_WEATHERDATAPLUGININFO_H
#define BLACKMISC_WEATHER_WEATHERDATAPLUGININFO_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/metaclass.h"
#include "blackmisc/valueobject.h"
#include <QJsonObject>
#include <QMetaType>
#include <QString>
namespace BlackMisc
{
namespace Weather
{
//! Describing a weather data plugin
class BLACKMISC_EXPORT CWeatherDataPluginInfo : public BlackMisc::CValueObject<CWeatherDataPluginInfo>
{
public:
//! Default constructor
CWeatherDataPluginInfo() = default;
//! Constructor (used with unit tests)
CWeatherDataPluginInfo(const QString &identifier, const QString &name,
const QString &description, bool valid);
//! \copydoc BlackMisc::CValueObject::convertFromJson
void convertFromJson(const QJsonObject &json);
//! Check if the provided plugin metadata is valid.
//! Weather data plugin has to meet the following requirements:
//! * implements org.swift-project.blackcore.weatherdata;
//! * provides plugin name;
bool isValid() const { return m_valid; }
//! Identifier
const QString &getIdentifier() const { return m_identifier; }
//! Name
const QString &getName() const { return m_name; }
//! Description
const QString &getDescription() const { return m_description; }
//! \copydoc BlackMisc::Mixin::String::toQString
QString convertToQString(bool i18n = false) const;
private:
QString m_identifier;
QString m_name;
QString m_description;
bool m_valid { false };
BLACK_METACLASS(
CWeatherDataPluginInfo,
BLACK_METAMEMBER(identifier, 0, CaseInsensitiveComparison),
BLACK_METAMEMBER(name, 0, DisabledForComparison | DisabledForHashing),
BLACK_METAMEMBER(description, 0, DisabledForComparison | DisabledForHashing),
BLACK_METAMEMBER(valid, 0, DisabledForComparison | DisabledForHashing)
);
};
} // ns
} // ns
Q_DECLARE_METATYPE(BlackMisc::Weather::CWeatherDataPluginInfo)
#endif // guard