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