]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/unicode/coll.h
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / coll.h
index 357af13d9b8f0d9aed71b321edd3294b70141e0b..93dbb722572196ad369292f76ddd4bca17b64da4 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ******************************************************************************
-*   Copyright (C) 1996-2010, International Business Machines                 *
+*   Copyright (C) 1996-2012, International Business Machines                 *
 *   Corporation and others.  All Rights Reserved.                            *
 ******************************************************************************
 */
@@ -598,29 +598,65 @@ public:
     virtual void setStrength(ECollationStrength newStrength) = 0;
 
     /**
-     * Get the current reordering of scripts (if one has been set).
+     * Retrieves the reordering codes for this collator.
      * @param dest The array to fill with the script ordering.
-     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string (pre-flighting).
-     * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
-     * @return The length of the array of the script ordering.
-     * @see ucol_getReorderCodes
-     * @internal 
+     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
+     *  will only return the length of the result without writing any of the result string (pre-flighting).
+     * @param status A reference to an error code value, which must not indicate
+     * a failure before the function call.
+     * @return The length of the script ordering array.
+     * @see ucol_setReorderCodes
+     * @see Collator#getEquivalentReorderCodes
+     * @see Collator#setReorderCodes
+     * @see UScriptCode
+     * @see UColReorderCode
+     * @stable ICU 4.8 
      */
-    virtual int32_t getReorderCodes(int32_t *dest,
+     virtual int32_t U_EXPORT2 getReorderCodes(int32_t *dest,
                                     int32_t destCapacity,
                                     UErrorCode& status) const;
 
     /**
-     * Set the ordering of scripts for this collator.
-     * @param reorderCodes An array of reorder codes in the new order.
+     * Sets the ordering of scripts for this collator.
+     *
+     * <p>The reordering codes are a combination of script codes and reorder codes.
+     * @param reorderCodes An array of script codes in the new order. This can be NULL if the 
+     * length is also set to 0. An empty array will clear any reordering codes on the collator.
      * @param reorderCodesLength The length of reorderCodes.
-     * @see ucol_setReorderCodes
-     * @internal 
+     * @param status error code
+     * @see Collator#getReorderCodes
+     * @see Collator#getEquivalentReorderCodes
+     * @see UScriptCode
+     * @see UColReorderCode
+     * @stable ICU 4.8 
      */
-    virtual void setReorderCodes(const int32_t* reorderCodes,
+     virtual void U_EXPORT2 setReorderCodes(const int32_t* reorderCodes,
                                 int32_t reorderCodesLength,
                                 UErrorCode& status) ;
 
+    /**
+     * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder
+     * codes will be grouped and must reorder together.
+     * @param reorderCode The reorder code to determine equivalence for. 
+     * @param dest The array to fill with the script equivalene reordering codes.
+     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the 
+     * function will only return the length of the result without writing any of the result 
+     * string (pre-flighting).
+     * @param status A reference to an error code value, which must not indicate 
+     * a failure before the function call.
+     * @return The length of the of the reordering code equivalence array.
+     * @see ucol_setReorderCodes
+     * @see Collator#getReorderCodes
+     * @see Collator#setReorderCodes
+     * @see UScriptCode
+     * @see UColReorderCode
+     * @stable ICU 4.8 
+     */
+    static int32_t U_EXPORT2 getEquivalentReorderCodes(int32_t reorderCode,
+                                int32_t* dest,
+                                int32_t destCapacity,
+                                UErrorCode& status);
+
     /**
      * Get name of the object for the desired Locale, in the desired langauge
      * @param objectLocale must be from getAvailableLocales
@@ -967,6 +1003,7 @@ protected:
     */
     Collator();
 
+#ifndef U_HIDE_DEPRECATED_API
     /**
     * Constructor.
     * Empty constructor, does not handle the arguments.
@@ -980,6 +1017,7 @@ protected:
     */
     Collator(UCollationStrength collationStrength,
              UNormalizationMode decompositionMode);
+#endif  /* U_HIDE_DEPRECATED_API */
 
     /**
     * Copy constructor.
@@ -1002,12 +1040,42 @@ protected:
 
 public:
 #if !UCONFIG_NO_SERVICE
+#ifndef U_HIDE_INTERNAL_API
     /**
      * used only by ucol_open, not for public use
      * @internal
      */
     static UCollator* createUCollator(const char* loc, UErrorCode* status);
+#endif  /* U_HIDE_INTERNAL_API */
 #endif
+
+    /** Get the short definition string for a collator. This internal API harvests the collator's
+     *  locale and the attribute set and produces a string that can be used for opening 
+     *  a collator with the same properties using the ucol_openFromShortString API.
+     *  This string will be normalized.
+     *  The structure and the syntax of the string is defined in the "Naming collators"
+     *  section of the users guide: 
+     *  http://icu-project.org/userguide/Collate_Concepts.html#Naming_Collators
+     *  This function supports preflighting.
+     * 
+     *  This is internal, and intended to be used with delegate converters.
+     *
+     *  @param locale a locale that will appear as a collators locale in the resulting
+     *                short string definition. If NULL, the locale will be harvested 
+     *                from the collator.
+     *  @param buffer space to hold the resulting string
+     *  @param capacity capacity of the buffer
+     *  @param status for returning errors. All the preflighting errors are featured
+     *  @return length of the resulting string
+     *  @see ucol_openFromShortString
+     *  @see ucol_normalizeShortDefinitionString
+     *  @see ucol_getShortDefinitionString
+     *  @internal
+     */
+    virtual int32_t internalGetShortDefinitionString(const char *locale,
+                                                     char *buffer,
+                                                     int32_t capacity,
+                                                     UErrorCode &status) const;
 private:
     /**
      * Assignment operator. Private for now.