Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/nodejs/src/node_metadata.h
1 #ifndef SRC_NODE_METADATA_H_ 2 #define SRC_NODE_METADATA_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <array> 7 #include <string> 8 #include <utility> 9 #include "node_version.h" 10 11 #if HAVE_OPENSSL 12 #include <openssl/crypto.h> 13 #if NODE_OPENSSL_HAS_QUIC 14 #include <openssl/quic.h> 15 #endif 16 #endif // HAVE_OPENSSL 17 18 namespace node { 19 20 // if this is a release build and no explicit base has been set 21 // substitute the standard release download URL 22 #ifndef NODE_RELEASE_URLBASE 23 #if NODE_VERSION_IS_RELEASE 24 #define NODE_RELEASE_URLBASE "https://nodejs.org/download/release/" 25 #endif // NODE_VERSION_IS_RELEASE 26 #endif // NODE_RELEASE_URLBASE 27 28 #if defined(NODE_RELEASE_URLBASE) 29 #define NODE_HAS_RELEASE_URLS 30 #endif 31 32 #if HAVE_AMARO && !defined(NODE_SHARED_BUILTIN_AMARO_DIST_INDEX_PATH) 33 #define NODE_VERSIONS_KEY_AMARO(V) V(amaro) 34 #else 35 #define NODE_VERSIONS_KEY_AMARO(V) 36 #endif 37 38 #ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH 39 #define NODE_VERSIONS_KEY_UNDICI(V) V(undici) 40 #else 41 #define NODE_VERSIONS_KEY_UNDICI(V) 42 #endif 43 44 #define NODE_VERSIONS_KEYS_BASE(V) \ 45 V(node) \ 46 V(v8) \ 47 V(uv) \ 48 V(zlib) \ 49 V(brotli) \ 50 V(zstd) \ 51 V(ares) \ 52 V(modules) \ 53 V(nghttp2) \ 54 V(napi) \ 55 V(llhttp) \ 56 V(uvwasi) \ 57 V(acorn) \ 58 V(simdjson) \ 59 V(simdutf) \ 60 V(ada) \ 61 V(nbytes) \ 62 NODE_VERSIONS_KEY_AMARO(V) \ 63 NODE_VERSIONS_KEY_UNDICI(V) \ 64 V(cjs_module_lexer) 65 66 #if HAVE_OPENSSL 67 #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) V(ncrypto) 68 #else 69 #define NODE_VERSIONS_KEY_CRYPTO(V) 70 #endif 71 72 #ifdef NODE_HAVE_I18N_SUPPORT 73 #define NODE_VERSIONS_KEY_INTL(V) \ 74 V(cldr) \ 75 V(icu) \ 76 V(tz) \ 77 V(unicode) 78 #else 79 #define NODE_VERSIONS_KEY_INTL(V) 80 #endif // NODE_HAVE_I18N_SUPPORT 81 82 #ifdef OPENSSL_INFO_QUIC 83 #define NODE_VERSIONS_KEY_QUIC(V) \ 84 V(ngtcp2) \ 85 V(nghttp3) 86 #else 87 #define NODE_VERSIONS_KEY_QUIC(V) 88 #endif 89 90 #if HAVE_SQLITE 91 #define NODE_VERSIONS_KEY_SQLITE(V) V(sqlite) 92 #else 93 #define NODE_VERSIONS_KEY_SQLITE(V) 94 #endif 95 96 #define NODE_VERSIONS_KEYS(V) \ 97 NODE_VERSIONS_KEYS_BASE(V) \ 98 NODE_VERSIONS_KEY_CRYPTO(V) \ 99 NODE_VERSIONS_KEY_INTL(V) \ 100 NODE_VERSIONS_KEY_QUIC(V) \ 101 NODE_VERSIONS_KEY_SQLITE(V) 102 103 #define V(key) +1 104 constexpr int NODE_VERSIONS_KEY_COUNT = NODE_VERSIONS_KEYS(V); 105 #undef V 106 107 class Metadata { 108 public: 109 Metadata(); 110 Metadata(Metadata&) = delete; 111 Metadata(Metadata&&) = delete; 112 Metadata operator=(Metadata&) = delete; 113 Metadata operator=(Metadata&&) = delete; 114 115 struct Versions { 116 Versions(); 117 118 #ifdef NODE_HAVE_I18N_SUPPORT 119 // Must be called on the main thread after 120 // i18n::InitializeICUDirectory() 121 void InitializeIntlVersions(); 122 #endif // NODE_HAVE_I18N_SUPPORT 123 124 #define V(key) std::string key; 125 NODE_VERSIONS_KEYS(V) 126 #undef V 127 128 std::array<std::pair<std::string_view, std::string_view>, 129 NODE_VERSIONS_KEY_COUNT> 130 pairs() const; 131 }; 132 133 struct Release { 134 Release(); 135 136 std::string name; 137 #if NODE_VERSION_IS_LTS 138 std::string lts; 139 #endif // NODE_VERSION_IS_LTS 140 141 #ifdef NODE_HAS_RELEASE_URLS 142 std::string source_url; 143 std::string headers_url; 144 #ifdef _WIN32 145 std::string lib_url; 146 #endif // _WIN32 147 #endif // NODE_HAS_RELEASE_URLS 148 }; 149 150 Versions versions; 151 const Release release; 152 const std::string arch; 153 const std::string platform; 154 }; 155 156 // Per-process global 157 namespace per_process { 158 extern Metadata metadata; 159 } 160 161 } // namespace node 162 163 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 164 #endif // SRC_NODE_METADATA_H_