2021-09-08 21:34:27 -04:00
|
|
|
/*
|
2022-03-15 10:58:47 -04:00
|
|
|
* Copyright (c) 2021-2022, 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);
|
|
|
|
|
|
|
|
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;
|
2022-12-14 19:18:10 +00:00
|
|
|
virtual ThrowCompletionOr<NonnullGCPtr<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
|
|
|
};
|
|
|
|
|
2023-08-30 12:30:39 -04:00
|
|
|
ThrowCompletionOr<NonnullGCPtr<NumberFormat>> initialize_number_format(VM&, NumberFormat&, Value locales_value, Value options_value);
|
2022-08-20 08:25:24 +01: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, NumberFormat::Notation notation);
|
|
|
|
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
|
|
|
}
|