1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:27:35 +00:00

LibJS: Replace JS::Intl::PluralRules::Type with Unicode::PluralForm

The JS::Intl enum was added when implementing the PluralRules
constructor. Now that LibUnicode has a plural rules implementation,
replace the JS::Intl enum with the analagous Unicode enum.
This commit is contained in:
Timothy Flynn 2022-07-07 09:58:36 -04:00 committed by Linus Groh
parent 2982aa0373
commit 670bd066a5
2 changed files with 5 additions and 32 deletions

View file

@ -10,6 +10,7 @@
#include <AK/StringView.h>
#include <LibJS/Runtime/Intl/NumberFormat.h>
#include <LibJS/Runtime/Object.h>
#include <LibUnicode/PluralRules.h>
namespace JS::Intl {
@ -17,20 +18,15 @@ class PluralRules final : public NumberFormatBase {
JS_OBJECT(PluralRules, NumberFormatBase);
public:
enum class Type {
Cardinal,
Ordinal,
};
PluralRules(Object& prototype);
virtual ~PluralRules() override = default;
Type type() const { return m_type; }
StringView type_string() const;
void set_type(StringView type);
Unicode::PluralForm type() const { return m_type; }
StringView type_string() const { return Unicode::plural_form_to_string(m_type); }
void set_type(StringView type) { m_type = Unicode::plural_form_from_string(type); }
private:
Type m_type { Type::Cardinal }; // [[Type]]
Unicode::PluralForm m_type { Unicode::PluralForm::Cardinal }; // [[Type]]
};
}