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 * @since 8 36 * @version 1.0 37 */ 38 #ifndef GLOBAL_RAW_DIR_H 39 #define GLOBAL_RAW_DIR_H 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 struct RawDir; 46 47 /** 48 * @brief Provides access to a raw file directory. 49 * 50 * 51 * 52 * @since 8 53 * @version 1.0 54 */ 55 typedef struct RawDir RawDir; 56 57 /** 58 * @brief Obtains the name of the file according to the index. 59 * 60 * You can use this method to traverse a raw file directory. 61 * 62 * @param rawDir Indicates the pointer to {@link RawDir}. 63 * @param index Indicates the file index in {@link RawDir}. 64 * @return Returns the name of the file according to the index, 65 * which can be passed to {@link OH_ResourceManager_OpenRawFile} as an input parameter; 66 * returns <b>NULL</b> if all files are returned. 67 * @see OH_ResourceManager_OpenRawFile 68 * @since 8 69 * @version 1.0 70 */ 71 const char *OH_ResourceManager_GetRawFileName(RawDir *rawDir, int index); 72 73 /** 74 * @brief get the count of the raw files in {@link RawDir}. 75 * 76 * You can use this method to get the valid index of {@link OH_ResourceManager_GetRawFileName}. 77 * 78 * @param rawDir Indicates the pointer to {@link RawDir}. 79 * @see OH_ResourceManager_GetRawFileName 80 * @since 8 81 * @version 1.0 82 */ 83 int OH_ResourceManager_GetRawFileCount(RawDir *rawDir); 84 85 /** 86 * @brief Closes an opened {@link RawDir} and releases all associated resources. 87 * 88 * 89 * 90 * @param rawDir Indicates the pointer to {@link RawDir}. 91 * @see OH_ResourceManager_OpenRawDir 92 * @since 8 93 * @version 1.0 94 */ 95 void OH_ResourceManager_CloseRawDir(RawDir *rawDir); 96 97 #ifdef __cplusplus 98 }; 99 #endif 100 101 /** @} */ 102 #endif // GLOBAL_RAW_DIR_H 103