intl/icu/source/io/uprintf.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/io/uprintf.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 +******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1998-2006, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +******************************************************************************
    1.11 +*
    1.12 +* File uprintf.h
    1.13 +*
    1.14 +* Modification History:
    1.15 +*
    1.16 +*   Date        Name        Description
    1.17 +*   11/19/98    stephen        Creation.
    1.18 +*   03/12/99    stephen     Modified for new C API.
    1.19 +******************************************************************************
    1.20 +*/
    1.21 +
    1.22 +#ifndef UPRINTF_H
    1.23 +#define UPRINTF_H
    1.24 +
    1.25 +#include "unicode/utypes.h"
    1.26 +
    1.27 +#if !UCONFIG_NO_FORMATTING
    1.28 +
    1.29 +#include "unicode/ustdio.h"
    1.30 +#include "ufmt_cmn.h"
    1.31 +#include "locbund.h"
    1.32 +
    1.33 +/**
    1.34 + * Struct encapsulating a single uprintf format specification.
    1.35 + */
    1.36 +typedef struct u_printf_spec_info {
    1.37 +  int32_t    fPrecision;    /* Precision  */
    1.38 +  int32_t    fWidth;        /* Width  */
    1.39 +
    1.40 +  UChar     fOrigSpec;      /* Conversion specification */
    1.41 +  UChar     fSpec;          /* Conversion specification */
    1.42 +  UChar     fPadChar;       /* Padding character  */
    1.43 +
    1.44 +  UBool     fAlt;           /* # flag  */
    1.45 +  UBool     fSpace;         /* Space flag  */
    1.46 +  UBool     fLeft;          /* - flag  */
    1.47 +  UBool     fShowSign;      /* + flag  */
    1.48 +  UBool     fZero;          /* 0 flag  */
    1.49 +
    1.50 +  UBool     fIsLongDouble;  /* L flag  */
    1.51 +  UBool     fIsShort;       /* h flag  */
    1.52 +  UBool     fIsLong;        /* l flag  */
    1.53 +  UBool     fIsLongLong;    /* ll flag  */
    1.54 +} u_printf_spec_info;
    1.55 +
    1.56 +typedef int32_t U_EXPORT2
    1.57 +u_printf_write_stream(void          *context,
    1.58 +                      const UChar   *str,
    1.59 +                      int32_t       count);
    1.60 +
    1.61 +typedef int32_t U_EXPORT2
    1.62 +u_printf_pad_and_justify_stream(void                        *context,
    1.63 +                                const u_printf_spec_info    *info,
    1.64 +                                const UChar                 *result,
    1.65 +                                int32_t                     resultLen);
    1.66 +
    1.67 +typedef struct u_printf_stream_handler {
    1.68 +    u_printf_write_stream *write;
    1.69 +    u_printf_pad_and_justify_stream *pad_and_justify;
    1.70 +} u_printf_stream_handler;
    1.71 +
    1.72 +/* Used by sprintf */
    1.73 +typedef struct u_localized_print_string {
    1.74 +    UChar     *str;     /* Place to write the string */
    1.75 +    int32_t   available;/* Number of codeunits available to write to */
    1.76 +    int32_t   len;      /* Maximum number of code units that can be written to output */
    1.77 +
    1.78 +    ULocaleBundle  fBundle;     /* formatters */
    1.79 +} u_localized_print_string;
    1.80 +
    1.81 +#define UP_PERCENT 0x0025
    1.82 +
    1.83 +/**
    1.84 + * Parse a single u_printf format string.
    1.85 + * @param fmt A pointer to a '%' character in a u_printf format specification.
    1.86 + * @param spec A pointer to a <TT>u_printf_spec</TT> to receive the parsed
    1.87 + * format specifier.
    1.88 + * @param locStringContext If present, will make sure that it will only write
    1.89 + *          to the buffer when space is available. It's done this way because
    1.90 + *          va_list sometimes can't be passed by pointer.
    1.91 + * @return The number of characters contained in this specifier.
    1.92 + */
    1.93 +U_CFUNC int32_t
    1.94 +u_printf_parse(const u_printf_stream_handler *streamHandler,
    1.95 +               const UChar     *fmt,
    1.96 +               void            *context,
    1.97 +               u_localized_print_string *locStringContext,
    1.98 +               ULocaleBundle   *formatBundle,
    1.99 +               int32_t         *written,
   1.100 +               va_list         ap);
   1.101 +
   1.102 +#endif /* #if !UCONFIG_NO_FORMATTING */
   1.103 +
   1.104 +#endif

mercurial