From 01f1d3fc1f5e28c4ab082e04eaadda44271fed63 Mon Sep 17 00:00:00 2001 From: "@ran-zhao-yu" Date: Thu, 16 May 2024 21:20:53 +0800 Subject: [PATCH 01/13] =?UTF-8?q?CAPI=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @ran-zhao-yu --- global/resource_management/BUILD.gn | 23 ++++ .../include/{ => rawfile}/raw_dir.h | 0 .../include/{ => rawfile}/raw_file.h | 0 .../include/{ => rawfile}/raw_file_manager.h | 38 +----- .../include/resourcemanager/native_common.h | 106 +++++++++++++++ .../resourcemanager/native_resource_manager.h | 85 ++++++++++++ .../libnative_resmgr.ndk.json | 122 ++++++++++++++++++ 7 files changed, 337 insertions(+), 37 deletions(-) rename global/resource_management/include/{ => rawfile}/raw_dir.h (100%) rename global/resource_management/include/{ => rawfile}/raw_file.h (100%) rename global/resource_management/include/{ => rawfile}/raw_file_manager.h (77%) create mode 100644 global/resource_management/include/resourcemanager/native_common.h create mode 100644 global/resource_management/include/resourcemanager/native_resource_manager.h create mode 100644 global/resource_management/libnative_resmgr.ndk.json diff --git a/global/resource_management/BUILD.gn b/global/resource_management/BUILD.gn index d5c9057ab..27d110384 100644 --- a/global/resource_management/BUILD.gn +++ b/global/resource_management/BUILD.gn @@ -27,3 +27,26 @@ ohos_ndk_headers("rawfile_header") { "./include/raw_file_manager.h", ] } + +ohos_ndk_headers("rawfile_header") { + dest_dir = "$ndk_headers_out_dir/rawfile" + sources = [ + "./include/rawfile/raw_dir.h", + "./include/rawfile/raw_file.h", + "./include/rawfile/raw_file_manager.h", + ] +} + +ohos_ndk_library("native_resmgr_ndk") { + ndk_description_file = "./libnative_resmgr.ndk.json" + min_compact_version = "1" + output_name = "native_resmgr" +} + +ohos_ndk_headers("native_resmgr_header") { + dest_dir = "$ndk_headers_out_dir/resourcemanager" + sources = [ + "./include/resourcemanager/native_resource_manager.h", + "./include/resourcemanager/native_common.h" + ] +} \ No newline at end of file diff --git a/global/resource_management/include/raw_dir.h b/global/resource_management/include/rawfile/raw_dir.h similarity index 100% rename from global/resource_management/include/raw_dir.h rename to global/resource_management/include/rawfile/raw_dir.h diff --git a/global/resource_management/include/raw_file.h b/global/resource_management/include/rawfile/raw_file.h similarity index 100% rename from global/resource_management/include/raw_file.h rename to global/resource_management/include/rawfile/raw_file.h diff --git a/global/resource_management/include/raw_file_manager.h b/global/resource_management/include/rawfile/raw_file_manager.h similarity index 77% rename from global/resource_management/include/raw_file_manager.h rename to global/resource_management/include/rawfile/raw_file_manager.h index ca3fabae4..a78172ded 100644 --- a/global/resource_management/include/raw_file_manager.h +++ b/global/resource_management/include/rawfile/raw_file_manager.h @@ -41,48 +41,12 @@ #include "napi/native_api.h" #include "raw_dir.h" #include "raw_file.h" +#include "../resourcemanager/native_common.h" #ifdef __cplusplus extern "C" { #endif -struct NativeResourceManager; - -/** - * @brief Presents the resource manager. - * - * This class encapsulates the native implementation of the JavaScript resource manager. The pointer to a - * ResourceManager object can be obtained by calling {@link OH_ResourceManager_InitNativeResourceManager}. - * - * @since 8 - * @version 1.0 - */ -typedef struct NativeResourceManager NativeResourceManager; - -/** - * @brief Obtains the native resource manager based on the JavaScipt resource manager. - * - * You need to obtain the resource manager to process raw files as required. - * - * @param env Indicates the pointer to the JavaScipt Native Interface (napi) environment. - * @param jsResMgr Indicates the JavaScipt resource manager. - * @return Returns the pointer to {@link NativeResourceManager}. - * @since 8 - * @version 1.0 - */ -NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr); - -/** - * @brief Releases the native resource manager. - * - * - * - * @param resMgr Indicates the pointer to {@link RawDir}. - * @since 8 - * @version 1.0 - */ -void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr); - /** * @brief Opens a raw file directory. * diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h new file mode 100644 index 000000000..fe3d58177 --- /dev/null +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup rawfile + * @{ + * + * @brief Provides native functions for the resource manager to operate raw file directories and their raw files. + * + * You can use the resource manager to traverse, open, seek, read, and close raw files. + * + * @since 8 + * @version 1.0 + */ + +/** + * @file raw_file_manager.h + * + * @brief Declares native functions for the resource manager. + * + * You can use the resource manager to open raw files for subsequent operations, such as seeking and reading. + * + * @since 8 + * @version 1.0 + */ +#ifndef GLOBAL_RAW_FILE_MANAGER_H +#define GLOBAL_RAW_FILE_MANAGER_H + +#include "napi/native_api.h" +#include "raw_dir.h" +#include "raw_file.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct NativeResourceManager; + +/** + * @brief Presents the resource manager. + * + * This class encapsulates the native implementation of the JavaScript resource manager. The pointer to a + * ResourceManager object can be obtained by calling {@link OH_ResourceManager_InitNativeResourceManager}. + * + * @since 8 + * @version 1.0 + */ +typedef struct NativeResourceManager NativeResourceManager; + +enum ResourceManager_ErrorCode{ + SUCCESS == 0; + ERROR_CODE_INVALID_INPUT_PARAMETER = 401, + ERROR_CODE_RES_ID_NOT_FOUND = 9001001, + ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002, + ERROR_CODE_RES_NAME_NOT_FOUND = 9001003, + ERROR_CODE_RES_NOT_FOUND_BY_NAME = 9001004, + ERROR_CODE_RES_PATH_INVALID = 9001005, + ERROR_CODE_RES_REF_TOO_MUCH = 9001006, + ERROR_CODE_RES_ID_FORMAT_ERROR = 9001007, + ERROR_CODE_RES_NAME_FORMAT_ERROR = 9001008, + ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED = 9001009, + ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010, +}; + +/** + * @brief Obtains the native resource manager based on the JavaScipt resource manager. + * + * You need to obtain the resource manager to process raw files as required. + * + * @param env Indicates the pointer to the JavaScipt Native Interface (napi) environment. + * @param jsResMgr Indicates the JavaScipt resource manager. + * @return Returns the pointer to {@link NativeResourceManager}. + * @since 8 + * @version 1.0 + */ +NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr); + +/** + * @brief Releases the native resource manager. + * + * + * + * @param resMgr Indicates the pointer to {@link RawDir}. + * @since 8 + * @version 1.0 + */ +void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr); + +#ifdef __cplusplus +}; +#endif + +/** @} */ +#endif // GLOBAL_NATIVE_RESOURCE_MANAGER_H diff --git a/global/resource_management/include/resourcemanager/native_resource_manager.h b/global/resource_management/include/resourcemanager/native_resource_manager.h new file mode 100644 index 000000000..201bb3231 --- /dev/null +++ b/global/resource_management/include/resourcemanager/native_resource_manager.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GLOBAL_NATIVE_RESOURCE_MANAGER_H +#define GLOBAL_NATIVE_RESOURCE_MANAGER_H + +#include "native_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResourceManager *mgr, uint32_t resId, char **resultValue, uint64_t *resultLen, uint32_t density = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeResourceManager *mgr, const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManager *mgr, uint32_t resId, unit8_t **resultValue, uint64_t *resultLen, uint32_t density = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetMediaByname(const NativeResourceManager *mgr, const char *resName, unit8_t **resultValue, uint64_t *resultLen, uint32_t density = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeResourceManager *mgr, uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const NativeResourceManager *mgr, char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0); + +ResourceManager_ErrorCode OH_ResourceManager_GetSymbol(const NativeResourceManager *mgr, uint32_t resId, uint32_t *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName(const NativeResourceManager *mgr, const char *resName, uint32_t *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetLocales(char **resultValue, uint32_t *resultLen, bool includeSystem = false); + +ResourceManager_ErrorCode OH_ResourceManager_GetDeviceCapability(const NativeResourceManager *mgr, DeviceCapability *deviceCapability); + +ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration(const NativeResourceManager *mgr, Configuration *configuration); + +ResourceManager_ErrorCode OH_ResourceManager_GetString(const NativeResourceManager *mgr, uint32_t resId, char **resultValue, ...); + +ResourceManager_ErrorCode OH_ResourceManager_GetStringByName(const NativeResourceManager *mgr, const char *resName, char **resultValue, ...); + +ResourceManager_ErrorCode OH_ResourceManager_GetStringArray(const NativeResourceManager *mgr, uint32_t resId, char ***resultValue, uint32_t *resultLen); + +ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName(const NativeResourceManager *mgr, const char *resName, char ***resultValue, uint32_t *resultLen); + +ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue, uint32_t *len); + +ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourceManager *mgr, uint32_t resId, uint32_t num, char **resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeResourceManager *mgr, const char *resName, uint32_t num, char **resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetColor(const NativeResourceManager *mgr, uint32_t resId, uint32_t *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetColorByName(const NativeResourceManager *mgr, const char *resName, uint32_t *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetInt(const NativeResourceManager *mgr, uint32_t resId, int *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetIntByName(const NativeResourceManager *mgr, const char *resName, int *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetFloat(const NativeResourceManager *mgr, uint32_t resId, float *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName(const NativeResourceManager *mgr, const char *resName, float *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetBool(const NativeResourceManager *mgr, uint32_t resId, bool *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName(const NativeResourceManager *mgr, const char *resName, bool *resultValue); + +ResourceManager_ErrorCode OH_ResourceManager_AddResource(const NativeResourceManager *mgr, char *path); + +ResourceManager_ErrorCode OH_ResourceManager_RemoveResource(const NativeResourceManager *mgr, char *path); +#ifdef __cplusplus +}; +#endif + +/** @} */ +#endif // GLOBAL_NATIVE_RESOURCE_MANAGER_H \ No newline at end of file diff --git a/global/resource_management/libnative_resmgr.ndk.json b/global/resource_management/libnative_resmgr.ndk.json new file mode 100644 index 000000000..d05465bb4 --- /dev/null +++ b/global/resource_management/libnative_resmgr.ndk.json @@ -0,0 +1,122 @@ +[ + { + "first_introduced": "12", + "name": "OH_ResourceManager_InitNativeResourceManager" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_ReleaseNativeResourceManager" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetMediaBase64" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetMediaBase64ByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetMedia" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetMediaByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetDrawableDescriptor" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetDrawableDescriptorByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetSymbol" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetSymbolByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetLocales" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetDeviceCapability" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetConfiguration" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetString" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetStringByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetStringArray" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetStringArrayByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_ReleaseStringArray" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetPluralString" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetPluralStringByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetColor" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetColorByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetInt" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetIntByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetFloat" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetFloatByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetBool" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_GetBoolByName" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_AddResource" + }, + { + "first_introduced": "12", + "name": "OH_ResourceManager_RemoveResource" + }, +] \ No newline at end of file -- Gitee From e6515455ba00dca551e7a3f200b0252c3eac5247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:23:48 +0000 Subject: [PATCH 02/13] update global/resource_management/BUILD.gn. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- global/resource_management/BUILD.gn | 9 --------- 1 file changed, 9 deletions(-) diff --git a/global/resource_management/BUILD.gn b/global/resource_management/BUILD.gn index 27d110384..bc4933d8b 100644 --- a/global/resource_management/BUILD.gn +++ b/global/resource_management/BUILD.gn @@ -19,15 +19,6 @@ ohos_ndk_library("librawfile_ndk") { output_name = "rawfile" } -ohos_ndk_headers("rawfile_header") { - dest_dir = "$ndk_headers_out_dir/rawfile" - sources = [ - "./include/raw_dir.h", - "./include/raw_file.h", - "./include/raw_file_manager.h", - ] -} - ohos_ndk_headers("rawfile_header") { dest_dir = "$ndk_headers_out_dir/rawfile" sources = [ -- Gitee From 89b993ae1eee3658153231c99d04d7bc19399ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:25:24 +0000 Subject: [PATCH 03/13] update global/resource_management/include/rawfile/raw_file_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/rawfile/raw_file_manager.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/global/resource_management/include/rawfile/raw_file_manager.h b/global/resource_management/include/rawfile/raw_file_manager.h index a78172ded..0529c1afe 100644 --- a/global/resource_management/include/rawfile/raw_file_manager.h +++ b/global/resource_management/include/rawfile/raw_file_manager.h @@ -47,6 +47,43 @@ extern "C" { #endif +struct NativeResourceManager; + +/** + * @brief Presents the resource manager. + * + * This class encapsulates the native implementation of the JavaScript resource manager. The pointer to a + * ResourceManager object can be obtained by calling {@link OH_ResourceManager_InitNativeResourceManager}. + * + * @since 8 + * @version 1.0 + */ +typedef struct NativeResourceManager NativeResourceManager; + +/** + * @brief Obtains the native resource manager based on the JavaScipt resource manager. + * + * You need to obtain the resource manager to process raw files as required. + * + * @param env Indicates the pointer to the JavaScipt Native Interface (napi) environment. + * @param jsResMgr Indicates the JavaScipt resource manager. + * @return Returns the pointer to {@link NativeResourceManager}. + * @since 8 + * @version 1.0 + */ +NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr); + +/** + * @brief Releases the native resource manager. + * + * + * + * @param resMgr Indicates the pointer to {@link RawDir}. + * @since 8 + * @version 1.0 + */ +void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr); + /** * @brief Opens a raw file directory. * -- Gitee From 20fcef34c38d463bbcdf123c150ce8828d744207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:28:41 +0000 Subject: [PATCH 04/13] update global/resource_management/include/resourcemanager/native_resource_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_resource_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global/resource_management/include/resourcemanager/native_resource_manager.h b/global/resource_management/include/resourcemanager/native_resource_manager.h index 201bb3231..233791dc4 100644 --- a/global/resource_management/include/resourcemanager/native_resource_manager.h +++ b/global/resource_management/include/resourcemanager/native_resource_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 03ab8dd1e4d3d4787d77ec14f532944c298690f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:29:48 +0000 Subject: [PATCH 05/13] update global/resource_management/include/resourcemanager/native_common.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h index fe3d58177..0862cae25 100644 --- a/global/resource_management/include/resourcemanager/native_common.h +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,8 +35,8 @@ * @since 8 * @version 1.0 */ -#ifndef GLOBAL_RAW_FILE_MANAGER_H -#define GLOBAL_RAW_FILE_MANAGER_H +#ifndef NATIVE_COMMON_H +#define NATIVE_COMMON_H #include "napi/native_api.h" #include "raw_dir.h" -- Gitee From 5cec5c583cc38ca706f237e3a828fa9d5106d602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:36:15 +0000 Subject: [PATCH 06/13] update global/resource_management/include/resourcemanager/native_resource_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_resource_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global/resource_management/include/resourcemanager/native_resource_manager.h b/global/resource_management/include/resourcemanager/native_resource_manager.h index 233791dc4..dc0606ead 100644 --- a/global/resource_management/include/resourcemanager/native_resource_manager.h +++ b/global/resource_management/include/resourcemanager/native_resource_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From d0d3abfaca743fa2442e14a256b238ad33f0840b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:36:59 +0000 Subject: [PATCH 07/13] update global/resource_management/include/resourcemanager/native_common.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h index 0862cae25..7cfd3bd13 100644 --- a/global/resource_management/include/resourcemanager/native_common.h +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,8 +39,6 @@ #define NATIVE_COMMON_H #include "napi/native_api.h" -#include "raw_dir.h" -#include "raw_file.h" #ifdef __cplusplus extern "C" { -- Gitee From f2ec085e0b85fdef76655a9178aedb5b4c9890d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 13:37:17 +0000 Subject: [PATCH 08/13] update global/resource_management/include/rawfile/raw_file_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- global/resource_management/include/rawfile/raw_file_manager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/global/resource_management/include/rawfile/raw_file_manager.h b/global/resource_management/include/rawfile/raw_file_manager.h index 0529c1afe..ca3fabae4 100644 --- a/global/resource_management/include/rawfile/raw_file_manager.h +++ b/global/resource_management/include/rawfile/raw_file_manager.h @@ -41,7 +41,6 @@ #include "napi/native_api.h" #include "raw_dir.h" #include "raw_file.h" -#include "../resourcemanager/native_common.h" #ifdef __cplusplus extern "C" { -- Gitee From e991ccaf714471229e25413c55df17c3e94b3461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Thu, 16 May 2024 15:15:42 +0000 Subject: [PATCH 09/13] update global/resource_management/include/resourcemanager/native_resource_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../resourcemanager/native_resource_manager.h | 351 +++++++++++++++++- 1 file changed, 349 insertions(+), 2 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_resource_manager.h b/global/resource_management/include/resourcemanager/native_resource_manager.h index dc0606ead..3ce461157 100644 --- a/global/resource_management/include/resourcemanager/native_resource_manager.h +++ b/global/resource_management/include/resourcemanager/native_resource_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,61 +21,408 @@ #ifdef __cplusplus extern "C" { #endif - +/** + * @brief Obtains the Base64 code of the image resource. + * + * Obtains the Base64 code of the image resource corresponding to the specified resource ID in callback mode. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param resultValue the result write to resultValue. + * @param resultLen the media length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResourceManager *mgr, uint32_t resId, char **resultValue, uint64_t *resultLen, uint32_t density = 0); +/** + * @brief Obtains the Base64 code of the image resource. + * + * Obtains the Base64 code of the image resource corresponding to the specified resource Name in callback mode. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource name. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param resultValue the result write to resultValue. + * @param resultLen the result write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeResourceManager *mgr, const char *resName, char **resultValue, uint64_t *resultLen, uint32_t density = 0); +/** + * @brief Obtains the content of the image resource. + * + * Obtains the content of the specified screen density media file corresponding to a specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param resultValue the result write to resultValue. + * @param resultLen the media length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManager *mgr, uint32_t resId, unit8_t **resultValue, uint64_t *resultLen, uint32_t density = 0); +/** + * @brief Obtains the content of the image resource. + * + * Obtains the content of the specified screen density media file corresponding to a specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource name. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param resultValue the result write to resultValue. + * @param resultLen the media length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. + * @since 12 + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetMediaByname(const NativeResourceManager *mgr, const char *resName, unit8_t **resultValue, uint64_t *resultLen, uint32_t density = 0); +/** + * @brief Obtains the DrawableDescriptor of the media file. + * + * Obtains the DrawableDescriptor of the media file corresponding to a specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param type The optional parameter means the media type, the default value 0 means the normal media. + * @param drawableDescriptor the result write to drawableDescriptor. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeResourceManager *mgr, uint32_t resId, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0); +/** + * @brief Obtains the DrawableDescriptor of the media file. + * + * Obtains the DrawableDescriptor of the media file corresponding to a specified resource Name. + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource name. + * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. + * @param type The optional parameter means the media type, the default value 0 means the normal media. + * @param drawableDescriptor the result write to drawableDescriptor. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const NativeResourceManager *mgr, char *resName, ArkUI_DrawableDescriptor **drawableDescriptor, uint32_t density = 0, uint32_t type = 0); +/** + * @brief Obtains the symbol resource. + * + * Obtains the symbol resource corresponding to the specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetSymbol(const NativeResourceManager *mgr, uint32_t resId, uint32_t *resultValue); +/** + * @brief Obtains the symbol resource. + * + * Obtains the symbol resource corresponding to the specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName(const NativeResourceManager *mgr, const char *resName, uint32_t *resultValue); +/** + * @brief Obtains locales list. + * @param includeSystem the parameter controls whether to include system resources, + * the default value is false, it has no effect when only system resources query the locales list. + * @return Returns the pointer to {@link resultValue}. + * @return Returns the pointer to {@link resultLen}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetLocales(char **resultValue, uint32_t *resultLen, bool includeSystem = false); +/** + * @brief Obtains the device capability. + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @return Returns the pointer to {@link deviceCapability}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetDeviceCapability(const NativeResourceManager *mgr, DeviceCapability *deviceCapability); +/** + * @brief Obtains the device configuration. + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @return Returns the pointer to {@link configuration}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration(const NativeResourceManager *mgr, Configuration *configuration); +/** + * @brief Obtains the character string. + * + * Obtains the character string corresponding to a specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetString(const NativeResourceManager *mgr, uint32_t resId, char **resultValue, ...); +/** + * @brief Obtains the character string. + * + * Obtains the character string corresponding to a specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetStringByName(const NativeResourceManager *mgr, const char *resName, char **resultValue, ...); +/** + * @brief Obtains the array of character strings. + * + * Obtains the array of character strings corresponding to a specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @return Returns the pointer to {@link resultLen}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetStringArray(const NativeResourceManager *mgr, uint32_t resId, char ***resultValue, uint32_t *resultLen); +/** + * @brief Obtains the array of character strings. + * + * Obtains the array of character strings corresponding to a specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @return Returns the pointer to {@link resultLen}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName(const NativeResourceManager *mgr, const char *resName, char ***resultValue, uint32_t *resultLen); +/** + * @brief Release the array of character strings. + * @param resValue the array of character strings corresponding to the specified resource name. + * @param len the length of array. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue, uint32_t *len); +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the ID string corresponding to the + * specified number. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link num}. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourceManager *mgr, uint32_t resId, uint32_t num, char **resultValue); +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the Name string corresponding to the + * specified number. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link num}. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeResourceManager *mgr, const char *resName, uint32_t num, char **resultValue); +/** + * @brief Obtains the color resource. + * + * Obtains the color resource corresponding to the specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetColor(const NativeResourceManager *mgr, uint32_t resId, uint32_t *resultValue); +/** + * @brief Obtains the color resource. + * + * Obtains the color resource corresponding to the specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetColorByName(const NativeResourceManager *mgr, const char *resName, uint32_t *resultValue); +/** + * @brief Obtains the Int resource. + * + * Obtains the Int resource corresponding to the specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetInt(const NativeResourceManager *mgr, uint32_t resId, int *resultValue); +/** + * @brief Obtains the Int resource. + * + * Obtains the Int resource corresponding to the specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetIntByName(const NativeResourceManager *mgr, const char *resName, int *resultValue); +/** + * @brief Obtains the Float resource. + * + * Obtains the Int resource corresponding to the specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetFloat(const NativeResourceManager *mgr, uint32_t resId, float *resultValue); +/** + * @brief Obtains the Float resource. + * + * Obtains the Float resource corresponding to the specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName(const NativeResourceManager *mgr, const char *resName, float *resultValue); +/** + * @brief Obtains the boolean result. + * + * Obtains the boolean result with a specified resource ID. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetBool(const NativeResourceManager *mgr, uint32_t resId, bool *resultValue); +/** + * @brief Obtains the boolean result. + * + * Obtains the boolean result with a specified resource Name. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource Name. + * @return Returns the pointer to {@link resultValue}. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName(const NativeResourceManager *mgr, const char *resName, bool *resultValue); +/** + * @brief Add overlay resources during application runtime. + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param path Indicates the application overlay path. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_AddResource(const NativeResourceManager *mgr, char *path); +/** + * @brief RemovE overlay resources during application runtime. + * @param mgr Indicates the pointer to {@link NativeResourceManager} +{@link OH_ResourceManager_InitNativeResourceManager}. + * @param path Indicates the application overlay path. + * @since 12 + * @version 1.0 + */ ResourceManager_ErrorCode OH_ResourceManager_RemoveResource(const NativeResourceManager *mgr, char *path); #ifdef __cplusplus }; -- Gitee From fbda638884bb2ed4cacbbe54b61c45b7fe03ea9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Fri, 17 May 2024 05:44:26 +0000 Subject: [PATCH 10/13] update global/resource_management/include/resourcemanager/native_common.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../resource_management/include/resourcemanager/native_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h index 7cfd3bd13..fc6aa02bd 100644 --- a/global/resource_management/include/resourcemanager/native_common.h +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -58,7 +58,7 @@ struct NativeResourceManager; typedef struct NativeResourceManager NativeResourceManager; enum ResourceManager_ErrorCode{ - SUCCESS == 0; + SUCCESS = 0, ERROR_CODE_INVALID_INPUT_PARAMETER = 401, ERROR_CODE_RES_ID_NOT_FOUND = 9001001, ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002, -- Gitee From 639cb5907a4244b75376a198b710ce7450c3d893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Fri, 17 May 2024 05:51:23 +0000 Subject: [PATCH 11/13] update global/resource_management/include/resourcemanager/native_common.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_common.h | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h index fc6aa02bd..d5cdbb791 100644 --- a/global/resource_management/include/resourcemanager/native_common.h +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -13,28 +13,6 @@ * limitations under the License. */ -/** - * @addtogroup rawfile - * @{ - * - * @brief Provides native functions for the resource manager to operate raw file directories and their raw files. - * - * You can use the resource manager to traverse, open, seek, read, and close raw files. - * - * @since 8 - * @version 1.0 - */ - -/** - * @file raw_file_manager.h - * - * @brief Declares native functions for the resource manager. - * - * You can use the resource manager to open raw files for subsequent operations, such as seeking and reading. - * - * @since 8 - * @version 1.0 - */ #ifndef NATIVE_COMMON_H #define NATIVE_COMMON_H -- Gitee From e2bfbe088289274ccec83dbef74e6f4386bad517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Fri, 17 May 2024 08:23:04 +0000 Subject: [PATCH 12/13] update global/resource_management/include/resourcemanager/native_common.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../include/resourcemanager/native_common.h | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_common.h b/global/resource_management/include/resourcemanager/native_common.h index d5cdbb791..fda586ab5 100644 --- a/global/resource_management/include/resourcemanager/native_common.h +++ b/global/resource_management/include/resourcemanager/native_common.h @@ -50,30 +50,6 @@ enum ResourceManager_ErrorCode{ ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010, }; -/** - * @brief Obtains the native resource manager based on the JavaScipt resource manager. - * - * You need to obtain the resource manager to process raw files as required. - * - * @param env Indicates the pointer to the JavaScipt Native Interface (napi) environment. - * @param jsResMgr Indicates the JavaScipt resource manager. - * @return Returns the pointer to {@link NativeResourceManager}. - * @since 8 - * @version 1.0 - */ -NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr); - -/** - * @brief Releases the native resource manager. - * - * - * - * @param resMgr Indicates the pointer to {@link RawDir}. - * @since 8 - * @version 1.0 - */ -void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr); - #ifdef __cplusplus }; #endif -- Gitee From d3bb57bccaea4162ef0e83f71282bb25e6dbf898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=89=E5=8F=AC=E5=AE=87?= Date: Fri, 17 May 2024 10:54:31 +0000 Subject: [PATCH 13/13] update global/resource_management/include/resourcemanager/native_resource_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 冉召宇 --- .../resourcemanager/native_resource_manager.h | 108 +++++++++++++----- 1 file changed, 81 insertions(+), 27 deletions(-) diff --git a/global/resource_management/include/resourcemanager/native_resource_manager.h b/global/resource_management/include/resourcemanager/native_resource_manager.h index 3ce461157..cc43648e6 100644 --- a/global/resource_management/include/resourcemanager/native_resource_manager.h +++ b/global/resource_management/include/resourcemanager/native_resource_manager.h @@ -50,7 +50,7 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResource * @param resName Indicates the resource name. * @param density The optional parameter ScreenDensity A value of 0 means to use the density of current system dpi. * @param resultValue the result write to resultValue. - * @param resultLen the result write to resultLen. + * @param resultLen the media length write to resultLen. * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types { BusinessError } 9001003 - Invalid resource name. { BusinessError } 9001004 - No matching resource is found based on the resource name. @@ -143,7 +143,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const N * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -157,7 +160,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetSymbol(const NativeResourceManag * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -165,10 +171,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName(const NativeResourc /** * @brief Obtains locales list. + * @param resultValue the result write to resultValue. + * @param resultLen the locales length write to resultLen. * @param includeSystem the parameter controls whether to include system resources, * the default value is false, it has no effect when only system resources query the locales list. - * @return Returns the pointer to {@link resultValue}. - * @return Returns the pointer to {@link resultLen}. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types * @since 12 * @version 1.0 */ @@ -178,7 +185,7 @@ ResourceManager_ErrorCode OH_ResourceManager_GetLocales(char **resultValue, uint * @brief Obtains the device capability. * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. - * @return Returns the pointer to {@link deviceCapability}. + * @param deviceCapability the result write to deviceCapability. * @since 12 * @version 1.0 */ @@ -188,7 +195,7 @@ ResourceManager_ErrorCode OH_ResourceManager_GetDeviceCapability(const NativeRes * @brief Obtains the device configuration. * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. - * @return Returns the pointer to {@link configuration}. + * @param configuration the result write to configuration. * @since 12 * @version 1.0 */ @@ -202,7 +209,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration(const NativeResour * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -216,7 +226,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetString(const NativeResourceManag * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -230,8 +243,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetStringByName(const NativeResourc * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. - * @return Returns the pointer to {@link resultLen}. + * @param resultValue the result write to resultValue. + * @param resultLen the StringArray length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -245,8 +261,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetStringArray(const NativeResource * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. - * @return Returns the pointer to {@link resultLen}. + * @param resultValue the result write to resultValue. + * @param resultLen the StringArray length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -256,6 +275,7 @@ ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName(const NativeRe * @brief Release the array of character strings. * @param resValue the array of character strings corresponding to the specified resource name. * @param len the length of array. + * @return * @since 12 * @version 1.0 */ @@ -270,8 +290,11 @@ ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link num}. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @param resultLen the PluralString length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -286,8 +309,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourc * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link num}. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @param resultLen the PluralString length write to resultLen. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -301,7 +327,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeR * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -315,7 +344,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetColor(const NativeResourceManage * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -329,7 +361,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetColorByName(const NativeResource * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -343,7 +378,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetInt(const NativeResourceManager * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -357,7 +395,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetIntByName(const NativeResourceMa * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -371,7 +412,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetFloat(const NativeResourceManage * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -385,7 +429,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName(const NativeResource * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + { BusinessError } 9001001 - Invalid resource ID. + { BusinessError } 9001002 - No matching resource is found based on the resource ID. * @since 12 * @version 1.0 */ @@ -399,7 +446,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetBool(const NativeResourceManager * @param mgr Indicates the pointer to {@link NativeResourceManager} {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource Name. - * @return Returns the pointer to {@link resultValue}. + * @param resultValue the result write to resultValue. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types + { BusinessError } 9001003 - Invalid resource name. + { BusinessError } 9001004 - No matching resource is found based on the resource name. * @since 12 * @version 1.0 */ @@ -408,8 +458,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName(const NativeResourceM /** * @brief Add overlay resources during application runtime. * @param mgr Indicates the pointer to {@link NativeResourceManager} -{@link OH_ResourceManager_InitNativeResourceManager}. + * {@link OH_ResourceManager_InitNativeResourceManager}. * @param path Indicates the application overlay path. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + * { BusinessError } 9001010 - Invalid overlay path. * @since 12 * @version 1.0 */ @@ -418,8 +470,10 @@ ResourceManager_ErrorCode OH_ResourceManager_AddResource(const NativeResourceMan /** * @brief RemovE overlay resources during application runtime. * @param mgr Indicates the pointer to {@link NativeResourceManager} -{@link OH_ResourceManager_InitNativeResourceManager}. + * {@link OH_ResourceManager_InitNativeResourceManager}. * @param path Indicates the application overlay path. + * @return { BusinessError } 401 - If the input parameter invalid. Possible causes: Incorrect parameter types. + * { BusinessError } 9001010 - Invalid overlay path. * @since 12 * @version 1.0 */ -- Gitee