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
00098 class U_I18N_API FieldPosition : public UObject {
00099 public:
00104 enum { DONT_CARE = -1 };
00105
00110 FieldPosition()
00111 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
00112
00124 FieldPosition(int32_t field)
00125 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
00126
00132 FieldPosition(const FieldPosition& copy)
00133 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
00134
00139 ~FieldPosition() {}
00140
00146 FieldPosition& operator=(const FieldPosition& copy);
00147
00154 UBool operator==(const FieldPosition& that) const;
00155
00162 UBool operator!=(const FieldPosition& that) const;
00163
00169 int32_t getField(void) const { return fField; }
00170
00176 int32_t getBeginIndex(void) const { return fBeginIndex; }
00177
00185 int32_t getEndIndex(void) const { return fEndIndex; }
00186
00192 void setField(int32_t f) { fField = f; }
00193
00199 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
00200
00206 void setEndIndex(int32_t ei) { fEndIndex = ei; }
00207
00213 virtual inline UClassID getDynamicClassID() const;
00214
00220 static inline UClassID getStaticClassID();
00221
00222 private:
00227 int32_t fField;
00228
00233 int32_t fBeginIndex;
00234
00239 int32_t fEndIndex;
00240
00245 static const char fgClassID;
00246 };
00247
00248 inline UClassID FieldPosition::getStaticClassID()
00249 { return (UClassID)&fgClassID; }
00250
00251 inline UClassID FieldPosition::getDynamicClassID() const
00252 { return FieldPosition::getStaticClassID(); }
00253
00254 inline FieldPosition&
00255 FieldPosition::operator=(const FieldPosition& copy)
00256 {
00257 fField = copy.fField;
00258 fEndIndex = copy.fEndIndex;
00259 fBeginIndex = copy.fBeginIndex;
00260 return *this;
00261 }
00262
00263 inline UBool
00264 FieldPosition::operator==(const FieldPosition& copy) const
00265 {
00266 if( fField != copy.fField ||
00267 fEndIndex != copy.fEndIndex ||
00268 fBeginIndex != copy.fBeginIndex)
00269 return FALSE;
00270 else
00271 return TRUE;
00272 }
00273
00274 inline UBool
00275 FieldPosition::operator!=(const FieldPosition& copy) const
00276 {
00277 return !operator==(copy);
00278 }
00279
00280 U_NAMESPACE_END
00281
00282 #endif
00283
00284 #endif // _FIELDPOS
00285