2 ******************************************************************************
4 * Copyright (C) 1998-2004, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 11/19/98 stephen Creation.
15 * 03/12/99 stephen Modified for new C API.
16 ******************************************************************************
22 #include "unicode/utypes.h"
24 #if !UCONFIG_NO_FORMATTING
26 #include "unicode/ustdio.h"
31 * Struct encapsulating a single uprintf format specification.
33 typedef struct u_printf_spec_info
{
34 int32_t fPrecision
; /* Precision */
35 int32_t fWidth
; /* Width */
37 UChar fSpec
; /* Conversion specification */
38 UChar fPadChar
; /* Padding character */
40 UBool fAlt
; /* # flag */
41 UBool fSpace
; /* Space flag */
42 UBool fLeft
; /* - flag */
43 UBool fShowSign
; /* + flag */
44 UBool fZero
; /* 0 flag */
46 UBool fIsLongDouble
; /* L flag */
47 UBool fIsShort
; /* h flag */
48 UBool fIsLong
; /* l flag */
49 UBool fIsLongLong
; /* ll flag */
52 typedef int32_t U_EXPORT2
53 u_printf_write_stream(void *context
,
57 typedef int32_t U_EXPORT2
58 u_printf_pad_and_justify_stream(void *context
,
59 const u_printf_spec_info
*info
,
63 typedef struct u_printf_stream_handler
{
64 u_printf_write_stream
*write
;
65 u_printf_pad_and_justify_stream
*pad_and_justify
;
66 } u_printf_stream_handler
;
69 typedef struct u_localized_print_string
{
70 UChar
*str
; /* Place to write the string */
71 int32_t available
;/* Number of codeunits available to write to */
72 int32_t len
; /* Maximum number of code units that can be written to output */
74 ULocaleBundle fBundle
; /* formatters */
75 } u_localized_print_string
;
77 #define UP_PERCENT 0x0025
80 * Parse a single u_printf format string.
81 * @param fmt A pointer to a '%' character in a u_printf format specification.
82 * @param spec A pointer to a <TT>u_printf_spec</TT> to receive the parsed
84 * @param locStringContext If present, will make sure that it will only write
85 * to the buffer when space is available. It's done this way because
86 * va_list sometimes can't be passed by pointer.
87 * @return The number of characters contained in this specifier.
90 u_printf_parse(const u_printf_stream_handler
*streamHandler
,
93 u_localized_print_string
*locStringContext
,
94 ULocaleBundle
*formatBundle
,
98 #endif /* #if !UCONFIG_NO_FORMATTING */