jpayne@69
|
1 // © 2018 and later: Unicode, Inc. and others.
|
jpayne@69
|
2 // License & terms of use: http://www.unicode.org/copyright.html
|
jpayne@69
|
3
|
jpayne@69
|
4 #ifndef __UFORMATTEDVALUE_H__
|
jpayne@69
|
5 #define __UFORMATTEDVALUE_H__
|
jpayne@69
|
6
|
jpayne@69
|
7 #include "unicode/utypes.h"
|
jpayne@69
|
8
|
jpayne@69
|
9 #if !UCONFIG_NO_FORMATTING
|
jpayne@69
|
10
|
jpayne@69
|
11 #include "unicode/ufieldpositer.h"
|
jpayne@69
|
12
|
jpayne@69
|
13 /**
|
jpayne@69
|
14 * \file
|
jpayne@69
|
15 * \brief C API: Abstract operations for localized strings.
|
jpayne@69
|
16 *
|
jpayne@69
|
17 * This file contains declarations for classes that deal with formatted strings. A number
|
jpayne@69
|
18 * of APIs throughout ICU use these classes for expressing their localized output.
|
jpayne@69
|
19 */
|
jpayne@69
|
20
|
jpayne@69
|
21
|
jpayne@69
|
22 /**
|
jpayne@69
|
23 * All possible field categories in ICU. Every entry in this enum corresponds
|
jpayne@69
|
24 * to another enum that exists in ICU.
|
jpayne@69
|
25 *
|
jpayne@69
|
26 * In the APIs that take a UFieldCategory, an int32_t type is used. Field
|
jpayne@69
|
27 * categories having any of the top four bits turned on are reserved as
|
jpayne@69
|
28 * private-use for external APIs implementing FormattedValue. This means that
|
jpayne@69
|
29 * categories 2^28 and higher or below zero (with the highest bit turned on)
|
jpayne@69
|
30 * are private-use and will not be used by ICU in the future.
|
jpayne@69
|
31 *
|
jpayne@69
|
32 * @stable ICU 64
|
jpayne@69
|
33 */
|
jpayne@69
|
34 typedef enum UFieldCategory {
|
jpayne@69
|
35 /**
|
jpayne@69
|
36 * For an undefined field category.
|
jpayne@69
|
37 *
|
jpayne@69
|
38 * @stable ICU 64
|
jpayne@69
|
39 */
|
jpayne@69
|
40 UFIELD_CATEGORY_UNDEFINED = 0,
|
jpayne@69
|
41
|
jpayne@69
|
42 /**
|
jpayne@69
|
43 * For fields in UDateFormatField (udat.h), from ICU 3.0.
|
jpayne@69
|
44 *
|
jpayne@69
|
45 * @stable ICU 64
|
jpayne@69
|
46 */
|
jpayne@69
|
47 UFIELD_CATEGORY_DATE,
|
jpayne@69
|
48
|
jpayne@69
|
49 /**
|
jpayne@69
|
50 * For fields in UNumberFormatFields (unum.h), from ICU 49.
|
jpayne@69
|
51 *
|
jpayne@69
|
52 * @stable ICU 64
|
jpayne@69
|
53 */
|
jpayne@69
|
54 UFIELD_CATEGORY_NUMBER,
|
jpayne@69
|
55
|
jpayne@69
|
56 /**
|
jpayne@69
|
57 * For fields in UListFormatterField (ulistformatter.h), from ICU 63.
|
jpayne@69
|
58 *
|
jpayne@69
|
59 * @stable ICU 64
|
jpayne@69
|
60 */
|
jpayne@69
|
61 UFIELD_CATEGORY_LIST,
|
jpayne@69
|
62
|
jpayne@69
|
63 /**
|
jpayne@69
|
64 * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64.
|
jpayne@69
|
65 *
|
jpayne@69
|
66 * @stable ICU 64
|
jpayne@69
|
67 */
|
jpayne@69
|
68 UFIELD_CATEGORY_RELATIVE_DATETIME,
|
jpayne@69
|
69
|
jpayne@69
|
70 /**
|
jpayne@69
|
71 * Reserved for possible future fields in UDateIntervalFormatField.
|
jpayne@69
|
72 *
|
jpayne@69
|
73 * @internal
|
jpayne@69
|
74 */
|
jpayne@69
|
75 UFIELD_CATEGORY_DATE_INTERVAL,
|
jpayne@69
|
76
|
jpayne@69
|
77 #ifndef U_HIDE_INTERNAL_API
|
jpayne@69
|
78 /** @internal */
|
jpayne@69
|
79 UFIELD_CATEGORY_COUNT,
|
jpayne@69
|
80 #endif /* U_HIDE_INTERNAL_API */
|
jpayne@69
|
81
|
jpayne@69
|
82 /**
|
jpayne@69
|
83 * Category for spans in a list.
|
jpayne@69
|
84 *
|
jpayne@69
|
85 * @stable ICU 64
|
jpayne@69
|
86 */
|
jpayne@69
|
87 UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST,
|
jpayne@69
|
88
|
jpayne@69
|
89 /**
|
jpayne@69
|
90 * Category for spans in a date interval.
|
jpayne@69
|
91 *
|
jpayne@69
|
92 * @stable ICU 64
|
jpayne@69
|
93 */
|
jpayne@69
|
94 UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL,
|
jpayne@69
|
95
|
jpayne@69
|
96 } UFieldCategory;
|
jpayne@69
|
97
|
jpayne@69
|
98
|
jpayne@69
|
99 struct UConstrainedFieldPosition;
|
jpayne@69
|
100 /**
|
jpayne@69
|
101 * Represents a span of a string containing a given field.
|
jpayne@69
|
102 *
|
jpayne@69
|
103 * This struct differs from UFieldPosition in the following ways:
|
jpayne@69
|
104 *
|
jpayne@69
|
105 * 1. It has information on the field category.
|
jpayne@69
|
106 * 2. It allows you to set constraints to use when iterating over field positions.
|
jpayne@69
|
107 * 3. It is used for the newer FormattedValue APIs.
|
jpayne@69
|
108 *
|
jpayne@69
|
109 * @stable ICU 64
|
jpayne@69
|
110 */
|
jpayne@69
|
111 typedef struct UConstrainedFieldPosition UConstrainedFieldPosition;
|
jpayne@69
|
112
|
jpayne@69
|
113
|
jpayne@69
|
114 /**
|
jpayne@69
|
115 * Creates a new UConstrainedFieldPosition.
|
jpayne@69
|
116 *
|
jpayne@69
|
117 * By default, the UConstrainedFieldPosition has no iteration constraints.
|
jpayne@69
|
118 *
|
jpayne@69
|
119 * @param ec Set if an error occurs.
|
jpayne@69
|
120 * @return The new object, or NULL if an error occurs.
|
jpayne@69
|
121 * @stable ICU 64
|
jpayne@69
|
122 */
|
jpayne@69
|
123 U_STABLE UConstrainedFieldPosition* U_EXPORT2
|
jpayne@69
|
124 ucfpos_open(UErrorCode* ec);
|
jpayne@69
|
125
|
jpayne@69
|
126
|
jpayne@69
|
127 /**
|
jpayne@69
|
128 * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created.
|
jpayne@69
|
129 *
|
jpayne@69
|
130 * Removes any constraints that may have been set on the instance.
|
jpayne@69
|
131 *
|
jpayne@69
|
132 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
133 * @param ec Set if an error occurs.
|
jpayne@69
|
134 * @stable ICU 64
|
jpayne@69
|
135 */
|
jpayne@69
|
136 U_STABLE void U_EXPORT2
|
jpayne@69
|
137 ucfpos_reset(
|
jpayne@69
|
138 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
139 UErrorCode* ec);
|
jpayne@69
|
140
|
jpayne@69
|
141
|
jpayne@69
|
142 /**
|
jpayne@69
|
143 * Destroys a UConstrainedFieldPosition and releases its memory.
|
jpayne@69
|
144 *
|
jpayne@69
|
145 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
146 * @stable ICU 64
|
jpayne@69
|
147 */
|
jpayne@69
|
148 U_STABLE void U_EXPORT2
|
jpayne@69
|
149 ucfpos_close(UConstrainedFieldPosition* ucfpos);
|
jpayne@69
|
150
|
jpayne@69
|
151
|
jpayne@69
|
152 /**
|
jpayne@69
|
153 * Sets a constraint on the field category.
|
jpayne@69
|
154 *
|
jpayne@69
|
155 * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
|
jpayne@69
|
156 * positions are skipped unless they have the given category.
|
jpayne@69
|
157 *
|
jpayne@69
|
158 * Any previously set constraints are cleared.
|
jpayne@69
|
159 *
|
jpayne@69
|
160 * For example, to loop over only the number-related fields:
|
jpayne@69
|
161 *
|
jpayne@69
|
162 * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
|
jpayne@69
|
163 * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec);
|
jpayne@69
|
164 * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
|
jpayne@69
|
165 * // handle the number-related field position
|
jpayne@69
|
166 * }
|
jpayne@69
|
167 * ucfpos_close(ucfpos);
|
jpayne@69
|
168 *
|
jpayne@69
|
169 * Changing the constraint while in the middle of iterating over a FormattedValue
|
jpayne@69
|
170 * does not generally have well-defined behavior.
|
jpayne@69
|
171 *
|
jpayne@69
|
172 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
173 * @param category The field category to fix when iterating.
|
jpayne@69
|
174 * @param ec Set if an error occurs.
|
jpayne@69
|
175 * @stable ICU 64
|
jpayne@69
|
176 */
|
jpayne@69
|
177 U_STABLE void U_EXPORT2
|
jpayne@69
|
178 ucfpos_constrainCategory(
|
jpayne@69
|
179 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
180 int32_t category,
|
jpayne@69
|
181 UErrorCode* ec);
|
jpayne@69
|
182
|
jpayne@69
|
183
|
jpayne@69
|
184 /**
|
jpayne@69
|
185 * Sets a constraint on the category and field.
|
jpayne@69
|
186 *
|
jpayne@69
|
187 * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition,
|
jpayne@69
|
188 * positions are skipped unless they have the given category and field.
|
jpayne@69
|
189 *
|
jpayne@69
|
190 * Any previously set constraints are cleared.
|
jpayne@69
|
191 *
|
jpayne@69
|
192 * For example, to loop over all grouping separators:
|
jpayne@69
|
193 *
|
jpayne@69
|
194 * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
|
jpayne@69
|
195 * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec);
|
jpayne@69
|
196 * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
|
jpayne@69
|
197 * // handle the grouping separator position
|
jpayne@69
|
198 * }
|
jpayne@69
|
199 * ucfpos_close(ucfpos);
|
jpayne@69
|
200 *
|
jpayne@69
|
201 * Changing the constraint while in the middle of iterating over a FormattedValue
|
jpayne@69
|
202 * does not generally have well-defined behavior.
|
jpayne@69
|
203 *
|
jpayne@69
|
204 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
205 * @param category The field category to fix when iterating.
|
jpayne@69
|
206 * @param field The field to fix when iterating.
|
jpayne@69
|
207 * @param ec Set if an error occurs.
|
jpayne@69
|
208 * @stable ICU 64
|
jpayne@69
|
209 */
|
jpayne@69
|
210 U_STABLE void U_EXPORT2
|
jpayne@69
|
211 ucfpos_constrainField(
|
jpayne@69
|
212 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
213 int32_t category,
|
jpayne@69
|
214 int32_t field,
|
jpayne@69
|
215 UErrorCode* ec);
|
jpayne@69
|
216
|
jpayne@69
|
217
|
jpayne@69
|
218 /**
|
jpayne@69
|
219 * Gets the field category for the current position.
|
jpayne@69
|
220 *
|
jpayne@69
|
221 * If a category or field constraint was set, this function returns the constrained
|
jpayne@69
|
222 * category. Otherwise, the return value is well-defined only after
|
jpayne@69
|
223 * ufmtval_nextPosition returns TRUE.
|
jpayne@69
|
224 *
|
jpayne@69
|
225 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
226 * @param ec Set if an error occurs.
|
jpayne@69
|
227 * @return The field category saved in the instance.
|
jpayne@69
|
228 * @stable ICU 64
|
jpayne@69
|
229 */
|
jpayne@69
|
230 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
231 ucfpos_getCategory(
|
jpayne@69
|
232 const UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
233 UErrorCode* ec);
|
jpayne@69
|
234
|
jpayne@69
|
235
|
jpayne@69
|
236 /**
|
jpayne@69
|
237 * Gets the field for the current position.
|
jpayne@69
|
238 *
|
jpayne@69
|
239 * If a field constraint was set, this function returns the constrained
|
jpayne@69
|
240 * field. Otherwise, the return value is well-defined only after
|
jpayne@69
|
241 * ufmtval_nextPosition returns TRUE.
|
jpayne@69
|
242 *
|
jpayne@69
|
243 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
244 * @param ec Set if an error occurs.
|
jpayne@69
|
245 * @return The field saved in the instance.
|
jpayne@69
|
246 * @stable ICU 64
|
jpayne@69
|
247 */
|
jpayne@69
|
248 U_STABLE int32_t U_EXPORT2
|
jpayne@69
|
249 ucfpos_getField(
|
jpayne@69
|
250 const UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
251 UErrorCode* ec);
|
jpayne@69
|
252
|
jpayne@69
|
253
|
jpayne@69
|
254 /**
|
jpayne@69
|
255 * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position.
|
jpayne@69
|
256 *
|
jpayne@69
|
257 * The output values are well-defined only after ufmtval_nextPosition returns TRUE.
|
jpayne@69
|
258 *
|
jpayne@69
|
259 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
260 * @param pStart Set to the start index saved in the instance. Ignored if nullptr.
|
jpayne@69
|
261 * @param pLimit Set to the end index saved in the instance. Ignored if nullptr.
|
jpayne@69
|
262 * @param ec Set if an error occurs.
|
jpayne@69
|
263 * @stable ICU 64
|
jpayne@69
|
264 */
|
jpayne@69
|
265 U_STABLE void U_EXPORT2
|
jpayne@69
|
266 ucfpos_getIndexes(
|
jpayne@69
|
267 const UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
268 int32_t* pStart,
|
jpayne@69
|
269 int32_t* pLimit,
|
jpayne@69
|
270 UErrorCode* ec);
|
jpayne@69
|
271
|
jpayne@69
|
272
|
jpayne@69
|
273 /**
|
jpayne@69
|
274 * Gets an int64 that FormattedValue implementations may use for storage.
|
jpayne@69
|
275 *
|
jpayne@69
|
276 * The initial value is zero.
|
jpayne@69
|
277 *
|
jpayne@69
|
278 * Users of FormattedValue should not need to call this method.
|
jpayne@69
|
279 *
|
jpayne@69
|
280 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
281 * @param ec Set if an error occurs.
|
jpayne@69
|
282 * @return The current iteration context from ucfpos_setInt64IterationContext.
|
jpayne@69
|
283 * @stable ICU 64
|
jpayne@69
|
284 */
|
jpayne@69
|
285 U_STABLE int64_t U_EXPORT2
|
jpayne@69
|
286 ucfpos_getInt64IterationContext(
|
jpayne@69
|
287 const UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
288 UErrorCode* ec);
|
jpayne@69
|
289
|
jpayne@69
|
290
|
jpayne@69
|
291 /**
|
jpayne@69
|
292 * Sets an int64 that FormattedValue implementations may use for storage.
|
jpayne@69
|
293 *
|
jpayne@69
|
294 * Intended to be used by FormattedValue implementations.
|
jpayne@69
|
295 *
|
jpayne@69
|
296 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
297 * @param context The new iteration context.
|
jpayne@69
|
298 * @param ec Set if an error occurs.
|
jpayne@69
|
299 * @stable ICU 64
|
jpayne@69
|
300 */
|
jpayne@69
|
301 U_STABLE void U_EXPORT2
|
jpayne@69
|
302 ucfpos_setInt64IterationContext(
|
jpayne@69
|
303 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
304 int64_t context,
|
jpayne@69
|
305 UErrorCode* ec);
|
jpayne@69
|
306
|
jpayne@69
|
307
|
jpayne@69
|
308 /**
|
jpayne@69
|
309 * Determines whether a given field should be included given the
|
jpayne@69
|
310 * constraints.
|
jpayne@69
|
311 *
|
jpayne@69
|
312 * Intended to be used by FormattedValue implementations.
|
jpayne@69
|
313 *
|
jpayne@69
|
314 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
315 * @param category The category to test.
|
jpayne@69
|
316 * @param field The field to test.
|
jpayne@69
|
317 * @param ec Set if an error occurs.
|
jpayne@69
|
318 * @stable ICU 64
|
jpayne@69
|
319 */
|
jpayne@69
|
320 U_STABLE UBool U_EXPORT2
|
jpayne@69
|
321 ucfpos_matchesField(
|
jpayne@69
|
322 const UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
323 int32_t category,
|
jpayne@69
|
324 int32_t field,
|
jpayne@69
|
325 UErrorCode* ec);
|
jpayne@69
|
326
|
jpayne@69
|
327
|
jpayne@69
|
328 /**
|
jpayne@69
|
329 * Sets new values for the primary public getters.
|
jpayne@69
|
330 *
|
jpayne@69
|
331 * Intended to be used by FormattedValue implementations.
|
jpayne@69
|
332 *
|
jpayne@69
|
333 * It is up to the implementation to ensure that the user-requested
|
jpayne@69
|
334 * constraints are satisfied. This method does not check!
|
jpayne@69
|
335 *
|
jpayne@69
|
336 * @param ucfpos The instance of UConstrainedFieldPosition.
|
jpayne@69
|
337 * @param category The new field category.
|
jpayne@69
|
338 * @param field The new field.
|
jpayne@69
|
339 * @param start The new inclusive start index.
|
jpayne@69
|
340 * @param limit The new exclusive end index.
|
jpayne@69
|
341 * @param ec Set if an error occurs.
|
jpayne@69
|
342 * @stable ICU 64
|
jpayne@69
|
343 */
|
jpayne@69
|
344 U_STABLE void U_EXPORT2
|
jpayne@69
|
345 ucfpos_setState(
|
jpayne@69
|
346 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
347 int32_t category,
|
jpayne@69
|
348 int32_t field,
|
jpayne@69
|
349 int32_t start,
|
jpayne@69
|
350 int32_t limit,
|
jpayne@69
|
351 UErrorCode* ec);
|
jpayne@69
|
352
|
jpayne@69
|
353
|
jpayne@69
|
354 struct UFormattedValue;
|
jpayne@69
|
355 /**
|
jpayne@69
|
356 * An abstract formatted value: a string with associated field attributes.
|
jpayne@69
|
357 * Many formatters format to types compatible with UFormattedValue.
|
jpayne@69
|
358 *
|
jpayne@69
|
359 * @stable ICU 64
|
jpayne@69
|
360 */
|
jpayne@69
|
361 typedef struct UFormattedValue UFormattedValue;
|
jpayne@69
|
362
|
jpayne@69
|
363
|
jpayne@69
|
364 /**
|
jpayne@69
|
365 * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The
|
jpayne@69
|
366 * return value is valid only as long as the UFormattedValue is present and unchanged in memory.
|
jpayne@69
|
367 *
|
jpayne@69
|
368 * The return value is NUL-terminated but could contain internal NULs.
|
jpayne@69
|
369 *
|
jpayne@69
|
370 * @param ufmtval
|
jpayne@69
|
371 * The object containing the formatted string and attributes.
|
jpayne@69
|
372 * @param pLength Output variable for the length of the string. Ignored if NULL.
|
jpayne@69
|
373 * @param ec Set if an error occurs.
|
jpayne@69
|
374 * @return A NUL-terminated char16 string owned by the UFormattedValue.
|
jpayne@69
|
375 * @stable ICU 64
|
jpayne@69
|
376 */
|
jpayne@69
|
377 U_STABLE const UChar* U_EXPORT2
|
jpayne@69
|
378 ufmtval_getString(
|
jpayne@69
|
379 const UFormattedValue* ufmtval,
|
jpayne@69
|
380 int32_t* pLength,
|
jpayne@69
|
381 UErrorCode* ec);
|
jpayne@69
|
382
|
jpayne@69
|
383
|
jpayne@69
|
384 /**
|
jpayne@69
|
385 * Iterates over field positions in the UFormattedValue. This lets you determine the position
|
jpayne@69
|
386 * of specific types of substrings, like a month or a decimal separator.
|
jpayne@69
|
387 *
|
jpayne@69
|
388 * To loop over all field positions:
|
jpayne@69
|
389 *
|
jpayne@69
|
390 * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec);
|
jpayne@69
|
391 * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) {
|
jpayne@69
|
392 * // handle the field position; get information from ucfpos
|
jpayne@69
|
393 * }
|
jpayne@69
|
394 * ucfpos_close(ucfpos);
|
jpayne@69
|
395 *
|
jpayne@69
|
396 * @param ufmtval
|
jpayne@69
|
397 * The object containing the formatted string and attributes.
|
jpayne@69
|
398 * @param ucfpos
|
jpayne@69
|
399 * The object used for iteration state; can provide constraints to iterate over only
|
jpayne@69
|
400 * one specific category or field;
|
jpayne@69
|
401 * see ucfpos_constrainCategory
|
jpayne@69
|
402 * and ucfpos_constrainField.
|
jpayne@69
|
403 * @param ec Set if an error occurs.
|
jpayne@69
|
404 * @return TRUE if another position was found; FALSE otherwise.
|
jpayne@69
|
405 * @stable ICU 64
|
jpayne@69
|
406 */
|
jpayne@69
|
407 U_STABLE UBool U_EXPORT2
|
jpayne@69
|
408 ufmtval_nextPosition(
|
jpayne@69
|
409 const UFormattedValue* ufmtval,
|
jpayne@69
|
410 UConstrainedFieldPosition* ucfpos,
|
jpayne@69
|
411 UErrorCode* ec);
|
jpayne@69
|
412
|
jpayne@69
|
413
|
jpayne@69
|
414 #if U_SHOW_CPLUSPLUS_API
|
jpayne@69
|
415 U_NAMESPACE_BEGIN
|
jpayne@69
|
416
|
jpayne@69
|
417 /**
|
jpayne@69
|
418 * \class LocalUConstrainedFieldPositionPointer
|
jpayne@69
|
419 * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close().
|
jpayne@69
|
420 * For most methods see the LocalPointerBase base class.
|
jpayne@69
|
421 *
|
jpayne@69
|
422 * Usage:
|
jpayne@69
|
423 *
|
jpayne@69
|
424 * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec));
|
jpayne@69
|
425 * // no need to explicitly call ucfpos_close()
|
jpayne@69
|
426 *
|
jpayne@69
|
427 * @stable ICU 64
|
jpayne@69
|
428 */
|
jpayne@69
|
429 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer,
|
jpayne@69
|
430 UConstrainedFieldPosition,
|
jpayne@69
|
431 ucfpos_close);
|
jpayne@69
|
432
|
jpayne@69
|
433 U_NAMESPACE_END
|
jpayne@69
|
434 #endif // U_SHOW_CPLUSPLUS_API
|
jpayne@69
|
435
|
jpayne@69
|
436
|
jpayne@69
|
437 #endif /* #if !UCONFIG_NO_FORMATTING */
|
jpayne@69
|
438 #endif // __UFORMATTEDVALUE_H__
|