QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgslayermetadatavalidator.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayermetadatavalidator.h
3 ---------------------------
4 begin : April 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLAYERMETADATAVALIDATOR_H
19#define QGSLAYERMETADATAVALIDATOR_H
20
21#include "qgis_sip.h"
22#include "qgis_core.h"
23#include <QString>
24#include <QVariant>
25
28
37{
38
39 public:
40
47 {
48
49 public:
50
54 ValidationResult( const QString &section, const QString &note, const QVariant &identifier = QVariant() )
55 : section( section )
56 , note( note )
57 , mIdentifier( identifier )
58 {}
59
61 QString section;
62
63 // TODO QGIS 4.0 - fix this
64
65#ifdef SIP_RUN
66 SIP_PROPERTY( name = identifier, get = _identifier, set = _setIdentifier )
67#endif
68
75 QVariant _identifier() const { return mIdentifier; }
76
83 void _setIdentifier( QVariant identifier ) { mIdentifier = identifier; }
84
86 QString note;
87
88 private:
89
90 QVariant mIdentifier;
91 };
92
94
102 virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const = 0;
103
104};
105
114{
115
116 public:
117
122
123 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
124
125};
126
127
136{
137
138 public:
139
144
145 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
146
147};
148
157{
158
159 public:
160
165
166 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
167
168};
169
170#endif // QGSLAYERMETADATAVALIDATOR_H
Contains the parameters describing a metadata validation failure.
void _setIdentifier(QVariant identifier)
Sets the optional identifier for the failed metadata item.
QString section
Metadata section which failed the validation.
ValidationResult(const QString &section, const QString &note, const QVariant &identifier=QVariant())
Constructor for ValidationResult.
QVariant _identifier() const
Returns the optional identifier for the failed metadata item.
QString note
The reason behind the validation failure.
Abstract base class for metadata validators.
virtual ~QgsAbstractMetadataBaseValidator()=default
virtual bool validate(const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results) const =0
Validates a metadata object, and returns true if the metadata is considered valid.
An abstract base class for metadata stores.
A structured metadata store for a map layer.
A validator for the native base QGIS metadata schema definition.
QgsNativeMetadataBaseValidator()=default
Constructor for QgsNativeMetadataBaseValidator.
A validator for the native QGIS layer metadata schema definition.
QgsNativeMetadataValidator()=default
Constructor for QgsNativeMetadataValidator.
A validator for the native QGIS project metadata schema definition.
QgsNativeProjectMetadataValidator()=default
Constructor for QgsNativeProjectMetadataValidator.
#define SIP_PROPERTY(name, getter, setter)
Definition: qgis_sip.h:273
#define SIP_OUT
Definition: qgis_sip.h:58