]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/unicode/parsepos.h
ICU-57165.0.1.tar.gz
[apple/icu.git] / icuSources / common / unicode / parsepos.h
index e741abab9bc3429398b1583c6b9af6c5cac4e908..cdf49e04ec27c2666e7d413d0adebee4d53dc7cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-* Copyright (C) {1997-2003}, International Business Machines Corporation and others. All Rights Reserved.
+* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
 *******************************************************************************
 *
 * File PARSEPOS.H
 #include "unicode/utypes.h"
 #include "unicode/uobject.h"
 
 U_NAMESPACE_BEGIN
 
 /**
+ * \file
+ * \brief C++ API: Canonical Iterator
+ */
+/** 
  * <code>ParsePosition</code> is a simple class used by <code>Format</code>
  * and its subclasses to keep track of the current position during parsing.
  * The <code>parseObject</code> method in the various <code>Format</code>
@@ -46,8 +51,10 @@ public:
      * @stable ICU 2.0
      */
     ParsePosition()
-        : UObject()
-      { this->index = 0; this->errorIndex = -1; }
+        : UObject(),
+        index(0),
+        errorIndex(-1)
+      {}
 
     /**
      * Create a new ParsePosition with the given initial index.
@@ -55,8 +62,10 @@ public:
      * @stable ICU 2.0
      */
     ParsePosition(int32_t newIndex)
-        : UObject()
-      {    this->index = newIndex; this->errorIndex = -1; }
+        : UObject(),
+        index(newIndex),
+        errorIndex(-1)
+      {}
 
     /**
      * Copy constructor
@@ -64,14 +73,16 @@ public:
      * @stable ICU 2.0
      */
     ParsePosition(const ParsePosition& copy)
-        : UObject(copy)
-      {    this->index = copy.index; this->errorIndex = copy.errorIndex; }
+        : UObject(copy),
+        index(copy.index),
+        errorIndex(copy.errorIndex)
+      {}
 
     /**
      * Destructor
      * @stable ICU 2.0
      */
-    ~ParsePosition() {}
+    virtual ~ParsePosition();
 
     /**
      * Assignment operator
@@ -93,6 +104,19 @@ public:
      */
     UBool              operator!=(const ParsePosition& 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
+     */
+    ParsePosition *clone() const;
+
     /**
      * Retrieve the current parse position.  On input to a parse method, this
      * is the index of the character at which parsing will begin; on output, it
@@ -126,18 +150,18 @@ public:
     int32_t getErrorIndex(void) const;
 
     /**
-     * ICU "poor man's RTTI", returns a UClassID for the actual class.
+     * ICU "poor man's RTTI", returns a UClassID for this class.
      *
-     * @draft ICU 2.2
+     * @stable ICU 2.2
      */
-    virtual inline UClassID getDynamicClassID() const;
+    static UClassID U_EXPORT2 getStaticClassID();
 
     /**
-     * ICU "poor man's RTTI", returns a UClassID for this class.
+     * ICU "poor man's RTTI", returns a UClassID for the actual class.
      *
-     * @draft ICU 2.2
+     * @stable ICU 2.2
      */
-    static inline UClassID getStaticClassID();
+    virtual UClassID getDynamicClassID() const;
 
 private:
     /**
@@ -153,21 +177,8 @@ private:
      */
     int32_t errorIndex;
 
-    /**
-     * 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
-ParsePosition::getStaticClassID()
-{ return (UClassID)&fgClassID; }
-
-inline UClassID
-ParsePosition::getDynamicClassID() const
-{ return ParsePosition::getStaticClassID(); }
-
 inline ParsePosition&
 ParsePosition::operator=(const ParsePosition& copy)
 {