Locale: Support for Percent Formatting

Updates BNumberFormat to be able to format
percentages.  Also re-introduces some unit
tests and updates the BNumberFormat ones.

This doesn't actually fix #16312 as the
defaults for percentage formatting don't seem
to track the selected language, but goes part
way there.

Related to #16312

Change-Id: Id6ddf426ce5571f4e8513c0eb1663cf42ac53cb1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3767
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Andrew Lindesay
2021-03-13 00:29:32 +00:00
parent 4c2d3a38ad
commit 564de1924a
11 changed files with 280 additions and 42 deletions
+7 -2
View File
@@ -19,7 +19,7 @@ class BNumberFormatImpl;
class BNumberFormat : public BFormat {
public:
BNumberFormat();
BNumberFormat(const BLocale* locale = NULL);
~BNumberFormat();
ssize_t Format(char* string, size_t maxSize,
@@ -34,9 +34,14 @@ public:
status_t FormatMonetary(BString& string,
const double value);
ssize_t FormatPercent(char* string, size_t maxSize,
const double value);
status_t FormatPercent(BString& string,
const double value);
status_t Parse(const BString& string, double& value);
BString GetSeparator(BNumberElement element);
BString GetSeparator(BNumberElement element);
private:
BNumberFormat(const BNumberFormat &other);