NumberFormatConstructor.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2021-2024, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/Intl/NumberFormat.h>
  8. #include <LibJS/Runtime/NativeFunction.h>
  9. namespace JS::Intl {
  10. class NumberFormatConstructor final : public NativeFunction {
  11. JS_OBJECT(NumberFormatConstructor, NativeFunction);
  12. JS_DECLARE_ALLOCATOR(NumberFormatConstructor);
  13. public:
  14. virtual void initialize(Realm&) override;
  15. virtual ~NumberFormatConstructor() override = default;
  16. virtual ThrowCompletionOr<Value> call() override;
  17. virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override;
  18. private:
  19. explicit NumberFormatConstructor(Realm&);
  20. virtual bool has_constructor() const override { return true; }
  21. JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);
  22. };
  23. 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);
  24. ThrowCompletionOr<void> set_number_format_unit_options(VM&, NumberFormat& intl_object, Object const& options);
  25. }