ListFormat.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2021, 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/Object.h>
  10. namespace JS::Intl {
  11. class ListFormat final : public Object {
  12. JS_OBJECT(ListFormat, Object);
  13. public:
  14. enum class Type {
  15. Invalid,
  16. Conjunction,
  17. Disjunction,
  18. Unit,
  19. };
  20. enum class Style {
  21. Invalid,
  22. Narrow,
  23. Short,
  24. Long,
  25. };
  26. ListFormat(Object& prototype);
  27. virtual ~ListFormat() override = default;
  28. String const& locale() const { return m_locale; }
  29. void set_locale(String locale) { m_locale = move(locale); }
  30. Type type() const { return m_type; }
  31. void set_type(StringView type);
  32. StringView type_string() const;
  33. Style style() const { return m_style; }
  34. void set_style(StringView style);
  35. StringView style_string() const;
  36. private:
  37. String m_locale; // [[Locale]]
  38. Type m_type { Type::Invalid }; // [[Type]]
  39. Style m_style { Style::Invalid }; // [[Style]]
  40. };
  41. }