QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsobjectvisitor.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsobjectvisitor.h
3 ---------------
4 begin : October 2025
5 copyright : (C) 2025 by Mathieu Pellerin
6 email : mathieu at opengis dot ch
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 QGSOBJECTVISITOR_H
19#define QGSOBJECTVISITOR_H
20
21#include "qgis.h"
22#include "qgis_core.h"
23
30class CORE_EXPORT QgsEmbeddedScriptEntity
31{
32 public:
37 : mType( type )
38 , mName( name )
39 , mScript( script )
40 {}
41
45 Qgis::EmbeddedScriptType type() const { return mType; }
46
50 QString name() const { return mName; }
51
55 QString script() const { return mScript; }
56
57 private:
59 QString mName;
60 QString mScript;
61};
62
63
72class CORE_EXPORT QgsObjectVisitorContext
73{
74 public:
76};
77
78
88{
89 public:
91
98 virtual bool visitEmbeddedScript( const QgsEmbeddedScriptEntity &entity, const QgsObjectVisitorContext &context )
99 {
100 Q_UNUSED( entity )
101 Q_UNUSED( context )
102 return true;
103 }
104};
105
106
114{
115 public:
117 {
118 mEmbeddedScripts << entity;
119 return true;
120 }
121
123 const QList<QgsEmbeddedScriptEntity> &embeddedScripts() const { return mEmbeddedScripts; }
124
125 private:
126 QList<QgsEmbeddedScriptEntity> mEmbeddedScripts;
127};
128
129#endif // QGSOBJECTVISITOR_H
EmbeddedScriptType
Type of Python Embedded in projects.
Definition qgis.h:463
A embedded script entity for QgsObjectEntityVisitorInterface.
QgsEmbeddedScriptEntity(Qgis::EmbeddedScriptType type, const QString &name, const QString &script)
Constructor for QgsEmbeddedScriptEntity.
QString script() const
Returns the entity's script.
Qgis::EmbeddedScriptType type() const
Returns the entity's embedded script type.
QString name() const
Returns the entity's name.
An object entity visitor to collect embedded scripts wthin a project and its layers.
bool visitEmbeddedScript(const QgsEmbeddedScriptEntity &entity, const QgsObjectVisitorContext &) override
Called when the visitor will visit an embedded script entity.
const QList< QgsEmbeddedScriptEntity > & embeddedScripts() const
Returns the collected embedded scripts.
An interface for classes which can visit various object entity (e.g.
virtual bool visitEmbeddedScript(const QgsEmbeddedScriptEntity &entity, const QgsObjectVisitorContext &context)
Called when the visitor will visit an embedded script entity.
virtual ~QgsObjectEntityVisitorInterface()=default
A QgsObjectEntityVisitorInterface context object.
QgsObjectVisitorContext()=default