Issue #1756 - Initial wrapped implementation in C++

This commit is contained in:
Moonchild 2021-03-31 11:54:20 +00:00 committed by roytam1
commit 5df0028108
10 changed files with 760 additions and 27 deletions

View file

@ -25,6 +25,7 @@
#include "unicode/parseerr.h"
#include "unicode/uformattable.h"
#include "unicode/udisplaycontext.h"
#include "unicode/ufieldpositer.h"
/**
* \file
@ -651,6 +652,57 @@ unum_formatUFormattable(const UNumberFormat* fmt,
UFieldPosition *pos,
UErrorCode *status);
/**
* Format a double using a UNumberFormat according to the UNumberFormat's locale,
* and initialize a UFieldPositionIterator that enumerates the subcomponents of
* the resulting string.
*
* @param format
* The formatter to use.
* @param number
* The number to format.
* @param result
* A pointer to a buffer to receive the NULL-terminated formatted
* number. If the formatted number fits into dest but cannot be
* NULL-terminated (length == resultLength) then the error code is set
* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't
* fit into result then the error code is set to
* U_BUFFER_OVERFLOW_ERROR.
* @param resultLength
* The maximum size of result.
* @param fpositer
* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
* (may be NULL if field position information is not needed, but in this
* case it's preferable to use {@link #unum_formatDouble}). Iteration
* information already present in the UFieldPositionIterator is deleted,
* and the iterator is reset to apply to the fields in the formatted
* string created by this function call. The field values and indexes
* returned by {@link #ufieldpositer_next} represent fields denoted by
* the UNumberFormatFields enum. Fields are not returned in a guaranteed
* order. Fields cannot overlap, but they may nest. For example, 1234
* could format as "1,234" which might consist of a grouping separator
* field for ',' and an integer field encompassing the entire string.
* @param status
* A pointer to an UErrorCode to receive any errors
* @return
* The total buffer size needed; if greater than resultLength, the
* output was truncated.
* @see unum_formatDouble
* @see unum_parse
* @see unum_parseDouble
* @see UFieldPositionIterator
* @see UNumberFormatFields
* @draft ICU 59
*/
U_DRAFT int32_t U_EXPORT2
unum_formatDoubleForFields(const UNumberFormat* format,
double number,
UChar* result,
int32_t resultLength,
UFieldPositionIterator* fpositer,
UErrorCode* status);
#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS
/**
* Parse a string into an integer using a UNumberFormat.
* The string will be parsed according to the UNumberFormat's locale.