Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/nodejs/src/node_webstorage.h
1 #ifndef SRC_NODE_WEBSTORAGE_H_ 2 #define SRC_NODE_WEBSTORAGE_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include "base_object.h" 7 #include "node_mem.h" 8 #include "sqlite3.h" 9 #include "util.h" 10 11 namespace node { 12 namespace webstorage { 13 14 struct conn_deleter { 15 void operator()(sqlite3* conn) const noexcept { 16 CHECK_EQ(sqlite3_close(conn), SQLITE_OK); 17 } 18 }; 19 using conn_unique_ptr = std::unique_ptr<sqlite3, conn_deleter>; 20 21 struct stmt_deleter { 22 void operator()(sqlite3_stmt* stmt) const noexcept { sqlite3_finalize(stmt); } 23 }; 24 using stmt_unique_ptr = std::unique_ptr<sqlite3_stmt, stmt_deleter>; 25 26 static constexpr std::string_view kInMemoryPath = ":memory:"; 27 28 class Storage : public BaseObject { 29 public: 30 Storage(Environment* env, 31 v8::Local<v8::Object> object, 32 std::string_view location); 33 void MemoryInfo(MemoryTracker* tracker) const override; 34 static void New(const v8::FunctionCallbackInfo<v8::Value>& args); 35 36 v8::Maybe<void> Clear(); 37 v8::MaybeLocal<v8::Array> Enumerate(); 38 v8::MaybeLocal<v8::Value> Length(); 39 v8::MaybeLocal<v8::Value> Load(v8::Local<v8::Name> key); 40 v8::MaybeLocal<v8::Value> LoadKey(const int index); 41 v8::Maybe<void> Remove(v8::Local<v8::Name> key); 42 v8::Maybe<void> Store(v8::Local<v8::Name> key, v8::Local<v8::Value> value); 43 44 SET_MEMORY_INFO_NAME(Storage) 45 SET_SELF_SIZE(Storage) 46 47 private: 48 v8::Maybe<void> Open(); 49 50 ~Storage() override; 51 std::string location_; 52 conn_unique_ptr db_; 53 v8::Global<v8::Map> symbols_; 54 }; 55 56 } // namespace webstorage 57 } // namespace node 58 59 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 60 #endif // SRC_NODE_WEBSTORAGE_H_