00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIELDPOS_H
00023 #define FIELDPOS_H
00024
00025 #include "unicode/utypes.h"
00026
00032 #if !UCONFIG_NO_FORMATTING
00033
00034 #include "unicode/uobject.h"
00035
00036 U_NAMESPACE_BEGIN
00037
00106 class U_I18N_API FieldPosition : public UObject {
00107 public:
00112 enum { DONT_CARE = -1 };
00113
00118 FieldPosition()
00119 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
00120
00132 FieldPosition(int32_t field)
00133 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
00134
00140 FieldPosition(const FieldPosition& copy)
00141 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
00142
00147 virtual ~FieldPosition();
00148
00154 FieldPosition& operator=(const FieldPosition& copy);
00155
00162 UBool operator==(const FieldPosition& that) const;
00163
00170 UBool operator!=(const FieldPosition& that) const;
00171
00183 FieldPosition *clone() const;
00184
00190 int32_t getField(void) const { return fField; }
00191
00197 int32_t getBeginIndex(void) const { return fBeginIndex; }
00198
00206 int32_t getEndIndex(void) const { return fEndIndex; }
00207
00213 void setField(int32_t f) { fField = f; }
00214
00220 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
00221
00227 void setEndIndex(int32_t ei) { fEndIndex = ei; }
00228
00234 virtual UClassID getDynamicClassID() const;
00235
00241 static UClassID U_EXPORT2 getStaticClassID();
00242
00243 private:
00248 int32_t fField;
00249
00254 int32_t fBeginIndex;
00255
00260 int32_t fEndIndex;
00261 };
00262
00263 inline FieldPosition&
00264 FieldPosition::operator=(const FieldPosition& copy)
00265 {
00266 fField = copy.fField;
00267 fEndIndex = copy.fEndIndex;
00268 fBeginIndex = copy.fBeginIndex;
00269 return *this;
00270 }
00271
00272 inline UBool
00273 FieldPosition::operator==(const FieldPosition& copy) const
00274 {
00275 return (fField == copy.fField &&
00276 fEndIndex == copy.fEndIndex &&
00277 fBeginIndex == copy.fBeginIndex);
00278 }
00279
00280 inline UBool
00281 FieldPosition::operator!=(const FieldPosition& copy) const
00282 {
00283 return !operator==(copy);
00284 }
00285
00286 U_NAMESPACE_END
00287
00288 #endif
00289
00290 #endif // _FIELDPOS
00291