QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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
Layer tree group node serves as a container for layers and further groups.
Validates the server specific parts of the configuration of a QGIS project.
QgsProjectServerValidator()=default
Constructor for QgsProjectServerValidator.
ValidationError
Errors that might be raised by the validation process.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:101
#define SIP_OUT
Definition: qgis_sip.h:58
Contains the parameters describing a project validation failure.
ValidationResult(const QgsProjectServerValidator::ValidationError error, const QVariant &identifier)
Constructor for ValidationResult.
QVariant identifier
Identifier related to the error.
QgsProjectServerValidator::ValidationError error
Error which occurred during the validation process.