1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *****************************************************************************************
5 * Copyright (C) 2015, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *****************************************************************************************
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/ufieldpositer.h"
15 #include "unicode/fpositer.h"
16 #include "unicode/localpointer.h"
21 U_CAPI UFieldPositionIterator
* U_EXPORT2
22 ufieldpositer_open(UErrorCode
* status
)
24 if (U_FAILURE(*status
)) {
27 FieldPositionIterator
* fpositer
= new FieldPositionIterator();
28 if (fpositer
== NULL
) {
29 *status
= U_MEMORY_ALLOCATION_ERROR
;
31 return (UFieldPositionIterator
*)fpositer
;
36 ufieldpositer_close(UFieldPositionIterator
*fpositer
)
38 delete (FieldPositionIterator
*)fpositer
;
42 U_CAPI
int32_t U_EXPORT2
43 ufieldpositer_next(UFieldPositionIterator
*fpositer
,
44 int32_t *beginIndex
, int32_t *endIndex
)
48 if (((FieldPositionIterator
*)fpositer
)->next(fp
)) {
49 field
= fp
.getField();
51 *beginIndex
= fp
.getBeginIndex();
54 *endIndex
= fp
.getEndIndex();
61 #endif /* #if !UCONFIG_NO_FORMATTING */