Skip to content
Permalink
Browse files

Code shuffle to avoid duplicate code

  • Loading branch information
nyalldawson committed Mar 19, 2018
1 parent 99faf06 commit d293c5d0a03924cbf174909d472017e86139f994
@@ -169,10 +169,10 @@
%Include layout/qgslayoututils.sip
%Include layout/qgsreportsectionfieldgroup.sip
%Include layout/qgsreportsectionlayout.sip
%Include metadata/qgsabstractmetadatabase.sip
%Include metadata/qgslayermetadata.sip
%Include metadata/qgslayermetadatavalidator.sip
%Include metadata/qgslayermetadataformatter.sip
%Include metadata/qgsmetadatabase.sip
%Include metadata/qgsprojectmetadata.sip
%Include processing/qgsprocessing.sip
%Include processing/qgsprocessingalgorithm.sip
@@ -1,7 +1,7 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/metadata/qgsmetadatabase.h *
* src/core/metadata/qgsabstractmetadatabase.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -10,38 +10,39 @@



class QgsMetadataBase
class QgsAbstractMetadataBase
{
%Docstring
A base class for metadata stores.
An abstract base class for metadata stores.

QgsMetadataBase is the base class for handling storage and management of the metadata
QgsAbstractMetadataBase is the base class for handling storage and management of the metadata
for various map related assets. This class is an internal QGIS format with a common
metadata structure. It is subclassed by layer and project specific metadata classes,
QgsLayerMetadata and QgsProjectMetadata.
such as QgsLayerMetadata and QgsProjectMetadata.

The metadata store is designed to be compatible with the Dublin Core metadata
specifications, and will be expanded to allow compatibility with ISO specifications
in future releases. However, the QGIS internal schema does not represent a superset
of all existing metadata schemas and accordingly conversion from specific
metadata formats to QgsMetadataBase may result in a loss of information.
metadata formats to QgsAbstractMetadataBase may result in a loss of information.

This class is designed to follow the specifications detailed in
the schema definition available at resources/qgis-resource-metadata.xsd
within the QGIS source code.

Metadata can be validated through the use of QgsMetadataBaseValidator
Metadata can be validated through the use of QgsAbstractMetadataBaseValidator
subclasses. E.g. validating against the native QGIS metadata schema can be performed
using QgsNativeMetadataValidator.

.. versionadded:: 3.2
%End

%TypeHeaderCode
#include "qgsmetadatabase.h"
#include "qgsabstractmetadatabase.h"
%End
public:


typedef QMap< QString, QStringList > KeywordMap;

struct Address
@@ -64,7 +65,7 @@ Constructor for Address.

QString country;

bool operator==( const QgsMetadataBase::Address &other ) const;
bool operator==( const QgsAbstractMetadataBase::Address &other ) const;
};

struct Contact
@@ -81,7 +82,7 @@ Constructor for Contact.

QString position;

QList< QgsMetadataBase::Address > addresses;
QList< QgsAbstractMetadataBase::Address > addresses;

QString voice;

@@ -91,10 +92,10 @@ Constructor for Contact.

QString role;

bool operator==( const QgsMetadataBase::Contact &other ) const;
bool operator==( const QgsAbstractMetadataBase::Contact &other ) const;
};

typedef QList< QgsMetadataBase::Contact > ContactList;
typedef QList< QgsAbstractMetadataBase::Contact > ContactList;


struct Link
@@ -119,17 +120,12 @@ Constructor for Link.

QString size;

bool operator==( const QgsMetadataBase::Link &other ) const;
bool operator==( const QgsAbstractMetadataBase::Link &other ) const;
};

typedef QList< QgsMetadataBase::Link > LinkList;
typedef QList< QgsAbstractMetadataBase::Link > LinkList;

QgsMetadataBase();
%Docstring
Constructor for QgsMetadataBase.
%End

virtual ~QgsMetadataBase();
virtual ~QgsAbstractMetadataBase();

