mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
AK+LibUnicode: Expose TrailingCodePointTransformation in to_titlecase
Relocating the definition of this enum from LibUnicode to AK.
This commit is contained in:
@@ -34,13 +34,6 @@ struct BlockName {
|
||||
StringView display_name;
|
||||
};
|
||||
|
||||
enum class TrailingCodePointTransformation : u8 {
|
||||
// Default behaviour; Puts the first typographic letter unit of each word, if lowercase, in titlecase; the other characters in lowercase.
|
||||
Lowercase,
|
||||
// Puts the first typographic letter unit of each word, if lowercase, in titlecase; other characters are unaffected. (https://drafts.csswg.org/css-text/#valdef-text-transform-capitalize)
|
||||
PreserveExisting,
|
||||
};
|
||||
|
||||
Optional<DeprecatedString> code_point_display_name(u32 code_point);
|
||||
Optional<StringView> code_point_block_display_name(u32 code_point);
|
||||
Optional<StringView> code_point_abbreviation(u32 code_point);
|
||||
|
||||
@@ -19,7 +19,6 @@ enum class Property : u8;
|
||||
enum class Script : u8;
|
||||
enum class SentenceBreakProperty : u8;
|
||||
enum class WordBreakProperty : u8;
|
||||
enum class TrailingCodePointTransformation : u8;
|
||||
|
||||
struct CodePointDecomposition;
|
||||
struct CurrencyCode;
|
||||
|
||||
@@ -28,10 +28,10 @@ ErrorOr<String> String::to_uppercase(Optional<StringView> const& locale) const
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
ErrorOr<String> String::to_titlecase(Optional<StringView> const& locale) const
|
||||
ErrorOr<String> String::to_titlecase(Optional<StringView> const& locale, TrailingCodePointTransformation trailing_code_point_transformation) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
TRY(Unicode::Detail::build_titlecase_string(code_points(), builder, locale, Unicode::TrailingCodePointTransformation::Lowercase));
|
||||
TRY(Unicode::Detail::build_titlecase_string(code_points(), builder, locale, trailing_code_point_transformation));
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user