2
******************************************************************************
4
* Copyright (C) 1998-2006, 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 fOrigSpec; /* Conversion specification */
38
UChar fSpec; /* Conversion specification */
39
UChar fPadChar; /* Padding character */
41
UBool fAlt; /* # flag */
42
UBool fSpace; /* Space flag */
43
UBool fLeft; /* - flag */
44
UBool fShowSign; /* + flag */
45
UBool fZero; /* 0 flag */
47
UBool fIsLongDouble; /* L flag */
48
UBool fIsShort; /* h flag */
49
UBool fIsLong; /* l flag */
50
UBool fIsLongLong; /* ll flag */
53
typedef int32_t U_EXPORT2
54
u_printf_write_stream(void *context,
58
typedef int32_t U_EXPORT2
59
u_printf_pad_and_justify_stream(void *context,
60
const u_printf_spec_info *info,
64
typedef struct u_printf_stream_handler {
65
u_printf_write_stream *write;
66
u_printf_pad_and_justify_stream *pad_and_justify;
67
} u_printf_stream_handler;
70
typedef struct u_localized_print_string {
71
UChar *str; /* Place to write the string */
72
int32_t available;/* Number of codeunits available to write to */
73
int32_t len; /* Maximum number of code units that can be written to output */
75
ULocaleBundle fBundle; /* formatters */
76
} u_localized_print_string;
78
#define UP_PERCENT 0x0025
81
* Parse a single u_printf format string.
82
* @param fmt A pointer to a '%' character in a u_printf format specification.
83
* @param spec A pointer to a <TT>u_printf_spec</TT> to receive the parsed
85
* @param locStringContext If present, will make sure that it will only write
86
* to the buffer when space is available. It's done this way because
87
* va_list sometimes can't be passed by pointer.
88
* @return The number of characters contained in this specifier.
91
u_printf_parse(const u_printf_stream_handler *streamHandler,
94
u_localized_print_string *locStringContext,
95
ULocaleBundle *formatBundle,
99
#endif /* #if !UCONFIG_NO_FORMATTING */