QGIS API Documentation  3.0.2-Girona (307d082)
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.h"
22 #include "qgis_core.h"
23 
24 class QgsLayerMetadata;
25 
33 class CORE_EXPORT QgsMetadataValidator
34 {
35 
36  public:
37 
43  {
44 
48  ValidationResult( const QString &section, const QString &note, const QVariant &identifier = QVariant() )
49  : section( section )
50  , identifier( identifier )
51  , note( note )
52  {}
53 
55  QString section;
56 
63  QVariant identifier;
64 
66  QString note;
67  };
68 
69  virtual ~QgsMetadataValidator() = default;
70 
78  virtual bool validate( const QgsLayerMetadata &metadata, QList< QgsMetadataValidator::ValidationResult > &results SIP_OUT ) const = 0;
79 
80 };
81 
82 
91 {
92 
93  public:
94 
98  QgsNativeMetadataValidator() = default;
99 
100  bool validate( const QgsLayerMetadata &metadata, QList< QgsMetadataValidator::ValidationResult > &results SIP_OUT ) const override;
101 
102 };
103 
104 #endif // QGSLAYERMETADATAVALIDATOR_H
Contains the parameters describing a metadata validation failure.
A validator for the native QGIS metadata schema definition.
QString section
Metadata section which failed the validation.
QString note
The reason behind the validation failure.
Abstract base class for metadata validators.
A structured metadata store for a map layer.
#define SIP_OUT
Definition: qgis_sip.h:51
QVariant identifier
Optional identifier for the failed metadata item.
ValidationResult(const QString &section, const QString &note, const QVariant &identifier=QVariant())
Constructor for ValidationResult.