Skip to content
Permalink
Browse files

Refactor QgsExpressionContext and move QgsExpressionContextUtils

out to its own header

Avoids slow recompilation caused by changes to the frequently
modified QgsExpressionContextUtils class
  • Loading branch information
nyalldawson committed Feb 12, 2019
1 parent d281c8a commit 69f45e389c289e2c4e69f0bcd08196df63d2827a
Showing with 1,635 additions and 1,464 deletions.
  1. +334 −0 python/core/auto_generated/expression/qgsexpressioncontextutils.sip.in
  2. +0 −318 python/core/auto_generated/qgsexpressioncontext.sip.in
  3. +1 −0 python/core/auto_generated/qgsmultirenderchecker.sip.in
  4. +1 −0 python/core/core_auto.sip
  5. +1 −0 src/analysis/processing/qgsalgorithmcategorizeusingstyle.cpp
  6. +1 −0 src/app/layout/qgslayoutpropertieswidget.cpp
  7. +1 −0 src/app/locator/qgsinbuiltlocatorfilters.cpp
  8. +1 −0 src/app/qgsattributeactionpropertiesdialog.cpp
  9. +1 −1 src/app/qgsattributetabledialog.cpp
  10. +1 −0 src/app/qgsattributetypedialog.cpp
  11. +1 −0 src/app/qgsdiagramproperties.cpp
  12. +15 −14 src/app/qgsfieldcalculator.cpp
  13. +1 −0 src/app/qgsgeometryvalidationmodel.cpp
  14. +1 −0 src/app/qgsidentifyresultsdialog.cpp
  15. +1 −0 src/app/qgslabelinggui.cpp
  16. +1 −0 src/app/qgslabelpropertydialog.cpp
  17. +1 −0 src/app/qgsmapsavedialog.cpp
  18. +1 −0 src/app/qgsmaptooladdfeature.cpp
  19. +1 −0 src/app/qgsmaptoolfeatureaction.cpp
  20. +1 −0 src/app/qgsmaptoolpointsymbol.cpp
  21. +1 −0 src/app/qgsmaptoolselectutils.cpp
  22. +1 −0 src/app/qgsoptions.cpp
  23. +1 −0 src/app/qgspointmarkeritem.cpp
  24. +1 −0 src/app/qgsprojectproperties.cpp
  25. +1 −0 src/app/qgsrulebasedlabelingwidget.cpp
  26. +1 −0 src/app/qgsselectbyformdialog.cpp
  27. +1 −0 src/app/qgssourcefieldsproperties.cpp
  28. +1 −0 src/app/qgsstatisticalsummarydockwidget.cpp
  29. +1 −0 src/app/qgsvectorlayerproperties.cpp
  30. +2 −0 src/core/CMakeLists.txt
  31. +1 −0 src/core/annotations/qgshtmlannotation.cpp
  32. +1 −0 src/core/dxf/qgsdxfexport.cpp
  33. +1 −1 src/core/expression/qgsexpression.cpp
  34. +841 −0 src/core/expression/qgsexpressioncontextutils.cpp
  35. +307 −0 src/core/expression/qgsexpressioncontextutils.h
  36. +2 −0 src/core/expression/qgsexpressionfunction.cpp
  37. +1 −0 src/core/fieldformatter/qgsrelationreferencefieldformatter.cpp
  38. +1 −0 src/core/fieldformatter/qgsvaluerelationfieldformatter.cpp
  39. +1 −0 src/core/layertree/qgslayertreemodellegendnode.cpp
  40. +1 −1 src/core/layout/qgscompositionconverter.h
  41. +1 −0 src/core/layout/qgslayout.cpp
  42. +1 −0 src/core/layout/qgslayoutatlas.cpp
  43. +1 −0 src/core/layout/qgslayoutframe.cpp
  44. +2 −0 src/core/layout/qgslayoutitem.cpp
  45. +1 −0 src/core/layout/qgslayoutitemattributetable.cpp
  46. +1 −0 src/core/layout/qgslayoutitemmap.cpp
  47. +1 −0 src/core/layout/qgslayoutobject.cpp
  48. +1 −0 src/core/layout/qgsprintlayout.cpp
  49. +1 −0 src/core/processing/models/qgsprocessingmodelalgorithm.cpp
  50. +2 −0 src/core/processing/qgsprocessingalgorithm.cpp
  51. +1 −0 src/core/processing/qgsprocessingparameters.h
  52. +1 −0 src/core/processing/qgsprocessingutils.h
  53. +1 −0 src/core/providers/memory/qgsmemoryfeatureiterator.cpp
  54. +1 −0 src/core/qgsaction.cpp
  55. +1 −0 src/core/qgsactionmanager.cpp
  56. +1 −839 src/core/qgsexpressioncontext.cpp
  57. +1 −290 src/core/qgsexpressioncontext.h
  58. +1 −0 src/core/qgslabelingengine.cpp
  59. +1 −0 src/core/qgslegendrenderer.cpp
  60. +1 −0 src/core/qgsmaphittest.cpp
  61. +1 −0 src/core/qgsmaprendererjob.cpp
  62. +2 −0 src/core/qgsmultirenderchecker.h
  63. +1 −0 src/core/qgsogcutils.cpp
  64. +1 −0 src/core/qgspointlocator.cpp
  65. +1 −0 src/core/qgsproject.cpp
  66. +1 −0 src/core/qgstracer.cpp
  67. +1 −0 src/core/qgsvectorfilewriter.cpp
  68. +1 −0 src/core/qgsvectorlayer.cpp
  69. +1 −0 src/core/qgsvectorlayerfeatureiterator.cpp
  70. +1 −0 src/core/qgsvectorlayerlabelprovider.cpp
  71. +1 −0 src/core/qgsvectorlayerrenderer.cpp
  72. +1 −0 src/core/qgsvectorlayerutils.cpp
  73. +1 −0 src/core/symbology/qgscategorizedsymbolrenderer.cpp
  74. +1 −0 src/core/symbology/qgsgraduatedsymbolrenderer.cpp
  75. +1 −0 src/core/symbology/qgssymbol.cpp
  76. +1 −0 src/core/symbology/qgssymbollayerutils.cpp
  77. +2 −0 src/gui/attributetable/qgsattributetablefiltermodel.cpp
  78. +1 −0 src/gui/attributetable/qgsattributetablemodel.cpp
  79. +1 −0 src/gui/attributetable/qgsdualview.cpp
  80. +1 −0 src/gui/attributetable/qgsfieldconditionalformatwidget.cpp
  81. +1 −0 src/gui/editorwidgets/core/qgseditorconfigwidget.cpp
  82. +1 −0 src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp
  83. +2 −0 src/gui/editorwidgets/qgsqmlwidgetwrapper.cpp
  84. +1 −0 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  85. +1 −0 src/gui/editorwidgets/qgsvaluerelationconfigdlg.cpp
  86. +1 −0 src/gui/layout/qgslayoutitemwidget.cpp
  87. +1 −0 src/gui/layout/qgslayoutitemwidget.h
  88. +1 −0 src/gui/processing/qgsprocessingmodelerparameterwidget.cpp
  89. +2 −0 src/gui/processing/qgsprocessingwidgetwrapper.cpp
  90. +1 −0 src/gui/qgsattributeform.cpp
  91. +1 −0 src/gui/qgsexpressionbuilderwidget.cpp
  92. +1 −0 src/gui/qgsexpressionbuilderwidget.h
  93. +2 −0 src/gui/qgsexpressionlineedit.cpp
  94. +1 −0 src/gui/qgsexpressionselectiondialog.cpp
  95. +1 −0 src/gui/qgsfieldexpressionwidget.cpp
  96. +1 −0 src/gui/qgshelp.cpp
  97. +1 −0 src/gui/qgshighlight.cpp
  98. +1 −0 src/gui/qgsmapcanvas.cpp
  99. +1 −0 src/gui/qgsmaptip.cpp
  100. +1 −0 src/gui/qgsmaptoolidentify.cpp
  101. +1 −0 src/gui/qgspropertyassistantwidget.cpp
  102. +1 −0 src/gui/qgspropertyoverridebutton.h
  103. +2 −0 src/gui/qgssearchquerybuilder.cpp
  104. +2 −0 src/gui/qgssymbolbutton.cpp
  105. +1 −0 src/gui/qgsvariableeditorwidget.cpp
  106. +1 −0 src/gui/symbology/qgs25drendererwidget.cpp
  107. +1 −0 src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
  108. +1 −0 src/gui/symbology/qgsdatadefinedsizelegendwidget.cpp
  109. +1 −0 src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
  110. +1 −0 src/gui/symbology/qgsheatmaprendererwidget.cpp
  111. +1 −0 src/gui/symbology/qgslayerpropertieswidget.cpp
  112. +1 −0 src/gui/symbology/qgsrendererwidget.cpp
  113. +1 −0 src/gui/symbology/qgssymbollayerwidget.cpp
  114. +1 −0 src/gui/symbology/qgssymbolselectordialog.cpp
  115. +1 −0 src/gui/symbology/qgssymbolwidgetcontext.cpp
  116. +1 −0 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  117. +1 −0 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  118. +1 −0 src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
  119. +1 −0 src/server/services/wfs/qgswfsgetfeature.cpp
  120. +1 −0 src/server/services/wfs/qgswfstransaction.cpp
  121. +1 −0 src/server/services/wfs/qgswfstransaction_1_0_0.cpp
  122. +1 −0 src/server/services/wms/qgswmsrenderer.cpp
  123. +1 −0 tests/src/analysis/testqgsprocessing.cpp
  124. +1 −0 tests/src/core/testqgs25drenderer.cpp
  125. +1 −0 tests/src/core/testqgsexpression.cpp
  126. +2 −0 tests/src/core/testqgsexpressioncontext.cpp
  127. +1 −0 tests/src/core/testqgslayout.cpp
  128. +1 −0 tests/src/core/testqgslayoutitem.cpp
  129. +1 −0 tests/src/core/testqgslayouttable.cpp
  130. +1 −0 tests/src/core/testqgsmapsettings.cpp
  131. +1 −0 tests/src/core/testqgsprojectstorage.cpp
