QGIS API Documentation  3.0.2-Girona (307d082)
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  , expression( other.expression )
54  , expressionReferencedCols( other.expressionReferencedCols )
55  {}
56 
57  ~QgsPropertyPrivate()
58  {
59  delete transformer;
60  }
61 
62  int type = 0;
63 
65  bool active = true;
66 
68  QgsPropertyTransformer *transformer = nullptr;
69 
70  // StaticData
71  QVariant staticValue;
72 
73  // FieldData
74  QString fieldName;
75  mutable int cachedFieldIdx = -1;
76 
77  // ExpressionData
78  QString expressionString;
79  mutable bool expressionPrepared = false;
80  mutable QgsExpression expression;
82  mutable QSet< QString > expressionReferencedCols;
83 
84 };
85 
87 
88 #endif // QGSPROPERTYPRIVATE_H
Abstract base class for objects which transform the calculated value of a property.