+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
-********************************************************************************
-* Copyright (C) 1997-2003, International Business Machines
-* Corporation and others. All Rights Reserved.
-********************************************************************************
-*
-* File FIELDPOS.H
-*
-* Modification History:
-*
-* Date Name Description
-* 02/25/97 aliu Converted from java.
-* 03/17/97 clhuang Updated per Format implementation.
-* 07/17/98 stephen Added default/copy ctors, and operators =, ==, !=
-********************************************************************************
-*/
+ ********************************************************************************
+ * Copyright (C) 1997-2006, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ ********************************************************************************
+ *
+ * File FIELDPOS.H
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 02/25/97 aliu Converted from java.
+ * 03/17/97 clhuang Updated per Format implementation.
+ * 07/17/98 stephen Added default/copy ctors, and operators =, ==, !=
+ ********************************************************************************
+ */
+
// *****************************************************************************
// This file was generated from the java source file FieldPosition.java
// *****************************************************************************
#include "unicode/utypes.h"
+/**
+ * \file
+ * \brief C++ API: FieldPosition identifies the fields in a formatted output.
+ */
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/uobject.h"
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* to perform partial formatting or to get information about the
* formatted output (such as the position of a field).
*
+ * The FieldPosition class is not intended for public subclassing.
+ *
* <p>
* Below is an example of using <code>FieldPosition</code> to aid
* alignment of an array of formatted floating-point numbers on
* 1.234
* \endcode
* </pre>
-*/
+ */
class U_I18N_API FieldPosition : public UObject {
public:
/**
* DONT_CARE may be specified as the field to indicate that the
- * caller doesn't need to specify a field. Do not subclass.
+ * caller doesn't need to specify a field.
+ * @stable ICU 2.0
*/
enum { DONT_CARE = -1 };
* Destructor
* @stable ICU 2.0
*/
- ~FieldPosition() {}
+ virtual ~FieldPosition();
/**
* Assignment operator
*/
UBool operator!=(const FieldPosition& that) const;
+ /**
+ * Clone this object.
+ * Clones can be used concurrently in multiple threads.
+ * If an error occurs, then NULL is returned.
+ * The caller must delete the clone.
+ *
+ * @return a clone of this object
+ *
+ * @see getDynamicClassID
+ * @stable ICU 2.8
+ */
+ FieldPosition *clone() const;
+
/**
* Retrieve the field identifier.
* @return the field identifier.
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.2
+ * @stable ICU 2.2
*/
- virtual inline UClassID getDynamicClassID() const;
+ virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.2
+ * @stable ICU 2.2
*/
- static inline UClassID getStaticClassID();
+ static UClassID U_EXPORT2 getStaticClassID();
private:
/**
* If the field does not occur in the text, 0 is returned.
*/
int32_t fEndIndex;
-
- /**
- * The address of this static class variable serves as this class's ID
- * for ICU "poor man's RTTI".
- */
- static const char fgClassID;
};
-inline UClassID FieldPosition::getStaticClassID()
-{ return (UClassID)&fgClassID; }
-
-inline UClassID FieldPosition::getDynamicClassID() const
-{ return FieldPosition::getStaticClassID(); }
-
inline FieldPosition&
FieldPosition::operator=(const FieldPosition& copy)
{
inline UBool
FieldPosition::operator==(const FieldPosition& copy) const
{
- if( fField != copy.fField ||
- fEndIndex != copy.fEndIndex ||
- fBeginIndex != copy.fBeginIndex)
- return FALSE;
- else
- return TRUE;
+ return (fField == copy.fField &&
+ fEndIndex == copy.fEndIndex &&
+ fBeginIndex == copy.fBeginIndex);
}
inline UBool
}
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
#endif /* #if !UCONFIG_NO_FORMATTING */