LibWeb: Add IDL integer typedefs

To make it easier to work out what the correctly sized type should be,
instead of needing to consult the spec or IDL generator.
This commit is contained in:
Shannon Booth 2024-01-02 19:04:15 +13:00 committed by Andreas Kling
parent f589bedb0d
commit f1f369b6c6
Notes: sideshowbarker 2024-07-17 04:21:32 +09:00

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
namespace Web::WebIDL {
// https://webidl.spec.whatwg.org/#idl-byte
// The byte type is a signed integer type that has values in the range [128, 127].
using Byte = i8;
// https://webidl.spec.whatwg.org/#idl-octet
// The octet type is an unsigned integer type that has values in the range [0, 255].
using Octet = u8;
// https://webidl.spec.whatwg.org/#idl-short
// The short type is a signed integer type that has values in the range [32768, 32767].
using Short = i16;
// https://webidl.spec.whatwg.org/#idl-unsigned-short
// The unsigned short type is an unsigned integer type that has values in the range [0, 65535].
using UnsignedShort = u16;
// https://webidl.spec.whatwg.org/#idl-long
// The long type is a signed integer type that has values in the range [2147483648, 2147483647].
using Long = i32;
// https://webidl.spec.whatwg.org/#idl-unsigned-long
// The unsigned long type is an unsigned integer type that has values in the range [0, 4294967295].
using UnsignedLong = u32;
// https://webidl.spec.whatwg.org/#idl-long-long
// The long long type is a signed integer type that has values in the range [9223372036854775808, 9223372036854775807].
using LongLong = i64;
// https://webidl.spec.whatwg.org/#idl-unsigned-long-long
// The unsigned long long type is an unsigned integer type that has values in the range [0, 18446744073709551615].
using UnsignedLongLong = u64;
}