annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/ufieldpositer.cpp @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents
children
rev   line source
arajkumar@11038 1 // © 2016 and later: Unicode, Inc. and others.
arajkumar@11038 2 // License & terms of use: http://www.unicode.org/copyright.html
arajkumar@11038 3 /*
arajkumar@11038 4 *****************************************************************************************
arajkumar@11038 5 * Copyright (C) 2015, International Business Machines
arajkumar@11038 6 * Corporation and others. All Rights Reserved.
arajkumar@11038 7 *****************************************************************************************
arajkumar@11038 8 */
arajkumar@11038 9
arajkumar@11038 10 #include "unicode/utypes.h"
arajkumar@11038 11
arajkumar@11038 12 #if !UCONFIG_NO_FORMATTING
arajkumar@11038 13
arajkumar@11038 14 #include "unicode/ufieldpositer.h"
arajkumar@11038 15 #include "unicode/fpositer.h"
arajkumar@11038 16 #include "unicode/localpointer.h"
arajkumar@11038 17
arajkumar@11038 18 U_NAMESPACE_USE
arajkumar@11038 19
arajkumar@11038 20
arajkumar@11038 21 U_CAPI UFieldPositionIterator* U_EXPORT2
arajkumar@11038 22 ufieldpositer_open(UErrorCode* status)
arajkumar@11038 23 {
arajkumar@11038 24 if (U_FAILURE(*status)) {
arajkumar@11038 25 return NULL;
arajkumar@11038 26 }
arajkumar@11038 27 FieldPositionIterator* fpositer = new FieldPositionIterator();
arajkumar@11038 28 if (fpositer == NULL) {
arajkumar@11038 29 *status = U_MEMORY_ALLOCATION_ERROR;
arajkumar@11038 30 }
arajkumar@11038 31 return (UFieldPositionIterator*)fpositer;
arajkumar@11038 32 }
arajkumar@11038 33
arajkumar@11038 34
arajkumar@11038 35 U_CAPI void U_EXPORT2
arajkumar@11038 36 ufieldpositer_close(UFieldPositionIterator *fpositer)
arajkumar@11038 37 {
arajkumar@11038 38 delete (FieldPositionIterator*)fpositer;
arajkumar@11038 39 }
arajkumar@11038 40
arajkumar@11038 41
arajkumar@11038 42 U_CAPI int32_t U_EXPORT2
arajkumar@11038 43 ufieldpositer_next(UFieldPositionIterator *fpositer,
arajkumar@11038 44 int32_t *beginIndex, int32_t *endIndex)
arajkumar@11038 45 {
arajkumar@11038 46 FieldPosition fp;
arajkumar@11038 47 int32_t field = -1;
arajkumar@11038 48 if (((FieldPositionIterator*)fpositer)->next(fp)) {
arajkumar@11038 49 field = fp.getField();
arajkumar@11038 50 if (beginIndex) {
arajkumar@11038 51 *beginIndex = fp.getBeginIndex();
arajkumar@11038 52 }
arajkumar@11038 53 if (endIndex) {
arajkumar@11038 54 *endIndex = fp.getEndIndex();
arajkumar@11038 55 }
arajkumar@11038 56 }
arajkumar@11038 57 return field;
arajkumar@11038 58 }
arajkumar@11038 59
arajkumar@11038 60
arajkumar@11038 61 #endif /* #if !UCONFIG_NO_FORMATTING */