1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.core.bindingstorage; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.namespace; 17 import qt.core.propertyprivate; 18 import qt.helpers; 19 20 /+ template <typename Class, typename T, auto Offset, auto Setter, auto Signal> 21 class QObjectCompatProperty; +/ 22 struct QPropertyDelayedNotifications; 23 24 extern(C++, "QtPrivate") { 25 26 struct BindingEvaluationState; 27 struct CompatPropertySafePoint; 28 } 29 30 struct QBindingStatus 31 { 32 /+ QtPrivate:: +/BindingEvaluationState* currentlyEvaluatingBinding = null; 33 /+ QtPrivate:: +/CompatPropertySafePoint* currentCompatProperty = null; 34 /+ Qt:: +/qt.core.namespace.HANDLE threadId = null; 35 QPropertyDelayedNotifications* groupUpdateData = null; 36 } 37 38 39 struct QBindingStorageData; 40 extern(C++, class) struct /+ Q_CORE_EXPORT +/ QBindingStorage 41 { 42 private: 43 /+ mutable +/ QBindingStorageData* d = null; 44 QBindingStatus* bindingStatus = null; 45 46 /+ template<typename Class, typename T, auto Offset, auto Setter, auto Signal> +/ 47 /+ friend class QObjectCompatProperty; +/ 48 /+ friend class QObjectPrivate; +/ 49 /+ friend class QtPrivate::QPropertyBindingData; +/ 50 public: 51 @disable this(); 52 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 53 ref typeof(this) rawConstructor(); 54 static typeof(this) create() 55 { 56 typeof(this) r = typeof(this).init; 57 r.rawConstructor(); 58 return r; 59 } 60 61 ~this(); 62 63 bool isEmpty() { return !d; } 64 65 void registerDependency(const(QUntypedPropertyData)* data) const 66 { 67 if (!bindingStatus.currentlyEvaluatingBinding) 68 return; 69 registerDependency_helper(data); 70 } 71 /+ QtPrivate:: +/qt.core.propertyprivate.QPropertyBindingData* bindingData(const(QUntypedPropertyData)* data) const 72 { 73 if (!d) 74 return null; 75 return bindingData_helper(data); 76 } 77 // ### Qt 7: remove unused BIC shim 78 void maybeUpdateBindingAndRegister(const(QUntypedPropertyData)* data) const { registerDependency(data); } 79 80 /+ QtPrivate:: +/qt.core.propertyprivate.QPropertyBindingData* bindingData(QUntypedPropertyData* data, bool create) 81 { 82 if (!d && !create) 83 return null; 84 return bindingData_helper(data, create); 85 } 86 private: 87 void clear(); 88 void registerDependency_helper(const(QUntypedPropertyData)* data) const; 89 // ### Unused, but keep for BC 90 void maybeUpdateBindingAndRegister_helper(const(QUntypedPropertyData)* data) const; 91 /+ QtPrivate:: +/qt.core.propertyprivate.QPropertyBindingData* bindingData_helper(const(QUntypedPropertyData)* data) const; 92 /+ QtPrivate:: +/qt.core.propertyprivate.QPropertyBindingData* bindingData_helper(QUntypedPropertyData* data, bool create); 93 mixin(CREATE_CONVENIENCE_WRAPPERS); 94 } 95