@@ -0,0 +1,334 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/expression/qgsexpressioncontextutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsExpressionContextUtils
{
%Docstring
Contains utilities for working with QgsExpressionContext objects, including methods
for creating scopes for specific uses (e.g., project scopes, layer scopes).

.. versionadded:: 2.12
%End

%TypeHeaderCode
#include "qgsexpressioncontextutils.h"
%End
public:

static QgsExpressionContextScope *globalScope() /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to the global QGIS context.
For instance, QGIS version numbers and variables specified through QGIS options.

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

static QgsExpressionContextScope *formScope( const QgsFeature &formFeature = QgsFeature( ), const QString &formMode = QString() ) /Factory/;
%Docstring
Creates a new scope which contains functions and variables from the current attribute form/table ``feature``.
The variables and values in this scope will reflect the current state of the form/row being edited.
The ``formMode`` (SingleEditMode etc.) is passed as text

.. versionadded:: 3.2
%End

static void setGlobalVariable( const QString &name, const QVariant &value );
%Docstring
Sets a global context variable. This variable will be contained within scopes retrieved via
globalScope().

:param name: variable name
:param value: variable value

.. seealso:: :py:func:`setGlobalVariable`

.. seealso:: :py:func:`globalScope`

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

static void setGlobalVariables( const QVariantMap &variables );
%Docstring
Sets all global context variables. Existing global variables will be removed and replaced
with the variables specified.

:param variables: new set of global variables

.. seealso:: :py:func:`setGlobalVariable`

.. seealso:: :py:func:`globalScope`

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

static void removeGlobalVariable( const QString &name );
%Docstring
Remove a global context variable.

:param name: variable name

.. seealso:: :py:func:`setGlobalVariable`

.. seealso:: :py:func:`setGlobalVariables`

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

static QgsExpressionContextScope *projectScope( const QgsProject *project ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a QGIS project.
For instance, project path and title, and variables specified through the project properties.

:param project: What project to use

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

static void setProjectVariable( QgsProject *project, const QString &name, const QVariant &value );
%Docstring
Sets a project context variable. This variable will be contained within scopes retrieved via
projectScope().

:param project: Project to apply changes to
:param name: variable name
:param value: variable value

.. seealso:: :py:func:`setProjectVariables`

.. seealso:: :py:func:`removeProjectVariable`

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

static void setProjectVariables( QgsProject *project, const QVariantMap &variables );
%Docstring
Sets all project context variables. Existing project variables will be removed and replaced
with the variables specified.

:param project: Project to apply changes to
:param variables: new set of project variables

.. seealso:: :py:func:`setProjectVariable`

.. seealso:: :py:func:`removeProjectVariable`

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

static void removeProjectVariable( QgsProject *project, const QString &name );
%Docstring
Remove project context variable.

:param project: Project to apply changes to
:param name: variable name

.. seealso:: :py:func:`setProjectVariable`

.. seealso:: :py:func:`setProjectVariables`

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

static QgsExpressionContextScope *layerScope( const QgsMapLayer *layer ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a :py:class:`QgsMapLayer`.
For instance, layer name, id and fields.
%End

static QList<QgsExpressionContextScope *> globalProjectLayerScopes( const QgsMapLayer *layer ) /Factory/;
%Docstring
Creates a list of three scopes: global, layer's project and layer.

.. versionadded:: 3.0
%End

static void setLayerVariable( QgsMapLayer *layer, const QString &name, const QVariant &value );
%Docstring
Sets a layer context variable. This variable will be contained within scopes retrieved via
layerScope().

:param layer: map layer
:param name: variable name
:param value: variable value

.. seealso:: :py:func:`setLayerVariables`

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

static void setLayerVariables( QgsMapLayer *layer, const QVariantMap &variables );
%Docstring
Sets all layer context variables. Existing layer variables will be removed and replaced
with the variables specified.

:param layer: map layer
:param variables: new set of layer variables

.. seealso:: :py:func:`setLayerVariable`

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

static QgsExpressionContextScope *mapSettingsScope( const QgsMapSettings &mapSettings ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
For instance, map scale and rotation.
%End

static QgsExpressionContextScope *mapToolCaptureScope( const QList<QgsPointLocator::Match> &matches ) /Factory/;
%Docstring
Sets the expression context variables which are available for expressions triggered by
a map tool capture like add feature.

.. versionadded:: 3.0
%End

static QgsExpressionContextScope *updateSymbolScope( const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope = 0 );
%Docstring
Updates a symbol scope related to a QgsSymbol to an expression context.

:param symbol: symbol to extract properties from
:param symbolScope: pointer to an existing scope to update

.. versionadded:: 2.14
%End

static QgsExpressionContextScope *layoutScope( const QgsLayout *layout ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a :py:class:`QgsLayout` ``layout``.
For instance, number of pages and page sizes.

.. versionadded:: 3.0
%End

static void setLayoutVariable( QgsLayout *layout, const QString &name, const QVariant &value );
%Docstring
Sets a layout context variable. This variable will be contained within scopes retrieved via
layoutScope().

:param layout: target layout
:param name: variable name
:param value: variable value

.. seealso:: :py:func:`setLayoutVariables`

.. seealso:: :py:func:`layoutScope`

.. versionadded:: 3.0
%End

static void setLayoutVariables( QgsLayout *layout, const QVariantMap &variables );
%Docstring
Sets all layout context variables. Existing layout variables will be removed and replaced
with the variables specified.

:param layout: target layout
:param variables: new set of layer variables

.. seealso:: :py:func:`setLayoutVariable`

.. seealso:: :py:func:`layoutScope`

.. versionadded:: 3.0
%End

static QgsExpressionContextScope *atlasScope( QgsLayoutAtlas *atlas ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a :py:class:`QgsLayoutAtlas`.
For instance, current page name and number.

:param atlas: source atlas. If null, a set of default atlas variables will be added to the scope.
%End

static QgsExpressionContextScope *layoutItemScope( const QgsLayoutItem *item ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a :py:class:`QgsLayoutItem`.
For instance, item size and position.

.. seealso:: :py:func:`setLayoutItemVariable`

.. seealso:: :py:func:`setLayoutItemVariables`

.. versionadded:: 3.0
%End

static void setLayoutItemVariable( QgsLayoutItem *item, const QString &name, const QVariant &value );
%Docstring
Sets a layout ``item`` context variable, with the given ``name`` and ``value``.
This variable will be contained within scopes retrieved via
layoutItemScope().

.. seealso:: :py:func:`setLayoutItemVariables`

.. seealso:: :py:func:`layoutItemScope`

.. versionadded:: 3.0
%End

static void setLayoutItemVariables( QgsLayoutItem *item, const QVariantMap &variables );
%Docstring
Sets all layout item context variables for an ``item``. Existing variables will be removed and replaced
with the ``variables`` specified.

.. seealso:: :py:func:`setLayoutItemVariable`

.. seealso:: :py:func:`layoutItemScope`

.. versionadded:: 3.0
%End

static QgsExpressionContext createFeatureBasedContext( const QgsFeature &feature, const QgsFields &fields );
%Docstring
Helper function for creating an expression context which contains just a feature and fields
collection. Generally this method should not be used as the created context does not include
standard scopes such as the global and project scopes.
%End

static QgsExpressionContextScope *processingAlgorithmScope( const QgsProcessingAlgorithm *algorithm, const QVariantMap &parameters, QgsProcessingContext &context ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a processing ``algorithm``,
when used with the specified ``parameters`` and ``context``.
For instance, algorithm name and parameter functions.

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

static QgsExpressionContextScope *processingModelAlgorithmScope( const QgsProcessingModelAlgorithm *model, const QVariantMap &parameters, QgsProcessingContext &context ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to a processing ``model`` algorithm,
when used with the specified ``parameters`` and ``context``.
For instance, model name and path variables.

.. versionadded:: 3.6
%End

static QgsExpressionContextScope *notificationScope( const QString &message = QString() ) /Factory/;
%Docstring
Creates a new scope which contains variables and functions relating to provider notifications

:param message: the notification message
%End

static void registerContextFunctions();
%Docstring
Registers all known core functions provided by QgsExpressionContextScope objects.
%End

public:
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/expression/qgsexpressioncontextutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 69f45e3

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