QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsabstractvaliditycheck.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsabstractvaliditycheck.h
3 --------------------------
4 begin : November 2018
5 copyright : (C) 2018 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSABSTRACTVALIDITYCHECK_H
16#define QGSABSTRACTVALIDITYCHECK_H
17
18#include "qgis_core.h"
19#include "qgis_sip.h"
20#include <QString>
21#include <QObject>
22
24class QgsFeedback;
25
37class CORE_EXPORT QgsValidityCheckResult
38{
39 public:
40
42 enum Type
43 {
46 };
47
50
54 QString title;
55
61
65 QString checkId;
66
67};
68
92class CORE_EXPORT QgsAbstractValidityCheck
93{
94
95 public:
96
97 // *INDENT-OFF*
100 {
101 LayoutCheck SIP_MONKEYPATCH_COMPAT_NAME( TypeLayoutCheck ) = 0,
102 UserCheck SIP_MONKEYPATCH_COMPAT_NAME( TypeUserCheck ) = 10000,
103 };
104 // *INDENT-ON*
105
106 virtual ~QgsAbstractValidityCheck() = default;
107
112
118 virtual QString id() const = 0;
119
123 virtual int checkType() const = 0;
124
139 virtual bool prepareCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback )
140 {
141 Q_UNUSED( context )
142 Q_UNUSED( feedback )
143 return true;
144 }
145
158 virtual QList< QgsValidityCheckResult > runCheck( const QgsValidityCheckContext *context, QgsFeedback *feedback ) = 0;
159
160};
161
162#endif // QGSABSTRACTVALIDITYCHECK_H
Abstract base class for individual validity checks.
virtual bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)
Prepares the check for execution, and returns true if the check can be run.
virtual QString id() const =0
Returns the unique ID of the check.
virtual int checkType() const =0
Returns the type of the check.
virtual QgsAbstractValidityCheck * create() const =0
Creates a new instance of the check and returns it.
virtual QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback)=0
Runs the check and returns a list of results.
virtual ~QgsAbstractValidityCheck()=default
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Base class for validity check contexts.
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass.
@ Critical
Critical error - notify user of result and prevent operation from proceeding.
@ Warning
Warning only, allow operation to proceed but notify user of result.
QString checkId
ID of the check which generated the result.
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
QString title
A short, translated string summarising the result.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:271
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:273