mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
AK+LibUnicode: Expose TrailingCodePointTransformation in to_titlecase
Relocating the definition of this enum from LibUnicode to AK.
This commit is contained in:
parent
af7df1dbbf
commit
6b32a1f18f
6 changed files with 14 additions and 11 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue