QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsprojectservervalidator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprojectservervalidator.h
3  ---------------------------
4  begin : March 2020
5  copyright : (C) 2020 by Etienne Trimaille
6  email : etienne dot trimaille 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 QGSPROJECTSERVERVALIDATOR_H
19 #define QGSPROJECTSERVERVALIDATOR_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgslayertreegroup.h"
24 #include "qgslayertree.h"
25 
26 
33 class CORE_EXPORT QgsProjectServerValidator
34 {
35 
36  public:
37 
42 
47  {
48  DuplicatedNames = 0,
49  LayerShortName = 1,
50  LayerEncoding = 2,
51  ProjectShortName = 3,
52  ProjectRootNameConflict = 4,
53  };
54 
60  static QString displayValidationError( QgsProjectServerValidator::ValidationError error );
61 
66  {
67 
71  ValidationResult( const QgsProjectServerValidator::ValidationError error, const QVariant &identifier )
72  : error( error )
73  , identifier( identifier )
74  {}
75 
80 
84  QVariant identifier;
85  };
86 
95  static bool validate( QgsProject *project, QList< QgsProjectServerValidator::ValidationResult > &results SIP_OUT );
96 
97  private:
98  static void browseLayerTree( QgsLayerTreeGroup *treeGroup, QStringList &owsNames, QStringList &encodingMessages );
99 
100 };
101 
102 #endif // QGSPROJECTSERVERVALIDATOR_H
SIP_OUT
#define SIP_OUT
Definition: qgis_sip.h:58
QgsProjectServerValidator::ValidationResult::error
QgsProjectServerValidator::ValidationError error
Error which occurred during the validation process.
Definition: qgsprojectservervalidator.h:79
QgsProjectServerValidator::ValidationError
ValidationError
Errors that might be raised by the validation process.
Definition: qgsprojectservervalidator.h:47
QgsProjectServerValidator::ValidationResult::ValidationResult
ValidationResult(const QgsProjectServerValidator::ValidationError error, const QVariant &identifier)
Constructor for ValidationResult.
Definition: qgsprojectservervalidator.h:71
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:95
QgsProjectServerValidator::ValidationResult
Contains the parameters describing a project validation failure.
Definition: qgsprojectservervalidator.h:66
qgslayertreegroup.h
qgis_sip.h
QgsLayerTreeGroup
Layer tree group node serves as a container for layers and further groups.
Definition: qgslayertreegroup.h:35
QgsProjectServerValidator::QgsProjectServerValidator
QgsProjectServerValidator()=default
Constructor for QgsProjectServerValidator.
QgsProjectServerValidator::ValidationResult::identifier
QVariant identifier
Identifier related to the error.
Definition: qgsprojectservervalidator.h:84
qgslayertree.h
QgsProjectServerValidator
Validates the server specific parts of the configuration of a QGIS project.
Definition: qgsprojectservervalidator.h:34