-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a new abstract base class QgsMetadataValidator for validating metadata against standard schemas. Initially only QgsNativeMetadataValidator for validating against the native QGIS metadata schema is implemented. In future this could be extended with Dublin Core, ISO 19115 validators, etc...
- Loading branch information
1 parent
cc3d67a
commit 5600395
Showing
8 changed files
with
463 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/metadata/qgslayermetadatavalidator.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsMetadataValidator | ||
{ | ||
%Docstring | ||
Abstract base class for metadata validators. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayermetadatavalidator.h" | ||
%End | ||
public: | ||
|
||
struct ValidationResult | ||
{ | ||
|
||
ValidationResult( const QString §ion, const QString ¬e, const QVariant &identifier = QVariant() ); | ||
%Docstring | ||
Constructor for ValidationResult. | ||
%End | ||
|
||
QString section; | ||
%Docstring | ||
Metadata section which failed the validation | ||
%End | ||
|
||
QVariant identifier; | ||
%Docstring | ||
Optional identifier for the failed metadata item. | ||
For instance, in list type metadata elements this | ||
will be set to the list index of the failed metadata | ||
item. | ||
%End | ||
|
||
QString note; | ||
%Docstring | ||
The reason behind the validation failure. | ||
%End | ||
}; | ||
|
||
virtual ~QgsMetadataValidator(); | ||
|
||
virtual bool validate( const QgsLayerMetadata &metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const = 0; | ||
%Docstring | ||
Validates a ``metadata`` object, and returns true if the | ||
metadata is considered valid. | ||
If validation fails, the ``results`` list will be filled with a list of | ||
items describing why the validation failed and what needs to be rectified | ||
to fix the metadata. | ||
:rtype: bool | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
class QgsNativeMetadataValidator : QgsMetadataValidator | ||
{ | ||
%Docstring | ||
A validator for the native QGIS metadata schema definition. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayermetadatavalidator.h" | ||
%End | ||
public: | ||
|
||
QgsNativeMetadataValidator(); | ||
%Docstring | ||
Constructor for QgsNativeMetadataValidator. | ||
%End | ||
|
||
virtual bool validate( const QgsLayerMetadata &metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const; | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/metadata/qgslayermetadatavalidator.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.