• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INAMED_H
17 #define META_INTERFACE_INAMED_H
18 
19 #include <meta/base/meta_types.h>
20 #include <meta/base/namespace.h>
21 #include <meta/interface/interface_macros.h>
22 
23 META_BEGIN_NAMESPACE()
24 
25 META_REGISTER_INTERFACE(INamed, "e5f8f341-94b5-479e-b124-ab53150ad1aa")
26 
27 /**
28  * @brief The INamed interface defines an interface for classes which
29  *        have a user-settable Name property.
30  *
31  *        If the implementing class also implements IObject, it should
32  *        override IObject::GetName to return the value of Name property.
33  */
34 class INamed : public CORE_NS::IInterface {
35     META_INTERFACE(CORE_NS::IInterface, INamed)
36 public:
37     /**
38      * @brief Name of the object.
39      */
40     META_PROPERTY(BASE_NS::string, Name)
41 };
42 
43 /// Separate name for object
44 class IObjectName : public CORE_NS::IInterface {
45     META_INTERFACE(CORE_NS::IInterface, IObjectName, "bca6bd12-ef83-4999-b3ca-f3ae91626673")
46 public:
47     virtual BASE_NS::string GetName() const = 0;
48     virtual bool SetName(BASE_NS::string_view name) = 0;
49 };
50 
51 META_END_NAMESPACE()
52 
53 #endif // META_INTERFACE_INAMED_H
54