ICU 75.1 75.1

fieldpos.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2006, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File FIELDPOS.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 02/25/97 aliu Converted from java.
15 * 03/17/97 clhuang Updated per Format implementation.
16 * 07/17/98 stephen Added default/copy ctors, and operators =, ==, !=
17 ********************************************************************************
18 */
19
20 // *****************************************************************************
21 // This file was generated from the java source file FieldPosition.java
22 // *****************************************************************************
23
24 #ifndef FIELDPOS_H
25 #define FIELDPOS_H
26
27 #include "unicode/utypes.h"
28
29 #if U_SHOW_CPLUSPLUS_API
30
36 #if !UCONFIG_NO_FORMATTING
37
38 #include "unicode/uobject.h"
39
40 U_NAMESPACE_BEGIN
41
110 class U_I18N_API FieldPosition : public UObject {
111 public:
117 enum { DONT_CARE = -1 };
118
123 FieldPosition()
124 : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
125
137 FieldPosition(int32_t field)
138 : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
139
145 FieldPosition(const FieldPosition& copy)
146 : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
147
152 virtual ~FieldPosition();
153
159 FieldPosition& operator=(const FieldPosition& copy);
160
167 bool operator==(const FieldPosition& that) const;
168
175 bool operator!=(const FieldPosition& that) const;
176
188 FieldPosition *clone() const;
189
195 int32_t getField() const { return fField; }
196
202 int32_t getBeginIndex() const { return fBeginIndex; }
203
211 int32_t getEndIndex() const { return fEndIndex; }
212
218 void setField(int32_t f) { fField = f; }
219
225 void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
226
232 void setEndIndex(int32_t ei) { fEndIndex = ei; }
233
239 virtual UClassID getDynamicClassID() const override;
240
246 static UClassID U_EXPORT2 getStaticClassID();
247
248 private:
253 int32_t fField;
254
259 int32_t fBeginIndex;
260
265 int32_t fEndIndex;
266 };
267
268 inline FieldPosition&
269 FieldPosition::operator=(const FieldPosition& copy)
270 {
271 fField = copy.fField;
272 fEndIndex = copy.fEndIndex;
273 fBeginIndex = copy.fBeginIndex;
274 return *this;
275 }
276
277 inline bool
278 FieldPosition::operator==(const FieldPosition& copy) const
279 {
280 return (fField == copy.fField &&
281 fEndIndex == copy.fEndIndex &&
282 fBeginIndex == copy.fBeginIndex);
283 }
284
285 inline bool
286 FieldPosition::operator!=(const FieldPosition& copy) const
287 {
288 return !operator==(copy);
289 }
290
291 U_NAMESPACE_END
292
293 #endif /* #if !UCONFIG_NO_FORMATTING */
294
295 #endif /* U_SHOW_CPLUSPLUS_API */
296
297 #endif // _FIELDPOS
298 //eof
icu::FieldPosition
FieldPosition is a simple class used by Format and its subclasses to identify fields in formatted out...
Definition: fieldpos.h:110
icu::FieldPosition::~FieldPosition
virtual ~FieldPosition()
Destructor.
icu::FieldPosition::getEndIndex
int32_t getEndIndex() const
Retrieve the index of the character following the last character in the requested field.
Definition: fieldpos.h:211
icu::FieldPosition::setEndIndex
void setEndIndex(int32_t ei)
Set the end index.
Definition: fieldpos.h:232
icu::FieldPosition::getStaticClassID
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
icu::FieldPosition::getField
int32_t getField() const
Retrieve the field identifier.
Definition: fieldpos.h:195
icu::FieldPosition::getBeginIndex
int32_t getBeginIndex() const
Retrieve the index of the first character in the requested field.
Definition: fieldpos.h:202
icu::FieldPosition::FieldPosition
FieldPosition(int32_t field)
Creates a FieldPosition object for the given field.
Definition: fieldpos.h:137
icu::FieldPosition::setField
void setField(int32_t f)
Set the field.
Definition: fieldpos.h:218
icu::FieldPosition::setBeginIndex
void setBeginIndex(int32_t bi)
Set the begin index.
Definition: fieldpos.h:225
icu::FieldPosition::FieldPosition
FieldPosition(const FieldPosition &copy)
Copy constructor.
Definition: fieldpos.h:145
icu::FieldPosition::FieldPosition
FieldPosition()
Creates a FieldPosition object with a non-specified field.
Definition: fieldpos.h:123
icu::FieldPosition::clone
FieldPosition * clone() const
Clone this object.
icu::FieldPosition::getDynamicClassID
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::operator!=
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:335
uobject.h
C++ API: Common ICU base class UObject.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301