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 CORE__LOADER__SYSTEM_GRAPH_LOADER_H
17 #define CORE__LOADER__SYSTEM_GRAPH_LOADER_H
18 
19 #include <base/containers/string_view.h>
20 #include <base/namespace.h>
21 #include <core/ecs/intf_system_graph_loader.h>
22 #include <core/namespace.h>
23 
24 CORE_BEGIN_NAMESPACE()
25 class IEcs;
26 class IInterface;
27 class IFileManager;
28 
29 class SystemGraphLoader final : public ISystemGraphLoader {
30 public:
31     explicit SystemGraphLoader(IFileManager&);
32     ~SystemGraphLoader() override = default;
33     LoadResult Load(BASE_NS::string_view uri, IEcs& ecs) override;
34     LoadResult LoadString(BASE_NS::string_view jsonString, IEcs& ecs) override;
35 
36 protected:
37     void Destroy() override;
38     IFileManager& fileManager_;
39 };
40 
41 class SystemGraphLoaderFactory final : public ISystemGraphLoaderFactory {
42 public:
43     SystemGraphLoaderFactory() = default;
44     ~SystemGraphLoaderFactory() override = default;
45     const IInterface* GetInterface(const BASE_NS::Uid& uid) const override;
46     IInterface* GetInterface(const BASE_NS::Uid& uid) override;
47     void Ref() override;
48     void Unref() override;
49     ISystemGraphLoader::Ptr Create(IFileManager& fileManager) override;
50 };
51 CORE_END_NAMESPACE()
52 
53 #endif // CORE__LOADER__SYSTEM_GRAPH_LOADER_H
54