PluralRules.h 896 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2022, Tim Flynn <trflynn89@pm.me>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/StringView.h>
  9. #include <LibJS/Runtime/Completion.h>
  10. #include <LibJS/Runtime/Intl/NumberFormat.h>
  11. #include <LibJS/Runtime/Object.h>
  12. namespace JS::Intl {
  13. class PluralRules final : public NumberFormatBase {
  14. JS_OBJECT(PluralRules, NumberFormatBase);
  15. public:
  16. enum class Type {
  17. Cardinal,
  18. Ordinal,
  19. };
  20. PluralRules(Object& prototype);
  21. virtual ~PluralRules() override = default;
  22. Type type() const { return m_type; }
  23. StringView type_string() const;
  24. void set_type(StringView type);
  25. private:
  26. Type m_type { Type::Cardinal }; // [[Type]]
  27. };
  28. ThrowCompletionOr<PluralRules*> initialize_plural_rules(GlobalObject& global_object, PluralRules& plural_rules, Value locales_value, Value options_value);
  29. }