QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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_core.h"
22#include "qgis_sip.h"
23
24#include <QString>
25#include <QVariant>
26
29
35
37{
38
39 public:
40
46 {
47
48 public:
49
53 ValidationResult( const QString &section, const QString &note, const QVariant &identifier = QVariant() )
54 : section( section )
55 , note( note )
56 , mIdentifier( identifier )
57 {}
58
60 QString section;
61
62 // TODO QGIS 4.0 - remove compatibility code
63
70 QVariant identifier() const SIP_PYNAME( _identifier ) { return mIdentifier; }
71
78 void setIdentifier( const QVariant &identifier ) { mIdentifier = identifier; }
79
81 QString note;
82
83 private:
84
85 QVariant mIdentifier;
86 };
87
89
97 virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const = 0;
98
99};
100
107
109{
110
111 public:
112
114
115 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
116
117};
118
119
125
127{
128
129 public:
131
132 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
133
134};
135
142
144{
145
146 public:
147
149
150 bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results SIP_OUT ) const override;
151
152};
153
154#endif // QGSLAYERMETADATAVALIDATOR_H
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.
bool validate(const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results) const override
Validates a metadata object, and returns true if the metadata is considered valid.
bool validate(const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results) const override
Validates a metadata object, and returns true if the metadata is considered valid.
QgsNativeMetadataValidator()=default
bool validate(const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results) const override
Validates a metadata object, and returns true if the metadata is considered valid.
#define SIP_PYNAME(name)
Definition qgis_sip.h:89
#define SIP_OUT
Definition qgis_sip.h:58