2021-09-08 21:34:27 -04:00
|
|
|
/*
|
2024-06-09 14:36:48 -04:00
|
|
|
* Copyright (c) 2021-2024, Tim Flynn <trflynn89@serenityos.org>
|
2021-09-08 21:34:27 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-03-15 10:58:47 -04:00
|
|
|
#include <LibJS/Runtime/Intl/NumberFormat.h>
|
2021-09-08 21:34:27 -04:00
|
|
|
#include <LibJS/Runtime/NativeFunction.h>
|
|
|
|
|
|
|
|
namespace JS::Intl {
|
|
|
|
|
|
|
|
class NumberFormatConstructor final : public NativeFunction {
|
|
|
|
JS_OBJECT(NumberFormatConstructor, NativeFunction);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(NumberFormatConstructor);
|
2021-09-08 21:34:27 -04:00
|
|
|
|
|
|
|
public:
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(Realm&) override;
|
2021-09-08 21:34:27 -04:00
|
|
|
virtual ~NumberFormatConstructor() override = default;
|
|
|
|
|
2021-10-20 21:16:30 +01:00
|
|
|
virtual ThrowCompletionOr<Value> call() override;
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
|
2021-09-08 21:34:27 -04:00
|
|
|
|
|
|
|
private:
|
2022-08-28 23:51:28 +02:00
|
|
|
explicit NumberFormatConstructor(Realm&);
|
|
|
|
|
2021-09-08 21:34:27 -04:00
|
|
|
virtual bool has_constructor() const override { return true; }
|
2021-09-10 11:12:05 -04:00
|
|
|
|
2021-10-22 22:49:43 +01:00
|
|
|
JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
|
2021-09-08 21:34:27 -04:00
|
|
|
};
|
|
|
|
|
2024-06-23 09:14:27 -04:00
|
|
|
ThrowCompletionOr<void> set_number_format_digit_options(VM&, NumberFormatBase& intl_object, Object const& options, int default_min_fraction_digits, int default_max_fraction_digits, Unicode::Notation notation);
|
2022-08-20 08:25:24 +01:00
|
|
|
ThrowCompletionOr<void> set_number_format_unit_options(VM&, NumberFormat& intl_object, Object const& options);
|
2022-03-15 10:58:47 -04:00
|
|
|
|
2021-09-08 21:34:27 -04:00
|
|
|
}
|