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
00027 #if !UCONFIG_NO_FORMATTING
00028
00029 #include "unicode/uobject.h"
00030
00031 U_NAMESPACE_BEGIN
00032
00101 class U_I18N_API FieldPosition : public UObject {
00102 public:
00107 enum { DONT_CARE = -1 };
00108
00113 FieldPosition()
00114 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
00115
00127 FieldPosition(int32_t field)
00128 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
00129
00135 FieldPosition(const FieldPosition& copy)
00136 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
00137
00142 virtual ~FieldPosition();
00143
00149 FieldPosition& operator=(const FieldPosition& copy);
00150
00157 UBool operator==(const FieldPosition& that) const;
00158
00165 UBool operator!=(const FieldPosition& that) const;
00166
00178 FieldPosition *clone() const;
00179
00185 int32_t getField(void) const { return fField; }
00186
00192 int32_t getBeginIndex(void) const { return fBeginIndex; }
00193
00201 int32_t getEndIndex(void) const { return fEndIndex; }
00202
00208 void setField(int32_t f) { fField = f; }
00209
00215 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
00216
00222 void setEndIndex(int32_t ei) { fEndIndex = ei; }
00223
00229 virtual UClassID getDynamicClassID() const;
00230
00236 static UClassID U_EXPORT2 getStaticClassID();
00237
00238 private:
00243 int32_t fField;
00244
00249 int32_t fBeginIndex;
00250
00255 int32_t fEndIndex;
00256 };
00257
00258 inline FieldPosition&
00259 FieldPosition::operator=(const FieldPosition& copy)
00260 {
00261 fField = copy.fField;
00262 fEndIndex = copy.fEndIndex;
00263 fBeginIndex = copy.fBeginIndex;
00264 return *this;
00265 }
00266
00267 inline UBool
00268 FieldPosition::operator==(const FieldPosition& copy) const
00269 {
00270 if( fField != copy.fField ||
00271 fEndIndex != copy.fEndIndex ||
00272 fBeginIndex != copy.fBeginIndex)
00273 return FALSE;
00274 else
00275 return TRUE;
00276 }
00277
00278 inline UBool
00279 FieldPosition::operator!=(const FieldPosition& copy) const
00280 {
00281 return !operator==(copy);
00282 }
00283
00284 U_NAMESPACE_END
00285
00286 #endif
00287
00288 #endif // _FIELDPOS
00289