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