1/* 2 * Copyright (c) 2020 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#ifndef JS_NATIVE_API_CONFIG_H 17#define JS_NATIVE_API_CONFIG_H 18 19#ifdef __cplusplus 20#if __cplusplus 21extern "C" { 22#endif 23#endif /* __cplusplus */ 24 25#define FILE_NAME_MAX_LEN 300 26#define URI_NAME_MAX_LEN 128 27#define TEXT_MAX_READ_LEN 4096 28#define DIR_LEVEL 5 29#define ERROR_CODE "code" 30#define TEXT "text" 31#define FILE_URI "uri" 32#define FILE_SOURCE_URI "srcUri" 33#define FILE_DESTINATION_URI "dstUri" 34#define FILE_LENGTH "length" 35#define FILE_LAST_MODIFIED_TIME "lastModifiedTime" 36#define FILE_TYPE "type" 37#define FILE_POSITION "position" 38#define FILE_APPEND "append" 39#define FILE_BUFFER "buffer" 40#define KV_KEY "key" 41#define KV_VALUE "value" 42#define DEFAULT "default" 43#define FILE_PREFIX "internal://app" 44#define DEFAULT_FOLDER_PATH "kvstore" 45#define TYPE_FILE "file" 46#define TYPE_DIR "dir" 47#define FILE_LIST "fileList" 48#define RECURSIVE "recursive" 49#define SUB_FILES "subFiles" 50#define ERR_NO_FILE "File or directory not exist" 51#define ERR_IO_EXCEPTION "I/O error" 52#define ERR_ILLEGAL_PARAM "Invalid parameter" 53#define ERR_GENERAL "System error" 54#define ERR_READ_TOO_LONG "The content of the file to be read exceeds 4KB" 55 56#define NATIVE_FEATURE_ON 1 57#define NATIVE_FEATURE_OFF 0 58 59enum ErrorCode { 60 NATIVE_SUCCESS = 0, 61 ERROR_FR_NO_FILE = -2, 62 ERROR_DIR_NOT_EMPTY = -39, 63 ERROR_CODE_GENERAL = -200, 64 ERROR_CODE_PARAM = -202, 65 ERROR_CODE_IO = -300, 66 ERROR_CODE_NO_FILE = -301, 67 ERROR_CODE_READ_TOO_LONG = -302 68}; 69 70#ifdef __cplusplus 71#if __cplusplus 72} 73#endif 74#endif /* __cplusplus */ 75 76#endif /* JS_NATIVE_API_COMMON_H */