Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/v8-message.h
$ cat -n /usr/include/node/v8-message.h 1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef INCLUDE_V8_MESSAGE_H_ 6 #define INCLUDE_V8_MESSAGE_H_ 7 8 #include <stdio.h> 9 10 #include <iosfwd> 11 12 #include "v8-local-handle.h" // NOLINT(build/include_directory) 13 #include "v8-maybe.h" // NOLINT(build/include_directory) 14 #include "v8-primitive.h" // NOLINT(build/include_directory) 15 #include "v8config.h" // NOLINT(build/include_directory) 16 17 namespace v8 { 18 19 class Integer; 20 class PrimitiveArray; 21 class StackTrace; 22 class String; 23 class Value; 24 25 /** 26 * The optional attributes of ScriptOrigin. 27 */ 28 class ScriptOriginOptions { 29 public: 30 V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false, 31 bool is_opaque = false, bool is_wasm = false, 32 bool is_module = false) 33 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) | 34 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) | 35 (is_module ? kIsModule : 0)) {} 36 V8_INLINE ScriptOriginOptions(int flags) 37 : flags_(flags & 38 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {} 39 40 bool IsSharedCrossOrigin() const { 41 return (flags_ & kIsSharedCrossOrigin) != 0; 42 } 43 bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; } 44 bool IsWasm() const { return (flags_ & kIsWasm) != 0; } 45 bool IsModule() const { return (flags_ & kIsModule) != 0; } 46 47 int Flags() const { return flags_; } 48 49 private: 50 enum { 51 kIsSharedCrossOrigin = 1, 52 kIsOpaque = 1 << 1, 53 kIsWasm = 1 << 2, 54 kIsModule = 1 << 3 55 }; 56 const int flags_; 57 }; 58 59 /** 60 * The origin, within a file, of a script. 61 */ 62 class V8_EXPORT ScriptOrigin { 63 public: 64 V8_DEPRECATE_SOON("Use constructor without the isolate.") 65 V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name, 66 int resource_line_offset = 0, 67 int resource_column_offset = 0, 68 bool resource_is_shared_cross_origin = false, 69 int script_id = -1, 70 Local<Value> source_map_url = Local<Value>(), 71 bool resource_is_opaque = false, bool is_wasm = false, 72 bool is_module = false, 73 Local<Data> host_defined_options = Local<Data>()) 74 : resource_name_(resource_name), 75 resource_line_offset_(resource_line_offset), 76 resource_column_offset_(resource_column_offset), 77 options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm, 78 is_module), 79 script_id_(script_id), 80 source_map_url_(source_map_url), 81 host_defined_options_(host_defined_options) { 82 VerifyHostDefinedOptions(); 83 } 84 85 V8_INLINE ScriptOrigin(Local<Value> resource_name, 86 int resource_line_offset = 0, 87 int resource_column_offset = 0, 88 bool resource_is_shared_cross_origin = false, 89 int script_id = -1, 90 Local<Value> source_map_url = Local<Value>(), 91 bool resource_is_opaque = false, bool is_wasm = false, 92 bool is_module = false, 93 Local<Data> host_defined_options = Local<Data>()) 94 : resource_name_(resource_name), 95 resource_line_offset_(resource_line_offset), 96 resource_column_offset_(resource_column_offset), 97 options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm, 98 is_module), 99 script_id_(script_id), 100 source_map_url_(source_map_url), 101 host_defined_options_(host_defined_options) { 102 VerifyHostDefinedOptions(); 103 } 104 105 V8_INLINE Local<Value> ResourceName() const; 106 V8_INLINE int LineOffset() const; 107 V8_INLINE int ColumnOffset() const; 108 V8_INLINE int ScriptId() const; 109 V8_INLINE Local<Value> SourceMapUrl() const; 110 V8_INLINE Local<Data> GetHostDefinedOptions() const; 111 V8_INLINE ScriptOriginOptions Options() const { return options_; } 112 113 private: 114 void VerifyHostDefinedOptions() const; 115 Local<Value> resource_name_; 116 int resource_line_offset_; 117 int resource_column_offset_; 118 ScriptOriginOptions options_; 119 int script_id_; 120 Local<Value> source_map_url_; 121 Local<Data> host_defined_options_; 122 }; 123 124 /** 125 * An error message. 126 */ 127 class V8_EXPORT Message { 128 public: 129 Local<String> Get() const; 130 131 /** 132 * Return the isolate to which the Message belongs. 133 */ 134 Isolate* GetIsolate() const; 135 136 V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSource( 137 Local<Context> context) const; 138 V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine( 139 Local<Context> context) const; 140 141 /** 142 * Returns the origin for the script from where the function causing the 143 * error originates. 144 */ 145 ScriptOrigin GetScriptOrigin() const; 146 147 /** 148 * Returns the resource name for the script from where the function causing 149 * the error originates. 150 */ 151 Local<Value> GetScriptResourceName() const; 152 153 /** 154 * Exception stack trace. By default stack traces are not captured for 155 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows 156 * to change this option. 157 */ 158 Local<StackTrace> GetStackTrace() const; 159 160 /** 161 * Returns the number, 1-based, of the line where the error occurred. 162 */ 163 V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const; 164 165 /** 166 * Returns the index within the script of the first character where 167 * the error occurred. 168 */ 169 int GetStartPosition() const; 170 171 /** 172 * Returns the index within the script of the last character where 173 * the error occurred. 174 */ 175 int GetEndPosition() const; 176 177 /** 178 * Returns the Wasm function index where the error occurred. Returns -1 if 179 * message is not from a Wasm script. 180 */ 181 int GetWasmFunctionIndex() const; 182 183 /** 184 * Returns the error level of the message. 185 */ 186 int ErrorLevel() const; 187 188 /** 189 * Returns the index within the line of the first character where 190 * the error occurred. 191 */ 192 int GetStartColumn() const; 193 V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const; 194 195 /** 196 * Returns the index within the line of the last character where 197 * the error occurred. 198 */ 199 int GetEndColumn() const; 200 V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const; 201 202 /** 203 * Passes on the value set by the embedder when it fed the script from which 204 * this Message was generated to V8. 205 */ 206 bool IsSharedCrossOrigin() const; 207 bool IsOpaque() const; 208 209 static void PrintCurrentStackTrace(Isolate* isolate, std::ostream& out); 210 211 static const int kNoLineNumberInfo = 0; 212 static const int kNoColumnInfo = 0; 213 static const int kNoScriptIdInfo = 0; 214 static const int kNoWasmFunctionIndexInfo = -1; 215 }; 216 217 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; } 218 219 Local<Data> ScriptOrigin::GetHostDefinedOptions() const { 220 return host_defined_options_; 221 } 222 223 int ScriptOrigin::LineOffset() const { return resource_line_offset_; } 224 225 int ScriptOrigin::ColumnOffset() const { return resource_column_offset_; } 226 227 int ScriptOrigin::ScriptId() const { return script_id_; } 228 229 Local<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; } 230 231 } // namespace v8 232 233 #endif // INCLUDE_V8_MESSAGE_H_
Welcome to MyWebUniversity on May 30, 2025.
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™