1 /* 2 * Copyright (c) 2024 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 #ifndef OHOS_RESOURCE_MANAGER_RESOURCEMANAGER_H 16 #define OHOS_RESOURCE_MANAGER_RESOURCEMANAGER_H 17 18 #include <map> 19 #include <string> 20 #include <vector> 21 #include <memory> 22 23 namespace OHOS { 24 namespace Global { 25 namespace Resource { 26 enum FunctionType { 27 SYNC = 0, 28 ASYNC = 1 29 }; 30 class ResourceManager { 31 public: 32 typedef struct { 33 /** the raw file fd */ 34 int fd; 35 36 /** the offset from where the raw file starts in the HAP */ 37 int64_t offset; 38 39 /** the length of the raw file in the HAP. */ 40 int64_t length; 41 } RawFileDescriptor; 42 43 struct Resource { 44 /** the hap bundle name */ 45 std::string bundleName; 46 47 /** the hap module name */ 48 std::string moduleName; 49 50 /** the resource id in hap */ 51 int32_t id; 52 }; 53 54 enum class NapiValueType { 55 NAPI_NUMBER = 0, 56 NAPI_STRING = 1 57 }; 58 ResourceManager()59 ResourceManager() {} ~ResourceManager()60 ~ResourceManager() {}; 61 }; 62 63 ResourceManager g_resourceManager; GetSystemResourceManagerNoSandBox()64ResourceManager *GetSystemResourceManagerNoSandBox() 65 { 66 return &g_resourceManager; 67 } 68 } // namespace Resource 69 } // namespace Global 70 } // namespace OHOS 71 72 #endif 73