00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FIELDPOS_H
00022 #define FIELDPOS_H
00023
00024 #include "unicode/utypes.h"
00025
00026 #if !UCONFIG_NO_FORMATTING
00027
00028 #include "unicode/uobject.h"
00029
00030 U_NAMESPACE_BEGIN
00031
00100 class U_I18N_API FieldPosition : public UObject {
00101 public:
00106 enum { DONT_CARE = -1 };
00107
00112 FieldPosition()
00113 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
00114
00126 FieldPosition(int32_t field)
00127 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
00128
00134 FieldPosition(const FieldPosition& copy)
00135 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
00136
00141 ~FieldPosition();
00142
00148 FieldPosition& operator=(const FieldPosition& copy);
00149
00156 UBool operator==(const FieldPosition& that) const;
00157
00164 UBool operator!=(const FieldPosition& that) const;
00165
00177 FieldPosition *clone() const;
00178
00184 int32_t getField(void) const { return fField; }
00185
00191 int32_t getBeginIndex(void) const { return fBeginIndex; }
00192
00200 int32_t getEndIndex(void) const { return fEndIndex; }
00201
00207 void setField(int32_t f) { fField = f; }
00208
00214 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
00215
00221 void setEndIndex(int32_t ei) { fEndIndex = ei; }
00222
00228 virtual UClassID getDynamicClassID() const;
00229
00235 static UClassID getStaticClassID();
00236
00237 private:
00242 int32_t fField;
00243
00248 int32_t fBeginIndex;
00249
00254 int32_t fEndIndex;
00255 };
00256
00257 inline FieldPosition&
00258 FieldPosition::operator=(const FieldPosition& copy)
00259 {
00260 fField = copy.fField;
00261 fEndIndex = copy.fEndIndex;
00262 fBeginIndex = copy.fBeginIndex;
00263 return *this;
00264 }
00265
00266 inline UBool
00267 FieldPosition::operator==(const FieldPosition& copy) const
00268 {
00269 if( fField != copy.fField ||
00270 fEndIndex != copy.fEndIndex ||
00271 fBeginIndex != copy.fBeginIndex)
00272 return FALSE;
00273 else
00274 return TRUE;
00275 }
00276
00277 inline UBool
00278 FieldPosition::operator!=(const FieldPosition& copy) const
00279 {
00280 return !operator==(copy);
00281 }
00282
00283 U_NAMESPACE_END
00284
00285 #endif
00286
00287 #endif // _FIELDPOS
00288