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 API_CORE_IFILE_SYSTEM_API_H 17 #define API_CORE_IFILE_SYSTEM_API_H 18 19 #include <cstdint> 20 21 #include <base/containers/string_view.h> 22 #include <base/util/uid.h> 23 #include <core/io/intf_file_manager.h> 24 #include <core/io/intf_file_monitor.h> 25 #include <core/namespace.h> 26 #include <core/plugin/intf_class_factory.h> 27 CORE_BEGIN_NAMESPACE()28CORE_BEGIN_NAMESPACE() 29 30 /** @ingroup group_ifilesystemapifactory */ 31 /** file system api factory interface 32 * Helpers to create 33 * Usage: 34 */ 35 36 class IFileSystemApi : public IClassFactory { 37 public: 38 static constexpr auto UID = BASE_NS::Uid { "dfe630b1-04ce-4c20-ac0d-7a521369dfbe" }; 39 40 virtual IFileManager::Ptr CreateFilemanager() = 0; 41 virtual IFileMonitor::Ptr CreateFilemonitor(IFileManager&) = 0; 42 virtual IFilesystem::Ptr CreateStdFileSystem() = 0; 43 virtual IFilesystem::Ptr CreateStdFileSystem(BASE_NS::string_view rootPath) = 0; 44 virtual IFilesystem::Ptr CreateMemFileSystem() = 0; 45 virtual IFilesystem::Ptr CreateROFilesystem(const void* const data, uint64_t size) = 0; 46 47 protected: 48 IFileSystemApi() = default; 49 virtual ~IFileSystemApi() = default; 50 }; 51 GetName(const IFileSystemApi *)52inline constexpr BASE_NS::string_view GetName(const IFileSystemApi*) 53 { 54 return "IFileSystemApi"; 55 } 56 CORE_END_NAMESPACE() 57 58 #endif // API_CORE_IFILE_SYSTEM_API_H 59