QGIS API Documentation  3.25.0-Master (dec16ba68b)
qgsproperty_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsproperty_p.h
3  ---------------
4  Date : January 2017
5  Copyright : (C) 2017 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 QGSPROPERTYPRIVATE_H
16 #define QGSPROPERTYPRIVATE_H
17 
19 
20 //
21 // W A R N I N G
22 // -------------
23 //
24 // This file is not part of the QGIS API. It exists purely as an
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
27 //
28 
29 #define SIP_NO_FILE
30 
31 #include "qgis_core.h"
32 #include <QSharedData>
33 #include <QVariant>
34 #include "qgsexpression.h"
35 #include "qgspropertytransformer.h"
36 
37 class QgsPropertyPrivate : public QSharedData
38 {
39  public:
40 
41  QgsPropertyPrivate() = default;
42 
43  QgsPropertyPrivate( const QgsPropertyPrivate &other )
44  : QSharedData( other )
45  , type( other.type )
46  , active( other.active )
47  , transformer( other.transformer ? other.transformer->clone() : nullptr )
48  , staticValue( other.staticValue )
49  , fieldName( other.fieldName )
50  , cachedFieldIdx( other.cachedFieldIdx )
51  , expressionString( other.expressionString )
52  , expressionPrepared( other.expressionPrepared )
53  , expressionIsInvalid( other.expressionIsInvalid )
54  , expression( other.expression )
55  , expressionReferencedCols( other.expressionReferencedCols )
56  {}
57 
58  ~QgsPropertyPrivate()
59  {
60  delete transformer;
61  }
62 
63  int type = 0;
64 
66  bool active = true;
67 
69  QgsPropertyTransformer *transformer = nullptr;
70 
71  // StaticData
72  QVariant staticValue;
73 
74  // FieldData
75  QString fieldName;
76  mutable int cachedFieldIdx = -1;
77 
78  // ExpressionData
79  QString expressionString;
80  mutable bool expressionPrepared = false;
81  mutable bool expressionIsInvalid = false;
82  mutable QgsExpression expression;
84  mutable QSet< QString > expressionReferencedCols;
85 
86  private:
87  QgsPropertyPrivate &operator=( const QgsPropertyPrivate & ) = delete;
88 };
89 
91 
92 #endif // QGSPROPERTYPRIVATE_H
Class for parsing and evaluation of expressions (formerly called "search strings").
Abstract base class for objects which transform the calculated value of a property.