1/* 2* Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 16import { FileTemp } from "../../gen/datatype"; 17 18export let napiCommonHTemplate: FileTemp = { 19 name: '[fileName]common.h', 20 content: ` 21 #ifndef NAPITUTORIALS_[upper_filename]COMMON_H 22#define NAPITUTORIALS_[upper_filename]COMMON_H 23 24#include <js_native_api.h> 25#include <js_native_api_types.h> 26#include <string> 27#include <stdio.h> 28#include <vector> 29#include "hilog/log.h" 30#include "napi/native_api.h" 31#include "[fileName].h" 32 33#define GLOBAL_RESMGR (0xFFEE) 34const unsigned int LOG_PRINT_DOMAIN = 0xFF00; 35 36constexpr int32_t STR_MAX_SIZES = 200; 37constexpr int32_t LONG_STR_MAX_SIZES = 1024; 38constexpr uint8_t PARAMS0 = 0; 39constexpr uint8_t PARAMS1 = 1; 40constexpr uint8_t PARAMS2 = 2; 41constexpr uint8_t PARAMS3 = 3; 42constexpr uint8_t PARAMS4 = 4; 43constexpr uint8_t PARAMS5 = 5; 44constexpr uint8_t PARAMS6 = 6; 45constexpr uint8_t PARAMS7 = 7; 46constexpr uint8_t PARAMS8 = 8; 47constexpr uint8_t PARAMS9 = 9; 48constexpr uint8_t PARAMS10 = 10; 49constexpr uint8_t PARAMS11 = 11; 50constexpr uint8_t PARAMS12 = 12; 51constexpr uint8_t PARAMS100 = 100; 52 53void getErrMessage(napi_status &status, napi_env &env, const napi_extended_error_info *&extended_error_info, 54 const char *info, const char *tag); 55 56#endif //NAPITUTORIALS_[upper_filename]COMMON_H 57` 58}