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