Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/js_native_api_types.h
$ cat -n /usr/include/node/js_native_api_types.h 1 #ifndef SRC_JS_NATIVE_API_TYPES_H_ 2 #define SRC_JS_NATIVE_API_TYPES_H_ 3 4 // This file needs to be compatible with C compilers. 5 // This is a public include file, and these includes have essentially 6 // became part of it's API. 7 #include
// NOLINT(modernize-deprecated-headers) 8 #include
// NOLINT(modernize-deprecated-headers) 9 10 #if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) 11 typedef uint16_t char16_t; 12 #endif 13 14 #ifndef NAPI_CDECL 15 #ifdef _WIN32 16 #define NAPI_CDECL __cdecl 17 #else 18 #define NAPI_CDECL 19 #endif 20 #endif 21 22 // JSVM API types are all opaque pointers for ABI stability 23 // typedef undefined structs instead of void* for compile time type safety 24 typedef struct napi_env__* napi_env; 25 typedef struct napi_value__* napi_value; 26 typedef struct napi_ref__* napi_ref; 27 typedef struct napi_handle_scope__* napi_handle_scope; 28 typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope; 29 typedef struct napi_callback_info__* napi_callback_info; 30 typedef struct napi_deferred__* napi_deferred; 31 32 typedef enum { 33 napi_default = 0, 34 napi_writable = 1 << 0, 35 napi_enumerable = 1 << 1, 36 napi_configurable = 1 << 2, 37 38 // Used with napi_define_class to distinguish static properties 39 // from instance properties. Ignored by napi_define_properties. 40 napi_static = 1 << 10, 41 42 #if NAPI_VERSION >= 8 43 // Default for class methods. 44 napi_default_method = napi_writable | napi_configurable, 45 46 // Default for object properties, like in JS obj[prop]. 47 napi_default_jsproperty = napi_writable | napi_enumerable | napi_configurable, 48 #endif // NAPI_VERSION >= 8 49 } napi_property_attributes; 50 51 typedef enum { 52 // ES6 types (corresponds to typeof) 53 napi_undefined, 54 napi_null, 55 napi_boolean, 56 napi_number, 57 napi_string, 58 napi_symbol, 59 napi_object, 60 napi_function, 61 napi_external, 62 napi_bigint, 63 } napi_valuetype; 64 65 typedef enum { 66 napi_int8_array, 67 napi_uint8_array, 68 napi_uint8_clamped_array, 69 napi_int16_array, 70 napi_uint16_array, 71 napi_int32_array, 72 napi_uint32_array, 73 napi_float32_array, 74 napi_float64_array, 75 napi_bigint64_array, 76 napi_biguint64_array, 77 } napi_typedarray_type; 78 79 typedef enum { 80 napi_ok, 81 napi_invalid_arg, 82 napi_object_expected, 83 napi_string_expected, 84 napi_name_expected, 85 napi_function_expected, 86 napi_number_expected, 87 napi_boolean_expected, 88 napi_array_expected, 89 napi_generic_failure, 90 napi_pending_exception, 91 napi_cancelled, 92 napi_escape_called_twice, 93 napi_handle_scope_mismatch, 94 napi_callback_scope_mismatch, 95 napi_queue_full, 96 napi_closing, 97 napi_bigint_expected, 98 napi_date_expected, 99 napi_arraybuffer_expected, 100 napi_detachable_arraybuffer_expected, 101 napi_would_deadlock, // unused 102 napi_no_external_buffers_allowed, 103 napi_cannot_run_js, 104 } napi_status; 105 // Note: when adding a new enum value to `napi_status`, please also update 106 // * `const int last_status` in the definition of `napi_get_last_error_info()' 107 // in file js_native_api_v8.cc. 108 // * `const char* error_messages[]` in file js_native_api_v8.cc with a brief 109 // message explaining the error. 110 // * the definition of `napi_status` in doc/api/n-api.md to reflect the newly 111 // added value(s). 112 113 typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env, 114 napi_callback_info info); 115 typedef void(NAPI_CDECL* napi_finalize)(napi_env env, 116 void* finalize_data, 117 void* finalize_hint); 118 119 typedef struct { 120 // One of utf8name or name should be NULL. 121 const char* utf8name; 122 napi_value name; 123 124 napi_callback method; 125 napi_callback getter; 126 napi_callback setter; 127 napi_value value; 128 129 napi_property_attributes attributes; 130 void* data; 131 } napi_property_descriptor; 132 133 typedef struct { 134 const char* error_message; 135 void* engine_reserved; 136 uint32_t engine_error_code; 137 napi_status error_code; 138 } napi_extended_error_info; 139 140 #if NAPI_VERSION >= 6 141 typedef enum { 142 napi_key_include_prototypes, 143 napi_key_own_only 144 } napi_key_collection_mode; 145 146 typedef enum { 147 napi_key_all_properties = 0, 148 napi_key_writable = 1, 149 napi_key_enumerable = 1 << 1, 150 napi_key_configurable = 1 << 2, 151 napi_key_skip_strings = 1 << 3, 152 napi_key_skip_symbols = 1 << 4 153 } napi_key_filter; 154 155 typedef enum { 156 napi_key_keep_numbers, 157 napi_key_numbers_to_strings 158 } napi_key_conversion; 159 #endif // NAPI_VERSION >= 6 160 161 #if NAPI_VERSION >= 8 162 typedef struct { 163 uint64_t lower; 164 uint64_t upper; 165 } napi_type_tag; 166 #endif // NAPI_VERSION >= 8 167 168 #endif // SRC_JS_NATIVE_API_TYPES_H_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™