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_ICONTAINABLE_H 17 #define META_INTERFACE_ICONTAINABLE_H 18 19 #include <base/util/uid.h> 20 21 #include <meta/interface/intf_object.h> 22 #include <meta/interface/property/intf_property.h> 23 24 META_BEGIN_NAMESPACE() 25 26 META_REGISTER_INTERFACE(IContainable, "4bcc982b-4b40-4171-9b77-073dc86d8f63") 27 28 /** 29 * @brief Interface indicating the object can be contained (for example in IContainer) 30 * and so it has a parent 31 */ 32 class IContainable : public CORE_NS::IInterface { 33 META_INTERFACE(CORE_NS::IInterface, IContainable) 34 public: 35 /** 36 * @brief Returns the parent object of this object if any 37 */ 38 virtual IObject::Ptr GetParent() const = 0; 39 }; 40 41 META_REGISTER_INTERFACE(IMutableContainable, "dd0b8f12-0f81-4dc3-869d-79c3457d4557") 42 43 /** 44 * @brief Implies IContainable where the parent can be re-set 45 */ 46 class IMutableContainable : public CORE_NS::IInterface { 47 META_INTERFACE(CORE_NS::IInterface, IMutableContainable) 48 public: 49 /** 50 * @brief Sets the parent object for this object 51 */ 52 virtual void SetParent(const IObject::Ptr& parent) = 0; 53 }; 54 55 META_REGISTER_INTERFACE(IEnablePropertyTraversal, "32612e47-f755-404b-8bfb-365dac04c644") 56 57 /** 58 * @brief Interface that enables Resolve traversal through property types 59 */ 60 class IEnablePropertyTraversal : public CORE_NS::IInterface { 61 META_INTERFACE(CORE_NS::IInterface, IEnablePropertyTraversal) 62 public: 63 /** 64 * @brief Set the property that currently owns this value. 65 */ 66 virtual void SetProperty(const IProperty::ConstWeakPtr&) = 0; 67 /** 68 * @brief Get the currently owning property. 69 */ 70 virtual IProperty::ConstWeakPtr GetProperty() const = 0; 71 }; 72 73 META_END_NAMESPACE() 74 75 #endif