1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/i18n/unicode/fpositer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,117 @@ 1.4 +/* 1.5 +******************************************************************************** 1.6 +* Copyright (C) 2010-2012, International Business Machines 1.7 +* Corporation and others. All Rights Reserved. 1.8 +******************************************************************************** 1.9 +* 1.10 +* File attiter.h 1.11 +* 1.12 +* Modification History: 1.13 +* 1.14 +* Date Name Description 1.15 +* 12/15/2009 dougfelt Created 1.16 +******************************************************************************** 1.17 +*/ 1.18 + 1.19 +#ifndef FPOSITER_H 1.20 +#define FPOSITER_H 1.21 + 1.22 +#include "unicode/utypes.h" 1.23 +#include "unicode/uobject.h" 1.24 + 1.25 +/** 1.26 + * \file 1.27 + * \brief C++ API: FieldPosition Iterator. 1.28 + */ 1.29 + 1.30 +#if UCONFIG_NO_FORMATTING 1.31 + 1.32 +U_NAMESPACE_BEGIN 1.33 + 1.34 +/* 1.35 + * Allow the declaration of APIs with pointers to FieldPositionIterator 1.36 + * even when formatting is removed from the build. 1.37 + */ 1.38 +class FieldPositionIterator; 1.39 + 1.40 +U_NAMESPACE_END 1.41 + 1.42 +#else 1.43 + 1.44 +#include "unicode/fieldpos.h" 1.45 +#include "unicode/umisc.h" 1.46 + 1.47 +U_NAMESPACE_BEGIN 1.48 + 1.49 +class UVector32; 1.50 + 1.51 +/** 1.52 + * FieldPositionIterator returns the field ids and their start/limit positions generated 1.53 + * by a call to Format::format. See Format, NumberFormat, DecimalFormat. 1.54 + * @stable ICU 4.4 1.55 + */ 1.56 +class U_I18N_API FieldPositionIterator : public UObject { 1.57 +public: 1.58 + /** 1.59 + * Destructor. 1.60 + * @stable ICU 4.4 1.61 + */ 1.62 + ~FieldPositionIterator(); 1.63 + 1.64 + /** 1.65 + * Constructs a new, empty iterator. 1.66 + * @stable ICU 4.4 1.67 + */ 1.68 + FieldPositionIterator(void); 1.69 + 1.70 + /** 1.71 + * Copy constructor. If the copy failed for some reason, the new iterator will 1.72 + * be empty. 1.73 + * @stable ICU 4.4 1.74 + */ 1.75 + FieldPositionIterator(const FieldPositionIterator&); 1.76 + 1.77 + /** 1.78 + * Return true if another object is semantically equal to this 1.79 + * one. 1.80 + * <p> 1.81 + * Return true if this FieldPositionIterator is at the same position in an 1.82 + * equal array of run values. 1.83 + * @stable ICU 4.4 1.84 + */ 1.85 + UBool operator==(const FieldPositionIterator&) const; 1.86 + 1.87 + /** 1.88 + * Returns the complement of the result of operator== 1.89 + * @param rhs The FieldPositionIterator to be compared for inequality 1.90 + * @return the complement of the result of operator== 1.91 + * @stable ICU 4.4 1.92 + */ 1.93 + UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); } 1.94 + 1.95 + /** 1.96 + * If the current position is valid, updates the FieldPosition values, advances the iterator, 1.97 + * and returns TRUE, otherwise returns FALSE. 1.98 + * @stable ICU 4.4 1.99 + */ 1.100 + UBool next(FieldPosition& fp); 1.101 + 1.102 +private: 1.103 + friend class FieldPositionIteratorHandler; 1.104 + 1.105 + /** 1.106 + * Sets the data used by the iterator, and resets the position. 1.107 + * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid 1.108 + * (length is not a multiple of 3, or start >= limit for any run). 1.109 + */ 1.110 + void setData(UVector32 *adopt, UErrorCode& status); 1.111 + 1.112 + UVector32 *data; 1.113 + int32_t pos; 1.114 +}; 1.115 + 1.116 +U_NAMESPACE_END 1.117 + 1.118 +#endif /* #if !UCONFIG_NO_FORMATTING */ 1.119 + 1.120 +#endif // FPOSITER_H