1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef META_INTERFACE_PROPERTY_BIND_H 17 #define META_INTERFACE_PROPERTY_BIND_H 18 19 #include <meta/base/interface_macros.h> 20 #include <meta/base/namespace.h> 21 #include <meta/base/types.h> 22 #include <meta/interface/intf_function.h> 23 #include <meta/interface/property/intf_property.h> 24 25 META_BEGIN_NAMESPACE() 26 27 META_REGISTER_INTERFACE(IBind, "29495e67-14a6-40aa-a16f-1923630af506") 28 29 class IBind : public CORE_NS::IInterface { 30 META_INTERFACE(CORE_NS::IInterface, IBind) 31 public: 32 /// getDeps == true to find dependencies, owner can be the property (or null) where this bind is supposed to end up 33 /// for checking circular dependencies 34 virtual bool SetTarget(const IProperty::ConstPtr& prop, bool getDeps, const IProperty* owner) = 0; 35 virtual bool SetTarget(const IFunction::ConstPtr& func, bool getDeps, const IProperty* owner) = 0; 36 virtual IFunction::ConstPtr GetTarget() const = 0; 37 38 virtual bool AddDependency(const INotifyOnChange::ConstPtr& dep) = 0; 39 virtual bool RemoveDependency(const INotifyOnChange::ConstPtr& dep) = 0; 40 41 virtual BASE_NS::vector<INotifyOnChange::ConstPtr> GetDependencies() const = 0; 42 }; 43 44 META_END_NAMESPACE() 45 46 #endif 47