2 *****************************************************************************************
3 * Copyright (C) 2015, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *****************************************************************************************
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_FORMATTING
12 #include "unicode/ufieldpositer.h"
13 #include "unicode/fpositer.h"
14 #include "unicode/localpointer.h"
19 U_CAPI UFieldPositionIterator
* U_EXPORT2
20 ufieldpositer_open(UErrorCode
* status
)
22 if (U_FAILURE(*status
)) {
25 FieldPositionIterator
* fpositer
= new FieldPositionIterator();
26 if (fpositer
== NULL
) {
27 *status
= U_MEMORY_ALLOCATION_ERROR
;
29 return (UFieldPositionIterator
*)fpositer
;
34 ufieldpositer_close(UFieldPositionIterator
*fpositer
)
36 delete (FieldPositionIterator
*)fpositer
;
40 U_CAPI
int32_t U_EXPORT2
41 ufieldpositer_next(UFieldPositionIterator
*fpositer
,
42 int32_t *beginIndex
, int32_t *endIndex
)
46 if (((FieldPositionIterator
*)fpositer
)->next(fp
)) {
47 field
= fp
.getField();
49 *beginIndex
= fp
.getBeginIndex();
52 *endIndex
= fp
.getEndIndex();
59 #endif /* #if !UCONFIG_NO_FORMATTING */