00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FIELDPOS_H
00025 #define FIELDPOS_H
00026
00027 #include "unicode/utypes.h"
00028
00029 #if U_SHOW_CPLUSPLUS_API
00030
00036 #if !UCONFIG_NO_FORMATTING
00037
00038 #include "unicode/uobject.h"
00039
00040 U_NAMESPACE_BEGIN
00041
00110 class U_I18N_API FieldPosition : public UObject {
00111 public:
00117 enum { DONT_CARE = -1 };
00118
00123 FieldPosition()
00124 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
00125
00137 FieldPosition(int32_t field)
00138 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
00139
00145 FieldPosition(const FieldPosition& copy)
00146 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
00147
00152 virtual ~FieldPosition();
00153
00159 FieldPosition& operator=(const FieldPosition& copy);
00160
00167 UBool operator==(const FieldPosition& that) const;
00168
00175 UBool operator!=(const FieldPosition& that) const;
00176
00188 FieldPosition *clone() const;
00189
00195 int32_t getField(void) const { return fField; }
00196
00202 int32_t getBeginIndex(void) const { return fBeginIndex; }
00203
00211 int32_t getEndIndex(void) const { return fEndIndex; }
00212
00218 void setField(int32_t f) { fField = f; }
00219
00225 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
00226
00232 void setEndIndex(int32_t ei) { fEndIndex = ei; }
00233
00239 virtual UClassID getDynamicClassID() const;
00240
00246 static UClassID U_EXPORT2 getStaticClassID();
00247
00248 private:
00253 int32_t fField;
00254
00259 int32_t fBeginIndex;
00260
00265 int32_t fEndIndex;
00266 };
00267
00268 inline FieldPosition&
00269 FieldPosition::operator=(const FieldPosition& copy)
00270 {
00271 fField = copy.fField;
00272 fEndIndex = copy.fEndIndex;
00273 fBeginIndex = copy.fBeginIndex;
00274 return *this;
00275 }
00276
00277 inline UBool
00278 FieldPosition::operator==(const FieldPosition& copy) const
00279 {
00280 return (fField == copy.fField &&
00281 fEndIndex == copy.fEndIndex &&
00282 fBeginIndex == copy.fBeginIndex);
00283 }
00284
00285 inline UBool
00286 FieldPosition::operator!=(const FieldPosition& copy) const
00287 {
00288 return !operator==(copy);
00289 }
00290
00291 U_NAMESPACE_END
00292
00293 #endif
00294
00295 #endif
00296
00297 #endif // _FIELDPOS
00298