LibWeb/IDB: Use enum flags in IDBCursor

This commit is contained in:
stelar7 2025-05-13 09:09:34 +02:00 committed by Shannon Booth
commit a5023ec053
Notes: github-actions[bot] 2025-05-13 10:50:42 +00:00
4 changed files with 19 additions and 9 deletions

View file

@ -25,9 +25,19 @@ class IDBCursor : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(IDBCursor, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(IDBCursor);
enum class GotValue {
No,
Yes,
};
enum class KeyOnly {
No,
Yes,
};
public:
virtual ~IDBCursor() override;
[[nodiscard]] static GC::Ref<IDBCursor> create(JS::Realm&, CursorSourceHandle, GC::Ptr<Key>, Bindings::IDBCursorDirection, bool, GC::Ptr<Key>, JS::Value, GC::Ref<IDBKeyRange>, bool);
[[nodiscard]] static GC::Ref<IDBCursor> create(JS::Realm&, CursorSourceHandle, GC::Ptr<Key>, Bindings::IDBCursorDirection, GotValue, GC::Ptr<Key>, JS::Value, GC::Ref<IDBKeyRange>, KeyOnly);
[[nodiscard]] CursorSourceHandle source_handle() { return m_source_handle; }
[[nodiscard]] Bindings::IDBCursorDirection direction() { return m_direction; }
@ -55,7 +65,7 @@ public:
WebIDL::ExceptionOr<void> continue_(JS::Value);
protected:
explicit IDBCursor(JS::Realm&, CursorSourceHandle, GC::Ptr<Key>, Bindings::IDBCursorDirection, bool, GC::Ptr<Key>, JS::Value, GC::Ref<IDBKeyRange>, bool);
explicit IDBCursor(JS::Realm&, CursorSourceHandle, GC::Ptr<Key>, Bindings::IDBCursorDirection, GotValue, GC::Ptr<Key>, JS::Value, GC::Ref<IDBKeyRange>, KeyOnly);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor& visitor) override;