169570cc8Sopenharmony_ci/* 269570cc8Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 369570cc8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 469570cc8Sopenharmony_ci * you may not use this file except in compliance with the License. 569570cc8Sopenharmony_ci * You may obtain a copy of the License at 669570cc8Sopenharmony_ci * 769570cc8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 869570cc8Sopenharmony_ci * 969570cc8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1069570cc8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1169570cc8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1269570cc8Sopenharmony_ci * See the License for the specific language governing permissions and 1369570cc8Sopenharmony_ci * limitations under the License. 1469570cc8Sopenharmony_ci */ 1569570cc8Sopenharmony_ci#ifndef OHOS_RESOURCE_MANAGER_RESOURCEMANAGER_H 1669570cc8Sopenharmony_ci#define OHOS_RESOURCE_MANAGER_RESOURCEMANAGER_H 1769570cc8Sopenharmony_ci 1869570cc8Sopenharmony_ci#include <map> 1969570cc8Sopenharmony_ci#include <string> 2069570cc8Sopenharmony_ci#include <vector> 2169570cc8Sopenharmony_ci#include <memory> 2269570cc8Sopenharmony_ci 2369570cc8Sopenharmony_cinamespace OHOS { 2469570cc8Sopenharmony_cinamespace Global { 2569570cc8Sopenharmony_cinamespace Resource { 2669570cc8Sopenharmony_cienum FunctionType { 2769570cc8Sopenharmony_ci SYNC = 0, 2869570cc8Sopenharmony_ci ASYNC = 1 2969570cc8Sopenharmony_ci}; 3069570cc8Sopenharmony_ciclass ResourceManager { 3169570cc8Sopenharmony_cipublic: 3269570cc8Sopenharmony_ci typedef struct { 3369570cc8Sopenharmony_ci /** the raw file fd */ 3469570cc8Sopenharmony_ci int fd; 3569570cc8Sopenharmony_ci 3669570cc8Sopenharmony_ci /** the offset from where the raw file starts in the HAP */ 3769570cc8Sopenharmony_ci int64_t offset; 3869570cc8Sopenharmony_ci 3969570cc8Sopenharmony_ci /** the length of the raw file in the HAP. */ 4069570cc8Sopenharmony_ci int64_t length; 4169570cc8Sopenharmony_ci } RawFileDescriptor; 4269570cc8Sopenharmony_ci 4369570cc8Sopenharmony_ci struct Resource { 4469570cc8Sopenharmony_ci /** the hap bundle name */ 4569570cc8Sopenharmony_ci std::string bundleName; 4669570cc8Sopenharmony_ci 4769570cc8Sopenharmony_ci /** the hap module name */ 4869570cc8Sopenharmony_ci std::string moduleName; 4969570cc8Sopenharmony_ci 5069570cc8Sopenharmony_ci /** the resource id in hap */ 5169570cc8Sopenharmony_ci int32_t id; 5269570cc8Sopenharmony_ci }; 5369570cc8Sopenharmony_ci 5469570cc8Sopenharmony_ci enum class NapiValueType { 5569570cc8Sopenharmony_ci NAPI_NUMBER = 0, 5669570cc8Sopenharmony_ci NAPI_STRING = 1 5769570cc8Sopenharmony_ci }; 5869570cc8Sopenharmony_ci 5969570cc8Sopenharmony_ci ResourceManager() {} 6069570cc8Sopenharmony_ci ~ResourceManager() {}; 6169570cc8Sopenharmony_ci}; 6269570cc8Sopenharmony_ci 6369570cc8Sopenharmony_ciResourceManager g_resourceManager; 6469570cc8Sopenharmony_ciResourceManager *GetSystemResourceManagerNoSandBox() 6569570cc8Sopenharmony_ci{ 6669570cc8Sopenharmony_ci return &g_resourceManager; 6769570cc8Sopenharmony_ci} 6869570cc8Sopenharmony_ci} // namespace Resource 6969570cc8Sopenharmony_ci} // namespace Global 7069570cc8Sopenharmony_ci} // namespace OHOS 7169570cc8Sopenharmony_ci 7269570cc8Sopenharmony_ci#endif 73