Files
ladybird/Libraries/LibWeb/WebAssembly/Table.h
Shannon Booth 5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00

46 lines
1.2 KiB
C++

/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <LibGC/Ptr.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Value.h>
#include <LibWasm/AbstractMachine/AbstractMachine.h>
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Bindings/Table.h>
namespace Web::WebAssembly {
class Table : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(Table, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(Table);
public:
static WebIDL::ExceptionOr<GC::Ref<Table>> construct_impl(JS::Realm&, Bindings::TableDescriptor& descriptor, JS::Value value);
WebIDL::ExceptionOr<u32> grow(u32 delta, JS::Value value);
WebIDL::ExceptionOr<JS::Value> get(u32 index) const;
WebIDL::ExceptionOr<void> set(u32 index, JS::Value value);
WebIDL::ExceptionOr<u32> length() const;
Wasm::TableAddress address() const { return m_address; }
private:
Table(JS::Realm&, Wasm::TableAddress);
virtual void initialize(JS::Realm&) override;
Wasm::TableAddress m_address;
};
}