QString identifier() const;
%Docstring
@@ -250,7 +246,7 @@ Adds a single history ``text`` to the end of the existing history list.
.. seealso:: :py:func:`setHistory`
%End

KeywordMap keywords() const;
QgsAbstractMetadataBase::KeywordMap keywords() const;
%Docstring
Returns the keywords map, which is a set of descriptive keywords associated with the resource.

@@ -264,7 +260,7 @@ associated with keyword list.
.. seealso:: :py:func:`keywordVocabularies`
%End

void setKeywords( const KeywordMap &keywords );
void setKeywords( const QgsAbstractMetadataBase::KeywordMap &keywords );
%Docstring
Sets the ``keywords`` map, which is a set of descriptive keywords associated with the resource.

@@ -338,14 +334,14 @@ Categories are stored using a special vocabulary 'gmd:topicCategory' in keywords
.. seealso:: :py:func:`keywords`
%End

QgsMetadataBase::ContactList contacts() const;
QgsAbstractMetadataBase::ContactList contacts() const;
%Docstring
Returns a list of contact persons or entities associated with the resource.

.. seealso:: :py:func:`setContacts`
%End

void setContacts( const QgsMetadataBase::ContactList &contacts );
void setContacts( const QgsAbstractMetadataBase::ContactList &contacts );
%Docstring
Sets the list of ``contacts`` or entities associated with the resource. Any existing contacts
will be replaced.
@@ -355,7 +351,7 @@ will be replaced.
.. seealso:: :py:func:`addContact`
%End

void addContact( const QgsMetadataBase::Contact &contact );
void addContact( const QgsAbstractMetadataBase::Contact &contact );
%Docstring
Adds an individual ``contact`` to the existing contacts.

@@ -364,14 +360,14 @@ Adds an individual ``contact`` to the existing contacts.
.. seealso:: :py:func:`setContacts`
%End

QgsMetadataBase::LinkList links() const;
QgsAbstractMetadataBase::LinkList links() const;
%Docstring
Returns a list of online resources associated with the resource.

.. seealso:: :py:func:`setLinks`
%End

void setLinks( const QgsMetadataBase::LinkList &links );
void setLinks( const QgsAbstractMetadataBase::LinkList &links );
%Docstring
Sets the list of online resources associated with the resource. Any existing links
will be replaced.
@@ -381,7 +377,7 @@ will be replaced.
.. seealso:: :py:func:`addLink`
%End

void addLink( const QgsMetadataBase::Link &link );
void addLink( const QgsAbstractMetadataBase::Link &link );
%Docstring
Adds an individual ``link`` to the existing links.

@@ -390,43 +386,65 @@ Adds an individual ``link`` to the existing links.
.. seealso:: :py:func:`setLinks`
%End

bool readMetadataXml( const QDomElement &metadataElement );
virtual bool readMetadataXml( const QDomElement &metadataElement );
%Docstring
Sets state from Dom document
Sets state from DOM document.

:param metadataElement: The Dom element corresponding to ``resourceMetadata'' tag
:param metadataElement: The DOM element corresponding to ``resourceMetadata'' tag

:return: true if successful

Subclasses which override this method should take care to also call the base
class method in order to read common metadata properties.
%End

bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
virtual bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
%Docstring
Stores state in Dom node
Stores state in a DOM node.

:param metadataElement: is a Dom element corresponding to ``resourceMetadata'' tag
:param document: is a the dom document being written
:param metadataElement: is a DOM element corresponding to ``resourceMetadata'' tag
:param document: is a the DOM document being written

:return: true if successful
%End

bool operator==( const QgsMetadataBase &metadataOther ) const;
Subclasses which override this method should take care to also call the base
class method in order to write common metadata properties.
%End

protected:

QgsAbstractMetadataBase();
%Docstring
Constructor for QgsAbstractMetadataBase.

QgsAbstractMetadataBase cannot be instantiated directly, it must be subclassed.
%End









