intl/icu/source/io/uprintf.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 ******************************************************************************
michael@0 3 *
michael@0 4 * Copyright (C) 1998-2006, International Business Machines
michael@0 5 * Corporation and others. All Rights Reserved.
michael@0 6 *
michael@0 7 ******************************************************************************
michael@0 8 *
michael@0 9 * File uprintf.h
michael@0 10 *
michael@0 11 * Modification History:
michael@0 12 *
michael@0 13 * Date Name Description
michael@0 14 * 11/19/98 stephen Creation.
michael@0 15 * 03/12/99 stephen Modified for new C API.
michael@0 16 ******************************************************************************
michael@0 17 */
michael@0 18
michael@0 19 #ifndef UPRINTF_H
michael@0 20 #define UPRINTF_H
michael@0 21
michael@0 22 #include "unicode/utypes.h"
michael@0 23
michael@0 24 #if !UCONFIG_NO_FORMATTING
michael@0 25
michael@0 26 #include "unicode/ustdio.h"
michael@0 27 #include "ufmt_cmn.h"
michael@0 28 #include "locbund.h"
michael@0 29
michael@0 30 /**
michael@0 31 * Struct encapsulating a single uprintf format specification.
michael@0 32 */
michael@0 33 typedef struct u_printf_spec_info {
michael@0 34 int32_t fPrecision; /* Precision */
michael@0 35 int32_t fWidth; /* Width */
michael@0 36
michael@0 37 UChar fOrigSpec; /* Conversion specification */
michael@0 38 UChar fSpec; /* Conversion specification */
michael@0 39 UChar fPadChar; /* Padding character */
michael@0 40
michael@0 41 UBool fAlt; /* # flag */
michael@0 42 UBool fSpace; /* Space flag */
michael@0 43 UBool fLeft; /* - flag */
michael@0 44 UBool fShowSign; /* + flag */
michael@0 45 UBool fZero; /* 0 flag */
michael@0 46
michael@0 47 UBool fIsLongDouble; /* L flag */
michael@0 48 UBool fIsShort; /* h flag */
michael@0 49 UBool fIsLong; /* l flag */
michael@0 50 UBool fIsLongLong; /* ll flag */
michael@0 51 } u_printf_spec_info;
michael@0 52
michael@0 53 typedef int32_t U_EXPORT2
michael@0 54 u_printf_write_stream(void *context,
michael@0 55 const UChar *str,
michael@0 56 int32_t count);
michael@0 57
michael@0 58 typedef int32_t U_EXPORT2
michael@0 59 u_printf_pad_and_justify_stream(void *context,
michael@0 60 const u_printf_spec_info *info,
michael@0 61 const UChar *result,
michael@0 62 int32_t resultLen);
michael@0 63
michael@0 64 typedef struct u_printf_stream_handler {
michael@0 65 u_printf_write_stream *write;
michael@0 66 u_printf_pad_and_justify_stream *pad_and_justify;
michael@0 67 } u_printf_stream_handler;
michael@0 68
michael@0 69 /* Used by sprintf */
michael@0 70 typedef struct u_localized_print_string {
michael@0 71 UChar *str; /* Place to write the string */
michael@0 72 int32_t available;/* Number of codeunits available to write to */
michael@0 73 int32_t len; /* Maximum number of code units that can be written to output */
michael@0 74
michael@0 75 ULocaleBundle fBundle; /* formatters */
michael@0 76 } u_localized_print_string;
michael@0 77
michael@0 78 #define UP_PERCENT 0x0025
michael@0 79
michael@0 80 /**
michael@0 81 * Parse a single u_printf format string.
michael@0 82 * @param fmt A pointer to a '%' character in a u_printf format specification.
michael@0 83 * @param spec A pointer to a <TT>u_printf_spec</TT> to receive the parsed
michael@0 84 * format specifier.
michael@0 85 * @param locStringContext If present, will make sure that it will only write
michael@0 86 * to the buffer when space is available. It's done this way because
michael@0 87 * va_list sometimes can't be passed by pointer.
michael@0 88 * @return The number of characters contained in this specifier.
michael@0 89 */
michael@0 90 U_CFUNC int32_t
michael@0 91 u_printf_parse(const u_printf_stream_handler *streamHandler,
michael@0 92 const UChar *fmt,
michael@0 93 void *context,
michael@0 94 u_localized_print_string *locStringContext,
michael@0 95 ULocaleBundle *formatBundle,
michael@0 96 int32_t *written,
michael@0 97 va_list ap);
michael@0 98
michael@0 99 #endif /* #if !UCONFIG_NO_FORMATTING */
michael@0 100
michael@0 101 #endif

mercurial