intl/icu/source/io/unicode/ustdio.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/io/unicode/ustdio.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,991 @@
     1.4 +/*
     1.5 +******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1998-2013, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +******************************************************************************
    1.11 +*
    1.12 +* File ustdio.h
    1.13 +*
    1.14 +* Modification History:
    1.15 +*
    1.16 +*   Date        Name        Description
    1.17 +*   10/16/98    stephen     Creation.
    1.18 +*   11/06/98    stephen     Modified per code review.
    1.19 +*   03/12/99    stephen     Modified for new C API.
    1.20 +*   07/19/99    stephen     Minor doc update.
    1.21 +*   02/01/01    george      Added sprintf & sscanf with all of its variants
    1.22 +******************************************************************************
    1.23 +*/
    1.24 +
    1.25 +#ifndef USTDIO_H
    1.26 +#define USTDIO_H
    1.27 +
    1.28 +#include <stdio.h>
    1.29 +#include <stdarg.h>
    1.30 +
    1.31 +#include "unicode/utypes.h"
    1.32 +#include "unicode/ucnv.h"
    1.33 +#include "unicode/utrans.h"
    1.34 +#include "unicode/localpointer.h"
    1.35 +#include "unicode/unum.h"
    1.36 +
    1.37 +/*
    1.38 +    TODO
    1.39 + The following is a small list as to what is currently wrong/suggestions for
    1.40 + ustdio.
    1.41 +
    1.42 + * Make sure that * in the scanf format specification works for all formats.
    1.43 + * Each UFILE takes up at least 2KB.
    1.44 +    Look into adding setvbuf() for configurable buffers.
    1.45 + * This library does buffering. The OS should do this for us already. Check on
    1.46 +    this, and remove it from this library, if this is the case. Double buffering
    1.47 +    wastes a lot of time and space.
    1.48 + * Test stdin and stdout with the u_f* functions
    1.49 + * Testing should be done for reading and writing multi-byte encodings,
    1.50 +    and make sure that a character that is contained across buffer boundries
    1.51 +    works even for incomplete characters.
    1.52 + * Make sure that the last character is flushed when the file/string is closed.
    1.53 + * snprintf should follow the C99 standard for the return value, which is
    1.54 +    return the number of characters (excluding the trailing '\0')
    1.55 +    which would have been written to the destination string regardless
    1.56 +    of available space. This is like pre-flighting.
    1.57 + * Everything that uses %s should do what operator>> does for UnicodeString.
    1.58 +    It should convert one byte at a time, and once a character is
    1.59 +    converted then check to see if it's whitespace or in the scanset.
    1.60 +    If it's whitespace or in the scanset, put all the bytes back (do nothing
    1.61 +    for sprintf/sscanf).
    1.62 + * If bad string data is encountered, make sure that the function fails
    1.63 +    without memory leaks and the unconvertable characters are valid
    1.64 +    substitution or are escaped characters.
    1.65 + * u_fungetc() can't unget a character when it's at the beginning of the
    1.66 +    internal conversion buffer. For example, read the buffer size # of
    1.67 +    characters, and then ungetc to get the previous character that was
    1.68 +    at the end of the last buffer.
    1.69 + * u_fflush() and u_fclose should return an int32_t like C99 functions.
    1.70 +    0 is returned if the operation was successful and EOF otherwise.
    1.71 + * u_fsettransliterator does not support U_READ side of transliteration.
    1.72 + * The format specifier should limit the size of a format or honor it in
    1.73 +    order to prevent buffer overruns.  (e.g. %256.256d).
    1.74 + * u_fread and u_fwrite don't exist. They're needed for reading and writing
    1.75 +    data structures without any conversion.
    1.76 + * u_file_read and u_file_write are used for writing strings. u_fgets and
    1.77 +    u_fputs or u_fread and u_fwrite should be used to do this.
    1.78 + * The width parameter for all scanf formats, including scanset, needs
    1.79 +    better testing. This prevents buffer overflows.
    1.80 + * Figure out what is suppose to happen when a codepage is changed midstream.
    1.81 +    Maybe a flush or a rewind are good enough.
    1.82 + * Make sure that a UFile opened with "rw" can be used after using
    1.83 +    u_fflush with a u_frewind.
    1.84 + * scanf(%i) should detect what type of number to use.
    1.85 + * Add more testing of the alternate format, %#
    1.86 + * Look at newline handling of fputs/puts
    1.87 + * Think more about codeunit/codepoint error handling/support in %S,%s,%C,%c,%[]
    1.88 + * Complete the file documentation with proper doxygen formatting.
    1.89 +    See http://oss.software.ibm.com/pipermail/icu/2003-July/005647.html
    1.90 +*/
    1.91 +
    1.92 +/**
    1.93 + * \file
    1.94 + * \brief C API: Unicode stdio-like API
    1.95 + *
    1.96 + * <h2>Unicode stdio-like C API</h2>
    1.97 + *
    1.98 + * <p>This API provides an stdio-like API wrapper around ICU's other
    1.99 + * formatting and parsing APIs. It is meant to ease the transition of adding
   1.100 + * Unicode support to a preexisting applications using stdio. The following
   1.101 + * is a small list of noticable differences between stdio and ICU I/O's
   1.102 + * ustdio implementation.</p>
   1.103 + *
   1.104 + * <ul>
   1.105 + * <li>Locale specific formatting and parsing is only done with file IO.</li>
   1.106 + * <li>u_fstropen can be used to simulate file IO with strings.
   1.107 + * This is similar to the iostream API, and it allows locale specific
   1.108 + * formatting and parsing to be used.</li>
   1.109 + * <li>This API provides uniform formatting and parsing behavior between
   1.110 + * platforms (unlike the standard stdio implementations found on various
   1.111 + * platforms).</li>
   1.112 + * <li>This API is better suited for text data handling than binary data
   1.113 + * handling when compared to the typical stdio implementation.</li>
   1.114 + * <li>You can specify a Transliterator while using the file IO.</li>
   1.115 + * <li>You can specify a file's codepage separately from the default
   1.116 + * system codepage.</li>
   1.117 + * </ul>
   1.118 + *
   1.119 + * <h2>Formatting and Parsing Specification</h2>
   1.120 + *
   1.121 + * General printf format:<br>
   1.122 + * %[format modifier][width][.precision][type modifier][format]
   1.123 + * 
   1.124 + * General scanf format:<br>
   1.125 + * %[*][format modifier][width][type modifier][format]
   1.126 + * 
   1.127 +<table cellspacing="3">
   1.128 +<tr><td>format</td><td>default<br>printf<br>type</td><td>default<br>scanf<br>type</td><td>description</td></tr>
   1.129 +<tr><td>%E</td><td>double</td><td>float</td><td>Scientific with an uppercase exponent</td></tr>
   1.130 +<tr><td>%e</td><td>double</td><td>float</td><td>Scientific with a lowercase exponent</td></tr>
   1.131 +<tr><td>%G</td><td>double</td><td>float</td><td>Use %E or %f for best format</td></tr>
   1.132 +<tr><td>%g</td><td>double</td><td>float</td><td>Use %e or %f for best format</td></tr>
   1.133 +<tr><td>%f</td><td>double</td><td>float</td><td>Simple floating point without the exponent</td></tr>
   1.134 +<tr><td>%X</td><td>int32_t</td><td>int32_t</td><td>ustdio special uppercase hex radix formatting</td></tr>
   1.135 +<tr><td>%x</td><td>int32_t</td><td>int32_t</td><td>ustdio special lowercase hex radix formatting</td></tr>
   1.136 +<tr><td>%d</td><td>int32_t</td><td>int32_t</td><td>Decimal format</td></tr>
   1.137 +<tr><td>%i</td><td>int32_t</td><td>int32_t</td><td>Same as %d</td></tr>
   1.138 +<tr><td>%n</td><td>int32_t</td><td>int32_t</td><td>count (write the number of UTF-16 codeunits read/written)</td></tr>
   1.139 +<tr><td>%o</td><td>int32_t</td><td>int32_t</td><td>ustdio special octal radix formatting</td></tr>
   1.140 +<tr><td>%u</td><td>uint32_t</td><td>uint32_t</td><td>Decimal format</td></tr>
   1.141 +<tr><td>%p</td><td>void *</td><td>void *</td><td>Prints the pointer value</td></tr>
   1.142 +<tr><td>%s</td><td>char *</td><td>char *</td><td>Use default converter or specified converter from fopen</td></tr>
   1.143 +<tr><td>%c</td><td>char</td><td>char</td><td>Use default converter or specified converter from fopen<br>
   1.144 +When width is specified for scanf, this acts like a non-NULL-terminated char * string.<br>
   1.145 +By default, only one char is written.</td></tr>
   1.146 +<tr><td>%S</td><td>UChar *</td><td>UChar *</td><td>Null terminated UTF-16 string</td></tr>
   1.147 +<tr><td>%C</td><td>UChar</td><td>UChar</td><td>16-bit Unicode code unit<br>
   1.148 +When width is specified for scanf, this acts like a non-NULL-terminated UChar * string<br>
   1.149 +By default, only one codepoint is written.</td></tr>
   1.150 +<tr><td>%[]</td><td>&nbsp;</td><td>UChar *</td><td>Null terminated UTF-16 string which contains the filtered set of characters specified by the UnicodeSet</td></tr>
   1.151 +<tr><td>%%</td><td>&nbsp;</td><td>&nbsp;</td><td>Show a percent sign</td></tr>
   1.152 +</table>
   1.153 +
   1.154 +Format modifiers
   1.155 +<table>
   1.156 +<tr><td>modifier</td><td>formats</td><td>type</td><td>comments</td></tr>
   1.157 +<tr><td>%h</td><td>%d, %i, %o, %x</td><td>int16_t</td><td>short format</td></tr>
   1.158 +<tr><td>%h</td><td>%u</td><td>uint16_t</td><td>short format</td></tr>
   1.159 +<tr><td>%h</td><td>c</td><td>char</td><td><b>(Unimplemented)</b> Use invariant converter</td></tr>
   1.160 +<tr><td>%h</td><td>s</td><td>char *</td><td><b>(Unimplemented)</b> Use invariant converter</td></tr>
   1.161 +<tr><td>%h</td><td>C</td><td>char</td><td><b>(Unimplemented)</b> 8-bit Unicode code unit</td></tr>
   1.162 +<tr><td>%h</td><td>S</td><td>char *</td><td><b>(Unimplemented)</b> Null terminated UTF-8 string</td></tr>
   1.163 +<tr><td>%l</td><td>%d, %i, %o, %x</td><td>int32_t</td><td>long format (no effect)</td></tr>
   1.164 +<tr><td>%l</td><td>%u</td><td>uint32_t</td><td>long format (no effect)</td></tr>
   1.165 +<tr><td>%l</td><td>c</td><td>N/A</td><td><b>(Unimplemented)</b> Reserved for future implementation</td></tr>
   1.166 +<tr><td>%l</td><td>s</td><td>N/A</td><td><b>(Unimplemented)</b> Reserved for future implementation</td></tr>
   1.167 +<tr><td>%l</td><td>C</td><td>UChar32</td><td><b>(Unimplemented)</b> 32-bit Unicode code unit</td></tr>
   1.168 +<tr><td>%l</td><td>S</td><td>UChar32 *</td><td><b>(Unimplemented)</b> Null terminated UTF-32 string</td></tr>
   1.169 +<tr><td>%ll</td><td>%d, %i, %o, %x</td><td>int64_t</td><td>long long format</td></tr>
   1.170 +<tr><td>%ll</td><td>%u</td><td>uint64_t</td><td><b>(Unimplemented)</b> long long format</td></tr>
   1.171 +<tr><td>%-</td><td><i>all</i></td><td>N/A</td><td>Left justify</td></tr>
   1.172 +<tr><td>%+</td><td>%d, %i, %o, %x, %e, %f, %g, %E, %G</td><td>N/A</td><td>Always show the plus or minus sign. Needs data for plus sign.</td></tr>
   1.173 +<tr><td>% </td><td>%d, %i, %o, %x, %e, %f, %g, %E, %G</td><td>N/A</td><td>Instead of a "+" output a blank character for positive numbers.</td></tr>
   1.174 +<tr><td>%#</td><td>%d, %i, %o, %x, %e, %f, %g, %E, %G</td><td>N/A</td><td>Precede octal value with 0, hex with 0x and show the 
   1.175 +                decimal point for floats.</td></tr>
   1.176 +<tr><td>%<i>n</i></td><td><i>all</i></td><td>N/A</td><td>Width of input/output. num is an actual number from 0 to 
   1.177 +                some large number.</td></tr>
   1.178 +<tr><td>%.<i>n</i></td><td>%e, %f, %g, %E, %F, %G</td><td>N/A</td><td>Significant digits precision. num is an actual number from
   1.179 +                0 to some large number.<br>If * is used in printf, then the precision is passed in as an argument before the number to be formatted.</td></tr>
   1.180 +</table>
   1.181 +
   1.182 +printf modifier
   1.183 +%*  int32_t     Next argument after this one specifies the width
   1.184 +
   1.185 +scanf modifier
   1.186 +%*  N/A         This field is scanned, but not stored
   1.187 +
   1.188 +<p>If you are using this C API instead of the ustream.h API for C++,
   1.189 +you can use one of the following u_fprintf examples to display a UnicodeString.</p>
   1.190 +
   1.191 +<pre><code>
   1.192 +    UFILE *out = u_finit(stdout, NULL, NULL);
   1.193 +    UnicodeString string1("string 1");
   1.194 +    UnicodeString string2("string 2");
   1.195 +    u_fprintf(out, "%S\n", string1.getTerminatedBuffer());
   1.196 +    u_fprintf(out, "%.*S\n", string2.length(), string2.getBuffer());
   1.197 +    u_fclose(out);
   1.198 +</code></pre>
   1.199 +
   1.200 + */
   1.201 +
   1.202 +
   1.203 +/**
   1.204 + * When an end of file is encountered, this value can be returned.
   1.205 + * @see u_fgetc
   1.206 + * @stable 3.0
   1.207 + */
   1.208 +#define U_EOF 0xFFFF
   1.209 +
   1.210 +/** Forward declaration of a Unicode-aware file @stable 3.0 */
   1.211 +typedef struct UFILE UFILE;
   1.212 +
   1.213 +/**
   1.214 + * Enum for which direction of stream a transliterator applies to.
   1.215 + * @see u_fsettransliterator
   1.216 + * @stable ICU 3.0
   1.217 + */
   1.218 +typedef enum { 
   1.219 +   U_READ = 1,
   1.220 +   U_WRITE = 2, 
   1.221 +   U_READWRITE =3  /* == (U_READ | U_WRITE) */ 
   1.222 +} UFileDirection;
   1.223 +
   1.224 +/**
   1.225 + * Open a UFILE.
   1.226 + * A UFILE is a wrapper around a FILE* that is locale and codepage aware.
   1.227 + * That is, data written to a UFILE will be formatted using the conventions
   1.228 + * specified by that UFILE's Locale; this data will be in the character set
   1.229 + * specified by that UFILE's codepage.
   1.230 + * @param filename The name of the file to open.
   1.231 + * @param perm The read/write permission for the UFILE; one of "r", "w", "rw"
   1.232 + * @param locale The locale whose conventions will be used to format 
   1.233 + * and parse output. If this parameter is NULL, the default locale will 
   1.234 + * be used.
   1.235 + * @param codepage The codepage in which data will be written to and
   1.236 + * read from the file. If this paramter is NULL the system default codepage
   1.237 + * will be used.
   1.238 + * @return A new UFILE, or NULL if an error occurred.
   1.239 + * @stable ICU 3.0
   1.240 + */
   1.241 +U_STABLE UFILE* U_EXPORT2
   1.242 +u_fopen(const char    *filename,
   1.243 +    const char    *perm,
   1.244 +    const char    *locale,
   1.245 +    const char    *codepage);
   1.246 +
   1.247 +/**
   1.248 + * Open a UFILE on top of an existing FILE* stream. The FILE* stream
   1.249 + * ownership remains with the caller. To have the UFILE take over
   1.250 + * ownership and responsibility for the FILE* stream, use the
   1.251 + * function u_fadopt.
   1.252 + * @param f The FILE* to which this UFILE will attach and use.
   1.253 + * @param locale The locale whose conventions will be used to format 
   1.254 + * and parse output. If this parameter is NULL, the default locale will 
   1.255 + * be used.
   1.256 + * @param codepage The codepage in which data will be written to and
   1.257 + * read from the file. If this paramter is NULL, data will be written and
   1.258 + * read using the default codepage for <TT>locale</TT>, unless <TT>locale</TT>
   1.259 + * is NULL, in which case the system default codepage will be used.
   1.260 + * @return A new UFILE, or NULL if an error occurred.
   1.261 + * @stable ICU 3.0
   1.262 + */
   1.263 +U_STABLE UFILE* U_EXPORT2
   1.264 +u_finit(FILE        *f,
   1.265 +    const char    *locale,
   1.266 +    const char    *codepage);
   1.267 +
   1.268 +/**
   1.269 + * Open a UFILE on top of an existing FILE* stream. The FILE* stream
   1.270 + * ownership is transferred to the new UFILE. It will be closed when the
   1.271 + * UFILE is closed.
   1.272 + * @param f The FILE* which this UFILE will take ownership of.
   1.273 + * @param locale The locale whose conventions will be used to format
   1.274 + * and parse output. If this parameter is NULL, the default locale will
   1.275 + * be used.
   1.276 + * @param codepage The codepage in which data will be written to and
   1.277 + * read from the file. If this paramter is NULL, data will be written and
   1.278 + * read using the default codepage for <TT>locale</TT>, unless <TT>locale</TT>
   1.279 + * is NULL, in which case the system default codepage will be used.
   1.280 + * @return A new UFILE, or NULL if an error occurred. If an error occurs
   1.281 + * the ownership of the FILE* stream remains with the caller.
   1.282 + * @stable ICU 4.4
   1.283 + */
   1.284 +U_STABLE UFILE* U_EXPORT2
   1.285 +u_fadopt(FILE     *f,
   1.286 +    const char    *locale,
   1.287 +    const char    *codepage);
   1.288 +
   1.289 +/**
   1.290 + * Create a UFILE that can be used for localized formatting or parsing.
   1.291 + * The u_sprintf and u_sscanf functions do not read or write numbers for a
   1.292 + * specific locale. The ustdio.h file functions can be used on this UFILE.
   1.293 + * The string is usable once u_fclose or u_fflush has been called on the
   1.294 + * returned UFILE.
   1.295 + * @param stringBuf The string used for reading or writing.
   1.296 + * @param capacity The number of code units available for use in stringBuf
   1.297 + * @param locale The locale whose conventions will be used to format 
   1.298 + * and parse output. If this parameter is NULL, the default locale will 
   1.299 + * be used.
   1.300 + * @return A new UFILE, or NULL if an error occurred.
   1.301 + * @stable ICU 3.0
   1.302 + */
   1.303 +U_STABLE UFILE* U_EXPORT2
   1.304 +u_fstropen(UChar      *stringBuf,
   1.305 +           int32_t     capacity,
   1.306 +           const char *locale);
   1.307 +
   1.308 +/**
   1.309 + * Close a UFILE. Implies u_fflush first.
   1.310 + * @param file The UFILE to close.
   1.311 + * @stable ICU 3.0
   1.312 + * @see u_fflush
   1.313 + */
   1.314 +U_STABLE void U_EXPORT2
   1.315 +u_fclose(UFILE *file);
   1.316 +
   1.317 +#if U_SHOW_CPLUSPLUS_API
   1.318 +
   1.319 +U_NAMESPACE_BEGIN
   1.320 +
   1.321 +/**
   1.322 + * \class LocalUFILEPointer
   1.323 + * "Smart pointer" class, closes a UFILE via u_fclose().
   1.324 + * For most methods see the LocalPointerBase base class.
   1.325 + *
   1.326 + * @see LocalPointerBase
   1.327 + * @see LocalPointer
   1.328 + * @stable ICU 4.4
   1.329 + */
   1.330 +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFILEPointer, UFILE, u_fclose);
   1.331 +
   1.332 +U_NAMESPACE_END
   1.333 +
   1.334 +#endif
   1.335 +
   1.336 +/**
   1.337 + * Tests if the UFILE is at the end of the file stream.
   1.338 + * @param f The UFILE from which to read.
   1.339 + * @return Returns TRUE after the first read operation that attempts to
   1.340 + * read past the end of the file. It returns FALSE if the current position is
   1.341 + * not end of file.
   1.342 + * @stable ICU 3.0
   1.343 +*/
   1.344 +U_STABLE UBool U_EXPORT2
   1.345 +u_feof(UFILE  *f);
   1.346 +
   1.347 +/**
   1.348 + * Flush output of a UFILE. Implies a flush of
   1.349 + * converter/transliterator state. (That is, a logical break is
   1.350 + * made in the output stream - for example if a different type of
   1.351 + * output is desired.)  The underlying OS level file is also flushed.
   1.352 + * Note that for a stateful encoding, the converter may write additional
   1.353 + * bytes to return the stream to default state.
   1.354 + * @param file The UFILE to flush.
   1.355 + * @stable ICU 3.0
   1.356 + */
   1.357 +U_STABLE void U_EXPORT2
   1.358 +u_fflush(UFILE *file);
   1.359 +
   1.360 +/**
   1.361 + * Rewind the file pointer to the beginning of the file.
   1.362 + * @param file The UFILE to rewind.
   1.363 + * @stable ICU 3.0
   1.364 + */
   1.365 +U_STABLE void
   1.366 +u_frewind(UFILE *file);
   1.367 +
   1.368 +/**
   1.369 + * Get the FILE* associated with a UFILE.
   1.370 + * @param f The UFILE
   1.371 + * @return A FILE*, owned by the UFILE. (The FILE <EM>must not</EM> be modified or closed)
   1.372 + * @stable ICU 3.0
   1.373 + */
   1.374 +U_STABLE FILE* U_EXPORT2
   1.375 +u_fgetfile(UFILE *f);
   1.376 +
   1.377 +#if !UCONFIG_NO_FORMATTING
   1.378 +
   1.379 +/**
   1.380 + * Get the locale whose conventions are used to format and parse output.
   1.381 + * This is the same locale passed in the preceding call to<TT>u_fsetlocale</TT>
   1.382 + * or <TT>u_fopen</TT>.
   1.383 + * @param file The UFILE to set.
   1.384 + * @return The locale whose conventions are used to format and parse output.
   1.385 + * @stable ICU 3.0
   1.386 + */
   1.387 +U_STABLE const char* U_EXPORT2
   1.388 +u_fgetlocale(UFILE *file);
   1.389 +
   1.390 +/**
   1.391 + * Set the locale whose conventions will be used to format and parse output.
   1.392 + * @param locale The locale whose conventions will be used to format 
   1.393 + * and parse output.
   1.394 + * @param file The UFILE to query.
   1.395 + * @return NULL if successful, otherwise a negative number.
   1.396 + * @stable ICU 3.0
   1.397 + */
   1.398 +U_STABLE int32_t U_EXPORT2
   1.399 +u_fsetlocale(UFILE      *file,
   1.400 +             const char *locale);
   1.401 +
   1.402 +#endif
   1.403 +
   1.404 +/**
   1.405 + * Get the codepage in which data is written to and read from the UFILE.
   1.406 + * This is the same codepage passed in the preceding call to 
   1.407 + * <TT>u_fsetcodepage</TT> or <TT>u_fopen</TT>.
   1.408 + * @param file The UFILE to query.
   1.409 + * @return The codepage in which data is written to and read from the UFILE,
   1.410 + * or NULL if an error occurred.
   1.411 + * @stable ICU 3.0
   1.412 + */
   1.413 +U_STABLE const char* U_EXPORT2
   1.414 +u_fgetcodepage(UFILE *file);
   1.415 +
   1.416 +/**
   1.417 + * Set the codepage in which data will be written to and read from the UFILE.
   1.418 + * All Unicode data written to the UFILE will be converted to this codepage
   1.419 + * before it is written to the underlying FILE*. It it generally a bad idea to
   1.420 + * mix codepages within a file. This should only be called right
   1.421 + * after opening the <TT>UFile</TT>, or after calling <TT>u_frewind</TT>.
   1.422 + * @param codepage The codepage in which data will be written to 
   1.423 + * and read from the file. For example <TT>"latin-1"</TT> or <TT>"ibm-943"</TT>.
   1.424 + * A value of NULL means the default codepage for the UFILE's current 
   1.425 + * locale will be used.
   1.426 + * @param file The UFILE to set.
   1.427 + * @return 0 if successful, otherwise a negative number.
   1.428 + * @see u_frewind
   1.429 + * @stable ICU 3.0
   1.430 + */
   1.431 +U_STABLE int32_t U_EXPORT2
   1.432 +u_fsetcodepage(const char   *codepage,
   1.433 +               UFILE        *file);
   1.434 +
   1.435 +
   1.436 +/**
   1.437 + * Returns an alias to the converter being used for this file.
   1.438 + * @param f The UFILE to get the value from
   1.439 + * @return alias to the converter (The converter <EM>must not</EM> be modified or closed)
   1.440 + * @stable ICU 3.0
   1.441 + */
   1.442 +U_STABLE UConverter* U_EXPORT2 u_fgetConverter(UFILE *f);
   1.443 +
   1.444 +#if !UCONFIG_NO_FORMATTING
   1.445 +#ifndef U_HIDE_DRAFT_API
   1.446 +/**
   1.447 + * Returns an alias to the number formatter being used for this file.
   1.448 + * @param f The UFILE to get the value from
   1.449 + * @return alias to the number formatter (The formatter <EM>must not</EM> be modified or closed)
   1.450 + * @draft ICU 51
   1.451 +*/
   1.452 + U_DRAFT const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *f);
   1.453 +#endif /* U_HIDE_DRAFT_API */
   1.454 +
   1.455 +/* Output functions */
   1.456 +
   1.457 +/**
   1.458 + * Write formatted data to <TT>stdout</TT>.
   1.459 + * @param patternSpecification A pattern specifying how <TT>u_printf</TT> will
   1.460 + * interpret the variable arguments received and format the data.
   1.461 + * @return The number of Unicode characters written to <TT>stdout</TT>
   1.462 + * @stable ICU 49
   1.463 + */
   1.464 +U_STABLE int32_t U_EXPORT2
   1.465 +u_printf(const char *patternSpecification,
   1.466 +         ... );
   1.467 +
   1.468 +/**
   1.469 + * Write formatted data to a UFILE.
   1.470 + * @param f The UFILE to which to write.
   1.471 + * @param patternSpecification A pattern specifying how <TT>u_fprintf</TT> will
   1.472 + * interpret the variable arguments received and format the data.
   1.473 + * @return The number of Unicode characters written to <TT>f</TT>.
   1.474 + * @stable ICU 3.0
   1.475 + */
   1.476 +U_STABLE int32_t U_EXPORT2
   1.477 +u_fprintf(UFILE         *f,
   1.478 +          const char    *patternSpecification,
   1.479 +          ... );
   1.480 +
   1.481 +/**
   1.482 + * Write formatted data to a UFILE.
   1.483 + * This is identical to <TT>u_fprintf</TT>, except that it will
   1.484 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.485 + * @param f The UFILE to which to write.
   1.486 + * @param patternSpecification A pattern specifying how <TT>u_fprintf</TT> will
   1.487 + * interpret the variable arguments received and format the data.
   1.488 + * @param ap The argument list to use.
   1.489 + * @return The number of Unicode characters written to <TT>f</TT>.
   1.490 + * @see u_fprintf
   1.491 + * @stable ICU 3.0
   1.492 + */
   1.493 +U_STABLE int32_t U_EXPORT2
   1.494 +u_vfprintf(UFILE        *f,
   1.495 +           const char   *patternSpecification,
   1.496 +           va_list      ap);
   1.497 +
   1.498 +/**
   1.499 + * Write formatted data to <TT>stdout</TT>.
   1.500 + * @param patternSpecification A pattern specifying how <TT>u_printf_u</TT> will
   1.501 + * interpret the variable arguments received and format the data.
   1.502 + * @return The number of Unicode characters written to <TT>stdout</TT>
   1.503 + * @stable ICU 49
   1.504 + */
   1.505 +U_STABLE int32_t U_EXPORT2
   1.506 +u_printf_u(const UChar *patternSpecification,
   1.507 +           ... );
   1.508 +
   1.509 +/**
   1.510 + * Get a UFILE for <TT>stdout</TT>.
   1.511 + * @return UFILE that writes to <TT>stdout</TT>
   1.512 + * @stable ICU 49
   1.513 + */
   1.514 +U_STABLE UFILE * U_EXPORT2
   1.515 +u_get_stdout(void);
   1.516 +
   1.517 +/**
   1.518 + * Write formatted data to a UFILE.
   1.519 + * @param f The UFILE to which to write.
   1.520 + * @param patternSpecification A pattern specifying how <TT>u_fprintf</TT> will
   1.521 + * interpret the variable arguments received and format the data.
   1.522 + * @return The number of Unicode characters written to <TT>f</TT>.
   1.523 + * @stable ICU 3.0
   1.524 + */
   1.525 +U_STABLE int32_t U_EXPORT2
   1.526 +u_fprintf_u(UFILE       *f,
   1.527 +            const UChar *patternSpecification,
   1.528 +            ... );
   1.529 +
   1.530 +/**
   1.531 + * Write formatted data to a UFILE.
   1.532 + * This is identical to <TT>u_fprintf_u</TT>, except that it will
   1.533 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.534 + * @param f The UFILE to which to write.
   1.535 + * @param patternSpecification A pattern specifying how <TT>u_fprintf</TT> will
   1.536 + * interpret the variable arguments received and format the data.
   1.537 + * @param ap The argument list to use.
   1.538 + * @return The number of Unicode characters written to <TT>f</TT>.
   1.539 + * @see u_fprintf_u
   1.540 + * @stable ICU 3.0
   1.541 + */
   1.542 +U_STABLE int32_t U_EXPORT2
   1.543 +u_vfprintf_u(UFILE      *f,
   1.544 +            const UChar *patternSpecification,
   1.545 +            va_list     ap);
   1.546 +#endif
   1.547 +/**
   1.548 + * Write a Unicode to a UFILE.  The null (U+0000) terminated UChar*
   1.549 + * <TT>s</TT> will be written to <TT>f</TT>, excluding the NULL terminator.
   1.550 + * A newline will be added to <TT>f</TT>.
   1.551 + * @param s The UChar* to write.
   1.552 + * @param f The UFILE to which to write.
   1.553 + * @return A non-negative number if successful, EOF otherwise.
   1.554 + * @see u_file_write
   1.555 + * @stable ICU 3.0
   1.556 + */
   1.557 +U_STABLE int32_t U_EXPORT2
   1.558 +u_fputs(const UChar *s,
   1.559 +        UFILE       *f);
   1.560 +
   1.561 +/**
   1.562 + * Write a UChar to a UFILE.
   1.563 + * @param uc The UChar to write.
   1.564 + * @param f The UFILE to which to write.
   1.565 + * @return The character written if successful, EOF otherwise.
   1.566 + * @stable ICU 3.0
   1.567 + */
   1.568 +U_STABLE UChar32 U_EXPORT2
   1.569 +u_fputc(UChar32  uc,
   1.570 +        UFILE  *f);
   1.571 +
   1.572 +/**
   1.573 + * Write Unicode to a UFILE.
   1.574 + * The ustring passed in will be converted to the UFILE's underlying
   1.575 + * codepage before it is written.
   1.576 + * @param ustring A pointer to the Unicode data to write.
   1.577 + * @param count The number of Unicode characters to write
   1.578 + * @param f The UFILE to which to write.
   1.579 + * @return The number of Unicode characters written.
   1.580 + * @see u_fputs
   1.581 + * @stable ICU 3.0
   1.582 + */
   1.583 +U_STABLE int32_t U_EXPORT2
   1.584 +u_file_write(const UChar    *ustring, 
   1.585 +             int32_t        count, 
   1.586 +             UFILE          *f);
   1.587 +
   1.588 +
   1.589 +/* Input functions */
   1.590 +#if !UCONFIG_NO_FORMATTING
   1.591 +
   1.592 +/**
   1.593 + * Read formatted data from a UFILE.
   1.594 + * @param f The UFILE from which to read.
   1.595 + * @param patternSpecification A pattern specifying how <TT>u_fscanf</TT> will
   1.596 + * interpret the variable arguments received and parse the data.
   1.597 + * @return The number of items successfully converted and assigned, or EOF
   1.598 + * if an error occurred.
   1.599 + * @stable ICU 3.0
   1.600 + */
   1.601 +U_STABLE int32_t U_EXPORT2
   1.602 +u_fscanf(UFILE      *f,
   1.603 +         const char *patternSpecification,
   1.604 +         ... );
   1.605 +
   1.606 +/**
   1.607 + * Read formatted data from a UFILE.
   1.608 + * This is identical to <TT>u_fscanf</TT>, except that it will
   1.609 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.610 + * @param f The UFILE from which to read.
   1.611 + * @param patternSpecification A pattern specifying how <TT>u_fscanf</TT> will
   1.612 + * interpret the variable arguments received and parse the data.
   1.613 + * @param ap The argument list to use.
   1.614 + * @return The number of items successfully converted and assigned, or EOF
   1.615 + * if an error occurred.
   1.616 + * @see u_fscanf
   1.617 + * @stable ICU 3.0
   1.618 + */
   1.619 +U_STABLE int32_t U_EXPORT2
   1.620 +u_vfscanf(UFILE         *f,
   1.621 +          const char    *patternSpecification,
   1.622 +          va_list        ap);
   1.623 +
   1.624 +/**
   1.625 + * Read formatted data from a UFILE.
   1.626 + * @param f The UFILE from which to read.
   1.627 + * @param patternSpecification A pattern specifying how <TT>u_fscanf</TT> will
   1.628 + * interpret the variable arguments received and parse the data.
   1.629 + * @return The number of items successfully converted and assigned, or EOF
   1.630 + * if an error occurred.
   1.631 + * @stable ICU 3.0
   1.632 + */
   1.633 +U_STABLE int32_t U_EXPORT2
   1.634 +u_fscanf_u(UFILE        *f,
   1.635 +           const UChar  *patternSpecification,
   1.636 +           ... );
   1.637 +
   1.638 +/**
   1.639 + * Read formatted data from a UFILE.
   1.640 + * This is identical to <TT>u_fscanf_u</TT>, except that it will
   1.641 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.642 + * @param f The UFILE from which to read.
   1.643 + * @param patternSpecification A pattern specifying how <TT>u_fscanf</TT> will
   1.644 + * interpret the variable arguments received and parse the data.
   1.645 + * @param ap The argument list to use.
   1.646 + * @return The number of items successfully converted and assigned, or EOF
   1.647 + * if an error occurred.
   1.648 + * @see u_fscanf_u
   1.649 + * @stable ICU 3.0
   1.650 + */
   1.651 +U_STABLE int32_t U_EXPORT2
   1.652 +u_vfscanf_u(UFILE       *f,
   1.653 +            const UChar *patternSpecification,
   1.654 +            va_list      ap);
   1.655 +#endif
   1.656 +
   1.657 +/**
   1.658 + * Read one line of text into a UChar* string from a UFILE. The newline
   1.659 + * at the end of the line is read into the string. The string is always
   1.660 + * null terminated
   1.661 + * @param f The UFILE from which to read.
   1.662 + * @param n The maximum number of characters - 1 to read.
   1.663 + * @param s The UChar* to receive the read data.  Characters will be
   1.664 + * stored successively in <TT>s</TT> until a newline or EOF is
   1.665 + * reached. A null character (U+0000) will be appended to <TT>s</TT>.
   1.666 + * @return A pointer to <TT>s</TT>, or NULL if no characters were available.
   1.667 + * @stable ICU 3.0
   1.668 + */
   1.669 +U_STABLE UChar* U_EXPORT2
   1.670 +u_fgets(UChar  *s,
   1.671 +        int32_t n,
   1.672 +        UFILE  *f);
   1.673 +
   1.674 +/**
   1.675 + * Read a UChar from a UFILE. It is recommended that <TT>u_fgetcx</TT>
   1.676 + * used instead for proper parsing functions, but sometimes reading
   1.677 + * code units is needed instead of codepoints.
   1.678 + *
   1.679 + * @param f The UFILE from which to read.
   1.680 + * @return The UChar value read, or U+FFFF if no character was available.
   1.681 + * @stable ICU 3.0
   1.682 + */
   1.683 +U_STABLE UChar U_EXPORT2
   1.684 +u_fgetc(UFILE   *f);
   1.685 +
   1.686 +/**
   1.687 + * Read a UChar32 from a UFILE.
   1.688 + *
   1.689 + * @param f The UFILE from which to read.
   1.690 + * @return The UChar32 value read, or U_EOF if no character was
   1.691 + * available, or U+FFFFFFFF if an ill-formed character was
   1.692 + * encountered.
   1.693 + * @see u_unescape()
   1.694 + * @stable ICU 3.0
   1.695 + */
   1.696 +U_STABLE UChar32 U_EXPORT2
   1.697 +u_fgetcx(UFILE  *f);
   1.698 +
   1.699 +/**
   1.700 + * Unget a UChar from a UFILE.
   1.701 + * If this function is not the first to operate on <TT>f</TT> after a call
   1.702 + * to <TT>u_fgetc</TT>, the results are undefined.
   1.703 + * If this function is passed a character that was not recieved from the
   1.704 + * previous <TT>u_fgetc</TT> or <TT>u_fgetcx</TT> call, the results are undefined.
   1.705 + * @param c The UChar to put back on the stream.
   1.706 + * @param f The UFILE to receive <TT>c</TT>.
   1.707 + * @return The UChar32 value put back if successful, U_EOF otherwise.
   1.708 + * @stable ICU 3.0
   1.709 + */
   1.710 +U_STABLE UChar32 U_EXPORT2
   1.711 +u_fungetc(UChar32   c,
   1.712 +      UFILE        *f);
   1.713 +
   1.714 +/**
   1.715 + * Read Unicode from a UFILE.
   1.716 + * Bytes will be converted from the UFILE's underlying codepage, with
   1.717 + * subsequent conversion to Unicode. The data will not be NULL terminated.
   1.718 + * @param chars A pointer to receive the Unicode data.
   1.719 + * @param count The number of Unicode characters to read.
   1.720 + * @param f The UFILE from which to read.
   1.721 + * @return The number of Unicode characters read.
   1.722 + * @stable ICU 3.0
   1.723 + */
   1.724 +U_STABLE int32_t U_EXPORT2
   1.725 +u_file_read(UChar        *chars, 
   1.726 +        int32_t        count, 
   1.727 +        UFILE         *f);
   1.728 +
   1.729 +#if !UCONFIG_NO_TRANSLITERATION
   1.730 +
   1.731 +/**
   1.732 + * Set a transliterator on the UFILE. The transliterator will be owned by the
   1.733 + * UFILE. 
   1.734 + * @param file The UFILE to set transliteration on
   1.735 + * @param adopt The UTransliterator to set. Can be NULL, which will
   1.736 + * mean that no transliteration is used.
   1.737 + * @param direction either U_READ, U_WRITE, or U_READWRITE - sets
   1.738 + *  which direction the transliterator is to be applied to. If
   1.739 + * U_READWRITE, the "Read" transliteration will be in the inverse
   1.740 + * direction.
   1.741 + * @param status ICU error code.
   1.742 + * @return The previously set transliterator, owned by the
   1.743 + * caller. If U_READWRITE is specified, only the WRITE transliterator
   1.744 + * is returned. In most cases, the caller should call utrans_close()
   1.745 + * on the result of this function.
   1.746 + * @stable ICU 3.0
   1.747 + */
   1.748 +U_STABLE UTransliterator* U_EXPORT2
   1.749 +u_fsettransliterator(UFILE *file, UFileDirection direction,
   1.750 +                     UTransliterator *adopt, UErrorCode *status);
   1.751 +
   1.752 +#endif
   1.753 +
   1.754 +
   1.755 +/* Output string functions */
   1.756 +#if !UCONFIG_NO_FORMATTING
   1.757 +
   1.758 +
   1.759 +/**
   1.760 + * Write formatted data to a Unicode string.
   1.761 + *
   1.762 + * @param buffer The Unicode String to which to write.
   1.763 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.764 + * interpret the variable arguments received and format the data.
   1.765 + * @return The number of Unicode code units written to <TT>buffer</TT>. This
   1.766 + * does not include the terminating null character.
   1.767 + * @stable ICU 3.0
   1.768 + */
   1.769 +U_STABLE int32_t U_EXPORT2
   1.770 +u_sprintf(UChar       *buffer,
   1.771 +        const char    *patternSpecification,
   1.772 +        ... );
   1.773 +
   1.774 +/**
   1.775 + * Write formatted data to a Unicode string. When the number of code units
   1.776 + * required to store the data exceeds <TT>count</TT>, then <TT>count</TT> code
   1.777 + * units of data are stored in <TT>buffer</TT> and a negative value is
   1.778 + * returned. When the number of code units required to store the data equals
   1.779 + * <TT>count</TT>, the string is not null terminated and <TT>count</TT> is
   1.780 + * returned.
   1.781 + *
   1.782 + * @param buffer The Unicode String to which to write.
   1.783 + * @param count The number of code units to read.
   1.784 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.785 + * interpret the variable arguments received and format the data.
   1.786 + * @return The number of Unicode characters that would have been written to
   1.787 + * <TT>buffer</TT> had count been sufficiently large. This does not include
   1.788 + * the terminating null character.
   1.789 + * @stable ICU 3.0
   1.790 + */
   1.791 +U_STABLE int32_t U_EXPORT2
   1.792 +u_snprintf(UChar      *buffer,
   1.793 +        int32_t       count,
   1.794 +        const char    *patternSpecification,
   1.795 +        ... );
   1.796 +
   1.797 +/**
   1.798 + * Write formatted data to a Unicode string.
   1.799 + * This is identical to <TT>u_sprintf</TT>, except that it will
   1.800 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.801 + *
   1.802 + * @param buffer The Unicode string to which to write.
   1.803 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.804 + * interpret the variable arguments received and format the data.
   1.805 + * @param ap The argument list to use.
   1.806 + * @return The number of Unicode characters written to <TT>buffer</TT>.
   1.807 + * @see u_sprintf
   1.808 + * @stable ICU 3.0
   1.809 + */
   1.810 +U_STABLE int32_t U_EXPORT2
   1.811 +u_vsprintf(UChar      *buffer,
   1.812 +        const char    *patternSpecification,
   1.813 +        va_list        ap);
   1.814 +
   1.815 +/**
   1.816 + * Write formatted data to a Unicode string.
   1.817 + * This is identical to <TT>u_snprintf</TT>, except that it will
   1.818 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.<br><br>
   1.819 + * When the number of code units required to store the data exceeds
   1.820 + * <TT>count</TT>, then <TT>count</TT> code units of data are stored in
   1.821 + * <TT>buffer</TT> and a negative value is returned. When the number of code
   1.822 + * units required to store the data equals <TT>count</TT>, the string is not
   1.823 + * null terminated and <TT>count</TT> is returned.
   1.824 + *
   1.825 + * @param buffer The Unicode string to which to write.
   1.826 + * @param count The number of code units to read.
   1.827 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.828 + * interpret the variable arguments received and format the data.
   1.829 + * @param ap The argument list to use.
   1.830 + * @return The number of Unicode characters that would have been written to
   1.831 + * <TT>buffer</TT> had count been sufficiently large.
   1.832 + * @see u_sprintf
   1.833 + * @stable ICU 3.0
   1.834 + */
   1.835 +U_STABLE int32_t U_EXPORT2
   1.836 +u_vsnprintf(UChar     *buffer,
   1.837 +        int32_t       count,
   1.838 +        const char    *patternSpecification,
   1.839 +        va_list        ap);
   1.840 +
   1.841 +/**
   1.842 + * Write formatted data to a Unicode string.
   1.843 + *
   1.844 + * @param buffer The Unicode string to which to write.
   1.845 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.846 + * interpret the variable arguments received and format the data.
   1.847 + * @return The number of Unicode characters written to <TT>buffer</TT>.
   1.848 + * @stable ICU 3.0
   1.849 + */
   1.850 +U_STABLE int32_t U_EXPORT2
   1.851 +u_sprintf_u(UChar      *buffer,
   1.852 +        const UChar    *patternSpecification,
   1.853 +        ... );
   1.854 +
   1.855 +/**
   1.856 + * Write formatted data to a Unicode string. When the number of code units
   1.857 + * required to store the data exceeds <TT>count</TT>, then <TT>count</TT> code
   1.858 + * units of data are stored in <TT>buffer</TT> and a negative value is
   1.859 + * returned. When the number of code units required to store the data equals
   1.860 + * <TT>count</TT>, the string is not null terminated and <TT>count</TT> is
   1.861 + * returned.
   1.862 + *
   1.863 + * @param buffer The Unicode string to which to write.
   1.864 + * @param count The number of code units to read.
   1.865 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.866 + * interpret the variable arguments received and format the data.
   1.867 + * @return The number of Unicode characters that would have been written to
   1.868 + * <TT>buffer</TT> had count been sufficiently large.
   1.869 + * @stable ICU 3.0
   1.870 + */
   1.871 +U_STABLE int32_t U_EXPORT2
   1.872 +u_snprintf_u(UChar     *buffer,
   1.873 +        int32_t        count,
   1.874 +        const UChar    *patternSpecification,
   1.875 +        ... );
   1.876 +
   1.877 +/**
   1.878 + * Write formatted data to a Unicode string.
   1.879 + * This is identical to <TT>u_sprintf_u</TT>, except that it will
   1.880 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.881 + *
   1.882 + * @param buffer The Unicode string to which to write.
   1.883 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.884 + * interpret the variable arguments received and format the data.
   1.885 + * @param ap The argument list to use.
   1.886 + * @return The number of Unicode characters written to <TT>f</TT>.
   1.887 + * @see u_sprintf_u
   1.888 + * @stable ICU 3.0
   1.889 + */
   1.890 +U_STABLE int32_t U_EXPORT2
   1.891 +u_vsprintf_u(UChar     *buffer,
   1.892 +        const UChar    *patternSpecification,
   1.893 +        va_list        ap);
   1.894 +
   1.895 +/**
   1.896 + * Write formatted data to a Unicode string.
   1.897 + * This is identical to <TT>u_snprintf_u</TT>, except that it will
   1.898 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.899 + * When the number of code units required to store the data exceeds
   1.900 + * <TT>count</TT>, then <TT>count</TT> code units of data are stored in
   1.901 + * <TT>buffer</TT> and a negative value is returned. When the number of code
   1.902 + * units required to store the data equals <TT>count</TT>, the string is not
   1.903 + * null terminated and <TT>count</TT> is returned.
   1.904 + *
   1.905 + * @param buffer The Unicode string to which to write.
   1.906 + * @param count The number of code units to read.
   1.907 + * @param patternSpecification A pattern specifying how <TT>u_sprintf</TT> will
   1.908 + * interpret the variable arguments received and format the data.
   1.909 + * @param ap The argument list to use.
   1.910 + * @return The number of Unicode characters that would have been written to
   1.911 + * <TT>f</TT> had count been sufficiently large.
   1.912 + * @see u_sprintf_u
   1.913 + * @stable ICU 3.0
   1.914 + */
   1.915 +U_STABLE int32_t U_EXPORT2
   1.916 +u_vsnprintf_u(UChar *buffer,
   1.917 +        int32_t         count,
   1.918 +        const UChar     *patternSpecification,
   1.919 +        va_list         ap);
   1.920 +
   1.921 +/* Input string functions */
   1.922 +
   1.923 +/**
   1.924 + * Read formatted data from a Unicode string.
   1.925 + *
   1.926 + * @param buffer The Unicode string from which to read.
   1.927 + * @param patternSpecification A pattern specifying how <TT>u_sscanf</TT> will
   1.928 + * interpret the variable arguments received and parse the data.
   1.929 + * @return The number of items successfully converted and assigned, or EOF
   1.930 + * if an error occurred.
   1.931 + * @stable ICU 3.0
   1.932 + */
   1.933 +U_STABLE int32_t U_EXPORT2
   1.934 +u_sscanf(const UChar   *buffer,
   1.935 +        const char     *patternSpecification,
   1.936 +        ... );
   1.937 +
   1.938 +/**
   1.939 + * Read formatted data from a Unicode string.
   1.940 + * This is identical to <TT>u_sscanf</TT>, except that it will
   1.941 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.942 + *
   1.943 + * @param buffer The Unicode string from which to read.
   1.944 + * @param patternSpecification A pattern specifying how <TT>u_sscanf</TT> will
   1.945 + * interpret the variable arguments received and parse the data.
   1.946 + * @param ap The argument list to use.
   1.947 + * @return The number of items successfully converted and assigned, or EOF
   1.948 + * if an error occurred.
   1.949 + * @see u_sscanf
   1.950 + * @stable ICU 3.0
   1.951 + */
   1.952 +U_STABLE int32_t U_EXPORT2
   1.953 +u_vsscanf(const UChar  *buffer,
   1.954 +        const char     *patternSpecification,
   1.955 +        va_list        ap);
   1.956 +
   1.957 +/**
   1.958 + * Read formatted data from a Unicode string.
   1.959 + *
   1.960 + * @param buffer The Unicode string from which to read.
   1.961 + * @param patternSpecification A pattern specifying how <TT>u_sscanf</TT> will
   1.962 + * interpret the variable arguments received and parse the data.
   1.963 + * @return The number of items successfully converted and assigned, or EOF
   1.964 + * if an error occurred.
   1.965 + * @stable ICU 3.0
   1.966 + */
   1.967 +U_STABLE int32_t U_EXPORT2
   1.968 +u_sscanf_u(const UChar  *buffer,
   1.969 +        const UChar     *patternSpecification,
   1.970 +        ... );
   1.971 +
   1.972 +/**
   1.973 + * Read formatted data from a Unicode string.
   1.974 + * This is identical to <TT>u_sscanf_u</TT>, except that it will
   1.975 + * <EM>not</EM> call <TT>va_start</TT> and <TT>va_end</TT>.
   1.976 + *
   1.977 + * @param buffer The Unicode string from which to read.
   1.978 + * @param patternSpecification A pattern specifying how <TT>u_sscanf</TT> will
   1.979 + * interpret the variable arguments received and parse the data.
   1.980 + * @param ap The argument list to use.
   1.981 + * @return The number of items successfully converted and assigned, or EOF
   1.982 + * if an error occurred.
   1.983 + * @see u_sscanf_u
   1.984 + * @stable ICU 3.0
   1.985 + */
   1.986 +U_STABLE int32_t U_EXPORT2
   1.987 +u_vsscanf_u(const UChar *buffer,
   1.988 +        const UChar     *patternSpecification,
   1.989 +        va_list         ap);
   1.990 +
   1.991 +#endif
   1.992 +#endif
   1.993 +
   1.994 +

mercurial