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 SCENE_EXT_ECS_OBJECT_H
17 #define SCENE_EXT_ECS_OBJECT_H
18
19 #include <scene/ext/intf_internal_scene.h>
20
21 #include <meta/ext/object.h>
22 #include <meta/interface/engine/intf_engine_value_manager.h>
23
SCENE_BEGIN_NAMESPACE()24 SCENE_BEGIN_NAMESPACE()
25
26 class IEcsResource : public CORE_NS::IInterface {
27 META_INTERFACE(CORE_NS::IInterface, IEcsResource, "4a605fe0-b0bf-4627-8f42-5e7d473e91ba")
28 public:
29 virtual CORE_NS::Entity GetEntity() const = 0;
30 };
31
32 class IEcsObject : public IEcsResource {
33 META_INTERFACE(IEcsResource, IEcsObject, "5576c6f2-364b-497f-b342-4fffeb022e53")
34 public:
35 virtual BASE_NS::string GetPath() const = 0;
36 virtual BASE_NS::string GetName() const = 0;
37
38 virtual IInternalScene::Ptr GetScene() const = 0;
39 virtual META_NS::IEngineValueManager::Ptr GetEngineValueManager() = 0;
40
41 virtual bool SetName(const BASE_NS::string& name) = 0;
42 virtual Future<bool> AddAllEngineProperties(
43 const META_NS::IMetadata::Ptr& object, BASE_NS::string_view component) = 0;
44 virtual Future<bool> AttachEngineProperty(const META_NS::IProperty::Ptr&, BASE_NS::string_view component) = 0;
45 virtual Future<META_NS::IProperty::Ptr> CreateEngineProperty(BASE_NS::string_view path) = 0;
46
47 virtual void SyncProperties() = 0;
48 };
49
50 SCENE_END_NAMESPACE()
51
52 META_INTERFACE_TYPE(SCENE_NS::IEcsObject)
53
54 #endif