]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ****************************************************************************** | |
3 | * | |
4 | * Copyright (C) 2000-2001, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ****************************************************************************** | |
8 | * | |
9 | * File sscanf.h | |
10 | * | |
11 | * Modification History: | |
12 | * | |
13 | * Date Name Description | |
14 | * 02/08/00 george Creation. Copied from uscanf.h | |
15 | ****************************************************************************** | |
16 | */ | |
17 | ||
18 | #ifndef _USSCANF_H | |
19 | #define _USSCANF_H | |
20 | ||
21 | #include "unicode/utypes.h" | |
22 | ||
23 | #if !UCONFIG_NO_FORMATTING | |
24 | ||
25 | #include "unicode/ustdio.h" | |
26 | #include "ufmt_cmn.h" | |
27 | #include "locbund.h" | |
28 | ||
29 | /** | |
30 | * Struct encapsulating a single uscanf format specification. | |
31 | */ | |
32 | struct u_sscanf_spec_info { | |
33 | UChar fSpec; /* Format specification */ | |
34 | ||
35 | int32_t fWidth; /* Width */ | |
36 | ||
37 | UChar fPadChar; /* Padding character */ | |
38 | ||
39 | UBool fIsLongDouble; /* L flag */ | |
40 | UBool fIsShort; /* h flag */ | |
41 | UBool fIsLong; /* l flag */ | |
42 | UBool fIsLongLong; /* ll flag */ | |
43 | }; | |
44 | typedef struct u_sscanf_spec_info u_sscanf_spec_info; | |
45 | ||
46 | struct u_localized_string { | |
47 | UChar *str; /* Place to write the string */ | |
48 | int32_t pos; /* Number of codeunits available to write to */ | |
49 | int32_t len; /* Maximum number of code units that can be written to output */ | |
50 | ||
51 | ULocaleBundle *fBundle; /* formatters */ | |
52 | UBool fOwnBundle; /* TRUE if fBundle should be deleted */ | |
53 | }; | |
54 | typedef struct u_localized_string u_localized_string; | |
55 | ||
56 | /** | |
57 | * A u_scanf handler function. | |
58 | * A u_scanf handler is responsible for handling a single u_scanf | |
59 | * format specification, for example 'd' or 's'. | |
60 | * @param stream The UFILE to which to write output. | |
61 | * @param info A pointer to a <TT>u_scanf_spec_info</TT> struct containing | |
62 | * information on the format specification. | |
63 | * @param args A pointer to the argument data | |
64 | * @param fmt A pointer to the first character in the format string | |
65 | * following the spec. | |
66 | * @param consumed On output, set to the number of characters consumed | |
67 | * in <TT>fmt</TT>. | |
68 | * @return The number of arguments converted and assigned, or -1 if an | |
69 | * error occurred. | |
70 | */ | |
71 | typedef int32_t (*u_sscanf_handler) (u_localized_string *input, | |
72 | const u_sscanf_spec_info *info, | |
73 | ufmt_args *args, | |
74 | const UChar *fmt, | |
75 | int32_t *consumed); | |
76 | ||
77 | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
78 | ||
79 | #endif |