Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/nodejs/src/node_url.h
1 #ifndef SRC_NODE_URL_H_ 2 #define SRC_NODE_URL_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <cinttypes> 7 #include "ada.h" 8 #include "aliased_buffer.h" 9 #include "node.h" 10 #include "node_snapshotable.h" 11 #include "util.h" 12 #include "v8-fast-api-calls.h" 13 #include "v8.h" 14 15 #include <optional> 16 #include <string> 17 18 namespace node { 19 class ExternalReferenceRegistry; 20 21 namespace url { 22 23 enum url_update_action { 24 kProtocol = 0, 25 kHost = 1, 26 kHostname = 2, 27 kPort = 3, 28 kUsername = 4, 29 kPassword = 5, 30 kPathname = 6, 31 kSearch = 7, 32 kHash = 8, 33 kHref = 9, 34 }; 35 36 class BindingData : public SnapshotableObject { 37 public: 38 BindingData(Realm* realm, v8::Local<v8::Object> obj); 39 40 using InternalFieldInfo = InternalFieldInfoBase; 41 42 SERIALIZABLE_OBJECT_METHODS() 43 SET_BINDING_ID(url_binding_data) 44 45 void MemoryInfo(MemoryTracker* tracker) const override; 46 SET_SELF_SIZE(BindingData) 47 SET_MEMORY_INFO_NAME(BindingData) 48 49 static void DomainToASCII(const v8::FunctionCallbackInfo<v8::Value>& args); 50 static void DomainToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args); 51 52 static void CanParse(const v8::FunctionCallbackInfo<v8::Value>& args); 53 static bool FastCanParse(v8::Local<v8::Value> receiver, 54 const v8::FastOneByteString& input); 55 static bool FastCanParseWithBase(v8::Local<v8::Value> receiver, 56 const v8::FastOneByteString& input, 57 const v8::FastOneByteString& base); 58 59 static void Format(const v8::FunctionCallbackInfo<v8::Value>& args); 60 static void GetOrigin(const v8::FunctionCallbackInfo<v8::Value>& args); 61 static void Parse(const v8::FunctionCallbackInfo<v8::Value>& args); 62 static void PathToFileURL(const v8::FunctionCallbackInfo<v8::Value>& args); 63 static void Update(const v8::FunctionCallbackInfo<v8::Value>& args); 64 65 static void CreatePerIsolateProperties(IsolateData* isolate_data, 66 v8::Local<v8::ObjectTemplate> ctor); 67 static void CreatePerContextProperties(v8::Local<v8::Object> target, 68 v8::Local<v8::Value> unused, 69 v8::Local<v8::Context> context, 70 void* priv); 71 static void RegisterExternalReferences(ExternalReferenceRegistry* registry); 72 73 private: 74 static constexpr size_t kURLComponentsLength = 9; 75 AliasedUint32Array url_components_buffer_; 76 77 void UpdateComponents(const ada::url_components& components, 78 const ada::scheme::type type); 79 80 static v8::CFunction fast_can_parse_methods_[]; 81 }; 82 83 void ThrowInvalidURL(Environment* env, 84 std::string_view input, 85 std::optional<std::string> base); 86 std::string FromFilePath(std::string_view file_path); 87 std::optional<std::string> FileURLToPath(Environment* env, 88 const ada::url_aggregator& file_url); 89 90 } // namespace url 91 92 } // namespace node 93 94 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 95 96 #endif // SRC_NODE_URL_H_