QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
36{
37
38 public:
39
45 {
46
47 public:
48
52 ValidationResult( const QString &section, const QString &note, const QVariant &identifier = QVariant() )
53 : section( section )
54 , note( note )
55 , mIdentifier( identifier )
56 {}
57
59 QString section;
60
61 // TODO QGIS 4.0 - remove compatibility code
62
69 QVariant identifier() const SIP_PYNAME( _identifier ) { return mIdentifier; }
70
77 void setIdentifier( const QVariant &identifier ) { mIdentifier = identifier; }
78
80 QString note;
81
82 private:
83
84 QVariant mIdentifier;
85 };
86
88
96 virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const = 0;
97
98};
99
108{
109
110 public:
111
113
114 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
115
116};
117
118
126{
127
128 public:
130
131 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
132
133};
134
143{
144
145 public:
146
148
149 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
150
151};
152
153#endif // QGSLAYERMETADATAVALIDATOR_H
Contains the parameters describing a metadata validation failure.
void setIdentifier(const QVariant &identifier)
Sets the optional identifier for the failed metadata item.
QString section
Metadata section which failed the validation.
QVariant identifier() const
Returns the optional identifier for the failed metadata item.
ValidationResult(const QString &section, const QString &note, const QVariant &identifier=QVariant())
Constructor for ValidationResult.
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.
A validator for the native QGIS layer metadata schema definition.
QgsNativeMetadataValidator()=default
A validator for the native QGIS project metadata schema definition.
#define SIP_PYNAME(name)
Definition qgis_sip.h:81
#define SIP_OUT
Definition qgis_sip.h:58