You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/06 18:28:19 UTC

[37/46] support static build

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/dtitvinf.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/dtitvinf.h b/platform/osx/icu/unicode/dtitvinf.h
new file mode 100644
index 0000000..07a8dbd
--- /dev/null
+++ b/platform/osx/icu/unicode/dtitvinf.h
@@ -0,0 +1,528 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 2008, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ *******************************************************************************
+ *
+ * File DTITVINF.H
+ *
+ *******************************************************************************
+ */
+
+#ifndef __DTITVINF_H__
+#define __DTITVINF_H__
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Date/Time interval patterns for formatting date/time interval
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/udat.h"
+#include "unicode/locid.h"
+#include "unicode/ucal.h"
+#include "unicode/dtptngen.h"
+//#include "dtitv_impl.h"
+
+/**
+ * @internal ICU 4.0
+ */
+ 
+union UHashTok;
+
+
+U_NAMESPACE_BEGIN
+
+U_CDECL_BEGIN 
+
+/**
+ * @internal ICU 4.0
+ */
+static UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2) ;
+
+U_CDECL_END 
+
+
+/**
+ * DateIntervalInfo is a public class for encapsulating localizable
+ * date time interval patterns. It is used by DateIntervalFormat.
+ *
+ * <P>
+ * For most users, ordinary use of DateIntervalFormat does not need to create
+ * DateIntervalInfo object directly.
+ * DateIntervalFormat will take care of it when creating a date interval
+ * formatter when user pass in skeleton and locale.
+ *
+ * <P>
+ * For power users, who want to create their own date interval patterns,
+ * or want to re-set date interval patterns, they could do so by
+ * directly creating DateIntervalInfo and manupulating it.
+ *
+ * <P>
+ * Logically, the interval patterns are mappings
+ * from (skeleton, the_largest_different_calendar_field)
+ * to (date_interval_pattern).
+ *
+ * <P>
+ * A skeleton 
+ * <ol>
+ * <li>
+ * only keeps the field pattern letter and ignores all other parts 
+ * in a pattern, such as space, punctuations, and string literals.
+ * <li>
+ * hides the order of fields. 
+ * <li>
+ * might hide a field's pattern letter length.
+ *
+ * For those non-digit calendar fields, the pattern letter length is 
+ * important, such as MMM, MMMM, and MMMMM; EEE and EEEE, 
+ * and the field's pattern letter length is honored.
+ *    
+ * For the digit calendar fields,  such as M or MM, d or dd, yy or yyyy, 
+ * the field pattern length is ignored and the best match, which is defined 
+ * in date time patterns, will be returned without honor the field pattern
+ * letter length in skeleton.
+ * </ol>
+ *
+ * <P>
+ * The calendar fields we support for interval formatting are:
+ * year, month, date, day-of-week, am-pm, hour, hour-of-day, and minute.
+ * Those calendar fields can be defined in the following order:
+ * year >  month > date > am-pm > hour >  minute 
+ *  
+ * The largest different calendar fields between 2 calendars is the
+ * first different calendar field in above order.
+ *
+ * For example: the largest different calendar fields between "Jan 10, 2007" 
+ * and "Feb 20, 2008" is year.
+ *   
+ * <P>
+ * There is a set of pre-defined static skeleton strings.
+ * There are pre-defined interval patterns for those pre-defined skeletons
+ * in locales' resource files.
+ * For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is  "yMMMd",
+ * in  en_US, if the largest different calendar field between date1 and date2 
+ * is "year", the date interval pattern  is "MMM d, yyyy - MMM d, yyyy", 
+ * such as "Jan 10, 2007 - Jan 10, 2008".
+ * If the largest different calendar field between date1 and date2 is "month",
+ * the date interval pattern is "MMM d - MMM d, yyyy",
+ * such as "Jan 10 - Feb 10, 2007".
+ * If the largest different calendar field between date1 and date2 is "day",
+ * the date interval pattern is ""MMM d-d, yyyy", such as "Jan 10-20, 2007".
+ *
+ * For date skeleton, the interval patterns when year, or month, or date is 
+ * different are defined in resource files.
+ * For time skeleton, the interval patterns when am/pm, or hour, or minute is
+ * different are defined in resource files.
+ *
+ *
+ * <P>
+ * There are 2 dates in interval pattern. For most locales, the first date
+ * in an interval pattern is the earlier date. There might be a locale in which
+ * the first date in an interval pattern is the later date.
+ * We use fallback format for the default order for the locale.
+ * For example, if the fallback format is "{0} - {1}", it means
+ * the first date in the interval pattern for this locale is earlier date.
+ * If the fallback format is "{1} - {0}", it means the first date is the 
+ * later date.
+ * For a particular interval pattern, the default order can be overriden
+ * by prefixing "latestFirst:" or "earliestFirst:" to the interval pattern.
+ * For example, if the fallback format is "{0}-{1}",
+ * but for skeleton "yMMMd", the interval pattern when day is different is 
+ * "latestFirst:d-d MMM yy", it means by default, the first date in interval
+ * pattern is the earlier date. But for skeleton "yMMMd", when day is different,
+ * the first date in "d-d MMM yy" is the later date.
+ * 
+ * <P>
+ * The recommended way to create a DateIntervalFormat object is to pass in 
+ * the locale. 
+ * By using a Locale parameter, the DateIntervalFormat object is 
+ * initialized with the pre-defined interval patterns for a given or 
+ * default locale.
+ * <P>
+ * Users can also create DateIntervalFormat object 
+ * by supplying their own interval patterns.
+ * It provides flexibility for power users.
+ *
+ * <P>
+ * After a DateIntervalInfo object is created, clients may modify
+ * the interval patterns using setIntervalPattern function as so desired.
+ * Currently, users can only set interval patterns when the following 
+ * calendar fields are different: ERA, YEAR, MONTH, DATE,  DAY_OF_MONTH, 
+ * DAY_OF_WEEK, AM_PM,  HOUR, HOUR_OF_DAY, and MINUTE.
+ * Interval patterns when other calendar fields are different is not supported.
+ * <P>
+ * DateIntervalInfo objects are cloneable. 
+ * When clients obtain a DateIntervalInfo object, 
+ * they can feel free to modify it as necessary.
+ * <P>
+ * DateIntervalInfo are not expected to be subclassed. 
+ * Data for a calendar is loaded out of resource bundles. 
+ * To ICU 4.0, date interval patterns are only supported in Gregorian calendar. 
+ * @draft ICU 4.0
+**/
+
+class U_I18N_API DateIntervalInfo : public UObject {
+public:
+    /**
+     * Default constructor.
+     * It does not initialize any interval patterns except
+     * that it initialize default fall-back pattern as "{0} - {1}",
+     * which can be reset by setFallbackIntervalPattern().
+     * It should be followed by setFallbackIntervalPattern() and 
+     * setIntervalPattern(), 
+     * and is recommended to be used only for power users who
+     * wants to create their own interval patterns and use them to create
+     * date interval formatter.
+     * @param status   output param set to success/failure code on exit
+     * @internal ICU 4.0
+     */
+    DateIntervalInfo(UErrorCode& status);
+
+
+    /** 
+     * Construct DateIntervalInfo for the given locale,
+     * @param locale  the interval patterns are loaded from the Gregorian 
+     *                calendar data in this locale.
+     * @param status  output param set to success/failure code on exit
+     * @draft ICU 4.0
+     */
+    DateIntervalInfo(const Locale& locale, UErrorCode& status);
+
+
+    /**
+     * Copy constructor.
+     * @draft ICU 4.0
+     */
+    DateIntervalInfo(const DateIntervalInfo&);
+
+    /**
+     * Assignment operator
+     * @draft ICU 4.0
+     */
+    DateIntervalInfo& operator=(const DateIntervalInfo&);
+
+    /**
+     * Clone this object polymorphically.
+     * The caller owns the result and should delete it when done.
+     * @return   a copy of the object
+     * @draft    ICU4.0
+     */
+    virtual DateIntervalInfo* clone(void) const;
+
+    /**
+     * Destructor.
+     * It is virtual to be safe, but it is not designed to be subclassed.
+     * @draft ICU 4.0
+     */
+    virtual ~DateIntervalInfo();
+
+
+    /**
+     * Return true if another object is semantically equal to this one.
+     *
+     * @param other    the DateIntervalInfo object to be compared with.
+     * @return         true if other is semantically equal to this.
+     * @stable ICU 4.0
+     */
+    virtual UBool operator==(const DateIntervalInfo& other) const;
+
+    /**
+     * Return true if another object is semantically unequal to this one.
+     *
+     * @param other    the DateIntervalInfo object to be compared with.
+     * @return         true if other is semantically unequal to this.
+     * @stable ICU 4.0
+     */
+    UBool operator!=(const DateIntervalInfo& other) const;
+
+
+
+    /** 
+     * Provides a way for client to build interval patterns.
+     * User could construct DateIntervalInfo by providing a list of skeletons
+     * and their patterns.
+     * <P>
+     * For example:
+     * <pre>
+     * UErrorCode status = U_ZERO_ERROR;
+     * DateIntervalInfo dIntervalInfo = new DateIntervalInfo();
+     * dIntervalInfo->setFallbackIntervalPattern("{0} ~ {1}");
+     * dIntervalInfo->setIntervalPattern("yMd", UCAL_YEAR, "'from' yyyy-M-d 'to' yyyy-M-d", status); 
+     * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_MONTH, "'from' yyyy MMM d 'to' MMM d", status);
+     * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_DAY, "yyyy MMM d-d", status, status);
+     * </pre>
+     *
+     * Restriction: 
+     * Currently, users can only set interval patterns when the following 
+     * calendar fields are different: ERA, YEAR, MONTH, DATE,  DAY_OF_MONTH, 
+     * DAY_OF_WEEK, AM_PM,  HOUR, HOUR_OF_DAY, and MINUTE.
+     * Interval patterns when other calendar fields are different are 
+     * not supported.
+     *
+     * @param skeleton         the skeleton on which interval pattern based
+     * @param lrgDiffCalUnit   the largest different calendar unit.
+     * @param intervalPattern  the interval pattern on the largest different
+     *                         calendar unit.
+     *                         For example, if lrgDiffCalUnit is 
+     *                         "year", the interval pattern for en_US when year
+     *                         is different could be "'from' yyyy 'to' yyyy".
+     * @param status           output param set to success/failure code on exit
+     * @draft ICU 4.0
+     */
+    void setIntervalPattern(const UnicodeString& skeleton, 
+                            UCalendarDateFields lrgDiffCalUnit, 
+                            const UnicodeString& intervalPattern,
+                            UErrorCode& status);
+
+    /**
+     * Get the interval pattern given skeleton and 
+     * the largest different calendar field.
+     * @param skeleton   the skeleton
+     * @param field      the largest different calendar field
+     * @param result     output param to receive the pattern
+     * @param status     output param set to success/failure code on exit
+     * @return a reference to 'result'
+     * @draft ICU 4.0 
+     */
+    UnicodeString& getIntervalPattern(const UnicodeString& skeleton,
+                                      UCalendarDateFields field,
+                                      UnicodeString& result,
+                                      UErrorCode& status) const; 
+
+    /**
+     * Get the fallback interval pattern.
+     * @param  result   output param to receive the pattern
+     * @return a reference to 'result'
+     * @draft ICU 4.0 
+     */
+    UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const;
+
+
+    /**
+     * Re-set the fallback interval pattern.
+     *
+     * In construction, default fallback pattern is set as "{0} - {1}".
+     * And constructor taking locale as parameter will set the
+     * fallback pattern as what defined in the locale resource file.
+     *
+     * This method provides a way for user to replace the fallback pattern.
+     *
+     * @param fallbackPattern  fall-back interval pattern.
+     * @param status           output param set to success/failure code on exit
+     * @draft ICU 4.0 
+     */
+    void setFallbackIntervalPattern(const UnicodeString& fallbackPattern,
+                                    UErrorCode& status);
+
+
+    /** Get default order -- whether the first date in pattern is later date
+                             or not.
+     * return default date ordering in interval pattern. TRUE if the first date
+     *        in pattern is later date, FALSE otherwise.
+     * @draft ICU 4.0 
+     */
+    UBool getDefaultOrder() const;
+
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for the actual class.
+     *
+     * @stable ICU 4.0
+     */
+    virtual UClassID getDynamicClassID() const;
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for this class.
+     *
+     * @stable ICU 4.0
+     */
+    static UClassID U_EXPORT2 getStaticClassID();
+
+
+private:
+    /**
+     * DateIntervalFormat will need access to
+     * getBestSkeleton(), parseSkeleton(), enum IntervalPatternIndex,
+     * and calendarFieldToPatternIndex().
+     *
+     * Instead of making above public,
+     * make DateIntervalFormat a friend of DateIntervalInfo.
+     */
+    friend class DateIntervalFormat;
+
+    friend UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2) ;
+
+    /**
+     * Following is for saving the interval patterns.
+     * We only support interval patterns on
+     * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, and MINUTE
+     */
+    enum IntervalPatternIndex
+    {
+        kIPI_ERA,
+        kIPI_YEAR,
+        kIPI_MONTH,
+        kIPI_DATE,
+        kIPI_AM_PM,
+        kIPI_HOUR,
+        kIPI_MINUTE,
+        kIPI_MAX_INDEX
+    };
+
+    /** 
+     * Initialize the DateIntervalInfo from locale
+     * @param locale   the given locale.
+     * @param status   output param set to success/failure code on exit
+     * @internal ICU 4.0 
+     */
+    void initializeData(const Locale& locale, UErrorCode& status);
+
+
+    /* Set Interval pattern.
+     *
+     * It sets interval pattern into the hash map.
+     *
+     * @param skeleton         skeleton on which the interval pattern based
+     * @param lrgDiffCalUnit   the largest different calendar unit.
+     * @param intervalPattern  the interval pattern on the largest different
+     *                         calendar unit.
+     * @param status           output param set to success/failure code on exit
+     * @internal ICU 4.0
+     */
+    void setIntervalPatternInternally(const UnicodeString& skeleton,
+                                      UCalendarDateFields lrgDiffCalUnit,
+                                      const UnicodeString& intervalPattern,
+                                      UErrorCode& status); 
+
+
+    /**given an input skeleton, get the best match skeleton 
+     * which has pre-defined interval pattern in resource file.
+     * Also return the difference between the input skeleton
+     * and the best match skeleton.
+     *
+     * TODO (xji): set field weight or
+     *             isolate the funtionality in DateTimePatternGenerator
+     * @param  skeleton               input skeleton
+     * @param  bestMatchDistanceInfo  the difference between input skeleton
+     *                                and best match skeleton.
+     *         0, if there is exact match for input skeleton
+     *         1, if there is only field width difference between 
+     *            the best match and the input skeleton
+     *         2, the only field difference is 'v' and 'z'
+     *        -1, if there is calendar field difference between
+     *            the best match and the input skeleton
+     * @return                        best match skeleton
+     * @internal ICU 4.0
+     */
+    const UnicodeString* getBestSkeleton(const UnicodeString& skeleton,
+                                         int8_t& bestMatchDistanceInfo) const;
+
+
+    /**
+     * Parse skeleton, save each field's width.
+     * It is used for looking for best match skeleton,
+     * and adjust pattern field width.
+     * @param skeleton            skeleton to be parsed
+     * @param skeletonFieldWidth  parsed skeleton field width
+     * @internal ICU 4.0
+     */
+    static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton, 
+                                        int32_t* skeletonFieldWidth);
+
+
+    /**
+     * Check whether one field width is numeric while the other is string.
+     *
+     * TODO (xji): make it general
+     *
+     * @param fieldWidth          one field width
+     * @param anotherFieldWidth   another field width
+     * @param patternLetter       pattern letter char
+     * @return true if one field width is numeric and the other is string,
+     *         false otherwise.
+     * @internal ICU 4.0
+     */
+    static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth,
+                                         int32_t anotherFieldWidth,
+                                         char patternLetter);
+
+
+    /** 
+     * Convert calendar field to the interval pattern index in 
+     * hash table.
+     *
+     * Since we only support the following calendar fields: 
+     * ERA, YEAR, MONTH, DATE,  DAY_OF_MONTH, DAY_OF_WEEK, 
+     * AM_PM,  HOUR, HOUR_OF_DAY, and MINUTE,
+     * We reserve only 4 interval patterns for a skeleton.
+     *
+     * @param field    calendar field
+     * @param status   output param set to success/failure code on exit
+     * @return  interval pattern index in hash table
+     * @internal ICU 4.0
+     */
+    static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex(
+                                                      UCalendarDateFields field,
+                                                      UErrorCode& status);
+
+
+    /**
+     * delete hash table (of type fIntervalPatterns).
+     *
+     * @param hTable  hash table to be deleted
+     * @internal ICU 4.0
+     */
+    void deleteHash(Hashtable* hTable);
+
+
+    /**
+     * initialize hash table (of type fIntervalPatterns).
+     *
+     * @param status   output param set to success/failure code on exit
+     * @return         hash table initialized
+     * @internal ICU 4.0
+     */
+    Hashtable* initHash(UErrorCode& status);
+
+
+
+    /**
+     * copy hash table (of type fIntervalPatterns).
+     *
+     * @param source   the source to copy from
+     * @param target   the target to copy to
+     * @param status   output param set to success/failure code on exit
+     * @internal ICU 4.0
+     */
+    void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
+
+
+    // data members
+    // fallback interval pattern 
+    UnicodeString fFallbackIntervalPattern;
+    // default order
+    UBool fFirstDateInPtnIsLaterDate;
+
+    // HashMap<UnicodeString, UnicodeString[kIPI_MAX_INDEX]>
+    // HashMap( skeleton, pattern[largest_different_field] )
+    Hashtable* fIntervalPatterns;
+
+};// end class DateIntervalInfo
+
+
+inline UBool
+DateIntervalInfo::operator!=(const DateIntervalInfo& other) const {
+    return !operator==(other);
+}
+
+
+U_NAMESPACE_END
+
+#endif
+
+#endif
+

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/dtptngen.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/dtptngen.h b/platform/osx/icu/unicode/dtptngen.h
new file mode 100644
index 0000000..eeea626
--- /dev/null
+++ b/platform/osx/icu/unicode/dtptngen.h
@@ -0,0 +1,423 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007-2009, International Business Machines Corporation and
+* others. All Rights Reserved.
+*******************************************************************************
+*
+* File DTPTNGEN.H
+*
+*******************************************************************************
+*/
+
+#ifndef __DTPTNGEN_H__
+#define __DTPTNGEN_H__
+
+#include "unicode/datefmt.h"
+#include "unicode/locid.h"
+#include "unicode/udat.h"
+#include "unicode/udatpg.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \file
+ * \brief C++ API: Date/Time Pattern Generator
+ */
+
+
+class Hashtable;
+class FormatParser;
+class DateTimeMatcher;
+class DistanceInfo;
+class PatternMap;
+class PtnSkeleton;
+
+/**
+ * This class provides flexible generation of date format patterns, like "yy-MM-dd". 
+ * The user can build up the generator by adding successive patterns. Once that 
+ * is done, a query can be made using a "skeleton", which is a pattern which just
+ * includes the desired fields and lengths. The generator will return the "best fit" 
+ * pattern corresponding to that skeleton.
+ * <p>The main method people will use is getBestPattern(String skeleton),
+ * since normally this class is pre-built with data from a particular locale. 
+ * However, generators can be built directly from other data as well.
+ * <p><i>Issue: may be useful to also have a function that returns the list of 
+ * fields in a pattern, in order, since we have that internally.
+ * That would be useful for getting the UI order of field elements.</i>
+ * @stable ICU 3.8
+**/
+class U_I18N_API DateTimePatternGenerator : public UObject {
+public:
+    /**
+     * Construct a flexible generator according to default locale.
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @stable ICU 3.8
+     */
+    static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status);
+
+    /**
+     * Construct a flexible generator according to data for a given locale.
+     * @param uLocale
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @stable ICU 3.8
+     */
+    static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status);
+
+    /**
+     * Create an empty generator, to be constructed with addPattern(...) etc.
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @stable ICU 3.8
+     */
+     static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
+     
+    /**
+     * Destructor.
+     * @stable ICU 3.8
+     */
+    virtual ~DateTimePatternGenerator();
+
+    /**
+     * Clone DateTimePatternGenerator object. Clients are responsible for 
+     * deleting the DateTimePatternGenerator object cloned.
+     * @stable ICU 3.8
+     */
+    DateTimePatternGenerator* clone() const;
+
+     /**
+      * Return true if another object is semantically equal to this one.
+      *
+      * @param other    the DateTimePatternGenerator object to be compared with.
+      * @return         true if other is semantically equal to this.
+      * @stable ICU 3.8
+      */
+    UBool operator==(const DateTimePatternGenerator& other) const;
+    
+    /**
+     * Return true if another object is semantically unequal to this one.
+     *
+     * @param other    the DateTimePatternGenerator object to be compared with.
+     * @return         true if other is semantically unequal to this.
+     * @stable ICU 3.8
+     */
+    UBool operator!=(const DateTimePatternGenerator& other) const;
+
+    /**
+     * Utility to return a unique skeleton from a given pattern. For example,
+     * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
+     *
+     * @param pattern   Input pattern, such as "dd/MMM"
+     * @param status  Output param set to success/failure code on exit,
+     *                  which must not indicate a failure before the function call.
+     * @return skeleton such as "MMMdd"
+     * @stable ICU 3.8
+     */
+    UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status);
+
+    /**
+     * Utility to return a unique base skeleton from a given pattern. This is
+     * the same as the skeleton, except that differences in length are minimized
+     * so as to only preserve the difference between string and numeric form. So
+     * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
+     * (notice the single d).
+     *
+     * @param pattern  Input pattern, such as "dd/MMM"
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return base skeleton, such as "Md"
+     * @stable ICU 3.8
+     */
+    UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status);
+
+    /**
+     * Adds a pattern to the generator. If the pattern has the same skeleton as
+     * an existing pattern, and the override parameter is set, then the previous
+     * value is overriden. Otherwise, the previous value is retained. In either
+     * case, the conflicting status is set and previous vale is stored in 
+     * conflicting pattern.
+     * <p>
+     * Note that single-field patterns (like "MMM") are automatically added, and
+     * don't need to be added explicitly!
+     *
+     * @param pattern   Input pattern, such as "dd/MMM"
+     * @param override  When existing values are to be overridden use true, 
+     *                   otherwise use false.
+     * @param conflictingPattern  Previous pattern with the same skeleton.
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return conflicting status.  The value could be UDATPG_NO_CONFLICT, 
+     *                             UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
+     * @stable ICU 3.8
+     */
+    UDateTimePatternConflict addPattern(const UnicodeString& pattern, 
+                                        UBool override, 
+                                        UnicodeString& conflictingPattern,
+                                        UErrorCode& status);
+
+    /**
+     * An AppendItem format is a pattern used to append a field if there is no
+     * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
+     * and there is no matching pattern internally, but there is a pattern
+     * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
+     * G. The way these two are conjoined is by using the AppendItemFormat for G
+     * (era). So if that value is, say "{0}, {1}" then the final resulting
+     * pattern is "d-MM-yyyy, G".
+     * <p>
+     * There are actually three available variables: {0} is the pattern so far,
+     * {1} is the element we are adding, and {2} is the name of the element.
+     * <p>
+     * This reflects the way that the CLDR data is organized.
+     *
+     * @param field  such as UDATPG_ERA_FIELD.
+     * @param value  pattern, such as "{0}, {1}"
+     * @stable ICU 3.8
+     */
+    void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value);
+
+    /**
+     * Getter corresponding to setAppendItemFormat. Values below 0 or at or
+     * above UDATPG_FIELD_COUNT are illegal arguments.
+     *
+     * @param  field  such as UDATPG_ERA_FIELD.
+     * @return append pattern for field
+     * @stable ICU 3.8
+     */
+    const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const;
+
+    /**
+     * Sets the names of field, eg "era" in English for ERA. These are only
+     * used if the corresponding AppendItemFormat is used, and if it contains a
+     * {2} variable.
+     * <p>
+     * This reflects the way that the CLDR data is organized.
+     *
+     * @param field   such as UDATPG_ERA_FIELD.
+     * @param value   name of the field
+     * @stable ICU 3.8
+     */
+    void setAppendItemName(UDateTimePatternField field, const UnicodeString& value);
+
+    /**
+     * Getter corresponding to setAppendItemNames. Values below 0 or at or above
+     * UDATPG_FIELD_COUNT are illegal arguments.
+     *
+     * @param field  such as UDATPG_ERA_FIELD.
+     * @return name for field
+     * @stable ICU 3.8
+     */
+    const UnicodeString& getAppendItemName(UDateTimePatternField field) const;
+
+    /**
+     * The date time format is a message format pattern used to compose date and
+     * time patterns. The default value is "{0} {1}", where {0} will be replaced
+     * by the date pattern and {1} will be replaced by the time pattern.
+     * <p>
+     * This is used when the input skeleton contains both date and time fields,
+     * but there is not a close match among the added patterns. For example,
+     * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
+     * its datetimeFormat is the default "{0} {1}". Then if the input skeleton
+     * is "MMMdhmm", there is not an exact match, so the input skeleton is
+     * broken up into two components "MMMd" and "hmm". There are close matches
+     * for those two skeletons, so the result is put together with this pattern,
+     * resulting in "d-MMM h:mm".
+     *
+     * @param dateTimeFormat
+     *            message format pattern, here {0} will be replaced by the date
+     *            pattern and {1} will be replaced by the time pattern.
+     * @stable ICU 3.8
+     */
+    void setDateTimeFormat(const UnicodeString& dateTimeFormat);
+
+    /**
+     * Getter corresponding to setDateTimeFormat.
+     * @return DateTimeFormat.
+     * @stable ICU 3.8
+     */
+    const UnicodeString& getDateTimeFormat() const;
+
+    /**
+     * Return the best pattern matching the input skeleton. It is guaranteed to
+     * have all of the fields in the skeleton.
+     *
+     * @param skeleton
+     *            The skeleton is a pattern containing only the variable fields.
+     *            For example, "MMMdd" and "mmhh" are skeletons.
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return bestPattern
+     *            The best pattern found from the given skeleton.
+     * @stable ICU 3.8
+     */
+     UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
+
+
+    /**
+     * Adjusts the field types (width and subtype) of a pattern to match what is
+     * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
+     * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
+     * "dd-MMMM hh:mm". This is used internally to get the best match for the
+     * input skeleton, but can also be used externally.
+     *
+     * @param pattern Input pattern
+     * @param skeleton
+     *            The skeleton is a pattern containing only the variable fields.
+     *            For example, "MMMdd" and "mmhh" are skeletons.
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return pattern adjusted to match the skeleton fields widths and subtypes.
+     * @stable ICU 3.8
+     */
+     UnicodeString replaceFieldTypes(const UnicodeString& pattern, 
+                                     const UnicodeString& skeleton, 
+                                     UErrorCode& status);
+
+    /**
+     * Return a list of all the skeletons (in canonical form) from this class.
+     *
+     * Call getPatternForSkeleton() to get the corresponding pattern.
+     *
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return StringEnumeration with the skeletons.
+     *         The caller must delete the object.
+     * @stable ICU 3.8
+     */
+     StringEnumeration* getSkeletons(UErrorCode& status) const;
+
+     /**
+      * Get the pattern corresponding to a given skeleton.
+      * @param skeleton 
+      * @return pattern corresponding to a given skeleton.
+      * @stable ICU 3.8
+      */
+     const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const;
+     
+    /**
+     * Return a list of all the base skeletons (in canonical form) from this class.
+     *
+     * @param status  Output param set to success/failure code on exit,
+     *               which must not indicate a failure before the function call.
+     * @return a StringEnumeration with the base skeletons.
+     *         The caller must delete the object.
+     * @stable ICU 3.8
+     */
+     StringEnumeration* getBaseSkeletons(UErrorCode& status) const;
+     
+     /**
+      * Return a list of redundant patterns are those which if removed, make no 
+      * difference in the resulting getBestPattern values. This method returns a 
+      * list of them, to help check the consistency of the patterns used to build 
+      * this generator.
+      * 
+      * @param status  Output param set to success/failure code on exit,
+      *               which must not indicate a failure before the function call.
+      * @return a StringEnumeration with the redundant pattern.
+      *         The caller must delete the object.
+      * @internal ICU 3.8
+      */
+     StringEnumeration* getRedundants(UErrorCode& status);
+      
+    /**
+     * The decimal value is used in formatting fractions of seconds. If the
+     * skeleton contains fractional seconds, then this is used with the
+     * fractional seconds. For example, suppose that the input pattern is
+     * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
+     * the decimal string is ",". Then the resulting pattern is modified to be
+     * "H:mm:ss,SSSS"
+     *
+     * @param decimal 
+     * @stable ICU 3.8
+     */
+    void setDecimal(const UnicodeString& decimal);
+
+    /**
+     * Getter corresponding to setDecimal.
+     * @return UnicodeString corresponding to the decimal point
+     * @stable ICU 3.8
+     */
+    const UnicodeString& getDecimal() const;
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for the actual class.
+     *
+     * @stable ICU 3.8
+     */
+    virtual UClassID getDynamicClassID() const;
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for this class.
+     *
+     * @stable ICU 3.8
+     */
+    static UClassID U_EXPORT2 getStaticClassID(void);
+
+private:
+    /**
+     * Constructor.
+     * @stable ICU 3.8
+     */
+    DateTimePatternGenerator(UErrorCode & status);
+
+    /**
+     * Constructor.
+     * @stable ICU 3.8
+     */
+    DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
+
+    /**
+     * Copy constructor.
+     * @param other DateTimePatternGenerator to copy
+     * @stable ICU 3.8
+     */
+    DateTimePatternGenerator(const DateTimePatternGenerator& other);
+
+    /**
+     * Default assignment operator.
+     * @param other DateTimePatternGenerator to copy
+     * @stable ICU 3.8
+     */
+    DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other);
+
+    Locale pLocale;  // pattern locale
+    FormatParser *fp;
+    DateTimeMatcher* dtMatcher;
+    DistanceInfo *distanceInfo;
+    PatternMap *patternMap;
+    UnicodeString appendItemFormats[UDATPG_FIELD_COUNT];
+    UnicodeString appendItemNames[UDATPG_FIELD_COUNT];
+    UnicodeString dateTimeFormat;
+    UnicodeString decimal;
+    DateTimeMatcher *skipMatcher;
+    Hashtable *fAvailableFormatKeyHash;
+    UnicodeString hackPattern;
+    UnicodeString emptyString;
+    UChar fDefaultHourFormatChar;
+
+    void initData(const Locale &locale, UErrorCode &status);
+    void addCanonicalItems();
+    void addICUPatterns(const Locale& locale, UErrorCode& status);
+    void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
+    void addCLDRData(const Locale& locale);
+    UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status);
+    void initHashtable(UErrorCode& status);
+    void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status);
+    void setDecimalSymbols(const Locale& locale, UErrorCode& status);
+    UDateTimePatternField getAppendFormatNumber(const char* field) const;
+    UDateTimePatternField getAppendNameNumber(const char* field) const;
+    void getAppendName(UDateTimePatternField field, UnicodeString& value);
+    int32_t getCanonicalIndex(const UnicodeString& field);
+    const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
+    UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, UBool fixFractionalSeconds);
+    UnicodeString getBestAppending(int32_t missingFields);
+    int32_t getTopBitNumber(int32_t foundMask);
+    void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
+    UBool isAvailableFormatSet(const UnicodeString &key) const;
+    void copyHashtable(Hashtable *other, UErrorCode &status);
+    UBool isCanonicalItem(const UnicodeString& item) const;
+} ;// end class DateTimePatternGenerator
+
+U_NAMESPACE_END
+
+#endif

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/dtrule.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/dtrule.h b/platform/osx/icu/unicode/dtrule.h
new file mode 100644
index 0000000..c46e618
--- /dev/null
+++ b/platform/osx/icu/unicode/dtrule.h
@@ -0,0 +1,250 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007-2008, International Business Machines Corporation and         *
+* others. All Rights Reserved.                                                *
+*******************************************************************************
+*/
+#ifndef DTRULE_H
+#define DTRULE_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file 
+ * \brief C++ API: Rule for specifying date and time in an year
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+
+U_NAMESPACE_BEGIN
+/**
+ * <code>DateTimeRule</code> is a class representing a time in a year by
+ * a rule specified by month, day of month, day of week and
+ * time in the day.
+ * 
+ * @stable ICU 4.0
+ */
+class U_I18N_API DateTimeRule : public UObject {
+public:
+
+    /**
+     * Date rule type constants.
+     * @stable ICU 4.0
+     */
+    enum DateRuleType {
+        DOM = 0,        /**< The exact day of month,
+                             for example, March 11. */
+        DOW,            /**< The Nth occurence of the day of week,
+                             for example, 2nd Sunday in March. */
+        DOW_GEQ_DOM,    /**< The first occurence of the day of week on or after the day of monnth,
+                             for example, first Sunday on or after March 8. */
+        DOW_LEQ_DOM     /**< The last occurence of the day of week on or before the day of month,
+                             for example, first Sunday on or before March 14. */
+    };
+
+    /**
+     * Time rule type constants.
+     * @stable ICU 4.0
+     */
+    enum TimeRuleType {
+        WALL_TIME = 0,  /**< The local wall clock time */
+        STANDARD_TIME,  /**< The local standard time */
+        UTC_TIME        /**< The UTC time */
+    };
+
+    /**
+     * Constructs a <code>DateTimeRule</code> by the day of month and
+     * the time rule.  The date rule type for an instance created by
+     * this constructor is <code>DOM</code>.
+     * 
+     * @param month         The rule month, for example, <code>Calendar::JANUARY</code>
+     * @param dayOfMonth    The day of month, 1-based.
+     * @param millisInDay   The milliseconds in the rule date.
+     * @param timeType      The time type, <code>WALL_TIME</code> or <code>STANDARD_TIME</code>
+     *                      or <code>UTC_TIME</code>.
+     * @stable ICU 4.0
+     */
+    DateTimeRule(int32_t month, int32_t dayOfMonth,
+        int32_t millisInDay, TimeRuleType timeType);
+
+    /**
+     * Constructs a <code>DateTimeRule</code> by the day of week and its oridinal
+     * number and the time rule.  The date rule type for an instance created
+     * by this constructor is <code>DOW</code>.
+     * 
+     * @param month         The rule month, for example, <code>Calendar::JANUARY</code>.
+     * @param weekInMonth   The ordinal number of the day of week.  Negative number
+     *                      may be used for specifying a rule date counted from the
+     *                      end of the rule month.
+     * @param dayOfWeek     The day of week, for example, <code>Calendar::SUNDAY</code>.
+     * @param millisInDay   The milliseconds in the rule date.
+     * @param timeType      The time type, <code>WALL_TIME</code> or <code>STANDARD_TIME</code>
+     *                      or <code>UTC_TIME</code>.
+     * @stable ICU 4.0
+     */
+    DateTimeRule(int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
+        int32_t millisInDay, TimeRuleType timeType);
+
+    /**
+     * Constructs a <code>DateTimeRule</code> by the first/last day of week
+     * on or after/before the day of month and the time rule.  The date rule
+     * type for an instance created by this constructor is either
+     * <code>DOM_GEQ_DOM</code> or <code>DOM_LEQ_DOM</code>.
+     * 
+     * @param month         The rule month, for example, <code>Calendar::JANUARY</code>
+     * @param dayOfMonth    The day of month, 1-based.
+     * @param dayOfWeek     The day of week, for example, <code>Calendar::SUNDAY</code>.
+     * @param after         true if the rule date is on or after the day of month.
+     * @param millisInDay   The milliseconds in the rule date.
+     * @param timeType      The time type, <code>WALL_TIME</code> or <code>STANDARD_TIME</code>
+     *                      or <code>UTC_TIME</code>.
+     * @stable ICU 4.0
+     */
+    DateTimeRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, UBool after,
+        int32_t millisInDay, TimeRuleType timeType);
+
+    /**
+     * Copy constructor.
+     * @param source    The DateTimeRule object to be copied.
+     * @stable ICU 4.0
+     */
+    DateTimeRule(const DateTimeRule& source);
+
+    /**
+     * Destructor.
+     * @stable ICU 4.0
+     */
+    ~DateTimeRule();
+
+    /**
+     * Clone this DateTimeRule object polymorphically. The caller owns the result and
+     * should delete it when done.
+     * @return    A copy of the object.
+     * @stable ICU 4.0
+     */
+    DateTimeRule* clone(void) const;
+
+    /**
+     * Assignment operator.
+     * @param right The object to be copied.
+     * @stable ICU 4.0
+     */
+    DateTimeRule& operator=(const DateTimeRule& right);
+
+    /**
+     * Return true if the given DateTimeRule objects are semantically equal. Objects
+     * of different subclasses are considered unequal.
+     * @param that  The object to be compared with.
+     * @return  true if the given DateTimeRule objects are semantically equal.
+     * @stable ICU 4.0
+     */
+    UBool operator==(const DateTimeRule& that) const;
+
+    /**
+     * Return true if the given DateTimeRule objects are semantically unequal. Objects
+     * of different subclasses are considered unequal.
+     * @param that  The object to be compared with.
+     * @return  true if the given DateTimeRule objects are semantically unequal.
+     * @stable ICU 4.0
+     */
+    UBool operator!=(const DateTimeRule& that) const;
+
+    /**
+     * Gets the date rule type, such as <code>DOM</code>
+     * @return The date rule type.
+     * @stable ICU 4.0
+     */
+    DateRuleType getDateRuleType(void) const;
+
+    /**
+     * Gets the time rule type
+     * @return The time rule type, either <code>WALL_TIME</code> or <code>STANDARD_TIME</code>
+     *         or <code>UTC_TIME</code>.
+     * @stable ICU 4.0
+     */
+    TimeRuleType getTimeRuleType(void) const;
+
+    /**
+     * Gets the rule month.
+     * @return The rule month.
+     * @stable ICU 4.0
+     */
+    int32_t getRuleMonth(void) const;
+
+    /**
+     * Gets the rule day of month.  When the date rule type
+     * is <code>DOW</code>, the value is always 0.
+     * @return The rule day of month
+     * @stable ICU 4.0
+     */
+    int32_t getRuleDayOfMonth(void) const;
+
+    /**
+     * Gets the rule day of week.  When the date rule type
+     * is <code>DOM</code>, the value is always 0.
+     * @return The rule day of week.
+     * @stable ICU 4.0
+     */
+    int32_t getRuleDayOfWeek(void) const;
+
+    /**
+     * Gets the ordinal number of the occurence of the day of week
+     * in the month.  When the date rule type is not <code>DOW</code>,
+     * the value is always 0.
+     * @return The rule day of week ordinal number in the month.
+     * @stable ICU 4.0
+     */
+    int32_t getRuleWeekInMonth(void) const;
+
+    /**
+     * Gets the rule time in the rule day.
+     * @return The time in the rule day in milliseconds.
+     * @stable ICU 4.0
+     */
+    int32_t getRuleMillisInDay(void) const;
+
+private:
+    int32_t fMonth;
+    int32_t fDayOfMonth;
+    int32_t fDayOfWeek;
+    int32_t fWeekInMonth;
+    int32_t fMillisInDay;
+    DateRuleType fDateRuleType;
+    TimeRuleType fTimeRuleType;
+
+public:
+    /**
+     * Return the class ID for this class. This is useful only for comparing to
+     * a return value from getDynamicClassID(). For example:
+     * <pre>
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * </pre>
+     * @return          The class ID for all objects of this class.
+     * @stable ICU 4.0
+     */
+    static UClassID U_EXPORT2 getStaticClassID(void);
+
+    /**
+     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
+     * method is to implement a simple version of RTTI, since not all C++
+     * compilers support genuine RTTI. Polymorphic operator==() and clone()
+     * methods call this method.
+     *
+     * @return          The class ID for this object. All objects of a
+     *                  given class have the same class ID.  Objects of
+     *                  other classes have different class IDs.
+     * @stable ICU 4.0
+     */
+    virtual UClassID getDynamicClassID(void) const;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // DTRULE_H
+//eof

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/fieldpos.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/fieldpos.h b/platform/osx/icu/unicode/fieldpos.h
new file mode 100644
index 0000000..38a9576
--- /dev/null
+++ b/platform/osx/icu/unicode/fieldpos.h
@@ -0,0 +1,291 @@
+/*
+ ********************************************************************************
+ *   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
+// *****************************************************************************
+ 
+#ifndef FIELDPOS_H
+#define FIELDPOS_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file 
+ * \brief C++ API: FieldPosition identifies the fields in a formatted output.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * <code>FieldPosition</code> is a simple class used by <code>Format</code>
+ * and its subclasses to identify fields in formatted output. Fields are
+ * identified by constants, whose names typically end with <code>_FIELD</code>,
+ * defined in the various subclasses of <code>Format</code>. See
+ * <code>ERA_FIELD</code> and its friends in <code>DateFormat</code> for
+ * an example.
+ *
+ * <p>
+ * <code>FieldPosition</code> keeps track of the position of the
+ * field within the formatted output with two indices: the index
+ * of the first character of the field and the index of the last
+ * character of the field.
+ *
+ * <p>
+ * One version of the <code>format</code> method in the various
+ * <code>Format</code> classes requires a <code>FieldPosition</code>
+ * object as an argument. You use this <code>format</code> method
+ * to perform partial formatting or to get information about the
+ * formatted output (such as the position of a field).
+ *
+ * The FieldPosition class is not suitable for subclassing.
+ *
+ * <p>
+ * Below is an example of using <code>FieldPosition</code> to aid
+ * alignment of an array of formatted floating-point numbers on
+ * their decimal points:
+ * <pre>
+ * \code
+ *       double doubleNum[] = {123456789.0, -12345678.9, 1234567.89, -123456.789,
+ *                  12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789};
+ *       int dNumSize = (int)(sizeof(doubleNum)/sizeof(double));
+ *       
+ *       UErrorCode status = U_ZERO_ERROR;
+ *       DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status);
+ *       fmt->setDecimalSeparatorAlwaysShown(true);
+ *       
+ *       const int tempLen = 20;
+ *       char temp[tempLen];
+ *       
+ *       for (int i=0; i<dNumSize; i++) {
+ *           FieldPosition pos(NumberFormat::INTEGER_FIELD);
+ *           UnicodeString buf;
+ *           char fmtText[tempLen];
+ *           ToCharString(fmt->format(doubleNum[i], buf, pos), fmtText);
+ *           for (int j=0; j<tempLen; j++) temp[j] = ' '; // clear with spaces
+ *           temp[__min(tempLen, tempLen-pos.getEndIndex())] = '\0';
+ *           cout << temp << fmtText   << endl;
+ *       }
+ *       delete fmt;
+ * \endcode
+ * </pre>
+ * <p>
+ * The code will generate the following output:
+ * <pre>
+ * \code
+ *           123,456,789.000
+ *           -12,345,678.900
+ *             1,234,567.880
+ *              -123,456.789
+ *                12,345.678
+ *                -1,234.567
+ *                   123.456
+ *                   -12.345
+ *                     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.
+     */
+    enum { DONT_CARE = -1 };
+
+    /**
+     * Creates a FieldPosition object with a non-specified field.
+     * @stable ICU 2.0
+     */
+    FieldPosition() 
+        : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {}
+
+    /**
+     * Creates a FieldPosition object for the given field.  Fields are
+     * identified by constants, whose names typically end with _FIELD,
+     * in the various subclasses of Format.
+     *
+     * @see NumberFormat#INTEGER_FIELD
+     * @see NumberFormat#FRACTION_FIELD
+     * @see DateFormat#YEAR_FIELD
+     * @see DateFormat#MONTH_FIELD
+     * @stable ICU 2.0
+     */
+    FieldPosition(int32_t field) 
+        : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {}
+
+    /**
+     * Copy constructor
+     * @param copy the object to be copied from.
+     * @stable ICU 2.0
+     */
+    FieldPosition(const FieldPosition& copy) 
+        : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {}
+
+    /**
+     * Destructor
+     * @stable ICU 2.0
+     */
+    virtual ~FieldPosition();
+
+    /**
+     * Assignment operator
+     * @param copy the object to be copied from.
+     * @stable ICU 2.0
+     */
+    FieldPosition&      operator=(const FieldPosition& copy);
+
+    /** 
+     * Equality operator.
+     * @param that    the object to be compared with.
+     * @return        TRUE if the two field positions are equal, FALSE otherwise.
+     * @stable ICU 2.0
+     */
+    UBool              operator==(const FieldPosition& that) const;
+
+    /** 
+     * Equality operator.
+     * @param that    the object to be compared with.
+     * @return        TRUE if the two field positions are not equal, FALSE otherwise.
+     * @stable ICU 2.0
+     */
+    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.
+     * @stable ICU 2.0
+     */
+    int32_t getField(void) const { return fField; }
+
+    /**
+     * Retrieve the index of the first character in the requested field.
+     * @return    the index of the first character in the requested field.
+     * @stable ICU 2.0
+     */
+    int32_t getBeginIndex(void) const { return fBeginIndex; }
+
+    /**
+     * Retrieve the index of the character following the last character in the
+     * requested field.
+     * @return    the index of the character following the last character in the
+     *            requested field.
+     * @stable ICU 2.0
+     */
+    int32_t getEndIndex(void) const { return fEndIndex; }
+ 
+    /**
+     * Set the field.
+     * @param f    the new value of the field.
+     * @stable ICU 2.0
+     */
+    void setField(int32_t f) { fField = f; }
+
+    /**
+     * Set the begin index.  For use by subclasses of Format.
+     * @param bi    the new value of the begin index
+     * @stable ICU 2.0
+     */
+    void setBeginIndex(int32_t bi) { fBeginIndex = bi; }
+
+    /**
+     * Set the end index.  For use by subclasses of Format.
+     * @param ei    the new value of the end index
+     * @stable ICU 2.0
+     */
+    void setEndIndex(int32_t ei) { fEndIndex = ei; }
+    
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for the actual class.
+     *
+     * @stable ICU 2.2
+     */
+    virtual UClassID getDynamicClassID() const;
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for this class.
+     *
+     * @stable ICU 2.2
+     */
+    static UClassID U_EXPORT2 getStaticClassID();
+
+private:
+    /**
+     * Input: Desired field to determine start and end offsets for.
+     * The meaning depends on the subclass of Format.
+     */
+    int32_t fField;
+
+    /**
+     * Output: Start offset of field in text.
+     * If the field does not occur in the text, 0 is returned.
+     */
+    int32_t fBeginIndex;
+
+    /**
+     * Output: End offset of field in text.
+     * If the field does not occur in the text, 0 is returned.
+     */
+    int32_t fEndIndex;
+};
+
+inline FieldPosition&
+FieldPosition::operator=(const FieldPosition& copy)
+{
+    fField         = copy.fField;
+    fEndIndex     = copy.fEndIndex;
+    fBeginIndex = copy.fBeginIndex;
+    return *this;
+}
+
+inline UBool
+FieldPosition::operator==(const FieldPosition& copy) const
+{
+    return (fField == copy.fField &&
+        fEndIndex == copy.fEndIndex &&
+        fBeginIndex == copy.fBeginIndex);
+}
+
+inline UBool
+FieldPosition::operator!=(const FieldPosition& copy) const
+{
+    return !operator==(copy);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _FIELDPOS
+//eof

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/fmtable.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/fmtable.h b/platform/osx/icu/unicode/fmtable.h
new file mode 100644
index 0000000..94ee328
--- /dev/null
+++ b/platform/osx/icu/unicode/fmtable.h
@@ -0,0 +1,591 @@
+/*
+********************************************************************************
+*   Copyright (C) 1997-2006, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+********************************************************************************
+*
+* File FMTABLE.H
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   02/29/97    aliu        Creation.
+********************************************************************************
+*/
+#ifndef FMTABLE_H
+#define FMTABLE_H
+
+#include "unicode/utypes.h"
+#include "unicode/unistr.h"
+/**
+ * \file 
+ * \brief C++ API: Formattable is a thin wrapper for primitive numeric types.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Formattable objects can be passed to the Format class or
+ * its subclasses for formatting.  Formattable is a thin wrapper
+ * class which interconverts between the primitive numeric types
+ * (double, long, etc.) as well as UDate and UnicodeString.
+ *
+ * <p>Internally, a Formattable object is a union of primitive types.
+ * As such, it can only store one flavor of data at a time.  To
+ * determine what flavor of data it contains, use the getType method.
+ *
+ * <p>As of ICU 3.0, Formattable may also wrap a UObject pointer,
+ * which it owns.  This allows an instance of any ICU class to be
+ * encapsulated in a Formattable.  For legacy reasons and for
+ * efficiency, primitive numeric types are still stored directly
+ * within a Formattable.
+ *
+ * <p>The Formattable class is not suitable for subclassing.
+ */
+class U_I18N_API Formattable : public UObject {
+public:
+    /**
+     * This enum is only used to let callers distinguish between
+     * the Formattable(UDate) constructor and the Formattable(double)
+     * constructor; the compiler cannot distinguish the signatures,
+     * since UDate is currently typedefed to be either double or long.
+     * If UDate is changed later to be a bonafide class
+     * or struct, then we no longer need this enum.
+     * @stable ICU 2.4
+     */
+    enum ISDATE { kIsDate };
+
+    /**
+     * Default constructor
+     * @stable ICU 2.4
+     */
+    Formattable(); // Type kLong, value 0
+
+    /**
+     * Creates a Formattable object with a UDate instance.
+     * @param d the UDate instance.
+     * @param flag the flag to indicate this is a date. Always set it to kIsDate
+     * @stable ICU 2.0  
+     */
+    Formattable(UDate d, ISDATE flag);
+
+    /**
+     * Creates a Formattable object with a double number.
+     * @param d the double number.
+     * @stable ICU 2.0
+     */
+    Formattable(double d);
+
+    /**
+     * Creates a Formattable object with a long number.
+     * @param l the long number.
+     * @stable ICU 2.0
+     */
+    Formattable(int32_t l);
+
+    /**
+     * Creates a Formattable object with an int64_t number
+     * @param ll the int64_t number.
+     * @stable ICU 2.8
+     */
+    Formattable(int64_t ll);
+
+#if !UCONFIG_NO_CONVERSION
+    /**
+     * Creates a Formattable object with a char string pointer.
+     * Assumes that the char string is null terminated.
+     * @param strToCopy the char string.
+     * @stable ICU 2.0
+     */
+    Formattable(const char* strToCopy);
+#endif
+
+    /**
+     * Creates a Formattable object with a UnicodeString object to copy from.
+     * @param strToCopy the UnicodeString string.
+     * @stable ICU 2.0
+     */
+    Formattable(const UnicodeString& strToCopy);
+
+    /**
+     * Creates a Formattable object with a UnicodeString object to adopt from.
+     * @param strToAdopt the UnicodeString string.
+     * @stable ICU 2.0
+     */
+    Formattable(UnicodeString* strToAdopt);
+
+    /**
+     * Creates a Formattable object with an array of Formattable objects.
+     * @param arrayToCopy the Formattable object array.
+     * @param count the array count.
+     * @stable ICU 2.0
+     */
+    Formattable(const Formattable* arrayToCopy, int32_t count);
+
+    /**
+     * Creates a Formattable object that adopts the given UObject.
+     * @param objectToAdopt the UObject to set this object to
+     * @stable ICU 3.0
+     */
+    Formattable(UObject* objectToAdopt);
+
+    /**
+     * Copy constructor.
+     * @stable ICU 2.0
+     */
+    Formattable(const Formattable&);
+
+    /**
+     * Assignment operator.
+     * @param rhs   The Formattable object to copy into this object.
+     * @stable ICU 2.0
+     */
+    Formattable&    operator=(const Formattable &rhs);
+
+    /**
+     * Equality comparison.
+     * @param other    the object to be compared with.
+     * @return        TRUE if other are equal to this, FALSE otherwise.
+     * @stable ICU 2.0
+     */
+    UBool          operator==(const Formattable &other) const;
+    
+    /** 
+     * Equality operator.
+     * @param other    the object to be compared with.
+     * @return        TRUE if other are unequal to this, FALSE otherwise.
+     * @stable ICU 2.0
+     */
+    UBool          operator!=(const Formattable& other) const
+      { return !operator==(other); }
+
+    /** 
+     * Destructor.
+     * @stable ICU 2.0
+     */
+    virtual         ~Formattable();
+
+    /**
+     * 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
+     */
+    Formattable *clone() const;
+
+    /** 
+     * Selector for flavor of data type contained within a
+     * Formattable object.  Formattable is a union of several
+     * different types, and at any time contains exactly one type.
+     * @stable ICU 2.4
+     */
+    enum Type {
+        /**
+         * Selector indicating a UDate value.  Use getDate to retrieve
+         * the value.
+         * @stable ICU 2.4
+         */
+        kDate,
+
+        /**
+         * Selector indicating a double value.  Use getDouble to
+         * retrieve the value.
+         * @stable ICU 2.4
+         */
+        kDouble,
+
+        /**
+         * Selector indicating a 32-bit integer value.  Use getLong to
+         * retrieve the value.
+         * @stable ICU 2.4
+         */
+        kLong,
+
+        /**
+         * Selector indicating a UnicodeString value.  Use getString
+         * to retrieve the value.
+         * @stable ICU 2.4
+         */
+        kString,
+
+        /**
+         * Selector indicating an array of Formattables.  Use getArray
+         * to retrieve the value.
+         * @stable ICU 2.4
+         */
+        kArray,
+
+        /**
+         * Selector indicating a 64-bit integer value.  Use getInt64
+         * to retrieve the value.
+         * @stable ICU 2.8
+         */
+        kInt64,
+
+        /**
+         * Selector indicating a UObject value.  Use getObject to
+         * retrieve the value.
+         * @stable ICU 3.0
+         */
+        kObject
+   };
+
+    /**
+     * Gets the data type of this Formattable object.
+     * @return    the data type of this Formattable object.
+     * @stable ICU 2.0
+     */
+    Type            getType(void) const;
+    
+    /**
+     * Returns TRUE if the data type of this Formattable object
+     * is kDouble, kLong, or kInt64.
+     * @return TRUE if this is a pure numeric object
+     * @stable ICU 3.0
+     */
+    UBool           isNumeric() const;
+    
+    /**
+     * Gets the double value of this object. If this object is not of type
+     * kDouble then the result is undefined.
+     * @return    the double value of this object.
+     * @stable ICU 2.0
+     */ 
+    double          getDouble(void) const { return fValue.fDouble; }
+
+    /**
+     * Gets the double value of this object. If this object is of type
+     * long or int64 then a casting conversion is peformed, with
+     * possible loss of precision.  If the type is kObject and the
+     * object is a Measure, then the result of
+     * getNumber().getDouble(status) is returned.  If this object is
+     * neither a numeric type nor a Measure, then 0 is returned and
+     * the status is set to U_INVALID_FORMAT_ERROR.
+     * @param status the error code
+     * @return the double value of this object.
+     * @stable ICU 3.0
+     */ 
+    double          getDouble(UErrorCode& status) const;
+
+    /**
+     * Gets the long value of this object. If this object is not of type
+     * kLong then the result is undefined.
+     * @return    the long value of this object.
+     * @stable ICU 2.0
+     */ 
+    int32_t         getLong(void) const { return (int32_t)fValue.fInt64; }
+
+    /**
+     * Gets the long value of this object. If the magnitude is too
+     * large to fit in a long, then the maximum or minimum long value,
+     * as appropriate, is returned and the status is set to
+     * U_INVALID_FORMAT_ERROR.  If this object is of type kInt64 and
+     * it fits within a long, then no precision is lost.  If it is of
+     * type kDouble, then a casting conversion is peformed, with
+     * truncation of any fractional part.  If the type is kObject and
+     * the object is a Measure, then the result of
+     * getNumber().getLong(status) is returned.  If this object is
+     * neither a numeric type nor a Measure, then 0 is returned and
+     * the status is set to U_INVALID_FORMAT_ERROR.
+     * @param status the error code
+     * @return    the long value of this object.
+     * @stable ICU 3.0
+     */ 
+    int32_t         getLong(UErrorCode& status) const;
+
+    /**
+     * Gets the int64 value of this object. If this object is not of type
+     * kInt64 then the result is undefined.
+     * @return    the int64 value of this object.
+     * @stable ICU 2.8
+     */ 
+    int64_t         getInt64(void) const { return fValue.fInt64; }
+
+    /**
+     * Gets the int64 value of this object. If this object is of type
+     * kDouble and the magnitude is too large to fit in an int64, then
+     * the maximum or minimum int64 value, as appropriate, is returned
+     * and the status is set to U_INVALID_FORMAT_ERROR.  If the
+     * magnitude fits in an int64, then a casting conversion is
+     * peformed, with truncation of any fractional part.  If the type
+     * is kObject and the object is a Measure, then the result of
+     * getNumber().getDouble(status) is returned.  If this object is
+     * neither a numeric type nor a Measure, then 0 is returned and
+     * the status is set to U_INVALID_FORMAT_ERROR.
+     * @param status the error code
+     * @return    the int64 value of this object.
+     * @stable ICU 3.0
+     */ 
+    int64_t         getInt64(UErrorCode& status) const;
+
+    /**
+     * Gets the Date value of this object. If this object is not of type
+     * kDate then the result is undefined.
+     * @return    the Date value of this object.
+     * @stable ICU 2.0
+     */ 
+    UDate           getDate() const { return fValue.fDate; }
+
+    /**
+     * Gets the Date value of this object.  If the type is not a date,
+     * status is set to U_INVALID_FORMAT_ERROR and the return value is
+     * undefined.
+     * @param status the error code.
+     * @return    the Date value of this object.
+     * @stable ICU 3.0
+     */ 
+     UDate          getDate(UErrorCode& status) const;
+
+    /**
+     * Gets the string value of this object. If this object is not of type
+     * kString then the result is undefined.
+     * @param result    Output param to receive the Date value of this object.
+     * @return          A reference to 'result'.
+     * @stable ICU 2.0
+     */ 
+    UnicodeString&  getString(UnicodeString& result) const
+      { result=*fValue.fString; return result; }
+
+    /**
+     * Gets the string value of this object. If the type is not a
+     * string, status is set to U_INVALID_FORMAT_ERROR and a bogus
+     * string is returned.
+     * @param result    Output param to receive the Date value of this object.
+     * @param status    the error code. 
+     * @return          A reference to 'result'.
+     * @stable ICU 3.0
+     */ 
+    UnicodeString&  getString(UnicodeString& result, UErrorCode& status) const;
+
+    /**
+     * Gets a const reference to the string value of this object. If
+     * this object is not of type kString then the result is
+     * undefined.
+     * @return   a const reference to the string value of this object.
+     * @stable ICU 2.0
+     */
+    inline const UnicodeString& getString(void) const;
+
+    /**
+     * Gets a const reference to the string value of this object.  If
+     * the type is not a string, status is set to
+     * U_INVALID_FORMAT_ERROR and the result is a bogus string.
+     * @param status    the error code.
+     * @return   a const reference to the string value of this object.
+     * @stable ICU 3.0
+     */
+    const UnicodeString& getString(UErrorCode& status) const;
+
+    /**
+     * Gets a reference to the string value of this object. If this
+     * object is not of type kString then the result is undefined.
+     * @return   a reference to the string value of this object.
+     * @stable ICU 2.0
+     */
+    inline UnicodeString& getString(void);
+
+    /**
+     * Gets a reference to the string value of this object. If the
+     * type is not a string, status is set to U_INVALID_FORMAT_ERROR
+     * and the result is a bogus string.
+     * @param status    the error code. 
+     * @return   a reference to the string value of this object.
+     * @stable ICU 3.0
+     */
+    UnicodeString& getString(UErrorCode& status);
+
+    /**
+     * Gets the array value and count of this object. If this object
+     * is not of type kArray then the result is undefined.
+     * @param count    fill-in with the count of this object.
+     * @return         the array value of this object.
+     * @stable ICU 2.0
+     */ 
+    const Formattable* getArray(int32_t& count) const
+      { count=fValue.fArrayAndCount.fCount; return fValue.fArrayAndCount.fArray; }
+
+    /**
+     * Gets the array value and count of this object. If the type is
+     * not an array, status is set to U_INVALID_FORMAT_ERROR, count is
+     * set to 0, and the result is NULL.
+     * @param count    fill-in with the count of this object.
+     * @param status the error code. 
+     * @return         the array value of this object.
+     * @stable ICU 3.0
+     */ 
+    const Formattable* getArray(int32_t& count, UErrorCode& status) const;
+
+    /**
+     * Accesses the specified element in the array value of this
+     * Formattable object. If this object is not of type kArray then
+     * the result is undefined.
+     * @param index the specified index.
+     * @return the accessed element in the array.
+     * @stable ICU 2.0
+     */
+    Formattable&    operator[](int32_t index) { return fValue.fArrayAndCount.fArray[index]; }
+       
+    /**
+     * Returns a pointer to the UObject contained within this
+     * formattable, or NULL if this object does not contain a UObject.
+     * @return a UObject pointer, or NULL
+     * @stable ICU 3.0
+     */
+    const UObject*  getObject() const;
+
+    /**
+     * Sets the double value of this object and changes the type to
+     * kDouble.
+     * @param d    the new double value to be set.
+     * @stable ICU 2.0
+     */ 
+    void            setDouble(double d);
+
+    /**
+     * Sets the long value of this object and changes the type to
+     * kLong.
+     * @param l    the new long value to be set.
+     * @stable ICU 2.0
+     */ 
+    void            setLong(int32_t l);
+
+    /**
+     * Sets the int64 value of this object and changes the type to
+     * kInt64.
+     * @param ll    the new int64 value to be set.
+     * @stable ICU 2.8
+     */ 
+    void            setInt64(int64_t ll);
+
+    /**
+     * Sets the Date value of this object and changes the type to
+     * kDate.
+     * @param d    the new Date value to be set.
+     * @stable ICU 2.0
+     */ 
+    void            setDate(UDate d);
+
+    /**
+     * Sets the string value of this object and changes the type to
+     * kString.
+     * @param stringToCopy    the new string value to be set.
+     * @stable ICU 2.0
+     */ 
+    void            setString(const UnicodeString& stringToCopy);
+
+    /**
+     * Sets the array value and count of this object and changes the
+     * type to kArray.
+     * @param array    the array value.
+     * @param count    the number of array elements to be copied.
+     * @stable ICU 2.0
+     */ 
+    void            setArray(const Formattable* array, int32_t count);
+
+    /**
+     * Sets and adopts the string value and count of this object and
+     * changes the type to kArray.
+     * @param stringToAdopt    the new string value to be adopted.
+     * @stable ICU 2.0
+     */ 
+    void            adoptString(UnicodeString* stringToAdopt);
+
+    /**
+     * Sets and adopts the array value and count of this object and
+     * changes the type to kArray.
+     * @stable ICU 2.0
+     */ 
+    void            adoptArray(Formattable* array, int32_t count);
+       
+    /**
+     * Sets and adopts the UObject value of this object and changes
+     * the type to kObject.  After this call, the caller must not
+     * delete the given object.
+     * @param objectToAdopt the UObject value to be adopted
+     * @stable ICU 3.0
+     */
+    void            adoptObject(UObject* objectToAdopt);
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for the actual class.
+     *
+     * @stable ICU 2.2
+     */
+    virtual UClassID getDynamicClassID() const;
+
+    /**
+     * ICU "poor man's RTTI", returns a UClassID for this class.
+     *
+     * @stable ICU 2.2
+     */
+    static UClassID U_EXPORT2 getStaticClassID();
+
+    /**
+     * Deprecated variant of getLong(UErrorCode&).
+     * @param status the error code
+     * @return the long value of this object.
+     * @deprecated ICU 3.0 use getLong(UErrorCode&) instead
+     */ 
+    inline int32_t getLong(UErrorCode* status) const;
+
+private:
+    /**
+     * Cleans up the memory for unwanted values.  For example, the adopted
+     * string or array objects.
+     */
+    void            dispose(void);
+
+    UnicodeString* getBogus() const;
+
+    union {
+        UObject*        fObject;
+        UnicodeString*  fString;
+        double          fDouble;
+        int64_t         fInt64;
+        UDate           fDate;
+        struct {
+          Formattable*  fArray;
+          int32_t       fCount;
+        }               fArrayAndCount;
+    } fValue;
+
+    Type                fType;
+    UnicodeString       fBogus; // Bogus string when it's needed.
+};
+
+inline UDate Formattable::getDate(UErrorCode& status) const {
+    if (fType != kDate) {
+        if (U_SUCCESS(status)) {
+            status = U_INVALID_FORMAT_ERROR;
+        }
+        return 0;
+    }
+    return fValue.fDate;
+}
+
+inline const UnicodeString& Formattable::getString(void) const {
+    return *fValue.fString;
+}
+
+inline UnicodeString& Formattable::getString(void) {
+    return *fValue.fString;
+}
+
+inline int32_t Formattable::getLong(UErrorCode* status) const {
+    return getLong(*status);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif //_FMTABLE
+//eof
+

http://git-wip-us.apache.org/repos/asf/couchdb-couch-collate/blob/32ffa429/platform/osx/icu/unicode/format.h
----------------------------------------------------------------------
diff --git a/platform/osx/icu/unicode/format.h b/platform/osx/icu/unicode/format.h
new file mode 100644
index 0000000..7f17b52
--- /dev/null
+++ b/platform/osx/icu/unicode/format.h
@@ -0,0 +1,296 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
+********************************************************************************
+*
+* File FORMAT.H
+*
+* Modification History:
+*
+*   Date        Name        Description
+*   02/19/97    aliu        Converted from java.
+*   03/17/97    clhuang     Updated per C++ implementation.
+*   03/27/97    helena      Updated to pass the simple test after code review.
+********************************************************************************
+*/
+// *****************************************************************************
+// This file was generated from the java source file Format.java
+// *****************************************************************************
+
+#ifndef FORMAT_H
+#define FORMAT_H
+
+
+#include "unicode/utypes.h"
+
+/**
+ * \file 
+ * \brief C++ API: Base class for all formats. 
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/unistr.h"
+#include "unicode/fmtable.h"
+#include "unicode/fieldpos.h"
+#include "unicode/parsepos.h"
+#include "unicode/parseerr.h" 
+#include "unicode/locid.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Base class for all formats.  This is an abstract base class which
+ * specifies the protocol for classes which convert other objects or
+ * values, such as numeric values and dates, and their string
+ * representations.  In some cases these representations may be
+ * localized or contain localized characters or strings.  For example,
+ * a numeric formatter such as DecimalFormat may convert a numeric
+ * value such as 12345 to the string "$12,345".  It may also parse
+ * the string back into a numeric value.  A date and time formatter
+ * like SimpleDateFormat may represent a specific date, encoded
+ * numerically, as a string such as "Wednesday, February 26, 1997 AD".
+ * <P>
+ * Many of the concrete subclasses of Format employ the notion of
+ * a pattern.  A pattern is a string representation of the rules which
+ * govern the interconversion between values and strings.  For example,
+ * a DecimalFormat object may be associated with the pattern
+ * "$#,##0.00;($#,##0.00)", which is a common US English format for
+ * currency values, yielding strings such as "$1,234.45" for 1234.45,
+ * and "($987.65)" for 987.6543.  The specific syntax of a pattern
+ * is defined by each subclass.
+ * <P>
+ * Even though many subclasses use patterns, the notion of a pattern
+ * is not inherent to Format classes in general, and is not part of
+ * the explicit base class protocol.
+ * <P>
+ * Two complex formatting classes bear mentioning.  These are
+ * MessageFormat and ChoiceFormat.  ChoiceFormat is a subclass of
+ * NumberFormat which allows the user to format different number ranges
+ * as strings.  For instance, 0 may be represented as "no files", 1 as
+ * "one file", and any number greater than 1 as "many files".
+ * MessageFormat is a formatter which utilizes other Format objects to
+ * format a string containing with multiple values.  For instance,
+ * A MessageFormat object might produce the string "There are no files
+ * on the disk MyDisk on February 27, 1997." given the arguments 0,
+ * "MyDisk", and the date value of 2/27/97.  See the ChoiceFormat
+ * and MessageFormat headers for further information.
+ * <P>
+ * If formatting is unsuccessful, a failing UErrorCode is returned when
+ * the Format cannot format the type of object, otherwise if there is
+ * something illformed about the the Unicode replacement character
+ * 0xFFFD is returned.
+ * <P>
+ * If there is no match when parsing, a parse failure UErrorCode is
+ * retured for methods which take no ParsePosition.  For the method
+ * that takes a ParsePosition, the index parameter is left unchanged.
+ * <P>
+ * <em>User subclasses are not supported.</em> While clients may write
+ * subclasses, such code will not necessarily work and will not be
+ * guaranteed to work stably from release to release.
+ */
+class U_I18N_API Format : public UObject {
+public:
+
+    /** Destructor
+     * @stable ICU 2.4
+     */
+    virtual ~Format();
+
+    /**
+     * Return true if the given Format objects are semantically equal.
+     * Objects of different subclasses are considered unequal.
+     * @param other    the object to be compared with.
+     * @return         Return true if the given Format objects are semantically equal.
+     *                 Objects of different subclasses are considered unequal.
+     * @stable ICU 2.0
+     */
+    virtual UBool operator==(const Format& other) const = 0;
+
+    /**
+     * Return true if the given Format objects are not semantically
+     * equal.
+     * @param other    the object to be compared with.
+     * @return         Return true if the given Format objects are not semantically.
+     * @stable ICU 2.0
+     */
+    UBool operator!=(const Format& other) const { return !operator==(other); }
+
+    /**
+     * Clone this object polymorphically.  The caller is responsible
+     * for deleting the result when done.
+     * @return    A copy of the object
+     * @stable ICU 2.0
+     */
+    virtual Format* clone() const = 0;
+
+    /**
+     * Formats an object to produce a string.
+     *
+     * @param obj       The object to format.
+     * @param appendTo  Output parameter to receive result.
+     *                  Result is appended to existing contents.
+     * @param status    Output parameter filled in with success or failure status.
+     * @return          Reference to 'appendTo' parameter.
+     * @stable ICU 2.0
+     */
+    UnicodeString& format(const Formattable& obj,
+                          UnicodeString& appendTo,
+                          UErrorCode& status) const;
+
+    /**
+     * Format an object to produce a string.  This is a pure virtual method which
+     * subclasses must implement. This method allows polymorphic formatting
+     * of Formattable objects. If a subclass of Format receives a Formattable
+     * object type it doesn't handle (e.g., if a numeric Formattable is passed
+     * to a DateFormat object) then it returns a failing UErrorCode.
+     *
+     * @param obj       The object to format.
+     * @param appendTo  Output parameter to receive result.
+     *                  Result is appended to existing contents.
+     * @param pos       On input: an alignment field, if desired.
+     *                  On output: the offsets of the alignment field.
+     * @param status    Output param filled with success/failure status.
+     * @return          Reference to 'appendTo' parameter.
+     * @stable ICU 2.0
+     */
+    virtual UnicodeString& format(const Formattable& obj,
+                                  UnicodeString& appendTo,
+                                  FieldPosition& pos,
+                                  UErrorCode& status) const = 0;
+
+    /**
+     * Parse a string to produce an object.  This is a pure virtual
+     * method which subclasses must implement.  This method allows
+     * polymorphic parsing of strings into Formattable objects.
+     * <P>
+     * Before calling, set parse_pos.index to the offset you want to
+     * start parsing at in the source.  After calling, parse_pos.index
+     * is the end of the text you parsed.  If error occurs, index is
+     * unchanged.
+     * <P>
+     * When parsing, leading whitespace is discarded (with successful
+     * parse), while trailing whitespace is left as is.
+     * <P>
+     * Example:
+     * <P>
+     * Parsing "_12_xy" (where _ represents a space) for a number,
+     * with index == 0 will result in the number 12, with
+     * parse_pos.index updated to 3 (just before the second space).
+     * Parsing a second time will result in a failing UErrorCode since
+     * "xy" is not a number, and leave index at 3.
+     * <P>
+     * Subclasses will typically supply specific parse methods that
+     * return different types of values. Since methods can't overload
+     * on return types, these will typically be named "parse", while
+     * this polymorphic method will always be called parseObject.  Any
+     * parse method that does not take a parse_pos should set status
+     * to an error value when no text in the required format is at the
+     * start position.
+     *
+     * @param source    The string to be parsed into an object.
+     * @param result    Formattable to be set to the parse result.
+     *                  If parse fails, return contents are undefined.
+     * @param parse_pos The position to start parsing at. Upon return
+     *                  this param is set to the position after the
+     *                  last character successfully parsed. If the
+     *                  source is not parsed successfully, this param
+     *                  will remain unchanged.
+     * @stable ICU 2.0
+     */
+    virtual void parseObject(const UnicodeString& source,
+                             Formattable& result,
+                             ParsePosition& parse_pos) const = 0;
+
+    /**
+     * Parses a string to produce an object. This is a convenience method
+     * which calls the pure virtual parseObject() method, and returns a
+     * failure UErrorCode if the ParsePosition indicates failure.
+     *
+     * @param source    The string to be parsed into an object.
+     * @param result    Formattable to be set to the parse result.
+     *                  If parse fails, return contents are undefined.
+     * @param status    Output param to be filled with success/failure
+     *                  result code.
+     * @stable ICU 2.0
+     */
+    void parseObject(const UnicodeString& source,
+                     Formattable& result,
+                     UErrorCode& status) const;
+
+    /**
+     * Returns a unique class ID POLYMORPHICALLY.  Pure virtual method.
+     * This method is to implement a simple version of RTTI, since not all
+     * C++ compilers support genuine RTTI.  Polymorphic operator==() and
+     * clone() methods call this method.
+     * Concrete subclasses of Format must implement getDynamicClassID()
+     *
+     * @return          The class ID for this object. All objects of a
+     *                  given class have the same class ID.  Objects of
+     *                  other classes have different class IDs.
+     * @stable ICU 2.0
+     */
+    virtual UClassID getDynamicClassID() const = 0;
+
+    /** Get the locale for this format object. You can choose between valid and actual locale.
+     *  @param type type of the locale we're looking for (valid or actual) 
+     *  @param status error code for the operation
+     *  @return the locale
+     *  @stable ICU 2.8
+     */
+    Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
+
+    /** Get the locale for this format object. You can choose between valid and actual locale.
+     *  @param type type of the locale we're looking for (valid or actual) 
+     *  @param status error code for the operation
+     *  @return the locale
+     *  @internal
+     */
+    const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
+
+ protected:
+    /** @stable ICU 2.8 */
+    void setLocaleIDs(const char* valid, const char* actual);
+
+protected:
+    /**
+     * Default constructor for subclass use only.  Does nothing.
+     * @stable ICU 2.0
+     */
+    Format();
+
+    /**
+     * @stable ICU 2.0
+     */
+    Format(const Format&); // Does nothing; for subclasses only
+
+    /**
+     * @stable ICU 2.0
+     */
+    Format& operator=(const Format&); // Does nothing; for subclasses
+
+       
+    /**
+     * Simple function for initializing a UParseError from a UnicodeString.
+     *
+     * @param pattern The pattern to copy into the parseError
+     * @param pos The position in pattern where the error occured
+     * @param parseError The UParseError object to fill in
+     * @stable ICU 2.4
+     */
+    static void syntaxError(const UnicodeString& pattern,
+                            int32_t pos,
+                            UParseError& parseError);
+
+ private:
+    char actualLocale[ULOC_FULLNAME_CAPACITY];
+    char validLocale[ULOC_FULLNAME_CAPACITY];
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _FORMAT
+//eof