bool equals( const QgsAbstractMetadataBase &other ) const;
%Docstring
Tests whether the common metadata fields in this object are equal to ``other``.

Subclasses should utilise this method from their equality operators to test
equality of base class members.

.. versionadded:: 3.2
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/core/metadata/qgsmetadatabase.h *
* src/core/metadata/qgsabstractmetadatabase.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -10,7 +10,7 @@



class QgsLayerMetadata : QgsMetadataBase
class QgsLayerMetadata : QgsAbstractMetadataBase
{
%Docstring
A structured metadata store for a map layer.
@@ -42,9 +42,6 @@ using QgsNativeMetadataValidator.
%End
public:


typedef QgsMetadataBase::KeywordMap KeywordMap;

struct SpatialExtent
{

@@ -113,21 +110,6 @@ Constructor for Constraint.

typedef QList< QgsLayerMetadata::Constraint > ConstraintList;


typedef QgsMetadataBase::Address Address;


typedef QgsMetadataBase::Contact Contact;


typedef QgsMetadataBase::ContactList ContactList;


typedef QgsMetadataBase::Link Link;


typedef QgsMetadataBase::LinkList LinkList;

QgsLayerMetadata();
%Docstring
Constructor for QgsLayerMetadata.
@@ -286,24 +268,10 @@ Reads the metadata state from a ``layer``'s custom properties (see QgsMapLayer.c
.. seealso:: :py:func:`saveToLayer`
%End

bool readMetadataXml( const QDomElement &metadataElement );
%Docstring
Sets state from Dom document
virtual bool readMetadataXml( const QDomElement &metadataElement );

:param metadataElement: The Dom element corresponding to ``resourceMetadata'' tag

:return: true if successful
%End
virtual bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;

bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
%Docstring
Stores state in Dom node

:param metadataElement: is a Dom element corresponding to ``resourceMetadata'' tag
:param document: is a the dom document being written

:return: true if successful
%End

bool operator==( const QgsLayerMetadata &metadataOther ) const;

@@ -11,7 +11,7 @@



class QgsMetadataValidator
class QgsAbstractMetadataBaseValidator
{
%Docstring
Abstract base class for metadata validators.
@@ -39,9 +39,9 @@ Constructor for ValidationResult.
QString note;
};

virtual ~QgsMetadataValidator();
virtual ~QgsAbstractMetadataBaseValidator();

virtual bool validate( const QgsMetadataBase *metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const = 0;
virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results /Out/ ) const = 0;
%Docstring
Validates a ``metadata`` object, and returns true if the
metadata is considered valid.
@@ -53,7 +53,7 @@ to fix the metadata.
};


class QgsNativeMetadataBaseValidator : QgsMetadataValidator
class QgsNativeMetadataBaseValidator : QgsAbstractMetadataBaseValidator
{
%Docstring
A validator for the native base QGIS metadata schema definition.
@@ -71,7 +71,7 @@ class QgsNativeMetadataBaseValidator : QgsMetadataValidator
Constructor for QgsNativeMetadataBaseValidator.
%End

virtual bool validate( const QgsMetadataBase *metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const;
virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results /Out/ ) const;


};
@@ -96,7 +96,7 @@ class QgsNativeMetadataValidator : QgsNativeMetadataBaseValidator
Constructor for QgsNativeMetadataValidator.
%End

virtual bool validate( const QgsMetadataBase *metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const;
virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results /Out/ ) const;


};
@@ -120,7 +120,7 @@ class QgsNativeProjectMetadataValidator : QgsNativeMetadataBaseValidator
Constructor for QgsNativeProjectMetadataValidator.
%End

virtual bool validate( const QgsMetadataBase *metadata, QList< QgsMetadataValidator::ValidationResult > &results /Out/ ) const;
virtual bool validate( const QgsAbstractMetadataBase *metadata, QList< QgsAbstractMetadataBaseValidator::ValidationResult > &results /Out/ ) const;


};

0 comments on commit d293c5d

Please sign in to comment.
You can’t perform that action at this time.