NEW 180753
makeString: add single-character helpers
https://bugs.webkit.org/show_bug.cgi?id=180753
Summary makeString: add single-character helpers
JF Bastien
Reported 2017-12-13 09:42:47 PST
It's neat how we do RawPointer(...) when trying to print (so we don't inadvertently pass a pointer). We should do the same thing for raw characters, especially considering that right now `unsigned short` just prints as a character (see test I added in #180720)! While we're there, it would also be very neat to have makeString helpers for integer formatting such as HexInt(...) while also choosing upper-/lower-case and 0x prefix. The same can be done for left-padding (with spaces or arbitrary character) as well as alignment, etc.
Attachments
JF Bastien
Comment 1 2017-12-13 09:44:58 PST
Note that we already have FormattedNumber for floating-point values.
Darin Adler
Comment 2 2017-12-13 21:04:34 PST
All good ideas. But please only add things we use.
Charlie Turner
Comment 3 2019-01-03 03:13:29 PST
I attempted the syntax for raw characters in https://bugs.webkit.org/show_bug.cgi?id=193101
Fujii Hironori
Comment 4 2019-01-06 18:20:04 PST
ICU 59 did the gutsy API breaking change typedefing UChar as char16_t. http://site.icu-project.org/download/59 What about the idea updating WTF's copy of ICU header? This seems a right direction?
Darin Adler
Comment 5 2020-01-26 20:51:43 PST
(In reply to Fujii Hironori from comment #4) > ICU 59 did the gutsy API breaking change typedefing UChar as char16_t. > http://site.icu-project.org/download/59 > What about the idea updating WTF's copy of ICU header? > This seems a right direction? Yes, I think that would be a good way to end up. I think this would be a significant transition project for WebKit. On Cocoa platforms, the types for Unicode characters in Core Foundation and Foundation, UniChar and unichar, are both typedefs for unsigned short. Thus there are many places where we use UChar, UniChar, and unichar interchangeably. Most of those would need to change. I think we've been careful to only use the C functions in ICU with C linkage, so we wouldn't have the most obvious kinds of runtime incompatibility issues, like mangled function names being different.
Note You need to log in before you can comment on or make changes to this bug.