You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/core/imetadataplugin.h

76 lines
1.8 KiB
C++

#ifndef IMETADATAPLUGIN_H
#define IMETADATAPLUGIN_H
#include <QString>
#include "core_global.h"
#include "iplugin.h"
class MetaData {
public:
MetaData(const QString& mName, const QString& mId, const QString& mDescription, int mSchemaVersion,
const QStringList& mSchemas, const QStringList& mDependsOn);
[[nodiscard]] const QString& getName() const;
[[nodiscard]] const QString& getId() const;
[[nodiscard]] const QString& getDescription() const;
[[nodiscard]] int getSchemaVersion() const;
[[nodiscard]] const QStringList& getSchemas() const;
[[nodiscard]] const QStringList& getDependsOn() const;
private:
QString m_name;
QString m_id;
QString m_description;
int m_schemaVersion;
QStringList m_schemas;
QStringList m_dependsOn;
};
using MetaDataPtr = QSharedPointer<MetaData>;
class CORESHARED_EXPORT IMetaDataPlugin : public IPlugin
{
public:
IMetaDataPlugin();
~IMetaDataPlugin() override;
// IPlugin interface
public:
QString pluginName() override;
QString pluginId() override;
QString pluginDescription() override;
int schemaVersion() override;
QStringList schemas() override;
QStringList dependsOn() override;
ReportList reports() override;
void init(const QJsonObject &metaData) override;
static MetaDataPtr loadBaseMetaData(const QJsonObject &metaData);
protected:
virtual void initServiceUi() = 0;
virtual void parseMetaData(const QJsonObject &metaData);
private:
QString m_name;
QString m_id;
QString m_description;
int m_schemaVersion;
QStringList m_schemas;
QStringList m_dependsOn;
ReportList m_reports;
static QString parseLocaleText(const QJsonObject &object);
void addCustomReports();
void addReportsFromJson(const QJsonValue &repArray);
};
#endif // IMETADATAPLUGIN_H