1 /* 2 * Copyright (c) 2022 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 /** 17 * @addtogroup rawfile 18 * @{ 19 * 20 * @brief Provides native functions for the resource manager to operate raw file directories and their raw files. 21 * 22 * You can use the resource manager to traverse, open, seek, read, and close raw files. 23 * 24 * @since 8 25 * @version 1.0 26 */ 27 28 /** 29 * @file raw_dir.h 30 * 31 * @brief Declares native functions related to raw file directories. 32 * 33 * For example, you can use the functions to traverse and close a raw file directory, and reset its index. 34 * 35 * @syscap SystemCapability.Global.ResourceManager 36 * @library librawfile.z.so 37 * @since 8 38 * @version 1.0 39 */ 40 #ifndef GLOBAL_RAW_DIR_H 41 #define GLOBAL_RAW_DIR_H 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 struct RawDir; 48 49 /** 50 * @brief Provides access to a raw file directory. 51 * 52 * 53 * 54 * @since 8 55 * @version 1.0 56 */ 57 typedef struct RawDir RawDir; 58 59 /** 60 * @brief Obtains the name of the file according to the index. 61 * 62 * You can use this method to traverse a raw file directory. 63 * 64 * @param rawDir Indicates the pointer to {@link RawDir}. 65 * @param index Indicates the file index in {@link RawDir}. 66 * @return Returns the name of the file according to the index, 67 * which can be passed to {@link OH_ResourceManager_OpenRawFile} as an input parameter; 68 * returns <b>NULL</b> if all files are returned. 69 * @see OH_ResourceManager_OpenRawFile 70 * @since 8 71 * @version 1.0 72 */ 73 const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index); 74 75 /** 76 * @brief get the count of the raw files in {@link RawDir}. 77 * 78 * You can use this method to get the valid index of {@link OH_ResourceManager_GetRawFileName}. 79 * 80 * @param rawDir Indicates the pointer to {@link RawDir}. 81 * @see OH_ResourceManager_GetRawFileName 82 * @since 8 83 * @version 1.0 84 */ 85 int OH_ResourceManager_GetRawFileCount(RawDir *rawDir); 86 87 /** 88 * @brief Closes an opened {@link RawDir} and releases all associated resources. 89 * 90 * 91 * 92 * @param rawDir Indicates the pointer to {@link RawDir}. 93 * @see OH_ResourceManager_OpenRawDir 94 * @since 8 95 * @version 1.0 96 */ 97 void OH_ResourceManager_CloseRawDir(RawDir *rawDir); 98 99 #ifdef __cplusplus 100 }; 101 #endif 102 103 /** @} */ 104 #endif // GLOBAL_RAW_DIR_H 105