summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/i18n/unicode
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-03-04 13:26:36 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-03-04 13:26:36 +0000
commit53790d2a0c50915d8cec71df3e89cd24d887b2fe (patch)
tree16f6b4df067eb3c2024e0a7735cb7ccea86b3aba /Build/source/libs/icu-xetex/i18n/unicode
parentf483a5de9331a257f597282e611ecfb63f5ab118 (diff)
update icu-xetex to 3.8.1-based code from xetex repository
git-svn-id: svn://tug.org/texlive/trunk@6842 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu-xetex/i18n/unicode')
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/basictz.h210
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/calendar.h2161
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/choicfmt.h780
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/coleitr.h399
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/coll.h1035
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/curramt.h130
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/currunit.h117
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/datefmt.h672
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h370
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h1902
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h698
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dtptngen.h416
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/dtrule.h250
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/fieldpos.h291
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/fmtable.h591
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/format.h296
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/gregocal.h823
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measfmt.h77
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measunit.h71
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/measure.h137
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h829
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/numfmt.h861
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/rbnf.h1049
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/rbtz.h355
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/regex.h950
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/search.h569
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/simpletz.h927
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h904
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/sortkey.h324
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/stsearch.h518
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h924
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/timezone.h726
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/translit.h1323
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/tzrule.h828
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/tztrans.h195
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucal.h1089
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucol.h1223
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucoleitr.h268
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h349
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ucurr.h225
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/udat.h826
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/udatpg.h475
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h194
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/umsg.h647
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/unirepl.h97
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/unum.h869
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/uregex.h631
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/usearch.h646
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/utmscale.h481
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/utrans.h583
-rw-r--r--Build/source/libs/icu-xetex/i18n/unicode/vtzone.h443
51 files changed, 31754 insertions, 0 deletions
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/basictz.h b/Build/source/libs/icu-xetex/i18n/unicode/basictz.h
new file mode 100644
index 00000000000..a49effd5b0b
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/basictz.h
@@ -0,0 +1,210 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, International Business Machines Corporation and *
+* others. All Rights Reserved. *
+*******************************************************************************
+*/
+#ifndef BASICTZ_H
+#define BASICTZ_H
+
+/**
+ * \file
+ * \brief C++ API: ICU TimeZone base class
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/timezone.h"
+#include "unicode/tzrule.h"
+#include "unicode/tztrans.h"
+
+U_NAMESPACE_BEGIN
+
+// forward declarations
+class UVector;
+
+/**
+ * <code>BasicTimeZone</code> is an abstract class extending <code>TimeZone</code>.
+ * This class provides some additional methods to access time zone transitions and rules.
+ * All ICU <code>TimeZone</code> concrete subclasses extend this class.
+ * @draft ICU 3.8
+ */
+class U_I18N_API BasicTimeZone: public TimeZone {
+public:
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~BasicTimeZone();
+
+ /**
+ * Gets the first time zone transition after the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the first transition after the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/ = 0;
+
+ /**
+ * Gets the most recent time zone transition before the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the most recent transition before the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/ = 0;
+
+ /**
+ * Checks if the time zone has equivalent transitions in the time range.
+ * This method returns true when all of transition times, from/to standard
+ * offsets and DST savings used by this time zone match the other in the
+ * time range.
+ * @param tz The <code>BasicTimeZone</code> object to be compared with.
+ * @param start The start time of the evaluated time range (inclusive)
+ * @param end The end time of the evaluated time range (inclusive)
+ * @param ignoreDstAmount
+ * When true, any transitions with only daylight saving amount
+ * changes will be ignored, except either of them is zero.
+ * For example, a transition from rawoffset 3:00/dstsavings 1:00
+ * to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison,
+ * but a transtion from rawoffset 2:00/dstsavings 1:00 to
+ * rawoffset 3:00/dstsavings 0:00 is included.
+ * @param ec Output param to filled in with a success or an error.
+ * @return true if the other time zone has the equivalent transitions in the
+ * time range.
+ * @draft ICU 3.8
+ */
+ virtual UBool hasEquivalentTransitions(/*const*/ BasicTimeZone& tz, UDate start, UDate end,
+ UBool ignoreDstAmount, UErrorCode& ec) /*const*/;
+
+ /**
+ * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
+ * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
+ * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
+ * @param status Receives error status code.
+ * @return The number of <code>TimeZoneRule</code>s representing time transitions.
+ * @draft ICU 3.8
+ */
+ virtual int32_t countTransitionRules(UErrorCode& status) /*const*/ = 0;
+
+ /**
+ * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
+ * which represent time transitions for this time zone. On successful return,
+ * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+ * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
+ * instances up to the size specified by trscount. The results are referencing the
+ * rule instance held by this time zone instance. Therefore, after this time zone
+ * is destructed, they are no longer available.
+ * @param initial Receives the initial timezone rule
+ * @param trsrules Receives the timezone transition rules
+ * @param trscount On input, specify the size of the array 'transitions' receiving
+ * the timezone transition rules. On output, actual number of
+ * rules filled in the array will be set.
+ * @param status Receives error status code.
+ * @draft ICU 3.8
+ */
+ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
+ const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/ = 0;
+
+ /**
+ * Gets the set of time zone rules valid at the specified time. Some known external time zone
+ * implementations are not capable to handle historic time zone rule changes. Also some
+ * implementations can only handle certain type of rule definitions.
+ * If this time zone does not use any daylight saving time within about 1 year from the specified
+ * time, only the <code>InitialTimeZone</code> is returned. Otherwise, the rule for standard
+ * time and daylight saving time transitions are returned in addition to the
+ * <code>InitialTimeZoneRule</code>. The standard and daylight saving time transition rules are
+ * represented by <code>AnnualTimeZoneRule</code> with <code>DateTimeRule::DOW</code> for its date
+ * rule and <code>DateTimeRule::WALL_TIME</code> for its time rule. Because daylight saving time
+ * rule is changing time to time in many time zones and also mapping a transition time rule to
+ * different type is lossy transformation, the set of rules returned by this method may be valid
+ * for short period of time.
+ * The time zone rule objects returned by this method is owned by the caller, so the caller is
+ * responsible for deleting them after use.
+ * @param date The date used for extracting time zone rules.
+ * @param initial Receives the <code>InitialTimeZone</code>, always not NULL.
+ * @param std Receives the <code>AnnualTimeZoneRule</code> for standard time transitions.
+ * When this time time zone does not observe daylight saving times around the
+ * specified date, NULL is set.
+ * @param dst Receives the <code>AnnualTimeZoneRule</code> for daylight saving time
+ * transitions. When this time zone does not observer daylight saving times
+ * around the specified date, NULL is set.
+ * @param status Receives error status code.
+ * @draft ICU 3.8
+ */
+ virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
+ AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) /*const*/;
+
+
+ /**
+ * The time type option bit flags used by getOffsetFromLocal
+ * @internal
+ */
+ enum {
+ kStandard = 0x01,
+ kDaylight = 0x03,
+ kFormer = 0x04,
+ kLatter = 0x0C
+ };
+
+ /**
+ * Get time zone offsets from local wall time.
+ * @internal
+ */
+ virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
+ int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/;
+
+protected:
+
+ /**
+ * The time type option bit masks used by getOffsetFromLocal
+ * @internal
+ */
+ enum {
+ kStdDstMask = kDaylight,
+ kFormerLatterMask = kLatter
+ };
+
+ /**
+ * Default constructor.
+ * @draft ICU 3.8
+ */
+ BasicTimeZone();
+
+ /**
+ * Construct a timezone with a given ID.
+ * @param id a system time zone ID
+ * @draft ICU 3.8
+ */
+ BasicTimeZone(const UnicodeString &id);
+
+ /**
+ * Copy constructor.
+ * @param source the object to be copied.
+ * @draft ICU 3.8
+ */
+ BasicTimeZone(const BasicTimeZone& source);
+
+ /**
+ * Gets the set of TimeZoneRule instances applicable to the specified time and after.
+ * @param start The start date used for extracting time zone rules
+ * @param initial Receives the InitialTimeZone, always not NULL
+ * @param transitionRules Receives the transition rules, could be NULL
+ * @param status Receives error status code
+ */
+ void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
+ UErrorCode& status) /*const*/;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // BASICTZ_H
+
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/calendar.h b/Build/source/libs/icu-xetex/i18n/unicode/calendar.h
new file mode 100644
index 00000000000..d048a8b8a8a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/calendar.h
@@ -0,0 +1,2161 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File CALENDAR.H
+*
+* Modification History:
+*
+* Date Name Description
+* 04/22/97 aliu Expanded and corrected comments and other header
+* contents.
+* 05/01/97 aliu Made equals(), before(), after() arguments const.
+* 05/20/97 aliu Replaced fAreFieldsSet with fAreFieldsInSync and
+* fAreAllFieldsSet.
+* 07/27/98 stephen Sync up with JDK 1.2
+* 11/15/99 weiv added YEAR_WOY and DOW_LOCAL
+* to EDateFields
+* 8/19/2002 srl Removed Javaisms
+* 11/07/2003 srl Update, clean up documentation.
+********************************************************************************
+*/
+
+#ifndef CALENDAR_H
+#define CALENDAR_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Calendar object
+ */
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+#include "unicode/locid.h"
+#include "unicode/timezone.h"
+#include "unicode/ucal.h"
+#include "unicode/umisc.h"
+
+U_NAMESPACE_BEGIN
+
+class ICUServiceFactory;
+
+/**
+ * @internal
+ */
+typedef int32_t UFieldResolutionTable[12][8];
+
+/**
+ * <code>Calendar</code> is an abstract base class for converting between
+ * a <code>UDate</code> object and a set of integer fields such as
+ * <code>YEAR</code>, <code>MONTH</code>, <code>DAY</code>, <code>HOUR</code>,
+ * and so on. (A <code>UDate</code> object represents a specific instant in
+ * time with millisecond precision. See UDate
+ * for information about the <code>UDate</code> class.)
+ *
+ * <p>
+ * Subclasses of <code>Calendar</code> interpret a <code>UDate</code>
+ * according to the rules of a specific calendar system.
+ * The most commonly used subclass of <code>Calendar</code> is
+ * <code>GregorianCalendar</code>. Other subclasses could represent
+ * the various types of lunar calendars in use in many parts of the world.
+ *
+ * <p>
+ * <b>NOTE</b>: (ICU 2.6) The subclass interface should be considered unstable
+ * - it WILL change.
+ *
+ * <p>
+ * Like other locale-sensitive classes, <code>Calendar</code> provides a
+ * static method, <code>createInstance</code>, for getting a generally useful
+ * object of this type. <code>Calendar</code>'s <code>createInstance</code> method
+ * returns the appropriate <code>Calendar</code> subclass whose
+ * time fields have been initialized with the current date and time:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * Calendar *rightNow = Calendar::createInstance(errCode);
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <p>
+ * A <code>Calendar</code> object can produce all the time field values
+ * needed to implement the date-time formatting for a particular language
+ * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
+ *
+ * <p>
+ * When computing a <code>UDate</code> from time fields, two special circumstances
+ * may arise: there may be insufficient information to compute the
+ * <code>UDate</code> (such as only year and month but no day in the month),
+ * or there may be inconsistent information (such as "Tuesday, July 15, 1996"
+ * -- July 15, 1996 is actually a Monday).
+ *
+ * <p>
+ * <strong>Insufficient information.</strong> The calendar will use default
+ * information to specify the missing fields. This may vary by calendar; for
+ * the Gregorian calendar, the default for a field is the same as that of the
+ * start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.
+ *
+ * <p>
+ * <strong>Inconsistent information.</strong> If fields conflict, the calendar
+ * will give preference to fields set more recently. For example, when
+ * determining the day, the calendar will look for one of the following
+ * combinations of fields. The most recent combination, as determined by the
+ * most recently set single field, will be used.
+ *
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * MONTH + DAY_OF_MONTH
+ * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ * DAY_OF_YEAR
+ * DAY_OF_WEEK + WEEK_OF_YEAR
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * For the time of day:
+ *
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * HOUR_OF_DAY
+ * AM_PM + HOUR
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <p>
+ * <strong>Note:</strong> for some non-Gregorian calendars, different
+ * fields may be necessary for complete disambiguation. For example, a full
+ * specification of the historial Arabic astronomical calendar requires year,
+ * month, day-of-month <em>and</em> day-of-week in some cases.
+ *
+ * <p>
+ * <strong>Note:</strong> There are certain possible ambiguities in
+ * interpretation of certain singular times, which are resolved in the
+ * following ways:
+ * <ol>
+ * <li> 24:00:00 "belongs" to the following day. That is,
+ * 23:59 on Dec 31, 1969 &lt; 24:00 on Jan 1, 1970 &lt; 24:01:00 on Jan 1, 1970
+ *
+ * <li> Although historically not precise, midnight also belongs to "am",
+ * and noon belongs to "pm", so on the same day,
+ * 12:00 am (midnight) &lt; 12:01 am, and 12:00 pm (noon) &lt; 12:01 pm
+ * </ol>
+ *
+ * <p>
+ * The date or time format strings are not part of the definition of a
+ * calendar, as those must be modifiable or overridable by the user at
+ * runtime. Use {@link DateFormat}
+ * to format dates.
+ *
+ * <p>
+ * <code>Calendar</code> provides an API for field "rolling", where fields
+ * can be incremented or decremented, but wrap around. For example, rolling the
+ * month up in the date <code>December 12, <b>1996</b></code> results in
+ * <code>January 12, <b>1996</b></code>.
+ *
+ * <p>
+ * <code>Calendar</code> also provides a date arithmetic function for
+ * adding the specified (signed) amount of time to a particular time field.
+ * For example, subtracting 5 days from the date <code>September 12, 1996</code>
+ * results in <code>September 7, 1996</code>.
+ *
+ * @stable ICU 2.0
+ */
+class U_I18N_API Calendar : public UObject {
+public:
+
+ /**
+ * Field IDs for date and time. Used to specify date/time fields. ERA is calendar
+ * specific. Example ranges given are for illustration only; see specific Calendar
+ * subclasses for actual ranges.
+ * @deprecated ICU 2.6. Use C enum UCalendarDateFields defined in ucal.h
+ */
+ enum EDateFields {
+#ifndef U_HIDE_DEPRECATED_API
+ ERA, // Example: 0..1
+ YEAR, // Example: 1..big number
+ MONTH, // Example: 0..11
+ WEEK_OF_YEAR, // Example: 1..53
+ WEEK_OF_MONTH, // Example: 1..4
+ DATE, // Example: 1..31
+ DAY_OF_YEAR, // Example: 1..365
+ DAY_OF_WEEK, // Example: 1..7
+ DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
+ AM_PM, // Example: 0..1
+ HOUR, // Example: 0..11
+ HOUR_OF_DAY, // Example: 0..23
+ MINUTE, // Example: 0..59
+ SECOND, // Example: 0..59
+ MILLISECOND, // Example: 0..999
+ ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
+ DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
+ YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
+ DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
+
+ FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
+#endif /* U_HIDE_DEPRECATED_API */
+ };
+
+ /**
+ * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients
+ * who create locale resources for the field of first-day-of-week should be aware of
+ * this. For instance, in US locale, first-day-of-week is set to 1, i.e., SUNDAY.
+ * @deprecated ICU 2.6. Use C enum UCalendarDaysOfWeek defined in ucal.h
+ */
+ enum EDaysOfWeek {
+#ifndef U_HIDE_DEPRECATED_API
+ SUNDAY = 1,
+ MONDAY,
+ TUESDAY,
+ WEDNESDAY,
+ THURSDAY,
+ FRIDAY,
+ SATURDAY
+#endif /* U_HIDE_DEPRECATED_API */
+ };
+
+ /**
+ * Useful constants for month. Note: Calendar month is 0-based.
+ * @deprecated ICU 2.6. Use C enum UCalendarMonths defined in ucal.h
+ */
+ enum EMonths {
+#ifndef U_HIDE_DEPRECATED_API
+ JANUARY,
+ FEBRUARY,
+ MARCH,
+ APRIL,
+ MAY,
+ JUNE,
+ JULY,
+ AUGUST,
+ SEPTEMBER,
+ OCTOBER,
+ NOVEMBER,
+ DECEMBER,
+ UNDECIMBER
+#endif /* U_HIDE_DEPRECATED_API */
+ };
+
+ /**
+ * Useful constants for hour in 12-hour clock. Used in GregorianCalendar.
+ * @deprecated ICU 2.6. Use C enum UCalendarAMPMs defined in ucal.h
+ */
+ enum EAmpm {
+#ifndef U_HIDE_DEPRECATED_API
+ AM,
+ PM
+#endif /* U_HIDE_DEPRECATED_API */
+ };
+
+ /**
+ * destructor
+ * @stable ICU 2.0
+ */
+ virtual ~Calendar();
+
+ /**
+ * Create and return a polymorphic copy of this calendar.
+ *
+ * @return a polymorphic copy of this calendar.
+ * @stable ICU 2.0
+ */
+ virtual Calendar* clone(void) const = 0;
+
+ /**
+ * Creates a Calendar using the default timezone and locale. Clients are responsible
+ * for deleting the object returned.
+ *
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise. U_MISSING_RESOURCE_ERROR will be returned if the resource data
+ * requests a calendar type which has not been installed.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
+
+ /**
+ * Creates a Calendar using the given timezone and the default locale.
+ * The Calendar takes ownership of zoneToAdopt; the
+ * client must not delete it.
+ *
+ * @param zoneToAdopt The given timezone to be adopted.
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
+
+ /**
+ * Creates a Calendar using the given timezone and the default locale. The TimeZone
+ * is _not_ adopted; the client is still responsible for deleting it.
+ *
+ * @param zone The timezone.
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
+
+ /**
+ * Creates a Calendar using the default timezone and the given locale.
+ *
+ * @param aLocale The given locale.
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Creates a Calendar using the given timezone and given locale.
+ * The Calendar takes ownership of zoneToAdopt; the
+ * client must not delete it.
+ *
+ * @param zoneToAdopt The given timezone to be adopted.
+ * @param aLocale The given locale.
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Gets a Calendar using the given timezone and given locale. The TimeZone
+ * is _not_ adopted; the client is still responsible for deleting it.
+ *
+ * @param zoneToAdopt The given timezone to be adopted.
+ * @param aLocale The given locale.
+ * @param success Indicates the success/failure of Calendar creation. Filled in
+ * with U_ZERO_ERROR if created successfully, set to a failure result
+ * otherwise.
+ * @return A Calendar if created successfully. NULL otherwise.
+ * @stable ICU 2.0
+ */
+ static Calendar* U_EXPORT2 createInstance(const TimeZone& zoneToAdopt, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Returns a list of the locales for which Calendars are installed.
+ *
+ * @param count Number of locales returned.
+ * @return An array of Locale objects representing the set of locales for which
+ * Calendars are installed. The system retains ownership of this list;
+ * the caller must NOT delete it. Does not include user-registered Calendars.
+ * @stable ICU 2.0
+ */
+ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
+
+ /**
+ * Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70
+ * (derived from the system time).
+ *
+ * @return The current UTC time in milliseconds.
+ * @stable ICU 2.0
+ */
+ static UDate U_EXPORT2 getNow(void);
+
+ /**
+ * Gets this Calendar's time as milliseconds. May involve recalculation of time due
+ * to previous calls to set time field values. The time specified is non-local UTC
+ * (GMT) time. Although this method is const, this object may actually be changed
+ * (semantically const).
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @return The current time in UTC (GMT) time, or zero if the operation
+ * failed.
+ * @stable ICU 2.0
+ */
+ inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
+
+ /**
+ * Sets this Calendar's current time with the given UDate. The time specified should
+ * be in non-local UTC (GMT) time.
+ *
+ * @param date The given UDate in UTC (GMT) time.
+ * @param status Output param set to success/failure code on exit. If any value
+ * set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.0
+ */
+ inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
+
+ /**
+ * Compares the equality of two Calendar objects. Objects of different subclasses
+ * are considered unequal. This comparison is very exacting; two Calendar objects
+ * must be in exactly the same state to be considered equal. To compare based on the
+ * represented time, use equals() instead.
+ *
+ * @param that The Calendar object to be compared with.
+ * @return True if the given Calendar is the same as this Calendar; false
+ * otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Calendar& that) const;
+
+ /**
+ * Compares the inequality of two Calendar objects.
+ *
+ * @param that The Calendar object to be compared with.
+ * @return True if the given Calendar is not the same as this Calendar; false
+ * otherwise.
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const Calendar& that) const {return !operator==(that);}
+
+ /**
+ * Returns TRUE if the given Calendar object is equivalent to this
+ * one. An equivalent Calendar will behave exactly as this one
+ * does, but it may be set to a different time. By contrast, for
+ * the operator==() method to return TRUE, the other Calendar must
+ * be set to the same time.
+ *
+ * @param other the Calendar to be compared with this Calendar
+ * @stable ICU 2.4
+ */
+ virtual UBool isEquivalentTo(const Calendar& other) const;
+
+ /**
+ * Compares the Calendar time, whereas Calendar::operator== compares the equality of
+ * Calendar objects.
+ *
+ * @param when The Calendar to be compared with this Calendar. Although this is a
+ * const parameter, the object may be modified physically
+ * (semantically const).
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @return True if the current time of this Calendar is equal to the time of
+ * Calendar when; false otherwise.
+ * @stable ICU 2.0
+ */
+ UBool equals(const Calendar& when, UErrorCode& status) const;
+
+ /**
+ * Returns true if this Calendar's current time is before "when"'s current time.
+ *
+ * @param when The Calendar to be compared with this Calendar. Although this is a
+ * const parameter, the object may be modified physically
+ * (semantically const).
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @return True if the current time of this Calendar is before the time of
+ * Calendar when; false otherwise.
+ * @stable ICU 2.0
+ */
+ UBool before(const Calendar& when, UErrorCode& status) const;
+
+ /**
+ * Returns true if this Calendar's current time is after "when"'s current time.
+ *
+ * @param when The Calendar to be compared with this Calendar. Although this is a
+ * const parameter, the object may be modified physically
+ * (semantically const).
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @return True if the current time of this Calendar is after the time of
+ * Calendar when; false otherwise.
+ * @stable ICU 2.0
+ */
+ UBool after(const Calendar& when, UErrorCode& status) const;
+
+ /**
+ * UDate Arithmetic function. Adds the specified (signed) amount of time to the given
+ * time field, based on the calendar's rules. For example, to subtract 5 days from
+ * the current time of the calendar, call add(Calendar::DATE, -5). When adding on
+ * the month or Calendar::MONTH field, other fields like date might conflict and
+ * need to be changed. For instance, adding 1 month on the date 01/31/96 will result
+ * in 02/29/96.
+ *
+ * @param field Specifies which date field to modify.
+ * @param amount The amount of time to be added to the field, in the natural unit
+ * for that field (e.g., days for the day fields, hours for the hour
+ * field.)
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @deprecated ICU 2.6. use add(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
+ */
+ virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * UDate Arithmetic function. Adds the specified (signed) amount of time to the given
+ * time field, based on the calendar's rules. For example, to subtract 5 days from
+ * the current time of the calendar, call add(Calendar::DATE, -5). When adding on
+ * the month or Calendar::MONTH field, other fields like date might conflict and
+ * need to be changed. For instance, adding 1 month on the date 01/31/96 will result
+ * in 02/29/96.
+ *
+ * @param field Specifies which date field to modify.
+ * @param amount The amount of time to be added to the field, in the natural unit
+ * for that field (e.g., days for the day fields, hours for the hour
+ * field.)
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.6.
+ */
+ virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * Time Field Rolling function. Rolls (up/down) a single unit of time on the given
+ * time field. For example, to roll the current date up by one day, call
+ * roll(Calendar::DATE, true). When rolling on the year or Calendar::YEAR field, it
+ * will roll the year value in the range between getMinimum(Calendar::YEAR) and the
+ * value returned by getMaximum(Calendar::YEAR). When rolling on the month or
+ * Calendar::MONTH field, other fields like date might conflict and, need to be
+ * changed. For instance, rolling the month up on the date 01/31/96 will result in
+ * 02/29/96. Rolling up always means rolling forward in time; e.g., rolling the year
+ * up on "100 BC" will result in "99 BC", for Gregorian calendar. When rolling on the
+ * hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the hour value in the range
+ * between 0 and 23, which is zero-based.
+ * <P>
+ * NOTE: Do not use this method -- use roll(EDateFields, int, UErrorCode&) instead.
+ *
+ * @param field The time field.
+ * @param up Indicates if the value of the specified time field is to be rolled
+ * up or rolled down. Use true if rolling up, false otherwise.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, UBool up, UErrorCode& status) instead.
+ */
+ inline void roll(EDateFields field, UBool up, UErrorCode& status);
+
+ /**
+ * Time Field Rolling function. Rolls (up/down) a single unit of time on the given
+ * time field. For example, to roll the current date up by one day, call
+ * roll(Calendar::DATE, true). When rolling on the year or Calendar::YEAR field, it
+ * will roll the year value in the range between getMinimum(Calendar::YEAR) and the
+ * value returned by getMaximum(Calendar::YEAR). When rolling on the month or
+ * Calendar::MONTH field, other fields like date might conflict and, need to be
+ * changed. For instance, rolling the month up on the date 01/31/96 will result in
+ * 02/29/96. Rolling up always means rolling forward in time; e.g., rolling the year
+ * up on "100 BC" will result in "99 BC", for Gregorian calendar. When rolling on the
+ * hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the hour value in the range
+ * between 0 and 23, which is zero-based.
+ * <P>
+ * NOTE: Do not use this method -- use roll(UCalendarDateFields, int, UErrorCode&) instead.
+ *
+ * @param field The time field.
+ * @param up Indicates if the value of the specified time field is to be rolled
+ * up or rolled down. Use true if rolling up, false otherwise.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.6.
+ */
+ inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
+
+ /**
+ * Time Field Rolling function. Rolls by the given amount on the given
+ * time field. For example, to roll the current date up by one day, call
+ * roll(Calendar::DATE, +1, status). When rolling on the month or
+ * Calendar::MONTH field, other fields like date might conflict and, need to be
+ * changed. For instance, rolling the month up on the date 01/31/96 will result in
+ * 02/29/96. Rolling by a positive value always means rolling forward in time;
+ * e.g., rolling the year by +1 on "100 BC" will result in "99 BC", for Gregorian
+ * calendar. When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will
+ * roll the hour value in the range between 0 and 23, which is zero-based.
+ * <P>
+ * The only difference between roll() and add() is that roll() does not change
+ * the value of more significant fields when it reaches the minimum or maximum
+ * of its range, whereas add() does.
+ *
+ * @param field The time field.
+ * @param amount Indicates amount to roll.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
+ */
+ virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * Time Field Rolling function. Rolls by the given amount on the given
+ * time field. For example, to roll the current date up by one day, call
+ * roll(Calendar::DATE, +1, status). When rolling on the month or
+ * Calendar::MONTH field, other fields like date might conflict and, need to be
+ * changed. For instance, rolling the month up on the date 01/31/96 will result in
+ * 02/29/96. Rolling by a positive value always means rolling forward in time;
+ * e.g., rolling the year by +1 on "100 BC" will result in "99 BC", for Gregorian
+ * calendar. When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will
+ * roll the hour value in the range between 0 and 23, which is zero-based.
+ * <P>
+ * The only difference between roll() and add() is that roll() does not change
+ * the value of more significant fields when it reaches the minimum or maximum
+ * of its range, whereas add() does.
+ *
+ * @param field The time field.
+ * @param amount Indicates amount to roll.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @stable ICU 2.6.
+ */
+ virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * Return the difference between the given time and the time this
+ * calendar object is set to. If this calendar is set
+ * <em>before</em> the given time, the returned value will be
+ * positive. If this calendar is set <em>after</em> the given
+ * time, the returned value will be negative. The
+ * <code>field</code> parameter specifies the units of the return
+ * value. For example, if <code>fieldDifference(when,
+ * Calendar::MONTH)</code> returns 3, then this calendar is set to
+ * 3 months before <code>when</code>, and possibly some addition
+ * time less than one month.
+ *
+ * <p>As a side effect of this call, this calendar is advanced
+ * toward <code>when</code> by the given amount. That is, calling
+ * this method has the side effect of calling <code>add(field,
+ * n)</code>, where <code>n</code> is the return value.
+ *
+ * <p>Usage: To use this method, call it first with the largest
+ * field of interest, then with progressively smaller fields. For
+ * example:
+ *
+ * <pre>
+ * int y = cal->fieldDifference(when, Calendar::YEAR, err);
+ * int m = cal->fieldDifference(when, Calendar::MONTH, err);
+ * int d = cal->fieldDifference(when, Calendar::DATE, err);</pre>
+ *
+ * computes the difference between <code>cal</code> and
+ * <code>when</code> in years, months, and days.
+ *
+ * <p>Note: <code>fieldDifference()</code> is
+ * <em>asymmetrical</em>. That is, in the following code:
+ *
+ * <pre>
+ * cal->setTime(date1, err);
+ * int m1 = cal->fieldDifference(date2, Calendar::MONTH, err);
+ * int d1 = cal->fieldDifference(date2, Calendar::DATE, err);
+ * cal->setTime(date2, err);
+ * int m2 = cal->fieldDifference(date1, Calendar::MONTH, err);
+ * int d2 = cal->fieldDifference(date1, Calendar::DATE, err);</pre>
+ *
+ * one might expect that <code>m1 == -m2 && d1 == -d2</code>.
+ * However, this is not generally the case, because of
+ * irregularities in the underlying calendar system (e.g., the
+ * Gregorian calendar has a varying number of days per month).
+ *
+ * @param when the date to compare this calendar's time to
+ * @param field the field in which to compute the result
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @return the difference, either positive or negative, between
+ * this calendar's time and <code>when</code>, in terms of
+ * <code>field</code>.
+ * @deprecated ICU 2.6. Use fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status).
+ */
+ virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
+
+ /**
+ * Return the difference between the given time and the time this
+ * calendar object is set to. If this calendar is set
+ * <em>before</em> the given time, the returned value will be
+ * positive. If this calendar is set <em>after</em> the given
+ * time, the returned value will be negative. The
+ * <code>field</code> parameter specifies the units of the return
+ * value. For example, if <code>fieldDifference(when,
+ * Calendar::MONTH)</code> returns 3, then this calendar is set to
+ * 3 months before <code>when</code>, and possibly some addition
+ * time less than one month.
+ *
+ * <p>As a side effect of this call, this calendar is advanced
+ * toward <code>when</code> by the given amount. That is, calling
+ * this method has the side effect of calling <code>add(field,
+ * n)</code>, where <code>n</code> is the return value.
+ *
+ * <p>Usage: To use this method, call it first with the largest
+ * field of interest, then with progressively smaller fields. For
+ * example:
+ *
+ * <pre>
+ * int y = cal->fieldDifference(when, Calendar::YEAR, err);
+ * int m = cal->fieldDifference(when, Calendar::MONTH, err);
+ * int d = cal->fieldDifference(when, Calendar::DATE, err);</pre>
+ *
+ * computes the difference between <code>cal</code> and
+ * <code>when</code> in years, months, and days.
+ *
+ * <p>Note: <code>fieldDifference()</code> is
+ * <em>asymmetrical</em>. That is, in the following code:
+ *
+ * <pre>
+ * cal->setTime(date1, err);
+ * int m1 = cal->fieldDifference(date2, Calendar::MONTH, err);
+ * int d1 = cal->fieldDifference(date2, Calendar::DATE, err);
+ * cal->setTime(date2, err);
+ * int m2 = cal->fieldDifference(date1, Calendar::MONTH, err);
+ * int d2 = cal->fieldDifference(date1, Calendar::DATE, err);</pre>
+ *
+ * one might expect that <code>m1 == -m2 && d1 == -d2</code>.
+ * However, this is not generally the case, because of
+ * irregularities in the underlying calendar system (e.g., the
+ * Gregorian calendar has a varying number of days per month).
+ *
+ * @param when the date to compare this calendar's time to
+ * @param field the field in which to compute the result
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @return the difference, either positive or negative, between
+ * this calendar's time and <code>when</code>, in terms of
+ * <code>field</code>.
+ * @stable ICU 2.6.
+ */
+ virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
+
+ /**
+ * Sets the calendar's time zone to be the one passed in. The Calendar takes ownership
+ * of the TimeZone; the caller is no longer responsible for deleting it. If the
+ * given time zone is NULL, this function has no effect.
+ *
+ * @param value The given time zone.
+ * @stable ICU 2.0
+ */
+ void adoptTimeZone(TimeZone* value);
+
+ /**
+ * Sets the calendar's time zone to be the same as the one passed in. The TimeZone
+ * passed in is _not_ adopted; the client is still responsible for deleting it.
+ *
+ * @param zone The given time zone.
+ * @stable ICU 2.0
+ */
+ void setTimeZone(const TimeZone& zone);
+
+ /**
+ * Returns a reference to the time zone owned by this calendar. The returned reference
+ * is only valid until clients make another call to adoptTimeZone or setTimeZone,
+ * or this Calendar is destroyed.
+ *
+ * @return The time zone object associated with this calendar.
+ * @stable ICU 2.0
+ */
+ const TimeZone& getTimeZone(void) const;
+
+ /**
+ * Returns the time zone owned by this calendar. The caller owns the returned object
+ * and must delete it when done. After this call, the new time zone associated
+ * with this Calendar is the default TimeZone as returned by TimeZone::createDefault().
+ *
+ * @return The time zone object which was associated with this calendar.
+ * @stable ICU 2.0
+ */
+ TimeZone* orphanTimeZone(void);
+
+ /**
+ * Queries if the current date for this Calendar is in Daylight Savings Time.
+ *
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return True if the current date for this Calendar is in Daylight Savings Time,
+ * false, otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool inDaylightTime(UErrorCode& status) const = 0;
+
+ /**
+ * Specifies whether or not date/time interpretation is to be lenient. With lenient
+ * interpretation, a date such as "February 942, 1996" will be treated as being
+ * equivalent to the 941st day after February 1, 1996. With strict interpretation,
+ * such dates will cause an error when computing time from the time field values
+ * representing the dates.
+ *
+ * @param lenient True specifies date/time interpretation to be lenient.
+ *
+ * @see DateFormat#setLenient
+ * @stable ICU 2.0
+ */
+ void setLenient(UBool lenient);
+
+ /**
+ * Tells whether date/time interpretation is to be lenient.
+ *
+ * @return True tells that date/time interpretation is to be lenient.
+ * @stable ICU 2.0
+ */
+ UBool isLenient(void) const;
+
+ /**
+ * Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
+ *
+ * @param value The given first day of the week.
+ * @deprecated ICU 2.6. Use setFirstDayOfWeek(UCalendarDaysOfWeek value) instead.
+ */
+ void setFirstDayOfWeek(EDaysOfWeek value);
+
+ /**
+ * Sets what the first day of the week is; e.g., Sunday in US, Monday in France.
+ *
+ * @param value The given first day of the week.
+ * @stable ICU 2.6.
+ */
+ void setFirstDayOfWeek(UCalendarDaysOfWeek value);
+
+ /**
+ * Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
+ *
+ * @return The first day of the week.
+ * @deprecated ICU 2.6 use the overload with error code
+ */
+ EDaysOfWeek getFirstDayOfWeek(void) const;
+
+ /**
+ * Gets what the first day of the week is; e.g., Sunday in US, Monday in France.
+ *
+ * @param status error code
+ * @return The first day of the week.
+ * @stable ICU 2.6
+ */
+ UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
+
+ /**
+ * Sets what the minimal days required in the first week of the year are; For
+ * example, if the first week is defined as one that contains the first day of the
+ * first month of a year, call the method with value 1. If it must be a full week,
+ * use value 7.
+ *
+ * @param value The given minimal days required in the first week of the year.
+ * @stable ICU 2.0
+ */
+ void setMinimalDaysInFirstWeek(uint8_t value);
+
+ /**
+ * Gets what the minimal days required in the first week of the year are; e.g., if
+ * the first week is defined as one that contains the first day of the first month
+ * of a year, getMinimalDaysInFirstWeek returns 1. If the minimal days required must
+ * be a full week, getMinimalDaysInFirstWeek returns 7.
+ *
+ * @return The minimal days required in the first week of the year.
+ * @stable ICU 2.0
+ */
+ uint8_t getMinimalDaysInFirstWeek(void) const;
+
+ /**
+ * Gets the minimum value for the given time field. e.g., for Gregorian
+ * DAY_OF_MONTH, 1.
+ *
+ * @param field The given time field.
+ * @return The minimum value for the given time field.
+ * @deprecated ICU 2.6. Use getMinimum(UCalendarDateFields field) instead.
+ */
+ virtual int32_t getMinimum(EDateFields field) const;
+
+ /**
+ * Gets the minimum value for the given time field. e.g., for Gregorian
+ * DAY_OF_MONTH, 1.
+ *
+ * @param field The given time field.
+ * @return The minimum value for the given time field.
+ * @stable ICU 2.6.
+ */
+ virtual int32_t getMinimum(UCalendarDateFields field) const;
+
+ /**
+ * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH,
+ * 31.
+ *
+ * @param field The given time field.
+ * @return The maximum value for the given time field.
+ * @deprecated ICU 2.6. Use getMaximum(UCalendarDateFields field) instead.
+ */
+ virtual int32_t getMaximum(EDateFields field) const;
+
+ /**
+ * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH,
+ * 31.
+ *
+ * @param field The given time field.
+ * @return The maximum value for the given time field.
+ * @stable ICU 2.6.
+ */
+ virtual int32_t getMaximum(UCalendarDateFields field) const;
+
+ /**
+ * Gets the highest minimum value for the given field if varies. Otherwise same as
+ * getMinimum(). For Gregorian, no difference.
+ *
+ * @param field The given time field.
+ * @return The highest minimum value for the given time field.
+ * @deprecated ICU 2.6. Use getGreatestMinimum(UCalendarDateFields field) instead.
+ */
+ virtual int32_t getGreatestMinimum(EDateFields field) const;
+
+ /**
+ * Gets the highest minimum value for the given field if varies. Otherwise same as
+ * getMinimum(). For Gregorian, no difference.
+ *
+ * @param field The given time field.
+ * @return The highest minimum value for the given time field.
+ * @stable ICU 2.6.
+ */
+ virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
+
+ /**
+ * Gets the lowest maximum value for the given field if varies. Otherwise same as
+ * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28.
+ *
+ * @param field The given time field.
+ * @return The lowest maximum value for the given time field.
+ * @deprecated ICU 2.6. Use getLeastMaximum(UCalendarDateFields field) instead.
+ */
+ virtual int32_t getLeastMaximum(EDateFields field) const;
+
+ /**
+ * Gets the lowest maximum value for the given field if varies. Otherwise same as
+ * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28.
+ *
+ * @param field The given time field.
+ * @return The lowest maximum value for the given time field.
+ * @stable ICU 2.6.
+ */
+ virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
+
+ /**
+ * Return the minimum value that this field could have, given the current date.
+ * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
+ *
+ * The version of this function on Calendar uses an iterative algorithm to determine the
+ * actual minimum value for the field. There is almost always a more efficient way to
+ * accomplish this (in most cases, you can simply return getMinimum()). GregorianCalendar
+ * overrides this function with a more efficient implementation.
+ *
+ * @param field the field to determine the minimum of
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return the minimum of the given field for the current date of this Calendar
+ * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field, UErrorCode& status) instead.
+ */
+ int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
+
+ /**
+ * Return the minimum value that this field could have, given the current date.
+ * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
+ *
+ * The version of this function on Calendar uses an iterative algorithm to determine the
+ * actual minimum value for the field. There is almost always a more efficient way to
+ * accomplish this (in most cases, you can simply return getMinimum()). GregorianCalendar
+ * overrides this function with a more efficient implementation.
+ *
+ * @param field the field to determine the minimum of
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return the minimum of the given field for the current date of this Calendar
+ * @stable ICU 2.6.
+ */
+ int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
+
+ /**
+ * Return the maximum value that this field could have, given the current date.
+ * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
+ * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar,
+ * for some years the actual maximum for MONTH is 12, and for others 13.
+ *
+ * The version of this function on Calendar uses an iterative algorithm to determine the
+ * actual maximum value for the field. There is almost always a more efficient way to
+ * accomplish this (in most cases, you can simply return getMaximum()). GregorianCalendar
+ * overrides this function with a more efficient implementation.
+ *
+ * @param field the field to determine the maximum of
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return the maximum of the given field for the current date of this Calendar
+ * @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field, UErrorCode& status) instead.
+ */
+ int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
+
+ /**
+ * Return the maximum value that this field could have, given the current date.
+ * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
+ * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar,
+ * for some years the actual maximum for MONTH is 12, and for others 13.
+ *
+ * The version of this function on Calendar uses an iterative algorithm to determine the
+ * actual maximum value for the field. There is almost always a more efficient way to
+ * accomplish this (in most cases, you can simply return getMaximum()). GregorianCalendar
+ * overrides this function with a more efficient implementation.
+ *
+ * @param field the field to determine the maximum of
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return the maximum of the given field for the current date of this Calendar
+ * @stable ICU 2.6.
+ */
+ int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
+
+ /**
+ * Gets the value for a given time field. Recalculate the current time field values
+ * if the time value has been changed by a call to setTime(). Return zero for unset
+ * fields if any fields have been explicitly set by a call to set(). To force a
+ * recomputation of all fields regardless of the previous state, call complete().
+ * This method is semantically const, but may alter the object in memory.
+ *
+ * @param field The given time field.
+ * @param status Fill-in parameter which receives the status of the operation.
+ * @return The value for the given time field, or zero if the field is unset,
+ * and set() has been called for any other field.
+ * @deprecated ICU 2.6. Use get(UCalendarDateFields field, UErrorCode& status) instead.
+ */
+ int32_t get(EDateFields field, UErrorCode& status) const;
+
+ /**
+ * Gets the value for a given time field. Recalculate the current time field values
+ * if the time value has been changed by a call to setTime(). Return zero for unset
+ * fields if any fields have been explicitly set by a call to set(). To force a
+ * recomputation of all fields regardless of the previous state, call complete().
+ * This method is semantically const, but may alter the object in memory.
+ *
+ * @param field The given time field.
+ * @param status Fill-in parameter which receives the status of the operation.
+ * @return The value for the given time field, or zero if the field is unset,
+ * and set() has been called for any other field.
+ * @stable ICU 2.6.
+ */
+ int32_t get(UCalendarDateFields field, UErrorCode& status) const;
+
+ /**
+ * Determines if the given time field has a value set. This can affect in the
+ * resolving of time in Calendar. Unset fields have a value of zero, by definition.
+ *
+ * @param field The given time field.
+ * @return True if the given time field has a value set; false otherwise.
+ * @deprecated ICU 2.6. Use isSet(UCalendarDateFields field) instead.
+ */
+ UBool isSet(EDateFields field) const;
+
+ /**
+ * Determines if the given time field has a value set. This can affect in the
+ * resolving of time in Calendar. Unset fields have a value of zero, by definition.
+ *
+ * @param field The given time field.
+ * @return True if the given time field has a value set; false otherwise.
+ * @stable ICU 2.6.
+ */
+ UBool isSet(UCalendarDateFields field) const;
+
+ /**
+ * Sets the given time field with the given value.
+ *
+ * @param field The given time field.
+ * @param value The value to be set for the given time field.
+ * @deprecated ICU 2.6. Use set(UCalendarDateFields field, int32_t value) instead.
+ */
+ void set(EDateFields field, int32_t value);
+
+ /**
+ * Sets the given time field with the given value.
+ *
+ * @param field The given time field.
+ * @param value The value to be set for the given time field.
+ * @stable ICU 2.6.
+ */
+ void set(UCalendarDateFields field, int32_t value);
+
+ /**
+ * Sets the values for the fields YEAR, MONTH, and DATE. Other field values are
+ * retained; call clear() first if this is not desired.
+ *
+ * @param year The value used to set the YEAR time field.
+ * @param month The value used to set the MONTH time field. Month value is 0-based.
+ * e.g., 0 for January.
+ * @param date The value used to set the DATE time field.
+ * @stable ICU 2.0
+ */
+ void set(int32_t year, int32_t month, int32_t date);
+
+ /**
+ * Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, and MINUTE. Other
+ * field values are retained; call clear() first if this is not desired.
+ *
+ * @param year The value used to set the YEAR time field.
+ * @param month The value used to set the MONTH time field. Month value is
+ * 0-based. E.g., 0 for January.
+ * @param date The value used to set the DATE time field.
+ * @param hour The value used to set the HOUR_OF_DAY time field.
+ * @param minute The value used to set the MINUTE time field.
+ * @stable ICU 2.0
+ */
+ void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
+
+ /**
+ * Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, MINUTE, and SECOND.
+ * Other field values are retained; call clear() first if this is not desired.
+ *
+ * @param year The value used to set the YEAR time field.
+ * @param month The value used to set the MONTH time field. Month value is
+ * 0-based. E.g., 0 for January.
+ * @param date The value used to set the DATE time field.
+ * @param hour The value used to set the HOUR_OF_DAY time field.
+ * @param minute The value used to set the MINUTE time field.
+ * @param second The value used to set the SECOND time field.
+ * @stable ICU 2.0
+ */
+ void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
+
+ /**
+ * Clears the values of all the time fields, making them both unset and assigning
+ * them a value of zero. The field values will be determined during the next
+ * resolving of time into time fields.
+ * @stable ICU 2.0
+ */
+ void clear(void);
+
+ /**
+ * Clears the value in the given time field, both making it unset and assigning it a
+ * value of zero. This field value will be determined during the next resolving of
+ * time into time fields.
+ *
+ * @param field The time field to be cleared.
+ * @deprecated ICU 2.6. Use clear(UCalendarDateFields field) instead.
+ */
+ void clear(EDateFields field);
+
+ /**
+ * Clears the value in the given time field, both making it unset and assigning it a
+ * value of zero. This field value will be determined during the next resolving of
+ * time into time fields.
+ *
+ * @param field The time field to be cleared.
+ * @stable ICU 2.6.
+ */
+ void clear(UCalendarDateFields field);
+
+ /**
+ * 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.
+ * <P>
+ * Concrete subclasses of Calendar must implement getDynamicClassID() and also a
+ * static method and data member:
+ *
+ * static UClassID getStaticClassID() { return (UClassID)&amp;fgClassID; }
+ * static char fgClassID;
+ *
+ * @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(void) const = 0;
+
+ /**
+ * Returns the resource key string used for this calendar type.
+ * For example, prepending "Eras_" to this string could return "Eras_japanese"
+ * or "Eras_gregorian".
+ *
+ * @returns static string, for example, "gregorian" or "japanese"
+ * @internal
+ */
+ virtual const char * getType() const = 0;
+
+protected:
+
+ /**
+ * Constructs a Calendar with the default time zone as returned by
+ * TimeZone::createInstance(), and the default locale.
+ *
+ * @param success Indicates the status of Calendar object construction. Returns
+ * U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ Calendar(UErrorCode& success);
+
+ /**
+ * Copy constructor
+ *
+ * @param source Calendar object to be copied from
+ * @stable ICU 2.0
+ */
+ Calendar(const Calendar& source);
+
+ /**
+ * Default assignment operator
+ *
+ * @param right Calendar object to be copied
+ * @stable ICU 2.0
+ */
+ Calendar& operator=(const Calendar& right);
+
+ /**
+ * Constructs a Calendar with the given time zone and locale. Clients are no longer
+ * responsible for deleting the given time zone object after it's adopted.
+ *
+ * @param zone The given time zone.
+ * @param aLocale The given locale.
+ * @param success Indicates the status of Calendar object construction. Returns
+ * U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Constructs a Calendar with the given time zone and locale.
+ *
+ * @param zone The given time zone.
+ * @param aLocale The given locale.
+ * @param success Indicates the status of Calendar object construction. Returns
+ * U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Converts Calendar's time field values to GMT as milliseconds.
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.0
+ */
+ virtual void computeTime(UErrorCode& status);
+
+ /**
+ * Converts GMT as milliseconds to time field values. This allows you to sync up the
+ * time field values with a new time that is set for the calendar. This method
+ * does NOT recompute the time first; to recompute the time, then the fields, use
+ * the method complete().
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.0
+ */
+ virtual void computeFields(UErrorCode& status);
+
+ /**
+ * Gets this Calendar's current time as a long.
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @return the current time as UTC milliseconds from the epoch.
+ * @stable ICU 2.0
+ */
+ double getTimeInMillis(UErrorCode& status) const;
+
+ /**
+ * Sets this Calendar's current time from the given long value.
+ * @param millis the new time in UTC milliseconds from the epoch.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.0
+ */
+ void setTimeInMillis( double millis, UErrorCode& status );
+
+ /**
+ * Recomputes the current time from currently set fields, and then fills in any
+ * unset fields in the time field list.
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ * @stable ICU 2.0
+ */
+ void complete(UErrorCode& status);
+
+ /**
+ * Gets the value for a given time field. Subclasses can use this function to get
+ * field values without forcing recomputation of time.
+ *
+ * @param field The given time field.
+ * @return The value for the given time field.
+ * @deprecated ICU 2.6. Use internalGet(UCalendarDateFields field) instead.
+ */
+ inline int32_t internalGet(EDateFields field) const {return fFields[field];}
+
+ /**
+ * Gets the value for a given time field. Subclasses can use this function to get
+ * field values without forcing recomputation of time. If the field's stamp is UNSET,
+ * the defaultValue is used.
+ *
+ * @param field The given time field.
+ * @param defaultValue a default value used if the field is unset.
+ * @return The value for the given time field.
+ * @internal
+ */
+ inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
+
+ /**
+ * Gets the value for a given time field. Subclasses can use this function to get
+ * field values without forcing recomputation of time.
+ *
+ * @param field The given time field.
+ * @return The value for the given time field.
+ * @internal
+ */
+ inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
+
+ /**
+ * Sets the value for a given time field. This is a fast internal method for
+ * subclasses. It does not affect the areFieldsInSync, isTimeSet, or areAllFieldsSet
+ * flags.
+ *
+ * @param field The given time field.
+ * @param value The value for the given time field.
+ * @deprecated ICU 2.6. Use internalSet(UCalendarDateFields field, int32_t value) instead.
+ */
+ void internalSet(EDateFields field, int32_t value);
+
+ /**
+ * Sets the value for a given time field. This is a fast internal method for
+ * subclasses. It does not affect the areFieldsInSync, isTimeSet, or areAllFieldsSet
+ * flags.
+ *
+ * @param field The given time field.
+ * @param value The value for the given time field.
+ * @stable ICU 2.6.
+ */
+ inline void internalSet(UCalendarDateFields field, int32_t value);
+
+ /**
+ * Prepare this calendar for computing the actual minimum or maximum.
+ * This method modifies this calendar's fields; it is called on a
+ * temporary calendar.
+ * @internal
+ */
+ virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
+
+ /**
+ * Limit enums. Not in sync with UCalendarLimitType (refers to internal fields).
+ * @internal
+ */
+ enum ELimitType {
+ UCAL_LIMIT_MINIMUM = 0,
+ UCAL_LIMIT_GREATEST_MINIMUM,
+ UCAL_LIMIT_LEAST_MAXIMUM,
+ UCAL_LIMIT_MAXIMUM,
+ UCAL_LIMIT_COUNT
+ };
+
+ /**
+ * Subclass API for defining limits of different types.
+ * Subclasses must implement this method to return limits for the
+ * following fields:
+ *
+ * <pre>UCAL_ERA
+ * UCAL_YEAR
+ * UCAL_MONTH
+ * UCAL_WEEK_OF_YEAR
+ * UCAL_WEEK_OF_MONTH
+ * UCAL_DATE (DAY_OF_MONTH on Java)
+ * UCAL_DAY_OF_YEAR
+ * UCAL_DAY_OF_WEEK_IN_MONTH
+ * UCAL_YEAR_WOY
+ * UCAL_EXTENDED_YEAR</pre>
+ *
+ * @param field one of the above field numbers
+ * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,
+ * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>
+ * @internal
+ */
+ virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
+
+ /**
+ * Return a limit for a field.
+ * @param field the field, from <code>0..UCAL_MAX_FIELD</code>
+ * @param limitType the type specifier for the limit
+ * @see #ELimitType
+ * @internal
+ */
+ virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
+
+
+ /**
+ * Return the Julian day number of day before the first day of the
+ * given month in the given extended year. Subclasses should override
+ * this method to implement their calendar system.
+ * @param eyear the extended year
+ * @param month the zero-based month, or 0 if useMonth is false
+ * @param useMonth if false, compute the day before the first day of
+ * the given year, otherwise, compute the day before the first day of
+ * the given month
+ * @return the Julian day number of the day before the first
+ * day of the given month and year
+ * @internal
+ */
+ virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
+ UBool useMonth) const = 0;
+
+ /**
+ * Return the number of days in the given month of the given extended
+ * year of this calendar system. Subclasses should override this
+ * method if they can provide a more correct or more efficient
+ * implementation than the default implementation in Calendar.
+ * @internal
+ */
+ virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
+
+ /**
+ * Return the number of days in the given extended year of this
+ * calendar system. Subclasses should override this method if they can
+ * provide a more correct or more efficient implementation than the
+ * default implementation in Calendar.
+ * @stable ICU 2.0
+ */
+ virtual int32_t handleGetYearLength(int32_t eyear) const;
+
+
+ /**
+ * Return the extended year defined by the current fields. This will
+ * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
+ * as UCAL_ERA) specific to the calendar system, depending on which set of
+ * fields is newer.
+ * @return the extended year
+ * @internal
+ */
+ virtual int32_t handleGetExtendedYear() = 0;
+
+ /**
+ * Subclasses may override this. This method calls
+ * handleGetMonthLength() to obtain the calendar-specific month
+ * length.
+ * @param bestField which field to use to calculate the date
+ * @return julian day specified by calendar fields.
+ * @internal
+ */
+ virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
+
+ /**
+ * Subclasses must override this to convert from week fields
+ * (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case
+ * where YEAR, EXTENDED_YEAR are not set.
+ * The Calendar implementation assumes yearWoy is in extended gregorian form
+ * @internal
+ * @return the extended year, UCAL_EXTENDED_YEAR
+ */
+ virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
+
+ /**
+ * Compute the Julian day from fields. Will determine whether to use
+ * the JULIAN_DAY field directly, or other fields.
+ * @return the julian day
+ * @internal
+ */
+ int32_t computeJulianDay();
+
+ /**
+ * Compute the milliseconds in the day from the fields. This is a
+ * value from 0 to 23:59:59.999 inclusive, unless fields are out of
+ * range, in which case it can be an arbitrary value. This value
+ * reflects local zone wall time.
+ * @internal
+ */
+ int32_t computeMillisInDay();
+
+ /**
+ * This method can assume EXTENDED_YEAR has been set.
+ * @param millis milliseconds of the date fields
+ * @param millisInDay milliseconds of the time fields; may be out
+ * or range.
+ * @param ec Output param set to failure code on function return
+ * when this function fails.
+ * @internal
+ */
+ int32_t computeZoneOffset(double millis, int32_t millisInDay, UErrorCode &ec);
+
+
+ /**
+ * Determine the best stamp in a range.
+ * @param start first enum to look at
+ * @param end last enum to look at
+ * @param bestSoFar stamp prior to function call
+ * @return the stamp value of the best stamp
+ * @internal
+ */
+ int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
+
+ /**
+ * Values for field resolution tables
+ * @see #resolveFields
+ * @internal
+ */
+ enum {
+ /** Marker for end of resolve set (row or group). */
+ kResolveSTOP = -1,
+ /** Value to be bitwised "ORed" against resolve table field values for remapping. Example: (UCAL_DATE | kResolveRemap) in 1st column will cause 'UCAL_DATE' to be returned, but will not examine the value of UCAL_DATE. */
+ kResolveRemap = 32
+ };
+
+ /**
+ * Precedence table for Dates
+ * @see #resolveFields
+ * @internal
+ */
+ static const UFieldResolutionTable kDatePrecedence[];
+
+ /**
+ * Precedence table for Year
+ * @see #resolveFields
+ * @internal
+ */
+ static const UFieldResolutionTable kYearPrecedence[];
+
+ /**
+ * Precedence table for Day of Week
+ * @see #resolveFields
+ * @internal
+ */
+ static const UFieldResolutionTable kDOWPrecedence[];
+
+ /**
+ * Given a precedence table, return the newest field combination in
+ * the table, or UCAL_FIELD_COUNT if none is found.
+ *
+ * <p>The precedence table is a 3-dimensional array of integers. It
+ * may be thought of as an array of groups. Each group is an array of
+ * lines. Each line is an array of field numbers. Within a line, if
+ * all fields are set, then the time stamp of the line is taken to be
+ * the stamp of the most recently set field. If any field of a line is
+ * unset, then the line fails to match. Within a group, the line with
+ * the newest time stamp is selected. The first field of the line is
+ * returned to indicate which line matched.
+ *
+ * <p>In some cases, it may be desirable to map a line to field that
+ * whose stamp is NOT examined. For example, if the best field is
+ * DAY_OF_WEEK then the DAY_OF_WEEK_IN_MONTH algorithm may be used. In
+ * order to do this, insert the value <code>kResolveRemap | F</code> at
+ * the start of the line, where <code>F</code> is the desired return
+ * field value. This field will NOT be examined; it only determines
+ * the return value if the other fields in the line are the newest.
+ *
+ * <p>If all lines of a group contain at least one unset field, then no
+ * line will match, and the group as a whole will fail to match. In
+ * that case, the next group will be processed. If all groups fail to
+ * match, then UCAL_FIELD_COUNT is returned.
+ * @internal
+ */
+ UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
+
+
+ /**
+ * @internal
+ */
+ virtual const UFieldResolutionTable* getFieldResolutionTable() const;
+
+ /**
+ * Return the field that is newer, either defaultField, or
+ * alternateField. If neither is newer or neither is set, return defaultField.
+ * @internal
+ */
+ UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
+
+
+private:
+ /**
+ * Helper function for calculating limits by trial and error
+ * @param field The field being investigated
+ * @param startValue starting (least max) value of field
+ * @param endValue ending (greatest max) value of field
+ * @param status return type
+ * @internal
+ */
+ int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
+
+
+protected:
+ /**
+ * The flag which indicates if the current time is set in the calendar.
+ * @stable ICU 2.0
+ */
+ UBool fIsTimeSet;
+
+ /**
+ * True if the fields are in sync with the currently set time of this Calendar.
+ * If false, then the next attempt to get the value of a field will
+ * force a recomputation of all fields from the current value of the time
+ * field.
+ * <P>
+ * This should really be named areFieldsInSync, but the old name is retained
+ * for backward compatibility.
+ * @stable ICU 2.0
+ */
+ UBool fAreFieldsSet;
+
+ /**
+ * True if all of the fields have been set. This is initially false, and set to
+ * true by computeFields().
+ * @stable ICU 2.0
+ */
+ UBool fAreAllFieldsSet;
+
+ /**
+ * True if all fields have been virtually set, but have not yet been
+ * computed. This occurs only in setTimeInMillis(). A calendar set
+ * to this state will compute all fields from the time if it becomes
+ * necessary, but otherwise will delay such computation.
+ * @stable ICU 3.0
+ */
+ UBool fAreFieldsVirtuallySet;
+
+ /**
+ * Get the current time without recomputing.
+ *
+ * @return the current time without recomputing.
+ * @stable ICU 2.0
+ */
+ UDate internalGetTime(void) const { return fTime; }
+
+ /**
+ * Set the current time without affecting flags or fields.
+ *
+ * @param time The time to be set
+ * @return the current time without recomputing.
+ * @stable ICU 2.0
+ */
+ void internalSetTime(UDate time) { fTime = time; }
+
+ /**
+ * The time fields containing values into which the millis is computed.
+ * @stable ICU 2.0
+ */
+ int32_t fFields[UCAL_FIELD_COUNT];
+
+ /**
+ * The flags which tell if a specified time field for the calendar is set.
+ * @deprecated ICU 2.8 use (fStamp[n]!=kUnset)
+ */
+ UBool fIsSet[UCAL_FIELD_COUNT];
+
+ /** Special values of stamp[]
+ * @stable ICU 2.0
+ */
+ enum {
+ kUnset = 0,
+ kInternallySet,
+ kMinimumUserStamp
+ };
+
+ /**
+ * Pseudo-time-stamps which specify when each field was set. There
+ * are two special values, UNSET and INTERNALLY_SET. Values from
+ * MINIMUM_USER_SET to Integer.MAX_VALUE are legal user set values.
+ * @stable ICU 2.0
+ */
+ int32_t fStamp[UCAL_FIELD_COUNT];
+
+ /**
+ * Subclasses may override this method to compute several fields
+ * specific to each calendar system. These are:
+ *
+ * <ul><li>ERA
+ * <li>YEAR
+ * <li>MONTH
+ * <li>DAY_OF_MONTH
+ * <li>DAY_OF_YEAR
+ * <li>EXTENDED_YEAR</ul>
+ *
+ * Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields, which
+ * will be set when this method is called. Subclasses can also call
+ * the getGregorianXxx() methods to obtain Gregorian calendar
+ * equivalents for the given Julian day.
+ *
+ * <p>In addition, subclasses should compute any subclass-specific
+ * fields, that is, fields from BASE_FIELD_COUNT to
+ * getFieldCount() - 1.
+ *
+ * <p>The default implementation in <code>Calendar</code> implements
+ * a pure proleptic Gregorian calendar.
+ * @internal
+ */
+ virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
+
+ /**
+ * Return the extended year on the Gregorian calendar as computed by
+ * <code>computeGregorianFields()</code>.
+ * @internal
+ */
+ int32_t getGregorianYear() const {
+ return fGregorianYear;
+ }
+
+ /**
+ * Return the month (0-based) on the Gregorian calendar as computed by
+ * <code>computeGregorianFields()</code>.
+ * @internal
+ */
+ int32_t getGregorianMonth() const {
+ return fGregorianMonth;
+ }
+
+ /**
+ * Return the day of year (1-based) on the Gregorian calendar as
+ * computed by <code>computeGregorianFields()</code>.
+ * @internal
+ */
+ int32_t getGregorianDayOfYear() const {
+ return fGregorianDayOfYear;
+ }
+
+ /**
+ * Return the day of month (1-based) on the Gregorian calendar as
+ * computed by <code>computeGregorianFields()</code>.
+ * @internal
+ */
+ int32_t getGregorianDayOfMonth() const {
+ return fGregorianDayOfMonth;
+ }
+
+ /**
+ * Called by computeJulianDay. Returns the default month (0-based) for the year,
+ * taking year and era into account. Defaults to 0 for Gregorian, which doesn't care.
+ * @internal
+ * @internal
+ */
+ virtual int32_t getDefaultMonthInYear() ;
+
+
+ /**
+ * Called by computeJulianDay. Returns the default day (1-based) for the month,
+ * taking currently-set year and era into account. Defaults to 1 for Gregorian.
+ * @internal
+ */
+ virtual int32_t getDefaultDayInMonth(int32_t /*month*/);
+
+ //-------------------------------------------------------------------------
+ // Protected utility methods for use by subclasses. These are very handy
+ // for implementing add, roll, and computeFields.
+ //-------------------------------------------------------------------------
+
+ /**
+ * Adjust the specified field so that it is within
+ * the allowable range for the date to which this calendar is set.
+ * For example, in a Gregorian calendar pinning the {@link #UCalendarDateFields DAY_OF_MONTH}
+ * field for a calendar set to April 31 would cause it to be set
+ * to April 30.
+ * <p>
+ * <b>Subclassing:</b>
+ * <br>
+ * This utility method is intended for use by subclasses that need to implement
+ * their own overrides of {@link #roll roll} and {@link #add add}.
+ * <p>
+ * <b>Note:</b>
+ * <code>pinField</code> is implemented in terms of
+ * {@link #getActualMinimum getActualMinimum}
+ * and {@link #getActualMaximum getActualMaximum}. If either of those methods uses
+ * a slow, iterative algorithm for a particular field, it would be
+ * unwise to attempt to call <code>pinField</code> for that field. If you
+ * really do need to do so, you should override this method to do
+ * something more efficient for that field.
+ * <p>
+ * @param field The calendar field whose value should be pinned.
+ * @param status Output param set to failure code on function return
+ * when this function fails.
+ *
+ * @see #getActualMinimum
+ * @see #getActualMaximum
+ * @stable ICU 2.0
+ */
+ virtual void pinField(UCalendarDateFields field, UErrorCode& status);
+
+ /**
+ * Return the week number of a day, within a period. This may be the week number in
+ * a year or the week number in a month. Usually this will be a value >= 1, but if
+ * some initial days of the period are excluded from week 1, because
+ * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1, then
+ * the week number will be zero for those
+ * initial days. This method requires the day number and day of week for some
+ * known date in the period in order to determine the day of week
+ * on the desired day.
+ * <p>
+ * <b>Subclassing:</b>
+ * <br>
+ * This method is intended for use by subclasses in implementing their
+ * {@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods.
+ * It is often useful in {@link #getActualMinimum getActualMinimum} and
+ * {@link #getActualMaximum getActualMaximum} as well.
+ * <p>
+ * This variant is handy for computing the week number of some other
+ * day of a period (often the first or last day of the period) when its day
+ * of the week is not known but the day number and day of week for some other
+ * day in the period (e.g. the current date) <em>is</em> known.
+ * <p>
+ * @param desiredDay The {@link #UCalendarDateFields DAY_OF_YEAR} or
+ * {@link #UCalendarDateFields DAY_OF_MONTH} whose week number is desired.
+ * Should be 1 for the first day of the period.
+ *
+ * @param dayOfPeriod The {@link #UCalendarDateFields DAY_OF_YEAR}
+ * or {@link #UCalendarDateFields DAY_OF_MONTH} for a day in the period whose
+ * {@link #UCalendarDateFields DAY_OF_WEEK} is specified by the
+ * <code>knownDayOfWeek</code> parameter.
+ * Should be 1 for first day of period.
+ *
+ * @param dayOfWeek The {@link #UCalendarDateFields DAY_OF_WEEK} for the day
+ * corresponding to the <code>knownDayOfPeriod</code> parameter.
+ * 1-based with 1=Sunday.
+ *
+ * @return The week number (one-based), or zero if the day falls before
+ * the first week because
+ * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek}
+ * is more than one.
+ *
+ * @stable ICU 2.8
+ */
+ int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
+
+
+ /**
+ * Return the week number of a day, within a period. This may be the week number in
+ * a year, or the week number in a month. Usually this will be a value >= 1, but if
+ * some initial days of the period are excluded from week 1, because
+ * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1,
+ * then the week number will be zero for those
+ * initial days. This method requires the day of week for the given date in order to
+ * determine the result.
+ * <p>
+ * <b>Subclassing:</b>
+ * <br>
+ * This method is intended for use by subclasses in implementing their
+ * {@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods.
+ * It is often useful in {@link #getActualMinimum getActualMinimum} and
+ * {@link #getActualMaximum getActualMaximum} as well.
+ * <p>
+ * @param dayOfPeriod The {@link #UCalendarDateFields DAY_OF_YEAR} or
+ * {@link #UCalendarDateFields DAY_OF_MONTH} whose week number is desired.
+ * Should be 1 for the first day of the period.
+ *
+ * @param dayOfWeek The {@link #UCalendarDateFields DAY_OF_WEEK} for the day
+ * corresponding to the <code>dayOfPeriod</code> parameter.
+ * 1-based with 1=Sunday.
+ *
+ * @return The week number (one-based), or zero if the day falls before
+ * the first week because
+ * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek}
+ * is more than one.
+ * @internal
+ */
+ inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
+
+ /**
+ * returns the local DOW, valid range 0..6
+ * @internal
+ */
+ int32_t getLocalDOW();
+
+private:
+
+ /**
+ * The next available value for fStamp[]
+ */
+ int32_t fNextStamp;// = MINIMUM_USER_STAMP;
+
+ /**
+ * The current time set for the calendar.
+ */
+ UDate fTime;
+
+ /**
+ * @see #setLenient
+ */
+ UBool fLenient;
+
+ /**
+ * Time zone affects the time calculation done by Calendar. Calendar subclasses use
+ * the time zone data to produce the local time.
+ */
+ TimeZone* fZone;
+
+ /**
+ * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent. They are
+ * used to figure out the week count for a specific date for a given locale. These
+ * must be set when a Calendar is constructed. For example, in US locale,
+ * firstDayOfWeek is SUNDAY; minimalDaysInFirstWeek is 1. They are used to figure
+ * out the week count for a specific date for a given locale. These must be set when
+ * a Calendar is constructed.
+ */
+ UCalendarDaysOfWeek fFirstDayOfWeek;
+ uint8_t fMinimalDaysInFirstWeek;
+
+ /**
+ * Sets firstDayOfWeek and minimalDaysInFirstWeek. Called at Calendar construction
+ * time.
+ *
+ * @param desiredLocale The given locale.
+ * @param type The calendar type identifier, e.g: gregorian, buddhist, etc.
+ * @param success Indicates the status of setting the week count data from
+ * the resource for the given locale. Returns U_ZERO_ERROR if
+ * constructed successfully.
+ */
+ void setWeekCountData(const Locale& desiredLocale, const char *type, UErrorCode& success);
+
+ /**
+ * Recompute the time and update the status fields isTimeSet
+ * and areFieldsSet. Callers should check isTimeSet and only
+ * call this method if isTimeSet is false.
+ *
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid or restricted by
+ * leniency, this will be set to an error status.
+ */
+ void updateTime(UErrorCode& status);
+
+ /**
+ * The Gregorian year, as computed by computeGregorianFields() and
+ * returned by getGregorianYear().
+ * @see #computeGregorianFields
+ */
+ int32_t fGregorianYear;
+
+ /**
+ * The Gregorian month, as computed by computeGregorianFields() and
+ * returned by getGregorianMonth().
+ * @see #computeGregorianFields
+ */
+ int32_t fGregorianMonth;
+
+ /**
+ * The Gregorian day of the year, as computed by
+ * computeGregorianFields() and returned by getGregorianDayOfYear().
+ * @see #computeGregorianFields
+ */
+ int32_t fGregorianDayOfYear;
+
+ /**
+ * The Gregorian day of the month, as computed by
+ * computeGregorianFields() and returned by getGregorianDayOfMonth().
+ * @see #computeGregorianFields
+ */
+ int32_t fGregorianDayOfMonth;
+
+ /* calculations */
+
+ /**
+ * Compute the Gregorian calendar year, month, and day of month from
+ * the given Julian day. These values are not stored in fields, but in
+ * member variables gregorianXxx. Also compute the DAY_OF_WEEK and
+ * DOW_LOCAL fields.
+ */
+ void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
+
+ /**
+ * Compute the Gregorian calendar year, month, and day of month from the
+ * Julian day. These values are not stored in fields, but in member
+ * variables gregorianXxx. They are used for time zone computations and by
+ * subclasses that are Gregorian derivatives. Subclasses may call this
+ * method to perform a Gregorian calendar millis->fields computation.
+ * To perform a Gregorian calendar fields->millis computation, call
+ * computeGregorianMonthStart().
+ * @see #computeGregorianMonthStart
+ */
+ void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
+
+ /**
+ * Compute the fields WEEK_OF_YEAR, YEAR_WOY, WEEK_OF_MONTH,
+ * DAY_OF_WEEK_IN_MONTH, and DOW_LOCAL from EXTENDED_YEAR, YEAR,
+ * DAY_OF_WEEK, and DAY_OF_YEAR. The latter fields are computed by the
+ * subclass based on the calendar system.
+ *
+ * <p>The YEAR_WOY field is computed simplistically. It is equal to YEAR
+ * most of the time, but at the year boundary it may be adjusted to YEAR-1
+ * or YEAR+1 to reflect the overlap of a week into an adjacent year. In
+ * this case, a simple increment or decrement is performed on YEAR, even
+ * though this may yield an invalid YEAR value. For instance, if the YEAR
+ * is part of a calendar system with an N-year cycle field CYCLE, then
+ * incrementing the YEAR may involve incrementing CYCLE and setting YEAR
+ * back to 0 or 1. This is not handled by this code, and in fact cannot be
+ * simply handled without having subclasses define an entire parallel set of
+ * fields for fields larger than or equal to a year. This additional
+ * complexity is not warranted, since the intention of the YEAR_WOY field is
+ * to support ISO 8601 notation, so it will typically be used with a
+ * proleptic Gregorian calendar, which has no field larger than a year.
+ */
+ void computeWeekFields(UErrorCode &ec);
+
+
+ /**
+ * Ensure that each field is within its valid range by calling {@link
+ * #validateField(int, int&)} on each field that has been set. This method
+ * should only be called if this calendar is not lenient.
+ * @see #isLenient
+ * @see #validateField(int, int&)
+ * @internal
+ */
+ void validateFields(UErrorCode &status);
+
+ /**
+ * Validate a single field of this calendar. Subclasses should
+ * override this method to validate any calendar-specific fields.
+ * Generic fields can be handled by
+ * <code>Calendar.validateField()</code>.
+ * @see #validateField(int, int, int, int&)
+ * @internal
+ */
+ virtual void validateField(UCalendarDateFields field, UErrorCode &status);
+
+ /**
+ * Validate a single field of this calendar given its minimum and
+ * maximum allowed value. If the field is out of range,
+ * <code>U_ILLEGAL_ARGUMENT_ERROR</code> will be set. Subclasses may
+ * use this method in their implementation of {@link
+ * #validateField(int, int&)}.
+ * @internal
+ */
+ void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
+
+ protected:
+ /**
+ * Convert a quasi Julian date to the day of the week. The Julian date used here is
+ * not a true Julian date, since it is measured from midnight, not noon. Return
+ * value is one-based.
+ *
+ * @param julian The given Julian date number.
+ * @return Day number from 1..7 (SUN..SAT).
+ * @internal
+ */
+ static uint8_t julianDayToDayOfWeek(double julian);
+
+ private:
+ char validLocale[ULOC_FULLNAME_CAPACITY];
+ char actualLocale[ULOC_FULLNAME_CAPACITY];
+
+ public:
+#if !UCONFIG_NO_SERVICE
+ /**
+ * INTERNAL FOR 2.6 -- Registration.
+ */
+
+ /**
+ * Return a StringEnumeration over the locales available at the time of the call,
+ * including registered locales.
+ * @return a StringEnumeration over the locales available at the time of the call
+ * @internal
+ */
+ static StringEnumeration* getAvailableLocales(void);
+
+ /**
+ * Register a new Calendar factory. The factory will be adopted.
+ * INTERNAL in 2.6
+ * @param toAdopt the factory instance to be adopted
+ * @param status the in/out status code, no special meanings are assigned
+ * @return a registry key that can be used to unregister this factory
+ * @internal
+ */
+ static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
+
+ /**
+ * Unregister a previously-registered CalendarFactory using the key returned from the
+ * register call. Key becomes invalid after a successful call and should not be used again.
+ * The CalendarFactory corresponding to the key will be deleted.
+ * INTERNAL in 2.6
+ * @param key the registry key returned by a previous call to registerFactory
+ * @param status the in/out status code, no special meanings are assigned
+ * @return TRUE if the factory for the key was successfully unregistered
+ * @internal
+ */
+ static UBool unregister(URegistryKey key, UErrorCode& status);
+
+ /**
+ * Multiple Calendar Implementation
+ * @internal
+ */
+ friend class CalendarFactory;
+
+ /**
+ * Multiple Calendar Implementation
+ * @internal
+ */
+ friend class CalendarService;
+
+ /**
+ * Multiple Calendar Implementation
+ * @internal
+ */
+ friend class DefaultCalendarFactory;
+#endif /* !UCONFIG_NO_SERVICE */
+
+ /**
+ * @internal
+ * @return TRUE if this calendar has a default century (i.e. 03 -> 2003)
+ */
+ virtual UBool haveDefaultCentury() const = 0;
+
+ /**
+ * @internal
+ * @return the start of the default century, as a UDate
+ */
+ virtual UDate defaultCenturyStart() const = 0;
+ /**
+ * @internal
+ * @return the beginning year of the default century, as a year
+ */
+ virtual int32_t defaultCenturyStartYear() const = 0;
+
+ /** Get the locale for this calendar 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 calendar 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;
+
+};
+
+// -------------------------------------
+
+inline Calendar*
+Calendar::createInstance(TimeZone* zone, UErrorCode& errorCode)
+{
+ // since the Locale isn't specified, use the default locale
+ return createInstance(zone, Locale::getDefault(), errorCode);
+}
+
+// -------------------------------------
+
+inline void
+Calendar::roll(UCalendarDateFields field, UBool up, UErrorCode& status)
+{
+ roll(field, (int32_t)(up ? +1 : -1), status);
+}
+
+inline void
+Calendar::roll(EDateFields field, UBool up, UErrorCode& status)
+{
+ roll((UCalendarDateFields) field, up, status);
+}
+
+
+// -------------------------------------
+
+/**
+ * Fast method for subclasses. The caller must maintain fUserSetDSTOffset and
+ * fUserSetZoneOffset, as well as the isSet[] array.
+ */
+
+inline void
+Calendar::internalSet(UCalendarDateFields field, int32_t value)
+{
+ fFields[field] = value;
+ fStamp[field] = kInternallySet;
+ fIsSet[field] = TRUE; // Remove later
+}
+
+inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
+{
+ return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
+}
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _CALENDAR
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/choicfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/choicfmt.h
new file mode 100644
index 00000000000..409966a4c8f
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/choicfmt.h
@@ -0,0 +1,780 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2005, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File CHOICFMT.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 03/20/97 helena Finished first cut of implementation and got rid
+* of nextDouble/previousDouble and replaced with
+* boolean array.
+* 4/10/97 aliu Clean up. Modified to work on AIX.
+* 8/6/97 nos Removed overloaded constructor, member var 'buffer'.
+* 07/22/98 stephen Removed operator!= (implemented in Format)
+********************************************************************************
+*/
+
+#ifndef CHOICFMT_H
+#define CHOICFMT_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Choice Format.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/unistr.h"
+#include "unicode/numfmt.h"
+#include "unicode/fieldpos.h"
+#include "unicode/format.h"
+
+U_NAMESPACE_BEGIN
+
+class MessageFormat;
+
+/**
+ * ChoiceFormat converts between ranges of numeric values
+ * and string names for those ranges. A <code>ChoiceFormat</code> splits
+ * the real number line <code>-Inf</code> to <code>+Inf</code> into two
+ * or more contiguous ranges. Each range is mapped to a
+ * string. <code>ChoiceFormat</code> is generally used in a
+ * <code>MessageFormat</code> for displaying grammatically correct
+ * plurals such as &quot;There are 2 files.&quot;</p>
+ *
+ * <p>There are two methods of defining a <code>ChoiceFormat</code>; both
+ * are equivalent. The first is by using a string pattern. This is the
+ * preferred method in most cases. The second method is through direct
+ * specification of the arrays that make up the
+ * <code>ChoiceFormat</code>.</p>
+ *
+ * <p><strong>Patterns</strong></p>
+ *
+ * <p>In most cases, the preferred way to define a
+ * <code>ChoiceFormat</code> is with a pattern. Here is an example of a
+ * <code>ChoiceFormat</code> pattern:</p>
+ *
+ * \htmlonly<pre> 0&#x2264;are no files|1&#x2264;is one file|1&lt;are many files</pre>\endhtmlonly
+ *
+ * <p>or equivalently,</p>
+ *
+ * \htmlonly<pre> 0#are no files|1#is one file|1&lt;are many files</pre>\endhtmlonly
+ *
+ * <p>The pattern consists of a number or <em>range specifiers</em>
+ * separated by vertical bars '|' (U+007C). There is no
+ * vertical bar after the last range. Each range specifier is of the
+ * form:</p>
+ *
+ * \htmlonly<blockquote><em>Number Separator String</em></blockquote>\endhtmlonly
+ *
+ * <p><em>Number</em> is a floating point number that can be parsed by a
+ * default <code>NumberFormat</code> for the US locale. It gives the
+ * lower limit of this range. The lower limit is either inclusive or
+ * exclusive, depending on the <em>separator</em>. The upper limit is
+ * given by the lower limit of the next range. The Unicode infinity
+ * sign \htmlonly&#x221E \endhtmlonly (U+221E) is recognized for positive infinity. It may be preceded by
+ * '-' (U+002D) to indicate negative infinity.</p>
+ *
+ * <p><em>String</em> is the format string for this range, with special
+ * characters enclosed in single quotes (<code>'The #
+ * sign'</code>). Single quotes themselves are indicated by two single
+ * quotes in a row (<code>'o''clock'</code>).</p>
+ *
+ * <p><em>Separator</em> is one of the following single characters:
+ *
+ * <ul>
+ * <li>\htmlonly'&#x2264;' \endhtmlonly (U+2264) or '#' (U+0023)
+ * indicates that the lower limit given by <em>Number</em> is
+ * inclusive. (The two characters are equivalent to ChoiceFormat.)
+ * This means that the limit value <em>Number</em> belongs to this
+ * range. Another way of saying this is that the corresponding
+ * closure is <code>FALSE</code>.</li>
+ *
+ * <li>'<' (U+003C) indicates that the lower limit given by
+ * <em>Number</em> is exclusive. This means that the value
+ * <em>Number</em> belongs to the prior range.</li> Another way of
+ * saying this is that the corresponding closure is
+ * <code>TRUE</code>.
+ * </ul>
+ *
+ * <p>See below for more information about closures.</p>
+ *
+ * <p><strong>Arrays</strong></p>
+ *
+ * <p>A <code>ChoiceFormat</code> defining <code>n</code> intervals
+ * (<code>n</code> &gt;= 2) is specified by three arrays of
+ * <code>n</code> items:
+ *
+ * <ul>
+ * <li><code>double limits[]</code> gives the start of each
+ * interval. This must be a non-decreasing list of values, none of
+ * which may be <code>NaN</code>.</li>
+ * <li><code>UBool closures[]</code> determines whether each limit
+ * value is contained in the interval below it or in the interval
+ * above it. If <code>closures[i]</code> is <code>FALSE</code>, then
+ * <code>limits[i]</code> is a member of interval
+ * <code>i</code>. Otherwise it is a member of interval
+ * <code>i+1</code>. If no closures array is specified, this is
+ * equivalent to having all closures be <code>FALSE</code>. Closures
+ * allow one to specify half-open, open, or closed intervals.</li>
+ * <li><code>UnicodeString formats[]</code> gives the string label
+ * associated with each interval.</li>
+ * </ul>
+ *
+ * <p><strong>Formatting and Parsing</strong></p>
+ *
+ * <p>During formatting, a number is converted to a
+ * string. <code>ChoiceFormat</code> accomplishes this by mapping the
+ * number to an interval using the following rule. Given a number
+ * <code>X</code> and and index value <code>j</code> in the range
+ * <code>0..n-1</code>, where <code>n</code> is the number of ranges:</p>
+ *
+ * \htmlonly<blockquote>\endhtmlonly<code>X</code> matches <code>j</code> if and only if
+ * <code>limit[j] &lt;= X &lt; limit[j+1]</code>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <p>(This assumes that all closures are <code>FALSE</code>. If some
+ * closures are <code>TRUE</code> then the relations must be changed to
+ * <code>&lt;=</code> or <code>&lt;</code> as appropriate.) If there is
+ * no match, then either the first or last index is used, depending on
+ * whether the number is too low or too high. Once a number is mapped to
+ * an interval <code>j</code>, the string <code>formats[j]</code> is
+ * output.</p>
+ *
+ * <p>During parsing, a string is converted to a
+ * number. <code>ChoiceFormat</code> finds the element
+ * <code>formats[j]</code> equal to the string, and returns
+ * <code>limits[j]</code> as the parsed value.</p>
+ *
+ * <p><strong>Notes</strong></p>
+ *
+ * <p>The first limit value does not define a range boundary. For
+ * example, in the pattern \htmlonly&quot;<code>1.0#a|2.0#b</code>&quot;\endhtmlonly, the
+ * intervals are [-Inf, 2.0) and [2.0, +Inf]. It appears that the first
+ * interval should be [1.0, 2.0). However, since all values that are too
+ * small are mapped to range zero, the first interval is effectively
+ * [-Inf, 2.0). However, the first limit value <em>is</em> used during
+ * formatting. In this example, <code>parse(&quot;a&quot;)</code> returns
+ * 1.0.</p>
+ *
+ * <p>There are no gaps between intervals and the entire number line is
+ * covered. A <code>ChoiceFormat</code> maps <em>all</em> possible
+ * double values to a finite set of intervals.</p>
+ *
+ * <p>The non-number <code>NaN</code> is mapped to interval zero during
+ * formatting.</p>
+ *
+ * <p><strong>Examples</strong></p>
+ *
+ * <p>Here is an example of two arrays that map the number
+ * <code>1..7</code> to the English day of the week abbreviations
+ * <code>Sun..Sat</code>. No closures array is given; this is the same as
+ * specifying all closures to be <code>FALSE</code>.</p>
+ *
+ * <pre> {1,2,3,4,5,6,7},
+ * {&quot;Sun&quot;,&quot;Mon&quot;,&quot;Tue&quot;,&quot;Wed&quot;,&quot;Thur&quot;,&quot;Fri&quot;,&quot;Sat&quot;}</pre>
+ *
+ * <p>Here is an example that maps the ranges [-Inf, 1), [1, 1], and (1,
+ * +Inf] to three strings. That is, the number line is split into three
+ * ranges: x &lt; 1.0, x = 1.0, and x &gt; 1.0.</p>
+ *
+ * <pre> {0, 1, 1},
+ * {FALSE, FALSE, TRUE},
+ * {&quot;no files&quot;, &quot;one file&quot;, &quot;many files&quot;}</pre>
+ *
+ * <p>Here is a simple example that shows formatting and parsing: </p>
+ *
+ * \code
+ * #include <unicode/choicfmt.h>
+ * #include <unicode/unistr.h>
+ * #include <iostream.h>
+ *
+ * int main(int argc, char *argv[]) {
+ * double limits[] = {1,2,3,4,5,6,7};
+ * UnicodeString monthNames[] = {
+ * "Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
+ * ChoiceFormat fmt(limits, monthNames, 7);
+ * UnicodeString str;
+ * char buf[256];
+ * for (double x = 1.0; x <= 8.0; x += 1.0) {
+ * fmt.format(x, str);
+ * str.extract(0, str.length(), buf, 256, "");
+ * str.truncate(0);
+ * cout << x << " -> "
+ * << buf << endl;
+ * }
+ * cout << endl;
+ * return 0;
+ * }
+ * \endcode
+ *
+ * <p>Here is a more complex example using a <code>ChoiceFormat</code>
+ * constructed from a pattern together with a
+ * <code>MessageFormat</code>.</p>
+ *
+ * \code
+ * #include <unicode/choicfmt.h>
+ * #include <unicode/msgfmt.h>
+ * #include <unicode/unistr.h>
+ * #include <iostream.h>
+ *
+ * int main(int argc, char *argv[]) {
+ * UErrorCode status = U_ZERO_ERROR;
+ * double filelimits[] = {0,1,2};
+ * UnicodeString filepart[] =
+ * {"are no files","is one file","are {0} files"};
+ * ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 );
+ * Format* testFormats[] =
+ * {fileform, NULL, NumberFormat::createInstance(status)};
+ * MessageFormat pattform("There {0} on {1}", status );
+ * pattform.adoptFormats(testFormats, 3);
+ * Formattable testArgs[] = {0L, "Disk A"};
+ * FieldPosition fp(0);
+ * UnicodeString str;
+ * char buf[256];
+ * for (int32_t i = 0; i < 4; ++i) {
+ * Formattable fInt(i);
+ * testArgs[0] = fInt;
+ * pattform.format(testArgs, 2, str, fp, status );
+ * str.extract(0, str.length(), buf, "");
+ * str.truncate(0);
+ * cout << "Output for i=" << i << " : " << buf << endl;
+ * }
+ * cout << endl;
+ * return 0;
+ * }
+ * \endcode
+ *
+ * <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 ChoiceFormat: public NumberFormat {
+public:
+ /**
+ * Construct a new ChoiceFormat with the limits and the corresponding formats
+ * based on the pattern.
+ *
+ * @param pattern Pattern used to construct object.
+ * @param status Output param to receive success code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ ChoiceFormat(const UnicodeString& pattern,
+ UErrorCode& status);
+
+
+ /**
+ * Construct a new ChoiceFormat with the given limits and formats. Copy
+ * the limits and formats instead of adopting them.
+ *
+ * @param limits Array of limit values.
+ * @param formats Array of formats.
+ * @param count Size of 'limits' and 'formats' arrays.
+ * @stable ICU 2.0
+ */
+
+ ChoiceFormat(const double* limits,
+ const UnicodeString* formats,
+ int32_t count );
+
+ /**
+ * Construct a new ChoiceFormat with the given limits and formats.
+ * Copy the limits and formats (instead of adopting them). By
+ * default, each limit in the array specifies the inclusive lower
+ * bound of its range, and the exclusive upper bound of the previous
+ * range. However, if the isLimitOpen element corresponding to a
+ * limit is TRUE, then the limit is the exclusive lower bound of its
+ * range, and the inclusive upper bound of the previous range.
+ * @param limits Array of limit values
+ * @param closures Array of booleans specifying whether each
+ * element of 'limits' is open or closed. If FALSE, then the
+ * corresponding limit is a member of the range above it. If TRUE,
+ * then the limit belongs to the range below it.
+ * @param formats Array of formats
+ * @param count Size of 'limits', 'closures', and 'formats' arrays
+ * @stable ICU 2.4
+ */
+ ChoiceFormat(const double* limits,
+ const UBool* closures,
+ const UnicodeString* formats,
+ int32_t count);
+
+ /**
+ * Copy constructor.
+ *
+ * @param that ChoiceFormat object to be copied from
+ * @stable ICU 2.0
+ */
+ ChoiceFormat(const ChoiceFormat& that);
+
+ /**
+ * Assignment operator.
+ *
+ * @param that ChoiceFormat object to be copied
+ * @stable ICU 2.0
+ */
+ const ChoiceFormat& operator=(const ChoiceFormat& that);
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~ChoiceFormat();
+
+ /**
+ * Clone this Format object polymorphically. The caller owns the
+ * result and should delete it when done.
+ *
+ * @return a copy of this object
+ * @stable ICU 2.0
+ */
+ virtual Format* clone(void) const;
+
+ /**
+ * Return true if the given Format objects are semantically equal.
+ * Objects of different subclasses are considered unequal.
+ *
+ * @param other ChoiceFormat object to be compared
+ * @return true if other is the same as this.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format& other) const;
+
+ /**
+ * Sets the pattern.
+ * @param pattern The pattern to be applied.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * Sets the pattern.
+ * @param pattern The pattern to be applied.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UParseError& parseError,
+ UErrorCode& status);
+ /**
+ * Gets the pattern.
+ *
+ * @param pattern Output param which will recieve the pattern
+ * Previous contents are deleted.
+ * @return A reference to 'pattern'
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toPattern(UnicodeString &pattern) const;
+
+#ifdef U_USE_CHOICE_FORMAT_DEPRECATES
+ /**
+ * Set the choices to be used in formatting. The arrays are adopted and
+ * should not be deleted by the caller.
+ *
+ * @param limitsToAdopt Contains the top value that you want
+ * parsed with that format,and should be in
+ * ascending sorted order. When formatting X,
+ * the choice will be the i, where limit[i]
+ * &lt;= X &lt; limit[i+1].
+ * @param formatsToAdopt The format strings you want to use for each limit.
+ * @param count The size of the above arrays.
+ * @obsolete ICU 2.6. Use setChoices instead since this API will be removed in that release.
+ */
+ virtual void adoptChoices(double* limitsToAdopt,
+ UnicodeString* formatsToAdopt,
+ int32_t count );
+
+ /**
+ * Set the choices to be used in formatting. The arrays are adopted
+ * and should not be deleted by the caller. See class description
+ * for documenatation of the limits, closures, and formats arrays.
+ * @param limitsToAdopt Array of limits to adopt
+ * @param closuresToAdopt Array of limit booleans to adopt
+ * @param formatsToAdopt Array of format string to adopt
+ * @param count The size of the above arrays
+ * @obsolete ICU 2.6. Use setChoices instead since this API will be removed in that release.
+ */
+ virtual void adoptChoices(double* limitsToAdopt,
+ UBool* closuresToAdopt,
+ UnicodeString* formatsToAdopt,
+ int32_t count);
+#endif
+
+ /**
+ * Set the choices to be used in formatting.
+ *
+ * @param limitsToCopy Contains the top value that you want
+ * parsed with that format,and should be in
+ * ascending sorted order. When formatting X,
+ * the choice will be the i, where limit[i]
+ * &lt;= X &lt; limit[i+1].
+ * @param formatsToCopy The format strings you want to use for each limit.
+ * @param count The size of the above arrays.
+ * @stable ICU 2.0
+ */
+ virtual void setChoices(const double* limitsToCopy,
+ const UnicodeString* formatsToCopy,
+ int32_t count );
+
+ /**
+ * Set the choices to be used in formatting. See class description
+ * for documenatation of the limits, closures, and formats arrays.
+ * @param limits Array of limits
+ * @param closures Array of limit booleans
+ * @param formats Array of format string
+ * @param count The size of the above arrays
+ * @stable ICU 2.4
+ */
+ virtual void setChoices(const double* limits,
+ const UBool* closures,
+ const UnicodeString* formats,
+ int32_t count);
+
+ /**
+ * Get the limits passed in the constructor.
+ *
+ * @param count The size of the limits arrays
+ * @return the limits.
+ * @stable ICU 2.0
+ */
+ virtual const double* getLimits(int32_t& count) const;
+
+ /**
+ * Get the limit booleans passed in the constructor. The caller
+ * must not delete the result.
+ *
+ * @param count The size of the arrays
+ * @return the closures
+ * @stable ICU 2.4
+ */
+ virtual const UBool* getClosures(int32_t& count) const;
+
+ /**
+ * Get the formats passed in the constructor.
+ *
+ * @param count The size of the arrays
+ * @return the formats.
+ * @stable ICU 2.0
+ */
+ virtual const UnicodeString* getFormats(int32_t& count) const;
+
+ /**
+ * Format a double or long number using this object's choices.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(double number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+ /**
+ * Format a int_32t number using this object's choices.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(int32_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Format an int64_t number using this object's choices.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.8
+ */
+ virtual UnicodeString& format(int64_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Format an array of objects using this object's choices.
+ *
+ * @param objs The array of objects to be formatted.
+ * @param cnt The size of objs.
+ * @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 success Output param set to success/failure code on
+ * exit.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(const Formattable* objs,
+ int32_t cnt,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& success) const;
+ /**
+ * Format an object using this object's choices.
+ *
+ *
+ * @param obj The object to be formatted.
+ * @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 set to success/failure code on
+ * exit.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ *
+ * @param obj The object to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Output param set to success/failure code on
+ * exit.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * Format a double number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( double number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * Format a long number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( int32_t number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Return a long if possible (e.g. within range LONG_MAX,
+ * LONG_MAX], and with no decimals), otherwise a double. If
+ * IntegerOnly is set, will stop at a decimal point (or equivalent;
+ * e.g. for rational numbers "1 2/3", will stop after the 1).
+ * <P>
+ * If no object can be parsed, parsePosition is unchanged, and NULL is
+ * returned.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param parsePosition The position to start parsing at on input.
+ * On output, moved to after the last successfully
+ * parse character. On parse failure, does not change.
+ * @see NumberFormat::isParseIntegerOnly
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& parsePosition) const;
+
+ /**
+ * Return a long if possible (e.g. within range LONG_MAX,
+ * LONG_MAX], and with no decimals), otherwise a double. If
+ * IntegerOnly is set, will stop at a decimal point (or equivalent;
+ * e.g. for rational numbers "1 2/3", will stop after the 1).
+ * <P>
+ * If no object can be parsed, parsePosition is unchanged, and NULL is
+ * returned.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param status Output param with the formatted string.
+ * @see NumberFormat::isParseIntegerOnly
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ UErrorCode& status) const;
+
+
+public:
+ /**
+ * 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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * 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() ==
+ * . Derived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+private:
+ // static cache management (thread-safe)
+ // static NumberFormat* getNumberFormat(UErrorCode &status); // call this function to 'check out' a numberformat from the cache.
+ // static void releaseNumberFormat(NumberFormat *adopt); // call this function to 'return' the number format to the cache.
+
+ /**
+ * Converts a string to a double value using a default NumberFormat object
+ * which is static (shared by all ChoiceFormat instances).
+ * @param string the string to be converted with.
+ * @return the converted double number.
+ */
+ static double stod(const UnicodeString& string);
+
+ /**
+ * Converts a double value to a string using a default NumberFormat object
+ * which is static (shared by all ChoiceFormat instances).
+ * @param value the double number to be converted with.
+ * @param string the result string.
+ * @return the converted string.
+ */
+ static UnicodeString& dtos(double value, UnicodeString& string);
+
+ ChoiceFormat(); // default constructor not implemented
+
+ /**
+ * Construct a new ChoiceFormat with the limits and the corresponding formats
+ * based on the pattern.
+ *
+ * @param newPattern Pattern used to construct object.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered.
+ * @param status Output param to receive success code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ ChoiceFormat(const UnicodeString& newPattern,
+ UParseError& parseError,
+ UErrorCode& status);
+
+ friend class MessageFormat;
+ /**
+ * Each ChoiceFormat divides the range -Inf..+Inf into fCount
+ * intervals. The intervals are:
+ *
+ * 0: fChoiceLimits[0]..fChoiceLimits[1]
+ * 1: fChoiceLimits[1]..fChoiceLimits[2]
+ * ...
+ * fCount-2: fChoiceLimits[fCount-2]..fChoiceLimits[fCount-1]
+ * fCount-1: fChoiceLimits[fCount-1]..+Inf
+ *
+ * Interval 0 is special; during formatting (mapping numbers to
+ * strings), it also contains all numbers less than
+ * fChoiceLimits[0], as well as NaN values.
+ *
+ * Interval i maps to and from string fChoiceFormats[i]. When
+ * parsing (mapping strings to numbers), then intervals map to
+ * their lower limit, that is, interval i maps to fChoiceLimit[i].
+ *
+ * The intervals may be closed, half open, or open. This affects
+ * formatting but does not affect parsing. Interval i is affected
+ * by fClosures[i] and fClosures[i+1]. If fClosures[i]
+ * is FALSE, then the value fChoiceLimits[i] is in interval i.
+ * That is, intervals i and i are:
+ *
+ * i-1: ... x < fChoiceLimits[i]
+ * i: fChoiceLimits[i] <= x ...
+ *
+ * If fClosures[i] is TRUE, then the value fChoiceLimits[i] is
+ * in interval i-1. That is, intervals i-1 and i are:
+ *
+ * i-1: ... x <= fChoiceLimits[i]
+ * i: fChoiceLimits[i] < x ...
+ *
+ * Because of the nature of interval 0, fClosures[0] has no
+ * effect.
+
+ */
+ double* fChoiceLimits;
+ UBool* fClosures;
+ UnicodeString* fChoiceFormats;
+ int32_t fCount;
+};
+
+inline UnicodeString&
+ChoiceFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ // Don't use Format:: - use immediate base class only,
+ // in case immediate base modifies behavior later.
+ return NumberFormat::format(obj, appendTo, status);
+}
+
+inline UnicodeString&
+ChoiceFormat::format(double number,
+ UnicodeString& appendTo) const {
+ return NumberFormat::format(number, appendTo);
+}
+
+inline UnicodeString&
+ChoiceFormat::format(int32_t number,
+ UnicodeString& appendTo) const {
+ return NumberFormat::format(number, appendTo);
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _CHOICFMT
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/coleitr.h b/Build/source/libs/icu-xetex/i18n/unicode/coleitr.h
new file mode 100644
index 00000000000..51b5d2887d9
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/coleitr.h
@@ -0,0 +1,399 @@
+/*
+ ******************************************************************************
+ * Copyright (C) 1997-2005, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ ******************************************************************************
+ */
+
+/**
+* File coleitr.h
+*
+*
+*
+* Created by: Helena Shih
+*
+* Modification History:
+*
+* Date Name Description
+*
+* 8/18/97 helena Added internal API documentation.
+* 08/03/98 erm Synched with 1.2 version CollationElementIterator.java
+* 12/10/99 aliu Ported Thai collation support from Java.
+* 01/25/01 swquek Modified into a C++ wrapper calling C APIs (ucoliter.h)
+* 02/19/01 swquek Removed CollationElementsIterator() since it is
+* private constructor and no calls are made to it
+*/
+
+#ifndef COLEITR_H
+#define COLEITR_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Collation Element Iterator.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/uobject.h"
+#include "unicode/tblcoll.h"
+#include "unicode/ucoleitr.h"
+
+/**
+ * The UCollationElements struct.
+ * For usage in C programs.
+ * @stable ICU 2.0
+ */
+typedef struct UCollationElements UCollationElements;
+
+U_NAMESPACE_BEGIN
+
+/**
+* The CollationElementIterator class is used as an iterator to walk through
+* each character of an international string. Use the iterator to return the
+* ordering priority of the positioned character. The ordering priority of a
+* character, which we refer to as a key, defines how a character is collated in
+* the given collation object.
+* For example, consider the following in Spanish:
+* <pre>
+* "ca" -> the first key is key('c') and second key is key('a').
+* "cha" -> the first key is key('ch') and second key is key('a').</pre>
+* And in German,
+* <pre> \htmlonly "&#x00E6;b"-> the first key is key('a'), the second key is key('e'), and
+* the third key is key('b'). \endhtmlonly </pre>
+* The key of a character, is an integer composed of primary order(short),
+* secondary order(char), and tertiary order(char). Java strictly defines the
+* size and signedness of its primitive data types. Therefore, the static
+* functions primaryOrder(), secondaryOrder(), and tertiaryOrder() return
+* int32_t to ensure the correctness of the key value.
+* <p>Example of the iterator usage: (without error checking)
+* <pre>
+* \code
+* void CollationElementIterator_Example()
+* {
+* UnicodeString str = "This is a test";
+* UErrorCode success = U_ZERO_ERROR;
+* RuleBasedCollator* rbc =
+* (RuleBasedCollator*) RuleBasedCollator::createInstance(success);
+* CollationElementIterator* c =
+* rbc->createCollationElementIterator( str );
+* int32_t order = c->next(success);
+* c->reset();
+* order = c->previous(success);
+* delete c;
+* delete rbc;
+* }
+* \endcode
+* </pre>
+* <p>
+* CollationElementIterator::next returns the collation order of the next
+* character based on the comparison level of the collator.
+* CollationElementIterator::previous returns the collation order of the
+* previous character based on the comparison level of the collator.
+* The Collation Element Iterator moves only in one direction between calls to
+* CollationElementIterator::reset. That is, CollationElementIterator::next()
+* and CollationElementIterator::previous can not be inter-used. Whenever
+* CollationElementIterator::previous is to be called after
+* CollationElementIterator::next() or vice versa,
+* CollationElementIterator::reset has to be called first to reset the status,
+* shifting pointers to either the end or the start of the string. Hence at the
+* next call of CollationElementIterator::previous or
+* CollationElementIterator::next(), the first or last collation order will be
+* returned.
+* If a change of direction is done without a CollationElementIterator::reset(),
+* the result is undefined.
+* The result of a forward iterate (CollationElementIterator::next) and
+* reversed result of the backward iterate (CollationElementIterator::previous)
+* on the same string are equivalent, if collation orders with the value
+* UCOL_IGNORABLE are ignored.
+* Character based on the comparison level of the collator. A collation order
+* consists of primary order, secondary order and tertiary order. The data
+* type of the collation order is <strong>t_int32</strong>.
+*
+* Note, CollationElementIterator should not be subclassed.
+* @see Collator
+* @see RuleBasedCollator
+* @version 1.8 Jan 16 2001
+*/
+class U_I18N_API CollationElementIterator : public UObject {
+public:
+
+ // CollationElementIterator public data member ------------------------------
+
+ enum {
+ /**
+ * NULLORDER indicates that an error has occured while processing
+ * @stable ICU 2.0
+ */
+ NULLORDER = (int32_t)0xffffffff
+ };
+
+ // CollationElementIterator public constructor/destructor -------------------
+
+ /**
+ * Copy constructor.
+ *
+ * @param other the object to be copied from
+ * @stable ICU 2.0
+ */
+ CollationElementIterator(const CollationElementIterator& other);
+
+ /**
+ * Destructor
+ * @stable ICU 2.0
+ */
+ virtual ~CollationElementIterator();
+
+ // CollationElementIterator public methods ----------------------------------
+
+ /**
+ * Returns true if "other" is the same as "this"
+ *
+ * @param other the object to be compared
+ * @return true if "other" is the same as "this"
+ * @stable ICU 2.0
+ */
+ UBool operator==(const CollationElementIterator& other) const;
+
+ /**
+ * Returns true if "other" is not the same as "this".
+ *
+ * @param other the object to be compared
+ * @return true if "other" is not the same as "this"
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const CollationElementIterator& other) const;
+
+ /**
+ * Resets the cursor to the beginning of the string.
+ * @stable ICU 2.0
+ */
+ void reset(void);
+
+ /**
+ * Gets the ordering priority of the next character in the string.
+ * @param status the error code status.
+ * @return the next character's ordering. otherwise returns NULLORDER if an
+ * error has occured or if the end of string has been reached
+ * @stable ICU 2.0
+ */
+ int32_t next(UErrorCode& status);
+
+ /**
+ * Get the ordering priority of the previous collation element in the string.
+ * @param status the error code status.
+ * @return the previous element's ordering. otherwise returns NULLORDER if an
+ * error has occured or if the start of string has been reached
+ * @stable ICU 2.0
+ */
+ int32_t previous(UErrorCode& status);
+
+ /**
+ * Gets the primary order of a collation order.
+ * @param order the collation order
+ * @return the primary order of a collation order.
+ * @stable ICU 2.0
+ */
+ static inline int32_t primaryOrder(int32_t order);
+
+ /**
+ * Gets the secondary order of a collation order.
+ * @param order the collation order
+ * @return the secondary order of a collation order.
+ * @stable ICU 2.0
+ */
+ static inline int32_t secondaryOrder(int32_t order);
+
+ /**
+ * Gets the tertiary order of a collation order.
+ * @param order the collation order
+ * @return the tertiary order of a collation order.
+ * @stable ICU 2.0
+ */
+ static inline int32_t tertiaryOrder(int32_t order);
+
+ /**
+ * Return the maximum length of any expansion sequences that end with the
+ * specified comparison order.
+ * @param order a collation order returned by previous or next.
+ * @return maximum size of the expansion sequences ending with the collation
+ * element or 1 if collation element does not occur at the end of any
+ * expansion sequence
+ * @stable ICU 2.0
+ */
+ int32_t getMaxExpansion(int32_t order) const;
+
+ /**
+ * Gets the comparison order in the desired strength. Ignore the other
+ * differences.
+ * @param order The order value
+ * @stable ICU 2.0
+ */
+ int32_t strengthOrder(int32_t order) const;
+
+ /**
+ * Sets the source string.
+ * @param str the source string.
+ * @param status the error code status.
+ * @stable ICU 2.0
+ */
+ void setText(const UnicodeString& str, UErrorCode& status);
+
+ /**
+ * Sets the source string.
+ * @param str the source character iterator.
+ * @param status the error code status.
+ * @stable ICU 2.0
+ */
+ void setText(CharacterIterator& str, UErrorCode& status);
+
+ /**
+ * Checks if a comparison order is ignorable.
+ * @param order the collation order.
+ * @return TRUE if a character is ignorable, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+ static inline UBool isIgnorable(int32_t order);
+
+ /**
+ * Gets the offset of the currently processed character in the source string.
+ * @return the offset of the character.
+ * @stable ICU 2.0
+ */
+ int32_t getOffset(void) const;
+
+ /**
+ * Sets the offset of the currently processed character in the source string.
+ * @param newOffset the new offset.
+ * @param status the error code status.
+ * @return the offset of the character.
+ * @stable ICU 2.0
+ */
+ void setOffset(int32_t newOffset, UErrorCode& status);
+
+ /**
+ * 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();
+
+protected:
+
+ // CollationElementIterator protected constructors --------------------------
+ /**
+ * @stable ICU 2.0
+ */
+ friend class RuleBasedCollator;
+
+ /**
+ * CollationElementIterator constructor. This takes the source string and the
+ * collation object. The cursor will walk thru the source string based on the
+ * predefined collation rules. If the source string is empty, NULLORDER will
+ * be returned on the calls to next().
+ * @param sourceText the source string.
+ * @param order the collation object.
+ * @param status the error code status.
+ * @stable ICU 2.0
+ */
+ CollationElementIterator(const UnicodeString& sourceText,
+ const RuleBasedCollator* order, UErrorCode& status);
+
+ /**
+ * CollationElementIterator constructor. This takes the source string and the
+ * collation object. The cursor will walk thru the source string based on the
+ * predefined collation rules. If the source string is empty, NULLORDER will
+ * be returned on the calls to next().
+ * @param sourceText the source string.
+ * @param order the collation object.
+ * @param status the error code status.
+ * @stable ICU 2.0
+ */
+ CollationElementIterator(const CharacterIterator& sourceText,
+ const RuleBasedCollator* order, UErrorCode& status);
+
+ // CollationElementIterator protected methods -------------------------------
+
+ /**
+ * Assignment operator
+ *
+ * @param other the object to be copied
+ * @stable ICU 2.0
+ */
+ const CollationElementIterator&
+ operator=(const CollationElementIterator& other);
+
+private:
+ CollationElementIterator(); // default constructor not implemented
+
+ // CollationElementIterator private data members ----------------------------
+
+ /**
+ * Data wrapper for collation elements
+ */
+ UCollationElements *m_data_;
+
+ /**
+ * Indicates if m_data_ belongs to this object.
+ */
+ UBool isDataOwned_;
+
+};
+
+// CollationElementIterator inline method defination --------------------------
+
+/**
+* Get the primary order of a collation order.
+* @param order the collation order
+* @return the primary order of a collation order.
+*/
+inline int32_t CollationElementIterator::primaryOrder(int32_t order)
+{
+ order &= RuleBasedCollator::PRIMARYORDERMASK;
+ return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
+}
+
+/**
+* Get the secondary order of a collation order.
+* @param order the collation order
+* @return the secondary order of a collation order.
+*/
+inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
+{
+ order = order & RuleBasedCollator::SECONDARYORDERMASK;
+ return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
+}
+
+/**
+* Get the tertiary order of a collation order.
+* @param order the collation order
+* @return the tertiary order of a collation order.
+*/
+inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
+{
+ return (order &= RuleBasedCollator::TERTIARYORDERMASK);
+}
+
+inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
+{
+ return ucol_getMaxExpansion(m_data_, (uint32_t)order);
+}
+
+inline UBool CollationElementIterator::isIgnorable(int32_t order)
+{
+ return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/coll.h b/Build/source/libs/icu-xetex/i18n/unicode/coll.h
new file mode 100644
index 00000000000..c3ebca16f23
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/coll.h
@@ -0,0 +1,1035 @@
+/*
+******************************************************************************
+* Copyright (C) 1996-2007, International Business Machines *
+* Corporation and others. All Rights Reserved. *
+******************************************************************************
+*/
+
+/**
+* File coll.h
+*
+* Created by: Helena Shih
+*
+* Modification History:
+*
+* Date Name Description
+* 02/5/97 aliu Modified createDefault to load collation data from
+* binary files when possible. Added related methods
+* createCollationFromFile, chopLocale, createPathName.
+* 02/11/97 aliu Added members addToCache, findInCache, and fgCache.
+* 02/12/97 aliu Modified to create objects from RuleBasedCollator cache.
+* Moved cache out of Collation class.
+* 02/13/97 aliu Moved several methods out of this class and into
+* RuleBasedCollator, with modifications. Modified
+* createDefault() to call new RuleBasedCollator(Locale&)
+* constructor. General clean up and documentation.
+* 02/20/97 helena Added clone, operator==, operator!=, operator=, copy
+* constructor and getDynamicClassID.
+* 03/25/97 helena Updated with platform independent data types.
+* 05/06/97 helena Added memory allocation error detection.
+* 06/20/97 helena Java class name change.
+* 09/03/97 helena Added createCollationKeyValues().
+* 02/10/98 damiba Added compare() with length as parameter.
+* 04/23/99 stephen Removed EDecompositionMode, merged with
+* Normalizer::EMode.
+* 11/02/99 helena Collator performance enhancements. Eliminates the
+* UnicodeString construction and special case for NO_OP.
+* 11/23/99 srl More performance enhancements. Inlining of
+* critical accessors.
+* 05/15/00 helena Added version information API.
+* 01/29/01 synwee Modified into a C++ wrapper which calls C apis
+* (ucoll.h).
+*/
+
+#ifndef COLL_H
+#define COLL_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Collation Service.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/uobject.h"
+#include "unicode/ucol.h"
+#include "unicode/normlzr.h"
+#include "unicode/locid.h"
+#include "unicode/uniset.h"
+#include "unicode/umisc.h"
+
+U_NAMESPACE_BEGIN
+
+class StringEnumeration;
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * @stable ICU 2.6
+ */
+class CollatorFactory;
+#endif
+
+/**
+* @stable ICU 2.0
+*/
+class CollationKey;
+
+/**
+* The <code>Collator</code> class performs locale-sensitive string
+* comparison.<br>
+* You use this class to build searching and sorting routines for natural
+* language text.<br>
+* <em>Important: </em>The ICU collation service has been reimplemented
+* in order to achieve better performance and UCA compliance.
+* For details, see the
+* <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+* collation design document</a>.
+* <p>
+* <code>Collator</code> is an abstract base class. Subclasses implement
+* specific collation strategies. One subclass,
+* <code>RuleBasedCollator</code>, is currently provided and is applicable
+* to a wide set of languages. Other subclasses may be created to handle more
+* specialized needs.
+* <p>
+* Like other locale-sensitive classes, you can use the static factory method,
+* <code>createInstance</code>, to obtain the appropriate
+* <code>Collator</code> object for a given locale. You will only need to
+* look at the subclasses of <code>Collator</code> if you need to
+* understand the details of a particular collation strategy or if you need to
+* modify that strategy.
+* <p>
+* The following example shows how to compare two strings using the
+* <code>Collator</code> for the default locale.
+* \htmlonly<blockquote>\endhtmlonly
+* <pre>
+* \code
+* // Compare two strings in the default locale
+* UErrorCode success = U_ZERO_ERROR;
+* Collator* myCollator = Collator::createInstance(success);
+* if (myCollator->compare("abc", "ABC") < 0)
+* cout << "abc is less than ABC" << endl;
+* else
+* cout << "abc is greater than or equal to ABC" << endl;
+* \endcode
+* </pre>
+* \htmlonly</blockquote>\endhtmlonly
+* <p>
+* You can set a <code>Collator</code>'s <em>strength</em> property to
+* determine the level of difference considered significant in comparisons.
+* Five strengths are provided: <code>PRIMARY</code>, <code>SECONDARY</code>,
+* <code>TERTIARY</code>, <code>QUATERNARY</code> and <code>IDENTICAL</code>.
+* The exact assignment of strengths to language features is locale dependant.
+* For example, in Czech, "e" and "f" are considered primary differences,
+* while "e" and "\u00EA" are secondary differences, "e" and "E" are tertiary
+* differences and "e" and "e" are identical. The following shows how both case
+* and accents could be ignored for US English.
+* \htmlonly<blockquote>\endhtmlonly
+* <pre>
+* \code
+* //Get the Collator for US English and set its strength to PRIMARY
+* UErrorCode success = U_ZERO_ERROR;
+* Collator* usCollator = Collator::createInstance(Locale::US, success);
+* usCollator->setStrength(Collator::PRIMARY);
+* if (usCollator->compare("abc", "ABC") == 0)
+* cout << "'abc' and 'ABC' strings are equivalent with strength PRIMARY" << endl;
+* \endcode
+* </pre>
+* \htmlonly</blockquote>\endhtmlonly
+* <p>
+* For comparing strings exactly once, the <code>compare</code> method
+* provides the best performance. When sorting a list of strings however, it
+* is generally necessary to compare each string multiple times. In this case,
+* sort keys provide better performance. The <code>getSortKey</code> methods
+* convert a string to a series of bytes that can be compared bitwise against
+* other sort keys using <code>strcmp()</code>. Sort keys are written as
+* zero-terminated byte strings. They consist of several substrings, one for
+* each collation strength level, that are delimited by 0x01 bytes.
+* If the string code points are appended for UCOL_IDENTICAL, then they are
+* processed for correct code point order comparison and may contain 0x01
+* bytes but not zero bytes.
+* </p>
+* <p>
+* An older set of APIs returns a <code>CollationKey</code> object that wraps
+* the sort key bytes instead of returning the bytes themselves.
+* Its use is deprecated, but it is still available for compatibility with
+* Java.
+* </p>
+* <p>
+* <strong>Note:</strong> <code>Collator</code>s with different Locale,
+* and CollationStrength settings will return different sort
+* orders for the same set of strings. Locales have specific collation rules,
+* and the way in which secondary and tertiary differences are taken into
+* account, for example, will result in a different sorting order for same
+* strings.
+* </p>
+* @see RuleBasedCollator
+* @see CollationKey
+* @see CollationElementIterator
+* @see Locale
+* @see Normalizer
+* @version 2.0 11/15/01
+*/
+
+class U_I18N_API Collator : public UObject {
+public:
+
+ // Collator public enums -----------------------------------------------
+
+ /**
+ * Base letter represents a primary difference. Set comparison level to
+ * PRIMARY to ignore secondary and tertiary differences.<br>
+ * Use this to set the strength of a Collator object.<br>
+ * Example of primary difference, "abc" &lt; "abd"
+ *
+ * Diacritical differences on the same base letter represent a secondary
+ * difference. Set comparison level to SECONDARY to ignore tertiary
+ * differences. Use this to set the strength of a Collator object.<br>
+ * Example of secondary difference, "&auml;" >> "a".
+ *
+ * Uppercase and lowercase versions of the same character represents a
+ * tertiary difference. Set comparison level to TERTIARY to include all
+ * comparison differences. Use this to set the strength of a Collator
+ * object.<br>
+ * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
+ *
+ * Two characters are considered "identical" when they have the same unicode
+ * spellings.<br>
+ * For example, "&auml;" == "&auml;".
+ *
+ * UCollationStrength is also used to determine the strength of sort keys
+ * generated from Collator objects.
+ * @stable ICU 2.0
+ */
+ enum ECollationStrength
+ {
+ PRIMARY = 0,
+ SECONDARY = 1,
+ TERTIARY = 2,
+ QUATERNARY = 3,
+ IDENTICAL = 15
+ };
+
+ /**
+ * LESS is returned if source string is compared to be less than target
+ * string in the compare() method.
+ * EQUAL is returned if source string is compared to be equal to target
+ * string in the compare() method.
+ * GREATER is returned if source string is compared to be greater than
+ * target string in the compare() method.
+ * @see Collator#compare
+ * @deprecated ICU 2.6. Use C enum UCollationResult defined in ucol.h
+ */
+ enum EComparisonResult
+ {
+ LESS = -1,
+ EQUAL = 0,
+ GREATER = 1
+ };
+
+ // Collator public destructor -----------------------------------------
+
+ /**
+ * Destructor
+ * @stable ICU 2.0
+ */
+ virtual ~Collator();
+
+ // Collator public methods --------------------------------------------
+
+ /**
+ * Returns true if "other" is the same as "this"
+ * @param other Collator object to be compared
+ * @return true if other is the same as this.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Collator& other) const;
+
+ /**
+ * Returns true if "other" is not the same as "this".
+ * @param other Collator object to be compared
+ * @return true if other is not the same as this.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator!=(const Collator& other) const;
+
+ /**
+ * Makes a shallow copy of the current object.
+ * @return a copy of this object
+ * @stable ICU 2.0
+ */
+ virtual Collator* clone(void) const = 0;
+
+ /**
+ * Creates the Collator object for the current default locale.
+ * The default locale is determined by Locale::getDefault.
+ * The UErrorCode& err parameter is used to return status information to the user.
+ * To check whether the construction succeeded or not, you should check the
+ * value of U_SUCCESS(err). If you wish more detailed information, you can
+ * check for informational error results which still indicate success.
+ * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For
+ * example, 'de_CH' was requested, but nothing was found there, so 'de' was
+ * used. U_USING_DEFAULT_ERROR indicates that the default locale data was
+ * used; neither the requested locale nor any of its fall back locales
+ * could be found.
+ * The caller owns the returned object and is responsible for deleting it.
+ *
+ * @param err the error code status.
+ * @return the collation object of the default locale.(for example, en_US)
+ * @see Locale#getDefault
+ * @stable ICU 2.0
+ */
+ static Collator* U_EXPORT2 createInstance(UErrorCode& err);
+
+ /**
+ * Gets the table-based collation object for the desired locale. The
+ * resource of the desired locale will be loaded by ResourceLoader.
+ * Locale::ENGLISH is the base collation table and all other languages are
+ * built on top of it with additional language-specific modifications.
+ * The UErrorCode& err parameter is used to return status information to the user.
+ * To check whether the construction succeeded or not, you should check
+ * the value of U_SUCCESS(err). If you wish more detailed information, you
+ * can check for informational error results which still indicate success.
+ * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For
+ * example, 'de_CH' was requested, but nothing was found there, so 'de' was
+ * used. U_USING_DEFAULT_ERROR indicates that the default locale data was
+ * used; neither the requested locale nor any of its fall back locales
+ * could be found.
+ * The caller owns the returned object and is responsible for deleting it.
+ * @param loc The locale ID for which to open a collator.
+ * @param err the error code status.
+ * @return the created table-based collation object based on the desired
+ * locale.
+ * @see Locale
+ * @see ResourceLoader
+ * @stable ICU 2.2
+ */
+ static Collator* U_EXPORT2 createInstance(const Locale& loc, UErrorCode& err);
+
+#ifdef U_USE_COLLATION_OBSOLETE_2_6
+ /**
+ * Create a Collator with a specific version.
+ * This is the same as createInstance(loc, err) except that getVersion() of
+ * the returned object is guaranteed to be the same as the version
+ * parameter.
+ * This is designed to be used to open the same collator for a given
+ * locale even when ICU is updated.
+ * The same locale and version guarantees the same sort keys and
+ * comparison results.
+ * <p>
+ * Note: this API will be removed in a future release. Use
+ * <tt>createInstance(const Locale&, UErrorCode&) instead.</tt></p>
+ *
+ * @param loc The locale ID for which to open a collator.
+ * @param version The requested collator version.
+ * @param err A reference to a UErrorCode,
+ * must not indicate a failure before calling this function.
+ * @return A pointer to a Collator, or 0 if an error occurred
+ * or a collator with the requested version is not available.
+ *
+ * @see getVersion
+ * @obsolete ICU 2.6
+ */
+ static Collator *createInstance(const Locale &loc, UVersionInfo version, UErrorCode &err);
+#endif
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different strings. Returns information about whether a string is less
+ * than, greater than or equal to another string.
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @return Returns a byte value. GREATER if source is greater
+ * than target; EQUAL if source is equal to target; LESS if source is less
+ * than target
+ * @deprecated ICU 2.6 use the overload with UErrorCode &
+ */
+ virtual EComparisonResult compare(const UnicodeString& source,
+ const UnicodeString& target) const;
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different strings. Returns information about whether a string is less
+ * than, greater than or equal to another string.
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source is greater
+ * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
+ * than target
+ * @stable ICU 2.6
+ */
+ virtual UCollationResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ UErrorCode &status) const = 0;
+
+ /**
+ * Does the same thing as compare but limits the comparison to a specified
+ * length
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @param length the length the comparison is limited to
+ * @return Returns a byte value. GREATER if source (up to the specified
+ * length) is greater than target; EQUAL if source (up to specified
+ * length) is equal to target; LESS if source (up to the specified
+ * length) is less than target.
+ * @deprecated ICU 2.6 use the overload with UErrorCode &
+ */
+ virtual EComparisonResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ int32_t length) const;
+
+ /**
+ * Does the same thing as compare but limits the comparison to a specified
+ * length
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @param length the length the comparison is limited to
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source (up to the specified
+ * length) is greater than target; UCOL_EQUAL if source (up to specified
+ * length) is equal to target; UCOL_LESS if source (up to the specified
+ * length) is less than target.
+ * @stable ICU 2.6
+ */
+ virtual UCollationResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ int32_t length,
+ UErrorCode &status) const = 0;
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different string arrays. Returns information about whether a string array
+ * is less than, greater than or equal to another string array.
+ * @param source the source string array to be compared with.
+ * @param sourceLength the length of the source string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param target the string that is to be compared with the source string.
+ * @param targetLength the length of the target string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @return Returns a byte value. GREATER if source is greater than target;
+ * EQUAL if source is equal to target; LESS if source is less than
+ * target
+ * @deprecated ICU 2.6 use the overload with UErrorCode &
+ */
+ virtual EComparisonResult compare(const UChar* source, int32_t sourceLength,
+ const UChar* target, int32_t targetLength)
+ const;
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different string arrays. Returns information about whether a string array
+ * is less than, greater than or equal to another string array.
+ * @param source the source string array to be compared with.
+ * @param sourceLength the length of the source string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param target the string that is to be compared with the source string.
+ * @param targetLength the length of the target string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source is greater
+ * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
+ * than target
+ * @stable ICU 2.6
+ */
+ virtual UCollationResult compare(const UChar* source, int32_t sourceLength,
+ const UChar* target, int32_t targetLength,
+ UErrorCode &status) const = 0;
+
+ /**
+ * Transforms the string into a series of characters that can be compared
+ * with CollationKey::compareTo. It is not possible to restore the original
+ * string from the chars in the sort key. The generated sort key handles
+ * only a limited number of ignorable characters.
+ * <p>Use CollationKey::equals or CollationKey::compare to compare the
+ * generated sort keys.
+ * If the source string is null, a null collation key will be returned.
+ * @param source the source string to be transformed into a sort key.
+ * @param key the collation key to be filled in
+ * @param status the error code status.
+ * @return the collation key of the string based on the collation rules.
+ * @see CollationKey#compare
+ * @deprecated ICU 2.8 Use getSortKey(...) instead
+ */
+ virtual CollationKey& getCollationKey(const UnicodeString& source,
+ CollationKey& key,
+ UErrorCode& status) const = 0;
+
+ /**
+ * Transforms the string into a series of characters that can be compared
+ * with CollationKey::compareTo. It is not possible to restore the original
+ * string from the chars in the sort key. The generated sort key handles
+ * only a limited number of ignorable characters.
+ * <p>Use CollationKey::equals or CollationKey::compare to compare the
+ * generated sort keys.
+ * <p>If the source string is null, a null collation key will be returned.
+ * @param source the source string to be transformed into a sort key.
+ * @param sourceLength length of the collation key
+ * @param key the collation key to be filled in
+ * @param status the error code status.
+ * @return the collation key of the string based on the collation rules.
+ * @see CollationKey#compare
+ * @deprecated ICU 2.8 Use getSortKey(...) instead
+ */
+ virtual CollationKey& getCollationKey(const UChar*source,
+ int32_t sourceLength,
+ CollationKey& key,
+ UErrorCode& status) const = 0;
+ /**
+ * Generates the hash code for the collation object
+ * @stable ICU 2.0
+ */
+ virtual int32_t hashCode(void) const = 0;
+
+ /**
+ * Gets the locale of the Collator
+ *
+ * @param type can be either requested, valid or actual locale. For more
+ * information see the definition of ULocDataLocaleType in
+ * uloc.h
+ * @param status the error code status.
+ * @return locale where the collation data lives. If the collator
+ * was instantiated from rules, locale is empty.
+ * @deprecated ICU 2.8 This API is under consideration for revision
+ * in ICU 3.0.
+ */
+ virtual const Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const = 0;
+
+ /**
+ * Convenience method for comparing two strings based on the collation rules.
+ * @param source the source string to be compared with.
+ * @param target the target string to be compared with.
+ * @return true if the first string is greater than the second one,
+ * according to the collation rules. false, otherwise.
+ * @see Collator#compare
+ * @stable ICU 2.0
+ */
+ UBool greater(const UnicodeString& source, const UnicodeString& target)
+ const;
+
+ /**
+ * Convenience method for comparing two strings based on the collation rules.
+ * @param source the source string to be compared with.
+ * @param target the target string to be compared with.
+ * @return true if the first string is greater than or equal to the second
+ * one, according to the collation rules. false, otherwise.
+ * @see Collator#compare
+ * @stable ICU 2.0
+ */
+ UBool greaterOrEqual(const UnicodeString& source,
+ const UnicodeString& target) const;
+
+ /**
+ * Convenience method for comparing two strings based on the collation rules.
+ * @param source the source string to be compared with.
+ * @param target the target string to be compared with.
+ * @return true if the strings are equal according to the collation rules.
+ * false, otherwise.
+ * @see Collator#compare
+ * @stable ICU 2.0
+ */
+ UBool equals(const UnicodeString& source, const UnicodeString& target) const;
+
+ /**
+ * Determines the minimum strength that will be use in comparison or
+ * transformation.
+ * <p>E.g. with strength == SECONDARY, the tertiary difference is ignored
+ * <p>E.g. with strength == PRIMARY, the secondary and tertiary difference
+ * are ignored.
+ * @return the current comparison level.
+ * @see Collator#setStrength
+ * @deprecated ICU 2.6 Use getAttribute(UCOL_STRENGTH...) instead
+ */
+ virtual ECollationStrength getStrength(void) const = 0;
+
+ /**
+ * Sets the minimum strength to be used in comparison or transformation.
+ * <p>Example of use:
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * Collator*myCollation = Collator::createInstance(Locale::US, status);
+ * if (U_FAILURE(status)) return;
+ * myCollation->setStrength(Collator::PRIMARY);
+ * // result will be "abc" == "ABC"
+ * // tertiary differences will be ignored
+ * Collator::ComparisonResult result = myCollation->compare("abc", "ABC");
+ * \endcode
+ * </pre>
+ * @see Collator#getStrength
+ * @param newStrength the new comparison level.
+ * @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead
+ */
+ virtual void setStrength(ECollationStrength newStrength) = 0;
+
+ /**
+ * Get name of the object for the desired Locale, in the desired langauge
+ * @param objectLocale must be from getAvailableLocales
+ * @param displayLocale specifies the desired locale for output
+ * @param name the fill-in parameter of the return value
+ * @return display-able name of the object for the object locale in the
+ * desired language
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
+ const Locale& displayLocale,
+ UnicodeString& name);
+
+ /**
+ * Get name of the object for the desired Locale, in the langauge of the
+ * default locale.
+ * @param objectLocale must be from getAvailableLocales
+ * @param name the fill-in parameter of the return value
+ * @return name of the object for the desired locale in the default language
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
+ UnicodeString& name);
+
+ /**
+ * Get the set of Locales for which Collations are installed.
+ *
+ * <p>Note this does not include locales supported by registered collators.
+ * If collators might have been registered, use the overload of getAvailableLocales
+ * that returns a StringEnumeration.</p>
+ *
+ * @param count the output parameter of number of elements in the locale list
+ * @return the list of available locales for which collations are installed
+ * @stable ICU 2.0
+ */
+ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
+
+ /**
+ * Return a StringEnumeration over the locales available at the time of the call,
+ * including registered locales. If a severe error occurs (such as out of memory
+ * condition) this will return null. If there is no locale data, an empty enumeration
+ * will be returned.
+ * @return a StringEnumeration over the locales available at the time of the call
+ * @stable ICU 2.6
+ */
+ static StringEnumeration* U_EXPORT2 getAvailableLocales(void);
+
+ /**
+ * Create a string enumerator of all possible keywords that are relevant to
+ * collation. At this point, the only recognized keyword for this
+ * service is "collation".
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @stable ICU 3.0
+ */
+ static StringEnumeration* U_EXPORT2 getKeywords(UErrorCode& status);
+
+ /**
+ * Given a keyword, create a string enumeration of all values
+ * for that keyword that are currently in use.
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords. If any other keyword is passed in, status is set
+ * to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param status input-output error code
+ * @return a string enumeration over collation keyword values, or NULL
+ * upon error. The caller is responsible for deleting the result.
+ * @stable ICU 3.0
+ */
+ static StringEnumeration* U_EXPORT2 getKeywordValues(const char *keyword, UErrorCode& status);
+
+ /**
+ * Return the functionally equivalent locale for the given
+ * requested locale, with respect to given keyword, for the
+ * collation service. If two locales return the same result, then
+ * collators instantiated for these locales will behave
+ * equivalently. The converse is not always true; two collators
+ * may in fact be equivalent, but return different results, due to
+ * internal details. The return result has no other meaning than
+ * that stated above, and implies nothing as to the relationship
+ * between the two locales. This is intended for use by
+ * applications who wish to cache collators, or otherwise reuse
+ * collators when possible. The functional equivalent may change
+ * over time. For more information, please see the <a
+ * href="http://icu-project.org/userguide/locale.html#services">
+ * Locales and Services</a> section of the ICU User Guide.
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords.
+ * @param locale the requested locale
+ * @param isAvailable reference to a fillin parameter that
+ * indicates whether the requested locale was 'available' to the
+ * collation service. A locale is defined as 'available' if it
+ * physically exists within the collation locale data.
+ * @param status reference to input-output error code
+ * @return the functionally equivalent collation locale, or the root
+ * locale upon error.
+ * @stable ICU 3.0
+ */
+ static Locale U_EXPORT2 getFunctionalEquivalent(const char* keyword, const Locale& locale,
+ UBool& isAvailable, UErrorCode& status);
+
+#if !UCONFIG_NO_SERVICE
+ /**
+ * Register a new Collator. The collator will be adopted.
+ * @param toAdopt the Collator instance to be adopted
+ * @param locale the locale with which the collator will be associated
+ * @param status the in/out status code, no special meanings are assigned
+ * @return a registry key that can be used to unregister this collator
+ * @stable ICU 2.6
+ */
+ static URegistryKey U_EXPORT2 registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& status);
+
+ /**
+ * Register a new CollatorFactory. The factory will be adopted.
+ * @param toAdopt the CollatorFactory instance to be adopted
+ * @param status the in/out status code, no special meanings are assigned
+ * @return a registry key that can be used to unregister this collator
+ * @stable ICU 2.6
+ */
+ static URegistryKey U_EXPORT2 registerFactory(CollatorFactory* toAdopt, UErrorCode& status);
+
+ /**
+ * Unregister a previously-registered Collator or CollatorFactory
+ * using the key returned from the register call. Key becomes
+ * invalid after a successful call and should not be used again.
+ * The object corresponding to the key will be deleted.
+ * @param key the registry key returned by a previous call to registerInstance
+ * @param status the in/out status code, no special meanings are assigned
+ * @return TRUE if the collator for the key was successfully unregistered
+ * @stable ICU 2.6
+ */
+ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
+#endif /* UCONFIG_NO_SERVICE */
+
+ /**
+ * Gets the version information for a Collator.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+ virtual void getVersion(UVersionInfo info) const = 0;
+
+ /**
+ * 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.
+ * @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(void) const = 0;
+
+ /**
+ * Universal attribute setter
+ * @param attr attribute type
+ * @param value attribute value
+ * @param status to indicate whether the operation went on smoothly or
+ * there were errors
+ * @stable ICU 2.2
+ */
+ virtual void setAttribute(UColAttribute attr, UColAttributeValue value,
+ UErrorCode &status) = 0;
+
+ /**
+ * Universal attribute getter
+ * @param attr attribute type
+ * @param status to indicate whether the operation went on smoothly or
+ * there were errors
+ * @return attribute value
+ * @stable ICU 2.2
+ */
+ virtual UColAttributeValue getAttribute(UColAttribute attr,
+ UErrorCode &status) = 0;
+
+ /**
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param varTop one or more (if contraction) UChars to which the variable top should be set
+ * @param len length of variable top string. If -1 it is considered to be zero terminated.
+ * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
+ * @stable ICU 2.0
+ */
+ virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status) = 0;
+
+ /**
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param varTop an UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set
+ * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
+ * @stable ICU 2.0
+ */
+ virtual uint32_t setVariableTop(const UnicodeString varTop, UErrorCode &status) = 0;
+
+ /**
+ * Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits.
+ * Lower 16 bits are ignored.
+ * @param varTop CE value, as returned by setVariableTop or ucol)getVariableTop
+ * @param status error code (not changed by function)
+ * @stable ICU 2.0
+ */
+ virtual void setVariableTop(const uint32_t varTop, UErrorCode &status) = 0;
+
+ /**
+ * Gets the variable top value of a Collator.
+ * Lower 16 bits are undefined and should be ignored.
+ * @param status error code (not changed by function). If error code is set, the return value is undefined.
+ * @stable ICU 2.0
+ */
+ virtual uint32_t getVariableTop(UErrorCode &status) const = 0;
+
+ /**
+ * Get an UnicodeSet that contains all the characters and sequences
+ * tailored in this collator.
+ * @param status error code of the operation
+ * @return a pointer to a UnicodeSet object containing all the
+ * code points and sequences that may sort differently than
+ * in the UCA. The object must be disposed of by using delete
+ * @stable ICU 2.4
+ */
+ virtual UnicodeSet *getTailoredSet(UErrorCode &status) const;
+
+
+ /**
+ * Thread safe cloning operation
+ * @return pointer to the new clone, user should remove it.
+ * @stable ICU 2.2
+ */
+ virtual Collator* safeClone(void) = 0;
+
+ /**
+ * Get the sort key as an array of bytes from an UnicodeString.
+ * Sort key byte arrays are zero-terminated and can be compared using
+ * strcmp().
+ * @param source string to be processed.
+ * @param result buffer to store result in. If NULL, number of bytes needed
+ * will be returned.
+ * @param resultLength length of the result buffer. If if not enough the
+ * buffer will be filled to capacity.
+ * @return Number of bytes needed for storing the sort key
+ * @stable ICU 2.2
+ */
+ virtual int32_t getSortKey(const UnicodeString& source,
+ uint8_t* result,
+ int32_t resultLength) const = 0;
+
+ /**
+ * Get the sort key as an array of bytes from an UChar buffer.
+ * Sort key byte arrays are zero-terminated and can be compared using
+ * strcmp().
+ * @param source string to be processed.
+ * @param sourceLength length of string to be processed.
+ * If -1, the string is 0 terminated and length will be decided by the
+ * function.
+ * @param result buffer to store result in. If NULL, number of bytes needed
+ * will be returned.
+ * @param resultLength length of the result buffer. If if not enough the
+ * buffer will be filled to capacity.
+ * @return Number of bytes needed for storing the sort key
+ * @stable ICU 2.2
+ */
+ virtual int32_t getSortKey(const UChar*source, int32_t sourceLength,
+ uint8_t*result, int32_t resultLength) const = 0;
+
+ /**
+ * Produce a bound for a given sortkey and a number of levels.
+ * Return value is always the number of bytes needed, regardless of
+ * whether the result buffer was big enough or even valid.<br>
+ * Resulting bounds can be used to produce a range of strings that are
+ * between upper and lower bounds. For example, if bounds are produced
+ * for a sortkey of string "smith", strings between upper and lower
+ * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
+ * is produced, strings matched would be as above. However, if bound
+ * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
+ * also match "Smithsonian" and similar.<br>
+ * For more on usage, see example in cintltst/capitst.c in procedure
+ * TestBounds.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param source The source sortkey.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * (If an unmodified sortkey is passed, it is always null
+ * terminated).
+ * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
+ * produces a lower inclusive bound, UCOL_BOUND_UPPER, that
+ * produces upper bound that matches strings of the same length
+ * or UCOL_BOUND_UPPER_LONG that matches strings that have the
+ * same starting substring as the source string.
+ * @param noOfLevels Number of levels required in the resulting bound (for most
+ * uses, the recommended value is 1). See users guide for
+ * explanation on number of levels a sortkey can have.
+ * @param result A pointer to a buffer to receive the resulting sortkey.
+ * @param resultLength The maximum size of result.
+ * @param status Used for returning error code if something went wrong. If the
+ * number of levels requested is higher than the number of levels
+ * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
+ * issued.
+ * @return The size needed to fully store the bound.
+ * @see ucol_keyHashCode
+ * @stable ICU 2.1
+ */
+ static int32_t U_EXPORT2 getBound(const uint8_t *source,
+ int32_t sourceLength,
+ UColBoundMode boundType,
+ uint32_t noOfLevels,
+ uint8_t *result,
+ int32_t resultLength,
+ UErrorCode &status);
+
+
+protected:
+
+ // Collator protected constructors -------------------------------------
+
+ /**
+ * Default constructor.
+ * Constructor is different from the old default Collator constructor.
+ * The task for determing the default collation strength and normalization
+ * mode is left to the child class.
+ * @stable ICU 2.0
+ */
+ Collator();
+
+ /**
+ * Constructor.
+ * Empty constructor, does not handle the arguments.
+ * This constructor is done for backward compatibility with 1.7 and 1.8.
+ * The task for handling the argument collation strength and normalization
+ * mode is left to the child class.
+ * @param collationStrength collation strength
+ * @param decompositionMode
+ * @deprecated ICU 2.4. Subclasses should use the default constructor
+ * instead and handle the strength and normalization mode themselves.
+ */
+ Collator(UCollationStrength collationStrength,
+ UNormalizationMode decompositionMode);
+
+ /**
+ * Copy constructor.
+ * @param other Collator object to be copied from
+ * @stable ICU 2.0
+ */
+ Collator(const Collator& other);
+
+ // Collator protected methods -----------------------------------------
+
+
+ /**
+ * Used internally by registraton to define the requested and valid locales.
+ * @param requestedLocale the requsted locale
+ * @param validLocale the valid locale
+ * @internal
+ */
+ virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale);
+
+public:
+#if !UCONFIG_NO_SERVICE
+ /**
+ * used only by ucol_open, not for public use
+ * @internal
+ */
+ static UCollator* createUCollator(const char* loc, UErrorCode* status);
+#endif
+private:
+ /**
+ * Assignment operator. Private for now.
+ * @internal
+ */
+ Collator& operator=(const Collator& other);
+
+ friend class CFactory;
+ friend class SimpleCFactory;
+ friend class ICUCollatorFactory;
+ friend class ICUCollatorService;
+ static Collator* makeInstance(const Locale& desiredLocale,
+ UErrorCode& status);
+
+ // Collator private data members ---------------------------------------
+
+ /*
+ synwee : removed as attributes to be handled by child class
+ UCollationStrength strength;
+ Normalizer::EMode decmp;
+ */
+ /* This is useless information */
+/* static const UVersionInfo fVersion;*/
+};
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * A factory, used with registerFactory, the creates multiple collators and provides
+ * display names for them. A factory supports some number of locales-- these are the
+ * locales for which it can create collators. The factory can be visible, in which
+ * case the supported locales will be enumerated by getAvailableLocales, or invisible,
+ * in which they are not. Invisible locales are still supported, they are just not
+ * listed by getAvailableLocales.
+ * <p>
+ * If standard locale display names are sufficient, Collator instances can
+ * be registered using registerInstance instead.</p>
+ * <p>
+ * Note: if the collators are to be used from C APIs, they must be instances
+ * of RuleBasedCollator.</p>
+ *
+ * @stable ICU 2.6
+ */
+class U_I18N_API CollatorFactory : public UObject {
+public:
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~CollatorFactory();
+
+ /**
+ * Return true if this factory is visible. Default is true.
+ * If not visible, the locales supported by this factory will not
+ * be listed by getAvailableLocales.
+ * @return true if the factory is visible.
+ * @stable ICU 2.6
+ */
+ virtual UBool visible(void) const;
+
+ /**
+ * Return a collator for the provided locale. If the locale
+ * is not supported, return NULL.
+ * @param loc the locale identifying the collator to be created.
+ * @return a new collator if the locale is supported, otherwise NULL.
+ * @stable ICU 2.6
+ */
+ virtual Collator* createCollator(const Locale& loc) = 0;
+
+ /**
+ * Return the name of the collator for the objectLocale, localized for the displayLocale.
+ * If objectLocale is not supported, or the factory is not visible, set the result string
+ * to bogus.
+ * @param objectLocale the locale identifying the collator
+ * @param displayLocale the locale for which the display name of the collator should be localized
+ * @param result an output parameter for the display name, set to bogus if not supported.
+ * @return the display name
+ * @stable ICU 2.6
+ */
+ virtual UnicodeString& getDisplayName(const Locale& objectLocale,
+ const Locale& displayLocale,
+ UnicodeString& result);
+
+ /**
+ * Return an array of all the locale names directly supported by this factory.
+ * The number of names is returned in count. This array is owned by the factory.
+ * Its contents must never change.
+ * @param count output parameter for the number of locales supported by the factory
+ * @param status the in/out error code
+ * @return a pointer to an array of count UnicodeStrings.
+ * @stable ICU 2.6
+ */
+ virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) = 0;
+};
+#endif /* UCONFIG_NO_SERVICE */
+
+// Collator inline methods -----------------------------------------------
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/curramt.h b/Build/source/libs/icu-xetex/i18n/unicode/curramt.h
new file mode 100644
index 00000000000..c33e6f1f833
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/curramt.h
@@ -0,0 +1,130 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: April 26, 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef __CURRENCYAMOUNT_H__
+#define __CURRENCYAMOUNT_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/measure.h"
+#include "unicode/currunit.h"
+
+/**
+ * \file
+ * \brief C++ API: Currency Amount Object.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ *
+ * A currency together with a numeric amount, such as 200 USD.
+ *
+ * @author Alan Liu
+ * @stable ICU 3.0
+ */
+class U_I18N_API CurrencyAmount: public Measure {
+ public:
+ /**
+ * Construct an object with the given numeric amount and the given
+ * ISO currency code.
+ * @param amount a numeric object; amount.isNumeric() must be TRUE
+ * @param isoCode the 3-letter ISO 4217 currency code; must not be
+ * NULL and must have length 3
+ * @param ec input-output error code. If the amount or the isoCode
+ * is invalid, then this will be set to a failing value.
+ * @stable ICU 3.0
+ */
+ CurrencyAmount(const Formattable& amount, const UChar* isoCode,
+ UErrorCode &ec);
+
+ /**
+ * Construct an object with the given numeric amount and the given
+ * ISO currency code.
+ * @param amount the amount of the given currency
+ * @param isoCode the 3-letter ISO 4217 currency code; must not be
+ * NULL and must have length 3
+ * @param ec input-output error code. If the isoCode is invalid,
+ * then this will be set to a failing value.
+ * @stable ICU 3.0
+ */
+ CurrencyAmount(double amount, const UChar* isoCode,
+ UErrorCode &ec);
+
+ /**
+ * Copy constructor
+ * @stable ICU 3.0
+ */
+ CurrencyAmount(const CurrencyAmount& other);
+
+ /**
+ * Assignment operator
+ * @stable ICU 3.0
+ */
+ CurrencyAmount& operator=(const CurrencyAmount& other);
+
+ /**
+ * Return a polymorphic clone of this object. The result will
+ * have the same class as returned by getDynamicClassID().
+ * @stable ICU 3.0
+ */
+ virtual UObject* clone() const;
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~CurrencyAmount();
+
+ /**
+ * Returns a unique class ID for this object POLYMORPHICALLY.
+ * This method implements a simple form of RTTI used by ICU.
+ * @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 3.0
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * Returns the class ID for this class. This is used to compare to
+ * the return value of getDynamicClassID().
+ * @return The class ID for all objects of this class.
+ * @stable ICU 3.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+ /**
+ * Return the currency unit object of this object.
+ * @stable ICU 3.0
+ */
+ inline const CurrencyUnit& getCurrency() const;
+
+ /**
+ * Return the ISO currency code of this object.
+ * @stable ICU 3.0
+ */
+ inline const UChar* getISOCurrency() const;
+};
+
+inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
+ return (const CurrencyUnit&) getUnit();
+}
+
+inline const UChar* CurrencyAmount::getISOCurrency() const {
+ return getCurrency().getISOCurrency();
+}
+
+U_NAMESPACE_END
+
+#endif // !UCONFIG_NO_FORMATTING
+#endif // __CURRENCYAMOUNT_H__
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/currunit.h b/Build/source/libs/icu-xetex/i18n/unicode/currunit.h
new file mode 100644
index 00000000000..ecd94110292
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/currunit.h
@@ -0,0 +1,117 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: April 26, 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef __CURRENCYUNIT_H__
+#define __CURRENCYUNIT_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/measunit.h"
+
+/**
+ * \file
+ * \brief C++ API: Currency Unit Information.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese
+ * yen). This class is a thin wrapper over a UChar string that
+ * subclasses MeasureUnit, for use with Measure and MeasureFormat.
+ *
+ * @author Alan Liu
+ * @stable ICU 3.0
+ */
+class U_I18N_API CurrencyUnit: public MeasureUnit {
+ public:
+ /**
+ * Construct an object with the given ISO currency code.
+ * @param isoCode the 3-letter ISO 4217 currency code; must not be
+ * NULL and must have length 3
+ * @param ec input-output error code. If the isoCode is invalid,
+ * then this will be set to a failing value.
+ * @stable ICU 3.0
+ */
+ CurrencyUnit(const UChar* isoCode, UErrorCode &ec);
+
+ /**
+ * Copy constructor
+ * @stable ICU 3.0
+ */
+ CurrencyUnit(const CurrencyUnit& other);
+
+ /**
+ * Assignment operator
+ * @stable ICU 3.0
+ */
+ CurrencyUnit& operator=(const CurrencyUnit& other);
+
+ /**
+ * Return a polymorphic clone of this object. The result will
+ * have the same class as returned by getDynamicClassID().
+ * @stable ICU 3.0
+ */
+ virtual UObject* clone() const;
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~CurrencyUnit();
+
+ /**
+ * Equality operator. Return true if this object is equal
+ * to the given object.
+ * @stable ICU 3.0
+ */
+ UBool operator==(const UObject& other) const;
+
+ /**
+ * Returns a unique class ID for this object POLYMORPHICALLY.
+ * This method implements a simple form of RTTI used by ICU.
+ * @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 3.0
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * Returns the class ID for this class. This is used to compare to
+ * the return value of getDynamicClassID().
+ * @return The class ID for all objects of this class.
+ * @stable ICU 3.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+ /**
+ * Return the ISO currency code of this object.
+ * @stable ICU 3.0
+ */
+ inline const UChar* getISOCurrency() const;
+
+ private:
+ /**
+ * The ISO 4217 code of this object.
+ */
+ UChar isoCode[4];
+};
+
+inline const UChar* CurrencyUnit::getISOCurrency() const {
+ return isoCode;
+}
+
+U_NAMESPACE_END
+
+#endif // !UCONFIG_NO_FORMATTING
+#endif // __CURRENCYUNIT_H__
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/datefmt.h b/Build/source/libs/icu-xetex/i18n/unicode/datefmt.h
new file mode 100644
index 00000000000..0022a99791b
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/datefmt.h
@@ -0,0 +1,672 @@
+/*
+ ********************************************************************************
+ * Copyright (C) 1997-2007, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ ********************************************************************************
+ *
+ * File DATEFMT.H
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 02/19/97 aliu Converted from java.
+ * 04/01/97 aliu Added support for centuries.
+ * 07/23/98 stephen JDK 1.2 sync
+ * 11/15/99 weiv Added support for week of year/day of week formatting
+ ********************************************************************************
+ */
+
+#ifndef DATEFMT_H
+#define DATEFMT_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/udat.h"
+#include "unicode/calendar.h"
+#include "unicode/numfmt.h"
+#include "unicode/format.h"
+#include "unicode/locid.h"
+
+/**
+ * \file
+ * \brief C++ API: Abstract class for converting dates.
+ */
+
+U_NAMESPACE_BEGIN
+
+class TimeZone;
+
+/**
+ * DateFormat is an abstract class for a family of classes that convert dates and
+ * times from their internal representations to textual form and back again in a
+ * language-independent manner. Converting from the internal representation (milliseconds
+ * since midnight, January 1, 1970) to text is known as "formatting," and converting
+ * from text to millis is known as "parsing." We currently define only one concrete
+ * subclass of DateFormat: SimpleDateFormat, which can handle pretty much all normal
+ * date formatting and parsing actions.
+ * <P>
+ * DateFormat helps you to format and parse dates for any locale. Your code can
+ * be completely independent of the locale conventions for months, days of the
+ * week, or even the calendar format: lunar vs. solar.
+ * <P>
+ * To format a date for the current Locale, use one of the static factory
+ * methods:
+ * <pre>
+ * \code
+ * DateFormat* dfmt = DateFormat::createDateInstance();
+ * UDate myDate = Calendar::getNow();
+ * UnicodeString myString;
+ * myString = dfmt->format( myDate, myString );
+ * \endcode
+ * </pre>
+ * If you are formatting multiple numbers, it is more efficient to get the
+ * format and use it multiple times so that the system doesn't have to fetch the
+ * information about the local language and country conventions multiple times.
+ * <pre>
+ * \code
+ * DateFormat* df = DateFormat::createDateInstance();
+ * UnicodeString myString;
+ * UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
+ * for (int32_t i = 0; i < 3; ++i) {
+ * myString.remove();
+ * cout << df->format( myDateArr[i], myString ) << endl;
+ * }
+ * \endcode
+ * </pre>
+ * To get specific fields of a date, you can use UFieldPosition to
+ * get specific fields.
+ * <pre>
+ * \code
+ * DateFormat* dfmt = DateFormat::createDateInstance();
+ * FieldPosition pos(DateFormat::YEAR_FIELD);
+ * UnicodeString myString;
+ * myString = dfmt->format( myDate, myString );
+ * cout << myString << endl;
+ * cout << pos.getBeginIndex() << "," << pos. getEndIndex() << endl;
+ * \endcode
+ * </pre>
+ * To format a date for a different Locale, specify it in the call to
+ * createDateInstance().
+ * <pre>
+ * \code
+ * DateFormat* df =
+ * DateFormat::createDateInstance( DateFormat::SHORT, Locale::getFrance());
+ * \endcode
+ * </pre>
+ * You can use a DateFormat to parse also.
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * UDate myDate = df->parse(myString, status);
+ * \endcode
+ * </pre>
+ * Use createDateInstance() to produce the normal date format for that country.
+ * There are other static factory methods available. Use createTimeInstance()
+ * to produce the normal time format for that country. Use createDateTimeInstance()
+ * to produce a DateFormat that formats both date and time. You can pass in
+ * different options to these factory methods to control the length of the
+ * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the
+ * locale, but generally:
+ * <ul type=round>
+ * <li> SHORT is completely numeric, such as 12/13/52 or 3:30pm
+ * <li> MEDIUM is longer, such as Jan 12, 1952
+ * <li> LONG is longer, such as January 12, 1952 or 3:30:32pm
+ * <li> FULL is pretty completely specified, such as
+ * Tuesday, April 12, 1952 AD or 3:30:42pm PST.
+ * </ul>
+ * You can also set the time zone on the format if you wish. If you want even
+ * more control over the format or parsing, (or want to give your users more
+ * control), you can try casting the DateFormat you get from the factory methods
+ * to a SimpleDateFormat. This will work for the majority of countries; just
+ * remember to chck getDynamicClassID() before carrying out the cast.
+ * <P>
+ * You can also use forms of the parse and format methods with ParsePosition and
+ * FieldPosition to allow you to
+ * <ul type=round>
+ * <li> Progressively parse through pieces of a string.
+ * <li> Align any particular field, or find out where it is for selection
+ * on the screen.
+ * </ul>
+ *
+ * <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 DateFormat : public Format {
+public:
+
+ /**
+ * Constants for various style patterns. These reflect the order of items in
+ * the DateTimePatterns resource. There are 4 time patterns, 4 date patterns,
+ * and then the date-time pattern. Each block of 4 values in the resource occurs
+ * in the order full, long, medium, short.
+ * @stable ICU 2.4
+ */
+ enum EStyle
+ {
+ kNone = -1,
+
+ kFull = 0,
+ kLong = 1,
+ kMedium = 2,
+ kShort = 3,
+
+ kDateOffset = kShort + 1,
+ // kFull + kDateOffset = 4
+ // kLong + kDateOffset = 5
+ // kMedium + kDateOffset = 6
+ // kShort + kDateOffset = 7
+
+ kDateTime = 8,
+
+
+ // relative dates
+ kRelative = (1 << 7),
+
+ kFullRelative = (kFull | kRelative),
+
+ kLongRelative = kLong | kRelative,
+
+ kMediumRelative = kMedium | kRelative,
+
+ kShortRelative = kShort | kRelative,
+
+
+ kDefault = kMedium,
+
+
+
+ /**
+ * These constants are provided for backwards compatibility only.
+ * Please use the C++ style constants defined above.
+ */
+ FULL = kFull,
+ LONG = kLong,
+ MEDIUM = kMedium,
+ SHORT = kShort,
+ DEFAULT = kDefault,
+ DATE_OFFSET = kDateOffset,
+ NONE = kNone,
+ DATE_TIME = kDateTime
+ };
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~DateFormat();
+
+ /**
+ * Equality operator. Returns true if the two formats have the same behavior.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format&) const;
+
+ /**
+ * Format an object to produce a string. This method handles Formattable
+ * objects with a UDate type. If a the Formattable object type is not a Date,
+ * then it returns a failing UErrorCode.
+ *
+ * @param obj The object to format. Must be a Date.
+ * @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;
+
+ /**
+ * Formats a date into a date/time string. This is an abstract method which
+ * concrete subclasses must implement.
+ * <P>
+ * On input, the FieldPosition parameter may have its "field" member filled with
+ * an enum value specifying a field. On output, the FieldPosition will be filled
+ * in with the text offsets for that field.
+ * <P> For example, given a time text
+ * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
+ * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
+ * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
+ * <P> Notice
+ * that if the same time field appears more than once in a pattern, the status will
+ * be set for the first occurence of that time field. For instance,
+ * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
+ * using the pattern "h a z (zzzz)" and the alignment field
+ * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
+ * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
+ * occurence of the timezone pattern character 'z'.
+ *
+ * @param cal Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param fieldPosition On input: an alignment field, if desired (see examples above)
+ * On output: the offsets of the alignment field (see examples above)
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.1
+ */
+ virtual UnicodeString& format( Calendar& cal,
+ UnicodeString& appendTo,
+ FieldPosition& fieldPosition) const = 0;
+
+ /**
+ * Formats a UDate into a date/time string.
+ * <P>
+ * On input, the FieldPosition parameter may have its "field" member filled with
+ * an enum value specifying a field. On output, the FieldPosition will be filled
+ * in with the text offsets for that field.
+ * <P> For example, given a time text
+ * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is
+ * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and
+ * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively.
+ * <P> Notice
+ * that if the same time field appears more than once in a pattern, the status will
+ * be set for the first occurence of that time field. For instance,
+ * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)"
+ * using the pattern "h a z (zzzz)" and the alignment field
+ * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and
+ * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first
+ * occurence of the timezone pattern character 'z'.
+ *
+ * @param date UDate to be formatted into a date/time string.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param fieldPosition On input: an alignment field, if desired (see examples above)
+ * On output: the offsets of the alignment field (see examples above)
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( UDate date,
+ UnicodeString& appendTo,
+ FieldPosition& fieldPosition) const;
+
+ /**
+ * Formats a UDate into a date/time string. If there is a problem, you won't
+ * know, using this method. Use the overloaded format() method which takes a
+ * FieldPosition& to detect formatting problems.
+ *
+ * @param date The UDate value to be formatted into a string.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(UDate date, UnicodeString& appendTo) const;
+
+ /**
+ * Redeclared Format method.
+ *
+ * @param obj The object to be formatted into a string.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Output param filled with success/failure status.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Parse a date/time string.
+ *
+ * @param text The string to be parsed into a UDate value.
+ * @param status Output param to be set to success/failure code. If
+ * 'text' cannot be parsed, it will be set to a failure
+ * code.
+ * @result The parsed UDate value, if successful.
+ * @stable ICU 2.0
+ */
+ virtual UDate parse( const UnicodeString& text,
+ UErrorCode& status) const;
+
+ /**
+ * Parse a date/time string beginning at the given parse position. For
+ * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
+ * that is equivalent to Date(837039928046).
+ * <P>
+ * By default, parsing is lenient: If the input is not in the form used by
+ * this object's format method but can still be parsed as a date, then the
+ * parse succeeds. Clients may insist on strict adherence to the format by
+ * calling setLenient(false).
+ *
+ * @see DateFormat::setLenient(boolean)
+ *
+ * @param text The date/time string to be parsed
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @param pos On input, the position at which to start parsing; on
+ * output, the position at which parsing terminated, or the
+ * start position if the parse failed.
+ * @return A valid UDate if the input could be parsed.
+ * @stable ICU 2.1
+ */
+ virtual void parse( const UnicodeString& text,
+ Calendar& cal,
+ ParsePosition& pos) const = 0;
+
+ /**
+ * Parse a date/time string beginning at the given parse position. For
+ * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
+ * that is equivalent to Date(837039928046).
+ * <P>
+ * By default, parsing is lenient: If the input is not in the form used by
+ * this object's format method but can still be parsed as a date, then the
+ * parse succeeds. Clients may insist on strict adherence to the format by
+ * calling setLenient(false).
+ *
+ * @see DateFormat::setLenient(boolean)
+ *
+ * @param text The date/time string to be parsed
+ * @param pos On input, the position at which to start parsing; on
+ * output, the position at which parsing terminated, or the
+ * start position if the parse failed.
+ * @return A valid UDate if the input could be parsed.
+ * @stable ICU 2.0
+ */
+ UDate parse( const UnicodeString& text,
+ ParsePosition& pos) const;
+
+ /**
+ * Parse a string to produce an object. This methods handles parsing of
+ * date/time strings into Formattable objects with UDate types.
+ * <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 a successful parse),
+ * while trailing whitespace is left as is.
+ * <P>
+ * See Format::parseObject() for more.
+ *
+ * @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.
+ * @return A newly created Formattable* object, or NULL
+ * on failure. The caller owns this and should
+ * delete it when done.
+ * @stable ICU 2.0
+ */
+ virtual void parseObject(const UnicodeString& source,
+ Formattable& result,
+ ParsePosition& parse_pos) const;
+
+ /**
+ * Create a default date/time formatter that uses the SHORT style for both
+ * the date and the time.
+ *
+ * @return A date/time formatter which the caller owns.
+ * @stable ICU 2.0
+ */
+ static DateFormat* U_EXPORT2 createInstance(void);
+
+ /**
+ * Creates a time formatter with the given formatting style for the given
+ * locale.
+ *
+ * @param style The given formatting style. For example,
+ * SHORT for "h:mm a" in the US locale.
+ * @param aLocale The given locale.
+ * @return A time formatter which the caller owns.
+ * @stable ICU 2.0
+ */
+ static DateFormat* U_EXPORT2 createTimeInstance(EStyle style = kDefault,
+ const Locale& aLocale = Locale::getDefault());
+
+ /**
+ * Creates a date formatter with the given formatting style for the given
+ * const locale.
+ *
+ * @param style The given formatting style. For example,
+ * SHORT for "M/d/yy" in the US locale.
+ * @param aLocale The given locale.
+ * @return A date formatter which the caller owns.
+ * @stable ICU 2.0
+ */
+ static DateFormat* U_EXPORT2 createDateInstance(EStyle style = kDefault,
+ const Locale& aLocale = Locale::getDefault());
+
+ /**
+ * Creates a date/time formatter with the given formatting styles for the
+ * given locale.
+ *
+ * @param dateStyle The given formatting style for the date portion of the result.
+ * For example, SHORT for "M/d/yy" in the US locale.
+ * @param timeStyle The given formatting style for the time portion of the result.
+ * For example, SHORT for "h:mm a" in the US locale.
+ * @param aLocale The given locale.
+ * @return A date/time formatter which the caller owns.
+ * @stable ICU 2.0
+ */
+ static DateFormat* U_EXPORT2 createDateTimeInstance(EStyle dateStyle = kDefault,
+ EStyle timeStyle = kDefault,
+ const Locale& aLocale = Locale::getDefault());
+
+ /**
+ * Gets the set of locales for which DateFormats are installed.
+ * @param count Filled in with the number of locales in the list that is returned.
+ * @return the set of locales for which DateFormats are installed. The caller
+ * does NOT own this list and must not delete it.
+ * @stable ICU 2.0
+ */
+ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
+
+ /**
+ * Returns true if the formatter is set for lenient parsing.
+ * @stable ICU 2.0
+ */
+ virtual UBool isLenient(void) const;
+
+ /**
+ * Specify whether or not date/time parsing is to be lenient. With lenient
+ * parsing, the parser may use heuristics to interpret inputs that do not
+ * precisely match this object's format. With strict parsing, inputs must
+ * match this object's format.
+ *
+ * @param lenient True specifies date/time interpretation to be lenient.
+ * @see Calendar::setLenient
+ * @stable ICU 2.0
+ */
+ virtual void setLenient(UBool lenient);
+
+ /**
+ * Gets the calendar associated with this date/time formatter.
+ * @return the calendar associated with this date/time formatter.
+ * @stable ICU 2.0
+ */
+ virtual const Calendar* getCalendar(void) const;
+
+ /**
+ * Set the calendar to be used by this date format. Initially, the default
+ * calendar for the specified or default locale is used. The caller should
+ * not delete the Calendar object after it is adopted by this call.
+ * Adopting a new calendar will change to the default symbols.
+ *
+ * @param calendarToAdopt Calendar object to be adopted.
+ * @stable ICU 2.0
+ */
+ virtual void adoptCalendar(Calendar* calendarToAdopt);
+
+ /**
+ * Set the calendar to be used by this date format. Initially, the default
+ * calendar for the specified or default locale is used.
+ *
+ * @param newCalendar Calendar object to be set.
+ * @stable ICU 2.0
+ */
+ virtual void setCalendar(const Calendar& newCalendar);
+
+
+ /**
+ * Gets the number formatter which this date/time formatter uses to format
+ * and parse the numeric portions of the pattern.
+ * @return the number formatter which this date/time formatter uses.
+ * @stable ICU 2.0
+ */
+ virtual const NumberFormat* getNumberFormat(void) const;
+
+ /**
+ * Allows you to set the number formatter. The caller should
+ * not delete the NumberFormat object after it is adopted by this call.
+ * @param formatToAdopt NumberFormat object to be adopted.
+ * @stable ICU 2.0
+ */
+ virtual void adoptNumberFormat(NumberFormat* formatToAdopt);
+
+ /**
+ * Allows you to set the number formatter.
+ * @param newNumberFormat NumberFormat object to be set.
+ * @stable ICU 2.0
+ */
+ virtual void setNumberFormat(const NumberFormat& newNumberFormat);
+
+ /**
+ * Returns a reference to the TimeZone used by this DateFormat's calendar.
+ * @return the time zone associated with the calendar of DateFormat.
+ * @stable ICU 2.0
+ */
+ virtual const TimeZone& getTimeZone(void) const;
+
+ /**
+ * Sets the time zone for the calendar of this DateFormat object. The caller
+ * no longer owns the TimeZone object and should not delete it after this call.
+ * @param zoneToAdopt the TimeZone to be adopted.
+ * @stable ICU 2.0
+ */
+ virtual void adoptTimeZone(TimeZone* zoneToAdopt);
+
+ /**
+ * Sets the time zone for the calendar of this DateFormat object.
+ * @param zone the new time zone.
+ * @stable ICU 2.0
+ */
+ virtual void setTimeZone(const TimeZone& zone);
+
+protected:
+ /**
+ * Default constructor. Creates a DateFormat with no Calendar or NumberFormat
+ * associated with it. This constructor depends on the subclasses to fill in
+ * the calendar and numberFormat fields.
+ * @stable ICU 2.0
+ */
+ DateFormat();
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.0
+ */
+ DateFormat(const DateFormat&);
+
+ /**
+ * Default assignment operator.
+ * @stable ICU 2.0
+ */
+ DateFormat& operator=(const DateFormat&);
+
+ /**
+ * The calendar that DateFormat uses to produce the time field values needed
+ * to implement date/time formatting. Subclasses should generally initialize
+ * this to the default calendar for the locale associated with this DateFormat.
+ * @stable ICU 2.4
+ */
+ Calendar* fCalendar;
+
+ /**
+ * The number formatter that DateFormat uses to format numbers in dates and
+ * times. Subclasses should generally initialize this to the default number
+ * format for the locale associated with this DateFormat.
+ * @stable ICU 2.4
+ */
+ NumberFormat* fNumberFormat;
+
+private:
+ /**
+ * Gets the date/time formatter with the given formatting styles for the
+ * given locale.
+ * @param dateStyle the given date formatting style.
+ * @param timeStyle the given time formatting style.
+ * @param inLocale the given locale.
+ * @return a date/time formatter, or 0 on failure.
+ */
+ static DateFormat* U_EXPORT2 create(EStyle timeStyle, EStyle dateStyle, const Locale&);
+
+public:
+ /**
+ * Field selector for FieldPosition for DateFormat fields.
+ * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be
+ * removed in that release
+ */
+ enum EField
+ {
+ // Obsolete; use UDateFormatField instead
+ kEraField = UDAT_ERA_FIELD,
+ kYearField = UDAT_YEAR_FIELD,
+ kMonthField = UDAT_MONTH_FIELD,
+ kDateField = UDAT_DATE_FIELD,
+ kHourOfDay1Field = UDAT_HOUR_OF_DAY1_FIELD,
+ kHourOfDay0Field = UDAT_HOUR_OF_DAY0_FIELD,
+ kMinuteField = UDAT_MINUTE_FIELD,
+ kSecondField = UDAT_SECOND_FIELD,
+ kMillisecondField = UDAT_FRACTIONAL_SECOND_FIELD,
+ kDayOfWeekField = UDAT_DAY_OF_WEEK_FIELD,
+ kDayOfYearField = UDAT_DAY_OF_YEAR_FIELD,
+ kDayOfWeekInMonthField = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD,
+ kWeekOfYearField = UDAT_WEEK_OF_YEAR_FIELD,
+ kWeekOfMonthField = UDAT_WEEK_OF_MONTH_FIELD,
+ kAmPmField = UDAT_AM_PM_FIELD,
+ kHour1Field = UDAT_HOUR1_FIELD,
+ kHour0Field = UDAT_HOUR0_FIELD,
+ kTimezoneField = UDAT_TIMEZONE_FIELD,
+ kYearWOYField = UDAT_YEAR_WOY_FIELD,
+ kDOWLocalField = UDAT_DOW_LOCAL_FIELD,
+ kExtendedYearField = UDAT_EXTENDED_YEAR_FIELD,
+ kJulianDayField = UDAT_JULIAN_DAY_FIELD,
+ kMillisecondsInDayField = UDAT_MILLISECONDS_IN_DAY_FIELD,
+
+ // Obsolete; use UDateFormatField instead
+ ERA_FIELD = UDAT_ERA_FIELD,
+ YEAR_FIELD = UDAT_YEAR_FIELD,
+ MONTH_FIELD = UDAT_MONTH_FIELD,
+ DATE_FIELD = UDAT_DATE_FIELD,
+ HOUR_OF_DAY1_FIELD = UDAT_HOUR_OF_DAY1_FIELD,
+ HOUR_OF_DAY0_FIELD = UDAT_HOUR_OF_DAY0_FIELD,
+ MINUTE_FIELD = UDAT_MINUTE_FIELD,
+ SECOND_FIELD = UDAT_SECOND_FIELD,
+ MILLISECOND_FIELD = UDAT_FRACTIONAL_SECOND_FIELD,
+ DAY_OF_WEEK_FIELD = UDAT_DAY_OF_WEEK_FIELD,
+ DAY_OF_YEAR_FIELD = UDAT_DAY_OF_YEAR_FIELD,
+ DAY_OF_WEEK_IN_MONTH_FIELD = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD,
+ WEEK_OF_YEAR_FIELD = UDAT_WEEK_OF_YEAR_FIELD,
+ WEEK_OF_MONTH_FIELD = UDAT_WEEK_OF_MONTH_FIELD,
+ AM_PM_FIELD = UDAT_AM_PM_FIELD,
+ HOUR1_FIELD = UDAT_HOUR1_FIELD,
+ HOUR0_FIELD = UDAT_HOUR0_FIELD,
+ TIMEZONE_FIELD = UDAT_TIMEZONE_FIELD
+ };
+};
+
+inline UnicodeString&
+DateFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return Format::format(obj, appendTo, status);
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _DATEFMT
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h b/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h
new file mode 100644
index 00000000000..bc5547d4cdd
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dcfmtsym.h
@@ -0,0 +1,370 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File DCFMTSYM.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 03/18/97 clhuang Updated per C++ implementation.
+* 03/27/97 helena Updated to pass the simple test after code review.
+* 08/26/97 aliu Added currency/intl currency symbol support.
+* 07/22/98 stephen Changed to match C++ style
+* currencySymbol -> fCurrencySymbol
+* Constants changed from CAPS to kCaps
+* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
+* 09/22/00 grhoten Marked deprecation tags with a pointer to replacement
+* functions.
+********************************************************************************
+*/
+
+#ifndef DCFMTSYM_H
+#define DCFMTSYM_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+#include "unicode/locid.h"
+
+/**
+ * \file
+ * \brief C++ API: Symbols for formatting numbers.
+ */
+
+
+U_NAMESPACE_BEGIN
+
+/**
+ * This class represents the set of symbols needed by DecimalFormat
+ * to format numbers. DecimalFormat creates for itself an instance of
+ * DecimalFormatSymbols from its locale data. If you need to change any
+ * of these symbols, you can get the DecimalFormatSymbols object from
+ * your DecimalFormat and modify it.
+ * <P>
+ * Here are the special characters used in the parts of the
+ * subpattern, with notes on their usage.
+ * <pre>
+ * \code
+ * Symbol Meaning
+ * 0 a digit
+ * # a digit, zero shows as absent
+ * . placeholder for decimal separator
+ * , placeholder for grouping separator.
+ * ; separates formats.
+ * - default negative prefix.
+ * % divide by 100 and show as percentage
+ * X any other characters can be used in the prefix or suffix
+ * ' used to quote special characters in a prefix or suffix.
+ * \endcode
+ * </pre>
+ * [Notes]
+ * <P>
+ * If there is no explicit negative subpattern, - is prefixed to the
+ * positive form. That is, "0.00" alone is equivalent to "0.00;-0.00".
+ * <P>
+ * The grouping separator is commonly used for thousands, but in some
+ * countries for ten-thousands. The interval is a constant number of
+ * digits between the grouping characters, such as 100,000,000 or 1,0000,0000.
+ * If you supply a pattern with multiple grouping characters, the interval
+ * between the last one and the end of the integer is the one that is
+ * used. So "#,##,###,####" == "######,####" == "##,####,####".
+ * <P>
+ * This class only handles localized digits where the 10 digits are
+ * contiguous in Unicode, from 0 to 9. Other digits sets (such as
+ * superscripts) would need a different subclass.
+ */
+class U_I18N_API DecimalFormatSymbols : public UObject {
+public:
+ /**
+ * Constants for specifying a number format symbol.
+ * @stable ICU 2.0
+ */
+ enum ENumberFormatSymbol {
+ /** The decimal separator */
+ kDecimalSeparatorSymbol,
+ /** The grouping separator */
+ kGroupingSeparatorSymbol,
+ /** The pattern separator */
+ kPatternSeparatorSymbol,
+ /** The percent sign */
+ kPercentSymbol,
+ /** Zero*/
+ kZeroDigitSymbol,
+ /** Character representing a digit in the pattern */
+ kDigitSymbol,
+ /** The minus sign */
+ kMinusSignSymbol,
+ /** The plus sign */
+ kPlusSignSymbol,
+ /** The currency symbol */
+ kCurrencySymbol,
+ /** The international currency symbol */
+ kIntlCurrencySymbol,
+ /** The monetary separator */
+ kMonetarySeparatorSymbol,
+ /** The exponential symbol */
+ kExponentialSymbol,
+ /** Per mill symbol - replaces kPermillSymbol */
+ kPerMillSymbol,
+ /** Escape padding character */
+ kPadEscapeSymbol,
+ /** Infinity symbol */
+ kInfinitySymbol,
+ /** Nan symbol */
+ kNaNSymbol,
+ /** Significant digit symbol
+ * @stable ICU 3.0 */
+ kSignificantDigitSymbol,
+ /** The monetary grouping separator
+ * @stable ICU 3.6
+ */
+ kMonetaryGroupingSeparatorSymbol,
+ /** count symbol constants */
+ kFormatSymbolCount
+ };
+
+ /**
+ * Create a DecimalFormatSymbols object for the given locale.
+ *
+ * @param locale The locale to get symbols for.
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @stable ICU 2.0
+ */
+ DecimalFormatSymbols(const Locale& locale, UErrorCode& status);
+
+ /**
+ * Create a DecimalFormatSymbols object for the default locale.
+ * This constructor will not fail. If the resource file data is
+ * not available, it will use hard-coded last-resort data and
+ * set status to U_USING_FALLBACK_ERROR.
+ *
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @stable ICU 2.0
+ */
+ DecimalFormatSymbols( UErrorCode& status);
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.0
+ */
+ DecimalFormatSymbols(const DecimalFormatSymbols&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.0
+ */
+ DecimalFormatSymbols& operator=(const DecimalFormatSymbols&);
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~DecimalFormatSymbols();
+
+ /**
+ * Return true if another object is semantically equal to this one.
+ *
+ * @param other the object to be compared with.
+ * @return true if another object is semantically equal to this one.
+ * @stable ICU 2.0
+ */
+ UBool operator==(const DecimalFormatSymbols& other) const;
+
+ /**
+ * Return true if another object is semantically unequal to this one.
+ *
+ * @param other the object to be compared with.
+ * @return true if another object is semantically unequal to this one.
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const DecimalFormatSymbols& other) const { return !operator==(other); }
+
+ /**
+ * Get one of the format symbols by its enum constant.
+ * Each symbol is stored as a string so that graphemes
+ * (characters with modifyer letters) can be used.
+ *
+ * @param symbol Constant to indicate a number format symbol.
+ * @return the format symbols by the param 'symbol'
+ * @stable ICU 2.0
+ */
+ inline UnicodeString getSymbol(ENumberFormatSymbol symbol) const;
+
+ /**
+ * Set one of the format symbols by its enum constant.
+ * Each symbol is stored as a string so that graphemes
+ * (characters with modifyer letters) can be used.
+ *
+ * @param symbol Constant to indicate a number format symbol.
+ * @param value value of the format sybmol
+ * @stable ICU 2.0
+ */
+ void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value);
+
+ /**
+ * Returns the locale for which this object was constructed.
+ * @stable ICU 2.6
+ */
+ inline Locale getLocale() const;
+
+ /**
+ * Returns the locale for this object. Two flavors are available:
+ * valid and actual locale.
+ * @stable ICU 2.8
+ */
+ Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
+
+ /**
+ * 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:
+ DecimalFormatSymbols(); // default constructor not implemented
+
+ /**
+ * Initializes the symbols from the LocaleElements resource bundle.
+ * Note: The organization of LocaleElements badly needs to be
+ * cleaned up.
+ *
+ * @param locale The locale to get symbols for.
+ * @param success Input/output parameter, set to success or
+ * failure code upon return.
+ * @param useLastResortData determine if use last resort data
+ */
+ void initialize(const Locale& locale, UErrorCode& success, UBool useLastResortData = FALSE);
+
+ /**
+ * Initialize the symbols from the given array of UnicodeStrings.
+ * The array must be of the correct size.
+ *
+ * @param numberElements the number format symbols
+ * @param numberElementsLength length of numberElements
+ */
+ void initialize(const UChar** numberElements, int32_t *numberElementsStrLen, int32_t numberElementsLength);
+
+ /**
+ * Initialize the symbols with default values.
+ */
+ void initialize();
+
+ void setCurrencyForSymbols();
+
+public:
+ /**
+ * _Internal_ function - more efficient version of getSymbol,
+ * returning a const reference to one of the symbol strings.
+ * The returned reference becomes invalid when the symbol is changed
+ * or when the DecimalFormatSymbols are destroyed.
+ * ### TODO markus 2002oct11: Consider proposing getConstSymbol() to be really public.
+ *
+ * @param symbol Constant to indicate a number format symbol.
+ * @return the format symbol by the param 'symbol'
+ * @internal
+ */
+ inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const;
+
+ /**
+ * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API.
+ * @internal
+ */
+ inline const UChar* getCurrencyPattern(void) const;
+
+private:
+ /**
+ * Private symbol strings.
+ * They are either loaded from a resource bundle or otherwise owned.
+ * setSymbol() clones the symbol string.
+ * Readonly aliases can only come from a resource bundle, so that we can always
+ * use fastCopyFrom() with them.
+ *
+ * If DecimalFormatSymbols becomes subclassable and the status of fSymbols changes
+ * from private to protected,
+ * or when fSymbols can be set any other way that allows them to be readonly aliases
+ * to non-resource bundle strings,
+ * then regular UnicodeString copies must be used instead of fastCopyFrom().
+ *
+ * @internal
+ */
+ UnicodeString fSymbols[kFormatSymbolCount];
+
+ /**
+ * Non-symbol variable for getConstSymbol(). Always empty.
+ * @internal
+ */
+ UnicodeString fNoSymbol;
+
+ Locale locale;
+
+ char actualLocale[ULOC_FULLNAME_CAPACITY];
+ char validLocale[ULOC_FULLNAME_CAPACITY];
+ const UChar* currPattern;
+};
+
+// -------------------------------------
+
+inline UnicodeString
+DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const {
+ const UnicodeString *strPtr;
+ if(symbol < kFormatSymbolCount) {
+ strPtr = &fSymbols[symbol];
+ } else {
+ strPtr = &fNoSymbol;
+ }
+ return *strPtr;
+}
+
+inline const UnicodeString &
+DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const {
+ const UnicodeString *strPtr;
+ if(symbol < kFormatSymbolCount) {
+ strPtr = &fSymbols[symbol];
+ } else {
+ strPtr = &fNoSymbol;
+ }
+ return *strPtr;
+}
+
+// -------------------------------------
+
+inline void
+DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value) {
+ if(symbol<kFormatSymbolCount) {
+ fSymbols[symbol]=value;
+ }
+}
+
+// -------------------------------------
+
+inline Locale
+DecimalFormatSymbols::getLocale() const {
+ return locale;
+}
+
+inline const UChar*
+DecimalFormatSymbols::getCurrencyPattern() const {
+ return currPattern;
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _DCFMTSYM
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h
new file mode 100644
index 00000000000..296906fb7d7
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/decimfmt.h
@@ -0,0 +1,1902 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File DECIMFMT.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 03/20/97 clhuang Updated per C++ implementation.
+* 04/03/97 aliu Rewrote parsing and formatting completely, and
+* cleaned up and debugged. Actually works now.
+* 04/17/97 aliu Changed DigitCount to int per code review.
+* 07/10/97 helena Made ParsePosition a class and get rid of the function
+* hiding problems.
+* 09/09/97 aliu Ported over support for exponential formats.
+* 07/20/98 stephen Changed documentation
+********************************************************************************
+*/
+
+#ifndef DECIMFMT_H
+#define DECIMFMT_H
+
+#include "unicode/utypes.h"
+/**
+ * \file
+ * \brief C++ API: Formats decimal numbers.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/dcfmtsym.h"
+#include "unicode/numfmt.h"
+#include "unicode/locid.h"
+
+U_NAMESPACE_BEGIN
+
+class DigitList;
+class ChoiceFormat;
+
+/**
+ * DecimalFormat is a concrete subclass of NumberFormat that formats decimal
+ * numbers. It has a variety of features designed to make it possible to parse
+ * and format numbers in any locale, including support for Western, Arabic, or
+ * Indic digits. It also supports different flavors of numbers, including
+ * integers ("123"), fixed-point numbers ("123.4"), scientific notation
+ * ("1.23E4"), percentages ("12%"), and currency amounts ("$123"). All of these
+ * flavors can be easily localized.
+ *
+ * <p>To obtain a NumberFormat for a specific locale (including the default
+ * locale) call one of NumberFormat's factory methods such as
+ * createInstance(). Do not call the DecimalFormat constructors directly, unless
+ * you know what you are doing, since the NumberFormat factory methods may
+ * return subclasses other than DecimalFormat.
+ *
+ * <p><strong>Example Usage</strong>
+ *
+ * \code
+ * // Normally we would have a GUI with a menu for this
+ * int32_t locCount;
+ * const Locale* locales = NumberFormat::getAvailableLocales(locCount);
+ *
+ * double myNumber = -1234.56;
+ * UErrorCode success = U_ZERO_ERROR;
+ * NumberFormat* form;
+ *
+ * // Print out a number with the localized number, currency and percent
+ * // format for each locale.
+ * UnicodeString countryName;
+ * UnicodeString displayName;
+ * UnicodeString str;
+ * UnicodeString pattern;
+ * Formattable fmtable;
+ * for (int32_t j = 0; j < 3; ++j) {
+ * cout << endl << "FORMAT " << j << endl;
+ * for (int32_t i = 0; i < locCount; ++i) {
+ * if (locales[i].getCountry(countryName).size() == 0) {
+ * // skip language-only
+ * continue;
+ * }
+ * switch (j) {
+ * case 0:
+ * form = NumberFormat::createInstance(locales[i], success ); break;
+ * case 1:
+ * form = NumberFormat::createCurrencyInstance(locales[i], success ); break;
+ * default:
+ * form = NumberFormat::createPercentInstance(locales[i], success ); break;
+ * }
+ * if (form) {
+ * str.remove();
+ * pattern = ((DecimalFormat*)form)->toPattern(pattern);
+ * cout << locales[i].getDisplayName(displayName) << ": " << pattern;
+ * cout << " -> " << form->format(myNumber,str) << endl;
+ * form->parse(form->format(myNumber,str), fmtable, success);
+ * delete form;
+ * }
+ * }
+ * }
+ * \endcode
+ *
+ * <p><strong>Patterns</strong>
+ *
+ * <p>A DecimalFormat consists of a <em>pattern</em> and a set of
+ * <em>symbols</em>. The pattern may be set directly using
+ * applyPattern(), or indirectly using other API methods which
+ * manipulate aspects of the pattern, such as the minimum number of integer
+ * digits. The symbols are stored in a DecimalFormatSymbols
+ * object. When using the NumberFormat factory methods, the
+ * pattern and symbols are read from ICU's locale data.
+ *
+ * <p><strong>Special Pattern Characters</strong>
+ *
+ * <p>Many characters in a pattern are taken literally; they are matched during
+ * parsing and output unchanged during formatting. Special characters, on the
+ * other hand, stand for other characters, strings, or classes of characters.
+ * For example, the '#' character is replaced by a localized digit. Often the
+ * replacement character is the same as the pattern character; in the U.S. locale,
+ * the ',' grouping character is replaced by ','. However, the replacement is
+ * still happening, and if the symbols are modified, the grouping character
+ * changes. Some special characters affect the behavior of the formatter by
+ * their presence; for example, if the percent character is seen, then the
+ * value is multiplied by 100 before being displayed.
+ *
+ * <p>To insert a special character in a pattern as a literal, that is, without
+ * any special meaning, the character must be quoted. There are some exceptions to
+ * this which are noted below.
+ *
+ * <p>The characters listed here are used in non-localized patterns. Localized
+ * patterns use the corresponding characters taken from this formatter's
+ * DecimalFormatSymbols object instead, and these characters lose
+ * their special status. Two exceptions are the currency sign and quote, which
+ * are not localized.
+ *
+ * <table border=0 cellspacing=3 cellpadding=0>
+ * <tr bgcolor="#ccccff">
+ * <td align=left><strong>Symbol</strong>
+ * <td align=left><strong>Location</strong>
+ * <td align=left><strong>Localized?</strong>
+ * <td align=left><strong>Meaning</strong>
+ * <tr valign=top>
+ * <td><code>0</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Digit
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>1-9</code>
+ * <td>Number
+ * <td>Yes
+ * <td>'1' through '9' indicate rounding.
+ * <tr valign=top>
+ * <td><code>\htmlonly&#x40;\endhtmlonly</code> <!--doxygen doesn't like @-->
+ * <td>Number
+ * <td>No
+ * <td>Significant digit
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>#</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Digit, zero shows as absent
+ * <tr valign=top>
+ * <td><code>.</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Decimal separator or monetary decimal separator
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>-</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Minus sign
+ * <tr valign=top>
+ * <td><code>,</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Grouping separator
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>E</code>
+ * <td>Number
+ * <td>Yes
+ * <td>Separates mantissa and exponent in scientific notation.
+ * <em>Need not be quoted in prefix or suffix.</em>
+ * <tr valign=top>
+ * <td><code>+</code>
+ * <td>Exponent
+ * <td>Yes
+ * <td>Prefix positive exponents with localized plus sign.
+ * <em>Need not be quoted in prefix or suffix.</em>
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>;</code>
+ * <td>Subpattern boundary
+ * <td>Yes
+ * <td>Separates positive and negative subpatterns
+ * <tr valign=top>
+ * <td><code>\%</code>
+ * <td>Prefix or suffix
+ * <td>Yes
+ * <td>Multiply by 100 and show as percentage
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>\\u2030</code>
+ * <td>Prefix or suffix
+ * <td>Yes
+ * <td>Multiply by 1000 and show as per mille
+ * <tr valign=top>
+ * <td><code>\htmlonly&curren;\endhtmlonly</code> (<code>\\u00A4</code>)
+ * <td>Prefix or suffix
+ * <td>No
+ * <td>Currency sign, replaced by currency symbol. If
+ * doubled, replaced by international currency symbol.
+ * If present in a pattern, the monetary decimal separator
+ * is used instead of the decimal separator.
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>'</code>
+ * <td>Prefix or suffix
+ * <td>No
+ * <td>Used to quote special characters in a prefix or suffix,
+ * for example, <code>"'#'#"</code> formats 123 to
+ * <code>"#123"</code>. To create a single quote
+ * itself, use two in a row: <code>"# o''clock"</code>.
+ * <tr valign=top>
+ * <td><code>*</code>
+ * <td>Prefix or suffix boundary
+ * <td>Yes
+ * <td>Pad escape, precedes pad character
+ * </table>
+ *
+ * <p>A DecimalFormat pattern contains a postive and negative
+ * subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a
+ * prefix, a numeric part, and a suffix. If there is no explicit negative
+ * subpattern, the negative subpattern is the localized minus sign prefixed to the
+ * positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there
+ * is an explicit negative subpattern, it serves only to specify the negative
+ * prefix and suffix; the number of digits, minimal digits, and other
+ * characteristics are ignored in the negative subpattern. That means that
+ * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)".
+ *
+ * <p>The prefixes, suffixes, and various symbols used for infinity, digits,
+ * thousands separators, decimal separators, etc. may be set to arbitrary
+ * values, and they will appear properly during formatting. However, care must
+ * be taken that the symbols and strings do not conflict, or parsing will be
+ * unreliable. For example, either the positive and negative prefixes or the
+ * suffixes must be distinct for parse() to be able
+ * to distinguish positive from negative values. Another example is that the
+ * decimal separator and thousands separator should be distinct characters, or
+ * parsing will be impossible.
+ *
+ * <p>The <em>grouping separator</em> is a character that separates clusters of
+ * integer digits to make large numbers more legible. It commonly used for
+ * thousands, but in some locales it separates ten-thousands. The <em>grouping
+ * size</em> is the number of digits between the grouping separators, such as 3
+ * for "100,000,000" or 4 for "1 0000 0000". There are actually two different
+ * grouping sizes: One used for the least significant integer digits, the
+ * <em>primary grouping size</em>, and one used for all others, the
+ * <em>secondary grouping size</em>. In most locales these are the same, but
+ * sometimes they are different. For example, if the primary grouping interval
+ * is 3, and the secondary is 2, then this corresponds to the pattern
+ * "#,##,##0", and the number 123456789 is formatted as "12,34,56,789". If a
+ * pattern contains multiple grouping separators, the interval between the last
+ * one and the end of the integer defines the primary grouping size, and the
+ * interval between the last two defines the secondary grouping size. All others
+ * are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####".
+ *
+ * <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause
+ * DecimalFormat to set a failing UErrorCode.
+ *
+ * <p><strong>Pattern BNF</strong>
+ *
+ * <pre>
+ * pattern := subpattern (';' subpattern)?
+ * subpattern := prefix? number exponent? suffix?
+ * number := (integer ('.' fraction)?) | sigDigits
+ * prefix := '\\u0000'..'\\uFFFD' - specialCharacters
+ * suffix := '\\u0000'..'\\uFFFD' - specialCharacters
+ * integer := '#'* '0'* '0'
+ * fraction := '0'* '#'*
+ * sigDigits := '#'* '@' '@'* '#'*
+ * exponent := 'E' '+'? '0'* '0'
+ * padSpec := '*' padChar
+ * padChar := '\\u0000'..'\\uFFFD' - quote
+ * &nbsp;
+ * Notation:
+ * X* 0 or more instances of X
+ * X? 0 or 1 instances of X
+ * X|Y either X or Y
+ * C..D any character from C up to D, inclusive
+ * S-T characters in S, except those in T
+ * </pre>
+ * The first subpattern is for positive numbers. The second (optional)
+ * subpattern is for negative numbers.
+ *
+ * <p>Not indicated in the BNF syntax above:
+ *
+ * <ul><li>The grouping separator ',' can occur inside the integer and
+ * sigDigits elements, between any two pattern characters of that
+ * element, as long as the integer or sigDigits element is not
+ * followed by the exponent element.
+ *
+ * <li>Two grouping intervals are recognized: That between the
+ * decimal point and the first grouping symbol, and that
+ * between the first and second grouping symbols. These
+ * intervals are identical in most locales, but in some
+ * locales they differ. For example, the pattern
+ * &quot;#,##,###&quot; formats the number 123456789 as
+ * &quot;12,34,56,789&quot;.</li>
+ *
+ * <li>The pad specifier <code>padSpec</code> may appear before the prefix,
+ * after the prefix, before the suffix, after the suffix, or not at all.
+ *
+ * <li>In place of '0', the digits '1' through '9' may be used to
+ * indicate a rounding increment.
+ * </ul>
+ *
+ * <p><strong>Parsing</strong>
+ *
+ * <p>DecimalFormat parses all Unicode characters that represent
+ * decimal digits, as defined by u_charDigitValue(). In addition,
+ * DecimalFormat also recognizes as digits the ten consecutive
+ * characters starting with the localized zero digit defined in the
+ * DecimalFormatSymbols object. During formatting, the
+ * DecimalFormatSymbols-based digits are output.
+ *
+ * <p>During parsing, grouping separators are ignored.
+ *
+ * <p>If parse(UnicodeString&,Formattable&,ParsePosition&)
+ * fails to parse a string, it leaves the parse position unchanged.
+ * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&)
+ * indicates parse failure by setting a failing
+ * UErrorCode.
+ *
+ * <p><strong>Formatting</strong>
+ *
+ * <p>Formatting is guided by several parameters, all of which can be
+ * specified either using a pattern or using the API. The following
+ * description applies to formats that do not use <a href="#sci">scientific
+ * notation</a> or <a href="#sigdig">significant digits</a>.
+ *
+ * <ul><li>If the number of actual integer digits exceeds the
+ * <em>maximum integer digits</em>, then only the least significant
+ * digits are shown. For example, 1997 is formatted as "97" if the
+ * maximum integer digits is set to 2.
+ *
+ * <li>If the number of actual integer digits is less than the
+ * <em>minimum integer digits</em>, then leading zeros are added. For
+ * example, 1997 is formatted as "01997" if the minimum integer digits
+ * is set to 5.
+ *
+ * <li>If the number of actual fraction digits exceeds the <em>maximum
+ * fraction digits</em>, then half-even rounding it performed to the
+ * maximum fraction digits. For example, 0.125 is formatted as "0.12"
+ * if the maximum fraction digits is 2. This behavior can be changed
+ * by specifying a rounding increment and a rounding mode.
+ *
+ * <li>If the number of actual fraction digits is less than the
+ * <em>minimum fraction digits</em>, then trailing zeros are added.
+ * For example, 0.125 is formatted as "0.1250" if the mimimum fraction
+ * digits is set to 4.
+ *
+ * <li>Trailing fractional zeros are not displayed if they occur
+ * <em>j</em> positions after the decimal, where <em>j</em> is less
+ * than the maximum fraction digits. For example, 0.10004 is
+ * formatted as "0.1" if the maximum fraction digits is four or less.
+ * </ul>
+ *
+ * <p><strong>Special Values</strong>
+ *
+ * <p><code>NaN</code> is represented as a single character, typically
+ * <code>\\uFFFD</code>. This character is determined by the
+ * DecimalFormatSymbols object. This is the only value for which
+ * the prefixes and suffixes are not used.
+ *
+ * <p>Infinity is represented as a single character, typically
+ * <code>\\u221E</code>, with the positive or negative prefixes and suffixes
+ * applied. The infinity character is determined by the
+ * DecimalFormatSymbols object.
+ *
+ * <a name="sci"><strong>Scientific Notation</strong></a>
+ *
+ * <p>Numbers in scientific notation are expressed as the product of a mantissa
+ * and a power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The
+ * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0),
+ * but it need not be. DecimalFormat supports arbitrary mantissas.
+ * DecimalFormat can be instructed to use scientific
+ * notation through the API or through the pattern. In a pattern, the exponent
+ * character immediately followed by one or more digit characters indicates
+ * scientific notation. Example: "0.###E0" formats the number 1234 as
+ * "1.234E3".
+ *
+ * <ul>
+ * <li>The number of digit characters after the exponent character gives the
+ * minimum exponent digit count. There is no maximum. Negative exponents are
+ * formatted using the localized minus sign, <em>not</em> the prefix and suffix
+ * from the pattern. This allows patterns such as "0.###E0 m/s". To prefix
+ * positive exponents with a localized plus sign, specify '+' between the
+ * exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0",
+ * "1E-1", etc. (In localized patterns, use the localized plus sign rather than
+ * '+'.)
+ *
+ * <li>The minimum number of integer digits is achieved by adjusting the
+ * exponent. Example: 0.00123 formatted with "00.###E0" yields "12.3E-4". This
+ * only happens if there is no maximum number of integer digits. If there is a
+ * maximum, then the minimum number of integer digits is fixed at one.
+ *
+ * <li>The maximum number of integer digits, if present, specifies the exponent
+ * grouping. The most common use of this is to generate <em>engineering
+ * notation</em>, in which the exponent is a multiple of three, e.g.,
+ * "##0.###E0". The number 12345 is formatted using "##0.####E0" as "12.345E3".
+ *
+ * <li>When using scientific notation, the formatter controls the
+ * digit counts using significant digits logic. The maximum number of
+ * significant digits limits the total number of integer and fraction
+ * digits that will be shown in the mantissa; it does not affect
+ * parsing. For example, 12345 formatted with "##0.##E0" is "12.3E3".
+ * See the section on significant digits for more details.
+ *
+ * <li>The number of significant digits shown is determined as
+ * follows: If areSignificantDigitsUsed() returns false, then the
+ * minimum number of significant digits shown is one, and the maximum
+ * number of significant digits shown is the sum of the <em>minimum
+ * integer</em> and <em>maximum fraction</em> digits, and is
+ * unaffected by the maximum integer digits. If this sum is zero,
+ * then all significant digits are shown. If
+ * areSignificantDigitsUsed() returns true, then the significant digit
+ * counts are specified by getMinimumSignificantDigits() and
+ * getMaximumSignificantDigits(). In this case, the number of
+ * integer digits is fixed at one, and there is no exponent grouping.
+ *
+ * <li>Exponential patterns may not contain grouping separators.
+ * </ul>
+ *
+ * <a name="sigdig"><strong>Significant Digits</strong></a>
+ *
+ * <code>DecimalFormat</code> has two ways of controlling how many
+ * digits are shows: (a) significant digits counts, or (b) integer and
+ * fraction digit counts. Integer and fraction digit counts are
+ * described above. When a formatter is using significant digits
+ * counts, the number of integer and fraction digits is not specified
+ * directly, and the formatter settings for these counts are ignored.
+ * Instead, the formatter uses however many integer and fraction
+ * digits are required to display the specified number of significant
+ * digits. Examples:
+ *
+ * <table border=0 cellspacing=3 cellpadding=0>
+ * <tr bgcolor="#ccccff">
+ * <td align=left>Pattern
+ * <td align=left>Minimum significant digits
+ * <td align=left>Maximum significant digits
+ * <td align=left>Number
+ * <td align=left>Output of format()
+ * <tr valign=top>
+ * <td><code>\@\@\@</code>
+ * <td>3
+ * <td>3
+ * <td>12345
+ * <td><code>12300</code>
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>\@\@\@</code>
+ * <td>3
+ * <td>3
+ * <td>0.12345
+ * <td><code>0.123</code>
+ * <tr valign=top>
+ * <td><code>\@\@##</code>
+ * <td>2
+ * <td>4
+ * <td>3.14159
+ * <td><code>3.142</code>
+ * <tr valign=top bgcolor="#eeeeff">
+ * <td><code>\@\@##</code>
+ * <td>2
+ * <td>4
+ * <td>1.23004
+ * <td><code>1.23</code>
+ * </table>
+ *
+ * <ul>
+ * <li>Significant digit counts may be expressed using patterns that
+ * specify a minimum and maximum number of significant digits. These
+ * are indicated by the <code>'@'</code> and <code>'#'</code>
+ * characters. The minimum number of significant digits is the number
+ * of <code>'@'</code> characters. The maximum number of significant
+ * digits is the number of <code>'@'</code> characters plus the number
+ * of <code>'#'</code> characters following on the right. For
+ * example, the pattern <code>"@@@"</code> indicates exactly 3
+ * significant digits. The pattern <code>"@##"</code> indicates from
+ * 1 to 3 significant digits. Trailing zero digits to the right of
+ * the decimal separator are suppressed after the minimum number of
+ * significant digits have been shown. For example, the pattern
+ * <code>"@##"</code> formats the number 0.1203 as
+ * <code>"0.12"</code>.
+ *
+ * <li>If a pattern uses significant digits, it may not contain a
+ * decimal separator, nor the <code>'0'</code> pattern character.
+ * Patterns such as <code>"@00"</code> or <code>"@.###"</code> are
+ * disallowed.
+ *
+ * <li>Any number of <code>'#'</code> characters may be prepended to
+ * the left of the leftmost <code>'@'</code> character. These have no
+ * effect on the minimum and maximum significant digits counts, but
+ * may be used to position grouping separators. For example,
+ * <code>"#,#@#"</code> indicates a minimum of one significant digits,
+ * a maximum of two significant digits, and a grouping size of three.
+ *
+ * <li>In order to enable significant digits formatting, use a pattern
+ * containing the <code>'@'</code> pattern character. Alternatively,
+ * call setSignificantDigitsUsed(TRUE).
+ *
+ * <li>In order to disable significant digits formatting, use a
+ * pattern that does not contain the <code>'@'</code> pattern
+ * character. Alternatively, call setSignificantDigitsUsed(FALSE).
+ *
+ * <li>The number of significant digits has no effect on parsing.
+ *
+ * <li>Significant digits may be used together with exponential notation. Such
+ * patterns are equivalent to a normal exponential pattern with a minimum and
+ * maximum integer digit count of one, a minimum fraction digit count of
+ * <code>getMinimumSignificantDigits() - 1</code>, and a maximum fraction digit
+ * count of <code>getMaximumSignificantDigits() - 1</code>. For example, the
+ * pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>.
+ *
+ * <li>If signficant digits are in use, then the integer and fraction
+ * digit counts, as set via the API, are ignored. If significant
+ * digits are not in use, then the signficant digit counts, as set via
+ * the API, are ignored.
+ *
+ * </ul>
+ *
+ * <p><strong>Padding</strong>
+ *
+ * <p>DecimalFormat supports padding the result of
+ * format() to a specific width. Padding may be specified either
+ * through the API or through the pattern syntax. In a pattern the pad escape
+ * character, followed by a single pad character, causes padding to be parsed
+ * and formatted. The pad escape character is '*' in unlocalized patterns, and
+ * can be localized using DecimalFormatSymbols::setSymbol() with a
+ * DecimalFormatSymbols::kPadEscapeSymbol
+ * selector. For example, <code>"$*x#,##0.00"</code> formats 123 to
+ * <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>.
+ *
+ * <ul>
+ * <li>When padding is in effect, the width of the positive subpattern,
+ * including prefix and suffix, determines the format width. For example, in
+ * the pattern <code>"* #0 o''clock"</code>, the format width is 10.
+ *
+ * <li>The width is counted in 16-bit code units (UChars).
+ *
+ * <li>Some parameters which usually do not matter have meaning when padding is
+ * used, because the pattern width is significant with padding. In the pattern
+ * "* ##,##,#,##0.##", the format width is 14. The initial characters "##,##,"
+ * do not affect the grouping size or maximum integer digits, but they do affect
+ * the format width.
+ *
+ * <li>Padding may be inserted at one of four locations: before the prefix,
+ * after the prefix, before the suffix, or after the suffix. If padding is
+ * specified in any other location, applyPattern()
+ * sets a failing UErrorCode. If there is no prefix,
+ * before the prefix and after the prefix are equivalent, likewise for the
+ * suffix.
+ *
+ * <li>When specified in a pattern, the 32-bit code point immediately
+ * following the pad escape is the pad character. This may be any character,
+ * including a special pattern character. That is, the pad escape
+ * <em>escapes</em> the following character. If there is no character after
+ * the pad escape, then the pattern is illegal.
+ *
+ * </ul>
+ *
+ * <p><strong>Rounding</strong>
+ *
+ * <p>DecimalFormat supports rounding to a specific increment. For
+ * example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the
+ * nearest 0.65 is 1.3. The rounding increment may be specified through the API
+ * or in a pattern. To specify a rounding increment in a pattern, include the
+ * increment in the pattern itself. "#,#50" specifies a rounding increment of
+ * 50. "#,##0.05" specifies a rounding increment of 0.05.
+ *
+ * <ul>
+ * <li>Rounding only affects the string produced by formatting. It does
+ * not affect parsing or change any numerical values.
+ *
+ * <li>A <em>rounding mode</em> determines how values are rounded; see
+ * DecimalFormat::ERoundingMode. Rounding increments specified in
+ * patterns use the default mode, DecimalFormat::kRoundHalfEven.
+ *
+ * <li>Some locales use rounding in their currency formats to reflect the
+ * smallest currency denomination.
+ *
+ * <li>In a pattern, digits '1' through '9' specify rounding, but otherwise
+ * behave identically to digit '0'.
+ * </ul>
+ *
+ * <p><strong>Synchronization</strong>
+ *
+ * <p>DecimalFormat objects are not synchronized. Multiple
+ * threads should not access one formatter concurrently.
+ *
+ * <p><strong>Subclassing</strong>
+ *
+ * <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 DecimalFormat: public NumberFormat {
+public:
+ /**
+ * Rounding mode.
+ * @stable ICU 2.4
+ */
+ enum ERoundingMode {
+ kRoundCeiling, /**< Round towards positive infinity */
+ kRoundFloor, /**< Round towards negative infinity */
+ kRoundDown, /**< Round towards zero */
+ kRoundUp, /**< Round away from zero */
+ kRoundHalfEven, /**< Round towards the nearest integer, or
+ towards the nearest even integer if equidistant */
+ kRoundHalfDown, /**< Round towards the nearest integer, or
+ towards zero if equidistant */
+ kRoundHalfUp /**< Round towards the nearest integer, or
+ away from zero if equidistant */
+ // We don't support ROUND_UNNECESSARY
+ };
+
+ /**
+ * Pad position.
+ * @stable ICU 2.4
+ */
+ enum EPadPosition {
+ kPadBeforePrefix,
+ kPadAfterPrefix,
+ kPadBeforeSuffix,
+ kPadAfterSuffix
+ };
+
+ /**
+ * Create a DecimalFormat using the default pattern and symbols
+ * for the default locale. This is a convenient way to obtain a
+ * DecimalFormat when internationalization is not the main concern.
+ * <P>
+ * To obtain standard formats for a given locale, use the factory methods
+ * on NumberFormat such as createInstance. These factories will
+ * return the most appropriate sub-class of NumberFormat for a given
+ * locale.
+ * @param status Output param set to success/failure code. If the
+ * pattern is invalid this will be set to a failure code.
+ * @stable ICU 2.0
+ */
+ DecimalFormat(UErrorCode& status);
+
+ /**
+ * Create a DecimalFormat from the given pattern and the symbols
+ * for the default locale. This is a convenient way to obtain a
+ * DecimalFormat when internationalization is not the main concern.
+ * <P>
+ * To obtain standard formats for a given locale, use the factory methods
+ * on NumberFormat such as createInstance. These factories will
+ * return the most appropriate sub-class of NumberFormat for a given
+ * locale.
+ * @param pattern A non-localized pattern string.
+ * @param status Output param set to success/failure code. If the
+ * pattern is invalid this will be set to a failure code.
+ * @stable ICU 2.0
+ */
+ DecimalFormat(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * Create a DecimalFormat from the given pattern and symbols.
+ * Use this constructor when you need to completely customize the
+ * behavior of the format.
+ * <P>
+ * To obtain standard formats for a given
+ * locale, use the factory methods on NumberFormat such as
+ * createInstance or createCurrencyInstance. If you need only minor adjustments
+ * to a standard format, you can modify the format returned by
+ * a NumberFormat factory method.
+ *
+ * @param pattern a non-localized pattern string
+ * @param symbolsToAdopt the set of symbols to be used. The caller should not
+ * delete this object after making this call.
+ * @param status Output param set to success/failure code. If the
+ * pattern is invalid this will be set to a failure code.
+ * @stable ICU 2.0
+ */
+ DecimalFormat( const UnicodeString& pattern,
+ DecimalFormatSymbols* symbolsToAdopt,
+ UErrorCode& status);
+
+ /**
+ * Create a DecimalFormat from the given pattern and symbols.
+ * Use this constructor when you need to completely customize the
+ * behavior of the format.
+ * <P>
+ * To obtain standard formats for a given
+ * locale, use the factory methods on NumberFormat such as
+ * createInstance or createCurrencyInstance. If you need only minor adjustments
+ * to a standard format, you can modify the format returned by
+ * a NumberFormat factory method.
+ *
+ * @param pattern a non-localized pattern string
+ * @param symbolsToAdopt the set of symbols to be used. The caller should not
+ * delete this object after making this call.
+ * @param parseError Output param to receive errors occured during parsing
+ * @param status Output param set to success/failure code. If the
+ * pattern is invalid this will be set to a failure code.
+ * @stable ICU 2.0
+ */
+ DecimalFormat( const UnicodeString& pattern,
+ DecimalFormatSymbols* symbolsToAdopt,
+ UParseError& parseError,
+ UErrorCode& status);
+ /**
+ * Create a DecimalFormat from the given pattern and symbols.
+ * Use this constructor when you need to completely customize the
+ * behavior of the format.
+ * <P>
+ * To obtain standard formats for a given
+ * locale, use the factory methods on NumberFormat such as
+ * createInstance or createCurrencyInstance. If you need only minor adjustments
+ * to a standard format, you can modify the format returned by
+ * a NumberFormat factory method.
+ *
+ * @param pattern a non-localized pattern string
+ * @param symbols the set of symbols to be used
+ * @param status Output param set to success/failure code. If the
+ * pattern is invalid this will be set to a failure code.
+ * @stable ICU 2.0
+ */
+ DecimalFormat( const UnicodeString& pattern,
+ const DecimalFormatSymbols& symbols,
+ UErrorCode& status);
+
+ /**
+ * Copy constructor.
+ *
+ * @param source the DecimalFormat object to be copied from.
+ * @stable ICU 2.0
+ */
+ DecimalFormat(const DecimalFormat& source);
+
+ /**
+ * Assignment operator.
+ *
+ * @param rhs the DecimalFormat object to be copied.
+ * @stable ICU 2.0
+ */
+ DecimalFormat& operator=(const DecimalFormat& rhs);
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~DecimalFormat();
+
+ /**
+ * Clone this Format object polymorphically. The caller owns the
+ * result and should delete it when done.
+ *
+ * @return a polymorphic copy of this DecimalFormat.
+ * @stable ICU 2.0
+ */
+ virtual Format* clone(void) const;
+
+ /**
+ * 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 true if the given Format objects are semantically equal.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format& other) const;
+
+ /**
+ * Format a double or long number using base-10 representation.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(double number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+ /**
+ * Format a long number using base-10 representation.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(int32_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+ /**
+ * Format an int64 number using base-10 representation.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.8
+ */
+ virtual UnicodeString& format(int64_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Format a Formattable using base-10 representation.
+ *
+ * @param obj The value to be formatted.
+ * @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 Error code indicating success or failure.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * 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;
+
+ /**
+ * Redeclared NumberFormat method.
+ * Format a double number.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(double number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * Format a long number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(int32_t number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * Format an int64 number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.8
+ */
+ UnicodeString& format(int64_t number,
+ UnicodeString& appendTo) const;
+ /**
+ * Parse the given string using this object's choices. The method
+ * does string comparisons to try to find an optimal match.
+ * If no object can be parsed, index is unchanged, and NULL is
+ * returned. The result is returned as the most parsimonious
+ * type of Formattable that will accomodate all of the
+ * necessary precision. For example, if the result is exactly 12,
+ * it will be returned as a long. However, if it is 1.5, it will
+ * be returned as a double.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param parsePosition The position to start parsing at on input.
+ * On output, moved to after the last successfully
+ * parse character. On parse failure, does not change.
+ * @see Formattable
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& parsePosition) const;
+
+ // Declare here again to get rid of function hiding problems.
+ /**
+ * Parse the given string using this object's choices.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * @param status Output parameter filled in with success or failure status.
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ UErrorCode& status) const;
+
+ /**
+ * Parses text from the given string as a currency amount. Unlike
+ * the parse() method, this method will attempt to parse a generic
+ * currency name, searching for a match of this object's locale's
+ * currency display names, or for a 3-letter ISO currency code.
+ * This method will fail if this format is not a currency format,
+ * that is, if it does not contain the currency pattern symbol
+ * (U+00A4) in its prefix or suffix.
+ *
+ * @param text the string to parse
+ * @param result output parameter to receive result. This will have
+ * its currency set to the parsed ISO currency code.
+ * @param pos input-output position; on input, the position within
+ * text to match; must have 0 <= pos.getIndex() < text.length();
+ * on output, the position after the last matched character. If
+ * the parse fails, the position in unchanged upon output.
+ * @return a reference to result
+ * @internal
+ */
+ virtual Formattable& parseCurrency(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& pos) const;
+
+ /**
+ * Returns the decimal format symbols, which is generally not changed
+ * by the programmer or user.
+ * @return desired DecimalFormatSymbols
+ * @see DecimalFormatSymbols
+ * @stable ICU 2.0
+ */
+ virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const;
+
+ /**
+ * Sets the decimal format symbols, which is generally not changed
+ * by the programmer or user.
+ * @param symbolsToAdopt DecimalFormatSymbols to be adopted.
+ * @stable ICU 2.0
+ */
+ virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt);
+
+ /**
+ * Sets the decimal format symbols, which is generally not changed
+ * by the programmer or user.
+ * @param symbols DecimalFormatSymbols.
+ * @stable ICU 2.0
+ */
+ virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols);
+
+
+ /**
+ * Get the positive prefix.
+ *
+ * @param result Output param which will receive the positive prefix.
+ * @return A reference to 'result'.
+ * Examples: +123, $123, sFr123
+ * @stable ICU 2.0
+ */
+ UnicodeString& getPositivePrefix(UnicodeString& result) const;
+
+ /**
+ * Set the positive prefix.
+ *
+ * @param newValue the new value of the the positive prefix to be set.
+ * Examples: +123, $123, sFr123
+ * @stable ICU 2.0
+ */
+ virtual void setPositivePrefix(const UnicodeString& newValue);
+
+ /**
+ * Get the negative prefix.
+ *
+ * @param result Output param which will receive the negative prefix.
+ * @return A reference to 'result'.
+ * Examples: -123, ($123) (with negative suffix), sFr-123
+ * @stable ICU 2.0
+ */
+ UnicodeString& getNegativePrefix(UnicodeString& result) const;
+
+ /**
+ * Set the negative prefix.
+ *
+ * @param newValue the new value of the the negative prefix to be set.
+ * Examples: -123, ($123) (with negative suffix), sFr-123
+ * @stable ICU 2.0
+ */
+ virtual void setNegativePrefix(const UnicodeString& newValue);
+
+ /**
+ * Get the positive suffix.
+ *
+ * @param result Output param which will receive the positive suffix.
+ * @return A reference to 'result'.
+ * Example: 123%
+ * @stable ICU 2.0
+ */
+ UnicodeString& getPositiveSuffix(UnicodeString& result) const;
+
+ /**
+ * Set the positive suffix.
+ *
+ * @param newValue the new value of the positive suffix to be set.
+ * Example: 123%
+ * @stable ICU 2.0
+ */
+ virtual void setPositiveSuffix(const UnicodeString& newValue);
+
+ /**
+ * Get the negative suffix.
+ *
+ * @param result Output param which will receive the negative suffix.
+ * @return A reference to 'result'.
+ * Examples: -123%, ($123) (with positive suffixes)
+ * @stable ICU 2.0
+ */
+ UnicodeString& getNegativeSuffix(UnicodeString& result) const;
+
+ /**
+ * Set the negative suffix.
+ *
+ * @param newValue the new value of the negative suffix to be set.
+ * Examples: 123%
+ * @stable ICU 2.0
+ */
+ virtual void setNegativeSuffix(const UnicodeString& newValue);
+
+ /**
+ * Get the multiplier for use in percent, permill, etc.
+ * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
+ * (For Arabic, use arabic percent symbol).
+ * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
+ *
+ * @return the multiplier for use in percent, permill, etc.
+ * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
+ * @stable ICU 2.0
+ */
+ int32_t getMultiplier(void) const;
+
+ /**
+ * Set the multiplier for use in percent, permill, etc.
+ * For a percentage, set the suffixes to have "%" and the multiplier to be 100.
+ * (For Arabic, use arabic percent symbol).
+ * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000.
+ *
+ * @param newValue the new value of the multiplier for use in percent, permill, etc.
+ * Examples: with 100, 1.23 -> "123", and "123" -> 1.23
+ * @stable ICU 2.0
+ */
+ virtual void setMultiplier(int32_t newValue);
+
+ /**
+ * Get the rounding increment.
+ * @return A positive rounding increment, or 0.0 if rounding
+ * is not in effect.
+ * @see #setRoundingIncrement
+ * @see #getRoundingMode
+ * @see #setRoundingMode
+ * @stable ICU 2.0
+ */
+ virtual double getRoundingIncrement(void) const;
+
+ /**
+ * Set the rounding increment. This method also controls whether
+ * rounding is enabled.
+ * @param newValue A positive rounding increment, or 0.0 to disable rounding.
+ * Negative increments are equivalent to 0.0.
+ * @see #getRoundingIncrement
+ * @see #getRoundingMode
+ * @see #setRoundingMode
+ * @stable ICU 2.0
+ */
+ virtual void setRoundingIncrement(double newValue);
+
+ /**
+ * Get the rounding mode.
+ * @return A rounding mode
+ * @see #setRoundingIncrement
+ * @see #getRoundingIncrement
+ * @see #setRoundingMode
+ * @stable ICU 2.0
+ */
+ virtual ERoundingMode getRoundingMode(void) const;
+
+ /**
+ * Set the rounding mode. This has no effect unless the rounding
+ * increment is greater than zero.
+ * @param roundingMode A rounding mode
+ * @see #setRoundingIncrement
+ * @see #getRoundingIncrement
+ * @see #getRoundingMode
+ * @stable ICU 2.0
+ */
+ virtual void setRoundingMode(ERoundingMode roundingMode);
+
+ /**
+ * Get the width to which the output of format() is padded.
+ * The width is counted in 16-bit code units.
+ * @return the format width, or zero if no padding is in effect
+ * @see #setFormatWidth
+ * @see #getPadCharacterString
+ * @see #setPadCharacter
+ * @see #getPadPosition
+ * @see #setPadPosition
+ * @stable ICU 2.0
+ */
+ virtual int32_t getFormatWidth(void) const;
+
+ /**
+ * Set the width to which the output of format() is padded.
+ * The width is counted in 16-bit code units.
+ * This method also controls whether padding is enabled.
+ * @param width the width to which to pad the result of
+ * format(), or zero to disable padding. A negative
+ * width is equivalent to 0.
+ * @see #getFormatWidth
+ * @see #getPadCharacterString
+ * @see #setPadCharacter
+ * @see #getPadPosition
+ * @see #setPadPosition
+ * @stable ICU 2.0
+ */
+ virtual void setFormatWidth(int32_t width);
+
+ /**
+ * Get the pad character used to pad to the format width. The
+ * default is ' '.
+ * @return a string containing the pad character. This will always
+ * have a length of one 32-bit code point.
+ * @see #setFormatWidth
+ * @see #getFormatWidth
+ * @see #setPadCharacter
+ * @see #getPadPosition
+ * @see #setPadPosition
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString getPadCharacterString() const;
+
+ /**
+ * Set the character used to pad to the format width. If padding
+ * is not enabled, then this will take effect if padding is later
+ * enabled.
+ * @param padChar a string containing the pad charcter. If the string
+ * has length 0, then the pad characer is set to ' '. Otherwise
+ * padChar.char32At(0) will be used as the pad character.
+ * @see #setFormatWidth
+ * @see #getFormatWidth
+ * @see #getPadCharacterString
+ * @see #getPadPosition
+ * @see #setPadPosition
+ * @stable ICU 2.0
+ */
+ virtual void setPadCharacter(const UnicodeString &padChar);
+
+ /**
+ * Get the position at which padding will take place. This is the location
+ * at which padding will be inserted if the result of format()
+ * is shorter than the format width.
+ * @return the pad position, one of kPadBeforePrefix,
+ * kPadAfterPrefix, kPadBeforeSuffix, or
+ * kPadAfterSuffix.
+ * @see #setFormatWidth
+ * @see #getFormatWidth
+ * @see #setPadCharacter
+ * @see #getPadCharacterString
+ * @see #setPadPosition
+ * @see #kPadBeforePrefix
+ * @see #kPadAfterPrefix
+ * @see #kPadBeforeSuffix
+ * @see #kPadAfterSuffix
+ * @stable ICU 2.0
+ */
+ virtual EPadPosition getPadPosition(void) const;
+
+ /**
+ * Set the position at which padding will take place. This is the location
+ * at which padding will be inserted if the result of format()
+ * is shorter than the format width. This has no effect unless padding is
+ * enabled.
+ * @param padPos the pad position, one of kPadBeforePrefix,
+ * kPadAfterPrefix, kPadBeforeSuffix, or
+ * kPadAfterSuffix.
+ * @see #setFormatWidth
+ * @see #getFormatWidth
+ * @see #setPadCharacter
+ * @see #getPadCharacterString
+ * @see #getPadPosition
+ * @see #kPadBeforePrefix
+ * @see #kPadAfterPrefix
+ * @see #kPadBeforeSuffix
+ * @see #kPadAfterSuffix
+ * @stable ICU 2.0
+ */
+ virtual void setPadPosition(EPadPosition padPos);
+
+ /**
+ * Return whether or not scientific notation is used.
+ * @return TRUE if this object formats and parses scientific notation
+ * @see #setScientificNotation
+ * @see #getMinimumExponentDigits
+ * @see #setMinimumExponentDigits
+ * @see #isExponentSignAlwaysShown
+ * @see #setExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual UBool isScientificNotation(void);
+
+ /**
+ * Set whether or not scientific notation is used. When scientific notation
+ * is used, the effective maximum number of integer digits is <= 8. If the
+ * maximum number of integer digits is set to more than 8, the effective
+ * maximum will be 1. This allows this call to generate a 'default' scientific
+ * number format without additional changes.
+ * @param useScientific TRUE if this object formats and parses scientific
+ * notation
+ * @see #isScientificNotation
+ * @see #getMinimumExponentDigits
+ * @see #setMinimumExponentDigits
+ * @see #isExponentSignAlwaysShown
+ * @see #setExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual void setScientificNotation(UBool useScientific);
+
+ /**
+ * Return the minimum exponent digits that will be shown.
+ * @return the minimum exponent digits that will be shown
+ * @see #setScientificNotation
+ * @see #isScientificNotation
+ * @see #setMinimumExponentDigits
+ * @see #isExponentSignAlwaysShown
+ * @see #setExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual int8_t getMinimumExponentDigits(void) const;
+
+ /**
+ * Set the minimum exponent digits that will be shown. This has no
+ * effect unless scientific notation is in use.
+ * @param minExpDig a value >= 1 indicating the fewest exponent digits
+ * that will be shown. Values less than 1 will be treated as 1.
+ * @see #setScientificNotation
+ * @see #isScientificNotation
+ * @see #getMinimumExponentDigits
+ * @see #isExponentSignAlwaysShown
+ * @see #setExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual void setMinimumExponentDigits(int8_t minExpDig);
+
+ /**
+ * Return whether the exponent sign is always shown.
+ * @return TRUE if the exponent is always prefixed with either the
+ * localized minus sign or the localized plus sign, false if only negative
+ * exponents are prefixed with the localized minus sign.
+ * @see #setScientificNotation
+ * @see #isScientificNotation
+ * @see #setMinimumExponentDigits
+ * @see #getMinimumExponentDigits
+ * @see #setExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual UBool isExponentSignAlwaysShown(void);
+
+ /**
+ * Set whether the exponent sign is always shown. This has no effect
+ * unless scientific notation is in use.
+ * @param expSignAlways TRUE if the exponent is always prefixed with either
+ * the localized minus sign or the localized plus sign, false if only
+ * negative exponents are prefixed with the localized minus sign.
+ * @see #setScientificNotation
+ * @see #isScientificNotation
+ * @see #setMinimumExponentDigits
+ * @see #getMinimumExponentDigits
+ * @see #isExponentSignAlwaysShown
+ * @stable ICU 2.0
+ */
+ virtual void setExponentSignAlwaysShown(UBool expSignAlways);
+
+ /**
+ * Return the grouping size. Grouping size is the number of digits between
+ * grouping separators in the integer portion of a number. For example,
+ * in the number "123,456.78", the grouping size is 3.
+ *
+ * @return the grouping size.
+ * @see setGroupingSize
+ * @see NumberFormat::isGroupingUsed
+ * @see DecimalFormatSymbols::getGroupingSeparator
+ * @stable ICU 2.0
+ */
+ int32_t getGroupingSize(void) const;
+
+ /**
+ * Set the grouping size. Grouping size is the number of digits between
+ * grouping separators in the integer portion of a number. For example,
+ * in the number "123,456.78", the grouping size is 3.
+ *
+ * @param newValue the new value of the grouping size.
+ * @see getGroupingSize
+ * @see NumberFormat::setGroupingUsed
+ * @see DecimalFormatSymbols::setGroupingSeparator
+ * @stable ICU 2.0
+ */
+ virtual void setGroupingSize(int32_t newValue);
+
+ /**
+ * Return the secondary grouping size. In some locales one
+ * grouping interval is used for the least significant integer
+ * digits (the primary grouping size), and another is used for all
+ * others (the secondary grouping size). A formatter supporting a
+ * secondary grouping size will return a positive integer unequal
+ * to the primary grouping size returned by
+ * getGroupingSize(). For example, if the primary
+ * grouping size is 4, and the secondary grouping size is 2, then
+ * the number 123456789 formats as "1,23,45,6789", and the pattern
+ * appears as "#,##,###0".
+ * @return the secondary grouping size, or a value less than
+ * one if there is none
+ * @see setSecondaryGroupingSize
+ * @see NumberFormat::isGroupingUsed
+ * @see DecimalFormatSymbols::getGroupingSeparator
+ * @stable ICU 2.4
+ */
+ int32_t getSecondaryGroupingSize(void) const;
+
+ /**
+ * Set the secondary grouping size. If set to a value less than 1,
+ * then secondary grouping is turned off, and the primary grouping
+ * size is used for all intervals, not just the least significant.
+ *
+ * @param newValue the new value of the secondary grouping size.
+ * @see getSecondaryGroupingSize
+ * @see NumberFormat#setGroupingUsed
+ * @see DecimalFormatSymbols::setGroupingSeparator
+ * @stable ICU 2.4
+ */
+ virtual void setSecondaryGroupingSize(int32_t newValue);
+
+ /**
+ * Allows you to get the behavior of the decimal separator with integers.
+ * (The decimal separator will always appear with decimals.)
+ *
+ * @return TRUE if the decimal separator always appear with decimals.
+ * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+ * @stable ICU 2.0
+ */
+ UBool isDecimalSeparatorAlwaysShown(void) const;
+
+ /**
+ * Allows you to set the behavior of the decimal separator with integers.
+ * (The decimal separator will always appear with decimals.)
+ *
+ * @param newValue set TRUE if the decimal separator will always appear with decimals.
+ * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+ * @stable ICU 2.0
+ */
+ virtual void setDecimalSeparatorAlwaysShown(UBool newValue);
+
+ /**
+ * Synthesizes a pattern string that represents the current state
+ * of this Format object.
+ *
+ * @param result Output param which will receive the pattern.
+ * Previous contents are deleted.
+ * @return A reference to 'result'.
+ * @see applyPattern
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toPattern(UnicodeString& result) const;
+
+ /**
+ * Synthesizes a localized pattern string that represents the current
+ * state of this Format object.
+ *
+ * @param result Output param which will receive the localized pattern.
+ * Previous contents are deleted.
+ * @return A reference to 'result'.
+ * @see applyPattern
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const;
+
+ /**
+ * Apply the given pattern to this Format object. A pattern is a
+ * short-hand specification for the various formatting properties.
+ * These properties can also be changed individually through the
+ * various setter methods.
+ * <P>
+ * There is no limit to integer digits are set
+ * by this routine, since that is the typical end-user desire;
+ * use setMaximumInteger if you want to set a real value.
+ * For negative numbers, use a second pattern, separated by a semicolon
+ * <pre>
+ * . Example "#,#00.0#" -> 1,234.56
+ * </pre>
+ * This means a minimum of 2 integer digits, 1 fraction digit, and
+ * a maximum of 2 fraction digits.
+ * <pre>
+ * . Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
+ * </pre>
+ * In negative patterns, the minimum and maximum counts are ignored;
+ * these are presumed to be set in the positive pattern.
+ *
+ * @param pattern The pattern to be applied.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UParseError& parseError,
+ UErrorCode& status);
+ /**
+ * Sets the pattern.
+ * @param pattern The pattern to be applied.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * Apply the given pattern to this Format object. The pattern
+ * is assumed to be in a localized notation. A pattern is a
+ * short-hand specification for the various formatting properties.
+ * These properties can also be changed individually through the
+ * various setter methods.
+ * <P>
+ * There is no limit to integer digits are set
+ * by this routine, since that is the typical end-user desire;
+ * use setMaximumInteger if you want to set a real value.
+ * For negative numbers, use a second pattern, separated by a semicolon
+ * <pre>
+ * . Example "#,#00.0#" -> 1,234.56
+ * </pre>
+ * This means a minimum of 2 integer digits, 1 fraction digit, and
+ * a maximum of 2 fraction digits.
+ *
+ * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
+ *
+ * In negative patterns, the minimum and maximum counts are ignored;
+ * these are presumed to be set in the positive pattern.
+ *
+ * @param pattern The localized pattern to be applied.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyLocalizedPattern(const UnicodeString& pattern,
+ UParseError& parseError,
+ UErrorCode& status);
+
+ /**
+ * Apply the given pattern to this Format object.
+ *
+ * @param pattern The localized pattern to be applied.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyLocalizedPattern(const UnicodeString& pattern,
+ UErrorCode& status);
+
+
+ /**
+ * Sets the maximum number of digits allowed in the integer portion of a
+ * number. This override limits the integer digit count to 309.
+ *
+ * @param newValue the new value of the maximum number of digits
+ * allowed in the integer portion of a number.
+ * @see NumberFormat#setMaximumIntegerDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMaximumIntegerDigits(int32_t newValue);
+
+ /**
+ * Sets the minimum number of digits allowed in the integer portion of a
+ * number. This override limits the integer digit count to 309.
+ *
+ * @param newValue the new value of the minimum number of digits
+ * allowed in the integer portion of a number.
+ * @see NumberFormat#setMinimumIntegerDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMinimumIntegerDigits(int32_t newValue);
+
+ /**
+ * Sets the maximum number of digits allowed in the fraction portion of a
+ * number. This override limits the fraction digit count to 340.
+ *
+ * @param newValue the new value of the maximum number of digits
+ * allowed in the fraction portion of a number.
+ * @see NumberFormat#setMaximumFractionDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMaximumFractionDigits(int32_t newValue);
+
+ /**
+ * Sets the minimum number of digits allowed in the fraction portion of a
+ * number. This override limits the fraction digit count to 340.
+ *
+ * @param newValue the new value of the minimum number of digits
+ * allowed in the fraction portion of a number.
+ * @see NumberFormat#setMinimumFractionDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMinimumFractionDigits(int32_t newValue);
+
+ /**
+ * Returns the minimum number of significant digits that will be
+ * displayed. This value has no effect unless areSignificantDigitsUsed()
+ * returns true.
+ * @return the fewest significant digits that will be shown
+ * @stable ICU 3.0
+ */
+ int32_t getMinimumSignificantDigits() const;
+
+ /**
+ * Returns the maximum number of significant digits that will be
+ * displayed. This value has no effect unless areSignificantDigitsUsed()
+ * returns true.
+ * @return the most significant digits that will be shown
+ * @stable ICU 3.0
+ */
+ int32_t getMaximumSignificantDigits() const;
+
+ /**
+ * Sets the minimum number of significant digits that will be
+ * displayed. If <code>min</code> is less than one then it is set
+ * to one. If the maximum significant digits count is less than
+ * <code>min</code>, then it is set to <code>min</code>. This
+ * value has no effect unless areSignificantDigits() returns true.
+ * @param min the fewest significant digits to be shown
+ * @stable ICU 3.0
+ */
+ void setMinimumSignificantDigits(int32_t min);
+
+ /**
+ * Sets the maximum number of significant digits that will be
+ * displayed. If <code>max</code> is less than one then it is set
+ * to one. If the minimum significant digits count is greater
+ * than <code>max</code>, then it is set to <code>max</code>.
+ * This value has no effect unless areSignificantDigits() returns
+ * true.
+ * @param max the most significant digits to be shown
+ * @stable ICU 3.0
+ */
+ void setMaximumSignificantDigits(int32_t max);
+
+ /**
+ * Returns true if significant digits are in use, or false if
+ * integer and fraction digit counts are in use.
+ * @return true if significant digits are in use
+ * @stable ICU 3.0
+ */
+ UBool areSignificantDigitsUsed() const;
+
+ /**
+ * Sets whether significant digits are in use, or integer and
+ * fraction digit counts are in use.
+ * @param useSignificantDigits true to use significant digits, or
+ * false to use integer and fraction digit counts
+ * @stable ICU 3.0
+ */
+ void setSignificantDigitsUsed(UBool useSignificantDigits);
+
+ public:
+ /**
+ * Sets the currency used to display currency
+ * amounts. This takes effect immediately, if this format is a
+ * currency format. If this format is not a currency format, then
+ * the currency is used if and when this object becomes a
+ * currency format through the application of a new pattern.
+ * @param theCurrency a 3-letter ISO code indicating new currency
+ * to use. It need not be null-terminated. May be the empty
+ * string or NULL to indicate no currency.
+ * @param ec input-output error code
+ * @stable ICU 3.0
+ */
+ virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
+
+ /**
+ * Sets the currency used to display currency amounts. See
+ * setCurrency(const UChar*, UErrorCode&).
+ * @deprecated ICU 3.0. Use setCurrency(const UChar*, UErrorCode&).
+ */
+ virtual void setCurrency(const UChar* theCurrency);
+
+ /**
+ * The resource tags we use to retrieve decimal format data from
+ * locale resource bundles.
+ * @deprecated ICU 3.4. This string has no public purpose. Please don't use it.
+ */
+ static const char fgNumberPatterns[];
+
+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() ==
+ * . Derived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+private:
+ DecimalFormat(); // default constructor not implemented
+
+ int32_t precision(UBool isIntegral) const;
+
+ /**
+ * Do real work of constructing a new DecimalFormat.
+ */
+ void construct(UErrorCode& status,
+ UParseError& parseErr,
+ const UnicodeString* pattern = 0,
+ DecimalFormatSymbols* symbolsToAdopt = 0
+ );
+
+ /**
+ * Does the real work of generating a pattern.
+ *
+ * @param result Output param which will receive the pattern.
+ * Previous contents are deleted.
+ * @param localized TRUE return localized pattern.
+ * @return A reference to 'result'.
+ */
+ UnicodeString& toPattern(UnicodeString& result, UBool localized) const;
+
+ /**
+ * Does the real work of applying a pattern.
+ * @param pattern The pattern to be applied.
+ * @param localized If true, the pattern is localized; else false.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ */
+ void applyPattern(const UnicodeString& pattern,
+ UBool localized,
+ UParseError& parseError,
+ UErrorCode& status);
+ /**
+ * Do the work of formatting a number, either a double or a long.
+ *
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param fieldPosition On input: an alignment field, if desired.
+ * On output: the offsets of the alignment field.
+ * @param digits the digits to be formatted.
+ * @param isInteger if TRUE format the digits as Integer.
+ * @return Reference to 'appendTo' parameter.
+ */
+ UnicodeString& subformat(UnicodeString& appendTo,
+ FieldPosition& fieldPosition,
+ DigitList& digits,
+ UBool isInteger) const;
+
+ void parse(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& pos,
+ UBool parseCurrency) const;
+
+ enum {
+ fgStatusInfinite,
+ fgStatusLength // Leave last in list.
+ } StatusFlags;
+
+ UBool subparse(const UnicodeString& text, ParsePosition& parsePosition,
+ DigitList& digits, UBool* status,
+ UChar* currency) const;
+
+ int32_t skipPadding(const UnicodeString& text, int32_t position) const;
+
+ int32_t compareAffix(const UnicodeString& input,
+ int32_t pos,
+ UBool isNegative,
+ UBool isPrefix,
+ UChar* currency) const;
+
+ static int32_t compareSimpleAffix(const UnicodeString& affix,
+ const UnicodeString& input,
+ int32_t pos);
+
+ static int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t pos);
+
+ static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos);
+
+ int32_t compareComplexAffix(const UnicodeString& affixPat,
+ const UnicodeString& input,
+ int32_t pos,
+ UChar* currency) const;
+
+ static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch);
+
+ static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str);
+
+ /**
+ * Get a decimal format symbol.
+ * Returns a const reference to the symbol string.
+ * @internal
+ */
+ inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
+
+ int32_t appendAffix(UnicodeString& buf, double number,
+ UBool isNegative, UBool isPrefix) const;
+
+ /**
+ * Append an affix to the given UnicodeString, using quotes if
+ * there are special characters. Single quotes themselves must be
+ * escaped in either case.
+ */
+ void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& affix,
+ UBool localized) const;
+
+ void appendAffixPattern(UnicodeString& appendTo,
+ const UnicodeString* affixPattern,
+ const UnicodeString& expAffix, UBool localized) const;
+
+ void expandAffix(const UnicodeString& pattern,
+ UnicodeString& affix,
+ double number,
+ UBool doFormat) const;
+
+ void expandAffixes();
+
+ static double round(double a, ERoundingMode mode, UBool isNegative);
+
+ void addPadding(UnicodeString& appendTo,
+ FieldPosition& fieldPosition,
+ int32_t prefixLen, int32_t suffixLen) const;
+
+ UBool isGroupingPosition(int32_t pos) const;
+
+ void setCurrencyForSymbols();
+
+ /**
+ * Constants.
+ */
+ //static const int8_t fgMaxDigit; // The largest digit, in this case 9
+
+ /*transient*/ //DigitList* fDigitList;
+
+ UnicodeString fPositivePrefix;
+ UnicodeString fPositiveSuffix;
+ UnicodeString fNegativePrefix;
+ UnicodeString fNegativeSuffix;
+ UnicodeString* fPosPrefixPattern;
+ UnicodeString* fPosSuffixPattern;
+ UnicodeString* fNegPrefixPattern;
+ UnicodeString* fNegSuffixPattern;
+
+ /**
+ * Formatter for ChoiceFormat-based currency names. If this field
+ * is not null, then delegate to it to format currency symbols.
+ * @since ICU 2.6
+ */
+ ChoiceFormat* fCurrencyChoice;
+
+ int32_t fMultiplier;
+ int32_t fGroupingSize;
+ int32_t fGroupingSize2;
+ UBool fDecimalSeparatorAlwaysShown;
+ /*transient*/ UBool fIsCurrencyFormat;
+ DecimalFormatSymbols* fSymbols;
+
+ UBool fUseSignificantDigits;
+ int32_t fMinSignificantDigits;
+ int32_t fMaxSignificantDigits;
+
+ UBool fUseExponentialNotation;
+ int8_t fMinExponentDigits;
+ UBool fExponentSignAlwaysShown;
+
+ /* If fRoundingIncrement is NULL, there is no rounding. Otherwise, round to
+ * fRoundingIncrement.getDouble(). Since this operation may be expensive,
+ * we cache the result in fRoundingDouble. All methods that update
+ * fRoundingIncrement also update fRoundingDouble. */
+ DigitList* fRoundingIncrement;
+ /*transient*/ double fRoundingDouble;
+ ERoundingMode fRoundingMode;
+
+ UChar32 fPad;
+ int32_t fFormatWidth;
+ EPadPosition fPadPosition;
+
+protected:
+
+ /**
+ * Returns the currency in effect for this formatter. Subclasses
+ * should override this method as needed. Unlike getCurrency(),
+ * this method should never return "".
+ * @result output parameter for null-terminated result, which must
+ * have a capacity of at least 4
+ * @internal
+ */
+ virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
+
+ /** number of integer digits
+ * @stable ICU 2.4
+ */
+ static const int32_t kDoubleIntegerDigits;
+ /** number of fraction digits
+ * @stable ICU 2.4
+ */
+ static const int32_t kDoubleFractionDigits;
+
+ /**
+ * When someone turns on scientific mode, we assume that more than this
+ * number of digits is due to flipping from some other mode that didn't
+ * restrict the maximum, and so we force 1 integer digit. We don't bother
+ * to track and see if someone is using exponential notation with more than
+ * this number, it wouldn't make sense anyway, and this is just to make sure
+ * that someone turning on scientific mode with default settings doesn't
+ * end up with lots of zeroes.
+ * @stable ICU 2.8
+ */
+ static const int32_t kMaxScientificIntegerDigits;
+};
+
+inline UnicodeString&
+DecimalFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ // Don't use Format:: - use immediate base class only,
+ // in case immediate base modifies behavior later.
+ return NumberFormat::format(obj, appendTo, status);
+}
+
+inline UnicodeString&
+DecimalFormat::format(double number,
+ UnicodeString& appendTo) const {
+ FieldPosition pos(0);
+ return format(number, appendTo, pos);
+}
+
+inline UnicodeString&
+DecimalFormat::format(int32_t number,
+ UnicodeString& appendTo) const {
+ FieldPosition pos(0);
+ return format((int64_t)number, appendTo, pos);
+}
+
+inline const UnicodeString &
+DecimalFormat::getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const {
+ return fSymbols->getConstSymbol(symbol);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _DECIMFMT
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h b/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h
new file mode 100644
index 00000000000..5bc73fef829
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dtfmtsym.h
@@ -0,0 +1,698 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File DTFMTSYM.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 07/21/98 stephen Added getZoneIndex()
+* Changed to match C++ conventions
+********************************************************************************
+*/
+
+#ifndef DTFMTSYM_H
+#define DTFMTSYM_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/calendar.h"
+#include "unicode/uobject.h"
+#include "unicode/locid.h"
+#include "unicode/ures.h"
+
+/**
+ * \file
+ * \brief C++ API: Symbols for formatting dates.
+ */
+
+U_NAMESPACE_BEGIN
+
+/* forward declaration */
+class SimpleDateFormat;
+class Hashtable;
+class ZoneStringFormat;
+class SafeZoneStringFormatPtr;
+
+/**
+ * DateFormatSymbols is a public class for encapsulating localizable date-time
+ * formatting data -- including timezone data. DateFormatSymbols is used by
+ * DateFormat and SimpleDateFormat.
+ * <P>
+ * Rather than first creating a DateFormatSymbols to get a date-time formatter
+ * by using a SimpleDateFormat constructor, clients are encouraged to create a
+ * date-time formatter using the getTimeInstance(), getDateInstance(), or
+ * getDateTimeInstance() method in DateFormat. Each of these methods can return a
+ * date/time formatter initialized with a default format pattern along with the
+ * date-time formatting data for a given or default locale. After a formatter is
+ * created, clients may modify the format pattern using the setPattern function
+ * as so desired. For more information on using these formatter factory
+ * functions, see DateFormat.
+ * <P>
+ * If clients decide to create a date-time formatter with a particular format
+ * pattern and locale, they can do so with new SimpleDateFormat(aPattern,
+ * new DateFormatSymbols(aLocale)). This will load the appropriate date-time
+ * formatting data from the locale.
+ * <P>
+ * DateFormatSymbols objects are clonable. When clients obtain a
+ * DateFormatSymbols object, they can feel free to modify the date-time
+ * formatting data as necessary. For instance, clients can
+ * replace the localized date-time format pattern characters with the ones that
+ * they feel easy to remember. Or they can change the representative cities
+ * originally picked by default to using their favorite ones.
+ * <P>
+ * DateFormatSymbols are not expected to be subclassed. Data for a calendar is
+ * loaded out of resource bundles. The 'type' parameter indicates the type of
+ * calendar, for example, "gregorian" or "japanese". If the type is not gregorian
+ * (or NULL, or an empty string) then the type is appended to the resource name,
+ * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did
+ * not exist (even in root), then this class will fall back to just 'Eras', that is,
+ * Gregorian data. Therefore, the calendar implementor MUST ensure that the root
+ * locale at least contains any resources that are to be particularized for the
+ * calendar type.
+ */
+class U_I18N_API DateFormatSymbols : public UObject {
+public:
+ /**
+ * Construct a DateFormatSymbols object by loading format data from
+ * resources for the default locale, in the default calendar (Gregorian).
+ * <P>
+ * NOTE: This constructor will never fail; if it cannot get resource
+ * data for the default locale, it will return a last-resort object
+ * based on hard-coded strings.
+ *
+ * @param status Status code. Failure
+ * results if the resources for the default cannot be
+ * found or cannot be loaded
+ * @stable ICU 2.0
+ */
+ DateFormatSymbols(UErrorCode& status);
+
+ /**
+ * Construct a DateFormatSymbols object by loading format data from
+ * resources for the given locale, in the default calendar (Gregorian).
+ *
+ * @param locale Locale to load format data from.
+ * @param status Status code. Failure
+ * results if the resources for the locale cannot be
+ * found or cannot be loaded
+ * @stable ICU 2.0
+ */
+ DateFormatSymbols(const Locale& locale,
+ UErrorCode& status);
+
+ /**
+ * Construct a DateFormatSymbols object by loading format data from
+ * resources for the default locale, in the default calendar (Gregorian).
+ * <P>
+ * NOTE: This constructor will never fail; if it cannot get resource
+ * data for the default locale, it will return a last-resort object
+ * based on hard-coded strings.
+ *
+ * @param type Type of calendar (as returned by Calendar::getType).
+ * Will be used to access the correct set of strings.
+ * (NULL or empty string defaults to "gregorian".)
+ * @param status Status code. Failure
+ * results if the resources for the default cannot be
+ * found or cannot be loaded
+ * @internal
+ */
+ DateFormatSymbols(const char *type, UErrorCode& status);
+
+ /**
+ * Construct a DateFormatSymbols object by loading format data from
+ * resources for the given locale, in the default calendar (Gregorian).
+ *
+ * @param locale Locale to load format data from.
+ * @param type Type of calendar (as returned by Calendar::getType).
+ * Will be used to access the correct set of strings.
+ * (NULL or empty string defaults to "gregorian".)
+ * @param status Status code. Failure
+ * results if the resources for the locale cannot be
+ * found or cannot be loaded
+ * @internal
+ */
+ DateFormatSymbols(const Locale& locale,
+ const char *type,
+ UErrorCode& status);
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.0
+ */
+ DateFormatSymbols(const DateFormatSymbols&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.0
+ */
+ DateFormatSymbols& operator=(const DateFormatSymbols&);
+
+ /**
+ * Destructor. This is nonvirtual because this class is not designed to be
+ * subclassed.
+ * @stable ICU 2.0
+ */
+ virtual ~DateFormatSymbols();
+
+ /**
+ * Return true if another object is semantically equal to this one.
+ *
+ * @param other the DateFormatSymbols object to be compared with.
+ * @return true if other is semantically equal to this.
+ * @stable ICU 2.0
+ */
+ UBool operator==(const DateFormatSymbols& other) const;
+
+ /**
+ * Return true if another object is semantically unequal to this one.
+ *
+ * @param other the DateFormatSymbols object to be compared with.
+ * @return true if other is semantically unequal to this.
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); }
+
+ /**
+ * Gets era strings. For example: "AD" and "BC".
+ *
+ * @param count Filled in with length of the array.
+ * @return the era strings.
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getEras(int32_t& count) const;
+
+ /**
+ * Sets era strings. For example: "AD" and "BC".
+ * @param eras Array of era strings (DateFormatSymbols retains ownership.)
+ * @param count Filled in with length of the array.
+ * @stable ICU 2.0
+ */
+ void setEras(const UnicodeString* eras, int32_t count);
+
+ /**
+ * Gets era name strings. For example: "Anno Domini" and "Before Christ".
+ *
+ * @param count Filled in with length of the array.
+ * @return the era name strings.
+ * @stable ICU 3.4
+ */
+ const UnicodeString* getEraNames(int32_t& count) const;
+
+ /**
+ * Sets era name strings. For example: "Anno Domini" and "Before Christ".
+ * @param eraNames Array of era name strings (DateFormatSymbols retains ownership.)
+ * @param count Filled in with length of the array.
+ * @stable ICU 3.6
+ */
+ void setEraNames(const UnicodeString* eraNames, int32_t count);
+
+ /**
+ * Gets month strings. For example: "January", "February", etc.
+ * @param count Filled in with length of the array.
+ * @return the month strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getMonths(int32_t& count) const;
+
+ /**
+ * Sets month strings. For example: "January", "February", etc.
+ *
+ * @param months the new month strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @stable ICU 2.0
+ */
+ void setMonths(const UnicodeString* months, int32_t count);
+
+ /**
+ * Gets short month strings. For example: "Jan", "Feb", etc.
+ *
+ * @param count Filled in with length of the array.
+ * @return the short month strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getShortMonths(int32_t& count) const;
+
+ /**
+ * Sets short month strings. For example: "Jan", "Feb", etc.
+ * @param count Filled in with length of the array.
+ * @param shortMonths the new short month strings. (not adopted; caller retains ownership)
+ * @stable ICU 2.0
+ */
+ void setShortMonths(const UnicodeString* shortMonths, int32_t count);
+
+ /**
+ * Selector for date formatting context
+ * @stable ICU 3.6
+ */
+ enum DtContextType {
+ FORMAT,
+ STANDALONE,
+ DT_CONTEXT_COUNT
+ };
+
+ /**
+ * Selector for date formatting width
+ * @stable ICU 3.6
+ */
+ enum DtWidthType {
+ ABBREVIATED,
+ WIDE,
+ NARROW,
+ DT_WIDTH_COUNT
+ };
+
+ /**
+ * Gets month strings by width and context. For example: "January", "February", etc.
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
+ * @return the month strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 3.4
+ */
+ const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const;
+
+ /**
+ * Sets month strings by width and context. For example: "January", "February", etc.
+ *
+ * @param months The new month strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW.
+ * @stable ICU 3.6
+ */
+ void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
+ * Gets weekday strings. For example: "Sunday", "Monday", etc.
+ * @param count Filled in with length of the array.
+ * @return the weekday strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getWeekdays(int32_t& count) const;
+
+
+ /**
+ * Sets weekday strings. For example: "Sunday", "Monday", etc.
+ * @param weekdays the new weekday strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @stable ICU 2.0
+ */
+ void setWeekdays(const UnicodeString* weekdays, int32_t count);
+
+ /**
+ * Gets short weekday strings. For example: "Sun", "Mon", etc.
+ * @param count Filled in with length of the array.
+ * @return the short weekday strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getShortWeekdays(int32_t& count) const;
+
+ /**
+ * Sets short weekday strings. For example: "Sun", "Mon", etc.
+ * @param shortWeekdays the new short weekday strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @stable ICU 2.0
+ */
+ void setShortWeekdays(const UnicodeString* shortWeekdays, int32_t count);
+
+ /**
+ * Gets weekday strings by width and context. For example: "Sunday", "Monday", etc.
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
+ * @return the month strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 3.4
+ */
+ const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const;
+
+ /**
+ * Sets weekday strings by width and context. For example: "Sunday", "Monday", etc.
+ * @param weekdays The new weekday strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW
+ * @stable ICU 3.6
+ */
+ void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
+ * Gets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE or ABBREVIATED. There
+ * are no NARROW quarters.
+ * @return the quarter strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 3.6
+ */
+ const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const;
+
+ /**
+ * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc.
+ *
+ * @param quarters The new quarter strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @param context The formatting context, either FORMAT or STANDALONE
+ * @param width The width of returned strings, either WIDE or ABBREVIATED. There
+ * are no NARROW quarters.
+ * @stable ICU 3.6
+ */
+ void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width);
+
+ /**
+ * Gets AM/PM strings. For example: "AM" and "PM".
+ * @param count Filled in with length of the array.
+ * @return the weekday strings. (DateFormatSymbols retains ownership.)
+ * @stable ICU 2.0
+ */
+ const UnicodeString* getAmPmStrings(int32_t& count) const;
+
+ /**
+ * Sets ampm strings. For example: "AM" and "PM".
+ * @param ampms the new ampm strings. (not adopted; caller retains ownership)
+ * @param count Filled in with length of the array.
+ * @stable ICU 2.0
+ */
+ void setAmPmStrings(const UnicodeString* ampms, int32_t count);
+
+ /**
+ * Gets timezone strings. These strings are stored in a 2-dimensional array.
+ * @param rowCount Output param to receive number of rows.
+ * @param columnCount Output param to receive number of columns.
+ * @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)
+ * @deprecated ICU 3.6
+ */
+ const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const;
+
+ /**
+ * Sets timezone strings. These strings are stored in a 2-dimensional array.
+ * @param strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
+ * @param rowCount The number of rows (count of first index).
+ * @param columnCount The number of columns (count of second index).
+ * @stable ICU 2.0
+ */
+ void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount);
+
+ /**
+ * Get the non-localized date-time pattern characters.
+ * @return the non-localized date-time pattern characters
+ * @stable ICU 2.0
+ */
+ static const UChar * U_EXPORT2 getPatternUChars(void);
+
+ /**
+ * Gets localized date-time pattern characters. For example: 'u', 't', etc.
+ * <p>
+ * Note: ICU no longer provides localized date-time pattern characters for a locale
+ * starting ICU 3.8. This method returns the non-localized date-time pattern
+ * characters unless user defined localized data is set by setLocalPatternChars.
+ * @param result Output param which will receive the localized date-time pattern characters.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& getLocalPatternChars(UnicodeString& result) const;
+
+ /**
+ * Sets localized date-time pattern characters. For example: 'u', 't', etc.
+ * @param newLocalPatternChars the new localized date-time
+ * pattern characters.
+ * @stable ICU 2.0
+ */
+ void setLocalPatternChars(const UnicodeString& newLocalPatternChars);
+
+ /**
+ * Returns the locale for this object. Two flavors are available:
+ * valid and actual locale.
+ * @stable ICU 2.8
+ */
+ Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
+
+ /**
+ * 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:
+
+ friend class SimpleDateFormat;
+ friend class DateFormatSymbolsSingleSetter; // see udat.cpp
+
+ /**
+ * Era strings. For example: "AD" and "BC".
+ */
+ UnicodeString* fEras;
+ int32_t fErasCount;
+
+ /**
+ * Era name strings. For example: "Anno Domini" and "Before Christ".
+ */
+ UnicodeString* fEraNames;
+ int32_t fEraNamesCount;
+
+ /**
+ * Month strings. For example: "January", "February", etc.
+ */
+ UnicodeString* fMonths;
+ int32_t fMonthsCount;
+
+ /**
+ * Short month strings. For example: "Jan", "Feb", etc.
+ */
+ UnicodeString* fShortMonths;
+ int32_t fShortMonthsCount;
+
+ /**
+ * Narrow month strings. For example: "J", "F", etc.
+ */
+ UnicodeString* fNarrowMonths;
+ int32_t fNarrowMonthsCount;
+
+ /**
+ * Standalone Month strings. For example: "January", "February", etc.
+ */
+ UnicodeString* fStandaloneMonths;
+ int32_t fStandaloneMonthsCount;
+
+ /**
+ * Standalone Short month strings. For example: "Jan", "Feb", etc.
+ */
+ UnicodeString* fStandaloneShortMonths;
+ int32_t fStandaloneShortMonthsCount;
+
+ /**
+ * Standalone Narrow month strings. For example: "J", "F", etc.
+ */
+ UnicodeString* fStandaloneNarrowMonths;
+ int32_t fStandaloneNarrowMonthsCount;
+
+ /**
+ * Weekday strings. For example: "Sunday", "Monday", etc.
+ */
+ UnicodeString* fWeekdays;
+ int32_t fWeekdaysCount;
+
+ /**
+ * Short weekday strings. For example: "Sun", "Mon", etc.
+ */
+ UnicodeString* fShortWeekdays;
+ int32_t fShortWeekdaysCount;
+
+ /**
+ * Narrow weekday strings. For example: "Sun", "Mon", etc.
+ */
+ UnicodeString* fNarrowWeekdays;
+ int32_t fNarrowWeekdaysCount;
+
+ /**
+ * Standalone Weekday strings. For example: "Sunday", "Monday", etc.
+ */
+ UnicodeString* fStandaloneWeekdays;
+ int32_t fStandaloneWeekdaysCount;
+
+ /**
+ * Standalone Short weekday strings. For example: "Sun", "Mon", etc.
+ */
+ UnicodeString* fStandaloneShortWeekdays;
+ int32_t fStandaloneShortWeekdaysCount;
+
+ /**
+ * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc.
+ */
+ UnicodeString* fStandaloneNarrowWeekdays;
+ int32_t fStandaloneNarrowWeekdaysCount;
+
+ /**
+ * Ampm strings. For example: "AM" and "PM".
+ */
+ UnicodeString* fAmPms;
+ int32_t fAmPmsCount;
+
+ /**
+ * Quarter strings. For example: "1st quarter", "2nd quarter", etc.
+ */
+ UnicodeString *fQuarters;
+ int32_t fQuartersCount;
+
+ /**
+ * Short quarters. For example: "Q1", "Q2", etc.
+ */
+ UnicodeString *fShortQuarters;
+ int32_t fShortQuartersCount;
+
+ /**
+ * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc.
+ */
+ UnicodeString *fStandaloneQuarters;
+ int32_t fStandaloneQuartersCount;
+
+ /**
+ * Standalone short quarter strings. For example: "Q1", "Q2", etc.
+ */
+ UnicodeString *fStandaloneShortQuarters;
+ int32_t fStandaloneShortQuartersCount;
+
+ /**
+ * The format data of all the timezones in this locale.
+ */
+ UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
+ UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
+ int32_t fZoneStringsRowCount;
+ int32_t fZoneStringsColCount;
+
+ const ZoneStringFormat *fZoneStringFormat;
+ ZoneStringFormat *fZSFLocal; // Local ZoneStringFormat instance
+ SafeZoneStringFormatPtr *fZSFCachePtr; // Cached ZoneStringFormat
+ Locale fZSFLocale; // Locale used for getting ZoneStringFormat
+
+ /**
+ * Pattern string used for localized time zone GMT format. For example, "GMT{0}"
+ */
+ UnicodeString fGmtFormat;
+
+ /**
+ * Pattern strings used for formatting zone offset in a localized time zone GMT string.
+ */
+ UnicodeString *fGmtHourFormats;
+ int32_t fGmtHourFormatsCount;
+
+ enum GMTHourType {
+ GMT_NEGATIVE_HMS = 0,
+ GMT_NEGATIVE_HM,
+ GMT_POSITIVE_HMS,
+ GMT_POSITIVE_HM,
+ GMT_HOUR_COUNT
+ };
+
+ /**
+ * Localized date-time pattern characters. For example: use 'u' as 'y'.
+ */
+ UnicodeString fLocalPatternChars;
+
+private:
+ /** valid/actual locale information
+ * these are always ICU locales, so the length should not be a problem
+ */
+ char validLocale[ULOC_FULLNAME_CAPACITY];
+ char actualLocale[ULOC_FULLNAME_CAPACITY];
+
+ DateFormatSymbols(); // default constructor not implemented
+
+ /**
+ * Called by the constructors to actually load data from the resources
+ *
+ * @param locale The locale to get symbols for.
+ * @param type Calendar Type (as from Calendar::getType())
+ * @param status Input/output parameter, set to success or
+ * failure code upon return.
+ * @param useLastResortData determine if use last resort data
+ */
+ void initializeData(const Locale&, const char *type, UErrorCode& status, UBool useLastResortData = FALSE);
+
+ /**
+ * Copy or alias an array in another object, as appropriate.
+ *
+ * @param dstArray the copy destination array.
+ * @param dstCount fill in with the lenth of 'dstArray'.
+ * @param srcArray the source array to be copied.
+ * @param srcCount the length of items to be copied from the 'srcArray'.
+ */
+ static void assignArray(UnicodeString*& dstArray,
+ int32_t& dstCount,
+ const UnicodeString* srcArray,
+ int32_t srcCount);
+
+ /**
+ * Return true if the given arrays' contents are equal, or if the arrays are
+ * identical (pointers are equal).
+ *
+ * @param array1 one array to be compared with.
+ * @param array2 another array to be compared with.
+ * @param count the length of items to be copied.
+ * @return true if the given arrays' contents are equal, or if the arrays are
+ * identical (pointers are equal).
+ */
+ static UBool arrayCompare(const UnicodeString* array1,
+ const UnicodeString* array2,
+ int32_t count);
+
+ /**
+ * Create a copy, in fZoneStrings, of the given zone strings array. The
+ * member variables fZoneStringsRowCount and fZoneStringsColCount should be
+ * set already by the caller.
+ */
+ void createZoneStrings(const UnicodeString *const * otherStrings);
+
+ /**
+ * Delete all the storage owned by this object.
+ */
+ void dispose(void);
+
+ /**
+ * Copy all of the other's data to this.
+ * @param other the object to be copied.
+ */
+ void copyData(const DateFormatSymbols& other);
+
+
+ /**
+ * Returns a ZoneStringFormat, used only by SimpleDateFormat for now.
+ */
+ const ZoneStringFormat* getZoneStringFormat(void) const;
+
+ /**
+ * Create a ZoneStringFormat by locale if not yet availble
+ */
+ void initZoneStringFormat(void);
+
+ /**
+ * Create zone strings array by locale if not yet available
+ */
+ void initZoneStringsArray(void);
+
+ /**
+ * Delete just the zone strings.
+ */
+ void disposeZoneStrings(void);
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _DTFMTSYM
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dtptngen.h b/Build/source/libs/icu-xetex/i18n/unicode/dtptngen.h
new file mode 100644
index 00000000000..09f6b84590c
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dtptngen.h
@@ -0,0 +1,416 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, 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
+
+class Hashtable;
+class FormatParser;
+class DateTimeMatcher;
+class DistanceInfo;
+class PatternMap;
+
+/**
+ * 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>
+ * @draft 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.
+ * @draft 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.
+ * @draft 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.
+ * @draft ICU 3.8
+ */
+ static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~DateTimePatternGenerator();
+
+ /**
+ * Clone DateTimePatternGenerator object. Clients are responsible for
+ * deleting the DateTimePatternGenerator object cloned.
+ * @draft 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.
+ * @draft 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.
+ * @draft 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"
+ * @draft 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"
+ * @draft 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.
+ * @draft 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}"
+ * @draft 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
+ * @draft 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
+ * @draft 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
+ * @draft 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.
+ * @draft ICU 3.8
+ */
+ void setDateTimeFormat(const UnicodeString& dateTimeFormat);
+
+ /**
+ * Getter corresponding to setDateTimeFormat.
+ * @return DateTimeFormat.
+ * @draft 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.
+ * @draft 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.
+ * @draft 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.
+ * @draft 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.
+ * @draft 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.
+ * @draft 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
+ * @draft ICU 3.8
+ */
+ void setDecimal(const UnicodeString& decimal);
+
+ /**
+ * Getter corresponding to setDecimal.
+ * @return UnicodeString corresponding to the decimal point
+ * @draft ICU 3.8
+ */
+ const UnicodeString& getDecimal() const;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ *
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ *
+ * @draft ICU 3.8
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+private:
+ /**
+ * Constructor.
+ * @draft ICU 3.8
+ */
+ DateTimePatternGenerator(UErrorCode & status);
+
+ /**
+ * Constructor.
+ * @draft ICU 3.8
+ */
+ DateTimePatternGenerator(const Locale& locale, UErrorCode & status);
+
+ /**
+ * Copy constructor.
+ * @param other DateTimePatternGenerator to copy
+ * @draft ICU 3.8
+ */
+ DateTimePatternGenerator(const DateTimePatternGenerator& other);
+
+ /**
+ * Default assignment operator.
+ * @param other DateTimePatternGenerator to copy
+ * @draft 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;
+ UErrorCode fStatus;
+ UnicodeString emptyString;
+
+ void initData(const Locale &locale);
+ void addCanonicalItems();
+ void addICUPatterns(const Locale& locale, UErrorCode& status);
+ void hackTimes(const UnicodeString& hackPattern, UErrorCode& status);
+ void addCLDRData(const Locale& locale);
+ 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);
+ UnicodeString adjustFieldTypes(const UnicodeString& pattern, 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);
+ UBool isCanonicalItem(const UnicodeString& item) const;
+ UErrorCode getStatus() const { return fStatus; } ;
+} ;// end class DateTimePatternGenerator
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/dtrule.h b/Build/source/libs/icu-xetex/i18n/unicode/dtrule.h
new file mode 100644
index 00000000000..7bdacd06aea
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/dtrule.h
@@ -0,0 +1,250 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, 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.
+ *
+ * @draft ICU 3.8
+ */
+class U_I18N_API DateTimeRule : public UObject {
+public:
+
+ /**
+ * Date rule type constants.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ 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>.
+ * @draft ICU 3.8
+ */
+ 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>.
+ * @draft ICU 3.8
+ */
+ 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>.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ DateTimeRule(const DateTimeRule& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ ~DateTimeRule();
+
+ /**
+ * Clone this DateTimeRule object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ DateTimeRule* clone(void) const;
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ UBool operator!=(const DateTimeRule& that) const;
+
+ /**
+ * Gets the date rule type, such as <code>DOM</code>
+ * @return The date rule type.
+ * @draft ICU 3.8
+ */
+ 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>.
+ * @draft ICU 3.8
+ */
+ TimeRuleType getTimeRuleType(void) const;
+
+ /**
+ * Gets the rule month.
+ * @return The rule month.
+ * @draft ICU 3.8
+ */
+ 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
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ int32_t getRuleWeekInMonth(void) const;
+
+ /**
+ * Gets the rule time in the rule day.
+ * @return The time in the rule day in milliseconds.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // DTRULE_H
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/fieldpos.h b/Build/source/libs/icu-xetex/i18n/unicode/fieldpos.h
new file mode 100644
index 00000000000..38a9576e782
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/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
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h b/Build/source/libs/icu-xetex/i18n/unicode/fmtable.h
new file mode 100644
index 00000000000..94ee32843f5
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/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
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/format.h b/Build/source/libs/icu-xetex/i18n/unicode/format.h
new file mode 100644
index 00000000000..7f17b52f00a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/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
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h b/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h
new file mode 100644
index 00000000000..f2d1b0b17d5
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/gregocal.h
@@ -0,0 +1,823 @@
+/*
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
+********************************************************************************
+*
+* File GREGOCAL.H
+*
+* Modification History:
+*
+* Date Name Description
+* 04/22/97 aliu Overhauled header.
+* 07/28/98 stephen Sync with JDK 1.2
+* 09/04/98 stephen Re-sync with JDK 8/31 putback
+* 09/14/98 stephen Changed type of kOneDay, kOneWeek to double.
+* Fixed bug in roll()
+* 10/15/99 aliu Fixed j31, incorrect WEEK_OF_YEAR computation.
+* Added documentation of WEEK_OF_YEAR computation.
+* 10/15/99 aliu Fixed j32, cannot set date to Feb 29 2000 AD.
+* {JDK bug 4210209 4209272}
+* 11/07/2003 srl Update, clean up documentation.
+********************************************************************************
+*/
+
+#ifndef GREGOCAL_H
+#define GREGOCAL_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/calendar.h"
+
+/**
+ * \file
+ * \brief C++ API: Concrete class which provides the standard calendar.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Concrete class which provides the standard calendar used by most of the world.
+ * <P>
+ * The standard (Gregorian) calendar has 2 eras, BC and AD.
+ * <P>
+ * This implementation handles a single discontinuity, which corresponds by default to
+ * the date the Gregorian calendar was originally instituted (October 15, 1582). Not all
+ * countries adopted the Gregorian calendar then, so this cutover date may be changed by
+ * the caller.
+ * <P>
+ * Prior to the institution of the Gregorian Calendar, New Year's Day was March 25. To
+ * avoid confusion, this Calendar always uses January 1. A manual adjustment may be made
+ * if desired for dates that are prior to the Gregorian changeover and which fall
+ * between January 1 and March 24.
+ *
+ * <p>Values calculated for the <code>WEEK_OF_YEAR</code> field range from 1 to
+ * 53. Week 1 for a year is the first week that contains at least
+ * <code>getMinimalDaysInFirstWeek()</code> days from that year. It thus
+ * depends on the values of <code>getMinimalDaysInFirstWeek()</code>,
+ * <code>getFirstDayOfWeek()</code>, and the day of the week of January 1.
+ * Weeks between week 1 of one year and week 1 of the following year are
+ * numbered sequentially from 2 to 52 or 53 (as needed).
+ *
+ * <p>For example, January 1, 1998 was a Thursday. If
+ * <code>getFirstDayOfWeek()</code> is <code>MONDAY</code> and
+ * <code>getMinimalDaysInFirstWeek()</code> is 4 (these are the values
+ * reflecting ISO 8601 and many national standards), then week 1 of 1998 starts
+ * on December 29, 1997, and ends on January 4, 1998. If, however,
+ * <code>getFirstDayOfWeek()</code> is <code>SUNDAY</code>, then week 1 of 1998
+ * starts on January 4, 1998, and ends on January 10, 1998; the first three days
+ * of 1998 then are part of week 53 of 1997.
+ *
+ * <p>Example for using GregorianCalendar:
+ * <pre>
+ * \code
+ * // get the supported ids for GMT-08:00 (Pacific Standard Time)
+ * UErrorCode success = U_ZERO_ERROR;
+ * const StringEnumeration *ids = TimeZone::createEnumeration(-8 * 60 * 60 * 1000);
+ * // if no ids were returned, something is wrong. get out.
+ * if (ids == 0 || ids->count(success) == 0) {
+ * return;
+ * }
+ *
+ * // begin output
+ * cout << "Current Time" << endl;
+ *
+ * // create a Pacific Standard Time time zone
+ * SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(NULL, success)));
+ *
+ * // set up rules for daylight savings time
+ * pdt->setStartRule(Calendar::APRIL, 1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
+ * pdt->setEndRule(Calendar::OCTOBER, -1, Calendar::SUNDAY, 2 * 60 * 60 * 1000);
+ *
+ * // create a GregorianCalendar with the Pacific Daylight time zone
+ * // and the current date and time
+ * Calendar* calendar = new GregorianCalendar( pdt, success );
+ *
+ * // print out a bunch of interesting things
+ * cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
+ * cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
+ * cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
+ * cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
+ * cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
+ * cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
+ * cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
+ * cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
+ * cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
+ * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ * cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
+ * cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
+ * cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
+ * cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
+ * cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
+ * cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
+ * cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl;
+ * cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl;
+ *
+ * cout << "Current Time, with hour reset to 3" << endl;
+ * calendar->clear(Calendar::HOUR_OF_DAY); // so doesn't override
+ * calendar->set(Calendar::HOUR, 3);
+ * cout << "ERA: " << calendar->get( Calendar::ERA, success ) << endl;
+ * cout << "YEAR: " << calendar->get( Calendar::YEAR, success ) << endl;
+ * cout << "MONTH: " << calendar->get( Calendar::MONTH, success ) << endl;
+ * cout << "WEEK_OF_YEAR: " << calendar->get( Calendar::WEEK_OF_YEAR, success ) << endl;
+ * cout << "WEEK_OF_MONTH: " << calendar->get( Calendar::WEEK_OF_MONTH, success ) << endl;
+ * cout << "DATE: " << calendar->get( Calendar::DATE, success ) << endl;
+ * cout << "DAY_OF_MONTH: " << calendar->get( Calendar::DAY_OF_MONTH, success ) << endl;
+ * cout << "DAY_OF_YEAR: " << calendar->get( Calendar::DAY_OF_YEAR, success ) << endl;
+ * cout << "DAY_OF_WEEK: " << calendar->get( Calendar::DAY_OF_WEEK, success ) << endl;
+ * cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( Calendar::DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ * cout << "AM_PM: " << calendar->get( Calendar::AM_PM, success ) << endl;
+ * cout << "HOUR: " << calendar->get( Calendar::HOUR, success ) << endl;
+ * cout << "HOUR_OF_DAY: " << calendar->get( Calendar::HOUR_OF_DAY, success ) << endl;
+ * cout << "MINUTE: " << calendar->get( Calendar::MINUTE, success ) << endl;
+ * cout << "SECOND: " << calendar->get( Calendar::SECOND, success ) << endl;
+ * cout << "MILLISECOND: " << calendar->get( Calendar::MILLISECOND, success ) << endl;
+ * cout << "ZONE_OFFSET: " << (calendar->get( Calendar::ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ * cout << "DST_OFFSET: " << (calendar->get( Calendar::DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ *
+ * if (U_FAILURE(success)) {
+ * cout << "An error occured. success=" << u_errorName(success) << endl;
+ * }
+ *
+ * delete ids;
+ * delete calendar; // also deletes pdt
+ * \endcode
+ * </pre>
+ * @stable ICU 2.0
+ */
+class U_I18N_API GregorianCalendar: public Calendar {
+public:
+
+ /**
+ * Useful constants for GregorianCalendar and TimeZone.
+ * @stable ICU 2.0
+ */
+ enum EEras {
+ BC,
+ AD
+ };
+
+ /**
+ * Constructs a default GregorianCalendar using the current time in the default time
+ * zone with the default locale.
+ *
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar based on the current time in the given time zone
+ * with the default locale. Clients are no longer responsible for deleting the given
+ * time zone object after it's adopted.
+ *
+ * @param zoneToAdopt The given timezone.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(TimeZone* zoneToAdopt, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar based on the current time in the given time zone
+ * with the default locale.
+ *
+ * @param zone The given timezone.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(const TimeZone& zone, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar based on the current time in the default time zone
+ * with the given locale.
+ *
+ * @param aLocale The given locale.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar based on the current time in the given time zone
+ * with the given locale. Clients are no longer responsible for deleting the given
+ * time zone object after it's adopted.
+ *
+ * @param zoneToAdopt The given timezone.
+ * @param aLocale The given locale.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar based on the current time in the given time zone
+ * with the given locale.
+ *
+ * @param zone The given timezone.
+ * @param aLocale The given locale.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar with the given AD date set in the default time
+ * zone with the default locale.
+ *
+ * @param year The value used to set the YEAR time field in the calendar.
+ * @param month The value used to set the MONTH time field in the calendar. Month
+ * value is 0-based. e.g., 0 for January.
+ * @param date The value used to set the DATE time field in the calendar.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(int32_t year, int32_t month, int32_t date, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar with the given AD date and time set for the
+ * default time zone with the default locale.
+ *
+ * @param year The value used to set the YEAR time field in the calendar.
+ * @param month The value used to set the MONTH time field in the calendar. Month
+ * value is 0-based. e.g., 0 for January.
+ * @param date The value used to set the DATE time field in the calendar.
+ * @param hour The value used to set the HOUR_OF_DAY time field in the calendar.
+ * @param minute The value used to set the MINUTE time field in the calendar.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, UErrorCode& success);
+
+ /**
+ * Constructs a GregorianCalendar with the given AD date and time set for the
+ * default time zone with the default locale.
+ *
+ * @param year The value used to set the YEAR time field in the calendar.
+ * @param month The value used to set the MONTH time field in the calendar. Month
+ * value is 0-based. e.g., 0 for January.
+ * @param date The value used to set the DATE time field in the calendar.
+ * @param hour The value used to set the HOUR_OF_DAY time field in the calendar.
+ * @param minute The value used to set the MINUTE time field in the calendar.
+ * @param second The value used to set the SECOND time field in the calendar.
+ * @param success Indicates the status of GregorianCalendar object construction.
+ * Returns U_ZERO_ERROR if constructed successfully.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode& success);
+
+ /**
+ * Destructor
+ * @stable ICU 2.0
+ */
+ virtual ~GregorianCalendar();
+
+ /**
+ * Copy constructor
+ * @param source the object to be copied.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar(const GregorianCalendar& source);
+
+ /**
+ * Default assignment operator
+ * @param right the object to be copied.
+ * @stable ICU 2.0
+ */
+ GregorianCalendar& operator=(const GregorianCalendar& right);
+
+ /**
+ * Create and return a polymorphic copy of this calendar.
+ * @return return a polymorphic copy of this calendar.
+ * @stable ICU 2.0
+ */
+ virtual Calendar* clone(void) const;
+
+ /**
+ * Sets the GregorianCalendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * @param date The given Gregorian cutover date.
+ * @param success Output param set to success/failure code on exit.
+ * @stable ICU 2.0
+ */
+ void setGregorianChange(UDate date, UErrorCode& success);
+
+ /**
+ * Gets the Gregorian Calendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * @return The Gregorian cutover time for this calendar.
+ * @stable ICU 2.0
+ */
+ UDate getGregorianChange(void) const;
+
+ /**
+ * Return true if the given year is a leap year. Determination of whether a year is
+ * a leap year is actually very complicated. We do something crude and mostly
+ * correct here, but for a real determination you need a lot of contextual
+ * information. For example, in Sweden, the change from Julian to Gregorian happened
+ * in a complex way resulting in missed leap years and double leap years between
+ * 1700 and 1753. Another example is that after the start of the Julian calendar in
+ * 45 B.C., the leap years did not regularize until 8 A.D. This method ignores these
+ * quirks, and pays attention only to the Julian onset date and the Gregorian
+ * cutover (which can be changed).
+ *
+ * @param year The given year.
+ * @return True if the given year is a leap year; false otherwise.
+ * @stable ICU 2.0
+ */
+ UBool isLeapYear(int32_t year) const;
+
+ /**
+ * Returns TRUE if the given Calendar object is equivalent to this
+ * one. Calendar override.
+ *
+ * @param other the Calendar to be compared with this Calendar
+ * @stable ICU 2.4
+ */
+ virtual UBool isEquivalentTo(const Calendar& other) const;
+
+ /**
+ * (Overrides Calendar) Rolls up or down by the given amount in the specified field.
+ * For more information, see the documentation for Calendar::roll().
+ *
+ * @param field The time field.
+ * @param amount Indicates amount to roll.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead.
+ */
+ virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * (Overrides Calendar) Rolls up or down by the given amount in the specified field.
+ * For more information, see the documentation for Calendar::roll().
+ *
+ * @param field The time field.
+ * @param amount Indicates amount to roll.
+ * @param status Output param set to success/failure code on exit. If any value
+ * previously set in the time field is invalid, this will be set to
+ * an error status.
+ * @stable ICU 2.6.
+ */
+ virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
+
+ /**
+ * Return the minimum value that this field could have, given the current date.
+ * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
+ * @param field the time field.
+ * @return the minimum value that this field could have, given the current date.
+ * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead.
+ */
+ int32_t getActualMinimum(EDateFields field) const;
+
+ /**
+ * Return the minimum value that this field could have, given the current date.
+ * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
+ * @param field the time field.
+ * @param status
+ * @return the minimum value that this field could have, given the current date.
+ * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. (Added to ICU 3.0 for signature consistency)
+ */
+ int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
+
+ /**
+ * Return the minimum value that this field could have, given the current date.
+ * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum().
+ * @param field the time field.
+ * @param status error result.
+ * @return the minimum value that this field could have, given the current date.
+ * @stable ICU 3.0
+ */
+ int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const;
+
+ /**
+ * Return the maximum value that this field could have, given the current date.
+ * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
+ * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar,
+ * for some years the actual maximum for MONTH is 12, and for others 13.
+ * @param field the time field.
+ * @return the maximum value that this field could have, given the current date.
+ * @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field) instead.
+ */
+ int32_t getActualMaximum(EDateFields field) const;
+
+ /**
+ * Return the maximum value that this field could have, given the current date.
+ * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
+ * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar,
+ * for some years the actual maximum for MONTH is 12, and for others 13.
+ * @param field the time field.
+ * @param status returns any errors that may result from this function call.
+ * @return the maximum value that this field could have, given the current date.
+ * @stable ICU 2.6
+ */
+ virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
+
+ /**
+ * (Overrides Calendar) Return true if the current date for this Calendar is in
+ * Daylight Savings Time. Recognizes DST_OFFSET, if it is set.
+ *
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return True if the current date for this Calendar is in Daylight Savings Time,
+ * false, otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool inDaylightTime(UErrorCode& status) const;
+
+public:
+
+ /**
+ * Override Calendar 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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * Return the class ID for this class. This is useful only for comparing to a return
+ * value from getDynamicClassID(). For example:
+ *
+ * Base* polymorphic_pointer = createPolymorphicObject();
+ * if (polymorphic_pointer->getDynamicClassID() ==
+ * Derived::getStaticClassID()) ...
+ *
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Get the calendar type, "gregorian", for use in DateFormatSymbols.
+ *
+ * @return calendar type
+ * @internal
+ */
+ virtual const char * getType() const;
+
+protected:
+
+ /**
+ * (Overrides Calendar) Converts GMT as milliseconds to time field values.
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @stable ICU 2.0
+ */
+
+ private:
+ GregorianCalendar(); // default constructor not implemented
+
+ protected:
+ /**
+ * Return the ERA. We need a special method for this because the
+ * default ERA is AD, but a zero (unset) ERA is BC.
+ * @return the ERA.
+ * @internal
+ */
+ virtual int32_t internalGetEra() const;
+
+ /**
+ * Return the Julian day number of day before the first day of the
+ * given month in the given extended year. Subclasses should override
+ * this method to implement their calendar system.
+ * @param eyear the extended year
+ * @param month the zero-based month, or 0 if useMonth is false
+ * @param useMonth if false, compute the day before the first day of
+ * the given year, otherwise, compute the day before the first day of
+ * the given month
+ * @return the Julian day number of the day before the first
+ * day of the given month and year
+ * @internal
+ */
+ virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
+ UBool useMonth) const;
+
+ /**
+ * Subclasses may override this. This method calls
+ * handleGetMonthLength() to obtain the calendar-specific month
+ * length.
+ * @param bestField which field to use to calculate the date
+ * @return julian day specified by calendar fields.
+ * @internal
+ */
+ virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField) ;
+
+ /**
+ * Return the number of days in the given month of the given extended
+ * year of this calendar system. Subclasses should override this
+ * method if they can provide a more correct or more efficient
+ * implementation than the default implementation in Calendar.
+ * @internal
+ */
+ virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const;
+
+ /**
+ * Return the number of days in the given extended year of this
+ * calendar system. Subclasses should override this method if they can
+ * provide a more correct or more efficient implementation than the
+ * default implementation in Calendar.
+ * @stable ICU 2.0
+ */
+ virtual int32_t handleGetYearLength(int32_t eyear) const;
+
+ /**
+ * return the length of the given month.
+ * @param month the given month.
+ * @return the length of the given month.
+ * @internal
+ */
+ virtual int32_t monthLength(int32_t month) const;
+
+ /**
+ * return the length of the month according to the given year.
+ * @param month the given month.
+ * @param year the given year.
+ * @return the length of the month
+ * @internal
+ */
+ virtual int32_t monthLength(int32_t month, int32_t year) const;
+
+ /**
+ * return the length of the given year.
+ * @param year the given year.
+ * @return the length of the given year.
+ * @internal
+ */
+ int32_t yearLength(int32_t year) const;
+
+ /**
+ * return the length of the year field.
+ * @return the length of the year field
+ * @internal
+ */
+ int32_t yearLength(void) const;
+
+ /**
+ * After adjustments such as add(MONTH), add(YEAR), we don't want the
+ * month to jump around. E.g., we don't want Jan 31 + 1 month to go to Mar
+ * 3, we want it to go to Feb 28. Adjustments which might run into this
+ * problem call this method to retain the proper month.
+ * @internal
+ */
+ void pinDayOfMonth(void);
+
+ /**
+ * Return the day number with respect to the epoch. January 1, 1970 (Gregorian)
+ * is day zero.
+ * @param status Fill-in parameter which receives the status of this operation.
+ * @return the day number with respect to the epoch.
+ * @internal
+ */
+ virtual UDate getEpochDay(UErrorCode& status);
+
+ /**
+ * Subclass API for defining limits of different types.
+ * Subclasses must implement this method to return limits for the
+ * following fields:
+ *
+ * <pre>UCAL_ERA
+ * UCAL_YEAR
+ * UCAL_MONTH
+ * UCAL_WEEK_OF_YEAR
+ * UCAL_WEEK_OF_MONTH
+ * UCAL_DATE (DAY_OF_MONTH on Java)
+ * UCAL_DAY_OF_YEAR
+ * UCAL_DAY_OF_WEEK_IN_MONTH
+ * UCAL_YEAR_WOY
+ * UCAL_EXTENDED_YEAR</pre>
+ *
+ * @param field one of the above field numbers
+ * @param limitType one of <code>MINIMUM</code>, <code>GREATEST_MINIMUM</code>,
+ * <code>LEAST_MAXIMUM</code>, or <code>MAXIMUM</code>
+ * @internal
+ */
+ virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const;
+
+ /**
+ * Return the extended year defined by the current fields. This will
+ * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such
+ * as UCAL_ERA) specific to the calendar system, depending on which set of
+ * fields is newer.
+ * @return the extended year
+ * @internal
+ */
+ virtual int32_t handleGetExtendedYear();
+
+ /**
+ * Subclasses may override this to convert from week fields
+ * (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case
+ * where YEAR, EXTENDED_YEAR are not set.
+ * The Gregorian implementation assumes a yearWoy in gregorian format, according to the current era.
+ * @return the extended year, UCAL_EXTENDED_YEAR
+ * @internal
+ */
+ virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
+
+
+ /**
+ * Subclasses may override this method to compute several fields
+ * specific to each calendar system. These are:
+ *
+ * <ul><li>ERA
+ * <li>YEAR
+ * <li>MONTH
+ * <li>DAY_OF_MONTH
+ * <li>DAY_OF_YEAR
+ * <li>EXTENDED_YEAR</ul>
+ *
+ * <p>The GregorianCalendar implementation implements
+ * a calendar with the specified Julian/Gregorian cutover date.
+ * @internal
+ */
+ virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
+
+ private:
+ /**
+ * Compute the julian day number of the given year.
+ * @param isGregorian if true, using Gregorian calendar, otherwise using Julian calendar
+ * @param year the given year.
+ * @param isLeap true if the year is a leap year.
+ * @return
+ */
+ static double computeJulianDayOfYear(UBool isGregorian, int32_t year,
+ UBool& isLeap);
+
+ /**
+ * Validates the values of the set time fields. True if they're all valid.
+ * @return True if the set time fields are all valid.
+ */
+ UBool validateFields(void) const;
+
+ /**
+ * Validates the value of the given time field. True if it's valid.
+ */
+ UBool boundsCheck(int32_t value, UCalendarDateFields field) const;
+
+ /**
+ * Return the pseudo-time-stamp for two fields, given their
+ * individual pseudo-time-stamps. If either of the fields
+ * is unset, then the aggregate is unset. Otherwise, the
+ * aggregate is the later of the two stamps.
+ * @param stamp_a One given field.
+ * @param stamp_b Another given field.
+ * @return the pseudo-time-stamp for two fields
+ */
+ int32_t aggregateStamp(int32_t stamp_a, int32_t stamp_b);
+
+ /**
+ * The point at which the Gregorian calendar rules are used, measured in
+ * milliseconds from the standard epoch. Default is October 15, 1582
+ * (Gregorian) 00:00:00 UTC, that is, October 4, 1582 (Julian) is followed
+ * by October 15, 1582 (Gregorian). This corresponds to Julian day number
+ * 2299161. This is measured from the standard epoch, not in Julian Days.
+ * @internal
+ */
+ UDate fGregorianCutover;
+
+ /**
+ * Julian day number of the Gregorian cutover
+ */
+ int32_t fCutoverJulianDay;
+
+ /**
+ * Midnight, local time (using this Calendar's TimeZone) at or before the
+ * gregorianCutover. This is a pure date value with no time of day or
+ * timezone component.
+ */
+ UDate fNormalizedGregorianCutover;// = gregorianCutover;
+
+ /**
+ * The year of the gregorianCutover, with 0 representing
+ * 1 BC, -1 representing 2 BC, etc.
+ */
+ int32_t fGregorianCutoverYear;// = 1582;
+
+ /**
+ * The year of the gregorianCutover, with 0 representing
+ * 1 BC, -1 representing 2 BC, etc.
+ */
+ int32_t fGregorianCutoverJulianDay;// = 2299161;
+
+ /**
+ * Converts time as milliseconds to Julian date. The Julian date used here is not a
+ * true Julian date, since it is measured from midnight, not noon.
+ *
+ * @param millis The given milliseconds.
+ * @return The Julian date number.
+ */
+ static double millisToJulianDay(UDate millis);
+
+ /**
+ * Converts Julian date to time as milliseconds. The Julian date used here is not a
+ * true Julian date, since it is measured from midnight, not noon.
+ *
+ * @param julian The given Julian date number.
+ * @return Time as milliseconds.
+ */
+ static UDate julianDayToMillis(double julian);
+
+ /**
+ * Used by handleComputeJulianDay() and handleComputeMonthStart().
+ * Temporary field indicating whether the calendar is currently Gregorian as opposed to Julian.
+ */
+ UBool fIsGregorian;
+
+ /**
+ * Used by handleComputeJulianDay() and handleComputeMonthStart().
+ * Temporary field indicating that the sense of the gregorian cutover should be inverted
+ * to handle certain calculations on and around the cutover date.
+ */
+ UBool fInvertGregorian;
+
+
+ public: // internal implementation
+
+ /**
+ * @internal
+ * @return TRUE if this calendar has the notion of a default century
+ */
+ virtual UBool haveDefaultCentury() const;
+
+ /**
+ * @internal
+ * @return the start of the default century
+ */
+ virtual UDate defaultCenturyStart() const;
+
+ /**
+ * @internal
+ * @return the beginning year of the default century
+ */
+ virtual int32_t defaultCenturyStartYear() const;
+
+ private:
+ /**
+ * The system maintains a static default century start date. This is initialized
+ * the first time it is used. Before then, it is set to SYSTEM_DEFAULT_CENTURY to
+ * indicate an uninitialized state. Once the system default century date and year
+ * are set, they do not change.
+ */
+ static UDate fgSystemDefaultCenturyStart;
+
+ /**
+ * See documentation for systemDefaultCenturyStart.
+ */
+ static int32_t fgSystemDefaultCenturyStartYear;
+
+ /**
+ * Default value that indicates the defaultCenturyStartYear is unitialized
+ */
+ static const int32_t fgSystemDefaultCenturyYear;
+
+ /**
+ * Default value that indicates the UDate of the beginning of the system default century
+ */
+ static const UDate fgSystemDefaultCentury;
+
+ /**
+ * Returns the beginning date of the 100-year window that dates with 2-digit years
+ * are considered to fall within.
+ * @return the beginning date of the 100-year window that dates with 2-digit years
+ * are considered to fall within.
+ */
+ UDate internalGetDefaultCenturyStart(void) const;
+
+ /**
+ * Returns the first year of the 100-year window that dates with 2-digit years
+ * are considered to fall within.
+ * @return the first year of the 100-year window that dates with 2-digit years
+ * are considered to fall within.
+ */
+ int32_t internalGetDefaultCenturyStartYear(void) const;
+
+ /**
+ * Initializes the 100-year window that dates with 2-digit years are considered
+ * to fall within so that its start date is 80 years before the current time.
+ */
+ static void initializeSystemDefaultCentury(void);
+
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _GREGOCAL
+//eof
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h
new file mode 100644
index 00000000000..a5af55e9d53
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measfmt.h
@@ -0,0 +1,77 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: April 20, 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef MEASUREFORMAT_H
+#define MEASUREFORMAT_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/format.h"
+
+/**
+ * \file
+ * \brief C++ API: Formatter for measure objects.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ *
+ * A formatter for measure objects. This is an abstract base class.
+ *
+ * <p>To format or parse a measure object, first create a formatter
+ * object using a MeasureFormat factory method. Then use that
+ * object's format and parse methods.
+ *
+ * <p>This is an abstract class.
+ *
+ * @see Format
+ * @author Alan Liu
+ * @stable ICU 3.0
+ */
+class U_I18N_API MeasureFormat : public Format {
+
+ public:
+
+ /**
+ * Return a formatter for CurrencyAmount objects in the given
+ * locale.
+ * @param locale desired locale
+ * @param ec input-output error code
+ * @return a formatter object, or NULL upon error
+ * @stable ICU 3.0
+ */
+ static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale,
+ UErrorCode& ec);
+
+ /**
+ * Return a formatter for CurrencyAmount objects in the default
+ * locale.
+ * @param ec input-output error code
+ * @return a formatter object, or NULL upon error
+ * @stable ICU 3.0
+ */
+ static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec);
+
+ protected:
+
+ /**
+ * Default constructor.
+ * @stable ICU 3.0
+ */
+ MeasureFormat();
+};
+
+U_NAMESPACE_END
+
+#endif // #if !UCONFIG_NO_FORMATTING
+#endif // #ifndef MEASUREFORMAT_H
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measunit.h b/Build/source/libs/icu-xetex/i18n/unicode/measunit.h
new file mode 100644
index 00000000000..9a210e65957
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measunit.h
@@ -0,0 +1,71 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: April 26, 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef __MEASUREUNIT_H__
+#define __MEASUREUNIT_H__
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/fmtable.h"
+
+/**
+ * \file
+ * \brief C++ API: A unit for measuring a quantity.
+ */
+
+U_NAMESPACE_BEGIN
+
+/**
+ * A unit such as length, mass, volume, currency, etc. A unit is
+ * coupled with a numeric amount to produce a Measure.
+ *
+ * <p>This is an abstract class.
+ *
+ * @author Alan Liu
+ * @stable ICU 3.0
+ */
+class U_I18N_API MeasureUnit: public UObject {
+ public:
+ /**
+ * Return a polymorphic clone of this object. The result will
+ * have the same class as returned by getDynamicClassID().
+ * @stable ICU 3.0
+ */
+ virtual UObject* clone() const = 0;
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~MeasureUnit();
+
+ /**
+ * Equality operator. Return true if this object is equal
+ * to the given object.
+ * @stable ICU 3.0
+ */
+ virtual UBool operator==(const UObject& other) const = 0;
+
+ protected:
+ /**
+ * Default constructor.
+ * @stable ICU 3.0
+ */
+ MeasureUnit();
+};
+
+U_NAMESPACE_END
+
+// NOTE: There is no measunit.cpp. For implementation, see measure.cpp. [alan]
+
+#endif // !UCONFIG_NO_FORMATTING
+#endif // __MEASUREUNIT_H__
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/measure.h b/Build/source/libs/icu-xetex/i18n/unicode/measure.h
new file mode 100644
index 00000000000..6b7a0497b47
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/measure.h
@@ -0,0 +1,137 @@
+/*
+**********************************************************************
+* Copyright (c) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Author: Alan Liu
+* Created: April 26, 2004
+* Since: ICU 3.0
+**********************************************************************
+*/
+#ifndef __MEASURE_H__
+#define __MEASURE_H__
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: MeasureUnit object.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/fmtable.h"
+
+U_NAMESPACE_BEGIN
+
+class MeasureUnit;
+
+/**
+ * An amount of a specified unit, consisting of a number and a Unit.
+ * For example, a length measure consists of a number and a length
+ * unit, such as feet or meters. This is an abstract class.
+ * Subclasses specify a concrete Unit type.
+ *
+ * <p>Measure objects are parsed and formatted by subclasses of
+ * MeasureFormat.
+ *
+ * <p>Measure objects are immutable.
+ *
+ * <p>This is an abstract class.
+ *
+ * @author Alan Liu
+ * @stable ICU 3.0
+ */
+class U_I18N_API Measure: public UObject {
+ public:
+ /**
+ * Construct an object with the given numeric amount and the given
+ * unit. After this call, the caller must not delete the given
+ * unit object.
+ * @param number a numeric object; amount.isNumeric() must be TRUE
+ * @param adoptedUnit the unit object, which must not be NULL
+ * @param ec input-output error code. If the amount or the unit
+ * is invalid, then this will be set to a failing value.
+ * @stable ICU 3.0
+ */
+ Measure(const Formattable& number, MeasureUnit* adoptedUnit,
+ UErrorCode& ec);
+
+ /**
+ * Copy constructor
+ * @stable ICU 3.0
+ */
+ Measure(const Measure& other);
+
+ /**
+ * Assignment operator
+ * @stable ICU 3.0
+ */
+ Measure& operator=(const Measure& other);
+
+ /**
+ * Return a polymorphic clone of this object. The result will
+ * have the same class as returned by getDynamicClassID().
+ * @stable ICU 3.0
+ */
+ virtual UObject* clone() const = 0;
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~Measure();
+
+ /**
+ * Equality operator. Return true if this object is equal
+ * to the given object.
+ * @stable ICU 3.0
+ */
+ UBool operator==(const UObject& other) const;
+
+ /**
+ * Return a reference to the numeric value of this object. The
+ * numeric value may be of any numeric type supported by
+ * Formattable.
+ * @stable ICU 3.0
+ */
+ inline const Formattable& getNumber() const;
+
+ /**
+ * Return a reference to the unit of this object.
+ * @stable ICU 3.0
+ */
+ inline const MeasureUnit& getUnit() const;
+
+ protected:
+ /**
+ * Default constructor.
+ * @stable ICU 3.0
+ */
+ Measure();
+
+ private:
+ /**
+ * The numeric value of this object, e.g. 2.54 or 100.
+ */
+ Formattable number;
+
+ /**
+ * The unit of this object, e.g., "millimeter" or "JPY". This is
+ * owned by this object.
+ */
+ MeasureUnit* unit;
+};
+
+inline const Formattable& Measure::getNumber() const {
+ return number;
+}
+
+inline const MeasureUnit& Measure::getUnit() const {
+ return *unit;
+}
+
+U_NAMESPACE_END
+
+#endif // !UCONFIG_NO_FORMATTING
+#endif // __MEASURE_H__
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h
new file mode 100644
index 00000000000..815cabbb944
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/msgfmt.h
@@ -0,0 +1,829 @@
+/*
+* Copyright (C) 1997-2006, International Business Machines Corporation and others. All Rights Reserved.
+********************************************************************************
+*
+* File MSGFMT.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 03/20/97 helena Finished first cut of implementation.
+* 07/22/98 stephen Removed operator!= (defined in Format)
+* 08/19/2002 srl Removing Javaisms
+********************************************************************************
+*/
+
+#ifndef MSGFMT_H
+#define MSGFMT_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Formats messages in a language-neutral way.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/format.h"
+#include "unicode/locid.h"
+#include "unicode/parseerr.h"
+
+U_NAMESPACE_BEGIN
+
+class NumberFormat;
+class DateFormat;
+
+/**
+ *
+ * A MessageFormat produces concatenated messages in a
+ * language-neutral way. It should be used for all string
+ * concatenations that are visible to end users.
+ * <P>
+ * A MessageFormat contains an array of <EM>subformats</EM> arranged
+ * within a <EM>template string</EM>. Together, the subformats and
+ * template string determine how the MessageFormat will operate during
+ * formatting and parsing.
+ * <P>
+ * Typically, both the subformats and the template string are
+ * specified at once in a <EM>pattern</EM>. By using different
+ * patterns for different locales, messages may be localized.
+ * <P>
+ * During formatting, the MessageFormat takes an array of arguments
+ * and produces a user-readable string. Each argument is a
+ * Formattable object; they may be passed in in an array, or as a
+ * single Formattable object which itself contains an array. Each
+ * argument is matched up with its corresponding subformat, which then
+ * formats it into a string. The resultant strings are then assembled
+ * within the string template of the MessageFormat to produce the
+ * final output string.
+ * <P>
+ * During parsing, an input string is matched against the string
+ * template of the MessageFormat to produce an array of Formattable
+ * objects. Plain text of the template string is matched directly
+ * against intput text. At each position in the template string where
+ * a subformat is located, the subformat is called to parse the
+ * corresponding segment of input text to produce an output argument.
+ * In this way, an array of arguments is created which together
+ * constitute the parse result.
+ * <P>
+ * Parsing may fail or produce unexpected results in a number of
+ * circumstances.
+ * <UL>
+ * <LI>If one of the arguments does not occur in the pattern, it
+ * will be returned as a default Formattable.
+ * <LI>If the format of an argument is loses information, such as with
+ * a choice format where a large number formats to "many", then the
+ * parse may not correspond to the originally formatted argument.
+ * <LI>MessageFormat does not handle ChoiceFormat recursion during
+ * parsing; such parses will fail.
+ * <LI>Parsing will not always find a match (or the correct match) if
+ * some part of the parse is ambiguous. For example, if the pattern
+ * "{1},{2}" is used with the string arguments {"a,b", "c"}, it will
+ * format as "a,b,c". When the result is parsed, it will return {"a",
+ * "b,c"}.
+ * <LI>If a single argument is formatted more than once in the string,
+ * then the rightmost subformat in the pattern string will produce the
+ * parse result; prior subformats with the same argument index will
+ * have no effect.
+ * </UL>
+ * Here are some examples of usage:
+ * <P>
+ * Example 1:
+ * <pre>
+ * \code
+ * UErrorCode success = U_ZERO_ERROR;
+ * GregorianCalendar cal(success);
+ * Formattable arguments[] = {
+ * 7L,
+ * Formattable( (Date) cal.getTime(success), Formattable::kIsDate),
+ * "a disturbance in the Force"
+ * };
+ *
+ * UnicodeString result;
+ * MessageFormat::format(
+ * "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ * arguments, 3, result, success );
+ *
+ * cout << "result: " << result << endl;
+ * //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance
+ * // in the Force on planet 7.
+ * \endcode
+ * </pre>
+ * Typically, the message format will come from resources, and the
+ * arguments will be dynamically set at runtime.
+ * <P>
+ * Example 2:
+ * <pre>
+ * \code
+ * success = U_ZERO_ERROR;
+ * Formattable testArgs[] = {3L, "MyDisk"};
+ *
+ * MessageFormat form(
+ * "The disk \"{1}\" contains {0} file(s).", success );
+ *
+ * UnicodeString string;
+ * FieldPosition fpos = 0;
+ * cout << "format: " << form.format(testArgs, 2, string, fpos, success ) << endl;
+ *
+ * // output, with different testArgs:
+ * // output: The disk "MyDisk" contains 0 file(s).
+ * // output: The disk "MyDisk" contains 1 file(s).
+ * // output: The disk "MyDisk" contains 1,273 file(s).
+ * \endcode
+ * </pre>
+ *
+ * The pattern is of the following form. Legend:
+ * <pre>
+ * \code
+ * {optional item}
+ * (group that may be repeated)*
+ * \endcode
+ * </pre>
+ * Do not confuse optional items with items inside quotes braces, such
+ * as this: "{". Quoted braces are literals.
+ * <pre>
+ * \code
+ * messageFormatPattern := string ( "{" messageFormatElement "}" string )*
+ *
+ * messageFormatElement := argumentIndex { "," elementFormat }
+ *
+ * elementFormat := "time" { "," datetimeStyle }
+ * | "date" { "," datetimeStyle }
+ * | "number" { "," numberStyle }
+ * | "choice" "," choiceStyle
+ *
+ * datetimeStyle := "short"
+ * | "medium"
+ * | "long"
+ * | "full"
+ * | dateFormatPattern
+ *
+ * numberStyle := "currency"
+ * | "percent"
+ * | "integer"
+ * | numberFormatPattern
+ *
+ * choiceStyle := choiceFormatPattern
+ * \endcode
+ * </pre>
+ * If there is no elementFormat, then the argument must be a string,
+ * which is substituted. If there is no dateTimeStyle or numberStyle,
+ * then the default format is used (e.g. NumberFormat::createInstance(),
+ * DateFormat::createTimeInstance(DateFormat::kDefault, ...) or DateFormat::createDateInstance(DateFormat::kDefault, ...). For
+ * a ChoiceFormat, the pattern must always be specified, since there
+ * is no default.
+ * <P>
+ * In strings, single quotes can be used to quote syntax characters.
+ * A literal single quote is represented by '', both within and outside
+ * of single-quoted segments. Inside a
+ * messageFormatElement, quotes are <EM>not</EM> removed. For example,
+ * {1,number,$'#',##} will produce a number format with the pound-sign
+ * quoted, with a result such as: "$#31,45".
+ * <P>
+ * If a pattern is used, then unquoted braces in the pattern, if any,
+ * must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab
+ * {0'}' de" and "ab } de" are not.
+ * <p>
+ * <dl><dt><b>Warning:</b><dd>The rules for using quotes within message
+ * format patterns unfortunately have shown to be somewhat confusing.
+ * In particular, it isn't always obvious to localizers whether single
+ * quotes need to be doubled or not. Make sure to inform localizers about
+ * the rules, and tell them (for example, by using comments in resource
+ * bundle source files) which strings will be processed by MessageFormat.
+ * Note that localizers may need to use single quotes in translated
+ * strings where the original version doesn't have them.
+ * <br>Note also that the simplest way to avoid the problem is to
+ * use the real apostrophe (single quote) character U+2019 (') for
+ * human-readable text, and to use the ASCII apostrophe (U+0027 ' )
+ * only in program syntax, like quoting in MessageFormat.
+ * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p>
+ * </dl>
+ * <P>
+ * The argumentIndex is a non-negative integer, which corresponds to the
+ * index of the arguments presented in an array to be formatted. The
+ * first argument has argumentIndex 0.
+ * <P>
+ * It is acceptable to have unused arguments in the array. With missing
+ * arguments or arguments that are not of the right class for the
+ * specified format, a failing UErrorCode result is set.
+ * <P>
+ * For more sophisticated patterns, you can use a ChoiceFormat to get
+ * output:
+ * <pre>
+ * \code
+ * UErrorCode success = U_ZERO_ERROR;
+ * MessageFormat* form("The disk \"{1}\" contains {0}.", success);
+ * double filelimits[] = {0,1,2};
+ * UnicodeString filepart[] = {"no files","one file","{0,number} files"};
+ * ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3);
+ * form.setFormat(1, *fileform); // NOT zero, see below
+ *
+ * Formattable testArgs[] = {1273L, "MyDisk"};
+ *
+ * UnicodeString string;
+ * FieldPosition fpos = 0;
+ * cout << form.format(testArgs, 2, string, fpos, success) << endl;
+ *
+ * // output, with different testArgs
+ * // output: The disk "MyDisk" contains no files.
+ * // output: The disk "MyDisk" contains one file.
+ * // output: The disk "MyDisk" contains 1,273 files.
+ * \endcode
+ * </pre>
+ * You can either do this programmatically, as in the above example,
+ * or by using a pattern (see ChoiceFormat for more information) as in:
+ * <pre>
+ * \code
+ * form.applyPattern(
+ * "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
+ * \endcode
+ * </pre>
+ * <P>
+ * <EM>Note:</EM> As we see above, the string produced by a ChoiceFormat in
+ * MessageFormat is treated specially; occurences of '{' are used to
+ * indicated subformats, and cause recursion. If you create both a
+ * MessageFormat and ChoiceFormat programmatically (instead of using
+ * the string patterns), then be careful not to produce a format that
+ * recurses on itself, which will cause an infinite loop.
+ * <P>
+ * <EM>Note:</EM> Subformats are numbered by their order in the pattern.
+ * This is <EM>not</EM> the same as the argumentIndex.
+ * <pre>
+ * \code
+ * For example: with "abc{2}def{3}ghi{0}...",
+ *
+ * format0 affects the first variable {2}
+ * format1 affects the second variable {3}
+ * format2 affects the second variable {0}
+ * \endcode
+ * </pre>
+ *
+ * <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 MessageFormat : public Format {
+public:
+ /**
+ * Enum type for kMaxFormat.
+ * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6,
+ * rendering this enum type obsolete.
+ */
+ enum EFormatNumber {
+ /**
+ * The maximum number of arguments.
+ * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6,
+ * rendering this constant obsolete.
+ */
+ kMaxFormat = 10
+ };
+
+ /**
+ * Constructs a new MessageFormat using the given pattern and the
+ * default locale.
+ *
+ * @param pattern Pattern used to construct object.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ MessageFormat(const UnicodeString& pattern,
+ UErrorCode &status);
+
+ /**
+ * Constructs a new MessageFormat using the given pattern and locale.
+ * @param pattern Pattern used to construct object.
+ * @param newLocale The locale to use for formatting dates and numbers.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ MessageFormat(const UnicodeString& pattern,
+ const Locale& newLocale,
+ UErrorCode& status);
+ /**
+ * Constructs a new MessageFormat using the given pattern and locale.
+ * @param pattern Pattern used to construct object.
+ * @param newLocale The locale to use for formatting dates and numbers.
+ * @param parseError Struct to recieve information on position
+ * of error within the pattern.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ MessageFormat(const UnicodeString& pattern,
+ const Locale& newLocale,
+ UParseError& parseError,
+ UErrorCode& status);
+ /**
+ * Constructs a new MessageFormat from an existing one.
+ * @stable ICU 2.0
+ */
+ MessageFormat(const MessageFormat&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.0
+ */
+ const MessageFormat& operator=(const MessageFormat&);
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~MessageFormat();
+
+ /**
+ * Clones this Format object polymorphically. The caller owns the
+ * result and should delete it when done.
+ * @stable ICU 2.0
+ */
+ virtual Format* clone(void) const;
+
+ /**
+ * Returns 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 true if the given Format objects are semantically equal.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format& other) const;
+
+ /**
+ * Sets the locale. This locale is used for fetching default number or date
+ * format information.
+ * @param theLocale the new locale value to be set.
+ * @stable ICU 2.0
+ */
+ virtual void setLocale(const Locale& theLocale);
+
+ /**
+ * Gets the locale. This locale is used for fetching default number or date
+ * format information.
+ * @return the locale of the object.
+ * @stable ICU 2.0
+ */
+ virtual const Locale& getLocale(void) const;
+
+ /**
+ * Applies the given pattern string to this message format.
+ *
+ * @param pattern The pattern to be applied.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UErrorCode& status);
+ /**
+ * Applies the given pattern string to this message format.
+ *
+ * @param pattern The pattern to be applied.
+ * @param parseError Struct to recieve information on position
+ * of error within pattern.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern,
+ UParseError& parseError,
+ UErrorCode& status);
+
+ /**
+ * Returns a pattern that can be used to recreate this object.
+ *
+ * @param appendTo Output parameter to receive the pattern.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toPattern(UnicodeString& appendTo) const;
+
+ /**
+ * Sets subformats.
+ * See the class description about format numbering.
+ * The caller should not delete the Format objects after this call.
+ * <EM>The array formatsToAdopt is not itself adopted.</EM> Its
+ * ownership is retained by the caller. If the call fails because
+ * memory cannot be allocated, then the formats will be deleted
+ * by this method, and this object will remain unchanged.
+ *
+ * @stable ICU 2.0
+ * @param formatsToAdopt the format to be adopted.
+ * @param count the size of the array.
+ */
+ virtual void adoptFormats(Format** formatsToAdopt, int32_t count);
+
+ /**
+ * Sets subformats.
+ * See the class description about format numbering.
+ * Each item in the array is cloned into the internal array.
+ * If the call fails because memory cannot be allocated, then this
+ * object will remain unchanged.
+ *
+ * @stable ICU 2.0
+ * @param newFormats the new format to be set.
+ * @param cnt the size of the array.
+ */
+ virtual void setFormats(const Format** newFormats,int32_t cnt);
+
+
+ /**
+ * Sets one subformat.
+ * See the class description about format numbering.
+ * The caller should not delete the Format object after this call.
+ * If the number is over the number of formats already set,
+ * the item will be deleted and ignored.
+ * @stable ICU 2.0
+ * @param formatNumber index of the subformat.
+ * @param formatToAdopt the format to be adopted.
+ */
+ virtual void adoptFormat(int32_t formatNumber, Format* formatToAdopt);
+
+ /**
+ * Sets one subformat.
+ * See the class description about format numbering.
+ * If the number is over the number of formats already set,
+ * the item will be ignored.
+ * @param formatNumber index of the subformat.
+ * @param format the format to be set.
+ * @stable ICU 2.0
+ */
+ virtual void setFormat(int32_t formatNumber, const Format& format);
+
+ /**
+ * Gets an array of subformats of this object. The returned array
+ * should not be deleted by the caller, nor should the pointers
+ * within the array. The array and its contents remain valid only
+ * until the next call to any method of this class is made with
+ * this object. See the class description about format numbering.
+ * @param count output parameter to receive the size of the array
+ * @return an array of count Format* objects, or NULL if out of
+ * memory. Any or all of the array elements may be NULL.
+ * @stable ICU 2.0
+ */
+ virtual const Format** getFormats(int32_t& count) const;
+
+ /**
+ * Formats the given array of arguments into a user-readable string.
+ * Does not take ownership of the Formattable* array or its contents.
+ *
+ * @param source An array of objects to be formatted.
+ * @param count The number of elements of 'source'.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param ignore Not used; inherited from base class API.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( const Formattable* source,
+ int32_t count,
+ UnicodeString& appendTo,
+ FieldPosition& ignore,
+ UErrorCode& status) const;
+
+ /**
+ * Formats the given array of arguments into a user-readable string
+ * using the given pattern.
+ *
+ * @param pattern The pattern.
+ * @param arguments An array of objects to be formatted.
+ * @param count The number of elements of 'source'.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ static UnicodeString& format( const UnicodeString& pattern,
+ const Formattable* arguments,
+ int32_t count,
+ UnicodeString& appendTo,
+ UErrorCode& status);
+
+ /**
+ * Formats the given array of arguments into a user-readable
+ * string. The array must be stored within a single Formattable
+ * object of type kArray. If the Formattable object type is not of
+ * type kArray, then returns a failing UErrorCode.
+ *
+ * @param obj A Formattable of type kArray containing
+ * arguments to be formatted.
+ * @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 Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+
+ /**
+ * Formats the given array of arguments into a user-readable
+ * string. The array must be stored within a single Formattable
+ * object of type kArray. If the Formattable object type is not of
+ * type kArray, then returns a failing UErrorCode.
+ *
+ * @param obj The object to format
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Parses the given string into an array of output arguments.
+ *
+ * @param source String to be parsed.
+ * @param pos On input, starting position for parse. On output,
+ * final position after parse. Unchanged if parse
+ * fails.
+ * @param count Output parameter to receive the number of arguments
+ * parsed.
+ * @return an array of parsed arguments. The caller owns both
+ * the array and its contents.
+ * @stable ICU 2.0
+ */
+ virtual Formattable* parse( const UnicodeString& source,
+ ParsePosition& pos,
+ int32_t& count) const;
+
+ /**
+ * Parses the given string into an array of output arguments.
+ *
+ * @param source String to be parsed.
+ * @param count Output param to receive size of returned array.
+ * @param status Input/output error code. If the
+ * pattern cannot be parsed, set to failure code.
+ * @return an array of parsed arguments. The caller owns both
+ * the array and its contents.
+ * @stable ICU 2.0
+ */
+ virtual Formattable* parse( const UnicodeString& source,
+ int32_t& count,
+ UErrorCode& status) const;
+
+ /**
+ * Parses the given string into an array of output arguments
+ * stored within a single Formattable of type kArray.
+ *
+ * @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 pos On input, starting position for parse. On output,
+ * final position after parse. Unchanged if parse
+ * fails.
+ * @stable ICU 2.0
+ */
+ virtual void parseObject(const UnicodeString& source,
+ Formattable& result,
+ ParsePosition& pos) const;
+
+ /**
+ * Convert an 'apostrophe-friendly' pattern into a standard
+ * pattern. Standard patterns treat all apostrophes as
+ * quotes, which is problematic in some languages, e.g.
+ * French, where apostrophe is commonly used. This utility
+ * assumes that only an unpaired apostrophe immediately before
+ * a brace is a true quote. Other unpaired apostrophes are paired,
+ * and the resulting standard pattern string is returned.
+ *
+ * <p><b>Note</b> it is not guaranteed that the returned pattern
+ * is indeed a valid pattern. The only effect is to convert
+ * between patterns having different quoting semantics.
+ *
+ * @param pattern the 'apostrophe-friendly' patttern to convert
+ * @param status Input/output error code. If the pattern
+ * cannot be parsed, the failure code is set.
+ * @return the standard equivalent of the original pattern
+ * @stable ICU 3.4
+ */
+ static UnicodeString autoQuoteApostrophe(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * 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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * 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() ==
+ * . Derived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+private:
+
+ Locale fLocale;
+ UnicodeString fPattern;
+ Format** formatAliases; // see getFormats
+ int32_t formatAliasesCapacity;
+
+ MessageFormat(); // default constructor not implemented
+
+ /*
+ * A structure representing one subformat of this MessageFormat.
+ * Each subformat has a Format object, an offset into the plain
+ * pattern text fPattern, and an argument number. The argument
+ * number corresponds to the array of arguments to be formatted.
+ * @internal
+ */
+ class Subformat {
+ public:
+ /**
+ * @internal
+ */
+ Format* format; // formatter
+ /**
+ * @internal
+ */
+ int32_t offset; // offset into fPattern
+ /**
+ * @internal
+ */
+ int32_t arg; // 0-based argument number
+
+ /**
+ * Clone that.format and assign it to this.format
+ * Do NOT delete this.format
+ * @internal
+ */
+ Subformat& operator=(const Subformat& that) {
+ format = that.format ? that.format->clone() : NULL;
+ offset = that.offset;
+ arg = that.arg;
+ return *this;
+ }
+
+ /**
+ * @internal
+ */
+ UBool operator==(const Subformat& that) const {
+ // Do cheap comparisons first
+ return offset == that.offset &&
+ arg == that.arg &&
+ ((format == that.format) || // handles NULL
+ (*format == *that.format));
+ }
+
+ /**
+ * @internal
+ */
+ UBool operator!=(const Subformat& that) const {
+ return !operator==(that);
+ }
+ };
+
+ /**
+ * A MessageFormat contains an array of subformats. This array
+ * needs to grow dynamically if the MessageFormat is modified.
+ */
+ Subformat* subformats;
+ int32_t subformatCount;
+ int32_t subformatCapacity;
+
+ /**
+ * A MessageFormat formats an array of arguments. Each argument
+ * has an expected type, based on the pattern. For example, if
+ * the pattern contains the subformat "{3,number,integer}", then
+ * we expect argument 3 to have type Formattable::kLong. This
+ * array needs to grow dynamically if the MessageFormat is
+ * modified.
+ */
+ Formattable::Type* argTypes;
+ int32_t argTypeCount;
+ int32_t argTypeCapacity;
+
+ // Variable-size array management
+ UBool allocateSubformats(int32_t capacity);
+ UBool allocateArgTypes(int32_t capacity);
+
+ /**
+ * Default Format objects used when no format is specified and a
+ * numeric or date argument is formatted. These are volatile
+ * cache objects maintained only for performance. They do not
+ * participate in operator=(), copy constructor(), nor
+ * operator==().
+ */
+ NumberFormat* defaultNumberFormat;
+ DateFormat* defaultDateFormat;
+
+ /**
+ * Method to retrieve default formats (or NULL on failure).
+ * These are semantically const, but may modify *this.
+ */
+ const NumberFormat* getDefaultNumberFormat(UErrorCode&) const;
+ const DateFormat* getDefaultDateFormat(UErrorCode&) const;
+
+ /**
+ * Finds the word s, in the keyword list and returns the located index.
+ * @param s the keyword to be searched for.
+ * @param list the list of keywords to be searched with.
+ * @return the index of the list which matches the keyword s.
+ */
+ static int32_t findKeyword( const UnicodeString& s,
+ const UChar * const *list);
+
+ /**
+ * Formats the array of arguments and copies the result into the
+ * result buffer, updates the field position.
+ *
+ * @param arguments The formattable objects array.
+ * @param cnt The array count.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Field position status.
+ * @param recursionProtection
+ * Initially zero. Bits 0..9 are used to indicate
+ * that a parameter has already been seen, to
+ * avoid recursion. Currently unused.
+ * @param success The error code status.
+ * @return Reference to 'appendTo' parameter.
+ */
+ UnicodeString& format( const Formattable* arguments,
+ int32_t cnt,
+ UnicodeString& appendTo,
+ FieldPosition& status,
+ int32_t recursionProtection,
+ UErrorCode& success) const;
+
+ void makeFormat(int32_t offsetNumber,
+ UnicodeString* segments,
+ UParseError& parseError,
+ UErrorCode& success);
+
+ /**
+ * Convenience method that ought to be in NumberFormat
+ */
+ NumberFormat* createIntegerFormat(const Locale& locale, UErrorCode& status) const;
+
+ /**
+ * Checks the range of the source text to quote the special
+ * characters, { and ' and copy to target buffer.
+ * @param source
+ * @param start the text offset to start the process of in the source string
+ * @param end the text offset to end the process of in the source string
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ */
+ static void copyAndFixQuotes(const UnicodeString& appendTo, int32_t start, int32_t end, UnicodeString& target);
+
+ /**
+ * Returns array of argument types in the parsed pattern
+ * for use in C API. Only for the use of umsg_vformat(). Not
+ * for public consumption.
+ * @param listCount Output parameter to receive the size of array
+ * @return The array of formattable types in the pattern
+ * @internal
+ */
+ const Formattable::Type* getArgTypeList(int32_t& listCount) const {
+ listCount = argTypeCount;
+ return argTypes;
+ }
+
+ friend class MessageFormatAdapter; // getFormatTypeList() access
+};
+
+inline UnicodeString&
+MessageFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return Format::format(obj, appendTo, status);
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _MSGFMT
+//eof
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h
new file mode 100644
index 00000000000..b27ed470819
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/numfmt.h
@@ -0,0 +1,861 @@
+/*
+********************************************************************************
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
+********************************************************************************
+*
+* File NUMFMT.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 03/18/97 clhuang Updated per C++ implementation.
+* 04/17/97 aliu Changed DigitCount to int per code review.
+* 07/20/98 stephen JDK 1.2 sync up. Added scientific support.
+* Changed naming conventions to match C++ guidelines
+* Derecated Java style constants (eg, INTEGER_FIELD)
+********************************************************************************
+*/
+
+#ifndef NUMFMT_H
+#define NUMFMT_H
+
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Abstract base class for all number formats.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/unistr.h"
+#include "unicode/format.h"
+#include "unicode/unum.h" // UNumberFormatStyle
+#include "unicode/locid.h"
+
+U_NAMESPACE_BEGIN
+
+#if !UCONFIG_NO_SERVICE
+class NumberFormatFactory;
+class StringEnumeration;
+#endif
+
+/**
+ *
+ * Abstract base class for all number formats. Provides interface for
+ * formatting and parsing a number. Also provides methods for
+ * determining which locales have number formats, and what their names
+ * are.
+ * <P>
+ * NumberFormat helps you to format and parse numbers for any locale.
+ * Your code can be completely independent of the locale conventions
+ * for decimal points, thousands-separators, or even the particular
+ * decimal digits used, or whether the number format is even decimal.
+ * <P>
+ * To format a number for the current Locale, use one of the static
+ * factory methods:
+ * <pre>
+ * \code
+ * double myNumber = 7.0;
+ * UnicodeString myString;
+ * UErrorCode success = U_ZERO_ERROR;
+ * NumberFormat* nf = NumberFormat::createInstance(success)
+ * nf->format(myNumber, myString);
+ * cout << " Example 1: " << myString << endl;
+ * \endcode
+ * </pre>
+ * If you are formatting multiple numbers, it is more efficient to get
+ * the format and use it multiple times so that the system doesn't
+ * have to fetch the information about the local language and country
+ * conventions multiple times.
+ * <pre>
+ * \code
+ * UnicodeString myString;
+ * UErrorCode success = U_ZERO_ERROR;
+ * nf = NumberFormat::createInstance( success );
+ * int32_t a[] = { 123, 3333, -1234567 };
+ * const int32_t a_len = sizeof(a) / sizeof(a[0]);
+ * myString.remove();
+ * for (int32_t i = 0; i < a_len; i++) {
+ * nf->format(a[i], myString);
+ * myString += " ; ";
+ * }
+ * cout << " Example 2: " << myString << endl;
+ * \endcode
+ * </pre>
+ * To format a number for a different Locale, specify it in the
+ * call to createInstance().
+ * <pre>
+ * \code
+ * nf = NumberFormat::createInstance( Locale::FRENCH, success );
+ * \endcode
+ * </pre>
+ * You can use a NumberFormat to parse also.
+ * <pre>
+ * \code
+ * UErrorCode success;
+ * Formattable result(-999); // initialized with error code
+ * nf->parse(myString, result, success);
+ * \endcode
+ * </pre>
+ * Use createInstance to get the normal number format for that country.
+ * There are other static factory methods available. Use getCurrency
+ * to get the currency number format for that country. Use getPercent
+ * to get a format for displaying percentages. With this format, a
+ * fraction from 0.53 is displayed as 53%.
+ * <P>
+ * You can also control the display of numbers with such methods as
+ * getMinimumFractionDigits. If you want even more control over the
+ * format or parsing, or want to give your users more control, you can
+ * try casting the NumberFormat you get from the factory methods to a
+ * DecimalNumberFormat. This will work for the vast majority of
+ * countries; just remember to put it in a try block in case you
+ * encounter an unusual one.
+ * <P>
+ * You can also use forms of the parse and format methods with
+ * ParsePosition and FieldPosition to allow you to:
+ * <ul type=round>
+ * <li>(a) progressively parse through pieces of a string.
+ * <li>(b) align the decimal point and other areas.
+ * </ul>
+ * For example, you can align numbers in two ways.
+ * <P>
+ * If you are using a monospaced font with spacing for alignment, you
+ * can pass the FieldPosition in your format call, with field =
+ * INTEGER_FIELD. On output, getEndIndex will be set to the offset
+ * between the last character of the integer and the decimal. Add
+ * (desiredSpaceCount - getEndIndex) spaces at the front of the
+ * string.
+ * <P>
+ * If you are using proportional fonts, instead of padding with
+ * spaces, measure the width of the string in pixels from the start to
+ * getEndIndex. Then move the pen by (desiredPixelWidth -
+ * widthToAlignmentPoint) before drawing the text. It also works
+ * where there is no decimal, but possibly additional characters at
+ * the end, e.g. with parentheses in negative numbers: "(12)" for -12.
+ * <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.
+ *
+ * @stable ICU 2.0
+ */
+class U_I18N_API NumberFormat : public Format {
+public:
+
+ /**
+ * Alignment Field constants used to construct a FieldPosition object.
+ * Signifies that the position of the integer part or fraction part of
+ * a formatted number should be returned.
+ *
+ * @see FieldPosition
+ * @stable ICU 2.0
+ */
+ enum EAlignmentFields {
+ kIntegerField,
+ kFractionField,
+
+
+ /**
+ * These constants are provided for backwards compatibility only.
+ * Please use the C++ style constants defined above.
+ * @stable ICU 2.0
+ */
+ INTEGER_FIELD = kIntegerField,
+ FRACTION_FIELD = kFractionField
+ };
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~NumberFormat();
+
+ /**
+ * Return true if the given Format objects are semantically equal.
+ * Objects of different subclasses are considered unequal.
+ * @return true if the given Format objects are semantically equal.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format& other) const;
+
+ /**
+ * Format an object to produce a string. This method handles
+ * Formattable objects with numeric types. If the Formattable
+ * object type is not a numeric type, 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;
+
+ /**
+ * Parse a string to produce an object. This methods handles
+ * parsing of numeric strings into Formattable objects with numeric
+ * types.
+ * <P>
+ * Before calling, set parse_pos.index to the offset you want to
+ * start parsing at in the source. After calling, parse_pos.index
+ * indicates the position after the successfully parsed text. If
+ * an error occurs, parse_pos.index is unchanged.
+ * <P>
+ * When parsing, leading whitespace is discarded (with successful
+ * parse), while trailing whitespace is left as is.
+ * <P>
+ * See Format::parseObject() for more.
+ *
+ * @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.
+ * @return A newly created Formattable* object, or NULL
+ * on failure. The caller owns this and should
+ * delete it when done.
+ * @stable ICU 2.0
+ */
+ virtual void parseObject(const UnicodeString& source,
+ Formattable& result,
+ ParsePosition& parse_pos) const;
+
+ /**
+ * Format a double number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( double number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Format a long number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format( int32_t number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Format an int64 number. These methods call the NumberFormat
+ * pure virtual format() methods with the default FieldPosition.
+ *
+ * @param number The value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.8
+ */
+ UnicodeString& format( int64_t number,
+ UnicodeString& appendTo) const;
+
+ /**
+ * Format a double number. Concrete subclasses must implement
+ * these pure virtual methods.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(double number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const = 0;
+ /**
+ * Format a long number. Concrete subclasses must implement
+ * these pure virtual methods.
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(int32_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const = 0;
+
+ /**
+ * Format an int64 number. (Not abstract to retain compatibility
+ * with earlier releases, however subclasses should override this
+ * method as it just delegates to format(int32_t number...);
+ *
+ * @param number The value to be formatted.
+ * @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.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.8
+ */
+ virtual UnicodeString& format(int64_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+ /**
+ * Redeclared Format method.
+ * @param obj The object to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Output parameter set to a failure error code
+ * when a failure occurs.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Return a long if possible (e.g. within range LONG_MAX,
+ * LONG_MAX], and with no decimals), otherwise a double. If
+ * IntegerOnly is set, will stop at a decimal point (or equivalent;
+ * e.g. for rational numbers "1 2/3", will stop after the 1).
+ * <P>
+ * If no object can be parsed, index is unchanged, and NULL is
+ * returned.
+ * <P>
+ * This is a pure virtual which concrete subclasses must implement.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param parsePosition The position to start parsing at on input.
+ * On output, moved to after the last successfully
+ * parse character. On parse failure, does not change.
+ * @return A Formattable object of numeric type. The caller
+ * owns this an must delete it. NULL on failure.
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& parsePosition) const = 0;
+
+ /**
+ * Parse a string as a numeric value, and return a Formattable
+ * numeric object. This method parses integers only if IntegerOnly
+ * is set.
+ *
+ * @param text The text to be parsed.
+ * @param result Formattable to be set to the parse result.
+ * If parse fails, return contents are undefined.
+ * @param status Output parameter set to a failure error code
+ * when a failure occurs.
+ * @return A Formattable object of numeric type. The caller
+ * owns this an must delete it. NULL on failure.
+ * @see NumberFormat::isParseIntegerOnly
+ * @stable ICU 2.0
+ */
+ virtual void parse( const UnicodeString& text,
+ Formattable& result,
+ UErrorCode& status) const;
+
+ /**
+ * Parses text from the given string as a currency amount. Unlike
+ * the parse() method, this method will attempt to parse a generic
+ * currency name, searching for a match of this object's locale's
+ * currency display names, or for a 3-letter ISO currency code.
+ * This method will fail if this format is not a currency format,
+ * that is, if it does not contain the currency pattern symbol
+ * (U+00A4) in its prefix or suffix.
+ *
+ * @param text the string to parse
+ * @param result output parameter to receive result. This will have
+ * its currency set to the parsed ISO currency code.
+ * @param pos input-output position; on input, the position within
+ * text to match; must have 0 <= pos.getIndex() < text.length();
+ * on output, the position after the last matched character. If
+ * the parse fails, the position in unchanged upon output.
+ * @return a reference to result
+ * @internal
+ */
+ virtual Formattable& parseCurrency(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& pos) const;
+
+ /**
+ * Return true if this format will parse numbers as integers
+ * only. For example in the English locale, with ParseIntegerOnly
+ * true, the string "1234." would be parsed as the integer value
+ * 1234 and parsing would stop at the "." character. Of course,
+ * the exact format accepted by the parse operation is locale
+ * dependant and determined by sub-classes of NumberFormat.
+ * @return true if this format will parse numbers as integers
+ * only.
+ * @stable ICU 2.0
+ */
+ UBool isParseIntegerOnly(void) const;
+
+ /**
+ * Sets whether or not numbers should be parsed as integers only.
+ * @param value set True, this format will parse numbers as integers
+ * only.
+ * @see isParseIntegerOnly
+ * @stable ICU 2.0
+ */
+ virtual void setParseIntegerOnly(UBool value);
+
+ /**
+ * Returns the default number format for the current default
+ * locale. The default format is one of the styles provided by
+ * the other factory methods: getNumberInstance,
+ * getCurrencyInstance or getPercentInstance. Exactly which one
+ * is locale dependant.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createInstance(UErrorCode&);
+
+ /**
+ * Returns the default number format for the specified locale.
+ * The default format is one of the styles provided by the other
+ * factory methods: getNumberInstance, getCurrencyInstance or
+ * getPercentInstance. Exactly which one is locale dependant.
+ * @param inLocale the given locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale,
+ UErrorCode&);
+
+ /**
+ * Returns a currency format for the current default locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&);
+
+ /**
+ * Returns a currency format for the specified locale.
+ * @param inLocale the given locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createCurrencyInstance(const Locale& inLocale,
+ UErrorCode&);
+
+ /**
+ * Returns a percentage format for the current default locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createPercentInstance(UErrorCode&);
+
+ /**
+ * Returns a percentage format for the specified locale.
+ * @param inLocale the given locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createPercentInstance(const Locale& inLocale,
+ UErrorCode&);
+
+ /**
+ * Returns a scientific format for the current default locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createScientificInstance(UErrorCode&);
+
+ /**
+ * Returns a scientific format for the specified locale.
+ * @param inLocale the given locale.
+ * @stable ICU 2.0
+ */
+ static NumberFormat* U_EXPORT2 createScientificInstance(const Locale& inLocale,
+ UErrorCode&);
+
+ /**
+ * Get the set of Locales for which NumberFormats are installed.
+ * @param count Output param to receive the size of the locales
+ * @stable ICU 2.0
+ */
+ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
+
+#if !UCONFIG_NO_SERVICE
+ /**
+ * Register a new NumberFormatFactory. The factory will be adopted.
+ * @param toAdopt the NumberFormatFactory instance to be adopted
+ * @param status the in/out status code, no special meanings are assigned
+ * @return a registry key that can be used to unregister this factory
+ * @stable ICU 2.6
+ */
+ static URegistryKey U_EXPORT2 registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status);
+
+ /**
+ * Unregister a previously-registered NumberFormatFactory using the key returned from the
+ * register call. Key becomes invalid after a successful call and should not be used again.
+ * The NumberFormatFactory corresponding to the key will be deleted.
+ * @param key the registry key returned by a previous call to registerFactory
+ * @param status the in/out status code, no special meanings are assigned
+ * @return TRUE if the factory for the key was successfully unregistered
+ * @stable ICU 2.6
+ */
+ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
+
+ /**
+ * Return a StringEnumeration over the locales available at the time of the call,
+ * including registered locales.
+ * @return a StringEnumeration over the locales available at the time of the call
+ * @stable ICU 2.6
+ */
+ static StringEnumeration* U_EXPORT2 getAvailableLocales(void);
+#endif /* UCONFIG_NO_SERVICE */
+
+ /**
+ * Returns true if grouping is used in this format. For example,
+ * in the English locale, with grouping on, the number 1234567
+ * might be formatted as "1,234,567". The grouping separator as
+ * well as the size of each group is locale dependant and is
+ * determined by sub-classes of NumberFormat.
+ * @see setGroupingUsed
+ * @stable ICU 2.0
+ */
+ UBool isGroupingUsed(void) const;
+
+ /**
+ * Set whether or not grouping will be used in this format.
+ * @param newValue True, grouping will be used in this format.
+ * @see getGroupingUsed
+ * @stable ICU 2.0
+ */
+ virtual void setGroupingUsed(UBool newValue);
+
+ /**
+ * Returns the maximum number of digits allowed in the integer portion of a
+ * number.
+ * @return the maximum number of digits allowed in the integer portion of a
+ * number.
+ * @see setMaximumIntegerDigits
+ * @stable ICU 2.0
+ */
+ int32_t getMaximumIntegerDigits(void) const;
+
+ /**
+ * Sets the maximum number of digits allowed in the integer portion of a
+ * number. maximumIntegerDigits must be >= minimumIntegerDigits. If the
+ * new value for maximumIntegerDigits is less than the current value
+ * of minimumIntegerDigits, then minimumIntegerDigits will also be set to
+ * the new value.
+ *
+ * @param newValue the new value for the maximum number of digits
+ * allowed in the integer portion of a number.
+ * @see getMaximumIntegerDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMaximumIntegerDigits(int32_t newValue);
+
+ /**
+ * Returns the minimum number of digits allowed in the integer portion of a
+ * number.
+ * @return the minimum number of digits allowed in the integer portion of a
+ * number.
+ * @see setMinimumIntegerDigits
+ * @stable ICU 2.0
+ */
+ int32_t getMinimumIntegerDigits(void) const;
+
+ /**
+ * Sets the minimum number of digits allowed in the integer portion of a
+ * number. minimumIntegerDigits must be &lt;= maximumIntegerDigits. If the
+ * new value for minimumIntegerDigits exceeds the current value
+ * of maximumIntegerDigits, then maximumIntegerDigits will also be set to
+ * the new value.
+ * @param newValue the new value to be set.
+ * @see getMinimumIntegerDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMinimumIntegerDigits(int32_t newValue);
+
+ /**
+ * Returns the maximum number of digits allowed in the fraction portion of a
+ * number.
+ * @return the maximum number of digits allowed in the fraction portion of a
+ * number.
+ * @see setMaximumFractionDigits
+ * @stable ICU 2.0
+ */
+ int32_t getMaximumFractionDigits(void) const;
+
+ /**
+ * Sets the maximum number of digits allowed in the fraction portion of a
+ * number. maximumFractionDigits must be >= minimumFractionDigits. If the
+ * new value for maximumFractionDigits is less than the current value
+ * of minimumFractionDigits, then minimumFractionDigits will also be set to
+ * the new value.
+ * @param newValue the new value to be set.
+ * @see getMaximumFractionDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMaximumFractionDigits(int32_t newValue);
+
+ /**
+ * Returns the minimum number of digits allowed in the fraction portion of a
+ * number.
+ * @return the minimum number of digits allowed in the fraction portion of a
+ * number.
+ * @see setMinimumFractionDigits
+ * @stable ICU 2.0
+ */
+ int32_t getMinimumFractionDigits(void) const;
+
+ /**
+ * Sets the minimum number of digits allowed in the fraction portion of a
+ * number. minimumFractionDigits must be &lt;= maximumFractionDigits. If the
+ * new value for minimumFractionDigits exceeds the current value
+ * of maximumFractionDigits, then maximumIntegerDigits will also be set to
+ * the new value
+ * @param newValue the new value to be set.
+ * @see getMinimumFractionDigits
+ * @stable ICU 2.0
+ */
+ virtual void setMinimumFractionDigits(int32_t newValue);
+
+ /**
+ * Sets the currency used to display currency
+ * amounts. This takes effect immediately, if this format is a
+ * currency format. If this format is not a currency format, then
+ * the currency is used if and when this object becomes a
+ * currency format.
+ * @param theCurrency a 3-letter ISO code indicating new currency
+ * to use. It need not be null-terminated. May be the empty
+ * string or NULL to indicate no currency.
+ * @param ec input-output error code
+ * @stable ICU 3.0
+ */
+ virtual void setCurrency(const UChar* theCurrency, UErrorCode& ec);
+
+ /**
+ * Gets the currency used to display currency
+ * amounts. This may be an empty string for some subclasses.
+ * @return a 3-letter null-terminated ISO code indicating
+ * the currency in use, or a pointer to the empty string.
+ * @stable ICU 2.6
+ */
+ const UChar* getCurrency() const;
+
+public:
+
+ /**
+ * Return the class ID for this class. This is useful for
+ * comparing to a return value from getDynamicClassID(). Note that,
+ * because NumberFormat is an abstract base class, no fully constructed object
+ * will have the class ID returned by NumberFormat::getStaticClassID().
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.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.
+ * <P>
+ * @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(void) const = 0;
+
+protected:
+
+ /**
+ * Default constructor for subclass use only.
+ * @stable ICU 2.0
+ */
+ NumberFormat();
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.0
+ */
+ NumberFormat(const NumberFormat&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.0
+ */
+ NumberFormat& operator=(const NumberFormat&);
+
+ /**
+ * Returns the currency in effect for this formatter. Subclasses
+ * should override this method as needed. Unlike getCurrency(),
+ * this method should never return "".
+ * @result output parameter for null-terminated result, which must
+ * have a capacity of at least 4
+ * @internal
+ */
+ virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
+
+private:
+
+ enum EStyles {
+ kNumberStyle,
+ kCurrencyStyle,
+ kPercentStyle,
+ kScientificStyle,
+ kStyleCount // ALWAYS LAST ENUM: number of styles
+ };
+
+ /**
+ * Creates the specified decimal format style of the desired locale.
+ * Hook for service registration, uses makeInstance directly if no services
+ * registered.
+ * @param desiredLocale the given locale.
+ * @param choice the given style.
+ * @param success Output param filled with success/failure status.
+ * @return A new NumberFormat instance.
+ */
+ static NumberFormat* U_EXPORT2 createInstance(const Locale& desiredLocale, EStyles choice, UErrorCode& success);
+
+ /**
+ * Creates the specified decimal format style of the desired locale.
+ * @param desiredLocale the given locale.
+ * @param choice the given style.
+ * @param success Output param filled with success/failure status.
+ * @return A new NumberFormat instance.
+ */
+ static NumberFormat* makeInstance(const Locale& desiredLocale, EStyles choice, UErrorCode& success);
+
+ UBool fGroupingUsed;
+ int32_t fMaxIntegerDigits;
+ int32_t fMinIntegerDigits;
+ int32_t fMaxFractionDigits;
+ int32_t fMinFractionDigits;
+ UBool fParseIntegerOnly;
+
+ // ISO currency code
+ UChar fCurrency[4];
+
+ friend class ICUNumberFormatFactory; // access to makeInstance, EStyles
+ friend class ICUNumberFormatService;
+};
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * A NumberFormatFactory is used to register new number formats. The factory
+ * should be able to create any of the predefined formats for each locale it
+ * supports. When registered, the locales it supports extend or override the
+ * locale already supported by ICU.
+ *
+ * @stable ICU 2.6
+ */
+class U_I18N_API NumberFormatFactory : public UObject {
+public:
+
+ /**
+ * Destructor
+ * @stable ICU 3.0
+ */
+ virtual ~NumberFormatFactory();
+
+ /**
+ * Return true if this factory will be visible. Default is true.
+ * If not visible, the locales supported by this factory will not
+ * be listed by getAvailableLocales.
+ * @stable ICU 2.6
+ */
+ virtual UBool visible(void) const = 0;
+
+ /**
+ * Return the locale names directly supported by this factory. The number of names
+ * is returned in count;
+ * @stable ICU 2.6
+ */
+ virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const = 0;
+
+ /**
+ * Return a number format of the appropriate type. If the locale
+ * is not supported, return null. If the locale is supported, but
+ * the type is not provided by this service, return null. Otherwise
+ * return an appropriate instance of NumberFormat.
+ * @stable ICU 2.6
+ */
+ virtual NumberFormat* createFormat(const Locale& loc, UNumberFormatStyle formatType) = 0;
+};
+
+/**
+ * A NumberFormatFactory that supports a single locale. It can be visible or invisible.
+ * @stable ICU 2.6
+ */
+class U_I18N_API SimpleNumberFormatFactory : public NumberFormatFactory {
+protected:
+ /**
+ * True if the locale supported by this factory is visible.
+ * @stable ICU 2.6
+ */
+ const UBool _visible;
+
+ /**
+ * The locale supported by this factory, as a UnicodeString.
+ * @stable ICU 2.6
+ */
+ UnicodeString _id;
+
+public:
+ /**
+ * @stable ICU 2.6
+ */
+ SimpleNumberFormatFactory(const Locale& locale, UBool visible = TRUE);
+
+ /**
+ * @stable ICU 3.0
+ */
+ virtual ~SimpleNumberFormatFactory();
+
+ /**
+ * @stable ICU 2.6
+ */
+ virtual UBool visible(void) const;
+
+ /**
+ * @stable ICU 2.6
+ */
+ virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const;
+};
+#endif /* #if !UCONFIG_NO_SERVICE */
+
+// -------------------------------------
+
+inline UBool
+NumberFormat::isParseIntegerOnly() const
+{
+ return fParseIntegerOnly;
+}
+
+inline UnicodeString&
+NumberFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ return Format::format(obj, appendTo, status);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _NUMFMT
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h b/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h
new file mode 100644
index 00000000000..030565eb284
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/rbnf.h
@@ -0,0 +1,1049 @@
+/*
+*******************************************************************************
+* Copyright (C) 1997-2006, International Business Machines Corporation and others.
+* All Rights Reserved.
+*******************************************************************************
+*/
+
+#ifndef RBNF_H
+#define RBNF_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Rule Based Number Format
+ */
+
+/**
+ * \def U_HAVE_RBNF
+ * This will be 0 if RBNF support is not included in ICU
+ * and 1 if it is.
+ *
+ * @stable ICU 2.4
+ */
+#if UCONFIG_NO_FORMATTING
+#define U_HAVE_RBNF 0
+#else
+#define U_HAVE_RBNF 1
+
+#include "unicode/coll.h"
+#include "unicode/dcfmtsym.h"
+#include "unicode/fmtable.h"
+#include "unicode/locid.h"
+#include "unicode/numfmt.h"
+#include "unicode/unistr.h"
+#include "unicode/strenum.h"
+
+U_NAMESPACE_BEGIN
+
+class NFRuleSet;
+class LocalizationInfo;
+
+/**
+ * Tags for the predefined rulesets.
+ *
+ * @stable ICU 2.2
+ */
+enum URBNFRuleSetTag {
+ URBNF_SPELLOUT,
+ URBNF_ORDINAL,
+ URBNF_DURATION,
+ URBNF_COUNT
+};
+
+#if UCONFIG_NO_COLLATION
+class Collator;
+#endif
+
+/**
+ * The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is
+ * typically used for spelling out numeric values in words (e.g., 25,3476 as
+ * &quot;twenty-five thousand three hundred seventy-six&quot; or &quot;vingt-cinq mille trois
+ * cents soixante-seize&quot; or
+ * &quot;f&uuml;nfundzwanzigtausenddreihundertsechsundsiebzig&quot;), but can also be used for
+ * other complicated formatting tasks, such as formatting a number of seconds as hours,
+ * minutes and seconds (e.g., 3,730 as &quot;1:02:10&quot;).
+ *
+ * <p>The resources contain three predefined formatters for each locale: spellout, which
+ * spells out a value in words (123 is &quot;one hundred twenty-three&quot;); ordinal, which
+ * appends an ordinal suffix to the end of a numeral (123 is &quot;123rd&quot;); and
+ * duration, which shows a duration in seconds as hours, minutes, and seconds (123 is
+ * &quot;2:03&quot;).&nbsp; The client can also define more specialized <tt>RuleBasedNumberFormat</tt>s
+ * by supplying programmer-defined rule sets.</p>
+ *
+ * <p>The behavior of a <tt>RuleBasedNumberFormat</tt> is specified by a textual description
+ * that is either passed to the constructor as a <tt>String</tt> or loaded from a resource
+ * bundle. In its simplest form, the description consists of a semicolon-delimited list of <em>rules.</em>
+ * Each rule has a string of output text and a value or range of values it is applicable to.
+ * In a typical spellout rule set, the first twenty rules are the words for the numbers from
+ * 0 to 19:</p>
+ *
+ * <pre>zero; one; two; three; four; five; six; seven; eight; nine;
+ * ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen; seventeen; eighteen; nineteen;</pre>
+ *
+ * <p>For larger numbers, we can use the preceding set of rules to format the ones place, and
+ * we only have to supply the words for the multiples of 10:</p>
+ *
+ * <pre> 20: twenty[-&gt;&gt;];
+ * 30: thirty[-&gt;&gt;];
+ * 40: forty[-&gt;&gt;];
+ * 50: fifty[-&gt;&gt;];
+ * 60: sixty[-&gt;&gt;];
+ * 70: seventy[-&gt;&gt;];
+ * 80: eighty[-&gt;&gt;];
+ * 90: ninety[-&gt;&gt;];</pre>
+ *
+ * <p>In these rules, the <em>base value</em> is spelled out explicitly and set off from the
+ * rule's output text with a colon. The rules are in a sorted list, and a rule is applicable
+ * to all numbers from its own base value to one less than the next rule's base value. The
+ * &quot;&gt;&gt;&quot; token is called a <em>substitution</em> and tells the fomatter to
+ * isolate the number's ones digit, format it using this same set of rules, and place the
+ * result at the position of the &quot;&gt;&gt;&quot; token. Text in brackets is omitted if
+ * the number being formatted is an even multiple of 10 (the hyphen is a literal hyphen; 24
+ * is &quot;twenty-four,&quot; not &quot;twenty four&quot;).</p>
+ *
+ * <p>For even larger numbers, we can actually look up several parts of the number in the
+ * list:</p>
+ *
+ * <pre>100: &lt;&lt; hundred[ &gt;&gt;];</pre>
+ *
+ * <p>The &quot;&lt;&lt;&quot; represents a new kind of substitution. The &lt;&lt; isolates
+ * the hundreds digit (and any digits to its left), formats it using this same rule set, and
+ * places the result where the &quot;&lt;&lt;&quot; was. Notice also that the meaning of
+ * &gt;&gt; has changed: it now refers to both the tens and the ones digits. The meaning of
+ * both substitutions depends on the rule's base value. The base value determines the rule's <em>divisor,</em>
+ * which is the highest power of 10 that is less than or equal to the base value (the user
+ * can change this). To fill in the substitutions, the formatter divides the number being
+ * formatted by the divisor. The integral quotient is used to fill in the &lt;&lt;
+ * substitution, and the remainder is used to fill in the &gt;&gt; substitution. The meaning
+ * of the brackets changes similarly: text in brackets is omitted if the value being
+ * formatted is an even multiple of the rule's divisor. The rules are applied recursively, so
+ * if a substitution is filled in with text that includes another substitution, that
+ * substitution is also filled in.</p>
+ *
+ * <p>This rule covers values up to 999, at which point we add another rule:</p>
+ *
+ * <pre>1000: &lt;&lt; thousand[ &gt;&gt;];</pre>
+ *
+ * <p>Again, the meanings of the brackets and substitution tokens shift because the rule's
+ * base value is a higher power of 10, changing the rule's divisor. This rule can actually be
+ * used all the way up to 999,999. This allows us to finish out the rules as follows:</p>
+ *
+ * <pre> 1,000,000: &lt;&lt; million[ &gt;&gt;];
+ * 1,000,000,000: &lt;&lt; billion[ &gt;&gt;];
+ * 1,000,000,000,000: &lt;&lt; trillion[ &gt;&gt;];
+ * 1,000,000,000,000,000: OUT OF RANGE!;</pre>
+ *
+ * <p>Commas, periods, and spaces can be used in the base values to improve legibility and
+ * are ignored by the rule parser. The last rule in the list is customarily treated as an
+ * &quot;overflow rule,&quot; applying to everything from its base value on up, and often (as
+ * in this example) being used to print out an error message or default representation.
+ * Notice also that the size of the major groupings in large numbers is controlled by the
+ * spacing of the rules: because in English we group numbers by thousand, the higher rules
+ * are separated from each other by a factor of 1,000.</p>
+ *
+ * <p>To see how these rules actually work in practice, consider the following example:
+ * Formatting 25,430 with this rule set would work like this:</p>
+ *
+ * <table border="0" width="100%">
+ * <tr>
+ * <td><strong>&lt;&lt; thousand &gt;&gt;</strong></td>
+ * <td>[the rule whose base value is 1,000 is applicable to 25,340]</td>
+ * </tr>
+ * <tr>
+ * <td><strong>twenty-&gt;&gt;</strong> thousand &gt;&gt;</td>
+ * <td>[25,340 over 1,000 is 25. The rule for 20 applies.]</td>
+ * </tr>
+ * <tr>
+ * <td>twenty-<strong>five</strong> thousand &gt;&gt;</td>
+ * <td>[25 mod 10 is 5. The rule for 5 is &quot;five.&quot;</td>
+ * </tr>
+ * <tr>
+ * <td>twenty-five thousand <strong>&lt;&lt; hundred &gt;&gt;</strong></td>
+ * <td>[25,340 mod 1,000 is 340. The rule for 100 applies.]</td>
+ * </tr>
+ * <tr>
+ * <td>twenty-five thousand <strong>three</strong> hundred &gt;&gt;</td>
+ * <td>[340 over 100 is 3. The rule for 3 is &quot;three.&quot;]</td>
+ * </tr>
+ * <tr>
+ * <td>twenty-five thousand three hundred <strong>forty</strong></td>
+ * <td>[340 mod 100 is 40. The rule for 40 applies. Since 40 divides
+ * evenly by 10, the hyphen and substitution in the brackets are omitted.]</td>
+ * </tr>
+ * </table>
+ *
+ * <p>The above syntax suffices only to format positive integers. To format negative numbers,
+ * we add a special rule:</p>
+ *
+ * <pre>-x: minus &gt;&gt;;</pre>
+ *
+ * <p>This is called a <em>negative-number rule,</em> and is identified by &quot;-x&quot;
+ * where the base value would be. This rule is used to format all negative numbers. the
+ * &gt;&gt; token here means &quot;find the number's absolute value, format it with these
+ * rules, and put the result here.&quot;</p>
+ *
+ * <p>We also add a special rule called a <em>fraction rule </em>for numbers with fractional
+ * parts:</p>
+ *
+ * <pre>x.x: &lt;&lt; point &gt;&gt;;</pre>
+ *
+ * <p>This rule is used for all positive non-integers (negative non-integers pass through the
+ * negative-number rule first and then through this rule). Here, the &lt;&lt; token refers to
+ * the number's integral part, and the &gt;&gt; to the number's fractional part. The
+ * fractional part is formatted as a series of single-digit numbers (e.g., 123.456 would be
+ * formatted as &quot;one hundred twenty-three point four five six&quot;).</p>
+ *
+ * <p>To see how this rule syntax is applied to various languages, examine the resource data.</p>
+ *
+ * <p>There is actually much more flexibility built into the rule language than the
+ * description above shows. A formatter may own multiple rule sets, which can be selected by
+ * the caller, and which can use each other to fill in their substitutions. Substitutions can
+ * also be filled in with digits, using a DecimalFormat object. There is syntax that can be
+ * used to alter a rule's divisor in various ways. And there is provision for much more
+ * flexible fraction handling. A complete description of the rule syntax follows:</p>
+ *
+ * <hr>
+ *
+ * <p>The description of a <tt>RuleBasedNumberFormat</tt>'s behavior consists of one or more <em>rule
+ * sets.</em> Each rule set consists of a name, a colon, and a list of <em>rules.</em> A rule
+ * set name must begin with a % sign. Rule sets with names that begin with a single % sign
+ * are <em>public:</em> the caller can specify that they be used to format and parse numbers.
+ * Rule sets with names that begin with %% are <em>private:</em> they exist only for the use
+ * of other rule sets. If a formatter only has one rule set, the name may be omitted.</p>
+ *
+ * <p>The user can also specify a special &quot;rule set&quot; named <tt>%%lenient-parse</tt>.
+ * The body of <tt>%%lenient-parse</tt> isn't a set of number-formatting rules, but a <tt>RuleBasedCollator</tt>
+ * description which is used to define equivalences for lenient parsing. For more information
+ * on the syntax, see <tt>RuleBasedCollator</tt>. For more information on lenient parsing,
+ * see <tt>setLenientParse()</tt>. <em>Note:</em> symbols that have syntactic meaning
+ * in collation rules, such as '&amp;', have no particular meaning when appearing outside
+ * of the <tt>lenient-parse</tt> rule set.</p>
+ *
+ * <p>The body of a rule set consists of an ordered, semicolon-delimited list of <em>rules.</em>
+ * Internally, every rule has a base value, a divisor, rule text, and zero, one, or two <em>substitutions.</em>
+ * These parameters are controlled by the description syntax, which consists of a <em>rule
+ * descriptor,</em> a colon, and a <em>rule body.</em></p>
+ *
+ * <p>A rule descriptor can take one of the following forms (text in <em>italics</em> is the
+ * name of a token):</p>
+ *
+ * <table border="0" width="100%">
+ * <tr>
+ * <td><em>bv</em>:</td>
+ * <td><em>bv</em> specifies the rule's base value. <em>bv</em> is a decimal
+ * number expressed using ASCII digits. <em>bv</em> may contain spaces, period, and commas,
+ * which are ignored. The rule's divisor is the highest power of 10 less than or equal to
+ * the base value.</td>
+ * </tr>
+ * <tr>
+ * <td><em>bv</em>/<em>rad</em>:</td>
+ * <td><em>bv</em> specifies the rule's base value. The rule's divisor is the
+ * highest power of <em>rad</em> less than or equal to the base value.</td>
+ * </tr>
+ * <tr>
+ * <td><em>bv</em>&gt;:</td>
+ * <td><em>bv</em> specifies the rule's base value. To calculate the divisor,
+ * let the radix be 10, and the exponent be the highest exponent of the radix that yields a
+ * result less than or equal to the base value. Every &gt; character after the base value
+ * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix
+ * raised to the power of the exponent; otherwise, the divisor is 1.</td>
+ * </tr>
+ * <tr>
+ * <td><em>bv</em>/<em>rad</em>&gt;:</td>
+ * <td><em>bv</em> specifies the rule's base value. To calculate the divisor,
+ * let the radix be <em>rad</em>, and the exponent be the highest exponent of the radix that
+ * yields a result less than or equal to the base value. Every &gt; character after the radix
+ * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix
+ * raised to the power of the exponent; otherwise, the divisor is 1.</td>
+ * </tr>
+ * <tr>
+ * <td>-x:</td>
+ * <td>The rule is a negative-number rule.</td>
+ * </tr>
+ * <tr>
+ * <td>x.x:</td>
+ * <td>The rule is an <em>improper fraction rule.</em></td>
+ * </tr>
+ * <tr>
+ * <td>0.x:</td>
+ * <td>The rule is a <em>proper fraction rule.</em></td>
+ * </tr>
+ * <tr>
+ * <td>x.0:</td>
+ * <td>The rule is a <em>master rule.</em></td>
+ * </tr>
+ * <tr>
+ * <td><em>nothing</em></td>
+ * <td>If the rule's rule descriptor is left out, the base value is one plus the
+ * preceding rule's base value (or zero if this is the first rule in the list) in a normal
+ * rule set.&nbsp; In a fraction rule set, the base value is the same as the preceding rule's
+ * base value.</td>
+ * </tr>
+ * </table>
+ *
+ * <p>A rule set may be either a regular rule set or a <em>fraction rule set,</em> depending
+ * on whether it is used to format a number's integral part (or the whole number) or a
+ * number's fractional part. Using a rule set to format a rule's fractional part makes it a
+ * fraction rule set.</p>
+ *
+ * <p>Which rule is used to format a number is defined according to one of the following
+ * algorithms: If the rule set is a regular rule set, do the following:
+ *
+ * <ul>
+ * <li>If the rule set includes a master rule (and the number was passed in as a <tt>double</tt>),
+ * use the master rule.&nbsp; (If the number being formatted was passed in as a <tt>long</tt>,
+ * the master rule is ignored.)</li>
+ * <li>If the number is negative, use the negative-number rule.</li>
+ * <li>If the number has a fractional part and is greater than 1, use the improper fraction
+ * rule.</li>
+ * <li>If the number has a fractional part and is between 0 and 1, use the proper fraction
+ * rule.</li>
+ * <li>Binary-search the rule list for the rule with the highest base value less than or equal
+ * to the number. If that rule has two substitutions, its base value is not an even multiple
+ * of its divisor, and the number <em>is</em> an even multiple of the rule's divisor, use the
+ * rule that precedes it in the rule list. Otherwise, use the rule itself.</li>
+ * </ul>
+ *
+ * <p>If the rule set is a fraction rule set, do the following:
+ *
+ * <ul>
+ * <li>Ignore negative-number and fraction rules.</li>
+ * <li>For each rule in the list, multiply the number being formatted (which will always be
+ * between 0 and 1) by the rule's base value. Keep track of the distance between the result
+ * the nearest integer.</li>
+ * <li>Use the rule that produced the result closest to zero in the above calculation. In the
+ * event of a tie or a direct hit, use the first matching rule encountered. (The idea here is
+ * to try each rule's base value as a possible denominator of a fraction. Whichever
+ * denominator produces the fraction closest in value to the number being formatted wins.) If
+ * the rule following the matching rule has the same base value, use it if the numerator of
+ * the fraction is anything other than 1; if the numerator is 1, use the original matching
+ * rule. (This is to allow singular and plural forms of the rule text without a lot of extra
+ * hassle.)</li>
+ * </ul>
+ *
+ * <p>A rule's body consists of a string of characters terminated by a semicolon. The rule
+ * may include zero, one, or two <em>substitution tokens,</em> and a range of text in
+ * brackets. The brackets denote optional text (and may also include one or both
+ * substitutions). The exact meanings of the substitution tokens, and under what conditions
+ * optional text is omitted, depend on the syntax of the substitution token and the context.
+ * The rest of the text in a rule body is literal text that is output when the rule matches
+ * the number being formatted.</p>
+ *
+ * <p>A substitution token begins and ends with a <em>token character.</em> The token
+ * character and the context together specify a mathematical operation to be performed on the
+ * number being formatted. An optional <em>substitution descriptor </em>specifies how the
+ * value resulting from that operation is used to fill in the substitution. The position of
+ * the substitution token in the rule body specifies the location of the resultant text in
+ * the original rule text.</p>
+ *
+ * <p>The meanings of the substitution token characters are as follows:</p>
+ *
+ * <table border="0" width="100%">
+ * <tr>
+ * <td>&gt;&gt;</td>
+ * <td>in normal rule</td>
+ * <td>Divide the number by the rule's divisor and format the remainder</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in negative-number rule</td>
+ * <td>Find the absolute value of the number and format the result</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in fraction or master rule</td>
+ * <td>Isolate the number's fractional part and format it.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in rule in fraction rule set</td>
+ * <td>Not allowed.</td>
+ * </tr>
+ * <tr>
+ * <td>&gt;&gt;&gt;</td>
+ * <td>in normal rule</td>
+ * <td>Divide the number by the rule's divisor and format the remainder,
+ * but bypass the normal rule-selection process and just use the
+ * rule that precedes this one in this rule list.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in all other rules</td>
+ * <td>Not allowed.</td>
+ * </tr>
+ * <tr>
+ * <td>&lt;&lt;</td>
+ * <td>in normal rule</td>
+ * <td>Divide the number by the rule's divisor and format the quotient</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in negative-number rule</td>
+ * <td>Not allowed.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in fraction or master rule</td>
+ * <td>Isolate the number's integral part and format it.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in rule in fraction rule set</td>
+ * <td>Multiply the number by the rule's base value and format the result.</td>
+ * </tr>
+ * <tr>
+ * <td>==</td>
+ * <td>in all rule sets</td>
+ * <td>Format the number unchanged</td>
+ * </tr>
+ * <tr>
+ * <td>[]</td>
+ * <td>in normal rule</td>
+ * <td>Omit the optional text if the number is an even multiple of the rule's divisor</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in negative-number rule</td>
+ * <td>Not allowed.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in improper-fraction rule</td>
+ * <td>Omit the optional text if the number is between 0 and 1 (same as specifying both an
+ * x.x rule and a 0.x rule)</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in master rule</td>
+ * <td>Omit the optional text if the number is an integer (same as specifying both an x.x
+ * rule and an x.0 rule)</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in proper-fraction rule</td>
+ * <td>Not allowed.</td>
+ * </tr>
+ * <tr>
+ * <td></td>
+ * <td>in rule in fraction rule set</td>
+ * <td>Omit the optional text if multiplying the number by the rule's base value yields 1.</td>
+ * </tr>
+ * </table>
+ *
+ * <p>The substitution descriptor (i.e., the text between the token characters) may take one
+ * of three forms:</p>
+ *
+ * <table border="0" width="100%">
+ * <tr>
+ * <td>a rule set name</td>
+ * <td>Perform the mathematical operation on the number, and format the result using the
+ * named rule set.</td>
+ * </tr>
+ * <tr>
+ * <td>a DecimalFormat pattern</td>
+ * <td>Perform the mathematical operation on the number, and format the result using a
+ * DecimalFormat with the specified pattern.&nbsp; The pattern must begin with 0 or #.</td>
+ * </tr>
+ * <tr>
+ * <td>nothing</td>
+ * <td>Perform the mathematical operation on the number, and format the result using the rule
+ * set containing the current rule, except:
+ * <ul>
+ * <li>You can't have an empty substitution descriptor with a == substitution.</li>
+ * <li>If you omit the substitution descriptor in a &gt;&gt; substitution in a fraction rule,
+ * format the result one digit at a time using the rule set containing the current rule.</li>
+ * <li>If you omit the substitution descriptor in a &lt;&lt; substitution in a rule in a
+ * fraction rule set, format the result using the default rule set for this formatter.</li>
+ * </ul>
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * <p>Whitespace is ignored between a rule set name and a rule set body, between a rule
+ * descriptor and a rule body, or between rules. If a rule body begins with an apostrophe,
+ * the apostrophe is ignored, but all text after it becomes significant (this is how you can
+ * have a rule's rule text begin with whitespace). There is no escape function: the semicolon
+ * is not allowed in rule set names or in rule text, and the colon is not allowed in rule set
+ * names. The characters beginning a substitution token are always treated as the beginning
+ * of a substitution token.</p>
+ *
+ * <p>See the resource data and the demo program for annotated examples of real rule sets
+ * using these features.</p>
+ *
+ * <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.
+ *
+ * <p><b>Localizations</b></p>
+ * <p>Constructors are available that allow the specification of localizations for the
+ * public rule sets (and also allow more control over what public rule sets are available).
+ * Localization data is represented as a textual description. The description represents
+ * an array of arrays of string. The first element is an array of the public rule set names,
+ * each of these must be one of the public rule set names that appear in the rules. Only
+ * names in this array will be treated as public rule set names by the API. Each subsequent
+ * element is an array of localizations of these names. The first element of one of these
+ * subarrays is the locale name, and the remaining elements are localizations of the
+ * public rule set names, in the same order as they were listed in the first arrray.</p>
+ * <p>In the syntax, angle brackets '<', '>' are used to delimit the arrays, and comma ',' is used
+ * to separate elements of an array. Whitespace is ignored, unless quoted.</p>
+ * <p>For example:<pre>
+ * < < %foo, %bar, %baz >,
+ * < en, Foo, Bar, Baz >,
+ * < fr, 'le Foo', 'le Bar', 'le Baz' >
+ * < zh, \\u7532, \\u4e59, \\u4e19 > >
+ * </pre></p>
+ * @author Richard Gillam
+ * @see NumberFormat
+ * @see DecimalFormat
+ * @stable ICU 2.0
+ */
+class U_I18N_API RuleBasedNumberFormat : public NumberFormat {
+public:
+
+ //-----------------------------------------------------------------------
+ // constructors
+ //-----------------------------------------------------------------------
+
+ /**
+ * Creates a RuleBasedNumberFormat that behaves according to the description
+ * passed in. The formatter uses the default locale.
+ * @param rules A description of the formatter's desired behavior.
+ * See the class documentation for a complete explanation of the description
+ * syntax.
+ * @param perror The parse error if an error was encountered.
+ * @param status The status indicating whether the constructor succeeded.
+ * @stable ICU 3.2
+ */
+ RuleBasedNumberFormat(const UnicodeString& rules, UParseError& perror, UErrorCode& status);
+
+ /**
+ * Creates a RuleBasedNumberFormat that behaves according to the description
+ * passed in. The formatter uses the default locale.
+ * <p>
+ * The localizations data provides information about the public
+ * rule sets and their localized display names for different
+ * locales. The first element in the list is an array of the names
+ * of the public rule sets. The first element in this array is
+ * the initial default ruleset. The remaining elements in the
+ * list are arrays of localizations of the names of the public
+ * rule sets. Each of these is one longer than the initial array,
+ * with the first String being the ULocale ID, and the remaining
+ * Strings being the localizations of the rule set names, in the
+ * same order as the initial array. Arrays are NULL-terminated.
+ * @param rules A description of the formatter's desired behavior.
+ * See the class documentation for a complete explanation of the description
+ * syntax.
+ * @param localizations the localization information.
+ * names in the description. These will be copied by the constructor.
+ * @param perror The parse error if an error was encountered.
+ * @param status The status indicating whether the constructor succeeded.
+ * @stable ICU 3.2
+ */
+ RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
+ UParseError& perror, UErrorCode& status);
+
+ /**
+ * Creates a RuleBasedNumberFormat that behaves according to the rules
+ * passed in. The formatter uses the specified locale to determine the
+ * characters to use when formatting numerals, and to define equivalences
+ * for lenient parsing.
+ * @param rules The formatter rules.
+ * See the class documentation for a complete explanation of the rule
+ * syntax.
+ * @param locale A locale that governs which characters are used for
+ * formatting values in numerals and which characters are equivalent in
+ * lenient parsing.
+ * @param perror The parse error if an error was encountered.
+ * @param status The status indicating whether the constructor succeeded.
+ * @stable ICU 2.0
+ */
+ RuleBasedNumberFormat(const UnicodeString& rules, const Locale& locale,
+ UParseError& perror, UErrorCode& status);
+
+ /**
+ * Creates a RuleBasedNumberFormat that behaves according to the description
+ * passed in. The formatter uses the default locale.
+ * <p>
+ * The localizations data provides information about the public
+ * rule sets and their localized display names for different
+ * locales. The first element in the list is an array of the names
+ * of the public rule sets. The first element in this array is
+ * the initial default ruleset. The remaining elements in the
+ * list are arrays of localizations of the names of the public
+ * rule sets. Each of these is one longer than the initial array,
+ * with the first String being the ULocale ID, and the remaining
+ * Strings being the localizations of the rule set names, in the
+ * same order as the initial array. Arrays are NULL-terminated.
+ * @param rules A description of the formatter's desired behavior.
+ * See the class documentation for a complete explanation of the description
+ * syntax.
+ * @param localizations a list of localizations for the rule set
+ * names in the description. These will be copied by the constructor.
+ * @param locale A locale that governs which characters are used for
+ * formatting values in numerals and which characters are equivalent in
+ * lenient parsing.
+ * @param perror The parse error if an error was encountered.
+ * @param status The status indicating whether the constructor succeeded.
+ * @stable ICU 3.2
+ */
+ RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations,
+ const Locale& locale, UParseError& perror, UErrorCode& status);
+
+ /**
+ * Creates a RuleBasedNumberFormat from a predefined ruleset. The selector
+ * code choosed among three possible predefined formats: spellout, ordinal,
+ * and duration.
+ * @param tag A selector code specifying which kind of formatter to create for that
+ * locale. There are three legal values: URBNF_SPELLOUT, which creates a formatter that
+ * spells out a value in words in the desired language, URBNF_ORDINAL, which attaches
+ * an ordinal suffix from the desired language to the end of a number (e.g. "123rd"),
+ * and URBNF_DURATION, which formats a duration in seconds as hours, minutes, and seconds.
+ * @param locale The locale for the formatter.
+ * @param status The status indicating whether the constructor succeeded.
+ * @stable ICU 2.0
+ */
+ RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& locale, UErrorCode& status);
+
+ //-----------------------------------------------------------------------
+ // boilerplate
+ //-----------------------------------------------------------------------
+
+ /**
+ * Copy constructor
+ * @param rhs the object to be copied from.
+ * @stable ICU 2.6
+ */
+ RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs);
+
+ /**
+ * Assignment operator
+ * @param rhs the object to be copied from.
+ * @stable ICU 2.6
+ */
+ RuleBasedNumberFormat& operator=(const RuleBasedNumberFormat& rhs);
+
+ /**
+ * Release memory allocated for a RuleBasedNumberFormat when you are finished with it.
+ * @stable ICU 2.6
+ */
+ virtual ~RuleBasedNumberFormat();
+
+ /**
+ * Clone this object polymorphically. The caller is responsible
+ * for deleting the result when done.
+ * @return A copy of the object.
+ * @stable ICU 2.6
+ */
+ virtual Format* clone(void) const;
+
+ /**
+ * 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 true if the given Format objects are semantically equal.
+ * @stable ICU 2.6
+ */
+ virtual UBool operator==(const Format& other) const;
+
+//-----------------------------------------------------------------------
+// public API functions
+//-----------------------------------------------------------------------
+
+ /**
+ * return the rules that were provided to the RuleBasedNumberFormat.
+ * @return the result String that was passed in
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString getRules() const;
+
+ /**
+ * Return the number of public rule set names.
+ * @return the number of public rule set names.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getNumberOfRuleSetNames() const;
+
+ /**
+ * Return the name of the index'th public ruleSet. If index is not valid,
+ * the function returns null.
+ * @param index the index of the ruleset
+ * @return the name of the index'th public ruleSet.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString getRuleSetName(int32_t index) const;
+
+ /**
+ * Return the number of locales for which we have localized rule set display names.
+ * @return the number of locales for which we have localized rule set display names.
+ * @stable ICU 3.2
+ */
+ virtual int32_t getNumberOfRuleSetDisplayNameLocales(void) const;
+
+ /**
+ * Return the index'th display name locale.
+ * @param index the index of the locale
+ * @param status set to a failure code when this function fails
+ * @return the locale
+ * @see #getNumberOfRuleSetDisplayNameLocales
+ * @stable ICU 3.2
+ */
+ virtual Locale getRuleSetDisplayNameLocale(int32_t index, UErrorCode& status) const;
+
+ /**
+ * Return the rule set display names for the provided locale. These are in the same order
+ * as those returned by getRuleSetName. The locale is matched against the locales for
+ * which there is display name data, using normal fallback rules. If no locale matches,
+ * the default display names are returned. (These are the internal rule set names minus
+ * the leading '%'.)
+ * @param index the index of the rule set
+ * @param locale the locale (returned by getRuleSetDisplayNameLocales) for which the localized
+ * display name is desired
+ * @return the display name for the given index, which might be bogus if there is an error
+ * @see #getRuleSetName
+ * @stable ICU 3.2
+ */
+ virtual UnicodeString getRuleSetDisplayName(int32_t index,
+ const Locale& locale = Locale::getDefault());
+
+ /**
+ * Return the rule set display name for the provided rule set and locale.
+ * The locale is matched against the locales for which there is display name data, using
+ * normal fallback rules. If no locale matches, the default display name is returned.
+ * @return the display name for the rule set
+ * @stable ICU 3.2
+ * @see #getRuleSetDisplayName
+ */
+ virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
+ const Locale& locale = Locale::getDefault());
+
+ /**
+ * Formats the specified 32-bit number using the default ruleset.
+ * @param number The number to format.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @return A textual representation of the number.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(int32_t number,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Formats the specified 64-bit number using the default ruleset.
+ * @param number The number to format.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @return A textual representation of the number.
+ * @stable ICU 2.1
+ */
+ virtual UnicodeString& format(int64_t number,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos) const;
+ /**
+ * Formats the specified number using the default ruleset.
+ * @param number The number to format.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @return A textual representation of the number.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(double number,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Formats the specified number using the named ruleset.
+ * @param number The number to format.
+ * @param ruleSetName The name of the rule set to format the number with.
+ * This must be the name of a valid public rule set for this formatter.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @param status the status
+ * @return A textual representation of the number.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(int32_t number,
+ const UnicodeString& ruleSetName,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+ /**
+ * Formats the specified 64-bit number using the named ruleset.
+ * @param number The number to format.
+ * @param ruleSetName The name of the rule set to format the number with.
+ * This must be the name of a valid public rule set for this formatter.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @param status the status
+ * @return A textual representation of the number.
+ * @stable ICU 2.1
+ */
+ virtual UnicodeString& format(int64_t number,
+ const UnicodeString& ruleSetName,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+ /**
+ * Formats the specified number using the named ruleset.
+ * @param number The number to format.
+ * @param ruleSetName The name of the rule set to format the number with.
+ * This must be the name of a valid public rule set for this formatter.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @param status the status
+ * @return A textual representation of the number.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(double number,
+ const UnicodeString& ruleSetName,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+
+ /**
+ * Formats the specified number using the default ruleset.
+ * @param obj The number to format.
+ * @param toAppendTo the string that will hold the (appended) result
+ * @param pos the fieldposition
+ * @param status the status
+ * @return A textual representation of the number.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format(const Formattable& obj,
+ UnicodeString& toAppendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+ /**
+ * Redeclared Format method.
+ * @param obj the object to be formatted.
+ * @param result Output param which will receive the formatted string.
+ * @param status Output param set to success/failure code
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& result,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * @param number the double value to be formatted.
+ * @param output Output param which will receive the formatted string.
+ * @return A reference to 'output'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(double number,
+ UnicodeString& output) const;
+
+ /**
+ * Redeclared NumberFormat method.
+ * @param number the long value to be formatted.
+ * @param output Output param which will receive the formatted string.
+ * @return A reference to 'output'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(int32_t number,
+ UnicodeString& output) const;
+
+ /**
+ * Parses the specfied string, beginning at the specified position, according
+ * to this formatter's rules. This will match the string against all of the
+ * formatter's public rule sets and return the value corresponding to the longest
+ * parseable substring. This function's behavior is affected by the lenient
+ * parse mode.
+ * @param text The string to parse
+ * @param result the result of the parse, either a double or a long.
+ * @param parsePosition On entry, contains the position of the first character
+ * in "text" to examine. On exit, has been updated to contain the position
+ * of the first character in "text" that wasn't consumed by the parse.
+ * @see #setLenient
+ * @stable ICU 2.0
+ */
+ virtual void parse(const UnicodeString& text,
+ Formattable& result,
+ ParsePosition& parsePosition) const;
+
+
+ /**
+ * Redeclared Format method.
+ * @param text The string to parse
+ * @param result the result of the parse, either a double or a long.
+ * @param status Output param set to failure code when a problem occurs.
+ * @stable ICU 2.0
+ */
+ virtual inline void parse(const UnicodeString& text,
+ Formattable& result,
+ UErrorCode& status) const;
+
+#if !UCONFIG_NO_COLLATION
+
+ /**
+ * Turns lenient parse mode on and off.
+ *
+ * When in lenient parse mode, the formatter uses a Collator for parsing the text.
+ * Only primary differences are treated as significant. This means that case
+ * differences, accent differences, alternate spellings of the same letter
+ * (e.g., ae and a-umlaut in German), ignorable characters, etc. are ignored in
+ * matching the text. In many cases, numerals will be accepted in place of words
+ * or phrases as well.
+ *
+ * For example, all of the following will correctly parse as 255 in English in
+ * lenient-parse mode:
+ * <br>"two hundred fifty-five"
+ * <br>"two hundred fifty five"
+ * <br>"TWO HUNDRED FIFTY-FIVE"
+ * <br>"twohundredfiftyfive"
+ * <br>"2 hundred fifty-5"
+ *
+ * The Collator used is determined by the locale that was
+ * passed to this object on construction. The description passed to this object
+ * on construction may supply additional collation rules that are appended to the
+ * end of the default collator for the locale, enabling additional equivalences
+ * (such as adding more ignorable characters or permitting spelled-out version of
+ * symbols; see the demo program for examples).
+ *
+ * It's important to emphasize that even strict parsing is relatively lenient: it
+ * will accept some text that it won't produce as output. In English, for example,
+ * it will correctly parse "two hundred zero" and "fifteen hundred".
+ *
+ * @param enabled If true, turns lenient-parse mode on; if false, turns it off.
+ * @see RuleBasedCollator
+ * @stable ICU 2.0
+ */
+ virtual void setLenient(UBool enabled);
+
+ /**
+ * Returns true if lenient-parse mode is turned on. Lenient parsing is off
+ * by default.
+ * @return true if lenient-parse mode is turned on.
+ * @see #setLenient
+ * @stable ICU 2.0
+ */
+ virtual inline UBool isLenient(void) const;
+
+#endif
+
+ /**
+ * Override the default rule set to use. If ruleSetName is null, reset
+ * to the initial default rule set. If the rule set is not a public rule set name,
+ * U_ILLEGAL_ARGUMENT_ERROR is returned in status.
+ * @param ruleSetName the name of the rule set, or null to reset the initial default.
+ * @param status set to failure code when a problem occurs.
+ * @stable ICU 2.6
+ */
+ virtual void setDefaultRuleSet(const UnicodeString& ruleSetName, UErrorCode& status);
+
+ /**
+ * Return the name of the current default rule set. If the current rule set is
+ * not public, returns a bogus (and empty) UnicodeString.
+ * @return the name of the current default rule set
+ * @stable ICU 3.0
+ */
+ virtual UnicodeString getDefaultRuleSetName() const;
+
+public:
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ *
+ * @stable ICU 2.8
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ *
+ * @stable ICU 2.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+private:
+ RuleBasedNumberFormat(); // default constructor not implemented
+
+ // this will ref the localizations if they are not NULL
+ // caller must deref to get adoption
+ RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations,
+ const Locale& locale, UParseError& perror, UErrorCode& status);
+
+ void init(const UnicodeString& rules, LocalizationInfo* localizations, UParseError& perror, UErrorCode& status);
+ void dispose();
+ void stripWhitespace(UnicodeString& src);
+ void initDefaultRuleSet();
+ void format(double number, NFRuleSet& ruleSet);
+ NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const;
+
+ /* friend access */
+ friend class NFSubstitution;
+ friend class NFRule;
+ friend class FractionalPartSubstitution;
+
+ inline NFRuleSet * getDefaultRuleSet() const;
+ Collator * getCollator() const;
+ DecimalFormatSymbols * getDecimalFormatSymbols() const;
+
+private:
+ NFRuleSet **ruleSets;
+ NFRuleSet *defaultRuleSet;
+ Locale locale;
+ Collator* collator;
+ DecimalFormatSymbols* decimalFormatSymbols;
+ UBool lenient;
+ UnicodeString* lenientParseRules;
+ LocalizationInfo* localizations;
+};
+
+// ---------------
+
+inline UnicodeString&
+RuleBasedNumberFormat::format(const Formattable& obj,
+ UnicodeString& result,
+ UErrorCode& status) const
+{
+ // Don't use Format:: - use immediate base class only,
+ // in case immediate base modifies behavior later.
+ // dlf - the above comment is bogus, if there were a reason to modify
+ // it, it would be virtual, and there's no reason because it is
+ // a one-line macro in NumberFormat anyway, just like this one.
+ return NumberFormat::format(obj, result, status);
+}
+
+inline UnicodeString&
+RuleBasedNumberFormat::format(double number, UnicodeString& output) const {
+ FieldPosition pos(0);
+ return format(number, output, pos);
+}
+
+inline UnicodeString&
+RuleBasedNumberFormat::format(int32_t number, UnicodeString& output) const {
+ FieldPosition pos(0);
+ return format(number, output, pos);
+}
+
+inline void
+RuleBasedNumberFormat::parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const
+{
+ NumberFormat::parse(text, result, status);
+}
+
+#if !UCONFIG_NO_COLLATION
+
+inline UBool
+RuleBasedNumberFormat::isLenient(void) const {
+ return lenient;
+}
+
+#endif
+
+inline NFRuleSet*
+RuleBasedNumberFormat::getDefaultRuleSet() const {
+ return defaultRuleSet;
+}
+
+U_NAMESPACE_END
+
+/* U_HAVE_RBNF */
+#endif
+
+/* RBNF_H */
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/rbtz.h b/Build/source/libs/icu-xetex/i18n/unicode/rbtz.h
new file mode 100644
index 00000000000..d7f342d5f9e
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/rbtz.h
@@ -0,0 +1,355 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, International Business Machines Corporation and *
+* others. All Rights Reserved. *
+*******************************************************************************
+*/
+#ifndef RBTZ_H
+#define RBTZ_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Rule based customizable time zone
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/basictz.h"
+#include "unicode/unistr.h"
+
+U_NAMESPACE_BEGIN
+
+// forward declaration
+class UVector;
+struct Transition;
+
+class U_I18N_API RuleBasedTimeZone : public BasicTimeZone {
+public:
+ /**
+ * Constructs a <code>RuleBasedTimeZone</code> object with the ID and the
+ * <code>InitialTimeZoneRule</code>. The input <code>InitialTimeZoneRule</code>
+ * is adopted by this <code>RuleBasedTimeZone</code>, thus the caller must not
+ * delete it.
+ * @param id The time zone ID.
+ * @param initialRule The initial time zone rule.
+ * @draft ICU 3.8
+ */
+ RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule);
+
+ /**
+ * Copy constructor.
+ * @param source The RuleBasedTimeZone object to be copied.
+ * @draft ICU 3.8
+ */
+ RuleBasedTimeZone(const RuleBasedTimeZone& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~RuleBasedTimeZone();
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ RuleBasedTimeZone& operator=(const RuleBasedTimeZone& right);
+
+ /**
+ * Return true if the given <code>TimeZone</code> objects are
+ * semantically equal. Objects of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZone</code> objects are
+ *semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZone& that) const;
+
+ /**
+ * Return true if the given <code>TimeZone</code> objects are
+ * semantically unequal. Objects of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZone</code> objects are
+ * semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZone& that) const;
+
+ /**
+ * Adds the <code>TimeZoneRule</code> which represents time transitions.
+ * The <code>TimeZoneRule</code> must have start times, that is, the result
+ * of isTransitionRule() must be true. Otherwise, U_ILLEGAL_ARGUMENT_ERROR
+ * is set to the error code.
+ * The input <code>TimeZoneRule</code> is adopted by this
+ * <code>RuleBasedTimeZone</code> on successful completion of this method,
+ * thus, the caller must not delete it when no error is returned.
+ * After all rules are added, the caller must call complete() method to
+ * make this <code>RuleBasedTimeZone</code> ready to handle common time
+ * zone functions.
+ * @param rule The <code>TimeZoneRule</code>.
+ * @param status Output param to filled in with a success or an error.
+ * @draft ICU 3.8
+ */
+ void addTransitionRule(TimeZoneRule* rule, UErrorCode& status);
+
+ /**
+ * Makes the <code>TimeZoneRule</code> ready to handle actual timezone
+ * calcuation APIs. This method collects time zone rules specified
+ * by the caller via the constructor and addTransitionRule() and
+ * builds internal structure for making the object ready to support
+ * time zone APIs such as getOffset(), getNextTransition() and others.
+ * @param status Output param to filled in with a success or an error.
+ * @draft ICU 3.8
+ */
+ void complete(UErrorCode& status);
+
+ /**
+ * Clones TimeZone objects polymorphically. Clients are responsible for deleting
+ * the TimeZone object cloned.
+ *
+ * @return A new copy of this TimeZone object.
+ * @draft ICU 3.8
+ */
+ virtual TimeZone* clone(void) const;
+
+ /**
+ * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time in this time zone, taking daylight savings time into
+ * account) as of a particular reference date. The reference date is used to determine
+ * whether daylight savings time is in effect and needs to be figured into the offset
+ * that is returned (in other words, what is the adjusted GMT offset in this time zone
+ * at this particular date and time?). For the time zones produced by createTimeZone(),
+ * the reference data is specified according to the Gregorian calendar, and the date
+ * and time fields are local standard time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, local standard time
+ * @param status Output param to filled in with a success or an error.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
+
+ /**
+ * Gets the time zone offset, for current date, modified in case of
+ * daylight savings. This is the offset to add *to* UTC to get local time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, local standard time
+ * @param monthLength The length of the given month in days.
+ * @param status Output param to filled in with a success or an error.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis,
+ int32_t monthLength, UErrorCode& status) const;
+
+ /**
+ * Returns the time zone raw and GMT offset for the given moment
+ * in time. Upon return, local-millis = GMT-millis + rawOffset +
+ * dstOffset. All computations are performed in the proleptic
+ * Gregorian calendar. The default implementation in the TimeZone
+ * class delegates to the 8-argument getOffset().
+ *
+ * @param date moment in time for which to return offsets, in
+ * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
+ * time or local wall time, depending on `local'.
+ * @param local if true, `date' is local wall time; otherwise it
+ * is in GMT time.
+ * @param rawOffset output parameter to receive the raw offset, that
+ * is, the offset not including DST adjustments
+ * @param dstOffset output parameter to receive the DST offset,
+ * that is, the offset to be added to `rawOffset' to obtain the
+ * total offset between local and GMT time. If DST is not in
+ * effect, this value is zero; otherwise it is a positive value,
+ * typically one hour.
+ * @param ec input-output error code
+ * @draft ICU 3.8
+ */
+ virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
+ int32_t& dstOffset, UErrorCode& ec) const;
+
+ /**
+ * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @param offsetMillis The new raw GMT offset for this time zone.
+ * @draft ICU 3.8
+ */
+ virtual void setRawOffset(int32_t offsetMillis);
+
+ /**
+ * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @return The TimeZone's raw GMT offset.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getRawOffset(void) const;
+
+ /**
+ * Queries if this time zone uses daylight savings time.
+ * @return true if this time zone uses daylight savings time,
+ * false, otherwise.
+ * @draft ICU 3.8
+ */
+ virtual UBool useDaylightTime(void) const;
+
+ /**
+ * Queries if the given date is in daylight savings time in
+ * this time zone.
+ * This method is wasteful since it creates a new GregorianCalendar and
+ * deletes it each time it is called. This is a deprecated method
+ * and provided only for Java compatibility.
+ *
+ * @param date the given UDate.
+ * @param status Output param filled in with success/error code.
+ * @return true if the given date is in daylight savings time,
+ * false, otherwise.
+ * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
+ */
+ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
+
+ /**
+ * Returns true if this zone has the same rule and offset as another zone.
+ * That is, if this zone differs only in ID, if at all.
+ * @param other the <code>TimeZone</code> object to be compared with
+ * @return true if the given zone is the same as this one,
+ * with the possible exception of the ID
+ * @draft ICU 3.8
+ */
+ virtual UBool hasSameRules(const TimeZone& other) const;
+
+ /**
+ * Gets the first time zone transition after the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the first transition after the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Gets the most recent time zone transition before the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the most recent transition before the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
+ * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
+ * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
+ * @param status Receives error status code.
+ * @return The number of <code>TimeZoneRule</code>s representing time transitions.
+ * @draft ICU 3.8
+ */
+ virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
+
+ /**
+ * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
+ * which represent time transitions for this time zone. On successful return,
+ * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+ * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
+ * instances up to the size specified by trscount. The results are referencing the
+ * rule instance held by this time zone instance. Therefore, after this time zone
+ * is destructed, they are no longer available.
+ * @param initial Receives the initial timezone rule
+ * @param trsrules Receives the timezone transition rules
+ * @param trscount On input, specify the size of the array 'transitions' receiving
+ * the timezone transition rules. On output, actual number of
+ * rules filled in the array will be set.
+ * @param status Receives error status code.
+ * @draft ICU 3.8
+ */
+ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
+ const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
+
+ /**
+ * Get time zone offsets from local wall time.
+ * @internal
+ */
+ virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
+ int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/;
+
+private:
+ void deleteRules(void);
+ void deleteTransitions(void);
+ UVector* copyRules(UVector* source);
+ TimeZoneRule* findRuleInFinal(UDate date, UBool local,
+ int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
+ UBool findNext(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
+ UBool findPrev(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const;
+ int32_t getLocalDelta(int32_t rawBefore, int32_t dstBefore, int32_t rawAfter, int32_t dstAfter,
+ int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
+ UDate getTransitionTime(Transition* transition, UBool local,
+ int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const;
+ void getOffsetInternal(UDate date, UBool local, int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt,
+ int32_t& rawOffset, int32_t& dstOffset, UErrorCode& ec) const;
+
+ InitialTimeZoneRule *fInitialRule;
+ UVector *fHistoricRules;
+ UVector *fFinalRules;
+ UVector *fHistoricTransitions;
+ UBool fUpToDate;
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // RBTZ_H
+
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/regex.h b/Build/source/libs/icu-xetex/i18n/unicode/regex.h
new file mode 100644
index 00000000000..ce24ef5f89b
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/regex.h
@@ -0,0 +1,950 @@
+/*
+**********************************************************************
+* Copyright (C) 2002-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: regex.h
+* encoding: US-ASCII
+* indentation:4
+*
+* created on: 2002oct22
+* created by: Andy Heninger
+*
+* ICU Regular Expressions, API for C++
+*/
+
+#ifndef REGEX_H
+#define REGEX_H
+
+//#define REGEX_DEBUG
+
+/**
+ * \file
+ * \brief C++ API: Regular Expressions
+ *
+ * <h2>Regular Expression API</h2>
+ *
+ * <p>The ICU API for processing regular expressions consists of two classes,
+ * <code>RegexPattern</code> and <code>RegexMatcher</code>.
+ * <code>RegexPattern</code> objects represent a pre-processed, or compiled
+ * regular expression. They are created from a regular expression pattern string,
+ * and can be used to create <code>RegexMatcher</code> objects for the pattern.</p>
+ *
+ * <p>Class <code>RegexMatcher</code> bundles together a regular expression
+ * pattern and a target string to which the search pattern will be applied.
+ * <code>RegexMatcher</code> includes API for doing plain find or search
+ * operations, for search and replace operations, and for obtaining detailed
+ * information about bounds of a match. </p>
+ *
+ * <p>Note that by constructing <code>RegexMatcher</code> objects directly from regular
+ * expression pattern strings application code can be simplified and the explicit
+ * need for <code>RegexPattern</code> objects can usually be eliminated.
+ * </p>
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_REGULAR_EXPRESSIONS
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/parseerr.h"
+
+#include "unicode/uregex.h"
+
+U_NAMESPACE_BEGIN
+
+
+// Forward Declarations...
+
+class RegexMatcher;
+class RegexPattern;
+class UVector;
+class UVector32;
+class UnicodeSet;
+struct REStackFrame;
+struct Regex8BitSet;
+class RuleBasedBreakIterator;
+class RegexCImpl;
+
+
+
+
+/**
+ * RBBIPatternDump Debug function, displays the compiled form of a pattern.
+ * @internal
+ */
+#ifdef REGEX_DEBUG
+U_INTERNAL void U_EXPORT2
+ RegexPatternDump(const RegexPattern *pat);
+#else
+ #define RegexPatternDump(pat)
+#endif
+
+
+
+/**
+ * Class <code>RegexPattern</code> represents a compiled regular expression. It includes
+ * factory methods for creating a RegexPattern object from the source (string) form
+ * of a regular expression, methods for creating RegexMatchers that allow the pattern
+ * to be applied to input text, and a few convenience methods for simple common
+ * uses of regular expressions.
+ *
+ * <p>Class RegexPattern is not intended to be subclassed.</p>
+ *
+ * @stable ICU 2.4
+ */
+class U_I18N_API RegexPattern: public UObject {
+public:
+
+ /**
+ * default constructor. Create a RegexPattern object that refers to no actual
+ * pattern. Not normally needed; RegexPattern objects are usually
+ * created using the factory method <code>compile()</code>.
+ *
+ * @stable ICU 2.4
+ */
+ RegexPattern();
+
+ /**
+ * Copy Constructor. Create a new RegexPattern object that is equivalent
+ * to the source object.
+ * @param source the pattern object to be copied.
+ * @stable ICU 2.4
+ */
+ RegexPattern(const RegexPattern &source);
+
+ /**
+ * Destructor. Note that a RegexPattern object must persist so long as any
+ * RegexMatcher objects that were created from the RegexPattern are active.
+ * @stable ICU 2.4
+ */
+ virtual ~RegexPattern();
+
+ /**
+ * Comparison operator. Two RegexPattern objects are considered equal if they
+ * were constructed from identical source patterns using the same match flag
+ * settings.
+ * @param that a RegexPattern object to compare with "this".
+ * @return TRUE if the objects are equivalent.
+ * @stable ICU 2.4
+ */
+ UBool operator==(const RegexPattern& that) const;
+
+ /**
+ * Comparison operator. Two RegexPattern objects are considered equal if they
+ * were constructed from identical source patterns using the same match flag
+ * settings.
+ * @param that a RegexPattern object to compare with "this".
+ * @return TRUE if the objects are different.
+ * @stable ICU 2.4
+ */
+ inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);};
+
+ /**
+ * Assignment operator. After assignment, this RegexPattern will behave identically
+ * to the source object.
+ * @stable ICU 2.4
+ */
+ RegexPattern &operator =(const RegexPattern &source);
+
+ /**
+ * Create an exact copy of this RegexPattern object. Since RegexPattern is not
+ * intended to be subclasses, <code>clone()</code> and the copy construction are
+ * equivalent operations.
+ * @return the copy of this RegexPattern
+ * @stable ICU 2.4
+ */
+ virtual RegexPattern *clone() const;
+
+
+ /**
+ * Compiles the regular expression in string form into a RegexPattern
+ * object. These compile methods, rather than the constructors, are the usual
+ * way that RegexPattern objects are created.
+ *
+ * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * objects created from the pattern are active. RegexMatchers keep a pointer
+ * back to their pattern, so premature deletion of the pattern is a
+ * catastrophic error.</p>
+ *
+ * <p>All pattern match mode flags are set to their default values.</p>
+ *
+ * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * from a pattern string rather than separately compiling the pattern and
+ * then creating a RegexMatcher object from the pattern.</p>
+ *
+ * @param regex The regular expression to be compiled.
+ * @param pe Receives the position (line and column nubers) of any error
+ * within the regular expression.)
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return A regexPattern object for the compiled pattern.
+ *
+ * @stable ICU 2.4
+ */
+ static RegexPattern * U_EXPORT2 compile( const UnicodeString &regex,
+ UParseError &pe,
+ UErrorCode &status);
+
+ /**
+ * Compiles the regular expression in string form into a RegexPattern
+ * object using the specified match mode flags. These compile methods,
+ * rather than the constructors, are the usual way that RegexPattern objects
+ * are created.
+ *
+ * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * objects created from the pattern are active. RegexMatchers keep a pointer
+ * back to their pattern, so premature deletion of the pattern is a
+ * catastrophic error.</p>
+ *
+ * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * from a pattern string instead of than separately compiling the pattern and
+ * then creating a RegexMatcher object from the pattern.</p>
+ *
+ * @param regex The regular expression to be compiled.
+ * @param flags The match mode flags to be used.
+ * @param pe Receives the position (line and column nubers) of any error
+ * within the regular expression.)
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return A regexPattern object for the compiled pattern.
+ *
+ * @stable ICU 2.4
+ */
+ static RegexPattern * U_EXPORT2 compile( const UnicodeString &regex,
+ uint32_t flags,
+ UParseError &pe,
+ UErrorCode &status);
+
+
+ /**
+ * Compiles the regular expression in string form into a RegexPattern
+ * object using the specified match mode flags. These compile methods,
+ * rather than the constructors, are the usual way that RegexPattern objects
+ * are created.
+ *
+ * <p>Note that RegexPattern objects must not be deleted while RegexMatcher
+ * objects created from the pattern are active. RegexMatchers keep a pointer
+ * back to their pattern, so premature deletion of the pattern is a
+ * catastrophic error.</p>
+ *
+ * <p>Note that it is often more convenient to construct a RegexMatcher directly
+ * from a pattern string instead of than separately compiling the pattern and
+ * then creating a RegexMatcher object from the pattern.</p>
+ *
+ * @param regex The regular expression to be compiled.
+ * @param flags The match mode flags to be used.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return A regexPattern object for the compiled pattern.
+ *
+ * @stable ICU 2.6
+ */
+ static RegexPattern * U_EXPORT2 compile( const UnicodeString &regex,
+ uint32_t flags,
+ UErrorCode &status);
+
+
+ /**
+ * Get the match mode flags that were used when compiling this pattern.
+ * @return the match mode flags
+ * @stable ICU 2.4
+ */
+ virtual uint32_t flags() const;
+
+ /**
+ * Creates a RegexMatcher that will match the given input against this pattern. The
+ * RegexMatcher can then be used to perform match, find or replace operations
+ * on the input. Note that a RegexPattern object must not be deleted while
+ * RegexMatchers created from it still exist and might possibly be used again.
+ * <p>
+ * The matcher will retain a reference to the supplied input string, and all regexp
+ * pattern matching operations happen directly on this original string. It is
+ * critical that the string not be altered or deleted before use by the regular
+ * expression operations is complete.
+ *
+ * @param input The input string to which the regular expression will be applied.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return A RegexMatcher object for this pattern and input.
+ *
+ * @stable ICU 2.4
+ */
+ virtual RegexMatcher *matcher(const UnicodeString &input,
+ UErrorCode &status) const;
+
+private:
+ /**
+ * Cause a compilation error if an application accidently attempts to
+ * create a matcher with a (UChar *) string as input rather than
+ * a UnicodeString. Avoids a dangling reference to a temporary string.
+ * <p>
+ * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * using one of the aliasing constructors, such as
+ * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ *
+ * @internal
+ */
+ RegexMatcher *matcher(const UChar *input,
+ UErrorCode &status) const;
+public:
+
+
+ /**
+ * Creates a RegexMatcher that will match against this pattern. The
+ * RegexMatcher can be used to perform match, find or replace operations.
+ * Note that a RegexPattern object must not be deleted while
+ * RegexMatchers created from it still exist and might possibly be used again.
+ *
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return A RegexMatcher object for this pattern and input.
+ *
+ * @stable ICU 2.6
+ */
+ virtual RegexMatcher *matcher(UErrorCode &status) const;
+
+
+ /**
+ * Test whether a string matches a regular expression. This convenience function
+ * both compiles the reguluar expression and applies it in a single operation.
+ * Note that if the same pattern needs to be applied repeatedly, this method will be
+ * less efficient than creating and reusing a RegexMatcher object.
+ *
+ * @param regex The regular expression
+ * @param input The string data to be matched
+ * @param pe Receives the position of any syntax errors within the regular expression
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return True if the regular expression exactly matches the full input string.
+ *
+ * @stable ICU 2.4
+ */
+ static UBool U_EXPORT2 matches(const UnicodeString &regex,
+ const UnicodeString &input,
+ UParseError &pe,
+ UErrorCode &status);
+
+
+ /**
+ * Returns the regular expression from which this pattern was compiled.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString pattern() const;
+
+
+ /**
+ * Split a string into fields. Somewhat like split() from Perl.
+ * The pattern matches identify delimiters that separate the input
+ * into fields. The input data between the matches becomes the
+ * fields themselves.
+ * <p>
+ * For the best performance on split() operations,
+ * <code>RegexMatcher::split</code> is perferable to this function
+ *
+ * @param input The string to be split into fields. The field delimiters
+ * match the pattern (in the "this" object)
+ * @param dest An array of UnicodeStrings to receive the results of the split.
+ * This is an array of actual UnicodeString objects, not an
+ * array of pointers to strings. Local (stack based) arrays can
+ * work well here.
+ * @param destCapacity The number of elements in the destination array.
+ * If the number of fields found is less than destCapacity, the
+ * extra strings in the destination array are not altered.
+ * If the number of destination strings is less than the number
+ * of fields, the trailing part of the input string, including any
+ * field delimiters, is placed in the last destination string.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The number of fields into which the input string was split.
+ * @stable ICU 2.4
+ */
+ virtual int32_t split(const UnicodeString &input,
+ UnicodeString dest[],
+ int32_t destCapacity,
+ UErrorCode &status) const;
+
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ *
+ * @stable ICU 2.4
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ *
+ * @stable ICU 2.4
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+private:
+ //
+ // Implementation Data
+ //
+ UnicodeString fPattern; // The original pattern string.
+ uint32_t fFlags; // The flags used when compiling the pattern.
+ //
+ UVector32 *fCompiledPat; // The compiled pattern p-code.
+ UnicodeString fLiteralText; // Any literal string data from the pattern,
+ // after un-escaping, for use during the match.
+
+ UVector *fSets; // Any UnicodeSets referenced from the pattern.
+ Regex8BitSet *fSets8; // (and fast sets for latin-1 range.)
+
+
+ UErrorCode fDeferredStatus; // status if some prior error has left this
+ // RegexPattern in an unusable state.
+
+ int32_t fMinMatchLen; // Minimum Match Length. All matches will have length
+ // >= this value. For some patterns, this calculated
+ // value may be less than the true shortest
+ // possible match.
+
+ int32_t fFrameSize; // Size of a state stack frame in the
+ // execution engine.
+
+ int32_t fDataSize; // The size of the data needed by the pattern that
+ // does not go on the state stack, but has just
+ // a single copy per matcher.
+
+ UVector32 *fGroupMap; // Map from capture group number to position of
+ // the group's variables in the matcher stack frame.
+
+ int32_t fMaxCaptureDigits;
+
+ UnicodeSet **fStaticSets; // Ptr to static (shared) sets for predefined
+ // regex character classes, e.g. Word.
+
+ Regex8BitSet *fStaticSets8; // Ptr to the static (shared) latin-1 only
+ // sets for predefined regex classes.
+
+ int32_t fStartType; // Info on how a match must start.
+ int32_t fInitialStringIdx; //
+ int32_t fInitialStringLen;
+ UnicodeSet *fInitialChars;
+ UChar32 fInitialChar;
+ Regex8BitSet *fInitialChars8;
+
+ friend class RegexCompile;
+ friend class RegexMatcher;
+ friend class RegexCImpl;
+
+ //
+ // Implementation Methods
+ //
+ void init(); // Common initialization, for use by constructors.
+ void zap(); // Common cleanup
+#ifdef REGEX_DEBUG
+ void dumpOp(int32_t index) const;
+ friend void U_EXPORT2 RegexPatternDump(const RegexPattern *);
+#endif
+
+};
+
+
+
+/**
+ * class RegexMatcher bundles together a reular expression pattern and
+ * input text to which the expression can be applied. It includes methods
+ * for testing for matches, and for find and replace operations.
+ *
+ * <p>Class RegexMatcher is not intended to be subclassed.</p>
+ *
+ * @stable ICU 2.4
+ */
+class U_I18N_API RegexMatcher: public UObject {
+public:
+
+ /**
+ * Construct a RegexMatcher for a regular expression.
+ * This is a convenience method that avoids the need to explicitly create
+ * a RegexPattern object. Note that if several RegexMatchers need to be
+ * created for the same expression, it will be more efficient to
+ * separately create and cache a RegexPattern object, and use
+ * its matcher() method to create the RegexMatcher objects.
+ *
+ * @param regexp The Regular Expression to be compiled.
+ * @param flags Regular expression options, such as case insensitive matching.
+ * @see UREGEX_CASE_INSENSITIVE
+ * @param status Any errors are reported by setting this UErrorCode variable.
+ * @stable ICU 2.6
+ */
+ RegexMatcher(const UnicodeString &regexp, uint32_t flags, UErrorCode &status);
+
+ /**
+ * Construct a RegexMatcher for a regular expression.
+ * This is a convenience method that avoids the need to explicitly create
+ * a RegexPattern object. Note that if several RegexMatchers need to be
+ * created for the same expression, it will be more efficient to
+ * separately create and cache a RegexPattern object, and use
+ * its matcher() method to create the RegexMatcher objects.
+ * <p>
+ * The matcher will retain a reference to the supplied input string, and all regexp
+ * pattern matching operations happen directly on the original string. It is
+ * critical that the string not be altered or deleted before use by the regular
+ * expression operations is complete.
+ *
+ * @param regexp The Regular Expression to be compiled.
+ * @param input The string to match. The matcher retains a reference to the
+ * caller's string; mo copy is made.
+ * @param flags Regular expression options, such as case insensitive matching.
+ * @see UREGEX_CASE_INSENSITIVE
+ * @param status Any errors are reported by setting this UErrorCode variable.
+ * @stable ICU 2.6
+ */
+ RegexMatcher(const UnicodeString &regexp, const UnicodeString &input,
+ uint32_t flags, UErrorCode &status);
+
+private:
+ /**
+ * Cause a compilation error if an application accidently attempts to
+ * create a matcher with a (UChar *) string as input rather than
+ * a UnicodeString. Avoids a dangling reference to a temporary string.
+ * <p>
+ * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * using one of the aliasing constructors, such as
+ * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ *
+ * @internal
+ */
+ RegexMatcher(const UnicodeString &regexp, const UChar *input,
+ uint32_t flags, UErrorCode &status);
+public:
+
+
+ /**
+ * Destructor.
+ *
+ * @stable ICU 2.4
+ */
+ virtual ~RegexMatcher();
+
+
+ /**
+ * Attempts to match the entire input string against the pattern.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if there is a match
+ * @stable ICU 2.4
+ */
+ virtual UBool matches(UErrorCode &status);
+
+ /**
+ * Attempts to match the input string, beginning at startIndex, against the pattern.
+ * The match must extend to the end of the input string.
+ * @param startIndex The input string index at which to begin matching.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if there is a match
+ * @stable ICU 2.8
+ */
+ virtual UBool matches(int32_t startIndex, UErrorCode &status);
+
+
+
+
+ /**
+ * Attempts to match the input string, starting from the beginning, against the pattern.
+ * Like the matches() method, this function always starts at the beginning of the input string;
+ * unlike that function, it does not require that the entire input string be matched.
+ *
+ * <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
+ * <code>end()</code>, and <code>group()</code> functions.</p>
+ *
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if there is a match at the start of the input string.
+ * @stable ICU 2.4
+ */
+ virtual UBool lookingAt(UErrorCode &status);
+
+
+ /**
+ * Attempts to match the input string, starting from the specified index, against the pattern.
+ * The match may be of any length, and is not required to extend to the end
+ * of the input string. Contrast with match().
+ *
+ * <p>If the match succeeds then more information can be obtained via the <code>start()</code>,
+ * <code>end()</code>, and <code>group()</code> functions.</p>
+ *
+ * @param startIndex The input string index at which to begin matching.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if there is a match.
+ * @stable ICU 2.8
+ */
+ virtual UBool lookingAt(int32_t startIndex, UErrorCode &status);
+
+ /**
+ * Find the next pattern match in the input string.
+ * The find begins searching the input at the location following the end of
+ * the previous match, or at the start of the string if there is no previous match.
+ * If a match is found, <code>start(), end()</code> and <code>group()</code>
+ * will provide more information regarding the match.
+ * <p>Note that if the input string is changed by the application,
+ * use find(startPos, status) instead of find(), because the saved starting
+ * position may not be valid with the altered input string.</p>
+ * @return TRUE if a match is found.
+ * @stable ICU 2.4
+ */
+ virtual UBool find();
+
+
+ /**
+ * Resets this RegexMatcher and then attempts to find the next substring of the
+ * input string that matches the pattern, starting at the specified index.
+ *
+ * @param start the position in the input string to begin the search
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if a match is found.
+ * @stable ICU 2.4
+ */
+ virtual UBool find(int32_t start, UErrorCode &status);
+
+
+ /**
+ * Returns a string containing the text matched by the previous match.
+ * If the pattern can match an empty string, an empty string may be returned.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * Possible errors are U_REGEX_INVALID_STATE if no match
+ * has been attempted or the last match failed.
+ * @return a string containing the matched input text.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString group(UErrorCode &status) const;
+
+
+ /**
+ * Returns a string containing the text captured by the given group
+ * during the previous match operation. Group(0) is the entire match.
+ *
+ * @param groupNum the capture group number
+ * @param status A reference to a UErrorCode to receive any errors.
+ * Possible errors are U_REGEX_INVALID_STATE if no match
+ * has been attempted or the last match failed and
+ * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
+ * @return the captured text
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString group(int32_t groupNum, UErrorCode &status) const;
+
+
+ /**
+ * Returns the number of capturing groups in this matcher's pattern.
+ * @return the number of capture groups
+ * @stable ICU 2.4
+ */
+ virtual int32_t groupCount() const;
+
+
+ /**
+ * Returns the index in the input string of the start of the text matched
+ * during the previous match operation.
+ * @param status a reference to a UErrorCode to receive any errors.
+ * @return The position in the input string of the start of the last match.
+ * @stable ICU 2.4
+ */
+ virtual int32_t start(UErrorCode &status) const;
+
+
+ /**
+ * Returns the index in the input string of the start of the text matched by the
+ * specified capture group during the previous match operation. Return -1 if
+ * the capture group exists in the pattern, but was not part of the last match.
+ *
+ * @param group the capture group number
+ * @param status A reference to a UErrorCode to receive any errors. Possible
+ * errors are U_REGEX_INVALID_STATE if no match has been
+ * attempted or the last match failed, and
+ * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number
+ * @return the start position of substring matched by the specified group.
+ * @stable ICU 2.4
+ */
+ virtual int32_t start(int32_t group, UErrorCode &status) const;
+
+
+ /**
+ * Returns the index in the input string of the first character following the
+ * text matched during the previous match operation.
+ * @param status A reference to a UErrorCode to receive any errors. Possible
+ * errors are U_REGEX_INVALID_STATE if no match has been
+ * attempted or the last match failed.
+ * @return the index of the last character matched, plus one.
+ * @stable ICU 2.4
+ */
+ virtual int32_t end(UErrorCode &status) const;
+
+
+ /**
+ * Returns the index in the input string of the character following the
+ * text matched by the specified capture group during the previous match operation.
+ * @param group the capture group number
+ * @param status A reference to a UErrorCode to receive any errors. Possible
+ * errors are U_REGEX_INVALID_STATE if no match has been
+ * attempted or the last match failed and
+ * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number
+ * @return the index of the first character following the text
+ * captured by the specifed group during the previous match operation.
+ * Return -1 if the capture group exists in the pattern but was not part of the match.
+ * @stable ICU 2.4
+ */
+ virtual int32_t end(int32_t group, UErrorCode &status) const;
+
+
+ /**
+ * Resets this matcher. The effect is to remove any memory of previous matches,
+ * and to cause subsequent find() operations to begin at the beginning of
+ * the input string.
+ *
+ * @return this RegexMatcher.
+ * @stable ICU 2.4
+ */
+ virtual RegexMatcher &reset();
+
+
+ /**
+ * Resets this matcher, and set the current input position.
+ * The effect is to remove any memory of previous matches,
+ * and to cause subsequent find() operations to begin at
+ * the specified position in the input string.
+ *
+ * @return this RegexMatcher.
+ * @stable ICU 2.8
+ */
+ virtual RegexMatcher &reset(int32_t index, UErrorCode &status);
+
+
+ /**
+ * Resets this matcher with a new input string. This allows instances of RegexMatcher
+ * to be reused, which is more efficient than creating a new RegexMatcher for
+ * each input string to be processed.
+ * @param input The new string on which subsequent pattern matches will operate.
+ * The matcher retains a reference to the callers string, and operates
+ * directly on that. Ownership of the string remains with the caller.
+ * Because no copy of the string is made, it is essential that the
+ * caller not delete the string until after regexp operations on it
+ * are done.
+ * @return this RegexMatcher.
+ * @stable ICU 2.4
+ */
+ virtual RegexMatcher &reset(const UnicodeString &input);
+
+private:
+ /**
+ * Cause a compilation error if an application accidently attempts to
+ * reset a matcher with a (UChar *) string as input rather than
+ * a UnicodeString. Avoids a dangling reference to a temporary string.
+ * <p>
+ * To efficiently work with UChar *strings, wrap the data in a UnicodeString
+ * using one of the aliasing constructors, such as
+ * <code>UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength);</code>
+ *
+ * @internal
+ */
+ RegexMatcher &reset(const UChar *input);
+public:
+
+ /**
+ * Returns the input string being matched. The returned string is not a copy,
+ * but the live input string. It should not be altered or deleted.
+ * @return the input string
+ * @stable ICU 2.4
+ */
+ virtual const UnicodeString &input() const;
+
+
+ /**
+ * Returns the pattern that is interpreted by this matcher.
+ * @return the RegexPattern for this RegexMatcher
+ * @stable ICU 2.4
+ */
+ virtual const RegexPattern &pattern() const;
+
+
+ /**
+ * Replaces every substring of the input that matches the pattern
+ * with the given replacement string. This is a convenience function that
+ * provides a complete find-and-replace-all operation.
+ *
+ * This method first resets this matcher. It then scans the input string
+ * looking for matches of the pattern. Input that is not part of any
+ * match is left unchanged; each match is replaced in the result by the
+ * replacement string. The replacement string may contain references to
+ * capture groups.
+ *
+ * @param replacement a string containing the replacement text.
+ * @param status a reference to a UErrorCode to receive any errors.
+ * @return a string containing the results of the find and replace.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString replaceAll(const UnicodeString &replacement, UErrorCode &status);
+
+
+ /**
+ * Replaces the first substring of the input that matches
+ * the pattern with the replacement string. This is a convenience
+ * function that provides a complete find-and-replace operation.
+ *
+ * <p>This function first resets this RegexMatcher. It then scans the input string
+ * looking for a match of the pattern. Input that is not part
+ * of the match is appended directly to the result string; the match is replaced
+ * in the result by the replacement string. The replacement string may contain
+ * references to captured groups.</p>
+ *
+ * <p>The state of the matcher (the position at which a subsequent find()
+ * would begin) after completing a replaceFirst() is not specified. The
+ * RegexMatcher should be reset before doing additional find() operations.</p>
+ *
+ * @param replacement a string containing the replacement text.
+ * @param status a reference to a UErrorCode to receive any errors.
+ * @return a string containing the results of the find and replace.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString replaceFirst(const UnicodeString &replacement, UErrorCode &status);
+
+ /**
+ * Implements a replace operation intended to be used as part of an
+ * incremental find-and-replace.
+ *
+ * <p>The input string, starting from the end of the previous replacement and ending at
+ * the start of the current match, is appended to the destination string. Then the
+ * replacement string is appended to the output string,
+ * including handling any substitutions of captured text.</p>
+ *
+ * <p>For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().</p>
+ *
+ * @param dest A UnicodeString to which the results of the find-and-replace are appended.
+ * @param replacement A UnicodeString that provides the text to be substituted for
+ * the input text that matched the regexp pattern. The replacement
+ * text may contain references to captured text from the
+ * input.
+ * @param status A reference to a UErrorCode to receive any errors. Possible
+ * errors are U_REGEX_INVALID_STATE if no match has been
+ * attempted or the last match failed, and U_INDEX_OUTOFBOUNDS_ERROR
+ * if the replacement text specifies a capture group that
+ * does not exist in the pattern.
+ *
+ * @return this RegexMatcher
+ * @stable ICU 2.4
+ *
+ */
+ virtual RegexMatcher &appendReplacement(UnicodeString &dest,
+ const UnicodeString &replacement, UErrorCode &status);
+
+
+ /**
+ * As the final step in a find-and-replace operation, append the remainder
+ * of the input string, starting at the position following the last appendReplacement(),
+ * to the destination string. <code>appendTail()</code> is intended to be invoked after one
+ * or more invocations of the <code>RegexMatcher::appendReplacement()</code>.
+ *
+ * @param dest A UnicodeString to which the results of the find-and-replace are appended.
+ * @return the destination string.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString &appendTail(UnicodeString &dest);
+
+
+
+ /**
+ * Split a string into fields. Somewhat like split() from Perl.
+ * The pattern matches identify delimiters that separate the input
+ * into fields. The input data between the matches becomes the
+ * fields themselves.
+ * <p>
+ *
+ * @param input The string to be split into fields. The field delimiters
+ * match the pattern (in the "this" object). This matcher
+ * will be reset to this input string.
+ * @param dest An array of UnicodeStrings to receive the results of the split.
+ * This is an array of actual UnicodeString objects, not an
+ * array of pointers to strings. Local (stack based) arrays can
+ * work well here.
+ * @param destCapacity The number of elements in the destination array.
+ * If the number of fields found is less than destCapacity, the
+ * extra strings in the destination array are not altered.
+ * If the number of destination strings is less than the number
+ * of fields, the trailing part of the input string, including any
+ * field delimiters, is placed in the last destination string.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The number of fields into which the input string was split.
+ * @stable ICU 2.6
+ */
+ virtual int32_t split(const UnicodeString &input,
+ UnicodeString dest[],
+ int32_t destCapacity,
+ UErrorCode &status);
+
+
+
+ /**
+ * setTrace Debug function, enable/disable tracing of the matching engine.
+ * For internal ICU development use only. DO NO USE!!!!
+ * @internal
+ */
+ void setTrace(UBool state);
+
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ *
+ * @stable ICU 2.2
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ *
+ * @stable ICU 2.2
+ */
+ virtual UClassID getDynamicClassID() const;
+
+private:
+ // Constructors and other object boilerplate are private.
+ // Instances of RegexMatcher can not be assigned, copied, cloned, etc.
+ RegexMatcher(); // default constructor not implemented
+ RegexMatcher(const RegexPattern *pat);
+ RegexMatcher(const RegexMatcher &other);
+ RegexMatcher &operator =(const RegexMatcher &rhs);
+ friend class RegexPattern;
+ friend class RegexCImpl;
+
+ //
+ // MatchAt This is the internal interface to the match engine itself.
+ // Match status comes back in matcher member variables.
+ //
+ void MatchAt(int32_t startIdx, UErrorCode &status);
+ inline void backTrack(int32_t &inputIdx, int32_t &patIdx);
+ UBool isWordBoundary(int32_t pos); // perform Perl-like \b test
+ UBool isUWordBoundary(int32_t pos); // perform RBBI based \b test
+ REStackFrame *resetStack();
+ inline REStackFrame *StateSave(REStackFrame *fp, int32_t savePatIdx,
+ int32_t frameSize, UErrorCode &status);
+
+
+ const RegexPattern *fPattern;
+ RegexPattern *fPatternOwned; // Non-NULL if this matcher owns the pattern, and
+ // should delete it when through.
+ const UnicodeString *fInput;
+
+ UBool fMatch; // True if the last match was successful.
+ int32_t fMatchStart; // Position of the start of the most recent match
+ int32_t fMatchEnd; // First position after the end of the most recent match
+ int32_t fLastMatchEnd; // First position after the end of the previous match,
+ // or -1 if there was no previous match.
+ int32_t fLastReplaceEnd; // First position after the end of the previous appendReplacement();
+
+ UVector32 *fStack;
+ REStackFrame *fFrame; // After finding a match, the last active stack
+ // frame, which will contain the capture group results.
+ // NOT valid while match engine is running.
+
+ int32_t *fData; // Data area for use by the compiled pattern.
+ int32_t fSmallData[8]; // Use this for data if it's enough.
+
+ UBool fTraceDebug; // Set true for debug tracing of match engine.
+
+ UErrorCode fDeferredStatus; // Save error state if that cannot be immediately
+ // reported, or that permanently disables this matcher.
+
+ RuleBasedBreakIterator *fWordBreakItr;
+
+
+};
+
+U_NAMESPACE_END
+#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/search.h b/Build/source/libs/icu-xetex/i18n/unicode/search.h
new file mode 100644
index 00000000000..a2fb2a8c7a0
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/search.h
@@ -0,0 +1,569 @@
+/*
+**********************************************************************
+* Copyright (C) 2001-2005 IBM and others. All rights reserved.
+**********************************************************************
+* Date Name Description
+* 03/22/2000 helena Creation.
+**********************************************************************
+*/
+
+#ifndef SEARCH_H
+#define SEARCH_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: SearchIterator object.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/chariter.h"
+#include "unicode/brkiter.h"
+#include "unicode/usearch.h"
+
+/**
+* @stable ICU 2.0
+*/
+struct USearch;
+/**
+* @stable ICU 2.0
+*/
+typedef struct USearch USearch;
+
+U_NAMESPACE_BEGIN
+
+/**
+ *
+ * <tt>SearchIterator</tt> is an abstract base class that provides
+ * methods to search for a pattern within a text string. Instances of
+ * <tt>SearchIterator</tt> maintain a current position and scans over the
+ * target text, returning the indices the pattern is matched and the length
+ * of each match.
+ * <p>
+ * <tt>SearchIterator</tt> defines a protocol for text searching.
+ * Subclasses provide concrete implementations of various search algorithms.
+ * For example, <tt>StringSearch</tt> implements language-sensitive pattern
+ * matching based on the comparison rules defined in a
+ * <tt>RuleBasedCollator</tt> object.
+ * <p>
+ * Other options for searching includes using a BreakIterator to restrict
+ * the points at which matches are detected.
+ * <p>
+ * <tt>SearchIterator</tt> provides an API that is similar to that of
+ * other text iteration classes such as <tt>BreakIterator</tt>. Using
+ * this class, it is easy to scan through text looking for all occurances of
+ * a given pattern. The following example uses a <tt>StringSearch</tt>
+ * object to find all instances of "fox" in the target string. Any other
+ * subclass of <tt>SearchIterator</tt> can be used in an identical
+ * manner.
+ * <pre><code>
+ * UnicodeString target("The quick brown fox jumped over the lazy fox");
+ * UnicodeString pattern("fox");
+ *
+ * SearchIterator *iter = new StringSearch(pattern, target);
+ * UErrorCode error = U_ZERO_ERROR;
+ * for (int pos = iter->first(error); pos != USEARCH_DONE;
+ * pos = iter->next(error)) {
+ * printf("Found match at %d pos, length is %d\n", pos,
+ * iter.getMatchLength());
+ * }
+ * </code></pre>
+ *
+ * @see StringSearch
+ * @see RuleBasedCollator
+ */
+class U_I18N_API SearchIterator : public UObject {
+
+public:
+
+ // public constructors and destructors -------------------------------
+
+ /**
+ * Copy constructor that creates a SearchIterator instance with the same
+ * behavior, and iterating over the same text.
+ * @param other the SearchIterator instance to be copied.
+ * @stable ICU 2.0
+ */
+ SearchIterator(const SearchIterator &other);
+
+ /**
+ * Destructor. Cleans up the search iterator data struct.
+ * @stable ICU 2.0
+ */
+ virtual ~SearchIterator();
+
+ // public get and set methods ----------------------------------------
+
+ /**
+ * Sets the index to point to the given position, and clears any state
+ * that's affected.
+ * <p>
+ * This method takes the argument index and sets the position in the text
+ * string accordingly without checking if the index is pointing to a
+ * valid starting point to begin searching.
+ * @param position within the text to be set. If position is less
+ * than or greater than the text range for searching,
+ * an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+ * @param status for errors if it occurs
+ * @stable ICU 2.0
+ */
+ virtual void setOffset(int32_t position, UErrorCode &status) = 0;
+
+ /**
+ * Return the current index in the text being searched.
+ * If the iteration has gone past the end of the text
+ * (or past the beginning for a backwards search), USEARCH_DONE
+ * is returned.
+ * @return current index in the text being searched.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(void) const = 0;
+
+ /**
+ * Sets the text searching attributes located in the enum
+ * USearchAttribute with values from the enum USearchAttributeValue.
+ * USEARCH_DEFAULT can be used for all attributes for resetting.
+ * @param attribute text attribute (enum USearchAttribute) to be set
+ * @param value text attribute value
+ * @param status for errors if it occurs
+ * @stable ICU 2.0
+ */
+ void setAttribute(USearchAttribute attribute,
+ USearchAttributeValue value,
+ UErrorCode &status);
+
+ /**
+ * Gets the text searching attributes
+ * @param attribute text attribute (enum USearchAttribute) to be retrieve
+ * @return text attribute value
+ * @stable ICU 2.0
+ */
+ USearchAttributeValue getAttribute(USearchAttribute attribute) const;
+
+ /**
+ * Returns the index to the match in the text string that was searched.
+ * This call returns a valid result only after a successful call to
+ * <tt>first</tt>, <tt>next</tt>, <tt>previous</tt>, or <tt>last</tt>.
+ * Just after construction, or after a searching method returns
+ * <tt>USEARCH_DONE</tt>, this method will return <tt>USEARCH_DONE</tt>.
+ * <p>
+ * Use getMatchedLength to get the matched string length.
+ * @return index of a substring within the text string that is being
+ * searched.
+ * @see #first
+ * @see #next
+ * @see #previous
+ * @see #last
+ * @stable ICU 2.0
+ */
+ int32_t getMatchedStart(void) const;
+
+ /**
+ * Returns the length of text in the string which matches the search
+ * pattern. This call returns a valid result only after a successful call
+ * to <tt>first</tt>, <tt>next</tt>, <tt>previous</tt>, or <tt>last</tt>.
+ * Just after construction, or after a searching method returns
+ * <tt>USEARCH_DONE</tt>, this method will return 0.
+ * @return The length of the match in the target text, or 0 if there
+ * is no match currently.
+ * @see #first
+ * @see #next
+ * @see #previous
+ * @see #last
+ * @stable ICU 2.0
+ */
+ int32_t getMatchedLength(void) const;
+
+ /**
+ * Returns the text that was matched by the most recent call to
+ * <tt>first</tt>, <tt>next</tt>, <tt>previous</tt>, or <tt>last</tt>.
+ * If the iterator is not pointing at a valid match (e.g. just after
+ * construction or after <tt>USEARCH_DONE</tt> has been returned,
+ * returns an empty string.
+ * @param result stores the matched string or an empty string if a match
+ * is not found.
+ * @see #first
+ * @see #next
+ * @see #previous
+ * @see #last
+ * @stable ICU 2.0
+ */
+ void getMatchedText(UnicodeString &result) const;
+
+ /**
+ * Set the BreakIterator that will be used to restrict the points
+ * at which matches are detected. The user is responsible for deleting
+ * the breakiterator.
+ * @param breakiter A BreakIterator that will be used to restrict the
+ * points at which matches are detected. If a match is
+ * found, but the match's start or end index is not a
+ * boundary as determined by the <tt>BreakIterator</tt>,
+ * the match will be rejected and another will be searched
+ * for. If this parameter is <tt>NULL</tt>, no break
+ * detection is attempted.
+ * @param status for errors if it occurs
+ * @see BreakIterator
+ * @stable ICU 2.0
+ */
+ void setBreakIterator(BreakIterator *breakiter, UErrorCode &status);
+
+ /**
+ * Returns the BreakIterator that is used to restrict the points at
+ * which matches are detected. This will be the same object that was
+ * passed to the constructor or to <tt>setBreakIterator</tt>.
+ * Note that <tt>NULL</tt> is a legal value; it means that break
+ * detection should not be attempted.
+ * @return BreakIterator used to restrict matchings.
+ * @see #setBreakIterator
+ * @stable ICU 2.0
+ */
+ const BreakIterator * getBreakIterator(void) const;
+
+ /**
+ * Set the string text to be searched. Text iteration will hence begin at
+ * the start of the text string. This method is useful if you want to
+ * re-use an iterator to search for the same pattern within a different
+ * body of text. The user is responsible for deleting the text.
+ * @param text string to be searched.
+ * @param status for errors. If the text length is 0,
+ * an U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ virtual void setText(const UnicodeString &text, UErrorCode &status);
+
+ /**
+ * Set the string text to be searched. Text iteration will hence begin at
+ * the start of the text string. This method is useful if you want to
+ * re-use an iterator to search for the same pattern within a different
+ * body of text.
+ * <p>
+ * Note: No parsing of the text within the <tt>CharacterIterator</tt>
+ * will be done during searching for this version. The block of text
+ * in <tt>CharacterIterator</tt> will be used as it is.
+ * The user is responsible for deleting the text.
+ * @param text string iterator to be searched.
+ * @param status for errors if any. If the text length is 0 then an
+ * U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ virtual void setText(CharacterIterator &text, UErrorCode &status);
+
+ /**
+ * Return the string text to be searched.
+ * @return text string to be searched.
+ * @stable ICU 2.0
+ */
+ const UnicodeString & getText(void) const;
+
+ // operator overloading ----------------------------------------------
+
+ /**
+ * Equality operator.
+ * @param that SearchIterator instance to be compared.
+ * @return TRUE if both BreakIterators are of the same class, have the
+ * same behavior, terates over the same text and have the same
+ * attributes. FALSE otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const SearchIterator &that) const;
+
+ /**
+ * Not-equal operator.
+ * @param that SearchIterator instance to be compared.
+ * @return FALSE if operator== returns TRUE, and vice versa.
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const SearchIterator &that) const;
+
+ // public methods ----------------------------------------------------
+
+ /**
+ * Returns a copy of SearchIterator with the same behavior, and
+ * iterating over the same text, as this one. Note that all data will be
+ * replicated, except for the text string to be searched.
+ * @return cloned object
+ * @stable ICU 2.0
+ */
+ virtual SearchIterator* safeClone(void) const = 0;
+
+ /**
+ * Returns the first index at which the string text matches the search
+ * pattern. The iterator is adjusted so that its current index (as
+ * returned by <tt>getOffset</tt>) is the match position if one
+ * was found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the iterator will be adjusted to the index USEARCH_DONE
+ * @param status for errors if it occurs
+ * @return The character index of the first match, or
+ * <tt>USEARCH_DONE</tt> if there are no matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t first(UErrorCode &status);
+
+ /**
+ * Returns the first index greater than <tt>position</tt> at which the
+ * string text matches the search pattern. The iterator is adjusted so
+ * that its current index (as returned by <tt>getOffset</tt>) is the
+ * match position if one was found. If a match is not found,
+ * <tt>USEARCH_DONE</tt> will be returned and the iterator will be
+ * adjusted to the index USEARCH_DONE
+ * @param position where search if to start from. If position is less
+ * than or greater than the text range for searching,
+ * an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+ * @param status for errors if it occurs
+ * @return The character index of the first match following
+ * <tt>position</tt>, or <tt>USEARCH_DONE</tt> if there are no
+ * matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t following(int32_t position, UErrorCode &status);
+
+ /**
+ * Returns the last index in the target text at which it matches the
+ * search pattern. The iterator is adjusted so that its current index
+ * (as returned by <tt>getOffset</tt>) is the match position if one was
+ * found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the iterator will be adjusted to the index USEARCH_DONE.
+ * @param status for errors if it occurs
+ * @return The index of the first match, or <tt>USEARCH_DONE</tt> if
+ * there are no matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t last(UErrorCode &status);
+
+ /**
+ * Returns the first index less than <tt>position</tt> at which the string
+ * text matches the search pattern. The iterator is adjusted so that its
+ * current index (as returned by <tt>getOffset</tt>) is the match
+ * position if one was found. If a match is not found,
+ * <tt>USEARCH_DONE</tt> will be returned and the iterator will be
+ * adjusted to the index USEARCH_DONE
+ * @param position where search is to start from. If position is less
+ * than or greater than the text range for searching,
+ * an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+ * @param status for errors if it occurs
+ * @return The character index of the first match preceding
+ * <tt>position</tt>, or <tt>USEARCH_DONE</tt> if there are
+ * no matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t preceding(int32_t position, UErrorCode &status);
+
+ /**
+ * Returns the index of the next point at which the text matches the
+ * search pattern, starting from the current position
+ * The iterator is adjusted so that its current index (as returned by
+ * <tt>getOffset</tt>) is the match position if one was found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the iterator will be adjusted to a position after the end of the text
+ * string.
+ * @param status for errors if it occurs
+ * @return The index of the next match after the current position,
+ * or <tt>USEARCH_DONE</tt> if there are no more matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t next(UErrorCode &status);
+
+ /**
+ * Returns the index of the previous point at which the string text
+ * matches the search pattern, starting at the current position.
+ * The iterator is adjusted so that its current index (as returned by
+ * <tt>getOffset</tt>) is the match position if one was found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the iterator will be adjusted to the index USEARCH_DONE
+ * @param status for errors if it occurs
+ * @return The index of the previous match before the current position,
+ * or <tt>USEARCH_DONE</tt> if there are no more matches.
+ * @see #getOffset
+ * @stable ICU 2.0
+ */
+ int32_t previous(UErrorCode &status);
+
+ /**
+ * Resets the iteration.
+ * Search will begin at the start of the text string if a forward
+ * iteration is initiated before a backwards iteration. Otherwise if a
+ * backwards iteration is initiated before a forwards iteration, the
+ * search will begin at the end of the text string.
+ * @stable ICU 2.0
+ */
+ virtual void reset();
+
+protected:
+ // protected data members ---------------------------------------------
+
+ /**
+ * C search data struct
+ * @stable ICU 2.0
+ */
+ USearch *m_search_;
+
+ /**
+ * Break iterator.
+ * Currently the C++ breakiterator does not have getRules etc to reproduce
+ * another in C. Hence we keep the original around and do the verification
+ * at the end of the match. The user is responsible for deleting this
+ * break iterator.
+ * @stable ICU 2.0
+ */
+ BreakIterator *m_breakiterator_;
+
+ /**
+ * Unicode string version of the search text
+ * @stable ICU 2.0
+ */
+ UnicodeString m_text_;
+
+ // protected constructors and destructors -----------------------------
+
+ /**
+ * Default constructor.
+ * Initializes data to the default values.
+ * @stable ICU 2.0
+ */
+ SearchIterator();
+
+ /**
+ * Constructor for use by subclasses.
+ * @param text The target text to be searched.
+ * @param breakiter A {@link BreakIterator} that is used to restrict the
+ * points at which matches are detected. If
+ * <tt>handleNext</tt> or <tt>handlePrev</tt> finds a
+ * match, but the match's start or end index is not a
+ * boundary as determined by the <tt>BreakIterator</tt>,
+ * the match is rejected and <tt>handleNext</tt> or
+ * <tt>handlePrev</tt> is called again. If this parameter
+ * is <tt>NULL</tt>, no break detection is attempted.
+ * @see #handleNext
+ * @see #handlePrev
+ * @stable ICU 2.0
+ */
+ SearchIterator(const UnicodeString &text,
+ BreakIterator *breakiter = NULL);
+
+ /**
+ * Constructor for use by subclasses.
+ * <p>
+ * Note: No parsing of the text within the <tt>CharacterIterator</tt>
+ * will be done during searching for this version. The block of text
+ * in <tt>CharacterIterator</tt> will be used as it is.
+ * @param text The target text to be searched.
+ * @param breakiter A {@link BreakIterator} that is used to restrict the
+ * points at which matches are detected. If
+ * <tt>handleNext</tt> or <tt>handlePrev</tt> finds a
+ * match, but the match's start or end index is not a
+ * boundary as determined by the <tt>BreakIterator</tt>,
+ * the match is rejected and <tt>handleNext</tt> or
+ * <tt>handlePrev</tt> is called again. If this parameter
+ * is <tt>NULL</tt>, no break detection is attempted.
+ * @see #handleNext
+ * @see #handlePrev
+ * @stable ICU 2.0
+ */
+ SearchIterator(CharacterIterator &text, BreakIterator *breakiter = NULL);
+
+ // protected methods --------------------------------------------------
+
+ /**
+ * Assignment operator. Sets this iterator to have the same behavior,
+ * and iterate over the same text, as the one passed in.
+ * @param that instance to be copied.
+ * @stable ICU 2.0
+ */
+ SearchIterator & operator=(const SearchIterator &that);
+
+ /**
+ * Abstract method which subclasses override to provide the mechanism
+ * for finding the next match in the target text. This allows different
+ * subclasses to provide different search algorithms.
+ * <p>
+ * If a match is found, the implementation should return the index at
+ * which the match starts and should call
+ * <tt>setMatchLength</tt> with the number of characters
+ * in the target text that make up the match. If no match is found, the
+ * method should return USEARCH_DONE.
+ * <p>
+ * @param position The index in the target text at which the search
+ * should start.
+ * @param status for error codes if it occurs.
+ * @return index at which the match starts, else if match is not found
+ * USEARCH_DONE is returned
+ * @see #setMatchLength
+ * @stable ICU 2.0
+ */
+ virtual int32_t handleNext(int32_t position, UErrorCode &status)
+ = 0;
+
+ /**
+ * Abstract method which subclasses override to provide the mechanism for
+ * finding the previous match in the target text. This allows different
+ * subclasses to provide different search algorithms.
+ * <p>
+ * If a match is found, the implementation should return the index at
+ * which the match starts and should call
+ * <tt>setMatchLength</tt> with the number of characters
+ * in the target text that make up the match. If no match is found, the
+ * method should return USEARCH_DONE.
+ * <p>
+ * @param position The index in the target text at which the search
+ * should start.
+ * @param status for error codes if it occurs.
+ * @return index at which the match starts, else if match is not found
+ * USEARCH_DONE is returned
+ * @see #setMatchLength
+ * @stable ICU 2.0
+ */
+ virtual int32_t handlePrev(int32_t position, UErrorCode &status)
+ = 0;
+
+ /**
+ * Sets the length of the currently matched string in the text string to
+ * be searched.
+ * Subclasses' <tt>handleNext</tt> and <tt>handlePrev</tt>
+ * methods should call this when they find a match in the target text.
+ * @param length length of the matched text.
+ * @see #handleNext
+ * @see #handlePrev
+ * @stable ICU 2.0
+ */
+ virtual void setMatchLength(int32_t length);
+
+ /**
+ * Sets the offset of the currently matched string in the text string to
+ * be searched.
+ * Subclasses' <tt>handleNext</tt> and <tt>handlePrev</tt>
+ * methods should call this when they find a match in the target text.
+ * @param position start offset of the matched text.
+ * @see #handleNext
+ * @see #handlePrev
+ * @stable ICU 2.0
+ */
+ virtual void setMatchStart(int32_t position);
+
+ /**
+ * sets match not found
+ * @stable ICU 2.0
+ */
+ void setMatchNotFound();
+};
+
+inline UBool SearchIterator::operator!=(const SearchIterator &that) const
+{
+ return !operator==(that);
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h b/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h
new file mode 100644
index 00000000000..08fdd208761
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/simpletz.h
@@ -0,0 +1,927 @@
+/*
+ ********************************************************************************
+ * Copyright (C) 1997-2007, International Business Machines *
+ * Corporation and others. All Rights Reserved. *
+ ********************************************************************************
+ *
+ * File SIMPLETZ.H
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ * 04/21/97 aliu Overhauled header.
+ * 08/10/98 stephen JDK 1.2 sync
+ * Added setStartRule() / setEndRule() overloads
+ * Added hasSameRules()
+ * 09/02/98 stephen Added getOffset(monthLen)
+ * Changed getOffset() to take UErrorCode
+ * 07/09/99 stephen Removed millisPerHour (unused, for HP compiler)
+ * 12/02/99 aliu Added TimeMode and constructor and setStart/EndRule
+ * methods that take TimeMode. Added to docs.
+ ********************************************************************************
+ */
+
+#ifndef SIMPLETZ_H
+#define SIMPLETZ_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/basictz.h"
+
+U_NAMESPACE_BEGIN
+
+// forward declaration
+class InitialTimeZoneRule;
+class TimeZoneTransition;
+class AnnualTimeZoneRule;
+
+/**
+ * <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code>
+ * that represents a time zone for use with a Gregorian calendar. This
+ * class does not handle historical changes.
+ * <P>
+ * When specifying daylight-savings-time begin and end dates, use a negative value for
+ * <code>dayOfWeekInMonth</code> to indicate that <code>SimpleTimeZone</code> should
+ * count from the end of the month backwards. For example, in the U.S., Daylight Savings
+ * Time ends at the last (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard
+ * time.
+ *
+ * @see Calendar
+ * @see GregorianCalendar
+ * @see TimeZone
+ * @author D. Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu
+ */
+class U_I18N_API SimpleTimeZone: public BasicTimeZone {
+public:
+
+ /**
+ * TimeMode is used, together with a millisecond offset after
+ * midnight, to specify a rule transition time. Most rules
+ * transition at a local wall time, that is, according to the
+ * current time in effect, either standard, or DST. However, some
+ * rules transition at local standard time, and some at a specific
+ * UTC time. Although it might seem that all times could be
+ * converted to wall time, thus eliminating the need for this
+ * parameter, this is not the case.
+ * @stable ICU 2.0
+ */
+ enum TimeMode {
+ WALL_TIME = 0,
+ STANDARD_TIME,
+ UTC_TIME
+ };
+
+ /**
+ * Copy constructor
+ * @param source the object to be copied.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone(const SimpleTimeZone& source);
+
+ /**
+ * Default assignment operator
+ * @param right the object to be copied.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone& operator=(const SimpleTimeZone& right);
+
+ /**
+ * Destructor
+ * @stable ICU 2.0
+ */
+ virtual ~SimpleTimeZone();
+
+ /**
+ * Returns true if the two TimeZone objects are equal; that is, they have
+ * the same ID, raw GMT offset, and DST rules.
+ *
+ * @param that The SimpleTimeZone object to be compared with.
+ * @return True if the given time zone is equal to this time zone; false
+ * otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const TimeZone& that) const;
+
+ /**
+ * Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID,
+ * and which doesn't observe daylight savings time. Normally you should use
+ * TimeZone::createInstance() to create a TimeZone instead of creating a
+ * SimpleTimeZone directly with this constructor.
+ *
+ * @param rawOffsetGMT The given base time zone offset to GMT.
+ * @param ID The timezone ID which is obtained from
+ * TimeZone.getAvailableIDs.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID);
+
+ /**
+ * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
+ * and times to start and end daylight savings time. To create a TimeZone that
+ * doesn't observe daylight savings time, don't use this constructor; use
+ * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
+ * TimeZone.createInstance() to create a TimeZone instead of creating a
+ * SimpleTimeZone directly with this constructor.
+ * <P>
+ * Various types of daylight-savings time rules can be specfied by using different
+ * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a
+ * complete explanation of how these parameters work, see the documentation for
+ * setStartRule().
+ *
+ * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset
+ * @param ID The new SimpleTimeZone's time zone ID.
+ * @param savingsStartMonth The daylight savings starting month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsStartDayOfWeekInMonth The daylight savings starting
+ * day-of-week-in-month. See setStartRule() for a
+ * complete explanation.
+ * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsStartTime The daylight savings starting time, expressed as the
+ * number of milliseconds after midnight.
+ * @param savingsEndMonth The daylight savings ending month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndTime The daylight savings ending time, expressed as the
+ * number of milliseconds after midnight.
+ * @param status An UErrorCode to receive the status.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
+ int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
+ int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
+ int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
+ int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
+ UErrorCode& status);
+ /**
+ * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
+ * and times to start and end daylight savings time. To create a TimeZone that
+ * doesn't observe daylight savings time, don't use this constructor; use
+ * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
+ * TimeZone.createInstance() to create a TimeZone instead of creating a
+ * SimpleTimeZone directly with this constructor.
+ * <P>
+ * Various types of daylight-savings time rules can be specfied by using different
+ * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a
+ * complete explanation of how these parameters work, see the documentation for
+ * setStartRule().
+ *
+ * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset
+ * @param ID The new SimpleTimeZone's time zone ID.
+ * @param savingsStartMonth The daylight savings starting month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsStartDayOfWeekInMonth The daylight savings starting
+ * day-of-week-in-month. See setStartRule() for a
+ * complete explanation.
+ * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsStartTime The daylight savings starting time, expressed as the
+ * number of milliseconds after midnight.
+ * @param savingsEndMonth The daylight savings ending month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndTime The daylight savings ending time, expressed as the
+ * number of milliseconds after midnight.
+ * @param savingsDST The number of milliseconds added to standard time
+ * to get DST time. Default is one hour.
+ * @param status An UErrorCode to receive the status.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
+ int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
+ int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
+ int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
+ int8_t savingsEndDayOfWeek, int32_t savingsEndTime,
+ int32_t savingsDST, UErrorCode& status);
+
+ /**
+ * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID,
+ * and times to start and end daylight savings time. To create a TimeZone that
+ * doesn't observe daylight savings time, don't use this constructor; use
+ * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use
+ * TimeZone.createInstance() to create a TimeZone instead of creating a
+ * SimpleTimeZone directly with this constructor.
+ * <P>
+ * Various types of daylight-savings time rules can be specfied by using different
+ * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a
+ * complete explanation of how these parameters work, see the documentation for
+ * setStartRule().
+ *
+ * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset
+ * @param ID The new SimpleTimeZone's time zone ID.
+ * @param savingsStartMonth The daylight savings starting month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsStartDayOfWeekInMonth The daylight savings starting
+ * day-of-week-in-month. See setStartRule() for a
+ * complete explanation.
+ * @param savingsStartDayOfWeek The daylight savings starting day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsStartTime The daylight savings starting time, expressed as the
+ * number of milliseconds after midnight.
+ * @param savingsStartTimeMode Whether the start time is local wall time, local
+ * standard time, or UTC time. Default is local wall time.
+ * @param savingsEndMonth The daylight savings ending month. Month is
+ * 0-based. eg, 0 for January.
+ * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndDayOfWeek The daylight savings ending day-of-week.
+ * See setStartRule() for a complete explanation.
+ * @param savingsEndTime The daylight savings ending time, expressed as the
+ * number of milliseconds after midnight.
+ * @param savingsEndTimeMode Whether the end time is local wall time, local
+ * standard time, or UTC time. Default is local wall time.
+ * @param savingsDST The number of milliseconds added to standard time
+ * to get DST time. Default is one hour.
+ * @param status An UErrorCode to receive the status.
+ * @stable ICU 2.0
+ */
+ SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID,
+ int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth,
+ int8_t savingsStartDayOfWeek, int32_t savingsStartTime,
+ TimeMode savingsStartTimeMode,
+ int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth,
+ int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode,
+ int32_t savingsDST, UErrorCode& status);
+
+ /**
+ * Sets the daylight savings starting year, that is, the year this time zone began
+ * observing its specified daylight savings time rules. The time zone is considered
+ * not to observe daylight savings time prior to that year; SimpleTimeZone doesn't
+ * support historical daylight-savings-time rules.
+ * @param year the daylight savings starting year.
+ * @stable ICU 2.0
+ */
+ void setStartYear(int32_t year);
+
+ /**
+ * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
+ * Time starts at the first Sunday in April, at 2 AM in standard time.
+ * Therefore, you can set the start rule by calling:
+ * setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000);
+ * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
+ * the exact starting date. Their exact meaning depend on their respective signs,
+ * allowing various types of rules to be constructed, as follows:
+ * <ul>
+ * <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
+ * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
+ * of the month).</li>
+ * <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
+ * the day of week in the month counting backward from the end of the month.
+ * (e.g., (-1, MONDAY) is the last Monday in the month)</li>
+ * <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
+ * specifies the day of the month, regardless of what day of the week it is.
+ * (e.g., (10, 0) is the tenth day of the month)</li>
+ * <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
+ * specifies the day of the month counting backward from the end of the
+ * month, regardless of what day of the week it is (e.g., (-2, 0) is the
+ * next-to-last day of the month).</li>
+ * <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
+ * first specified day of the week on or after the specfied day of the month.
+ * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
+ * [or the 15th itself if the 15th is a Sunday].)</li>
+ * <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
+ * last specified day of the week on or before the specified day of the month.
+ * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
+ * [or the 20th itself if the 20th is a Tuesday].)</li>
+ * </ul>
+ * @param month the daylight savings starting month. Month is 0-based.
+ * eg, 0 for January.
+ * @param dayOfWeekInMonth the daylight savings starting
+ * day-of-week-in-month. Please see the member description for an example.
+ * @param dayOfWeek the daylight savings starting day-of-week. Please see
+ * the member description for an example.
+ * @param time the daylight savings starting time. Please see the member
+ * description for an example.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
+ int32_t time, UErrorCode& status);
+ /**
+ * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings
+ * Time starts at the first Sunday in April, at 2 AM in standard time.
+ * Therefore, you can set the start rule by calling:
+ * setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000);
+ * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate
+ * the exact starting date. Their exact meaning depend on their respective signs,
+ * allowing various types of rules to be constructed, as follows:
+ * <ul>
+ * <li>If both dayOfWeekInMonth and dayOfWeek are positive, they specify the
+ * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday
+ * of the month).</li>
+ * <li>If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify
+ * the day of week in the month counting backward from the end of the month.
+ * (e.g., (-1, MONDAY) is the last Monday in the month)</li>
+ * <li>If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth
+ * specifies the day of the month, regardless of what day of the week it is.
+ * (e.g., (10, 0) is the tenth day of the month)</li>
+ * <li>If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth
+ * specifies the day of the month counting backward from the end of the
+ * month, regardless of what day of the week it is (e.g., (-2, 0) is the
+ * next-to-last day of the month).</li>
+ * <li>If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the
+ * first specified day of the week on or after the specfied day of the month.
+ * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month
+ * [or the 15th itself if the 15th is a Sunday].)</li>
+ * <li>If dayOfWeek and DayOfWeekInMonth are both negative, they specify the
+ * last specified day of the week on or before the specified day of the month.
+ * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month
+ * [or the 20th itself if the 20th is a Tuesday].)</li>
+ * </ul>
+ * @param month the daylight savings starting month. Month is 0-based.
+ * eg, 0 for January.
+ * @param dayOfWeekInMonth the daylight savings starting
+ * day-of-week-in-month. Please see the member description for an example.
+ * @param dayOfWeek the daylight savings starting day-of-week. Please see
+ * the member description for an example.
+ * @param time the daylight savings starting time. Please see the member
+ * description for an example.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
+ int32_t time, TimeMode mode, UErrorCode& status);
+
+ /**
+ * Sets the DST start rule to a fixed date within a month.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth The date in that month (1-based).
+ * @param time The time of that day (number of millis after midnight)
+ * when DST takes effect in local wall time, which is
+ * standard time in this case.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
+ UErrorCode& status);
+ /**
+ * Sets the DST start rule to a fixed date within a month.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth The date in that month (1-based).
+ * @param time The time of that day (number of millis after midnight)
+ * when DST takes effect in local wall time, which is
+ * standard time in this case.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time,
+ TimeMode mode, UErrorCode& status);
+
+ /**
+ * Sets the DST start rule to a weekday before or after a give date within
+ * a month, e.g., the first Monday on or after the 8th.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth A date within that month (1-based).
+ * @param dayOfWeek The day of the week on which this rule occurs.
+ * @param time The time of that day (number of millis after midnight)
+ * when DST takes effect in local wall time, which is
+ * standard time in this case.
+ * @param after If true, this rule selects the first dayOfWeek on
+ * or after dayOfMonth. If false, this rule selects
+ * the last dayOfWeek on or before dayOfMonth.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ int32_t time, UBool after, UErrorCode& status);
+ /**
+ * Sets the DST start rule to a weekday before or after a give date within
+ * a month, e.g., the first Monday on or after the 8th.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth A date within that month (1-based).
+ * @param dayOfWeek The day of the week on which this rule occurs.
+ * @param time The time of that day (number of millis after midnight)
+ * when DST takes effect in local wall time, which is
+ * standard time in this case.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param after If true, this rule selects the first dayOfWeek on
+ * or after dayOfMonth. If false, this rule selects
+ * the last dayOfWeek on or before dayOfMonth.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ int32_t time, TimeMode mode, UBool after, UErrorCode& status);
+
+ /**
+ * Sets the daylight savings ending rule. For example, in the U.S., Daylight
+ * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
+ * Therefore, you can set the end rule by calling:
+ * <pre>
+ * . setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);
+ * </pre>
+ * Various other types of rules can be specified by manipulating the dayOfWeek
+ * and dayOfWeekInMonth parameters. For complete details, see the documentation
+ * for setStartRule().
+ *
+ * @param month the daylight savings ending month. Month is 0-based.
+ * eg, 0 for January.
+ * @param dayOfWeekInMonth the daylight savings ending
+ * day-of-week-in-month. See setStartRule() for a complete explanation.
+ * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
+ * for a complete explanation.
+ * @param time the daylight savings ending time. Please see the member
+ * description for an example.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
+ int32_t time, UErrorCode& status);
+
+ /**
+ * Sets the daylight savings ending rule. For example, in the U.S., Daylight
+ * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time.
+ * Therefore, you can set the end rule by calling:
+ * <pre>
+ * . setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);
+ * </pre>
+ * Various other types of rules can be specified by manipulating the dayOfWeek
+ * and dayOfWeekInMonth parameters. For complete details, see the documentation
+ * for setStartRule().
+ *
+ * @param month the daylight savings ending month. Month is 0-based.
+ * eg, 0 for January.
+ * @param dayOfWeekInMonth the daylight savings ending
+ * day-of-week-in-month. See setStartRule() for a complete explanation.
+ * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule()
+ * for a complete explanation.
+ * @param time the daylight savings ending time. Please see the member
+ * description for an example.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek,
+ int32_t time, TimeMode mode, UErrorCode& status);
+
+ /**
+ * Sets the DST end rule to a fixed date within a month.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth The date in that month (1-based).
+ * @param time The time of that day (number of millis after midnight)
+ * when DST ends in local wall time, which is daylight
+ * time in this case.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status);
+
+ /**
+ * Sets the DST end rule to a fixed date within a month.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth The date in that month (1-based).
+ * @param time The time of that day (number of millis after midnight)
+ * when DST ends in local wall time, which is daylight
+ * time in this case.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time,
+ TimeMode mode, UErrorCode& status);
+
+ /**
+ * Sets the DST end rule to a weekday before or after a give date within
+ * a month, e.g., the first Monday on or after the 8th.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth A date within that month (1-based).
+ * @param dayOfWeek The day of the week on which this rule occurs.
+ * @param time The time of that day (number of millis after midnight)
+ * when DST ends in local wall time, which is daylight
+ * time in this case.
+ * @param after If true, this rule selects the first dayOfWeek on
+ * or after dayOfMonth. If false, this rule selects
+ * the last dayOfWeek on or before dayOfMonth.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ int32_t time, UBool after, UErrorCode& status);
+
+ /**
+ * Sets the DST end rule to a weekday before or after a give date within
+ * a month, e.g., the first Monday on or after the 8th.
+ *
+ * @param month The month in which this rule occurs (0-based).
+ * @param dayOfMonth A date within that month (1-based).
+ * @param dayOfWeek The day of the week on which this rule occurs.
+ * @param time The time of that day (number of millis after midnight)
+ * when DST ends in local wall time, which is daylight
+ * time in this case.
+ * @param mode whether the time is local wall time, local standard time,
+ * or UTC time. Default is local wall time.
+ * @param after If true, this rule selects the first dayOfWeek on
+ * or after dayOfMonth. If false, this rule selects
+ * the last dayOfWeek on or before dayOfMonth.
+ * @param status An UErrorCode
+ * @stable ICU 2.0
+ */
+ void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ int32_t time, TimeMode mode, UBool after, UErrorCode& status);
+
+ /**
+ * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time in this time zone, taking daylight savings time into
+ * account) as of a particular reference date. The reference date is used to determine
+ * whether daylight savings time is in effect and needs to be figured into the offset
+ * that is returned (in other words, what is the adjusted GMT offset in this time zone
+ * at this particular date and time?). For the time zones produced by createTimeZone(),
+ * the reference data is specified according to the Gregorian calendar, and the date
+ * and time fields are in GMT, NOT local time.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, UTT (NOT local time).
+ * @param status An UErrorCode to receive the status.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
+
+ /**
+ * Gets the time zone offset, for current date, modified in case of
+ * daylight savings. This is the offset to add *to* UTC to get local time.
+ * @param era the era of the given date.
+ * @param year the year in the given date.
+ * @param month the month in the given date.
+ * Month is 0-based. e.g., 0 for January.
+ * @param day the day-in-month of the given date.
+ * @param dayOfWeek the day-of-week of the given date.
+ * @param milliseconds the millis in day in <em>standard</em> local time.
+ * @param monthLength the length of the given month in days.
+ * @param status An UErrorCode to receive the status.
+ * @return the offset to add *to* GMT to get local time.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t milliseconds,
+ int32_t monthLength, UErrorCode& status) const;
+ /**
+ * Gets the time zone offset, for current date, modified in case of
+ * daylight savings. This is the offset to add *to* UTC to get local time.
+ * @param era the era of the given date.
+ * @param year the year in the given date.
+ * @param month the month in the given date.
+ * Month is 0-based. e.g., 0 for January.
+ * @param day the day-in-month of the given date.
+ * @param dayOfWeek the day-of-week of the given date.
+ * @param milliseconds the millis in day in <em>standard</em> local time.
+ * @param monthLength the length of the given month in days.
+ * @param prevMonthLength length of the previous month in days.
+ * @param status An UErrorCode to receive the status.
+ * @return the offset to add *to* GMT to get local time.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t milliseconds,
+ int32_t monthLength, int32_t prevMonthLength,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared TimeZone method. This implementation simply calls
+ * the base class method, which otherwise would be hidden.
+ * @stable ICU 2.8
+ */
+ virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
+ int32_t& dstOffset, UErrorCode& ec) const;
+
+ /**
+ * Get time zone offsets from local wall time.
+ * @internal
+ */
+ virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
+ int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/;
+
+ /**
+ * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @return The TimeZone's raw GMT offset.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getRawOffset(void) const;
+
+ /**
+ * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @param offsetMillis The new raw GMT offset for this time zone.
+ * @stable ICU 2.0
+ */
+ virtual void setRawOffset(int32_t offsetMillis);
+
+ /**
+ * Sets the amount of time in ms that the clock is advanced during DST.
+ * @param millisSavedDuringDST the number of milliseconds the time is
+ * advanced with respect to standard time when the daylight savings rules
+ * are in effect. A positive number, typically one hour (3600000).
+ * @param status An UErrorCode to receive the status.
+ * @stable ICU 2.0
+ */
+ void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status);
+
+ /**
+ * Returns the amount of time in ms that the clock is advanced during DST.
+ * @return the number of milliseconds the time is
+ * advanced with respect to standard time when the daylight savings rules
+ * are in effect. A positive number, typically one hour (3600000).
+ * @stable ICU 2.0
+ */
+ virtual int32_t getDSTSavings(void) const;
+
+ /**
+ * Queries if this TimeZone uses Daylight Savings Time.
+ *
+ * @return True if this TimeZone uses Daylight Savings Time; false otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool useDaylightTime(void) const;
+
+ /**
+ * Returns true if the given date is within the period when daylight savings time
+ * is in effect; false otherwise. If the TimeZone doesn't observe daylight savings
+ * time, this functions always returns false.
+ * This method is wasteful since it creates a new GregorianCalendar and
+ * deletes it each time it is called. This is a deprecated method
+ * and provided only for Java compatibility.
+ *
+ * @param date The date to test.
+ * @param status An UErrorCode to receive the status.
+ * @return true if the given date is in Daylight Savings Time;
+ * false otherwise.
+ * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
+ */
+ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
+
+ /**
+ * Return true if this zone has the same rules and offset as another zone.
+ * @param other the TimeZone object to be compared with
+ * @return true if the given zone has the same rules and offset as this one
+ * @stable ICU 2.0
+ */
+ UBool hasSameRules(const TimeZone& other) const;
+
+ /**
+ * Clones TimeZone objects polymorphically. Clients are responsible for deleting
+ * the TimeZone object cloned.
+ *
+ * @return A new copy of this TimeZone object.
+ * @stable ICU 2.0
+ */
+ virtual TimeZone* clone(void) const;
+
+ /**
+ * Gets the first time zone transition after the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the first transition after the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Gets the most recent time zone transition before the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the most recent transition before the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
+ * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
+ * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
+ * @param status Receives error status code.
+ * @return The number of <code>TimeZoneRule</code>s representing time transitions.
+ * @draft ICU 3.8
+ */
+ virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
+
+ /**
+ * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
+ * which represent time transitions for this time zone. On successful return,
+ * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+ * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
+ * instances up to the size specified by trscount. The results are referencing the
+ * rule instance held by this time zone instance. Therefore, after this time zone
+ * is destructed, they are no longer available.
+ * @param initial Receives the initial timezone rule
+ * @param trsrules Receives the timezone transition rules
+ * @param trscount On input, specify the size of the array 'transitions' receiving
+ * the timezone transition rules. On output, actual number of
+ * rules filled in the array will be set.
+ * @param status Receives error status code.
+ * @draft ICU 3.8
+ */
+ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
+ const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
+
+
+public:
+
+ /**
+ * Override TimeZone 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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * 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() ==
+ * . Derived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+private:
+ /**
+ * Constants specifying values of startMode and endMode.
+ */
+ enum EMode
+ {
+ DOM_MODE = 1,
+ DOW_IN_MONTH_MODE,
+ DOW_GE_DOM_MODE,
+ DOW_LE_DOM_MODE
+ };
+
+ SimpleTimeZone(); // default constructor not implemented
+
+ /**
+ * Internal construction method.
+ * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset
+ * @param startMonth the month DST starts
+ * @param startDay the day DST starts
+ * @param startDayOfWeek the DOW DST starts
+ * @param startTime the time DST starts
+ * @param startTimeMode Whether the start time is local wall time, local
+ * standard time, or UTC time. Default is local wall time.
+ * @param endMonth the month DST ends
+ * @param endDay the day DST ends
+ * @param endDayOfWeek the DOW DST ends
+ * @param endTime the time DST ends
+ * @param endTimeMode Whether the end time is local wall time, local
+ * standard time, or UTC time. Default is local wall time.
+ * @param savingsDST The number of milliseconds added to standard time
+ * to get DST time. Default is one hour.
+ * @param status An UErrorCode to receive the status.
+ */
+ void construct(int32_t rawOffsetGMT,
+ int8_t startMonth, int8_t startDay, int8_t startDayOfWeek,
+ int32_t startTime, TimeMode startTimeMode,
+ int8_t endMonth, int8_t endDay, int8_t endDayOfWeek,
+ int32_t endTime, TimeMode endTimeMode,
+ int32_t dstSavings, UErrorCode& status);
+
+ /**
+ * Compare a given date in the year to a rule. Return 1, 0, or -1, depending
+ * on whether the date is after, equal to, or before the rule date. The
+ * millis are compared directly against the ruleMillis, so any
+ * standard-daylight adjustments must be handled by the caller.
+ *
+ * @return 1 if the date is after the rule date, -1 if the date is before
+ * the rule date, or 0 if the date is equal to the rule date.
+ */
+ static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen,
+ int8_t dayOfMonth,
+ int8_t dayOfWeek, int32_t millis, int32_t millisDelta,
+ EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek,
+ int8_t ruleDay, int32_t ruleMillis);
+
+ /**
+ * Given a set of encoded rules in startDay and startDayOfMonth, decode
+ * them and set the startMode appropriately. Do the same for endDay and
+ * endDayOfMonth.
+ * <P>
+ * Upon entry, the day of week variables may be zero or
+ * negative, in order to indicate special modes. The day of month
+ * variables may also be negative.
+ * <P>
+ * Upon exit, the mode variables will be
+ * set, and the day of week and day of month variables will be positive.
+ * <P>
+ * This method also recognizes a startDay or endDay of zero as indicating
+ * no DST.
+ */
+ void decodeRules(UErrorCode& status);
+ void decodeStartRule(UErrorCode& status);
+ void decodeEndRule(UErrorCode& status);
+
+ int8_t startMonth, startDay, startDayOfWeek; // the month, day, DOW, and time DST starts
+ int32_t startTime;
+ TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode
+ int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends
+ int32_t endTime;
+ int32_t startYear; // the year these DST rules took effect
+ int32_t rawOffset; // the TimeZone's raw GMT offset
+ UBool useDaylight; // flag indicating whether this TimeZone uses DST
+ static const int8_t STATICMONTHLENGTH[12]; // lengths of the months
+ EMode startMode, endMode; // flags indicating what kind of rules the DST rules are
+
+ /**
+ * A positive value indicating the amount of time saved during DST in ms.
+ * Typically one hour; sometimes 30 minutes.
+ */
+ int32_t dstSavings;
+
+ /* Private for BasicTimeZone implementation */
+ void initTransitionRules(UErrorCode& status);
+ void clearTransitionRules(void);
+ void deleteTransitionRules(void);
+ UBool transitionRulesInitialized;
+ InitialTimeZoneRule* initialRule;
+ TimeZoneTransition* firstTransition;
+ AnnualTimeZoneRule* stdRule;
+ AnnualTimeZoneRule* dstRule;
+};
+
+inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth,
+ int32_t dayOfWeek,
+ int32_t time, UErrorCode& status) {
+ setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
+}
+
+inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
+ int32_t time,
+ UErrorCode& status) {
+ setStartRule(month, dayOfMonth, time, WALL_TIME, status);
+}
+
+inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth,
+ int32_t dayOfWeek,
+ int32_t time, UBool after, UErrorCode& status) {
+ setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
+}
+
+inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth,
+ int32_t dayOfWeek,
+ int32_t time, UErrorCode& status) {
+ setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status);
+}
+
+inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth,
+ int32_t time, UErrorCode& status) {
+ setEndRule(month, dayOfMonth, time, WALL_TIME, status);
+}
+
+inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ int32_t time, UBool after, UErrorCode& status) {
+ setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status);
+}
+
+inline void
+SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef,
+ int32_t& dstOffsetRef, UErrorCode& ec) const {
+ TimeZone::getOffset(date, local, rawOffsetRef, dstOffsetRef, ec);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _SIMPLETZ
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h b/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h
new file mode 100644
index 00000000000..2fb7c8eb0cf
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/smpdtfmt.h
@@ -0,0 +1,904 @@
+/*
+* Copyright (C) 1997-2006, International Business Machines Corporation and others. All Rights Reserved.
+*******************************************************************************
+*
+* File SMPDTFMT.H
+*
+* Modification History:
+*
+* Date Name Description
+* 02/19/97 aliu Converted from java.
+* 07/09/97 helena Make ParsePosition into a class.
+* 07/21/98 stephen Added GMT_PLUS, GMT_MINUS
+* Changed setTwoDigitStartDate to set2DigitYearStart
+* Changed getTwoDigitStartDate to get2DigitYearStart
+* Removed subParseLong
+* Removed getZoneIndex (added in DateFormatSymbols)
+* 06/14/99 stephen Removed fgTimeZoneDataSuffix
+* 10/14/99 aliu Updated class doc to describe 2-digit year parsing
+* {j28 4182066}.
+*******************************************************************************
+*/
+
+#ifndef SMPDTFMT_H
+#define SMPDTFMT_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Format and parse dates in a language-independent manner.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/datefmt.h"
+
+U_NAMESPACE_BEGIN
+
+class DateFormatSymbols;
+class DateFormat;
+class MessageFormat;
+
+/**
+ *
+ * SimpleDateFormat is a concrete class for formatting and parsing dates in a
+ * language-independent manner. It allows for formatting (millis -> text),
+ * parsing (text -> millis), and normalization. Formats/Parses a date or time,
+ * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970.
+ * <P>
+ * Clients are encouraged to create a date-time formatter using DateFormat::getInstance(),
+ * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather than
+ * explicitly constructing an instance of SimpleDateFormat. This way, the client
+ * is guaranteed to get an appropriate formatting pattern for whatever locale the
+ * program is running in. However, if the client needs something more unusual than
+ * the default patterns in the locales, he can construct a SimpleDateFormat directly
+ * and give it an appropriate pattern (or use one of the factory methods on DateFormat
+ * and modify the pattern after the fact with toPattern() and applyPattern().
+ * <P>
+ * Date/Time format syntax:
+ * <P>
+ * The date/time format is specified by means of a string time pattern. In this
+ * pattern, all ASCII letters are reserved as pattern letters, which are defined
+ * as the following:
+ * <pre>
+ * \code
+ * Symbol Meaning Presentation Example
+ * ------ ------- ------------ -------
+ * G era designator (Text) AD
+ * y year (Number) 1996
+ * Y year (week of year) (Number) 1997
+ * u extended year (Number) 4601
+ * M month in year (Text & Number) July & 07
+ * d day in month (Number) 10
+ * h hour in am/pm (1~12) (Number) 12
+ * H hour in day (0~23) (Number) 0
+ * m minute in hour (Number) 30
+ * s second in minute (Number) 55
+ * S fractional second (Number) 978
+ * E day of week (Text) Tuesday
+ * e day of week (local 1~7) (Number) 2
+ * D day in year (Number) 189
+ * F day of week in month (Number) 2 (2nd Wed in July)
+ * w week in year (Number) 27
+ * W week in month (Number) 2
+ * a am/pm marker (Text) PM
+ * k hour in day (1~24) (Number) 24
+ * K hour in am/pm (0~11) (Number) 0
+ * z time zone (Time) Pacific Standard Time
+ * Z time zone (RFC 822) (Number) -0800
+ * v time zone (generic) (Text) Pacific Time
+ * g Julian day (Number) 2451334
+ * A milliseconds in day (Number) 69540000
+ * ' escape for text (Delimiter) 'Date='
+ * '' single quote (Literal) 'o''clock'
+ * \endcode
+ * </pre>
+ * The count of pattern letters determine the format.
+ * <P>
+ * (Text): 4 or more, use full form, &lt;4, use short or abbreviated form if it
+ * exists. (e.g., "EEEE" produces "Monday", "EEE" produces "Mon")
+ * <P>
+ * (Number): the minimum number of digits. Shorter numbers are zero-padded to
+ * this amount (e.g. if "m" produces "6", "mm" produces "06"). Year is handled
+ * specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.
+ * (e.g., if "yyyy" produces "1997", "yy" produces "97".)
+ * Unlike other fields, fractional seconds are padded on the right with zero.
+ * <P>
+ * (Text & Number): 3 or over, use text, otherwise use number. (e.g., "M" produces "1",
+ * "MM" produces "01", "MMM" produces "Jan", and "MMMM" produces "January".)
+ * <P>
+ * Any characters in the pattern that are not in the ranges of ['a'..'z'] and
+ * ['A'..'Z'] will be treated as quoted text. For instance, characters
+ * like ':', '.', ' ', '#' and '@' will appear in the resulting time text
+ * even they are not embraced within single quotes.
+ * <P>
+ * A pattern containing any invalid pattern letter will result in a failing
+ * UErrorCode result during formatting or parsing.
+ * <P>
+ * Examples using the US locale:
+ * <pre>
+ * \code
+ * Format Pattern Result
+ * -------------- -------
+ * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->> 1996.07.10 AD at 15:08:56 Pacific Time
+ * "EEE, MMM d, ''yy" ->> Wed, July 10, '96
+ * "h:mm a" ->> 12:08 PM
+ * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time
+ * "K:mm a, vvv" ->> 0:00 PM, PT
+ * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM
+ * \endcode
+ * </pre>
+ * Code Sample:
+ * <pre>
+ * \code
+ * UErrorCode success = U_ZERO_ERROR;
+ * SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
+ * pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000);
+ * pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000);
+ *
+ * // Format the current time.
+ * SimpleDateFormat* formatter
+ * = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
+ * GregorianCalendar cal(success);
+ * UDate currentTime_1 = cal.getTime(success);
+ * FieldPosition fp(0);
+ * UnicodeString dateString;
+ * formatter->format( currentTime_1, dateString, fp );
+ * cout << "result: " << dateString << endl;
+ *
+ * // Parse the previous string back into a Date.
+ * ParsePosition pp(0);
+ * UDate currentTime_2 = formatter->parse(dateString, pp );
+ * \endcode
+ * </pre>
+ * In the above example, the time value "currentTime_2" obtained from parsing
+ * will be equal to currentTime_1. However, they may not be equal if the am/pm
+ * marker 'a' is left out from the format pattern while the "hour in am/pm"
+ * pattern symbol is used. This information loss can happen when formatting the
+ * time in PM.
+ *
+ * <p>
+ * When parsing a date string using the abbreviated year pattern ("y" or "yy"),
+ * SimpleDateFormat must interpret the abbreviated year
+ * relative to some century. It does this by adjusting dates to be
+ * within 80 years before and 20 years after the time the SimpleDateFormat
+ * instance is created. For example, using a pattern of "MM/dd/yy" and a
+ * SimpleDateFormat instance created on Jan 1, 1997, the string
+ * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"
+ * would be interpreted as May 4, 1964.
+ * During parsing, only strings consisting of exactly two digits, as defined by
+ * <code>Unicode::isDigit()</code>, will be parsed into the default century.
+ * Any other numeric string, such as a one digit string, a three or more digit
+ * string, or a two digit string that isn't all digits (for example, "-1"), is
+ * interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the
+ * same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.
+ *
+ * <p>
+ * If the year pattern has more than two 'y' characters, the year is
+ * interpreted literally, regardless of the number of digits. So using the
+ * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.
+ *
+ * <p>
+ * When numeric fields abut one another directly, with no intervening delimiter
+ * characters, they constitute a run of abutting numeric fields. Such runs are
+ * parsed specially. For example, the format "HHmmss" parses the input text
+ * "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and fails to
+ * parse "1234". In other words, the leftmost field of the run is flexible,
+ * while the others keep a fixed width. If the parse fails anywhere in the run,
+ * then the leftmost field is shortened by one character, and the entire run is
+ * parsed again. This is repeated until either the parse succeeds or the
+ * leftmost field is one character in length. If the parse still fails at that
+ * point, the parse of the run fails.
+ *
+ * <P>
+ * For time zones that have no names, SimpleDateFormat uses strings GMT+hours:minutes or
+ * GMT-hours:minutes.
+ * <P>
+ * The calendar defines what is the first day of the week, the first week of the
+ * year, whether hours are zero based or not (0 vs 12 or 24), and the timezone.
+ * There is one common number format to handle all the numbers; the digit count
+ * is handled programmatically according to the pattern.
+ *
+ * <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 SimpleDateFormat: public DateFormat {
+public:
+ /**
+ * Construct a SimpleDateFormat using the default pattern for the default
+ * locale.
+ * <P>
+ * [Note:] Not all locales support SimpleDateFormat; for full generality,
+ * use the factory methods in the DateFormat class.
+ * @param status Output param set to success/failure code.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(UErrorCode& status);
+
+ /**
+ * Construct a SimpleDateFormat using the given pattern and the default locale.
+ * The locale is used to obtain the symbols used in formatting (e.g., the
+ * names of the months), but not to provide the pattern.
+ * <P>
+ * [Note:] Not all locales support SimpleDateFormat; for full generality,
+ * use the factory methods in the DateFormat class.
+ * @param pattern the pattern for the format.
+ * @param status Output param set to success/failure code.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * Construct a SimpleDateFormat using the given pattern and locale.
+ * The locale is used to obtain the symbols used in formatting (e.g., the
+ * names of the months), but not to provide the pattern.
+ * <P>
+ * [Note:] Not all locales support SimpleDateFormat; for full generality,
+ * use the factory methods in the DateFormat class.
+ * @param pattern the pattern for the format.
+ * @param locale the given locale.
+ * @param status Output param set to success/failure code.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(const UnicodeString& pattern,
+ const Locale& locale,
+ UErrorCode& status);
+
+ /**
+ * Construct a SimpleDateFormat using the given pattern and locale-specific
+ * symbol data. The formatter takes ownership of the DateFormatSymbols object;
+ * the caller is no longer responsible for deleting it.
+ * @param pattern the given pattern for the format.
+ * @param formatDataToAdopt the symbols to be adopted.
+ * @param status Output param set to success/faulure code.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(const UnicodeString& pattern,
+ DateFormatSymbols* formatDataToAdopt,
+ UErrorCode& status);
+
+ /**
+ * Construct a SimpleDateFormat using the given pattern and locale-specific
+ * symbol data. The DateFormatSymbols object is NOT adopted; the caller
+ * remains responsible for deleting it.
+ * @param pattern the given pattern for the format.
+ * @param formatData the formatting symbols to be use.
+ * @param status Output param set to success/faulure code.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(const UnicodeString& pattern,
+ const DateFormatSymbols& formatData,
+ UErrorCode& status);
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat(const SimpleDateFormat&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.0
+ */
+ SimpleDateFormat& operator=(const SimpleDateFormat&);
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~SimpleDateFormat();
+
+ /**
+ * Clone this Format object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @stable ICU 2.0
+ */
+ virtual Format* clone(void) const;
+
+ /**
+ * 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 true if the given Format objects are semantically equal.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Format& other) const;
+
+ /**
+ * Format a date or time, which is the standard millis since 24:00 GMT, Jan
+ * 1, 1970. Overrides DateFormat pure virtual method.
+ * <P>
+ * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->>
+ * 1996.07.10 AD at 15:08:56 PDT
+ *
+ * @param cal Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos The formatting position. On input: an alignment field,
+ * if desired. On output: the offsets of the alignment field.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.1
+ */
+ virtual UnicodeString& format( Calendar& cal,
+ UnicodeString& appendTo,
+ FieldPosition& pos) const;
+
+ /**
+ * Format a date or time, which is the standard millis since 24:00 GMT, Jan
+ * 1, 1970. Overrides DateFormat pure virtual method.
+ * <P>
+ * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->>
+ * 1996.07.10 AD at 15:08:56 PDT
+ *
+ * @param obj A Formattable containing the date-time value to be formatted
+ * into a date-time string. If the type of the Formattable
+ * is a numeric type, it is treated as if it were an
+ * instance of Date.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param pos The formatting position. On input: an alignment field,
+ * if desired. On output: the offsets of the alignment field.
+ * @param status Output param set to success/faulure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& format( const Formattable& obj,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared DateFormat method.
+ * @param date the Date value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param fieldPosition The formatting position. On input: an alignment field,
+ * if desired. On output: the offsets of the alignment field.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.1
+ */
+ UnicodeString& format(UDate date,
+ UnicodeString& appendTo,
+ FieldPosition& fieldPosition) const;
+
+ /**
+ * Redeclared DateFormat method.
+ * @param obj Object to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param status Input/output success/failure code.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Redeclared DateFormat method.
+ * @param date Date value to be formatted.
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @return Reference to 'appendTo' parameter.
+ * @stable ICU 2.0
+ */
+ UnicodeString& format(UDate date, UnicodeString& appendTo) const;
+
+ /**
+ * Parse a date/time string beginning at the given parse position. For
+ * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
+ * that is equivalent to Date(837039928046).
+ * <P>
+ * By default, parsing is lenient: If the input is not in the form used by
+ * this object's format method but can still be parsed as a date, then the
+ * parse succeeds. Clients may insist on strict adherence to the format by
+ * calling setLenient(false).
+ *
+ * @param text The date/time string to be parsed
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @param pos On input, the position at which to start parsing; on
+ * output, the position at which parsing terminated, or the
+ * start position if the parse failed.
+ * @return A valid UDate if the input could be parsed.
+ * @stable ICU 2.1
+ */
+ virtual void parse( const UnicodeString& text,
+ Calendar& cal,
+ ParsePosition& pos) const;
+
+ /**
+ * Parse a date/time string starting at the given parse position. For
+ * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date
+ * that is equivalent to Date(837039928046).
+ * <P>
+ * By default, parsing is lenient: If the input is not in the form used by
+ * this object's format method but can still be parsed as a date, then the
+ * parse succeeds. Clients may insist on strict adherence to the format by
+ * calling setLenient(false).
+ *
+ * @see DateFormat::setLenient(boolean)
+ *
+ * @param text The date/time string to be parsed
+ * @param pos On input, the position at which to start parsing; on
+ * output, the position at which parsing terminated, or the
+ * start position if the parse failed.
+ * @return A valid UDate if the input could be parsed.
+ * @stable ICU 2.0
+ */
+ UDate parse( const UnicodeString& text,
+ ParsePosition& pos) const;
+
+
+ /**
+ * Parse a date/time string. For example, a time text "07/10/96 4:5 PM, PDT"
+ * will be parsed into a UDate that is equivalent to Date(837039928046).
+ * Parsing begins at the beginning of the string and proceeds as far as
+ * possible. Assuming no parse errors were encountered, this function
+ * doesn't return any information about how much of the string was consumed
+ * by the parsing. If you need that information, use the version of
+ * parse() that takes a ParsePosition.
+ *
+ * @param text The date/time string to be parsed
+ * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with
+ * an error value if there was a parse error.
+ * @return A valid UDate if the input could be parsed.
+ * @stable ICU 2.0
+ */
+ virtual UDate parse( const UnicodeString& text,
+ UErrorCode& status) const;
+
+ /**
+ * Set the start UDate used to interpret two-digit year strings.
+ * When dates are parsed having 2-digit year strings, they are placed within
+ * a assumed range of 100 years starting on the two digit start date. For
+ * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or
+ * some other year. SimpleDateFormat chooses a year so that the resultant
+ * date is on or after the two digit start date and within 100 years of the
+ * two digit start date.
+ * <P>
+ * By default, the two digit start date is set to 80 years before the current
+ * time at which a SimpleDateFormat object is created.
+ * @param d start UDate used to interpret two-digit year strings.
+ * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with
+ * an error value if there was a parse error.
+ * @stable ICU 2.0
+ */
+ virtual void set2DigitYearStart(UDate d, UErrorCode& status);
+
+ /**
+ * Get the start UDate used to interpret two-digit year strings.
+ * When dates are parsed having 2-digit year strings, they are placed within
+ * a assumed range of 100 years starting on the two digit start date. For
+ * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or
+ * some other year. SimpleDateFormat chooses a year so that the resultant
+ * date is on or after the two digit start date and within 100 years of the
+ * two digit start date.
+ * <P>
+ * By default, the two digit start date is set to 80 years before the current
+ * time at which a SimpleDateFormat object is created.
+ * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with
+ * an error value if there was a parse error.
+ * @stable ICU 2.0
+ */
+ UDate get2DigitYearStart(UErrorCode& status) const;
+
+ /**
+ * Return a pattern string describing this date format.
+ * @param result Output param to receive the pattern.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toPattern(UnicodeString& result) const;
+
+ /**
+ * Return a localized pattern string describing this date format.
+ * In most cases, this will return the same thing as toPattern(),
+ * but a locale can specify characters to use in pattern descriptions
+ * in place of the ones described in this class's class documentation.
+ * (Presumably, letters that would be more mnemonic in that locale's
+ * language.) This function would produce a pattern using those
+ * letters.
+ *
+ * @param result Receives the localized pattern.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toLocalizedPattern(UnicodeString& result,
+ UErrorCode& status) const;
+
+ /**
+ * Apply the given unlocalized pattern string to this date format.
+ * (i.e., after this call, this formatter will format dates according to
+ * the new pattern)
+ *
+ * @param pattern The pattern to be applied.
+ * @stable ICU 2.0
+ */
+ virtual void applyPattern(const UnicodeString& pattern);
+
+ /**
+ * Apply the given localized pattern string to this date format.
+ * (see toLocalizedPattern() for more information on localized patterns.)
+ *
+ * @param pattern The localized pattern to be applied.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+ virtual void applyLocalizedPattern(const UnicodeString& pattern,
+ UErrorCode& status);
+
+ /**
+ * Gets the date/time formatting symbols (this is an object carrying
+ * the various strings and other symbols used in formatting: e.g., month
+ * names and abbreviations, time zone names, AM/PM strings, etc.)
+ * @return a copy of the date-time formatting data associated
+ * with this date-time formatter.
+ * @stable ICU 2.0
+ */
+ virtual const DateFormatSymbols* getDateFormatSymbols(void) const;
+
+ /**
+ * Set the date/time formatting symbols. The caller no longer owns the
+ * DateFormatSymbols object and should not delete it after making this call.
+ * @param newFormatSymbols the given date-time formatting symbols to copy.
+ * @stable ICU 2.0
+ */
+ virtual void adoptDateFormatSymbols(DateFormatSymbols* newFormatSymbols);
+
+ /**
+ * Set the date/time formatting data.
+ * @param newFormatSymbols the given date-time formatting symbols to copy.
+ * @stable ICU 2.0
+ */
+ virtual void setDateFormatSymbols(const DateFormatSymbols& newFormatSymbols);
+
+ /**
+ * 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 2.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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * Set the calendar to be used by this date format. Initially, the default
+ * calendar for the specified or default locale is used. The caller should
+ * not delete the Calendar object after it is adopted by this call.
+ * Adopting a new calendar will change to the default symbols.
+ *
+ * @param calendarToAdopt Calendar object to be adopted.
+ * @stable ICU 2.0
+ */
+ virtual void adoptCalendar(Calendar* calendarToAdopt);
+
+private:
+ friend class DateFormat;
+
+ void initializeDefaultCentury(void);
+
+ SimpleDateFormat(); // default constructor not implemented
+
+ /**
+ * Used by the DateFormat factory methods to construct a SimpleDateFormat.
+ * @param timeStyle the time style.
+ * @param dateStyle the date style.
+ * @param locale the given locale.
+ * @param status Output param set to success/failure code on
+ * exit.
+ */
+ SimpleDateFormat(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status);
+
+ /**
+ * Construct a SimpleDateFormat for the given locale. If no resource data
+ * is available, create an object of last resort, using hard-coded strings.
+ * This is an internal method, called by DateFormat. It should never fail.
+ * @param locale the given locale.
+ * @param status Output param set to success/failure code on
+ * exit.
+ */
+ SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use default pattern
+
+ /**
+ * Called by format() to format a single field.
+ *
+ * @param appendTo Output parameter to receive result.
+ * Result is appended to existing contents.
+ * @param ch The format character we encountered in the pattern.
+ * @param count Number of characters in the current pattern symbol (e.g.,
+ * "yyyy" in the pattern would result in a call to this function
+ * with ch equal to 'y' and count equal to 4)
+ * @param pos The FieldPosition being filled in by the format() call. If
+ * this function is formatting the field specfied by pos, it
+ * will fill in pos with the beginning and ending offsets of the
+ * field.
+ * @param status Receives a status code, which will be U_ZERO_ERROR if the operation
+ * succeeds.
+ */
+ void subFormat( UnicodeString &appendTo,
+ UChar ch,
+ int32_t count,
+ FieldPosition& pos,
+ Calendar& cal,
+ UErrorCode& status) const; // in case of illegal argument
+
+ /**
+ * Used by subFormat() to format a numeric value.
+ * Appends to toAppendTo a string representation of "value"
+ * having a number of digits between "minDigits" and
+ * "maxDigits". Uses the DateFormat's NumberFormat.
+ *
+ * @param appendTo Output parameter to receive result.
+ * Formatted number is appended to existing contents.
+ * @param value Value to format.
+ * @param minDigits Minimum number of digits the result should have
+ * @param maxDigits Maximum number of digits the result should have
+ */
+ void zeroPaddingNumber( UnicodeString &appendTo,
+ int32_t value,
+ int32_t minDigits,
+ int32_t maxDigits) const;
+
+ /**
+ * Return true if the given format character, occuring count
+ * times, represents a numeric field.
+ */
+ static UBool isNumeric(UChar formatChar, int32_t count);
+
+ /**
+ * initializes fCalendar from parameters. Returns fCalendar as a convenience.
+ * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault().
+ * @param locale Locale of the calendar
+ * @param status Error code
+ * @return the newly constructed fCalendar
+ */
+ Calendar *initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status);
+
+ /**
+ * initializes fSymbols from parameters.
+ * @param locale Locale of the symbols
+ * @param calendar Alias to Calendar that will be used.
+ * @param status Error code
+ */
+ void initializeSymbols(const Locale& locale, Calendar* calendar, UErrorCode& status);
+
+ /**
+ * Called by several of the constructors to load pattern data and formatting symbols
+ * out of a resource bundle and initialize the locale based on it.
+ * @param timeStyle The time style, as passed to DateFormat::createDateInstance().
+ * @param dateStyle The date style, as passed to DateFormat::createTimeInstance().
+ * @param locale The locale to load the patterns from.
+ * @param status Filled in with an error code if loading the data from the
+ * resources fails.
+ */
+ void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status);
+
+ /**
+ * Called by construct() and the various constructors to set up the SimpleDateFormat's
+ * Calendar and NumberFormat objects.
+ * @param locale The locale for which we want a Calendar and a NumberFormat.
+ * @param statuc Filled in with an error code if creating either subobject fails.
+ */
+ void initialize(const Locale& locale, UErrorCode& status);
+
+ /**
+ * Private code-size reduction function used by subParse.
+ * @param text the time text being parsed.
+ * @param start where to start parsing.
+ * @param field the date field being parsed.
+ * @param stringArray the string array to parsed.
+ * @param stringArrayCount the size of the array.
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @return the new start position if matching succeeded; a negative number
+ * indicating matching failure, otherwise.
+ */
+ int32_t matchString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
+ const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
+
+ /**
+ * Private code-size reduction function used by subParse.
+ * @param text the time text being parsed.
+ * @param start where to start parsing.
+ * @param field the date field being parsed.
+ * @param stringArray the string array to parsed.
+ * @param stringArrayCount the size of the array.
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @return the new start position if matching succeeded; a negative number
+ * indicating matching failure, otherwise.
+ */
+ int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field,
+ const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const;
+
+ /**
+ * Private member function that converts the parsed date strings into
+ * timeFields. Returns -start (for ParsePosition) if failed.
+ * @param text the time text to be parsed.
+ * @param start where to start parsing.
+ * @param ch the pattern character for the date field text to be parsed.
+ * @param count the count of a pattern character.
+ * @param obeyCount if true then the count is strictly obeyed.
+ * @param ambiguousYear If true then the two-digit year == the default start year.
+ * @param cal a Calendar set to the date and time to be formatted
+ * into a date/time string.
+ * @return the new start position if matching succeeded; a negative number
+ * indicating matching failure, otherwise.
+ */
+ int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, int32_t count,
+ UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], Calendar& cal) const;
+
+ void parseInt(const UnicodeString& text,
+ Formattable& number,
+ ParsePosition& pos,
+ UBool allowNegative) const;
+
+ void parseInt(const UnicodeString& text,
+ Formattable& number,
+ int32_t maxDigits,
+ ParsePosition& pos,
+ UBool allowNegative) const;
+
+ /**
+ * Translate a pattern, mapping each character in the from string to the
+ * corresponding character in the to string. Return an error if the original
+ * pattern contains an unmapped character, or if a quote is unmatched.
+ * Quoted (single quotes only) material is not translated.
+ * @param originalPattern the original pattern.
+ * @param translatedPattern Output param to receive the translited pattern.
+ * @param from the characters to be translited from.
+ * @param to the characters to be translited to.
+ * @param status Receives a status code, which will be U_ZERO_ERROR
+ * if the operation succeeds.
+ */
+ static void translatePattern(const UnicodeString& originalPattern,
+ UnicodeString& translatedPattern,
+ const UnicodeString& from,
+ const UnicodeString& to,
+ UErrorCode& status);
+
+ /**
+ * Sets the starting date of the 100-year window that dates with 2-digit years
+ * are considered to fall within.
+ * @param startDate the start date
+ * @param status Receives a status code, which will be U_ZERO_ERROR
+ * if the operation succeeds.
+ */
+ void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status);
+
+ /**
+ * Private methods for formatting/parsing GMT string
+ */
+ void appendGMT(UnicodeString &appendTo, Calendar& cal, UErrorCode& status) const;
+ void formatGMTDefault(UnicodeString &appendTo, int32_t offset) const;
+ int32_t parseGMT(const UnicodeString &text, ParsePosition &pos) const;
+ int32_t parseGMTDefault(const UnicodeString &text, ParsePosition &pos) const;
+ UBool isDefaultGMTFormat() const;
+
+ void formatRFC822TZ(UnicodeString &appendTo, int32_t offset) const;
+
+ /**
+ * Initialize MessageFormat instances used for GMT formatting/parsing
+ */
+ void initGMTFormatters(UErrorCode &status);
+
+ /**
+ * Used to map pattern characters to Calendar field identifiers.
+ */
+ static const UCalendarDateFields fgPatternIndexToCalendarField[];
+
+ /**
+ * Map index into pattern character string to DateFormat field number
+ */
+ static const UDateFormatField fgPatternIndexToDateFormatField[];
+
+ /**
+ * The formatting pattern for this formatter.
+ */
+ UnicodeString fPattern;
+
+ /**
+ * The original locale used (for reloading symbols)
+ */
+ Locale fLocale;
+
+ /**
+ * A pointer to an object containing the strings to use in formatting (e.g.,
+ * month and day names, AM and PM strings, time zone names, etc.)
+ */
+ DateFormatSymbols* fSymbols; // Owned
+
+ /**
+ * If dates have ambiguous years, we map them into the century starting
+ * at defaultCenturyStart, which may be any date. If defaultCenturyStart is
+ * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the system
+ * values are used. The instance values defaultCenturyStart and
+ * defaultCenturyStartYear are only used if explicitly set by the user
+ * through the API method parseAmbiguousDatesAsAfter().
+ */
+ UDate fDefaultCenturyStart;
+
+ /**
+ * See documentation for defaultCenturyStart.
+ */
+ /*transient*/ int32_t fDefaultCenturyStartYear;
+
+ enum ParsedTZType {
+ TZTYPE_UNK,
+ TZTYPE_STD,
+ TZTYPE_DST
+ };
+
+ ParsedTZType tztype; // here to avoid api change
+
+ /*
+ * MessageFormat instances used for localized GMT format
+ */
+ MessageFormat **fGMTFormatters;
+
+ UBool fHaveDefaultCentury;
+};
+
+inline UDate
+SimpleDateFormat::get2DigitYearStart(UErrorCode& /*status*/) const
+{
+ return fDefaultCenturyStart;
+}
+
+inline UnicodeString&
+SimpleDateFormat::format(const Formattable& obj,
+ UnicodeString& appendTo,
+ UErrorCode& status) const {
+ // Don't use Format:: - use immediate base class only,
+ // in case immediate base modifies behavior later.
+ return DateFormat::format(obj, appendTo, status);
+}
+
+inline UnicodeString&
+SimpleDateFormat::format(UDate date,
+ UnicodeString& appendTo,
+ FieldPosition& fieldPosition) const {
+ // Don't use Format:: - use immediate base class only,
+ // in case immediate base modifies behavior later.
+ return DateFormat::format(date, appendTo, fieldPosition);
+}
+
+inline UnicodeString&
+SimpleDateFormat::format(UDate date, UnicodeString& appendTo) const {
+ return DateFormat::format(date, appendTo);
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // _SMPDTFMT
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h b/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h
new file mode 100644
index 00000000000..ef202dd9ba4
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/sortkey.h
@@ -0,0 +1,324 @@
+/*
+ *****************************************************************************
+ * Copyright (C) 1996-2006, International Business Machines Corporation and others.
+ * All Rights Reserved.
+ *****************************************************************************
+ *
+ * File sortkey.h
+ *
+ * Created by: Helena Shih
+ *
+ * Modification History:
+ *
+ * Date Name Description
+ *
+ * 6/20/97 helena Java class name change.
+ * 8/18/97 helena Added internal API documentation.
+ * 6/26/98 erm Changed to use byte arrays and memcmp.
+ *****************************************************************************
+ */
+
+#ifndef SORTKEY_H
+#define SORTKEY_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Keys for comparing strings multiple times.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/coll.h"
+
+U_NAMESPACE_BEGIN
+
+/* forward declaration */
+class RuleBasedCollator;
+
+/**
+ *
+ * Collation keys are generated by the Collator class. Use the CollationKey objects
+ * instead of Collator to compare strings multiple times. A CollationKey
+ * preprocesses the comparison information from the Collator object to
+ * make the comparison faster. If you are not going to comparing strings
+ * multiple times, then using the Collator object is generally faster,
+ * since it only processes as much of the string as needed to make a
+ * comparison.
+ * <p> For example (with strength == tertiary)
+ * <p>When comparing "Abernathy" to "Baggins-Smythworthy", Collator
+ * only needs to process a couple of characters, while a comparison
+ * with CollationKeys will process all of the characters. On the other hand,
+ * if you are doing a sort of a number of fields, it is much faster to use
+ * CollationKeys, since you will be comparing strings multiple times.
+ * <p>Typical use of CollationKeys are in databases, where you store a CollationKey
+ * in a hidden field, and use it for sorting or indexing.
+ *
+ * <p>Example of use:
+ * <pre>
+ * \code
+ * UErrorCode success = U_ZERO_ERROR;
+ * Collator* myCollator = Collator::createInstance(success);
+ * CollationKey* keys = new CollationKey [3];
+ * myCollator->getCollationKey("Tom", keys[0], success );
+ * myCollator->getCollationKey("Dick", keys[1], success );
+ * myCollator->getCollationKey("Harry", keys[2], success );
+ *
+ * // Inside body of sort routine, compare keys this way:
+ * CollationKey tmp;
+ * if(keys[0].compareTo( keys[1] ) > 0 ) {
+ * tmp = keys[0]; keys[0] = keys[1]; keys[1] = tmp;
+ * }
+ * //...
+ * \endcode
+ * </pre>
+ * <p>Because Collator::compare()'s algorithm is complex, it is faster to sort
+ * long lists of words by retrieving collation keys with Collator::getCollationKey().
+ * You can then cache the collation keys and compare them using CollationKey::compareTo().
+ * <p>
+ * <strong>Note:</strong> <code>Collator</code>s with different Locale,
+ * CollationStrength and DecompositionMode settings will return different
+ * CollationKeys for the same set of strings. Locales have specific
+ * collation rules, and the way in which secondary and tertiary differences
+ * are taken into account, for example, will result in different CollationKeys
+ * for same strings.
+ * <p>
+
+ * @see Collator
+ * @see RuleBasedCollator
+ * @version 1.3 12/18/96
+ * @author Helena Shih
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+class U_I18N_API CollationKey : public UObject {
+public:
+ /**
+ * This creates an empty collation key based on the null string. An empty
+ * collation key contains no sorting information. When comparing two empty
+ * collation keys, the result is Collator::EQUAL. Comparing empty collation key
+ * with non-empty collation key is always Collator::LESS.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ CollationKey();
+
+
+ /**
+ * Creates a collation key based on the collation key values.
+ * @param values the collation key values
+ * @param count number of collation key values, including trailing nulls.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ CollationKey(const uint8_t* values,
+ int32_t count);
+
+ /**
+ * Copy constructor.
+ * @param other the object to be copied.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ CollationKey(const CollationKey& other);
+
+ /**
+ * Sort key destructor.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ virtual ~CollationKey();
+
+ /**
+ * Assignment operator
+ * @param other the object to be copied.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ const CollationKey& operator=(const CollationKey& other);
+
+ /**
+ * Compare if two collation keys are the same.
+ * @param source the collation key to compare to.
+ * @return Returns true if two collation keys are equal, false otherwise.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ UBool operator==(const CollationKey& source) const;
+
+ /**
+ * Compare if two collation keys are not the same.
+ * @param source the collation key to compare to.
+ * @return Returns TRUE if two collation keys are different, FALSE otherwise.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ UBool operator!=(const CollationKey& source) const;
+
+
+ /**
+ * Test to see if the key is in an invalid state. The key will be in an
+ * invalid state if it couldn't allocate memory for some operation.
+ * @return Returns TRUE if the key is in an invalid, FALSE otherwise.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ UBool isBogus(void) const;
+
+ /**
+ * Returns a pointer to the collation key values. The storage is owned
+ * by the collation key and the pointer will become invalid if the key
+ * is deleted.
+ * @param count the output parameter of number of collation key values,
+ * including any trailing nulls.
+ * @return a pointer to the collation key values.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ const uint8_t* getByteArray(int32_t& count) const;
+
+#ifdef U_USE_COLLATION_KEY_DEPRECATES
+ /**
+ * Extracts the collation key values into a new array. The caller owns
+ * this storage and should free it.
+ * @param count the output parameter of number of collation key values,
+ * including any trailing nulls.
+ * @obsolete ICU 2.6. Use getByteArray instead since this API will be removed in that release.
+ */
+ uint8_t* toByteArray(int32_t& count) const;
+#endif
+
+ /**
+ * Convenience method which does a string(bit-wise) comparison of the
+ * two collation keys.
+ * @param target target collation key to be compared with
+ * @return Returns Collator::LESS if sourceKey &lt; targetKey,
+ * Collator::GREATER if sourceKey > targetKey and Collator::EQUAL
+ * otherwise.
+ * @deprecated ICU 2.6 use the overload with error code
+ */
+ Collator::EComparisonResult compareTo(const CollationKey& target) const;
+
+ /**
+ * Convenience method which does a string(bit-wise) comparison of the
+ * two collation keys.
+ * @param target target collation key to be compared with
+ * @param status error code
+ * @return Returns UCOL_LESS if sourceKey &lt; targetKey,
+ * UCOL_GREATER if sourceKey > targetKey and UCOL_EQUAL
+ * otherwise.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ UCollationResult compareTo(const CollationKey& target, UErrorCode &status) const;
+
+ /**
+ * Creates an integer that is unique to the collation key. NOTE: this
+ * is not the same as String.hashCode.
+ * <p>Example of use:
+ * <pre>
+ * . UErrorCode status = U_ZERO_ERROR;
+ * . Collator *myCollation = Collator::createInstance(Locale::US, status);
+ * . if (U_FAILURE(status)) return;
+ * . CollationKey key1, key2;
+ * . UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR;
+ * . myCollation->getCollationKey("abc", key1, status1);
+ * . if (U_FAILURE(status1)) { delete myCollation; return; }
+ * . myCollation->getCollationKey("ABC", key2, status2);
+ * . if (U_FAILURE(status2)) { delete myCollation; return; }
+ * . // key1.hashCode() != key2.hashCode()
+ * </pre>
+ * @return the hash value based on the string's collation order.
+ * @see UnicodeString#hashCode
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ int32_t hashCode(void) const;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for the actual class.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ virtual UClassID getDynamicClassID() const;
+
+ /**
+ * ICU "poor man's RTTI", returns a UClassID for this class.
+ * @deprecated ICU 2.8 Use Collator::getSortKey(...) instead
+ */
+ static UClassID U_EXPORT2 getStaticClassID();
+
+private:
+ /**
+ * Returns an array of the collation key values as 16-bit integers.
+ * The caller owns the storage and must delete it.
+ * @param values Output param of the collation key values.
+ * @param count output parameter of the number of collation key values
+ * @return a pointer to an array of 16-bit collation key values.
+ */
+ void adopt(uint8_t *values, int32_t count);
+
+ /*
+ * Creates a collation key with a string.
+ */
+
+ /**
+ * If this CollationKey has capacity less than newSize,
+ * its internal capacity will be increased to newSize.
+ * @param newSize minimum size this CollationKey has to have
+ * @return this CollationKey
+ */
+ CollationKey& ensureCapacity(int32_t newSize);
+ /**
+ * Set the CollationKey to a "bogus" or invalid state
+ * @return this CollationKey
+ */
+ CollationKey& setToBogus(void);
+ /**
+ * Resets this CollationKey to an empty state
+ * @return this CollationKey
+ */
+ CollationKey& reset(void);
+
+ /**
+ * Allow private access to RuleBasedCollator
+ */
+ friend class RuleBasedCollator;
+ /**
+ * Bogus status
+ */
+ UBool fBogus;
+ /**
+ * Size of fBytes used to store the sortkey. i.e. up till the
+ * null-termination.
+ */
+ int32_t fCount;
+ /**
+ * Full size of the fBytes
+ */
+ int32_t fCapacity;
+ /**
+ * Unique hash value of this CollationKey
+ */
+ int32_t fHashCode;
+ /**
+ * Array to store the sortkey
+ */
+ uint8_t* fBytes;
+
+};
+
+inline UBool
+CollationKey::operator!=(const CollationKey& other) const
+{
+ return !(*this == other);
+}
+
+inline UBool
+CollationKey::isBogus() const
+{
+ return fBogus;
+}
+
+inline const uint8_t*
+CollationKey::getByteArray(int32_t &count) const
+{
+ count = fCount;
+ return fBytes;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h b/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h
new file mode 100644
index 00000000000..a3e1bd79263
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/stsearch.h
@@ -0,0 +1,518 @@
+/*
+**********************************************************************
+* Copyright (C) 2001-2007 IBM and others. All rights reserved.
+**********************************************************************
+* Date Name Description
+* 03/22/2000 helena Creation.
+**********************************************************************
+*/
+
+#ifndef STSEARCH_H
+#define STSEARCH_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Service for searching text based on RuleBasedCollator.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/tblcoll.h"
+#include "unicode/coleitr.h"
+#include "unicode/search.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ *
+ * <tt>StringSearch</tt> is a <tt>SearchIterator</tt> that provides
+ * language-sensitive text searching based on the comparison rules defined
+ * in a {@link RuleBasedCollator} object.
+ * StringSearch ensures that language eccentricity can be
+ * handled, e.g. for the German collator, characters &szlig; and SS will be matched
+ * if case is chosen to be ignored.
+ * See the <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+ * "ICU Collation Design Document"</a> for more information.
+ * <p>
+ * The algorithm implemented is a modified form of the Boyer Moore's search.
+ * For more information see
+ * <a href="http://icu-project.org/docs/papers/efficient_text_searching_in_java.html">
+ * "Efficient Text Searching in Java"</a>, published in <i>Java Report</i>
+ * in February, 1999, for further information on the algorithm.
+ * <p>
+ * There are 2 match options for selection:<br>
+ * Let S' be the sub-string of a text string S between the offsets start and
+ * end <start, end>.
+ * <br>
+ * A pattern string P matches a text string S at the offsets <start, end>
+ * if
+ * <pre>
+ * option 1. Some canonical equivalent of P matches some canonical equivalent
+ * of S'
+ * option 2. P matches S' and if P starts or ends with a combining mark,
+ * there exists no non-ignorable combining mark before or after S?
+ * in S respectively.
+ * </pre>
+ * Option 2. will be the default.
+ * <p>
+ * This search has APIs similar to that of other text iteration mechanisms
+ * such as the break iterators in <tt>BreakIterator</tt>. Using these
+ * APIs, it is easy to scan through text looking for all occurances of
+ * a given pattern. This search iterator allows changing of direction by
+ * calling a <tt>reset</tt> followed by a <tt>next</tt> or <tt>previous</tt>.
+ * Though a direction change can occur without calling <tt>reset</tt> first,
+ * this operation comes with some speed penalty.
+ * Match results in the forward direction will match the result matches in
+ * the backwards direction in the reverse order
+ * <p>
+ * <tt>SearchIterator</tt> provides APIs to specify the starting position
+ * within the text string to be searched, e.g. <tt>setOffset</tt>,
+ * <tt>preceding</tt> and <tt>following</tt>. Since the
+ * starting position will be set as it is specified, please take note that
+ * there are some danger points which the search may render incorrect
+ * results:
+ * <ul>
+ * <li> The midst of a substring that requires normalization.
+ * <li> If the following match is to be found, the position should not be the
+ * second character which requires to be swapped with the preceding
+ * character. Vice versa, if the preceding match is to be found,
+ * position to search from should not be the first character which
+ * requires to be swapped with the next character. E.g certain Thai and
+ * Lao characters require swapping.
+ * <li> If a following pattern match is to be found, any position within a
+ * contracting sequence except the first will fail. Vice versa if a
+ * preceding pattern match is to be found, a invalid starting point
+ * would be any character within a contracting sequence except the last.
+ * </ul>
+ * <p>
+ * A breakiterator can be used if only matches at logical breaks are desired.
+ * Using a breakiterator will only give you results that exactly matches the
+ * boundaries given by the breakiterator. For instance the pattern "e" will
+ * not be found in the string "\u00e9" if a character break iterator is used.
+ * <p>
+ * Options are provided to handle overlapping matches.
+ * E.g. In English, overlapping matches produces the result 0 and 2
+ * for the pattern "abab" in the text "ababab", where else mutually
+ * exclusive matches only produce the result of 0.
+ * <p>
+ * Though collator attributes will be taken into consideration while
+ * performing matches, there are no APIs here for setting and getting the
+ * attributes. These attributes can be set by getting the collator
+ * from <tt>getCollator</tt> and using the APIs in <tt>coll.h</tt>.
+ * Lastly to update StringSearch to the new collator attributes,
+ * reset() has to be called.
+ * <p>
+ * Restriction: <br>
+ * Currently there are no composite characters that consists of a
+ * character with combining class > 0 before a character with combining
+ * class == 0. However, if such a character exists in the future,
+ * StringSearch does not guarantee the results for option 1.
+ * <p>
+ * Consult the <tt>SearchIterator</tt> documentation for information on
+ * and examples of how to use instances of this class to implement text
+ * searching.
+ * <pre><code>
+ * UnicodeString target("The quick brown fox jumps over the lazy dog.");
+ * UnicodeString pattern("fox");
+ *
+ * UErrorCode error = U_ZERO_ERROR;
+ * StringSearch iter(pattern, target, Locale::getUS(), NULL, status);
+ * for (int pos = iter.first(error);
+ * pos != USEARCH_DONE;
+ * pos = iter.next(error))
+ * {
+ * printf("Found match at %d pos, length is %d\n", pos,
+ * iter.getMatchLength());
+ * }
+ * </code></pre>
+ * <p>
+ * Note, StringSearch is not to be subclassed.
+ * </p>
+ * @see SearchIterator
+ * @see RuleBasedCollator
+ * @since ICU 2.0
+ */
+
+class U_I18N_API StringSearch : public SearchIterator
+{
+public:
+
+ // public constructors and destructors --------------------------------
+
+ /**
+ * Creating a <tt>StringSearch</tt> instance using the argument locale
+ * language rule set. A collator will be created in the process, which
+ * will be owned by this instance and will be deleted during
+ * destruction
+ * @param pattern The text for which this object will search.
+ * @param text The text in which to search for the pattern.
+ * @param locale A locale which defines the language-sensitive
+ * comparison rules used to determine whether text in the
+ * pattern and target matches.
+ * @param breakiter A <tt>BreakIterator</tt> object used to constrain
+ * the matches that are found. Matches whose start and end
+ * indices in the target text are not boundaries as
+ * determined by the <tt>BreakIterator</tt> are
+ * ignored. If this behavior is not desired,
+ * <tt>NULL</tt> can be passed in instead.
+ * @param status for errors if any. If pattern or text is NULL, or if
+ * either the length of pattern or text is 0 then an
+ * U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ StringSearch(const UnicodeString &pattern, const UnicodeString &text,
+ const Locale &locale,
+ BreakIterator *breakiter,
+ UErrorCode &status);
+
+ /**
+ * Creating a <tt>StringSearch</tt> instance using the argument collator
+ * language rule set. Note, user retains the ownership of this collator,
+ * it does not get destroyed during this instance's destruction.
+ * @param pattern The text for which this object will search.
+ * @param text The text in which to search for the pattern.
+ * @param coll A <tt>RuleBasedCollator</tt> object which defines
+ * the language-sensitive comparison rules used to
+ * determine whether text in the pattern and target
+ * matches. User is responsible for the clearing of this
+ * object.
+ * @param breakiter A <tt>BreakIterator</tt> object used to constrain
+ * the matches that are found. Matches whose start and end
+ * indices in the target text are not boundaries as
+ * determined by the <tt>BreakIterator</tt> are
+ * ignored. If this behavior is not desired,
+ * <tt>NULL</tt> can be passed in instead.
+ * @param status for errors if any. If either the length of pattern or
+ * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ StringSearch(const UnicodeString &pattern,
+ const UnicodeString &text,
+ RuleBasedCollator *coll,
+ BreakIterator *breakiter,
+ UErrorCode &status);
+
+ /**
+ * Creating a <tt>StringSearch</tt> instance using the argument locale
+ * language rule set. A collator will be created in the process, which
+ * will be owned by this instance and will be deleted during
+ * destruction
+ * <p>
+ * Note: No parsing of the text within the <tt>CharacterIterator</tt>
+ * will be done during searching for this version. The block of text
+ * in <tt>CharacterIterator</tt> will be used as it is.
+ * @param pattern The text for which this object will search.
+ * @param text The text iterator in which to search for the pattern.
+ * @param locale A locale which defines the language-sensitive
+ * comparison rules used to determine whether text in the
+ * pattern and target matches. User is responsible for
+ * the clearing of this object.
+ * @param breakiter A <tt>BreakIterator</tt> object used to constrain
+ * the matches that are found. Matches whose start and end
+ * indices in the target text are not boundaries as
+ * determined by the <tt>BreakIterator</tt> are
+ * ignored. If this behavior is not desired,
+ * <tt>NULL</tt> can be passed in instead.
+ * @param status for errors if any. If either the length of pattern or
+ * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ StringSearch(const UnicodeString &pattern, CharacterIterator &text,
+ const Locale &locale,
+ BreakIterator *breakiter,
+ UErrorCode &status);
+
+ /**
+ * Creating a <tt>StringSearch</tt> instance using the argument collator
+ * language rule set. Note, user retains the ownership of this collator,
+ * it does not get destroyed during this instance's destruction.
+ * <p>
+ * Note: No parsing of the text within the <tt>CharacterIterator</tt>
+ * will be done during searching for this version. The block of text
+ * in <tt>CharacterIterator</tt> will be used as it is.
+ * @param pattern The text for which this object will search.
+ * @param text The text in which to search for the pattern.
+ * @param coll A <tt>RuleBasedCollator</tt> object which defines
+ * the language-sensitive comparison rules used to
+ * determine whether text in the pattern and target
+ * matches. User is responsible for the clearing of this
+ * object.
+ * @param breakiter A <tt>BreakIterator</tt> object used to constrain
+ * the matches that are found. Matches whose start and end
+ * indices in the target text are not boundaries as
+ * determined by the <tt>BreakIterator</tt> are
+ * ignored. If this behavior is not desired,
+ * <tt>NULL</tt> can be passed in instead.
+ * @param status for errors if any. If either the length of pattern or
+ * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ StringSearch(const UnicodeString &pattern, CharacterIterator &text,
+ RuleBasedCollator *coll,
+ BreakIterator *breakiter,
+ UErrorCode &status);
+
+ /**
+ * Copy constructor that creates a StringSearch instance with the same
+ * behavior, and iterating over the same text.
+ * @param that StringSearch instance to be copied.
+ * @stable ICU 2.0
+ */
+ StringSearch(const StringSearch &that);
+
+ /**
+ * Destructor. Cleans up the search iterator data struct.
+ * If a collator is created in the constructor, it will be destroyed here.
+ * @stable ICU 2.0
+ */
+ virtual ~StringSearch(void);
+
+ /**
+ * 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
+ */
+ StringSearch *clone() const;
+
+ // operator overloading ---------------------------------------------
+
+ /**
+ * Assignment operator. Sets this iterator to have the same behavior,
+ * and iterate over the same text, as the one passed in.
+ * @param that instance to be copied.
+ * @stable ICU 2.0
+ */
+ StringSearch & operator=(const StringSearch &that);
+
+ /**
+ * Equality operator.
+ * @param that instance to be compared.
+ * @return TRUE if both instances have the same attributes,
+ * breakiterators, collators and iterate over the same text
+ * while looking for the same pattern.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const SearchIterator &that) const;
+
+ // public get and set methods ----------------------------------------
+
+ /**
+ * Sets the index to point to the given position, and clears any state
+ * that's affected.
+ * <p>
+ * This method takes the argument index and sets the position in the text
+ * string accordingly without checking if the index is pointing to a
+ * valid starting point to begin searching.
+ * @param position within the text to be set. If position is less
+ * than or greater than the text range for searching,
+ * an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+ * @param status for errors if it occurs
+ * @stable ICU 2.0
+ */
+ virtual void setOffset(int32_t position, UErrorCode &status);
+
+ /**
+ * Return the current index in the text being searched.
+ * If the iteration has gone past the end of the text
+ * (or past the beginning for a backwards search), USEARCH_DONE
+ * is returned.
+ * @return current index in the text being searched.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(void) const;
+
+ /**
+ * Set the target text to be searched.
+ * Text iteration will hence begin at the start of the text string.
+ * This method is
+ * useful if you want to re-use an iterator to search for the same
+ * pattern within a different body of text.
+ * @param text text string to be searched
+ * @param status for errors if any. If the text length is 0 then an
+ * U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ virtual void setText(const UnicodeString &text, UErrorCode &status);
+
+ /**
+ * Set the target text to be searched.
+ * Text iteration will hence begin at the start of the text string.
+ * This method is
+ * useful if you want to re-use an iterator to search for the same
+ * pattern within a different body of text.
+ * Note: No parsing of the text within the <tt>CharacterIterator</tt>
+ * will be done during searching for this version. The block of text
+ * in <tt>CharacterIterator</tt> will be used as it is.
+ * @param text text string to be searched
+ * @param status for errors if any. If the text length is 0 then an
+ * U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ virtual void setText(CharacterIterator &text, UErrorCode &status);
+
+ /**
+ * Gets the collator used for the language rules.
+ * <p>
+ * Caller may modify but <b>must not</b> delete the <tt>RuleBasedCollator</tt>!
+ * Modifications to this collator will affect the original collator passed in to
+ * the <tt>StringSearch></tt> constructor or to setCollator, if any.
+ * @return collator used for string search
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator * getCollator() const;
+
+ /**
+ * Sets the collator used for the language rules. User retains the
+ * ownership of this collator, thus the responsibility of deletion lies
+ * with the user. This method causes internal data such as Boyer-Moore
+ * shift tables to be recalculated, but the iterator's position is
+ * unchanged.
+ * @param coll collator
+ * @param status for errors if any
+ * @stable ICU 2.0
+ */
+ void setCollator(RuleBasedCollator *coll, UErrorCode &status);
+
+ /**
+ * Sets the pattern used for matching.
+ * Internal data like the Boyer Moore table will be recalculated, but
+ * the iterator's position is unchanged.
+ * @param pattern search pattern to be found
+ * @param status for errors if any. If the pattern length is 0 then an
+ * U_ILLEGAL_ARGUMENT_ERROR is returned.
+ * @stable ICU 2.0
+ */
+ void setPattern(const UnicodeString &pattern, UErrorCode &status);
+
+ /**
+ * Gets the search pattern.
+ * @return pattern used for matching
+ * @stable ICU 2.0
+ */
+ const UnicodeString & getPattern() const;
+
+ // public methods ----------------------------------------------------
+
+ /**
+ * Reset the iteration.
+ * Search will begin at the start of the text string if a forward
+ * iteration is initiated before a backwards iteration. Otherwise if
+ * a backwards iteration is initiated before a forwards iteration, the
+ * search will begin at the end of the text string.
+ * @stable ICU 2.0
+ */
+ virtual void reset();
+
+ /**
+ * Returns a copy of StringSearch with the same behavior, and
+ * iterating over the same text, as this one. Note that all data will be
+ * replicated, except for the user-specified collator and the
+ * breakiterator.
+ * @return cloned object
+ * @stable ICU 2.0
+ */
+ virtual SearchIterator * safeClone(void) const;
+
+ /**
+ * 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();
+
+protected:
+
+ // protected method -------------------------------------------------
+
+ /**
+ * Search forward for matching text, starting at a given location.
+ * Clients should not call this method directly; instead they should
+ * call {@link SearchIterator#next }.
+ * <p>
+ * If a match is found, this method returns the index at which the match
+ * starts and calls {@link SearchIterator#setMatchLength } with the number
+ * of characters in the target text that make up the match. If no match
+ * is found, the method returns <tt>USEARCH_DONE</tt>.
+ * <p>
+ * The <tt>StringSearch</tt> is adjusted so that its current index
+ * (as returned by {@link #getOffset }) is the match position if one was
+ * found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the <tt>StringSearch</tt> will be adjusted to the index USEARCH_DONE.
+ * @param position The index in the target text at which the search
+ * starts
+ * @param status for errors if any occurs
+ * @return The index at which the matched text in the target starts, or
+ * USEARCH_DONE if no match was found.
+ * @stable ICU 2.0
+ */
+ virtual int32_t handleNext(int32_t position, UErrorCode &status);
+
+ /**
+ * Search backward for matching text, starting at a given location.
+ * Clients should not call this method directly; instead they should call
+ * <tt>SearchIterator.previous()</tt>, which this method overrides.
+ * <p>
+ * If a match is found, this method returns the index at which the match
+ * starts and calls {@link SearchIterator#setMatchLength } with the number
+ * of characters in the target text that make up the match. If no match
+ * is found, the method returns <tt>USEARCH_DONE</tt>.
+ * <p>
+ * The <tt>StringSearch</tt> is adjusted so that its current index
+ * (as returned by {@link #getOffset }) is the match position if one was
+ * found.
+ * If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+ * the <tt>StringSearch</tt> will be adjusted to the index USEARCH_DONE.
+ * @param position The index in the target text at which the search
+ * starts.
+ * @param status for errors if any occurs
+ * @return The index at which the matched text in the target starts, or
+ * USEARCH_DONE if no match was found.
+ * @stable ICU 2.0
+ */
+ virtual int32_t handlePrev(int32_t position, UErrorCode &status);
+
+private :
+ StringSearch(); // default constructor not implemented
+
+ // private data members ----------------------------------------------
+
+ /**
+ * RuleBasedCollator, contains exactly the same UCollator * in m_strsrch_
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator m_collator_;
+ /**
+ * Pattern text
+ * @stable ICU 2.0
+ */
+ UnicodeString m_pattern_;
+ /**
+ * String search struct data
+ * @stable ICU 2.0
+ */
+ UStringSearch *m_strsrch_;
+
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h b/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h
new file mode 100644
index 00000000000..ab7d9eae21b
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/tblcoll.h
@@ -0,0 +1,924 @@
+/*
+******************************************************************************
+* Copyright (C) 1996-2007, International Business Machines Corporation and
+* others. All Rights Reserved.
+******************************************************************************
+*/
+
+/**
+* File tblcoll.h
+*
+* Created by: Helena Shih
+*
+* Modification History:
+*
+* Date Name Description
+* 2/5/97 aliu Added streamIn and streamOut methods. Added
+* constructor which reads RuleBasedCollator object from
+* a binary file. Added writeToFile method which streams
+* RuleBasedCollator out to a binary file. The streamIn
+* and streamOut methods use istream and ostream objects
+* in binary mode.
+* 2/12/97 aliu Modified to use TableCollationData sub-object to
+* hold invariant data.
+* 2/13/97 aliu Moved several methods into this class from Collation.
+* Added a private RuleBasedCollator(Locale&) constructor,
+* to be used by Collator::createDefault(). General
+* clean up.
+* 2/20/97 helena Added clone, operator==, operator!=, operator=, and copy
+* constructor and getDynamicClassID.
+* 3/5/97 aliu Modified constructFromFile() to add parameter
+* specifying whether or not binary loading is to be
+* attempted. This is required for dynamic rule loading.
+* 05/07/97 helena Added memory allocation error detection.
+* 6/17/97 helena Added IDENTICAL strength for compare, changed getRules to
+* use MergeCollation::getPattern.
+* 6/20/97 helena Java class name change.
+* 8/18/97 helena Added internal API documentation.
+* 09/03/97 helena Added createCollationKeyValues().
+* 02/10/98 damiba Added compare with "length" parameter
+* 08/05/98 erm Synched with 1.2 version of RuleBasedCollator.java
+* 04/23/99 stephen Removed EDecompositionMode, merged with
+* Normalizer::EMode
+* 06/14/99 stephen Removed kResourceBundleSuffix
+* 11/02/99 helena Collator performance enhancements. Eliminates the
+* UnicodeString construction and special case for NO_OP.
+* 11/23/99 srl More performance enhancements. Updates to NormalizerIterator
+* internal state management.
+* 12/15/99 aliu Update to support Thai collation. Move NormalizerIterator
+* to implementation file.
+* 01/29/01 synwee Modified into a C++ wrapper which calls C API
+* (ucol.h)
+*/
+
+#ifndef TBLCOLL_H
+#define TBLCOLL_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: RuleBasedCollator class provides the simple implementation of Collator.
+ */
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/coll.h"
+#include "unicode/ucol.h"
+#include "unicode/sortkey.h"
+#include "unicode/normlzr.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+* @stable ICU 2.0
+*/
+class StringSearch;
+/**
+* @stable ICU 2.0
+*/
+class CollationElementIterator;
+
+/**
+ * The RuleBasedCollator class provides the simple implementation of
+ * Collator, using data-driven tables. The user can create a customized
+ * table-based collation.
+ * <P>
+ * <em>Important: </em>The ICU collation service has been reimplemented
+ * in order to achieve better performance and UCA compliance.
+ * For details, see the
+ * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+ * collation design document</a>.
+ * <p>
+ * RuleBasedCollator is a thin C++ wrapper over the C implementation.
+ * <p>
+ * For more information about the collation service see
+ * <a href="http://icu-project.org/userguide/Collate_Intro.html">the users guide</a>.
+ * <p>
+ * Collation service provides correct sorting orders for most locales supported in ICU.
+ * If specific data for a locale is not available, the orders eventually falls back
+ * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>.
+ * <p>
+ * Sort ordering may be customized by providing your own set of rules. For more on
+ * this subject see the <a href="http://icu-project.org/userguide/Collate_Customization.html">
+ * Collation customization</a> section of the users guide.
+ * <p>
+ * Note, RuleBasedCollator is not to be subclassed.
+ * @see Collator
+ * @version 2.0 11/15/2001
+ */
+class U_I18N_API RuleBasedCollator : public Collator
+{
+public:
+
+ // constructor -------------------------------------------------------------
+
+ /**
+ * RuleBasedCollator constructor. This takes the table rules and builds a
+ * collation table out of them. Please see RuleBasedCollator class
+ * description for more details on the collation rule syntax.
+ * @param rules the collation rules to build the collation table from.
+ * @param status reporting a success or an error.
+ * @see Locale
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator(const UnicodeString& rules, UErrorCode& status);
+
+ /**
+ * RuleBasedCollator constructor. This takes the table rules and builds a
+ * collation table out of them. Please see RuleBasedCollator class
+ * description for more details on the collation rule syntax.
+ * @param rules the collation rules to build the collation table from.
+ * @param collationStrength default strength for comparison
+ * @param status reporting a success or an error.
+ * @see Locale
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator(const UnicodeString& rules,
+ ECollationStrength collationStrength,
+ UErrorCode& status);
+
+ /**
+ * RuleBasedCollator constructor. This takes the table rules and builds a
+ * collation table out of them. Please see RuleBasedCollator class
+ * description for more details on the collation rule syntax.
+ * @param rules the collation rules to build the collation table from.
+ * @param decompositionMode the normalisation mode
+ * @param status reporting a success or an error.
+ * @see Locale
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator(const UnicodeString& rules,
+ UColAttributeValue decompositionMode,
+ UErrorCode& status);
+
+ /**
+ * RuleBasedCollator constructor. This takes the table rules and builds a
+ * collation table out of them. Please see RuleBasedCollator class
+ * description for more details on the collation rule syntax.
+ * @param rules the collation rules to build the collation table from.
+ * @param collationStrength default strength for comparison
+ * @param decompositionMode the normalisation mode
+ * @param status reporting a success or an error.
+ * @see Locale
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator(const UnicodeString& rules,
+ ECollationStrength collationStrength,
+ UColAttributeValue decompositionMode,
+ UErrorCode& status);
+
+ /**
+ * Copy constructor.
+ * @param other the RuleBasedCollator object to be copied
+ * @see Locale
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator(const RuleBasedCollator& other);
+
+
+ /** Opens a collator from a collator binary image created using
+ * cloneBinary. Binary image used in instantiation of the
+ * collator remains owned by the user and should stay around for
+ * the lifetime of the collator. The API also takes a base collator
+ * which usualy should be UCA.
+ * @param bin binary image owned by the user and required through the
+ * lifetime of the collator
+ * @param length size of the image. If negative, the API will try to
+ * figure out the length of the image
+ * @param base fallback collator, usually UCA. Base is required to be
+ * present through the lifetime of the collator. Currently
+ * it cannot be NULL.
+ * @param status for catching errors
+ * @return newly created collator
+ * @see cloneBinary
+ * @stable ICU 3.4
+ */
+ RuleBasedCollator(const uint8_t *bin, int32_t length,
+ const RuleBasedCollator *base,
+ UErrorCode &status);
+ // destructor --------------------------------------------------------------
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~RuleBasedCollator();
+
+ // public methods ----------------------------------------------------------
+
+ /**
+ * Assignment operator.
+ * @param other other RuleBasedCollator object to compare with.
+ * @stable ICU 2.0
+ */
+ RuleBasedCollator& operator=(const RuleBasedCollator& other);
+
+ /**
+ * Returns true if argument is the same as this object.
+ * @param other Collator object to be compared.
+ * @return true if arguments is the same as this object.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const Collator& other) const;
+
+ /**
+ * Returns true if argument is not the same as this object.
+ * @param other Collator object to be compared
+ * @return returns true if argument is not the same as this object.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator!=(const Collator& other) const;
+
+ /**
+ * Makes a deep copy of the object.
+ * The caller owns the returned object.
+ * @return the cloned object.
+ * @stable ICU 2.0
+ */
+ virtual Collator* clone(void) const;
+
+ /**
+ * Creates a collation element iterator for the source string. The caller of
+ * this method is responsible for the memory management of the return
+ * pointer.
+ * @param source the string over which the CollationElementIterator will
+ * iterate.
+ * @return the collation element iterator of the source string using this as
+ * the based Collator.
+ * @stable ICU 2.2
+ */
+ virtual CollationElementIterator* createCollationElementIterator(
+ const UnicodeString& source) const;
+
+ /**
+ * Creates a collation element iterator for the source. The caller of this
+ * method is responsible for the memory management of the returned pointer.
+ * @param source the CharacterIterator which produces the characters over
+ * which the CollationElementItgerator will iterate.
+ * @return the collation element iterator of the source using this as the
+ * based Collator.
+ * @stable ICU 2.2
+ */
+ virtual CollationElementIterator* createCollationElementIterator(
+ const CharacterIterator& source) const;
+
+ /**
+ * Compares a range of character data stored in two different strings based
+ * on the collation rules. Returns information about whether a string is
+ * less than, greater than or equal to another string in a language.
+ * This can be overriden in a subclass.
+ * @param source the source string.
+ * @param target the target string to be compared with the source string.
+ * @return the comparison result. GREATER if the source string is greater
+ * than the target string, LESS if the source is less than the
+ * target. Otherwise, returns EQUAL.
+ * @deprecated ICU 2.6 Use overload with UErrorCode&
+ */
+ virtual EComparisonResult compare(const UnicodeString& source,
+ const UnicodeString& target) const;
+
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different strings. Returns information about whether a string is less
+ * than, greater than or equal to another string.
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source is greater
+ * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
+ * than target
+ * @stable ICU 2.6
+ **/
+ virtual UCollationResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ UErrorCode &status) const;
+
+ /**
+ * Compares a range of character data stored in two different strings based
+ * on the collation rules up to the specified length. Returns information
+ * about whether a string is less than, greater than or equal to another
+ * string in a language. This can be overriden in a subclass.
+ * @param source the source string.
+ * @param target the target string to be compared with the source string.
+ * @param length compares up to the specified length
+ * @return the comparison result. GREATER if the source string is greater
+ * than the target string, LESS if the source is less than the
+ * target. Otherwise, returns EQUAL.
+ * @deprecated ICU 2.6 Use overload with UErrorCode&
+ */
+ virtual EComparisonResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ int32_t length) const;
+
+ /**
+ * Does the same thing as compare but limits the comparison to a specified
+ * length
+ * @param source the source string to be compared with.
+ * @param target the string that is to be compared with the source string.
+ * @param length the length the comparison is limited to
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source (up to the specified
+ * length) is greater than target; UCOL_EQUAL if source (up to specified
+ * length) is equal to target; UCOL_LESS if source (up to the specified
+ * length) is less than target.
+ * @stable ICU 2.6
+ */
+ virtual UCollationResult compare(const UnicodeString& source,
+ const UnicodeString& target,
+ int32_t length,
+ UErrorCode &status) const;
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different string arrays. Returns information about whether a string array
+ * is less than, greater than or equal to another string array.
+ * <p>Example of use:
+ * <pre>
+ * . UChar ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC"
+ * . UChar abc[] = {0x61, 0x62, 0x63, 0}; // = "abc"
+ * . UErrorCode status = U_ZERO_ERROR;
+ * . Collator *myCollation =
+ * . Collator::createInstance(Locale::US, status);
+ * . if (U_FAILURE(status)) return;
+ * . myCollation->setStrength(Collator::PRIMARY);
+ * . // result would be Collator::EQUAL ("abc" == "ABC")
+ * . // (no primary difference between "abc" and "ABC")
+ * . Collator::EComparisonResult result =
+ * . myCollation->compare(abc, 3, ABC, 3);
+ * . myCollation->setStrength(Collator::TERTIARY);
+ * . // result would be Collator::LESS ("abc" &lt;&lt;&lt; "ABC")
+ * . // (with tertiary difference between "abc" and "ABC")
+ * . result = myCollation->compare(abc, 3, ABC, 3);
+ * </pre>
+ * @param source the source string array to be compared with.
+ * @param sourceLength the length of the source string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param target the string that is to be compared with the source string.
+ * @param targetLength the length of the target string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @return Returns a byte value. GREATER if source is greater than target;
+ * EQUAL if source is equal to target; LESS if source is less than
+ * target
+ * @deprecated ICU 2.6 Use overload with UErrorCode&
+ */
+ virtual EComparisonResult compare(const UChar* source, int32_t sourceLength,
+ const UChar* target, int32_t targetLength)
+ const;
+
+ /**
+ * The comparison function compares the character data stored in two
+ * different string arrays. Returns information about whether a string array
+ * is less than, greater than or equal to another string array.
+ * @param source the source string array to be compared with.
+ * @param sourceLength the length of the source string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param target the string that is to be compared with the source string.
+ * @param targetLength the length of the target string array. If this value
+ * is equal to -1, the string array is null-terminated.
+ * @param status possible error code
+ * @return Returns an enum value. UCOL_GREATER if source is greater
+ * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less
+ * than target
+ * @stable ICU 2.6
+ */
+ virtual UCollationResult compare(const UChar* source, int32_t sourceLength,
+ const UChar* target, int32_t targetLength,
+ UErrorCode &status) const;
+
+ /**
+ * Transforms a specified region of the string into a series of characters
+ * that can be compared with CollationKey.compare. Use a CollationKey when
+ * you need to do repeated comparisions on the same string. For a single
+ * comparison the compare method will be faster.
+ * @param source the source string.
+ * @param key the transformed key of the source string.
+ * @param status the error code status.
+ * @return the transformed key.
+ * @see CollationKey
+ * @deprecated ICU 2.8 Use getSortKey(...) instead
+ */
+ virtual CollationKey& getCollationKey(const UnicodeString& source,
+ CollationKey& key,
+ UErrorCode& status) const;
+
+ /**
+ * Transforms a specified region of the string into a series of characters
+ * that can be compared with CollationKey.compare. Use a CollationKey when
+ * you need to do repeated comparisions on the same string. For a single
+ * comparison the compare method will be faster.
+ * @param source the source string.
+ * @param sourceLength the length of the source string.
+ * @param key the transformed key of the source string.
+ * @param status the error code status.
+ * @return the transformed key.
+ * @see CollationKey
+ * @deprecated ICU 2.8 Use getSortKey(...) instead
+ */
+ virtual CollationKey& getCollationKey(const UChar *source,
+ int32_t sourceLength,
+ CollationKey& key,
+ UErrorCode& status) const;
+
+ /**
+ * Generates the hash code for the rule-based collation object.
+ * @return the hash code.
+ * @stable ICU 2.0
+ */
+ virtual int32_t hashCode(void) const;
+
+ /**
+ * Gets the locale of the Collator
+ * @param type can be either requested, valid or actual locale. For more
+ * information see the definition of ULocDataLocaleType in
+ * uloc.h
+ * @param status the error code status.
+ * @return locale where the collation data lives. If the collator
+ * was instantiated from rules, locale is empty.
+ * @deprecated ICU 2.8 likely to change in ICU 3.0, based on feedback
+ */
+ virtual const Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const;
+
+ /**
+ * Gets the table-based rules for the collation object.
+ * @return returns the collation rules that the table collation object was
+ * created from.
+ * @stable ICU 2.0
+ */
+ const UnicodeString& getRules(void) const;
+
+ /**
+ * Gets the version information for a Collator.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+ virtual void getVersion(UVersionInfo info) const;
+
+ /**
+ * Return the maximum length of any expansion sequences that end with the
+ * specified comparison order.
+ * @param order a collation order returned by previous or next.
+ * @return maximum size of the expansion sequences ending with the collation
+ * element or 1 if collation element does not occur at the end of
+ * any expansion sequence
+ * @see CollationElementIterator#getMaxExpansion
+ * @stable ICU 2.0
+ */
+ int32_t getMaxExpansion(int32_t order) const;
+
+ /**
+ * 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 2.0
+ */
+ virtual UClassID getDynamicClassID(void) const;
+
+ /**
+ * Returns 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() ==
+ * Derived::getStaticClassID()) ...
+ * </pre>
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Returns the binary format of the class's rules. The format is that of
+ * .col files.
+ * @param length Returns the length of the data, in bytes
+ * @param status the error code status.
+ * @return memory, owned by the caller, of size 'length' bytes.
+ * @stable ICU 2.2
+ */
+ uint8_t *cloneRuleData(int32_t &length, UErrorCode &status);
+
+
+ /** Creates a binary image of a collator. This binary image can be stored and
+ * later used to instantiate a collator using ucol_openBinary.
+ * This API supports preflighting.
+ * @param buffer a fill-in buffer to receive the binary image
+ * @param capacity capacity of the destination buffer
+ * @param status for catching errors
+ * @return size of the image
+ * @see ucol_openBinary
+ * @stable ICU 3.4
+ */
+ int32_t cloneBinary(uint8_t *buffer, int32_t capacity, UErrorCode &status);
+
+ /**
+ * Returns current rules. Delta defines whether full rules are returned or
+ * just the tailoring.
+ * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
+ * @param buffer UnicodeString to store the result rules
+ * @stable ICU 2.2
+ */
+ void getRules(UColRuleOption delta, UnicodeString &buffer);
+
+ /**
+ * Universal attribute setter
+ * @param attr attribute type
+ * @param value attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @stable ICU 2.2
+ */
+ virtual void setAttribute(UColAttribute attr, UColAttributeValue value,
+ UErrorCode &status);
+
+ /**
+ * Universal attribute getter.
+ * @param attr attribute type
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @return attribute value
+ * @stable ICU 2.2
+ */
+ virtual UColAttributeValue getAttribute(UColAttribute attr,
+ UErrorCode &status);
+
+ /**
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param varTop one or more (if contraction) UChars to which the variable top should be set
+ * @param len length of variable top string. If -1 it is considered to be zero terminated.
+ * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
+ * @stable ICU 2.0
+ */
+ virtual uint32_t setVariableTop(const UChar *varTop, int32_t len, UErrorCode &status);
+
+ /**
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param varTop an UnicodeString size 1 or more (if contraction) of UChars to which the variable top should be set
+ * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits. Lower 16 bits are undefined
+ * @stable ICU 2.0
+ */
+ virtual uint32_t setVariableTop(const UnicodeString varTop, UErrorCode &status);
+
+ /**
+ * Sets the variable top to a collation element value supplied. Variable top is set to the upper 16 bits.
+ * Lower 16 bits are ignored.
+ * @param varTop CE value, as returned by setVariableTop or ucol)getVariableTop
+ * @param status error code (not changed by function)
+ * @stable ICU 2.0
+ */
+ virtual void setVariableTop(const uint32_t varTop, UErrorCode &status);
+
+ /**
+ * Gets the variable top value of a Collator.
+ * Lower 16 bits are undefined and should be ignored.
+ * @param status error code (not changed by function). If error code is set, the return value is undefined.
+ * @stable ICU 2.0
+ */
+ virtual uint32_t getVariableTop(UErrorCode &status) const;
+
+ /**
+ * Get an UnicodeSet that contains all the characters and sequences tailored in
+ * this collator.
+ * @param status error code of the operation
+ * @return a pointer to a UnicodeSet object containing all the
+ * code points and sequences that may sort differently than
+ * in the UCA. The object must be disposed of by using delete
+ * @stable ICU 2.4
+ */
+ virtual UnicodeSet *getTailoredSet(UErrorCode &status) const;
+
+ /**
+ * Thread safe cloning operation.
+ * @return pointer to the new clone, user should remove it.
+ * @stable ICU 2.2
+ */
+ virtual Collator* safeClone(void);
+
+ /**
+ * Get the sort key as an array of bytes from an UnicodeString.
+ * @param source string to be processed.
+ * @param result buffer to store result in. If NULL, number of bytes needed
+ * will be returned.
+ * @param resultLength length of the result buffer. If if not enough the
+ * buffer will be filled to capacity.
+ * @return Number of bytes needed for storing the sort key
+ * @stable ICU 2.0
+ */
+ virtual int32_t getSortKey(const UnicodeString& source, uint8_t *result,
+ int32_t resultLength) const;
+
+ /**
+ * Get the sort key as an array of bytes from an UChar buffer.
+ * @param source string to be processed.
+ * @param sourceLength length of string to be processed. If -1, the string
+ * is 0 terminated and length will be decided by the function.
+ * @param result buffer to store result in. If NULL, number of bytes needed
+ * will be returned.
+ * @param resultLength length of the result buffer. If if not enough the
+ * buffer will be filled to capacity.
+ * @return Number of bytes needed for storing the sort key
+ * @stable ICU 2.2
+ */
+ virtual int32_t getSortKey(const UChar *source, int32_t sourceLength,
+ uint8_t *result, int32_t resultLength) const;
+
+ /**
+ * Determines the minimum strength that will be use in comparison or
+ * transformation.
+ * <p>E.g. with strength == SECONDARY, the tertiary difference is ignored
+ * <p>E.g. with strength == PRIMARY, the secondary and tertiary difference
+ * are ignored.
+ * @return the current comparison level.
+ * @see RuleBasedCollator#setStrength
+ * @deprecated ICU 2.6 Use getAttribute(UCOL_STRENGTH...) instead
+ */
+ virtual ECollationStrength getStrength(void) const;
+
+ /**
+ * Sets the minimum strength to be used in comparison or transformation.
+ * @see RuleBasedCollator#getStrength
+ * @param newStrength the new comparison level.
+ * @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead
+ */
+ virtual void setStrength(ECollationStrength newStrength);
+
+private:
+
+ // private static constants -----------------------------------------------
+
+ enum {
+ /* need look up in .commit() */
+ CHARINDEX = 0x70000000,
+ /* Expand index follows */
+ EXPANDCHARINDEX = 0x7E000000,
+ /* contract indexes follows */
+ CONTRACTCHARINDEX = 0x7F000000,
+ /* unmapped character values */
+ UNMAPPED = 0xFFFFFFFF,
+ /* primary strength increment */
+ PRIMARYORDERINCREMENT = 0x00010000,
+ /* secondary strength increment */
+ SECONDARYORDERINCREMENT = 0x00000100,
+ /* tertiary strength increment */
+ TERTIARYORDERINCREMENT = 0x00000001,
+ /* mask off anything but primary order */
+ PRIMARYORDERMASK = 0xffff0000,
+ /* mask off anything but secondary order */
+ SECONDARYORDERMASK = 0x0000ff00,
+ /* mask off anything but tertiary order */
+ TERTIARYORDERMASK = 0x000000ff,
+ /* mask off ignorable char order */
+ IGNORABLEMASK = 0x0000ffff,
+ /* use only the primary difference */
+ PRIMARYDIFFERENCEONLY = 0xffff0000,
+ /* use only the primary and secondary difference */
+ SECONDARYDIFFERENCEONLY = 0xffffff00,
+ /* primary order shift */
+ PRIMARYORDERSHIFT = 16,
+ /* secondary order shift */
+ SECONDARYORDERSHIFT = 8,
+ /* starting value for collation elements */
+ COLELEMENTSTART = 0x02020202,
+ /* testing mask for primary low element */
+ PRIMARYLOWZEROMASK = 0x00FF0000,
+ /* reseting value for secondaries and tertiaries */
+ RESETSECONDARYTERTIARY = 0x00000202,
+ /* reseting value for tertiaries */
+ RESETTERTIARY = 0x00000002,
+
+ PRIMIGNORABLE = 0x0202
+ };
+
+ // private data members ---------------------------------------------------
+
+ UBool dataIsOwned;
+
+ UBool isWriteThroughAlias;
+
+ /**
+ * c struct for collation. All initialisation for it has to be done through
+ * setUCollator().
+ */
+ UCollator *ucollator;
+
+ /**
+ * Rule UnicodeString
+ */
+ UnicodeString urulestring;
+
+ // friend classes --------------------------------------------------------
+
+ /**
+ * Used to iterate over collation elements in a character source.
+ */
+ friend class CollationElementIterator;
+
+ /**
+ * Collator ONLY needs access to RuleBasedCollator(const Locale&,
+ * UErrorCode&)
+ */
+ friend class Collator;
+
+ /**
+ * Searching over collation elements in a character source
+ */
+ friend class StringSearch;
+
+ // private constructors --------------------------------------------------
+
+ /**
+ * Default constructor
+ */
+ RuleBasedCollator();
+
+ /**
+ * RuleBasedCollator constructor. This constructor takes a locale. The
+ * only caller of this class should be Collator::createInstance(). If
+ * createInstance() happens to know that the requested locale's collation is
+ * implemented as a RuleBasedCollator, it can then call this constructor.
+ * OTHERWISE IT SHOULDN'T, since this constructor ALWAYS RETURNS A VALID
+ * COLLATION TABLE. It does this by falling back to defaults.
+ * @param desiredLocale locale used
+ * @param status error code status
+ */
+ RuleBasedCollator(const Locale& desiredLocale, UErrorCode& status);
+
+ /**
+ * common constructor implementation
+ *
+ * @param rules the collation rules to build the collation table from.
+ * @param collationStrength default strength for comparison
+ * @param decompositionMode the normalisation mode
+ * @param status reporting a success or an error.
+ */
+ void
+ construct(const UnicodeString& rules,
+ UColAttributeValue collationStrength,
+ UColAttributeValue decompositionMode,
+ UErrorCode& status);
+
+ // private methods -------------------------------------------------------
+
+ /**
+ * Creates the c struct for ucollator
+ * @param locale desired locale
+ * @param status error status
+ */
+ void setUCollator(const Locale& locale, UErrorCode& status);
+
+ /**
+ * Creates the c struct for ucollator
+ * @param locale desired locale name
+ * @param status error status
+ */
+ void setUCollator(const char* locale, UErrorCode& status);
+
+ /**
+ * Creates the c struct for ucollator. This used internally by StringSearch.
+ * Hence the responsibility of cleaning up the ucollator is not done by
+ * this RuleBasedCollator. The isDataOwned flag is set to FALSE.
+ * @param collator new ucollator data
+ * @param rules corresponding collation rules
+ */
+ void setUCollator(UCollator *collator);
+
+public:
+ /**
+ * Get UCollator data struct. Used only by StringSearch & intltest.
+ * @return UCollator data struct
+ * @internal
+ */
+ const UCollator * getUCollator();
+
+protected:
+ /**
+ * Used internally by registraton to define the requested and valid locales.
+ * @param requestedLocale the requsted locale
+ * @param validLocale the valid locale
+ * @internal
+ */
+ virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale);
+
+private:
+
+ // if not owned and not a write through alias, copy the ucollator
+ void checkOwned(void);
+
+ // utility to init rule string used by checkOwned and construct
+ void setRuleStringFromCollator();
+
+ /**
+ * Converts C's UCollationResult to EComparisonResult
+ * @param result member of the enum UComparisonResult
+ * @return EComparisonResult equivalent of UCollationResult
+ * @deprecated ICU 2.6. We will not need it.
+ */
+ Collator::EComparisonResult getEComparisonResult(
+ const UCollationResult &result) const;
+
+ /**
+ * Converts C's UCollationStrength to ECollationStrength
+ * @param strength member of the enum UCollationStrength
+ * @return ECollationStrength equivalent of UCollationStrength
+ */
+ Collator::ECollationStrength getECollationStrength(
+ const UCollationStrength &strength) const;
+
+ /**
+ * Converts C++'s ECollationStrength to UCollationStrength
+ * @param strength member of the enum ECollationStrength
+ * @return UCollationStrength equivalent of ECollationStrength
+ */
+ UCollationStrength getUCollationStrength(
+ const Collator::ECollationStrength &strength) const;
+};
+
+// inline method implementation ---------------------------------------------
+
+inline void RuleBasedCollator::setUCollator(const Locale &locale,
+ UErrorCode &status)
+{
+ setUCollator(locale.getName(), status);
+}
+
+
+inline void RuleBasedCollator::setUCollator(UCollator *collator)
+{
+
+ if (ucollator && dataIsOwned) {
+ ucol_close(ucollator);
+ }
+ ucollator = collator;
+ dataIsOwned = FALSE;
+ isWriteThroughAlias = TRUE;
+ setRuleStringFromCollator();
+}
+
+inline const UCollator * RuleBasedCollator::getUCollator()
+{
+ return ucollator;
+}
+
+inline Collator::EComparisonResult RuleBasedCollator::getEComparisonResult(
+ const UCollationResult &result) const
+{
+ switch (result)
+ {
+ case UCOL_LESS :
+ return Collator::LESS;
+ case UCOL_EQUAL :
+ return Collator::EQUAL;
+ default :
+ return Collator::GREATER;
+ }
+}
+
+inline Collator::ECollationStrength RuleBasedCollator::getECollationStrength(
+ const UCollationStrength &strength) const
+{
+ switch (strength)
+ {
+ case UCOL_PRIMARY :
+ return Collator::PRIMARY;
+ case UCOL_SECONDARY :
+ return Collator::SECONDARY;
+ case UCOL_TERTIARY :
+ return Collator::TERTIARY;
+ case UCOL_QUATERNARY :
+ return Collator::QUATERNARY;
+ default :
+ return Collator::IDENTICAL;
+ }
+}
+
+inline UCollationStrength RuleBasedCollator::getUCollationStrength(
+ const Collator::ECollationStrength &strength) const
+{
+ switch (strength)
+ {
+ case Collator::PRIMARY :
+ return UCOL_PRIMARY;
+ case Collator::SECONDARY :
+ return UCOL_SECONDARY;
+ case Collator::TERTIARY :
+ return UCOL_TERTIARY;
+ case Collator::QUATERNARY :
+ return UCOL_QUATERNARY;
+ default :
+ return UCOL_IDENTICAL;
+ }
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/timezone.h b/Build/source/libs/icu-xetex/i18n/unicode/timezone.h
new file mode 100644
index 00000000000..e771cb90855
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/timezone.h
@@ -0,0 +1,726 @@
+/*************************************************************************
+* Copyright (c) 1997-2007, International Business Machines Corporation
+* and others. All Rights Reserved.
+**************************************************************************
+*
+* File TIMEZONE.H
+*
+* Modification History:
+*
+* Date Name Description
+* 04/21/97 aliu Overhauled header.
+* 07/09/97 helena Changed createInstance to createDefault.
+* 08/06/97 aliu Removed dependency on internal header for Hashtable.
+* 08/10/98 stephen Changed getDisplayName() API conventions to match
+* 08/19/98 stephen Changed createTimeZone() to never return 0
+* 09/02/98 stephen Sync to JDK 1.2 8/31
+* - Added getOffset(... monthlen ...)
+* - Added hasSameRules()
+* 09/15/98 stephen Added getStaticClassID
+* 12/03/99 aliu Moved data out of static table into icudata.dll.
+* Hashtable replaced by new static data structures.
+* 12/14/99 aliu Made GMT public.
+* 08/15/01 grhoten Made GMT private and added the getGMT() function
+**************************************************************************
+*/
+
+#ifndef TIMEZONE_H
+#define TIMEZONE_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: TimeZone object
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/ures.h"
+
+U_NAMESPACE_BEGIN
+
+class StringEnumeration;
+
+/**
+ *
+ * <code>TimeZone</code> represents a time zone offset, and also figures out daylight
+ * savings.
+ *
+ * <p>
+ * Typically, you get a <code>TimeZone</code> using <code>createDefault</code>
+ * which creates a <code>TimeZone</code> based on the time zone where the program
+ * is running. For example, for a program running in Japan, <code>createDefault</code>
+ * creates a <code>TimeZone</code> object based on Japanese Standard Time.
+ *
+ * <p>
+ * You can also get a <code>TimeZone</code> using <code>createTimeZone</code> along
+ * with a time zone ID. For instance, the time zone ID for the Pacific
+ * Standard Time zone is "PST". So, you can get a PST <code>TimeZone</code> object
+ * with:
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * TimeZone *tz = TimeZone::createTimeZone("PST");
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ * You can use <code>getAvailableIDs</code> method to iterate through
+ * all the supported time zone IDs. You can then choose a
+ * supported ID to get a <code>TimeZone</code>.
+ * If the time zone you want is not represented by one of the
+ * supported IDs, then you can create a custom time zone ID with
+ * the following syntax:
+ *
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * GMT[+|-]hh[[:]mm]
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * For example, you might specify GMT+14:00 as a custom
+ * time zone ID. The <code>TimeZone</code> that is returned
+ * when you specify a custom time zone ID does not include
+ * daylight savings time.
+ *
+ * TimeZone is an abstract class representing a time zone. A TimeZone is needed for
+ * Calendar to produce local time for a particular time zone. A TimeZone comprises
+ * three basic pieces of information:
+ * <ul>
+ * <li>A time zone offset; that, is the number of milliseconds to add or subtract
+ * from a time expressed in terms of GMT to convert it to the same time in that
+ * time zone (without taking daylight savings time into account).</li>
+ * <li>Logic necessary to take daylight savings time into account if daylight savings
+ * time is observed in that time zone (e.g., the days and hours on which daylight
+ * savings time begins and ends).</li>
+ * <li>An ID. This is a text string that uniquely identifies the time zone.</li>
+ * </ul>
+ *
+ * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle
+ * daylight savings time and GMT offset in different ways. Currently we only have one
+ * TimeZone subclass: SimpleTimeZone.)
+ * <P>
+ * The TimeZone class contains a static list containing a TimeZone object for every
+ * combination of GMT offset and daylight-savings time rules currently in use in the
+ * world, each with a unique ID. Each ID consists of a region (usually a continent or
+ * ocean) and a city in that region, separated by a slash, (for example, Pacific
+ * Standard Time is "America/Los_Angeles.") Because older versions of this class used
+ * three- or four-letter abbreviations instead, there is also a table that maps the older
+ * abbreviations to the newer ones (for example, "PST" maps to "America/LosAngeles").
+ * Anywhere the API requires an ID, you can use either form.
+ * <P>
+ * To create a new TimeZone, you call the factory function TimeZone::createTimeZone()
+ * and pass it a time zone ID. You can use the createEnumeration() function to
+ * obtain a list of all the time zone IDs recognized by createTimeZone().
+ * <P>
+ * You can also use TimeZone::createDefault() to create a TimeZone. This function uses
+ * platform-specific APIs to produce a TimeZone for the time zone corresponding to
+ * the client's computer's physical location. For example, if you're in Japan (assuming
+ * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone
+ * for Japanese Standard Time ("Asia/Tokyo").
+ */
+class U_I18N_API TimeZone : public UObject {
+public:
+ /**
+ * @stable ICU 2.0
+ */
+ virtual ~TimeZone();
+
+ /**
+ * The GMT time zone has a raw offset of zero and does not use daylight
+ * savings time. This is a commonly used time zone.
+ * @return the GMT time zone.
+ * @stable ICU 2.0
+ */
+ static const TimeZone* U_EXPORT2 getGMT(void);
+
+ /**
+ * Creates a <code>TimeZone</code> for the given ID.
+ * @param ID the ID for a <code>TimeZone</code>, either an abbreviation such as
+ * "PST", a full name such as "America/Los_Angeles", or a custom ID
+ * such as "GMT-8:00".
+ * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID
+ * cannot be understood. Return result guaranteed to be non-null. If you
+ * require that the specific zone asked for be returned, check the ID of the
+ * return result.
+ * @stable ICU 2.0
+ */
+ static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID);
+
+ /**
+ * Returns an enumeration over all recognized time zone IDs. (i.e.,
+ * all strings that createTimeZone() accepts)
+ *
+ * @return an enumeration object, owned by the caller.
+ * @stable ICU 2.4
+ */
+ static StringEnumeration* U_EXPORT2 createEnumeration();
+
+ /**
+ * Returns an enumeration over time zone IDs with a given raw
+ * offset from GMT. There may be several times zones with the
+ * same GMT offset that differ in the way they handle daylight
+ * savings time. For example, the state of Arizona doesn't
+ * observe daylight savings time. If you ask for the time zone
+ * IDs corresponding to GMT-7:00, you'll get back an enumeration
+ * over two time zone IDs: "America/Denver," which corresponds to
+ * Mountain Standard Time in the winter and Mountain Daylight Time
+ * in the summer, and "America/Phoenix", which corresponds to
+ * Mountain Standard Time year-round, even in the summer.
+ *
+ * @param rawOffset an offset from GMT in milliseconds, ignoring
+ * the effect of daylight savings time, if any
+ * @return an enumeration object, owned by the caller
+ * @stable ICU 2.4
+ */
+ static StringEnumeration* U_EXPORT2 createEnumeration(int32_t rawOffset);
+
+ /**
+ * Returns an enumeration over time zone IDs associated with the
+ * given country. Some zones are affiliated with no country
+ * (e.g., "UTC"); these may also be retrieved, as a group.
+ *
+ * @param country The ISO 3166 two-letter country code, or NULL to
+ * retrieve zones not affiliated with any country.
+ * @return an enumeration object, owned by the caller
+ * @stable ICU 2.4
+ */
+ static StringEnumeration* U_EXPORT2 createEnumeration(const char* country);
+
+#ifdef U_USE_TIMEZONE_OBSOLETE_2_8
+ /**
+ * Returns a list of time zone IDs, one for each time zone with a given GMT offset.
+ * The return value is a list because there may be several times zones with the same
+ * GMT offset that differ in the way they handle daylight savings time. For example,
+ * the state of Arizona doesn't observe Daylight Savings time. So if you ask for
+ * the time zone IDs corresponding to GMT-7:00, you'll get back two time zone IDs:
+ * "America/Denver," which corresponds to Mountain Standard Time in the winter and
+ * Mountain Daylight Time in the summer, and "America/Phoenix", which corresponds to
+ * Mountain Standard Time year-round, even in the summer.
+ * <P>
+ * The caller owns the list that is returned, but does not own the strings contained
+ * in that list. Delete the array with uprv_free(), but DON'T delete the elements in the array.
+ *
+ * <p>NOTE: uprv_free() is declared in the private header source/common/cmemory.h.
+ *
+ * @param rawOffset An offset from GMT in milliseconds.
+ * @param numIDs Receives the number of items in the array that is returned.
+ * @return An array of UnicodeString pointers, where each UnicodeString is
+ * a time zone ID for a time zone with the given GMT offset. If
+ * there is no timezone that matches the GMT offset
+ * specified, NULL is returned.
+ * @obsolete ICU 2.8. Use createEnumeration(int32_t) instead since this API will be removed in that release.
+ */
+ static const UnicodeString** createAvailableIDs(int32_t rawOffset, int32_t& numIDs);
+
+ /**
+ * Returns a list of time zone IDs associated with the given
+ * country. Some zones are affiliated with no country (e.g.,
+ * "UTC"); these may also be retrieved, as a group.
+ *
+ * <P>The caller owns the list that is returned, but does not own
+ * the strings contained in that list. Delete the array with uprv_free(), but
+ * <b>DON'T</b> delete the elements in the array.
+ *
+ * <p>NOTE: uprv_free() is declared in the private header source/common/cmemory.h.
+ *
+ * @param country The ISO 3166 two-letter country code, or NULL to
+ * retrieve zones not affiliated with any country.
+ * @param numIDs Receives the number of items in the array that is
+ * returned.
+ * @return An array of UnicodeString pointers, where each
+ * UnicodeString is a time zone ID for a time zone with the given
+ * country. If there is no timezone that matches the country
+ * specified, NULL is returned.
+ * @obsolete ICU 2.8. Use createEnumeration(const char*) instead since this API will be removed in that release.
+ */
+ static const UnicodeString** createAvailableIDs(const char* country,
+ int32_t& numIDs);
+
+ /**
+ * Returns a list of all time zone IDs supported by the TimeZone class (i.e., all
+ * IDs that it's legal to pass to createTimeZone()). The caller owns the list that
+ * is returned, but does not own the strings contained in that list. Delete the array with uprv_free(),
+ * but DON'T delete the elements in the array.
+ *
+ * <p>NOTE: uprv_free() is declared in the private header source/common/cmemory.h.
+ *
+ * @param numIDs Receives the number of zone IDs returned.
+ * @return An array of UnicodeString pointers, where each is a time zone ID
+ * supported by the TimeZone class.
+ * @obsolete ICU 2.8. Use createEnumeration(void) instead since this API will be removed in that release.
+ */
+ static const UnicodeString** createAvailableIDs(int32_t& numIDs);
+#endif
+
+ /**
+ * Returns the number of IDs in the equivalency group that
+ * includes the given ID. An equivalency group contains zones
+ * that have the same GMT offset and rules.
+ *
+ * <p>The returned count includes the given ID; it is always >= 1.
+ * The given ID must be a system time zone. If it is not, returns
+ * zero.
+ * @param id a system time zone ID
+ * @return the number of zones in the equivalency group containing
+ * 'id', or zero if 'id' is not a valid system ID
+ * @see #getEquivalentID
+ * @stable ICU 2.0
+ */
+ static int32_t U_EXPORT2 countEquivalentIDs(const UnicodeString& id);
+
+ /**
+ * Returns an ID in the equivalency group that
+ * includes the given ID. An equivalency group contains zones
+ * that have the same GMT offset and rules.
+ *
+ * <p>The given index must be in the range 0..n-1, where n is the
+ * value returned by <code>countEquivalentIDs(id)</code>. For
+ * some value of 'index', the returned value will be equal to the
+ * given id. If the given id is not a valid system time zone, or
+ * if 'index' is out of range, then returns an empty string.
+ * @param id a system time zone ID
+ * @param index a value from 0 to n-1, where n is the value
+ * returned by <code>countEquivalentIDs(id)</code>
+ * @return the ID of the index-th zone in the equivalency group
+ * containing 'id', or an empty string if 'id' is not a valid
+ * system ID or 'index' is out of range
+ * @see #countEquivalentIDs
+ * @stable ICU 2.0
+ */
+ static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id,
+ int32_t index);
+
+ /**
+ * Creates a new copy of the default TimeZone for this host. Unless the default time
+ * zone has already been set using adoptDefault() or setDefault(), the default is
+ * determined by querying the system using methods in TPlatformUtilities. If the
+ * system routines fail, or if they specify a TimeZone or TimeZone offset which is not
+ * recognized, the TimeZone indicated by the ID kLastResortID is instantiated
+ * and made the default.
+ *
+ * @return A default TimeZone. Clients are responsible for deleting the time zone
+ * object returned.
+ * @stable ICU 2.0
+ */
+ static TimeZone* U_EXPORT2 createDefault(void);
+
+ /**
+ * Sets the default time zone (i.e., what's returned by createDefault()) to be the
+ * specified time zone. If NULL is specified for the time zone, the default time
+ * zone is set to the default host time zone. This call adopts the TimeZone object
+ * passed in; the clent is no longer responsible for deleting it.
+ *
+ * @param zone A pointer to the new TimeZone object to use as the default.
+ * @stable ICU 2.0
+ */
+ static void U_EXPORT2 adoptDefault(TimeZone* zone);
+
+ /**
+ * Same as adoptDefault(), except that the TimeZone object passed in is NOT adopted;
+ * the caller remains responsible for deleting it.
+ *
+ * @param zone The given timezone.
+ * @system
+ */
+ static void U_EXPORT2 setDefault(const TimeZone& zone);
+
+ /**
+ * Returns the timezone data version currently used by ICU.
+ * @param status Output param to filled in with a success or an error.
+ * @return the version string, such as "2007f"
+ * @draft ICU 3.8
+ */
+ static const char* U_EXPORT2 getTZDataVersion(UErrorCode& status);
+
+ /**
+ * Returns true if the two TimeZones are equal. (The TimeZone version only compares
+ * IDs, but subclasses are expected to also compare the fields they add.)
+ *
+ * @param that The TimeZone object to be compared with.
+ * @return True if the given TimeZone is equal to this TimeZone; false
+ * otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool operator==(const TimeZone& that) const;
+
+ /**
+ * Returns true if the two TimeZones are NOT equal; that is, if operator==() returns
+ * false.
+ *
+ * @param that The TimeZone object to be compared with.
+ * @return True if the given TimeZone is not equal to this TimeZone; false
+ * otherwise.
+ * @stable ICU 2.0
+ */
+ UBool operator!=(const TimeZone& that) const {return !operator==(that);}
+
+ /**
+ * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time in this time zone, taking daylight savings time into
+ * account) as of a particular reference date. The reference date is used to determine
+ * whether daylight savings time is in effect and needs to be figured into the offset
+ * that is returned (in other words, what is the adjusted GMT offset in this time zone
+ * at this particular date and time?). For the time zones produced by createTimeZone(),
+ * the reference data is specified according to the Gregorian calendar, and the date
+ * and time fields are local standard time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, local standard time
+ * @param status Output param to filled in with a success or an error.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0;
+
+ /**
+ * Gets the time zone offset, for current date, modified in case of
+ * daylight savings. This is the offset to add *to* UTC to get local time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era the era of the given date.
+ * @param year the year in the given date.
+ * @param month the month in the given date.
+ * Month is 0-based. e.g., 0 for January.
+ * @param day the day-in-month of the given date.
+ * @param dayOfWeek the day-of-week of the given date.
+ * @param milliseconds the millis in day in <em>standard</em> local time.
+ * @param monthLength the length of the given month in days.
+ * @param status Output param to filled in with a success or an error.
+ * @return the offset to add *to* GMT to get local time.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t milliseconds,
+ int32_t monthLength, UErrorCode& status) const = 0;
+
+ /**
+ * Returns the time zone raw and GMT offset for the given moment
+ * in time. Upon return, local-millis = GMT-millis + rawOffset +
+ * dstOffset. All computations are performed in the proleptic
+ * Gregorian calendar. The default implementation in the TimeZone
+ * class delegates to the 8-argument getOffset().
+ *
+ * @param date moment in time for which to return offsets, in
+ * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
+ * time or local wall time, depending on `local'.
+ * @param local if true, `date' is local wall time; otherwise it
+ * is in GMT time.
+ * @param rawOffset output parameter to receive the raw offset, that
+ * is, the offset not including DST adjustments
+ * @param dstOffset output parameter to receive the DST offset,
+ * that is, the offset to be added to `rawOffset' to obtain the
+ * total offset between local and GMT time. If DST is not in
+ * effect, this value is zero; otherwise it is a positive value,
+ * typically one hour.
+ * @param ec input-output error code
+ *
+ * @stable ICU 2.8
+ */
+ virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
+ int32_t& dstOffset, UErrorCode& ec) const;
+
+ /**
+ * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @param offsetMillis The new raw GMT offset for this time zone.
+ * @stable ICU 2.0
+ */
+ virtual void setRawOffset(int32_t offsetMillis) = 0;
+
+ /**
+ * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @return The TimeZone's raw GMT offset.
+ * @stable ICU 2.0
+ */
+ virtual int32_t getRawOffset(void) const = 0;
+
+ /**
+ * Fills in "ID" with the TimeZone's ID.
+ *
+ * @param ID Receives this TimeZone's ID.
+ * @return A reference to 'ID'
+ * @stable ICU 2.0
+ */
+ UnicodeString& getID(UnicodeString& ID) const;
+
+ /**
+ * Sets the TimeZone's ID to the specified value. This doesn't affect any other
+ * fields (for example, if you say<
+ * blockquote><pre>
+ * . TimeZone* foo = TimeZone::createTimeZone("America/New_York");
+ * . foo.setID("America/Los_Angeles");
+ * </pre>\htmlonly</blockquote>\endhtmlonly
+ * the time zone's GMT offset and daylight-savings rules don't change to those for
+ * Los Angeles. They're still those for New York. Only the ID has changed.)
+ *
+ * @param ID The new timezone ID.
+ * @stable ICU 2.0
+ */
+ void setID(const UnicodeString& ID);
+
+ /**
+ * Enum for use with getDisplayName
+ * @stable ICU 2.4
+ */
+ enum EDisplayType {
+ /**
+ * Selector for short display name
+ * @stable ICU 2.4
+ */
+ SHORT = 1,
+ /**
+ * Selector for long display name
+ * @stable ICU 2.4
+ */
+ LONG
+ };
+
+ /**
+ * Returns a name of this time zone suitable for presentation to the user
+ * in the default locale.
+ * This method returns the long name, not including daylight savings.
+ * If the display name is not available for the locale,
+ * then this method returns a string in the format
+ * <code>GMT[+-]hh:mm</code>.
+ * @param result the human-readable name of this time zone in the default locale.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& getDisplayName(UnicodeString& result) const;
+
+ /**
+ * Returns a name of this time zone suitable for presentation to the user
+ * in the specified locale.
+ * This method returns the long name, not including daylight savings.
+ * If the display name is not available for the locale,
+ * then this method returns a string in the format
+ * <code>GMT[+-]hh:mm</code>.
+ * @param locale the locale in which to supply the display name.
+ * @param result the human-readable name of this time zone in the given locale
+ * or in the default locale if the given locale is not recognized.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const;
+
+ /**
+ * Returns a name of this time zone suitable for presentation to the user
+ * in the default locale.
+ * If the display name is not available for the locale,
+ * then this method returns a string in the format
+ * <code>GMT[+-]hh:mm</code>.
+ * @param daylight if true, return the daylight savings name.
+ * @param style either <code>LONG</code> or <code>SHORT</code>
+ * @param result the human-readable name of this time zone in the default locale.
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const;
+
+ /**
+ * Returns a name of this time zone suitable for presentation to the user
+ * in the specified locale.
+ * If the display name is not available for the locale,
+ * then this method returns a string in the format
+ * <code>GMT[+-]hh:mm</code>.
+ * @param daylight if true, return the daylight savings name.
+ * @param style either <code>LONG</code> or <code>SHORT</code>
+ * @param locale the locale in which to supply the display name.
+ * @param result the human-readable name of this time zone in the given locale
+ * or in the default locale if the given locale is not recognized.
+ * @return A refence to 'result'.
+ * @stable ICU 2.0
+ */
+ UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const;
+
+ /**
+ * Queries if this time zone uses daylight savings time.
+ * @return true if this time zone uses daylight savings time,
+ * false, otherwise.
+ * @stable ICU 2.0
+ */
+ virtual UBool useDaylightTime(void) const = 0;
+
+ /**
+ * Queries if the given date is in daylight savings time in
+ * this time zone.
+ * This method is wasteful since it creates a new GregorianCalendar and
+ * deletes it each time it is called. This is a deprecated method
+ * and provided only for Java compatibility.
+ *
+ * @param date the given UDate.
+ * @param status Output param filled in with success/error code.
+ * @return true if the given date is in daylight savings time,
+ * false, otherwise.
+ * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
+ */
+ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0;
+
+ /**
+ * Returns true if this zone has the same rule and offset as another zone.
+ * That is, if this zone differs only in ID, if at all.
+ * @param other the <code>TimeZone</code> object to be compared with
+ * @return true if the given zone is the same as this one,
+ * with the possible exception of the ID
+ * @stable ICU 2.0
+ */
+ virtual UBool hasSameRules(const TimeZone& other) const;
+
+ /**
+ * Clones TimeZone objects polymorphically. Clients are responsible for deleting
+ * the TimeZone object cloned.
+ *
+ * @return A new copy of this TimeZone object.
+ * @stable ICU 2.0
+ */
+ virtual TimeZone* clone(void) const = 0;
+
+ /**
+ * Return the class ID for this class. This is useful only for
+ * comparing to a return value from getDynamicClassID().
+ * @return The class ID for all objects of this class.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Returns a unique class ID POLYMORPHICALLY. 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.
+ * <P>
+ * Concrete subclasses of TimeZone must use the UOBJECT_DEFINE_RTTI_IMPLEMENTATION
+ * macro from uobject.h in their implementation to provide correct RTTI information.
+ * @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(void) const = 0;
+
+ /**
+ * Returns the amount of time to be added to local standard time
+ * to get local wall clock time.
+ * <p>
+ * The default implementation always returns 3600000 milliseconds
+ * (i.e., one hour) if this time zone observes Daylight Saving
+ * Time. Otherwise, 0 (zero) is returned.
+ * <p>
+ * If an underlying TimeZone implementation subclass supports
+ * historical Daylight Saving Time changes, this method returns
+ * the known latest daylight saving value.
+ *
+ * @return the amount of saving time in milliseconds
+ * @stable ICU 3.6
+ */
+ virtual int32_t getDSTSavings() const;
+
+protected:
+
+ /**
+ * Default constructor. ID is initialized to the empty string.
+ * @stable ICU 2.0
+ */
+ TimeZone();
+
+ /**
+ * Construct a timezone with a given ID.
+ * @param id a system time zone ID
+ * @stable ICU 2.0
+ */
+ TimeZone(const UnicodeString &id);
+
+ /**
+ * Copy constructor.
+ * @param source the object to be copied.
+ * @stable ICU 2.0
+ */
+ TimeZone(const TimeZone& source);
+
+ /**
+ * Default assignment operator.
+ * @param right the object to be copied.
+ * @stable ICU 2.0
+ */
+ TimeZone& operator=(const TimeZone& right);
+
+ /**
+ * Utility function. For internally loading rule data.
+ * @param top Top resource bundle for tz data
+ * @param ruleid ID of rule to load
+ * @param oldbundle Old bundle to reuse or NULL
+ * @param status Status parameter
+ * @return either a new bundle or *oldbundle
+ * @internal
+ */
+ static UResourceBundle* loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status);
+
+private:
+ friend class ZoneMeta;
+
+ /**
+ * Get a canonical Olson zone ID for the given ID. If the given ID is not valid,
+ * this method returns empty string as the result. If the given ID is a link, then the
+ * referenced ID (canonical ID) is returned.
+ */
+ static UnicodeString& getOlsonCanonicalID(const UnicodeString &id, UnicodeString &canonical);
+
+ static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
+
+ /**
+ * Responsible for setting up DEFAULT_ZONE. Uses routines in TPlatformUtilities
+ * (i.e., platform-specific calls) to get the current system time zone. Failing
+ * that, uses the platform-specific default time zone. Failing that, uses GMT.
+ */
+ static void initDefault(void);
+
+ // See source file for documentation
+ /**
+ * Lookup the given name in our system zone table. If found,
+ * instantiate a new zone of that name and return it. If not
+ * found, return 0.
+ * @param name tthe given name of a system time zone.
+ * @return the timezone indicated by the 'name'.
+ */
+ static TimeZone* createSystemTimeZone(const UnicodeString& name);
+
+ UnicodeString fID; // this time zone's ID
+};
+
+
+// -------------------------------------
+
+inline UnicodeString&
+TimeZone::getID(UnicodeString& ID) const
+{
+ ID = fID;
+ return ID;
+}
+
+// -------------------------------------
+
+inline void
+TimeZone::setID(const UnicodeString& ID)
+{
+ fID = ID;
+}
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif //_TIMEZONE
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/translit.h b/Build/source/libs/icu-xetex/i18n/unicode/translit.h
new file mode 100644
index 00000000000..1dcbb9a884d
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/translit.h
@@ -0,0 +1,1323 @@
+/*
+**********************************************************************
+* Copyright (C) 1999-2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* Date Name Description
+* 11/17/99 aliu Creation.
+**********************************************************************
+*/
+#ifndef TRANSLIT_H
+#define TRANSLIT_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: Tranforms text from one format to another.
+ */
+
+#if !UCONFIG_NO_TRANSLITERATION
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/parseerr.h"
+#include "unicode/utrans.h" // UTransPosition, UTransDirection
+#include "unicode/strenum.h"
+
+U_NAMESPACE_BEGIN
+
+class UnicodeFilter;
+class UnicodeSet;
+class CompoundTransliterator;
+class TransliteratorParser;
+class NormalizationTransliterator;
+class TransliteratorIDParser;
+
+/**
+ *
+ * <code>Transliterator</code> is an abstract class that
+ * transliterates text from one format to another. The most common
+ * kind of transliterator is a script, or alphabet, transliterator.
+ * For example, a Russian to Latin transliterator changes Russian text
+ * written in Cyrillic characters to phonetically equivalent Latin
+ * characters. It does not <em>translate</em> Russian to English!
+ * Transliteration, unlike translation, operates on characters, without
+ * reference to the meanings of words and sentences.
+ *
+ * <p>Although script conversion is its most common use, a
+ * transliterator can actually perform a more general class of tasks.
+ * In fact, <code>Transliterator</code> defines a very general API
+ * which specifies only that a segment of the input text is replaced
+ * by new text. The particulars of this conversion are determined
+ * entirely by subclasses of <code>Transliterator</code>.
+ *
+ * <p><b>Transliterators are stateless</b>
+ *
+ * <p><code>Transliterator</code> objects are <em>stateless</em>; they
+ * retain no information between calls to
+ * <code>transliterate()</code>. (However, this does <em>not</em>
+ * mean that threads may share transliterators without synchronizing
+ * them. Transliterators are not immutable, so they must be
+ * synchronized when shared between threads.) This1 might seem to
+ * limit the complexity of the transliteration operation. In
+ * practice, subclasses perform complex transliterations by delaying
+ * the replacement of text until it is known that no other
+ * replacements are possible. In other words, although the
+ * <code>Transliterator</code> objects are stateless, the source text
+ * itself embodies all the needed information, and delayed operation
+ * allows arbitrary complexity.
+ *
+ * <p><b>Batch transliteration</b>
+ *
+ * <p>The simplest way to perform transliteration is all at once, on a
+ * string of existing text. This is referred to as <em>batch</em>
+ * transliteration. For example, given a string <code>input</code>
+ * and a transliterator <code>t</code>, the call
+ *
+ * \htmlonly<blockquote>\endhtmlonly<code>String result = t.transliterate(input);
+ * </code>\htmlonly</blockquote>\endhtmlonly
+ *
+ * will transliterate it and return the result. Other methods allow
+ * the client to specify a substring to be transliterated and to use
+ * {@link Replaceable } objects instead of strings, in order to
+ * preserve out-of-band information (such as text styles).
+ *
+ * <p><b>Keyboard transliteration</b>
+ *
+ * <p>Somewhat more involved is <em>keyboard</em>, or incremental
+ * transliteration. This is the transliteration of text that is
+ * arriving from some source (typically the user's keyboard) one
+ * character at a time, or in some other piecemeal fashion.
+ *
+ * <p>In keyboard transliteration, a <code>Replaceable</code> buffer
+ * stores the text. As text is inserted, as much as possible is
+ * transliterated on the fly. This means a GUI that displays the
+ * contents of the buffer may show text being modified as each new
+ * character arrives.
+ *
+ * <p>Consider the simple <code>RuleBasedTransliterator</code>:
+ *
+ * \htmlonly<blockquote>\endhtmlonly<code>
+ * th&gt;{theta}<br>
+ * t&gt;{tau}
+ * </code>\htmlonly</blockquote>\endhtmlonly
+ *
+ * When the user types 't', nothing will happen, since the
+ * transliterator is waiting to see if the next character is 'h'. To
+ * remedy this, we introduce the notion of a cursor, marked by a '|'
+ * in the output string:
+ *
+ * \htmlonly<blockquote>\endhtmlonly<code>
+ * t&gt;|{tau}<br>
+ * {tau}h&gt;{theta}
+ * </code>\htmlonly</blockquote>\endhtmlonly
+ *
+ * Now when the user types 't', tau appears, and if the next character
+ * is 'h', the tau changes to a theta. This is accomplished by
+ * maintaining a cursor position (independent of the insertion point,
+ * and invisible in the GUI) across calls to
+ * <code>transliterate()</code>. Typically, the cursor will
+ * be coincident with the insertion point, but in a case like the one
+ * above, it will precede the insertion point.
+ *
+ * <p>Keyboard transliteration methods maintain a set of three indices
+ * that are updated with each call to
+ * <code>transliterate()</code>, including the cursor, start,
+ * and limit. Since these indices are changed by the method, they are
+ * passed in an <code>int[]</code> array. The <code>START</code> index
+ * marks the beginning of the substring that the transliterator will
+ * look at. It is advanced as text becomes committed (but it is not
+ * the committed index; that's the <code>CURSOR</code>). The
+ * <code>CURSOR</code> index, described above, marks the point at
+ * which the transliterator last stopped, either because it reached
+ * the end, or because it required more characters to disambiguate
+ * between possible inputs. The <code>CURSOR</code> can also be
+ * explicitly set by rules in a <code>RuleBasedTransliterator</code>.
+ * Any characters before the <code>CURSOR</code> index are frozen;
+ * future keyboard transliteration calls within this input sequence
+ * will not change them. New text is inserted at the
+ * <code>LIMIT</code> index, which marks the end of the substring that
+ * the transliterator looks at.
+ *
+ * <p>Because keyboard transliteration assumes that more characters
+ * are to arrive, it is conservative in its operation. It only
+ * transliterates when it can do so unambiguously. Otherwise it waits
+ * for more characters to arrive. When the client code knows that no
+ * more characters are forthcoming, perhaps because the user has
+ * performed some input termination operation, then it should call
+ * <code>finishTransliteration()</code> to complete any
+ * pending transliterations.
+ *
+ * <p><b>Inverses</b>
+ *
+ * <p>Pairs of transliterators may be inverses of one another. For
+ * example, if transliterator <b>A</b> transliterates characters by
+ * incrementing their Unicode value (so "abc" -> "def"), and
+ * transliterator <b>B</b> decrements character values, then <b>A</b>
+ * is an inverse of <b>B</b> and vice versa. If we compose <b>A</b>
+ * with <b>B</b> in a compound transliterator, the result is the
+ * indentity transliterator, that is, a transliterator that does not
+ * change its input text.
+ *
+ * The <code>Transliterator</code> method <code>getInverse()</code>
+ * returns a transliterator's inverse, if one exists, or
+ * <code>null</code> otherwise. However, the result of
+ * <code>getInverse()</code> usually will <em>not</em> be a true
+ * mathematical inverse. This is because true inverse transliterators
+ * are difficult to formulate. For example, consider two
+ * transliterators: <b>AB</b>, which transliterates the character 'A'
+ * to 'B', and <b>BA</b>, which transliterates 'B' to 'A'. It might
+ * seem that these are exact inverses, since
+ *
+ * \htmlonly<blockquote>\endhtmlonly"A" x <b>AB</b> -> "B"<br>
+ * "B" x <b>BA</b> -> "A"\htmlonly</blockquote>\endhtmlonly
+ *
+ * where 'x' represents transliteration. However,
+ *
+ * \htmlonly<blockquote>\endhtmlonly"ABCD" x <b>AB</b> -> "BBCD"<br>
+ * "BBCD" x <b>BA</b> -> "AACD"\htmlonly</blockquote>\endhtmlonly
+ *
+ * so <b>AB</b> composed with <b>BA</b> is not the
+ * identity. Nonetheless, <b>BA</b> may be usefully considered to be
+ * <b>AB</b>'s inverse, and it is on this basis that
+ * <b>AB</b><code>.getInverse()</code> could legitimately return
+ * <b>BA</b>.
+ *
+ * <p><b>IDs and display names</b>
+ *
+ * <p>A transliterator is designated by a short identifier string or
+ * <em>ID</em>. IDs follow the format <em>source-destination</em>,
+ * where <em>source</em> describes the entity being replaced, and
+ * <em>destination</em> describes the entity replacing
+ * <em>source</em>. The entities may be the names of scripts,
+ * particular sequences of characters, or whatever else it is that the
+ * transliterator converts to or from. For example, a transliterator
+ * from Russian to Latin might be named "Russian-Latin". A
+ * transliterator from keyboard escape sequences to Latin-1 characters
+ * might be named "KeyboardEscape-Latin1". By convention, system
+ * entity names are in English, with the initial letters of words
+ * capitalized; user entity names may follow any format so long as
+ * they do not contain dashes.
+ *
+ * <p>In addition to programmatic IDs, transliterator objects have
+ * display names for presentation in user interfaces, returned by
+ * {@link #getDisplayName }.
+ *
+ * <p><b>Factory methods and registration</b>
+ *
+ * <p>In general, client code should use the factory method
+ * {@link #createInstance } to obtain an instance of a
+ * transliterator given its ID. Valid IDs may be enumerated using
+ * <code>getAvailableIDs()</code>. Since transliterators are mutable,
+ * multiple calls to {@link #createInstance } with the same ID will
+ * return distinct objects.
+ *
+ * <p>In addition to the system transliterators registered at startup,
+ * user transliterators may be registered by calling
+ * <code>registerInstance()</code> at run time. A registered instance
+ * acts a template; future calls to {@link #createInstance } with the ID
+ * of the registered object return clones of that object. Thus any
+ * object passed to <tt>registerInstance()</tt> must implement
+ * <tt>clone()</tt> propertly. To register a transliterator subclass
+ * without instantiating it (until it is needed), users may call
+ * {@link #registerFactory }. In this case, the objects are
+ * instantiated by invoking the zero-argument public constructor of
+ * the class.
+ *
+ * <p><b>Subclassing</b>
+ *
+ * Subclasses must implement the abstract method
+ * <code>handleTransliterate()</code>. <p>Subclasses should override
+ * the <code>transliterate()</code> method taking a
+ * <code>Replaceable</code> and the <code>transliterate()</code>
+ * method taking a <code>String</code> and <code>StringBuffer</code>
+ * if the performance of these methods can be improved over the
+ * performance obtained by the default implementations in this class.
+ *
+ * @author Alan Liu
+ * @stable ICU 2.0
+ */
+class U_I18N_API Transliterator : public UObject {
+
+private:
+
+ /**
+ * Programmatic name, e.g., "Latin-Arabic".
+ */
+ UnicodeString ID;
+
+ /**
+ * This transliterator's filter. Any character for which
+ * <tt>filter.contains()</tt> returns <tt>false</tt> will not be
+ * altered by this transliterator. If <tt>filter</tt> is
+ * <tt>null</tt> then no filtering is applied.
+ */
+ UnicodeFilter* filter;
+
+ int32_t maximumContextLength;
+
+ public:
+
+ /**
+ * A context integer or pointer for a factory function, passed by
+ * value.
+ * @stable ICU 2.4
+ */
+ union Token {
+ /**
+ * This token, interpreted as a 32-bit integer.
+ * @stable ICU 2.4
+ */
+ int32_t integer;
+ /**
+ * This token, interpreted as a native pointer.
+ * @stable ICU 2.4
+ */
+ void* pointer;
+ };
+
+ /**
+ * Return a token containing an integer.
+ * @return a token containing an integer.
+ * @internal
+ */
+ inline static Token integerToken(int32_t);
+
+ /**
+ * Return a token containing a pointer.
+ * @return a token containing a pointer.
+ * @internal
+ */
+ inline static Token pointerToken(void*);
+
+ /**
+ * A function that creates and returns a Transliterator. When
+ * invoked, it will be passed the ID string that is being
+ * instantiated, together with the context pointer that was passed
+ * in when the factory function was first registered. Many
+ * factory functions will ignore both parameters, however,
+ * functions that are registered to more than one ID may use the
+ * ID or the context parameter to parameterize the transliterator
+ * they create.
+ * @param ID the string identifier for this transliterator
+ * @param context a context pointer that will be stored and
+ * later passed to the factory function when an ID matching
+ * the registration ID is being instantiated with this factory.
+ * @stable ICU 2.4
+ */
+ typedef Transliterator* (U_EXPORT2 *Factory)(const UnicodeString& ID, Token context);
+
+protected:
+
+ /**
+ * Default constructor.
+ * @param ID the string identifier for this transliterator
+ * @param adoptedFilter the filter. Any character for which
+ * <tt>filter.contains()</tt> returns <tt>false</tt> will not be
+ * altered by this transliterator. If <tt>filter</tt> is
+ * <tt>null</tt> then no filtering is applied.
+ * @stable ICU 2.4
+ */
+ Transliterator(const UnicodeString& ID, UnicodeFilter* adoptedFilter);
+
+ /**
+ * Copy constructor.
+ * @stable ICU 2.4
+ */
+ Transliterator(const Transliterator&);
+
+ /**
+ * Assignment operator.
+ * @stable ICU 2.4
+ */
+ Transliterator& operator=(const Transliterator&);
+
+ /**
+ * Create a transliterator from a basic ID. This is an ID
+ * containing only the forward direction source, target, and
+ * variant.
+ * @param id a basic ID of the form S-T or S-T/V.
+ * @param canon canonical ID to assign to the object, or
+ * NULL to leave the ID unchanged
+ * @return a newly created Transliterator or null if the ID is
+ * invalid.
+ * @stable ICU 2.4
+ */
+ static Transliterator* createBasicInstance(const UnicodeString& id,
+ const UnicodeString* canon);
+
+ friend class TransliteratorParser; // for parseID()
+ friend class TransliteratorIDParser; // for createBasicInstance()
+ friend class TransliteratorAlias; // for setID()
+
+public:
+
+ /**
+ * Destructor.
+ * @stable ICU 2.0
+ */
+ virtual ~Transliterator();
+
+ /**
+ * Implements Cloneable.
+ * All subclasses are encouraged to implement this method if it is
+ * possible and reasonable to do so. Subclasses that are to be
+ * registered with the system using <tt>registerInstance()</tt>
+ * are required to implement this method. If a subclass does not
+ * implement clone() properly and is registered with the system
+ * using registerInstance(), then the default clone() implementation
+ * will return null, and calls to createInstance() will fail.
+ *
+ * @return a copy of the object.
+ * @see #registerInstance
+ * @stable ICU 2.0
+ */
+ virtual Transliterator* clone() const;
+
+ /**
+ * Transliterates a segment of a string, with optional filtering.
+ *
+ * @param text the string to be transliterated
+ * @param start the beginning index, inclusive; <code>0 <= start
+ * <= limit</code>.
+ * @param limit the ending index, exclusive; <code>start <= limit
+ * <= text.length()</code>.
+ * @return The new limit index. The text previously occupying <code>[start,
+ * limit)</code> has been transliterated, possibly to a string of a different
+ * length, at <code>[start, </code><em>new-limit</em><code>)</code>, where
+ * <em>new-limit</em> is the return value. If the input offsets are out of bounds,
+ * the returned value is -1 and the input string remains unchanged.
+ * @stable ICU 2.0
+ */
+ virtual int32_t transliterate(Replaceable& text,
+ int32_t start, int32_t limit) const;
+
+ /**
+ * Transliterates an entire string in place. Convenience method.
+ * @param text the string to be transliterated
+ * @stable ICU 2.0
+ */
+ virtual void transliterate(Replaceable& text) const;
+
+ /**
+ * Transliterates the portion of the text buffer that can be
+ * transliterated unambiguosly after new text has been inserted,
+ * typically as a result of a keyboard event. The new text in
+ * <code>insertion</code> will be inserted into <code>text</code>
+ * at <code>index.limit</code>, advancing
+ * <code>index.limit</code> by <code>insertion.length()</code>.
+ * Then the transliterator will try to transliterate characters of
+ * <code>text</code> between <code>index.cursor</code> and
+ * <code>index.limit</code>. Characters before
+ * <code>index.cursor</code> will not be changed.
+ *
+ * <p>Upon return, values in <code>index</code> will be updated.
+ * <code>index.start</code> will be advanced to the first
+ * character that future calls to this method will read.
+ * <code>index.cursor</code> and <code>index.limit</code> will
+ * be adjusted to delimit the range of text that future calls to
+ * this method may change.
+ *
+ * <p>Typical usage of this method begins with an initial call
+ * with <code>index.start</code> and <code>index.limit</code>
+ * set to indicate the portion of <code>text</code> to be
+ * transliterated, and <code>index.cursor == index.start</code>.
+ * Thereafter, <code>index</code> can be used without
+ * modification in future calls, provided that all changes to
+ * <code>text</code> are made via this method.
+ *
+ * <p>This method assumes that future calls may be made that will
+ * insert new text into the buffer. As a result, it only performs
+ * unambiguous transliterations. After the last call to this
+ * method, there may be untransliterated text that is waiting for
+ * more input to resolve an ambiguity. In order to perform these
+ * pending transliterations, clients should call {@link
+ * #finishTransliteration } after the last call to this
+ * method has been made.
+ *
+ * @param text the buffer holding transliterated and untransliterated text
+ * @param index an array of three integers.
+ *
+ * <ul><li><code>index.start</code>: the beginning index,
+ * inclusive; <code>0 <= index.start <= index.limit</code>.
+ *
+ * <li><code>index.limit</code>: the ending index, exclusive;
+ * <code>index.start <= index.limit <= text.length()</code>.
+ * <code>insertion</code> is inserted at
+ * <code>index.limit</code>.
+ *
+ * <li><code>index.cursor</code>: the next character to be
+ * considered for transliteration; <code>index.start <=
+ * index.cursor <= index.limit</code>. Characters before
+ * <code>index.cursor</code> will not be changed by future calls
+ * to this method.</ul>
+ *
+ * @param insertion text to be inserted and possibly
+ * transliterated into the translation buffer at
+ * <code>index.limit</code>. If <code>null</code> then no text
+ * is inserted.
+ * @param status Output param to filled in with a success or an error.
+ * @see #handleTransliterate
+ * @exception IllegalArgumentException if <code>index</code>
+ * is invalid
+ * @see UTransPosition
+ * @stable ICU 2.0
+ */
+ virtual void transliterate(Replaceable& text, UTransPosition& index,
+ const UnicodeString& insertion,
+ UErrorCode& status) const;
+
+ /**
+ * Transliterates the portion of the text buffer that can be
+ * transliterated unambiguosly after a new character has been
+ * inserted, typically as a result of a keyboard event. This is a
+ * convenience method; see {@link
+ * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const}
+ * for details.
+ * @param text the buffer holding transliterated and
+ * untransliterated text
+ * @param index an array of three integers. See {@link
+ * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const }.
+ * @param insertion text to be inserted and possibly
+ * transliterated into the translation buffer at
+ * <code>index.limit</code>.
+ * @param status Output param to filled in with a success or an error.
+ * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const
+ * @stable ICU 2.0
+ */
+ virtual void transliterate(Replaceable& text, UTransPosition& index,
+ UChar32 insertion,
+ UErrorCode& status) const;
+
+ /**
+ * Transliterates the portion of the text buffer that can be
+ * transliterated unambiguosly. This is a convenience method; see
+ * {@link
+ * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const }
+ * for details.
+ * @param text the buffer holding transliterated and
+ * untransliterated text
+ * @param index an array of three integers. See {@link
+ * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const }.
+ * @param status Output param to filled in with a success or an error.
+ * @see #transliterate(Replaceable, int[], String)
+ * @stable ICU 2.0
+ */
+ virtual void transliterate(Replaceable& text, UTransPosition& index,
+ UErrorCode& status) const;
+
+ /**
+ * Finishes any pending transliterations that were waiting for
+ * more characters. Clients should call this method as the last
+ * call after a sequence of one or more calls to
+ * <code>transliterate()</code>.
+ * @param text the buffer holding transliterated and
+ * untransliterated text.
+ * @param index the array of indices previously passed to {@link
+ * #transliterate }
+ * @stable ICU 2.0
+ */
+ virtual void finishTransliteration(Replaceable& text,
+ UTransPosition& index) const;
+
+private:
+
+ /**
+ * This internal method does incremental transliteration. If the
+ * 'insertion' is non-null then we append it to 'text' before
+ * proceeding. This method calls through to the pure virtual
+ * framework method handleTransliterate() to do the actual
+ * work.
+ * @param text the buffer holding transliterated and
+ * untransliterated text
+ * @param index an array of three integers. See {@link
+ * #transliterate(Replaceable, int[], String)}.
+ * @param insertion text to be inserted and possibly
+ * transliterated into the translation buffer at
+ * <code>index.limit</code>.
+ * @param status Output param to filled in with a success or an error.
+ */
+ void _transliterate(Replaceable& text,
+ UTransPosition& index,
+ const UnicodeString* insertion,
+ UErrorCode &status) const;
+
+protected:
+
+ /**
+ * Abstract method that concrete subclasses define to implement
+ * their transliteration algorithm. This method handles both
+ * incremental and non-incremental transliteration. Let
+ * <code>originalStart</code> refer to the value of
+ * <code>pos.start</code> upon entry.
+ *
+ * <ul>
+ * <li>If <code>incremental</code> is false, then this method
+ * should transliterate all characters between
+ * <code>pos.start</code> and <code>pos.limit</code>. Upon return
+ * <code>pos.start</code> must == <code> pos.limit</code>.</li>
+ *
+ * <li>If <code>incremental</code> is true, then this method
+ * should transliterate all characters between
+ * <code>pos.start</code> and <code>pos.limit</code> that can be
+ * unambiguously transliterated, regardless of future insertions
+ * of text at <code>pos.limit</code>. Upon return,
+ * <code>pos.start</code> should be in the range
+ * [<code>originalStart</code>, <code>pos.limit</code>).
+ * <code>pos.start</code> should be positioned such that
+ * characters [<code>originalStart</code>, <code>
+ * pos.start</code>) will not be changed in the future by this
+ * transliterator and characters [<code>pos.start</code>,
+ * <code>pos.limit</code>) are unchanged.</li>
+ * </ul>
+ *
+ * <p>Implementations of this method should also obey the
+ * following invariants:</p>
+ *
+ * <ul>
+ * <li> <code>pos.limit</code> and <code>pos.contextLimit</code>
+ * should be updated to reflect changes in length of the text
+ * between <code>pos.start</code> and <code>pos.limit</code>. The
+ * difference <code> pos.contextLimit - pos.limit</code> should
+ * not change.</li>
+ *
+ * <li><code>pos.contextStart</code> should not change.</li>
+ *
+ * <li>Upon return, neither <code>pos.start</code> nor
+ * <code>pos.limit</code> should be less than
+ * <code>originalStart</code>.</li>
+ *
+ * <li>Text before <code>originalStart</code> and text after
+ * <code>pos.limit</code> should not change.</li>
+ *
+ * <li>Text before <code>pos.contextStart</code> and text after
+ * <code> pos.contextLimit</code> should be ignored.</li>
+ * </ul>
+ *
+ * <p>Subclasses may safely assume that all characters in
+ * [<code>pos.start</code>, <code>pos.limit</code>) are filtered.
+ * In other words, the filter has already been applied by the time
+ * this method is called. See
+ * <code>filteredTransliterate()</code>.
+ *
+ * <p>This method is <b>not</b> for public consumption. Calling
+ * this method directly will transliterate
+ * [<code>pos.start</code>, <code>pos.limit</code>) without
+ * applying the filter. End user code should call <code>
+ * transliterate()</code> instead of this method. Subclass code
+ * and wrapping transliterators should call
+ * <code>filteredTransliterate()</code> instead of this method.<p>
+ *
+ * @param text the buffer holding transliterated and
+ * untransliterated text
+ *
+ * @param pos the indices indicating the start, limit, context
+ * start, and context limit of the text.
+ *
+ * @param incremental if true, assume more text may be inserted at
+ * <code>pos.limit</code> and act accordingly. Otherwise,
+ * transliterate all text between <code>pos.start</code> and
+ * <code>pos.limit</code> and move <code>pos.start</code> up to
+ * <code>pos.limit</code>.
+ *
+ * @see #transliterate
+ * @stable ICU 2.4
+ */
+ virtual void handleTransliterate(Replaceable& text,
+ UTransPosition& pos,
+ UBool incremental) const = 0;
+
+public:
+ /**
+ * Transliterate a substring of text, as specified by index, taking filters
+ * into account. This method is for subclasses that need to delegate to
+ * another transliterator, such as CompoundTransliterator.
+ * @param text the text to be transliterated
+ * @param index the position indices
+ * @param incremental if TRUE, then assume more characters may be inserted
+ * at index.limit, and postpone processing to accomodate future incoming
+ * characters
+ * @stable ICU 2.4
+ */
+ virtual void filteredTransliterate(Replaceable& text,
+ UTransPosition& index,
+ UBool incremental) const;
+
+private:
+
+ /**
+ * Top-level transliteration method, handling filtering, incremental and
+ * non-incremental transliteration, and rollback. All transliteration
+ * public API methods eventually call this method with a rollback argument
+ * of TRUE. Other entities may call this method but rollback should be
+ * FALSE.
+ *
+ * <p>If this transliterator has a filter, break up the input text into runs
+ * of unfiltered characters. Pass each run to
+ * <subclass>.handleTransliterate().
+ *
+ * <p>In incremental mode, if rollback is TRUE, perform a special
+ * incremental procedure in which several passes are made over the input
+ * text, adding one character at a time, and committing successful
+ * transliterations as they occur. Unsuccessful transliterations are rolled
+ * back and retried with additional characters to give correct results.
+ *
+ * @param text the text to be transliterated
+ * @param index the position indices
+ * @param incremental if TRUE, then assume more characters may be inserted
+ * at index.limit, and postpone processing to accomodate future incoming
+ * characters
+ * @param rollback if TRUE and if incremental is TRUE, then perform special
+ * incremental processing, as described above, and undo partial
+ * transliterations where necessary. If incremental is FALSE then this
+ * parameter is ignored.
+ */
+ virtual void filteredTransliterate(Replaceable& text,
+ UTransPosition& index,
+ UBool incremental,
+ UBool rollback) const;
+
+public:
+
+ /**
+ * Returns the length of the longest context required by this transliterator.
+ * This is <em>preceding</em> context. The default implementation supplied
+ * by <code>Transliterator</code> returns zero; subclasses
+ * that use preceding context should override this method to return the
+ * correct value. For example, if a transliterator translates "ddd" (where
+ * d is any digit) to "555" when preceded by "(ddd)", then the preceding
+ * context length is 5, the length of "(ddd)".
+ *
+ * @return The maximum number of preceding context characters this
+ * transliterator needs to examine
+ * @stable ICU 2.0
+ */
+ int32_t getMaximumContextLength(void) const;
+
+protected:
+
+ /**
+ * Method for subclasses to use to set the maximum context length.
+ * @param maxContextLength the new value to be set.
+ * @see #getMaximumContextLength
+ * @stable ICU 2.4
+ */
+ void setMaximumContextLength(int32_t maxContextLength);
+
+public:
+
+ /**
+ * Returns a programmatic identifier for this transliterator.
+ * If this identifier is passed to <code>createInstance()</code>, it
+ * will return this object, if it has been registered.
+ * @return a programmatic identifier for this transliterator.
+ * @see #registerInstance
+ * @see #registerFactory
+ * @see #getAvailableIDs
+ * @stable ICU 2.0
+ */
+ virtual const UnicodeString& getID(void) const;
+
+ /**
+ * Returns a name for this transliterator that is appropriate for
+ * display to the user in the default locale. See {@link
+ * #getDisplayName } for details.
+ * @param ID the string identifier for this transliterator
+ * @param result Output param to receive the display name
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getDisplayName(const UnicodeString& ID,
+ UnicodeString& result);
+
+ /**
+ * Returns a name for this transliterator that is appropriate for
+ * display to the user in the given locale. This name is taken
+ * from the locale resource data in the standard manner of the
+ * <code>java.text</code> package.
+ *
+ * <p>If no localized names exist in the system resource bundles,
+ * a name is synthesized using a localized
+ * <code>MessageFormat</code> pattern from the resource data. The
+ * arguments to this pattern are an integer followed by one or two
+ * strings. The integer is the number of strings, either 1 or 2.
+ * The strings are formed by splitting the ID for this
+ * transliterator at the first '-'. If there is no '-', then the
+ * entire ID forms the only string.
+ * @param ID the string identifier for this transliterator
+ * @param inLocale the Locale in which the display name should be
+ * localized.
+ * @param result Output param to receive the display name
+ * @return A reference to 'result'.
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getDisplayName(const UnicodeString& ID,
+ const Locale& inLocale,
+ UnicodeString& result);
+
+ /**
+ * Returns the filter used by this transliterator, or <tt>NULL</tt>
+ * if this transliterator uses no filter.
+ * @return the filter used by this transliterator, or <tt>NULL</tt>
+ * if this transliterator uses no filter.
+ * @stable ICU 2.0
+ */
+ const UnicodeFilter* getFilter(void) const;
+
+ /**
+ * Returns the filter used by this transliterator, or <tt>NULL</tt> if this
+ * transliterator uses no filter. The caller must eventually delete the
+ * result. After this call, this transliterator's filter is set to
+ * <tt>NULL</tt>.
+ * @return the filter used by this transliterator, or <tt>NULL</tt> if this
+ * transliterator uses no filter.
+ * @stable ICU 2.4
+ */
+ UnicodeFilter* orphanFilter(void);
+
+ /**
+ * Changes the filter used by this transliterator. If the filter
+ * is set to <tt>null</tt> then no filtering will occur.
+ *
+ * <p>Callers must take care if a transliterator is in use by
+ * multiple threads. The filter should not be changed by one
+ * thread while another thread may be transliterating.
+ * @param adoptedFilter the new filter to be adopted.
+ * @stable ICU 2.0
+ */
+ void adoptFilter(UnicodeFilter* adoptedFilter);
+
+ /**
+ * Returns this transliterator's inverse. See the class
+ * documentation for details. This implementation simply inverts
+ * the two entities in the ID and attempts to retrieve the
+ * resulting transliterator. That is, if <code>getID()</code>
+ * returns "A-B", then this method will return the result of
+ * <code>createInstance("B-A")</code>, or <code>null</code> if that
+ * call fails.
+ *
+ * <p>Subclasses with knowledge of their inverse may wish to
+ * override this method.
+ *
+ * @param status Output param to filled in with a success or an error.
+ * @return a transliterator that is an inverse, not necessarily
+ * exact, of this transliterator, or <code>null</code> if no such
+ * transliterator is registered.
+ * @see #registerInstance
+ * @stable ICU 2.0
+ */
+ Transliterator* createInverse(UErrorCode& status) const;
+
+ /**
+ * Returns a <code>Transliterator</code> object given its ID.
+ * The ID must be either a system transliterator ID or a ID registered
+ * using <code>registerInstance()</code>.
+ *
+ * @param ID a valid ID, as enumerated by <code>getAvailableIDs()</code>
+ * @param dir either FORWARD or REVERSE.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param to filled in with a success or an error.
+ * @return A <code>Transliterator</code> object with the given ID
+ * @see #registerInstance
+ * @see #getAvailableIDs
+ * @see #getID
+ * @stable ICU 2.0
+ */
+ static Transliterator* U_EXPORT2 createInstance(const UnicodeString& ID,
+ UTransDirection dir,
+ UParseError& parseError,
+ UErrorCode& status);
+
+ /**
+ * Returns a <code>Transliterator</code> object given its ID.
+ * The ID must be either a system transliterator ID or a ID registered
+ * using <code>registerInstance()</code>.
+ * @param ID a valid ID, as enumerated by <code>getAvailableIDs()</code>
+ * @param dir either FORWARD or REVERSE.
+ * @param status Output param to filled in with a success or an error.
+ * @return A <code>Transliterator</code> object with the given ID
+ * @stable ICU 2.0
+ */
+ static Transliterator* U_EXPORT2 createInstance(const UnicodeString& ID,
+ UTransDirection dir,
+ UErrorCode& status);
+
+ /**
+ * Returns a <code>Transliterator</code> object constructed from
+ * the given rule string. This will be a RuleBasedTransliterator,
+ * if the rule string contains only rules, or a
+ * CompoundTransliterator, if it contains ID blocks, or a
+ * NullTransliterator, if it contains ID blocks which parse as
+ * empty for the given direction.
+ * @param ID the id for the transliterator.
+ * @param rules rules, separated by ';'
+ * @param dir either FORWARD or REVERSE.
+ * @param parseError Struct to recieve information on position
+ * of error if an error is encountered
+ * @param status Output param set to success/failure code.
+ * @stable ICU 2.0
+ */
+ static Transliterator* U_EXPORT2 createFromRules(const UnicodeString& ID,
+ const UnicodeString& rules,
+ UTransDirection dir,
+ UParseError& parseError,
+ UErrorCode& status);
+
+ /**
+ * Create a rule string that can be passed to createFromRules()
+ * to recreate this transliterator.
+ * @param result the string to receive the rules. Previous
+ * contents will be deleted.
+ * @param escapeUnprintable if TRUE then convert unprintable
+ * character to their hex escape representations, \\uxxxx or
+ * \\Uxxxxxxxx. Unprintable characters are those other than
+ * U+000A, U+0020..U+007E.
+ * @stable ICU 2.0
+ */
+ virtual UnicodeString& toRules(UnicodeString& result,
+ UBool escapeUnprintable) const;
+
+ /**
+ * Return the number of elements that make up this transliterator.
+ * For example, if the transliterator "NFD;Jamo-Latin;Latin-Greek"
+ * were created, the return value of this method would be 3.
+ *
+ * <p>If this transliterator is not composed of other
+ * transliterators, then this method returns 1.
+ * @return the number of transliterators that compose this
+ * transliterator, or 1 if this transliterator is not composed of
+ * multiple transliterators
+ * @stable ICU 3.0
+ */
+ int32_t countElements() const;
+
+ /**
+ * Return an element that makes up this transliterator. For
+ * example, if the transliterator "NFD;Jamo-Latin;Latin-Greek"
+ * were created, the return value of this method would be one
+ * of the three transliterator objects that make up that
+ * transliterator: [NFD, Jamo-Latin, Latin-Greek].
+ *
+ * <p>If this transliterator is not composed of other
+ * transliterators, then this method will return a reference to
+ * this transliterator when given the index 0.
+ * @param index a value from 0..countElements()-1 indicating the
+ * transliterator to return
+ * @param ec input-output error code
+ * @return one of the transliterators that makes up this
+ * transliterator, if this transliterator is made up of multiple
+ * transliterators, otherwise a reference to this object if given
+ * an index of 0
+ * @stable ICU 3.0
+ */
+ const Transliterator& getElement(int32_t index, UErrorCode& ec) const;
+
+ /**
+ * Returns the set of all characters that may be modified in the
+ * input text by this Transliterator. This incorporates this
+ * object's current filter; if the filter is changed, the return
+ * value of this function will change. The default implementation
+ * returns an empty set. Some subclasses may override {@link
+ * #handleGetSourceSet } to return a more precise result. The
+ * return result is approximate in any case and is intended for
+ * use by tests, tools, or utilities.
+ * @param result receives result set; previous contents lost
+ * @return a reference to result
+ * @see #getTargetSet
+ * @see #handleGetSourceSet
+ * @stable ICU 2.4
+ */
+ UnicodeSet& getSourceSet(UnicodeSet& result) const;
+
+ /**
+ * Framework method that returns the set of all characters that
+ * may be modified in the input text by this Transliterator,
+ * ignoring the effect of this object's filter. The base class
+ * implementation returns the empty set. Subclasses that wish to
+ * implement this should override this method.
+ * @return the set of characters that this transliterator may
+ * modify. The set may be modified, so subclasses should return a
+ * newly-created object.
+ * @param result receives result set; previous contents lost
+ * @see #getSourceSet
+ * @see #getTargetSet
+ * @stable ICU 2.4
+ */
+ virtual void handleGetSourceSet(UnicodeSet& result) const;
+
+ /**
+ * Returns the set of all characters that may be generated as
+ * replacement text by this transliterator. The default
+ * implementation returns the empty set. Some subclasses may
+ * override this method to return a more precise result. The
+ * return result is approximate in any case and is intended for
+ * use by tests, tools, or utilities requiring such
+ * meta-information.
+ * @param result receives result set; previous contents lost
+ * @return a reference to result
+ * @see #getTargetSet
+ * @stable ICU 2.4
+ */
+ virtual UnicodeSet& getTargetSet(UnicodeSet& result) const;
+
+public:
+
+ /**
+ * Registers a factory function that creates transliterators of
+ * a given ID.
+ * @param id the ID being registered
+ * @param factory a function pointer that will be copied and
+ * called later when the given ID is passed to createInstance()
+ * @param context a context pointer that will be stored and
+ * later passed to the factory function when an ID matching
+ * the registration ID is being instantiated with this factory.
+ * @stable ICU 2.0
+ */
+ static void U_EXPORT2 registerFactory(const UnicodeString& id,
+ Factory factory,
+ Token context);
+
+ /**
+ * Registers an instance <tt>obj</tt> of a subclass of
+ * <code>Transliterator</code> with the system. When
+ * <tt>createInstance()</tt> is called with an ID string that is
+ * equal to <tt>obj->getID()</tt>, then <tt>obj->clone()</tt> is
+ * returned.
+ *
+ * After this call the Transliterator class owns the adoptedObj
+ * and will delete it.
+ *
+ * @param adoptedObj an instance of subclass of
+ * <code>Transliterator</code> that defines <tt>clone()</tt>
+ * @see #createInstance
+ * @see #registerFactory
+ * @see #unregister
+ * @stable ICU 2.0
+ */
+ static void U_EXPORT2 registerInstance(Transliterator* adoptedObj);
+
+ /**
+ * Registers an ID string as an alias of another ID string.
+ * That is, after calling this function, <tt>createInstance(aliasID)</tt>
+ * will return the same thing as <tt>createInstance(realID)</tt>.
+ * This is generally used to create shorter, more mnemonic aliases
+ * for long compound IDs.
+ *
+ * @param aliasID The new ID being registered.
+ * @param realID The ID that the new ID is to be an alias for.
+ * This can be a compound ID and can include filters and should
+ * refer to transliterators that have already been registered with
+ * the framework, although this isn't checked.
+ * @stable ICU 3.6
+ */
+ static void U_EXPORT2 registerAlias(const UnicodeString& aliasID,
+ const UnicodeString& realID);
+
+protected:
+
+ /**
+ * @internal
+ * @param id the ID being registered
+ * @param factory a function pointer that will be copied and
+ * called later when the given ID is passed to createInstance()
+ * @param context a context pointer that will be stored and
+ * later passed to the factory function when an ID matching
+ * the registration ID is being instantiated with this factory.
+ */
+ static void _registerFactory(const UnicodeString& id,
+ Factory factory,
+ Token context);
+
+ /**
+ * @internal
+ */
+ static void _registerInstance(Transliterator* adoptedObj);
+
+ /**
+ * @internal
+ */
+ static void _registerAlias(const UnicodeString& aliasID, const UnicodeString& realID);
+
+ /**
+ * Register two targets as being inverses of one another. For
+ * example, calling registerSpecialInverse("NFC", "NFD", true) causes
+ * Transliterator to form the following inverse relationships:
+ *
+ * <pre>NFC => NFD
+ * Any-NFC => Any-NFD
+ * NFD => NFC
+ * Any-NFD => Any-NFC</pre>
+ *
+ * (Without the special inverse registration, the inverse of NFC
+ * would be NFC-Any.) Note that NFD is shorthand for Any-NFD, but
+ * that the presence or absence of "Any-" is preserved.
+ *
+ * <p>The relationship is symmetrical; registering (a, b) is
+ * equivalent to registering (b, a).
+ *
+ * <p>The relevant IDs must still be registered separately as
+ * factories or classes.
+ *
+ * <p>Only the targets are specified. Special inverses always
+ * have the form Any-Target1 <=> Any-Target2. The target should
+ * have canonical casing (the casing desired to be produced when
+ * an inverse is formed) and should contain no whitespace or other
+ * extraneous characters.
+ *
+ * @param target the target against which to register the inverse
+ * @param inverseTarget the inverse of target, that is
+ * Any-target.getInverse() => Any-inverseTarget
+ * @param bidirectional if true, register the reverse relation
+ * as well, that is, Any-inverseTarget.getInverse() => Any-target
+ * @internal
+ */
+ static void _registerSpecialInverse(const UnicodeString& target,
+ const UnicodeString& inverseTarget,
+ UBool bidirectional);
+
+public:
+
+ /**
+ * Unregisters a transliterator or class. This may be either
+ * a system transliterator or a user transliterator or class.
+ * Any attempt to construct an unregistered transliterator based
+ * on its ID will fail.
+ *
+ * @param ID the ID of the transliterator or class
+ * @return the <code>Object</code> that was registered with
+ * <code>ID</code>, or <code>null</code> if none was
+ * @see #registerInstance
+ * @see #registerFactory
+ * @stable ICU 2.0
+ */
+ static void U_EXPORT2 unregister(const UnicodeString& ID);
+
+public:
+
+ /**
+ * Return a StringEnumeration over the IDs available at the time of the
+ * call, including user-registered IDs.
+ * @param ec input-output error code
+ * @return a newly-created StringEnumeration over the transliterators
+ * available at the time of the call. The caller should delete this object
+ * when done using it.
+ * @stable ICU 3.0
+ */
+ static StringEnumeration* U_EXPORT2 getAvailableIDs(UErrorCode& ec);
+
+ /**
+ * Return the number of registered source specifiers.
+ * @return the number of registered source specifiers.
+ * @stable ICU 2.0
+ */
+ static int32_t U_EXPORT2 countAvailableSources(void);
+
+ /**
+ * Return a registered source specifier.
+ * @param index which specifier to return, from 0 to n-1, where
+ * n = countAvailableSources()
+ * @param result fill-in paramter to receive the source specifier.
+ * If index is out of range, result will be empty.
+ * @return reference to result
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getAvailableSource(int32_t index,
+ UnicodeString& result);
+
+ /**
+ * Return the number of registered target specifiers for a given
+ * source specifier.
+ * @param source the given source specifier.
+ * @return the number of registered target specifiers for a given
+ * source specifier.
+ * @stable ICU 2.0
+ */
+ static int32_t U_EXPORT2 countAvailableTargets(const UnicodeString& source);
+
+ /**
+ * Return a registered target specifier for a given source.
+ * @param index which specifier to return, from 0 to n-1, where
+ * n = countAvailableTargets(source)
+ * @param source the source specifier
+ * @param result fill-in paramter to receive the target specifier.
+ * If source is invalid or if index is out of range, result will
+ * be empty.
+ * @return reference to result
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getAvailableTarget(int32_t index,
+ const UnicodeString& source,
+ UnicodeString& result);
+
+ /**
+ * Return the number of registered variant specifiers for a given
+ * source-target pair.
+ * @param source the source specifiers.
+ * @param target the target specifiers.
+ * @stable ICU 2.0
+ */
+ static int32_t U_EXPORT2 countAvailableVariants(const UnicodeString& source,
+ const UnicodeString& target);
+
+ /**
+ * Return a registered variant specifier for a given source-target
+ * pair.
+ * @param index which specifier to return, from 0 to n-1, where
+ * n = countAvailableVariants(source, target)
+ * @param source the source specifier
+ * @param target the target specifier
+ * @param result fill-in paramter to receive the variant
+ * specifier. If source is invalid or if target is invalid or if
+ * index is out of range, result will be empty.
+ * @return reference to result
+ * @stable ICU 2.0
+ */
+ static UnicodeString& U_EXPORT2 getAvailableVariant(int32_t index,
+ const UnicodeString& source,
+ const UnicodeString& target,
+ UnicodeString& result);
+
+protected:
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static int32_t _countAvailableSources(void);
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static UnicodeString& _getAvailableSource(int32_t index,
+ UnicodeString& result);
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static int32_t _countAvailableTargets(const UnicodeString& source);
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static UnicodeString& _getAvailableTarget(int32_t index,
+ const UnicodeString& source,
+ UnicodeString& result);
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static int32_t _countAvailableVariants(const UnicodeString& source,
+ const UnicodeString& target);
+
+ /**
+ * Non-mutexed internal method
+ * @internal
+ */
+ static UnicodeString& _getAvailableVariant(int32_t index,
+ const UnicodeString& source,
+ const UnicodeString& target,
+ UnicodeString& result);
+
+protected:
+
+ /**
+ * Set the ID of this transliterators. Subclasses shouldn't do
+ * this, unless the underlying script behavior has changed.
+ * @param id the new id t to be set.
+ * @stable ICU 2.4
+ */
+ void setID(const UnicodeString& id);
+
+public:
+
+ /**
+ * Return the class ID for this class. This is useful only for
+ * comparing to a return value from getDynamicClassID().
+ * Note that Transliterator is an abstract base class, and therefor
+ * no fully constructed object will have a dynamic
+ * UCLassID that equals the UClassID returned from
+ * TRansliterator::getStaticClassID().
+ * @return The class ID for class Transliterator.
+ * @stable ICU 2.0
+ */
+ static UClassID U_EXPORT2 getStaticClassID(void);
+
+ /**
+ * Returns a unique class ID <b>polymorphically</b>. 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.
+ *
+ * <p>Concrete subclasses of Transliterator must use the
+ * UOBJECT_DEFINE_RTTI_IMPLEMENTATION macro from
+ * uobject.h to provide the RTTI functions.
+ *
+ * @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(void) const = 0;
+
+private:
+ static UBool initializeRegistry(void);
+
+public:
+ /**
+ * Return the number of IDs currently registered with the system.
+ * To retrieve the actual IDs, call getAvailableID(i) with
+ * i from 0 to countAvailableIDs() - 1.
+ * @return the number of IDs currently registered with the system.
+ * @obsolete ICU 3.4 use getAvailableIDs() instead
+ */
+ static int32_t U_EXPORT2 countAvailableIDs(void);
+
+ /**
+ * Return the index-th available ID. index must be between 0
+ * and countAvailableIDs() - 1, inclusive. If index is out of
+ * range, the result of getAvailableID(0) is returned.
+ * @param index the given ID index.
+ * @return the index-th available ID. index must be between 0
+ * and countAvailableIDs() - 1, inclusive. If index is out of
+ * range, the result of getAvailableID(0) is returned.
+ * @obsolete ICU 3.4 use getAvailableIDs() instead; this function
+ * is not thread safe, since it returns a reference to storage that
+ * may become invalid if another thread calls unregister
+ */
+ static const UnicodeString& U_EXPORT2 getAvailableID(int32_t index);
+};
+
+inline int32_t Transliterator::getMaximumContextLength(void) const {
+ return maximumContextLength;
+}
+
+inline void Transliterator::setID(const UnicodeString& id) {
+ ID = id;
+ // NUL-terminate the ID string, which is a non-aliased copy.
+ ID.append((UChar)0);
+ ID.truncate(ID.length()-1);
+}
+
+inline Transliterator::Token Transliterator::integerToken(int32_t i) {
+ Token t;
+ t.integer = i;
+ return t;
+}
+
+inline Transliterator::Token Transliterator::pointerToken(void* p) {
+ Token t;
+ t.pointer = p;
+ return t;
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_TRANSLITERATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/tzrule.h b/Build/source/libs/icu-xetex/i18n/unicode/tzrule.h
new file mode 100644
index 00000000000..a0576ca87a3
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/tzrule.h
@@ -0,0 +1,828 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, International Business Machines Corporation and *
+* others. All Rights Reserved. *
+*******************************************************************************
+*/
+#ifndef TZRULE_H
+#define TZRULE_H
+
+/**
+ * \file
+ * \brief C++ API: Time zone rule classes
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+#include "unicode/unistr.h"
+#include "unicode/dtrule.h"
+
+U_NAMESPACE_BEGIN
+
+/**
+ * <code>TimeZoneRule</code> is a class representing a rule for time zone.
+ * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
+ * raw offset (UTC offset for standard time) and daylight saving time offset.
+ *
+ * @draft ICU 3.8
+ */
+class U_I18N_API TimeZoneRule : public UObject {
+public:
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~TimeZoneRule();
+
+ /**
+ * Clone this TimeZoneRule object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ virtual TimeZoneRule* clone(void) const = 0;
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZoneRule& that) const;
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZoneRule& that) const;
+
+ /**
+ * Fills in "name" with the name of this time zone.
+ * @param name Receives the name of this time zone.
+ * @return A reference to "name"
+ * @draft ICU 3.8
+ */
+ UnicodeString& getName(UnicodeString& name) const;
+
+ /**
+ * Gets the standard time offset.
+ * @return The standard time offset from UTC in milliseconds.
+ * @draft ICU 3.8
+ */
+ int32_t getRawOffset(void) const;
+
+ /**
+ * Gets the amount of daylight saving delta time from the standard time.
+ * @return The amount of daylight saving offset used by this rule
+ * in milliseconds.
+ * @draft ICU 3.8
+ */
+ int32_t getDSTSavings(void) const;
+
+ /**
+ * Returns if this rule represents the same rule and offsets as another.
+ * When two <code>TimeZoneRule</code> objects differ only its names, this method
+ * returns true.
+ * @param other The <code>TimeZoneRule</code> object to be compared with.
+ * @return true if the other <code>TimeZoneRule</code> is the same as this one.
+ * @draft ICU 3.8
+ */
+ virtual UBool isEquivalentTo(const TimeZoneRule& other) const;
+
+ /**
+ * Gets the very first time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the very first time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
+
+ /**
+ * Gets the final time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the final time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
+
+ /**
+ * Gets the first time when this rule takes effect after the specified time.
+ * @param base The first start time after this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The first time when this rule takes effect after
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const = 0;
+
+ /**
+ * Gets the most recent time when this rule takes effect before the specified time.
+ * @param base The most recent time before this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The most recent time when this rule takes effect before
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const = 0;
+
+protected:
+
+ /**
+ * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
+ * standard time and the amount of daylight saving offset adjustment.
+ * @param name The time zone name.
+ * @param rawOffset The UTC offset of its standard time in milliseconds.
+ * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
+ * If this ia a rule for standard time, the value of this argument is 0.
+ * @draft ICU 3.8
+ */
+ TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
+
+ /**
+ * Copy constructor.
+ * @param source The TimeZoneRule object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeZoneRule(const TimeZoneRule& source);
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeZoneRule& operator=(const TimeZoneRule& right);
+
+private:
+ UnicodeString fName; // time name
+ int32_t fRawOffset; // UTC offset of the standard time in milliseconds
+ int32_t fDSTSavings; // DST saving amount in milliseconds
+};
+
+/**
+ * <code>InitialTimeZoneRule</code> represents a time zone rule
+ * representing a time zone effective from the beginning and
+ * has no actual start times.
+ * @draft ICU 3.8
+ */
+class U_I18N_API InitialTimeZoneRule : public TimeZoneRule {
+public:
+ /**
+ * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
+ * standard time and the amount of daylight saving offset adjustment.
+ * @param name The time zone name.
+ * @param rawOffset The UTC offset of its standard time in milliseconds.
+ * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
+ * If this ia a rule for standard time, the value of this argument is 0.
+ * @draft ICU 3.8
+ */
+ InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
+
+ /**
+ * Copy constructor.
+ * @param source The InitialTimeZoneRule object to be copied.
+ * @draft ICU 3.8
+ */
+ InitialTimeZoneRule(const InitialTimeZoneRule& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~InitialTimeZoneRule();
+
+ /**
+ * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ virtual InitialTimeZoneRule* clone(void) const;
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right);
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZoneRule& that) const;
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the time when this rule takes effect in the given year.
+ * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the start time in the year.
+ * @return true if this rule takes effect in the year and the result is set to
+ * "result".
+ * @draft ICU 3.8
+ */
+ UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Returns if this rule represents the same rule and offsets as another.
+ * When two <code>TimeZoneRule</code> objects differ only its names, this method
+ * returns true.
+ * @param that The <code>TimeZoneRule</code> object to be compared with.
+ * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
+ * @draft ICU 3.8
+ */
+ virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the very first time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the very first time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the final time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the final time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the first time when this rule takes effect after the specified time.
+ * @param base The first start time after this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The first time when this rule takes effect after
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+ /**
+ * Gets the most recent time when this rule takes effect before the specified time.
+ * @param base The most recent time before this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The most recent time when this rule takes effect before
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+/**
+ * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
+ * rule which takes effect annually. The calenday system used for the rule is
+ * is based on Gregorian calendar
+ *
+ * @draft ICU 3.8
+ */
+class U_I18N_API AnnualTimeZoneRule : public TimeZoneRule {
+public:
+ /**
+ * The constant representing the maximum year used for designating
+ * a rule is permanent.
+ */
+ static const int32_t MAX_YEAR;
+
+ /**
+ * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
+ * standard time, the amount of daylight saving offset adjustment, the annual start
+ * time rule and the start/until years. The input DateTimeRule is copied by this
+ * constructor, so the caller remains responsible for deleting the object.
+ * @param name The time zone name.
+ * @param rawOffset The GMT offset of its standard time in milliseconds.
+ * @param dstSavings The amount of daylight saving offset adjustment in
+ * milliseconds. If this ia a rule for standard time,
+ * the value of this argument is 0.
+ * @param dateTimeRule The start date/time rule repeated annually.
+ * @param startYear The first year when this rule takes effect.
+ * @param endYear The last year when this rule takes effect. If this
+ * rule is effective forever in future, specify MAX_YEAR.
+ * @draft ICU 3.8
+ */
+ AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
+ const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear);
+
+ /**
+ * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
+ * standard time, the amount of daylight saving offset adjustment, the annual start
+ * time rule and the start/until years. The input DateTimeRule object is adopted
+ * by this object, therefore, the caller must not delete the object.
+ * @param name The time zone name.
+ * @param rawOffset The GMT offset of its standard time in milliseconds.
+ * @param dstSavings The amount of daylight saving offset adjustment in
+ * milliseconds. If this ia a rule for standard time,
+ * the value of this argument is 0.
+ * @param dateTimeRule The start date/time rule repeated annually.
+ * @param startYear The first year when this rule takes effect.
+ * @param endYear The last year when this rule takes effect. If this
+ * rule is effective forever in future, specify MAX_YEAR.
+ * @draft ICU 3.8
+ */
+ AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
+ DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear);
+
+ /**
+ * Copy constructor.
+ * @param source The AnnualTimeZoneRule object to be copied.
+ * @draft ICU 3.8
+ */
+ AnnualTimeZoneRule(const AnnualTimeZoneRule& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~AnnualTimeZoneRule();
+
+ /**
+ * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ virtual AnnualTimeZoneRule* clone(void) const;
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right);
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZoneRule& that) const;
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the start date/time rule used by this rule.
+ * @return The <code>AnnualDateTimeRule</code> which represents the start date/time
+ * rule used by this time zone rule.
+ * @draft ICU 3.8
+ */
+ const DateTimeRule* getRule(void) const;
+
+ /**
+ * Gets the first year when this rule takes effect.
+ * @return The start year of this rule. The year is in Gregorian calendar
+ * with 0 == 1 BCE, -1 == 2 BCE, etc.
+ * @draft ICU 3.8
+ */
+ int32_t getStartYear(void) const;
+
+ /**
+ * Gets the end year when this rule takes effect.
+ * @return The end year of this rule (inclusive). The year is in Gregorian calendar
+ * with 0 == 1 BCE, -1 == 2 BCE, etc.
+ * @draft ICU 3.8
+ */
+ int32_t getEndYear(void) const;
+
+ /**
+ * Gets the time when this rule takes effect in the given year.
+ * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the start time in the year.
+ * @return true if this rule takes effect in the year and the result is set to
+ * "result".
+ * @draft ICU 3.8
+ */
+ UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Returns if this rule represents the same rule and offsets as another.
+ * When two <code>TimeZoneRule</code> objects differ only its names, this method
+ * returns true.
+ * @param that The <code>TimeZoneRule</code> object to be compared with.
+ * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
+ * @draft ICU 3.8
+ */
+ virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the very first time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the very first time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the final time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the final time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the first time when this rule takes effect after the specified time.
+ * @param base The first start time after this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The first time when this rule takes effect after
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+ /**
+ * Gets the most recent time when this rule takes effect before the specified time.
+ * @param base The most recent time before this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The most recent time when this rule takes effect before
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+
+private:
+ DateTimeRule* fDateTimeRule;
+ int32_t fStartYear;
+ int32_t fEndYear;
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+/**
+ * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
+ * defined by an array of milliseconds since the standard base time.
+ *
+ * @draft ICU 3.8
+ */
+class U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule {
+public:
+ /**
+ * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
+ * standard time, the amount of daylight saving offset adjustment and
+ * the array of times when this rule takes effect.
+ * @param name The time zone name.
+ * @param rawOffset The UTC offset of its standard time in milliseconds.
+ * @param dstSavings The amount of daylight saving offset adjustment in
+ * milliseconds. If this ia a rule for standard time,
+ * the value of this argument is 0.
+ * @param startTimes The array start times in milliseconds since the base time
+ * (January 1, 1970, 00:00:00).
+ * @param numStartTimes The number of elements in the parameter "startTimes"
+ * @param timeRuleType The time type of the start times, which is one of
+ * <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
+ * and <code>UNIVERSAL_TIME</code>.
+ * @draft ICU 3.8
+ */
+ TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
+ const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType);
+
+ /**
+ * Copy constructor.
+ * @param source The TimeArrayTimeZoneRule object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~TimeArrayTimeZoneRule();
+
+ /**
+ * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ virtual TimeArrayTimeZoneRule* clone(void) const;
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right);
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZoneRule& that) const;
+
+ /**
+ * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the time type of the start times used by this rule. The return value
+ * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
+ * or <code>UNIVERSAL_TIME</code>.
+ *
+ * @return The time type used of the start times used by this rule.
+ * @draft ICU 3.8
+ */
+ DateTimeRule::TimeRuleType getTimeType(void) const;
+
+ /**
+ * Gets a start time at the index stored in this rule.
+ * @param index The index of start times
+ * @param result Receives the start time at the index
+ * @return true if the index is within the valid range and
+ * and the result is set. When false, the output
+ * parameger "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ UBool getStartTimeAt(int32_t index, UDate& result) const;
+
+ /**
+ * Returns the number of start times stored in this rule
+ * @return The number of start times.
+ * @draft ICU 3.8
+ */
+ int32_t countStartTimes(void) const;
+
+ /**
+ * Returns if this rule represents the same rule and offsets as another.
+ * When two <code>TimeZoneRule</code> objects differ only its names, this method
+ * returns true.
+ * @param that The <code>TimeZoneRule</code> object to be compared with.
+ * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
+ * @draft ICU 3.8
+ */
+ virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
+
+ /**
+ * Gets the very first time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the very first time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the final time when this rule takes effect.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param result Receives the final time when this rule takes effect.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
+
+ /**
+ * Gets the first time when this rule takes effect after the specified time.
+ * @param base The first start time after this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The first time when this rule takes effect after
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+ /**
+ * Gets the most recent time when this rule takes effect before the specified time.
+ * @param base The most recent time before this base time will be returned.
+ * @param prevRawOffset The standard time offset from UTC before this rule
+ * takes effect in milliseconds.
+ * @param prevDSTSavings The amount of daylight saving offset from the
+ * standard time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives The most recent time when this rule takes effect before
+ * the specified base time.
+ * @return true if the start time is available. When false is returned, output parameter
+ * "result" is unchanged.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
+ UBool inclusive, UDate& result) const;
+
+
+private:
+ enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 };
+ UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec);
+ UDate getUTC(UDate time, int32_t raw, int32_t dst) const;
+
+ DateTimeRule::TimeRuleType fTimeRuleType;
+ int32_t fNumStartTimes;
+ UDate* fStartTimes;
+ UDate fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE];
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // TZRULE_H
+
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/tztrans.h b/Build/source/libs/icu-xetex/i18n/unicode/tztrans.h
new file mode 100644
index 00000000000..6c7b0215f03
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/tztrans.h
@@ -0,0 +1,195 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, International Business Machines Corporation and *
+* others. All Rights Reserved. *
+*******************************************************************************
+*/
+#ifndef TZTRANS_H
+#define TZTRANS_H
+
+/**
+ * \file
+ * \brief C++ API: Time zone transition
+ */
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uobject.h"
+
+U_NAMESPACE_BEGIN
+
+// Forward declaration
+class TimeZoneRule;
+
+/**
+ * <code>TimeZoneTransition</code> is a class representing a time zone transition.
+ * An instance has a time of transition and rules for both before and after the transition.
+ * @draft ICU 3.8
+ */
+class U_I18N_API TimeZoneTransition : public UObject {
+public:
+ /**
+ * Constructs a <code>TimeZoneTransition</code> with the time and the rules before/after
+ * the transition.
+ *
+ * @param time The time of transition in milliseconds since the base time.
+ * @param from The time zone rule used before the transition.
+ * @param to The time zone rule used after the transition.
+ * @draft ICU 3.8
+ */
+ TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to);
+
+ /**
+ * Constructs an empty <code>TimeZoneTransition</code>
+ * @draft ICU 3.8
+ */
+ TimeZoneTransition();
+
+ /**
+ * Copy constructor.
+ * @param source The TimeZoneTransition object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeZoneTransition(const TimeZoneTransition& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ ~TimeZoneTransition();
+
+ /**
+ * Clone this TimeZoneTransition object polymorphically. The caller owns the result and
+ * should delete it when done.
+ * @return A copy of the object.
+ * @draft ICU 3.8
+ */
+ TimeZoneTransition* clone(void) const;
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ TimeZoneTransition& operator=(const TimeZoneTransition& right);
+
+ /**
+ * Return true if the given TimeZoneTransition objects are semantically equal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given TimeZoneTransition objects are semantically equal.
+ * @draft ICU 3.8
+ */
+ UBool operator==(const TimeZoneTransition& that) const;
+
+ /**
+ * Return true if the given TimeZoneTransition objects are semantically unequal. Objects
+ * of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given TimeZoneTransition objects are semantically unequal.
+ * @draft ICU 3.8
+ */
+ UBool operator!=(const TimeZoneTransition& that) const;
+
+ /**
+ * Returns the time of transition in milliseconds.
+ * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
+ * @draft ICU 3.8
+ */
+ UDate getTime(void) const;
+
+ /**
+ * Sets the time of transition in milliseconds.
+ * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
+ * @draft ICU 3.8
+ */
+ void setTime(UDate time);
+
+ /**
+ * Returns the rule used before the transition.
+ * @return The time zone rule used after the transition.
+ * @draft ICU 3.8
+ */
+ const TimeZoneRule* getFrom(void) const;
+
+ /**
+ * Sets the rule used before the transition. The caller remains
+ * responsible for deleting the <code>TimeZoneRule</code> object.
+ * @param from The time zone rule used before the transition.
+ * @draft ICU 3.8
+ */
+ void setFrom(const TimeZoneRule& from);
+
+ /**
+ * Adopts the rule used before the transition. The caller must
+ * not delete the <code>TimeZoneRule</code> object passed in.
+ * @param from The time zone rule used before the transition.
+ * @draft ICU 3.8
+ */
+ void adoptFrom(TimeZoneRule* from);
+
+ /**
+ * Sets the rule used after the transition. The caller remains
+ * responsible for deleting the <code>TimeZoneRule</code> object.
+ * @param to The time zone rule used after the transition.
+ * @draft ICU 3.8
+ */
+ void setTo(const TimeZoneRule& to);
+
+ /**
+ * Adopts the rule used after the transition. The caller must
+ * not delete the <code>TimeZoneRule</code> object passed in.
+ * @param to The time zone rule used after the transition.
+ * @draft ICU 3.8
+ */
+ void adoptTo(TimeZoneRule* to);
+
+ /**
+ * Returns the rule used after the transition.
+ * @return The time zone rule used after the transition.
+ * @draft ICU 3.8
+ */
+ const TimeZoneRule* getTo(void) const;
+
+private:
+ UDate fTime;
+ TimeZoneRule* fFrom;
+ TimeZoneRule* fTo;
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // TZTRANS_H
+
+//eof
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucal.h b/Build/source/libs/icu-xetex/i18n/unicode/ucal.h
new file mode 100644
index 00000000000..43648f4c502
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucal.h
@@ -0,0 +1,1089 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 1996-2007, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ *******************************************************************************
+ */
+
+#ifndef UCAL_H
+#define UCAL_H
+
+#include "unicode/utypes.h"
+#include "unicode/uenum.h"
+#include "unicode/uloc.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+/**
+ * \file
+ * \brief C API: Calendar
+ *
+ * <h2>Calendar C API</h2>
+ *
+ * UCalendar C API is used for converting between a <code>UDate</code> object
+ * and a set of integer fields such as <code>UCAL_YEAR</code>, <code>UCAL_MONTH</code>,
+ * <code>UCAL_DAY</code>, <code>UCAL_HOUR</code>, and so on.
+ * (A <code>UDate</code> object represents a specific instant in
+ * time with millisecond precision. See UDate
+ * for information about the <code>UDate</code> .)
+ *
+ * <p>
+ * Types of <code>UCalendar</code> interpret a <code>UDate</code>
+ * according to the rules of a specific calendar system. The U_STABLE
+ * provides the enum UCalendarType with UCAL_TRADITIONAL and
+ * UCAL_GREGORIAN.
+ * <p>
+ * Like other locale-sensitive C API, calendar API provides a
+ * function, <code>ucal_open()</code>, which returns a pointer to
+ * <code>UCalendar</code> whose time fields have been initialized
+ * with the current date and time. We need to specify the type of
+ * calendar to be opened and the timezoneId.
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * UCalendar *caldef;
+ * UChar *tzId;
+ * UErrorCode status;
+ * tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) );
+ * u_uastrcpy(tzId, "PST");
+ * caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status);
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <p>
+ * A <code>UCalendar</code> object can produce all the time field values
+ * needed to implement the date-time formatting for a particular language
+ * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
+ *
+ * <p>
+ * When computing a <code>UDate</code> from time fields, two special circumstances
+ * may arise: there may be insufficient information to compute the
+ * <code>UDate</code> (such as only year and month but no day in the month),
+ * or there may be inconsistent information (such as "Tuesday, July 15, 1996"
+ * -- July 15, 1996 is actually a Monday).
+ *
+ * <p>
+ * <strong>Insufficient information.</strong> The calendar will use default
+ * information to specify the missing fields. This may vary by calendar; for
+ * the Gregorian calendar, the default for a field is the same as that of the
+ * start of the epoch: i.e., UCAL_YEAR = 1970, UCAL_MONTH = JANUARY, UCAL_DATE = 1, etc.
+ *
+ * <p>
+ * <strong>Inconsistent information.</strong> If fields conflict, the calendar
+ * will give preference to fields set more recently. For example, when
+ * determining the day, the calendar will look for one of the following
+ * combinations of fields. The most recent combination, as determined by the
+ * most recently set single field, will be used.
+ *
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * UCAL_MONTH + UCAL_DAY_OF_MONTH
+ * UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
+ * UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK
+ * UCAL_DAY_OF_YEAR
+ * UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * For the time of day:
+ *
+ * \htmlonly<blockquote>\endhtmlonly
+ * <pre>
+ * \code
+ * UCAL_HOUR_OF_DAY
+ * UCAL_AM_PM + UCAL_HOUR
+ * \endcode
+ * </pre>
+ * \htmlonly</blockquote>\endhtmlonly
+ *
+ * <p>
+ * <strong>Note:</strong> for some non-Gregorian calendars, different
+ * fields may be necessary for complete disambiguation. For example, a full
+ * specification of the historial Arabic astronomical calendar requires year,
+ * month, day-of-month <em>and</em> day-of-week in some cases.
+ *
+ * <p>
+ * <strong>Note:</strong> There are certain possible ambiguities in
+ * interpretation of certain singular times, which are resolved in the
+ * following ways:
+ * <ol>
+ * <li> 24:00:00 "belongs" to the following day. That is,
+ * 23:59 on Dec 31, 1969 &lt; 24:00 on Jan 1, 1970 &lt; 24:01:00 on Jan 1, 1970
+ *
+ * <li> Although historically not precise, midnight also belongs to "am",
+ * and noon belongs to "pm", so on the same day,
+ * 12:00 am (midnight) &lt; 12:01 am, and 12:00 pm (noon) &lt; 12:01 pm
+ * </ol>
+ *
+ * <p>
+ * The date or time format strings are not part of the definition of a
+ * calendar, as those must be modifiable or overridable by the user at
+ * runtime. Use {@link DateFormat}
+ * to format dates.
+ *
+ * <p>
+ * <code>Calendar</code> provides an API for field "rolling", where fields
+ * can be incremented or decremented, but wrap around. For example, rolling the
+ * month up in the date <code>December 12, <b>1996</b></code> results in
+ * <code>January 12, <b>1996</b></code>.
+ *
+ * <p>
+ * <code>Calendar</code> also provides a date arithmetic function for
+ * adding the specified (signed) amount of time to a particular time field.
+ * For example, subtracting 5 days from the date <code>September 12, 1996</code>
+ * results in <code>September 7, 1996</code>.
+ *
+ * @stable ICU 2.0
+ */
+
+/** A calendar.
+ * For usage in C programs.
+ * @stable ICU 2.0
+ */
+typedef void* UCalendar;
+
+/** Possible types of UCalendars
+ * @stable ICU 2.0
+ */
+enum UCalendarType {
+ /** A traditional calendar for the locale */
+ UCAL_TRADITIONAL,
+ /** The Gregorian calendar */
+ UCAL_GREGORIAN
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarType UCalendarType;
+
+/** Possible fields in a UCalendar
+ * @stable ICU 2.0
+ */
+enum UCalendarDateFields {
+ /**
+ * Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar.
+ * This is a calendar-specific value.
+ * @stable ICU 2.6
+ */
+ UCAL_ERA,
+
+ /**
+ * Field number indicating the year. This is a calendar-specific value.
+ * @stable ICU 2.6
+ */
+ UCAL_YEAR,
+
+ /**
+ * Field number indicating the month. This is a calendar-specific value.
+ * The first month of the year is
+ * <code>JANUARY</code>; the last depends on the number of months in a year.
+ * @see #UCAL_JANUARY
+ * @see #UCAL_FEBRUARY
+ * @see #UCAL_MARCH
+ * @see #UCAL_APRIL
+ * @see #UCAL_MAY
+ * @see #UCAL_JUNE
+ * @see #UCAL_JULY
+ * @see #UCAL_AUGUST
+ * @see #UCAL_SEPTEMBER
+ * @see #UCAL_OCTOBER
+ * @see #UCAL_NOVEMBER
+ * @see #UCAL_DECEMBER
+ * @see #UCAL_UNDECIMBER
+ * @stable ICU 2.6
+ */
+ UCAL_MONTH,
+
+ /**
+ * Field number indicating the
+ * week number within the current year. The first week of the year, as
+ * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
+ * attributes, has value 1. Subclasses define
+ * the value of <code>UCAL_WEEK_OF_YEAR</code> for days before the first week of
+ * the year.
+ * @see ucal_getAttribute
+ * @see ucal_setAttribute
+ * @stable ICU 2.6
+ */
+ UCAL_WEEK_OF_YEAR,
+
+ /**
+ * Field number indicating the
+ * week number within the current month. The first week of the month, as
+ * defined by <code>UCAL_FIRST_DAY_OF_WEEK</code> and <code>UCAL_MINIMAL_DAYS_IN_FIRST_WEEK</code>
+ * attributes, has value 1. Subclasses define
+ * the value of <code>WEEK_OF_MONTH</code> for days before the first week of
+ * the month.
+ * @see ucal_getAttribute
+ * @see ucal_setAttribute
+ * @see #UCAL_FIRST_DAY_OF_WEEK
+ * @see #UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
+ * @stable ICU 2.6
+ */
+ UCAL_WEEK_OF_MONTH,
+
+ /**
+ * Field number indicating the
+ * day of the month. This is a synonym for <code>DAY_OF_MONTH</code>.
+ * The first day of the month has value 1.
+ * @see #UCAL_DAY_OF_MONTH
+ * @stable ICU 2.6
+ */
+ UCAL_DATE,
+
+ /**
+ * Field number indicating the day
+ * number within the current year. The first day of the year has value 1.
+ * @stable ICU 2.6
+ */
+ UCAL_DAY_OF_YEAR,
+
+ /**
+ * Field number indicating the day
+ * of the week. This field takes values <code>SUNDAY</code>,
+ * <code>MONDAY</code>, <code>TUESDAY</code>, <code>WEDNESDAY</code>,
+ * <code>THURSDAY</code>, <code>FRIDAY</code>, and <code>SATURDAY</code>.
+ * @see #UCAL_SUNDAY
+ * @see #UCAL_MONDAY
+ * @see #UCAL_TUESDAY
+ * @see #UCAL_WEDNESDAY
+ * @see #UCAL_THURSDAY
+ * @see #UCAL_FRIDAY
+ * @see #UCAL_SATURDAY
+ * @stable ICU 2.6
+ */
+ UCAL_DAY_OF_WEEK,
+
+ /**
+ * Field number indicating the
+ * ordinal number of the day of the week within the current month. Together
+ * with the <code>DAY_OF_WEEK</code> field, this uniquely specifies a day
+ * within a month. Unlike <code>WEEK_OF_MONTH</code> and
+ * <code>WEEK_OF_YEAR</code>, this field's value does <em>not</em> depend on
+ * <code>getFirstDayOfWeek()</code> or
+ * <code>getMinimalDaysInFirstWeek()</code>. <code>DAY_OF_MONTH 1</code>
+ * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH
+ * 1</code>; <code>8</code> through <code>15</code> correspond to
+ * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on.
+ * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before
+ * <code>DAY_OF_WEEK_IN_MONTH 1</code>. Negative values count back from the
+ * end of the month, so the last Sunday of a month is specified as
+ * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>. Because
+ * negative values count backward they will usually be aligned differently
+ * within the month than positive values. For example, if a month has 31
+ * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap
+ * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>.
+ * @see #UCAL_DAY_OF_WEEK
+ * @see #UCAL_WEEK_OF_MONTH
+ * @stable ICU 2.6
+ */
+ UCAL_DAY_OF_WEEK_IN_MONTH,
+
+ /**
+ * Field number indicating
+ * whether the <code>HOUR</code> is before or after noon.
+ * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>.
+ * @see #UCAL_AM
+ * @see #UCAL_PM
+ * @see #UCAL_HOUR
+ * @stable ICU 2.6
+ */
+ UCAL_AM_PM,
+
+ /**
+ * Field number indicating the
+ * hour of the morning or afternoon. <code>HOUR</code> is used for the 12-hour
+ * clock.
+ * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.
+ * @see #UCAL_AM_PM
+ * @see #UCAL_HOUR_OF_DAY
+ * @stable ICU 2.6
+ */
+ UCAL_HOUR,
+
+ /**
+ * Field number indicating the
+ * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.
+ * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.
+ * @see #UCAL_HOUR
+ * @stable ICU 2.6
+ */
+ UCAL_HOUR_OF_DAY,
+
+ /**
+ * Field number indicating the
+ * minute within the hour.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_MINUTE</code> is 4.
+ * @stable ICU 2.6
+ */
+ UCAL_MINUTE,
+
+ /**
+ * Field number indicating the
+ * second within the minute.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_SECOND</code> is 15.
+ * @stable ICU 2.6
+ */
+ UCAL_SECOND,
+
+ /**
+ * Field number indicating the
+ * millisecond within the second.
+ * E.g., at 10:04:15.250 PM the <code>UCAL_MILLISECOND</code> is 250.
+ * @stable ICU 2.6
+ */
+ UCAL_MILLISECOND,
+
+ /**
+ * Field number indicating the
+ * raw offset from GMT in milliseconds.
+ * @stable ICU 2.6
+ */
+ UCAL_ZONE_OFFSET,
+
+ /**
+ * Field number indicating the
+ * daylight savings offset in milliseconds.
+ * @stable ICU 2.6
+ */
+ UCAL_DST_OFFSET,
+
+ /**
+ * Field number
+ * indicating the extended year corresponding to the
+ * <code>UCAL_WEEK_OF_YEAR</code> field. This may be one greater or less
+ * than the value of <code>UCAL_EXTENDED_YEAR</code>.
+ * @stable ICU 2.6
+ */
+ UCAL_YEAR_WOY,
+
+ /**
+ * Field number
+ * indicating the localized day of week. This will be a value from 1
+ * to 7 inclusive, with 1 being the localized first day of the week.
+ * @stable ICU 2.6
+ */
+ UCAL_DOW_LOCAL,
+
+ /**
+ * Year of this calendar system, encompassing all supra-year fields. For example,
+ * in Gregorian/Julian calendars, positive Extended Year values indicate years AD,
+ * 1 BC = 0 extended, 2 BC = -1 extended, and so on.
+ * @stable ICU 2.8
+ */
+ UCAL_EXTENDED_YEAR,
+
+ /**
+ * Field number
+ * indicating the modified Julian day number. This is different from
+ * the conventional Julian day number in two regards. First, it
+ * demarcates days at local zone midnight, rather than noon GMT.
+ * Second, it is a local number; that is, it depends on the local time
+ * zone. It can be thought of as a single number that encompasses all
+ * the date-related fields.
+ * @stable ICU 2.8
+ */
+ UCAL_JULIAN_DAY,
+
+ /**
+ * Ranges from 0 to 23:59:59.999 (regardless of DST). This field behaves <em>exactly</em>
+ * like a composite of all time-related fields, not including the zone fields. As such,
+ * it also reflects discontinuities of those fields on DST transition days. On a day
+ * of DST onset, it will jump forward. On a day of DST cessation, it will jump
+ * backward. This reflects the fact that it must be combined with the DST_OFFSET field
+ * to obtain a unique local time value.
+ * @stable ICU 2.8
+ */
+ UCAL_MILLISECONDS_IN_DAY,
+
+ /**
+ * Field count
+ * @stable ICU 2.6
+ */
+ UCAL_FIELD_COUNT,
+
+ /**
+ * Field number indicating the
+ * day of the month. This is a synonym for <code>UCAL_DATE</code>.
+ * The first day of the month has value 1.
+ * @see #UCAL_DATE
+ * Synonym for UCAL_DATE
+ * @stable ICU 2.8
+ **/
+ UCAL_DAY_OF_MONTH=UCAL_DATE
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarDateFields UCalendarDateFields;
+ /**
+ * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients
+ * who create locale resources for the field of first-day-of-week should be aware of
+ * this. For instance, in US locale, first-day-of-week is set to 1, i.e., UCAL_SUNDAY.
+ */
+/** Possible days of the week in a UCalendar
+ * @stable ICU 2.0
+ */
+enum UCalendarDaysOfWeek {
+ /** Sunday */
+ UCAL_SUNDAY = 1,
+ /** Monday */
+ UCAL_MONDAY,
+ /** Tuesday */
+ UCAL_TUESDAY,
+ /** Wednesday */
+ UCAL_WEDNESDAY,
+ /** Thursday */
+ UCAL_THURSDAY,
+ /** Friday */
+ UCAL_FRIDAY,
+ /** Saturday */
+ UCAL_SATURDAY
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
+
+/** Possible months in a UCalendar. Note: Calendar month is 0-based.
+ * @stable ICU 2.0
+ */
+enum UCalendarMonths {
+ /** January */
+ UCAL_JANUARY,
+ /** February */
+ UCAL_FEBRUARY,
+ /** March */
+ UCAL_MARCH,
+ /** April */
+ UCAL_APRIL,
+ /** May */
+ UCAL_MAY,
+ /** June */
+ UCAL_JUNE,
+ /** July */
+ UCAL_JULY,
+ /** August */
+ UCAL_AUGUST,
+ /** September */
+ UCAL_SEPTEMBER,
+ /** October */
+ UCAL_OCTOBER,
+ /** November */
+ UCAL_NOVEMBER,
+ /** December */
+ UCAL_DECEMBER,
+ /** Value of the <code>UCAL_MONTH</code> field indicating the
+ * thirteenth month of the year. Although the Gregorian calendar
+ * does not use this value, lunar calendars do.
+ */
+ UCAL_UNDECIMBER
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarMonths UCalendarMonths;
+
+/** Possible AM/PM values in a UCalendar
+ * @stable ICU 2.0
+ */
+enum UCalendarAMPMs {
+ /** AM */
+ UCAL_AM,
+ /** PM */
+ UCAL_PM
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarAMPMs UCalendarAMPMs;
+
+/**
+ * Create an enumeration over all time zones.
+ *
+ * @param ec input/output error code
+ *
+ * @return an enumeration object that the caller must dispose of using
+ * uenum_close(), or NULL upon failure. In case of failure *ec will
+ * indicate the error.
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucal_openTimeZones(UErrorCode* ec);
+
+/**
+ * Create an enumeration over all time zones associated with the given
+ * country. Some zones are affiliated with no country (e.g., "UTC");
+ * these may also be retrieved, as a group.
+ *
+ * @param country the ISO 3166 two-letter country code, or NULL to
+ * retrieve zones not affiliated with any country
+ *
+ * @param ec input/output error code
+ *
+ * @return an enumeration object that the caller must dispose of using
+ * uenum_close(), or NULL upon failure. In case of failure *ec will
+ * indicate the error.
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
+
+/**
+ * Return the default time zone. The default is determined initially
+ * by querying the host operating system. It may be changed with
+ * ucal_setDefaultTimeZone() or with the C++ TimeZone API.
+ *
+ * @param result A buffer to receive the result, or NULL
+ *
+ * @param resultCapacity The capacity of the result buffer
+ *
+ * @param ec input/output error code
+ *
+ * @return The result string length, not including the terminating
+ * null
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
+
+/**
+ * Set the default time zone.
+ *
+ * @param zoneID null-terminated time zone ID
+ *
+ * @param ec input/output error code
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE void U_EXPORT2
+ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
+
+/**
+ * Return the amount of time in milliseconds that the clock is
+ * advanced during daylight savings time for the given time zone, or
+ * zero if the time zone does not observe daylight savings time.
+ *
+ * @param zoneID null-terminated time zone ID
+ *
+ * @param ec input/output error code
+ *
+ * @return the number of milliseconds the time is advanced with
+ * respect to standard time when the daylight savings rules are in
+ * effect. This is always a non-negative number, most commonly either
+ * 3,600,000 (one hour) or zero.
+ *
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
+
+/**
+ * Get the current date and time.
+ * The value returned is represented as milliseconds from the epoch.
+ * @return The current date and time.
+ * @stable ICU 2.0
+ */
+U_STABLE UDate U_EXPORT2
+ucal_getNow(void);
+
+/**
+ * Open a UCalendar.
+ * A UCalendar may be used to convert a millisecond value to a year,
+ * month, and day.
+ * @param zoneID The desired TimeZone ID. If 0, use the default time zone.
+ * @param len The length of zoneID, or -1 if null-terminated.
+ * @param locale The desired locale
+ * @param type The type of UCalendar to open.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCalendar, or 0 if an error occurred.
+ * @stable ICU 2.0
+ */
+U_STABLE UCalendar* U_EXPORT2
+ucal_open(const UChar* zoneID,
+ int32_t len,
+ const char* locale,
+ UCalendarType type,
+ UErrorCode* status);
+
+/**
+ * Close a UCalendar.
+ * Once closed, a UCalendar may no longer be used.
+ * @param cal The UCalendar to close.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_close(UCalendar *cal);
+
+/**
+ * Set the TimeZone used by a UCalendar.
+ * A UCalendar uses a timezone for converting from Greenwich time to local time.
+ * @param cal The UCalendar to set.
+ * @param zoneID The desired TimeZone ID. If 0, use the default time zone.
+ * @param len The length of zoneID, or -1 if null-terminated.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_setTimeZone(UCalendar* cal,
+ const UChar* zoneID,
+ int32_t len,
+ UErrorCode* status);
+
+/**
+ * Possible formats for a UCalendar's display name
+ * @stable ICU 2.0
+ */
+enum UCalendarDisplayNameType {
+ /** Standard display name */
+ UCAL_STANDARD,
+ /** Short standard display name */
+ UCAL_SHORT_STANDARD,
+ /** Daylight savings display name */
+ UCAL_DST,
+ /** Short daylight savings display name */
+ UCAL_SHORT_DST
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
+
+/**
+ * Get the display name for a UCalendar's TimeZone.
+ * A display name is suitable for presentation to a user.
+ * @param cal The UCalendar to query.
+ * @param type The desired display name format; one of UCAL_STANDARD, UCAL_SHORT_STANDARD,
+ * UCAL_DST, UCAL_SHORT_DST
+ * @param locale The desired locale for the display name.
+ * @param result A pointer to a buffer to receive the formatted number.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The total buffer size needed; if greater than resultLength, the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_getTimeZoneDisplayName(const UCalendar* cal,
+ UCalendarDisplayNameType type,
+ const char* locale,
+ UChar* result,
+ int32_t resultLength,
+ UErrorCode* status);
+
+/**
+ * Determine if a UCalendar is currently in daylight savings time.
+ * Daylight savings time is not used in all parts of the world.
+ * @param cal The UCalendar to query.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return TRUE if cal is currently in daylight savings time, FALSE otherwise
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucal_inDaylightTime(const UCalendar* cal,
+ UErrorCode* status );
+
+/**
+ * Sets the GregorianCalendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * This function works only for Gregorian calendars. If the UCalendar is not
+ * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
+ * error code is set.
+ *
+ * @param cal The calendar object.
+ * @param date The given Gregorian cutover date.
+ * @param pErrorCode Pointer to a standard ICU error code. Its input value must
+ * pass the U_SUCCESS() test, or else the function returns
+ * immediately. Check for U_FAILURE() on output or use with
+ * function chaining. (See User Guide for details.)
+ *
+ * @see GregorianCalendar::setGregorianChange
+ * @see ucal_getGregorianChange
+ * @stable ICU 3.6
+ */
+U_STABLE void U_EXPORT2
+ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
+
+/**
+ * Gets the Gregorian Calendar change date. This is the point when the switch from
+ * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October
+ * 15, 1582. Previous to this time and date will be Julian dates.
+ *
+ * This function works only for Gregorian calendars. If the UCalendar is not
+ * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR
+ * error code is set.
+ *
+ * @param cal The calendar object.
+ * @param pErrorCode Pointer to a standard ICU error code. Its input value must
+ * pass the U_SUCCESS() test, or else the function returns
+ * immediately. Check for U_FAILURE() on output or use with
+ * function chaining. (See User Guide for details.)
+ * @return The Gregorian cutover time for this calendar.
+ *
+ * @see GregorianCalendar::getGregorianChange
+ * @see ucal_setGregorianChange
+ * @stable ICU 3.6
+ */
+U_STABLE UDate U_EXPORT2
+ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
+
+/**
+ * Types of UCalendar attributes
+ * @stable ICU 2.0
+ */
+enum UCalendarAttribute {
+ /** Lenient parsing */
+ UCAL_LENIENT,
+ /** First day of week */
+ UCAL_FIRST_DAY_OF_WEEK,
+ /** Minimum number of days in first week */
+ UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarAttribute UCalendarAttribute;
+
+/**
+ * Get a numeric attribute associated with a UCalendar.
+ * Numeric attributes include the first day of the week, or the minimal numbers
+ * of days in the first week of the month.
+ * @param cal The UCalendar to query.
+ * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK,
+ * or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
+ * @return The value of attr.
+ * @see ucal_setAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_getAttribute(const UCalendar* cal,
+ UCalendarAttribute attr);
+
+/**
+ * Set a numeric attribute associated with a UCalendar.
+ * Numeric attributes include the first day of the week, or the minimal numbers
+ * of days in the first week of the month.
+ * @param cal The UCalendar to set.
+ * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK,
+ * or UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
+ * @param newValue The new value of attr.
+ * @see ucal_getAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_setAttribute(UCalendar* cal,
+ UCalendarAttribute attr,
+ int32_t newValue);
+
+/**
+ * Get a locale for which calendars are available.
+ * A UCalendar in a locale returned by this function will contain the correct
+ * day and month names for the locale.
+ * @param index The index of the desired locale.
+ * @return A locale for which calendars are available, or 0 if none.
+ * @see ucal_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+ucal_getAvailable(int32_t index);
+
+/**
+ * Determine how many locales have calendars available.
+ * This function is most useful as determining the loop ending condition for
+ * calls to \ref ucal_getAvailable.
+ * @return The number of locales for which calendars are available.
+ * @see ucal_getAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_countAvailable(void);
+
+/**
+ * Get a UCalendar's current time in millis.
+ * The time is represented as milliseconds from the epoch.
+ * @param cal The UCalendar to query.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The calendar's current time in millis.
+ * @see ucal_setMillis
+ * @see ucal_setDate
+ * @see ucal_setDateTime
+ * @stable ICU 2.0
+ */
+U_STABLE UDate U_EXPORT2
+ucal_getMillis(const UCalendar* cal,
+ UErrorCode* status);
+
+/**
+ * Set a UCalendar's current time in millis.
+ * The time is represented as milliseconds from the epoch.
+ * @param cal The UCalendar to set.
+ * @param dateTime The desired date and time.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucal_getMillis
+ * @see ucal_setDate
+ * @see ucal_setDateTime
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_setMillis(UCalendar* cal,
+ UDate dateTime,
+ UErrorCode* status );
+
+/**
+ * Set a UCalendar's current date.
+ * The date is represented as a series of 32-bit integers.
+ * @param cal The UCalendar to set.
+ * @param year The desired year.
+ * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY,
+ * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
+ * @param date The desired day of the month.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucal_getMillis
+ * @see ucal_setMillis
+ * @see ucal_setDateTime
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_setDate(UCalendar* cal,
+ int32_t year,
+ int32_t month,
+ int32_t date,
+ UErrorCode* status);
+
+/**
+ * Set a UCalendar's current date.
+ * The date is represented as a series of 32-bit integers.
+ * @param cal The UCalendar to set.
+ * @param year The desired year.
+ * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY,
+ * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER
+ * @param date The desired day of the month.
+ * @param hour The desired hour of day.
+ * @param minute The desired minute.
+ * @param second The desirec second.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucal_getMillis
+ * @see ucal_setMillis
+ * @see ucal_setDate
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_setDateTime(UCalendar* cal,
+ int32_t year,
+ int32_t month,
+ int32_t date,
+ int32_t hour,
+ int32_t minute,
+ int32_t second,
+ UErrorCode* status);
+
+/**
+ * Returns TRUE if two UCalendars are equivalent. Equivalent
+ * UCalendars will behave identically, but they may be set to
+ * different times.
+ * @param cal1 The first of the UCalendars to compare.
+ * @param cal2 The second of the UCalendars to compare.
+ * @return TRUE if cal1 and cal2 are equivalent, FALSE otherwise.
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucal_equivalentTo(const UCalendar* cal1,
+ const UCalendar* cal2);
+
+/**
+ * Add a specified signed amount to a particular field in a UCalendar.
+ * This can modify more significant fields in the calendar.
+ * @param cal The UCalendar to which to add.
+ * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @param amount The signed amount to add to field. If the amount causes the value
+ * to exceed to maximum or minimum values for that field, other fields are modified
+ * to preserve the magnitude of the change.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucal_roll
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_add(UCalendar* cal,
+ UCalendarDateFields field,
+ int32_t amount,
+ UErrorCode* status);
+
+/**
+ * Add a specified signed amount to a particular field in a UCalendar.
+ * This will not modify more significant fields in the calendar.
+ * @param cal The UCalendar to which to add.
+ * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @param amount The signed amount to add to field. If the amount causes the value
+ * to exceed to maximum or minimum values for that field, the field is pinned to a permissible
+ * value.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucal_add
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_roll(UCalendar* cal,
+ UCalendarDateFields field,
+ int32_t amount,
+ UErrorCode* status);
+
+/**
+ * Get the current value of a field from a UCalendar.
+ * All fields are represented as 32-bit integers.
+ * @param cal The UCalendar to query.
+ * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The value of the desired field.
+ * @see ucal_set
+ * @see ucal_isSet
+ * @see ucal_clearField
+ * @see ucal_clear
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_get(const UCalendar* cal,
+ UCalendarDateFields field,
+ UErrorCode* status );
+
+/**
+ * Set the value of a field in a UCalendar.
+ * All fields are represented as 32-bit integers.
+ * @param cal The UCalendar to set.
+ * @param field The field to set; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @param value The desired value of field.
+ * @see ucal_get
+ * @see ucal_isSet
+ * @see ucal_clearField
+ * @see ucal_clear
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_set(UCalendar* cal,
+ UCalendarDateFields field,
+ int32_t value);
+
+/**
+ * Determine if a field in a UCalendar is set.
+ * All fields are represented as 32-bit integers.
+ * @param cal The UCalendar to query.
+ * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @return TRUE if field is set, FALSE otherwise.
+ * @see ucal_get
+ * @see ucal_set
+ * @see ucal_clearField
+ * @see ucal_clear
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucal_isSet(const UCalendar* cal,
+ UCalendarDateFields field);
+
+/**
+ * Clear a field in a UCalendar.
+ * All fields are represented as 32-bit integers.
+ * @param cal The UCalendar containing the field to clear.
+ * @param field The field to clear; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @see ucal_get
+ * @see ucal_set
+ * @see ucal_isSet
+ * @see ucal_clear
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_clearField(UCalendar* cal,
+ UCalendarDateFields field);
+
+/**
+ * Clear all fields in a UCalendar.
+ * All fields are represented as 32-bit integers.
+ * @param calendar The UCalendar to clear.
+ * @see ucal_get
+ * @see ucal_set
+ * @see ucal_isSet
+ * @see ucal_clearField
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucal_clear(UCalendar* calendar);
+
+/**
+ * Possible limit values for a UCalendar
+ * @stable ICU 2.0
+ */
+enum UCalendarLimitType {
+ /** Minimum value */
+ UCAL_MINIMUM,
+ /** Maximum value */
+ UCAL_MAXIMUM,
+ /** Greatest minimum value */
+ UCAL_GREATEST_MINIMUM,
+ /** Leaest maximum value */
+ UCAL_LEAST_MAXIMUM,
+ /** Actual minimum value */
+ UCAL_ACTUAL_MINIMUM,
+ /** Actual maximum value */
+ UCAL_ACTUAL_MAXIMUM
+};
+
+/** @stable ICU 2.0 */
+typedef enum UCalendarLimitType UCalendarLimitType;
+
+/**
+ * Determine a limit for a field in a UCalendar.
+ * A limit is a maximum or minimum value for a field.
+ * @param cal The UCalendar to query.
+ * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH,
+ * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK,
+ * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND,
+ * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET.
+ * @param type The desired critical point; one of UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM,
+ * UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return The requested value.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucal_getLimit(const UCalendar* cal,
+ UCalendarDateFields field,
+ UCalendarLimitType type,
+ UErrorCode* status);
+
+/** Get the locale for this calendar object. You can choose between valid and actual locale.
+ * @param cal The calendar object
+ * @param type type of the locale we're looking for (valid or actual)
+ * @param status error code for the operation
+ * @return the locale name
+ * @stable ICU 2.8
+ */
+U_STABLE const char * U_EXPORT2
+ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
+
+/**
+ * Returns the timezone data version currently used by ICU.
+ * @param status error code for the operation
+ * @return the version string, such as "2007f"
+ * @draft ICU 3.8
+ */
+U_DRAFT const char * U_EXPORT2
+ucal_getTZDataVersion(UErrorCode* status);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucol.h b/Build/source/libs/icu-xetex/i18n/unicode/ucol.h
new file mode 100644
index 00000000000..37abe2cc22e
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucol.h
@@ -0,0 +1,1223 @@
+/*
+*******************************************************************************
+* Copyright (c) 1996-2007, International Business Machines Corporation and others.
+* All Rights Reserved.
+*******************************************************************************
+*/
+
+#ifndef UCOL_H
+#define UCOL_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/unorm.h"
+#include "unicode/parseerr.h"
+#include "unicode/uloc.h"
+#include "unicode/uset.h"
+
+/**
+ * \file
+ * \brief C API: Collator
+ *
+ * <h2> Collator C API </h2>
+ *
+ * The C API for Collator performs locale-sensitive
+ * string comparison. You use this service to build
+ * searching and sorting routines for natural language text.
+ * <em>Important: </em>The ICU collation service has been reimplemented
+ * in order to achieve better performance and UCA compliance.
+ * For details, see the
+ * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+ * collation design document</a>.
+ * <p>
+ * For more information about the collation service see
+ * <a href="http://icu-project.org/userguide/Collate_Intro.html">the users guide</a>.
+ * <p>
+ * Collation service provides correct sorting orders for most locales supported in ICU.
+ * If specific data for a locale is not available, the orders eventually falls back
+ * to the <a href="http://www.unicode.org/unicode/reports/tr10/">UCA sort order</a>.
+ * <p>
+ * Sort ordering may be customized by providing your own set of rules. For more on
+ * this subject see the
+ * <a href="http://icu-project.org/userguide/Collate_Customization.html">
+ * Collation customization</a> section of the users guide.
+ * <p>
+ * @see UCollationResult
+ * @see UNormalizationMode
+ * @see UCollationStrength
+ * @see UCollationElements
+ */
+
+/** A collator.
+* For usage in C programs.
+*/
+struct UCollator;
+/** structure representing a collator object instance
+ * @stable ICU 2.0
+ */
+typedef struct UCollator UCollator;
+
+
+/**
+ * UCOL_LESS is returned if source string is compared to be less than target
+ * string in the u_strcoll() method.
+ * UCOL_EQUAL is returned if source string is compared to be equal to target
+ * string in the u_strcoll() method.
+ * UCOL_GREATER is returned if source string is compared to be greater than
+ * target string in the u_strcoll() method.
+ * @see u_strcoll()
+ * <p>
+ * Possible values for a comparison result
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** string a == string b */
+ UCOL_EQUAL = 0,
+ /** string a > string b */
+ UCOL_GREATER = 1,
+ /** string a < string b */
+ UCOL_LESS = -1
+} UCollationResult ;
+
+
+/** Enum containing attribute values for controling collation behavior.
+ * Here are all the allowable values. Not every attribute can take every value. The only
+ * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined
+ * value for that locale
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** accepted by most attributes */
+ UCOL_DEFAULT = -1,
+
+ /** Primary collation strength */
+ UCOL_PRIMARY = 0,
+ /** Secondary collation strength */
+ UCOL_SECONDARY = 1,
+ /** Tertiary collation strength */
+ UCOL_TERTIARY = 2,
+ /** Default collation strength */
+ UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY,
+ UCOL_CE_STRENGTH_LIMIT,
+ /** Quaternary collation strength */
+ UCOL_QUATERNARY=3,
+ /** Identical collation strength */
+ UCOL_IDENTICAL=15,
+ UCOL_STRENGTH_LIMIT,
+
+ /** Turn the feature off - works for UCOL_FRENCH_COLLATION,
+ UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+ & UCOL_DECOMPOSITION_MODE*/
+ UCOL_OFF = 16,
+ /** Turn the feature on - works for UCOL_FRENCH_COLLATION,
+ UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE
+ & UCOL_DECOMPOSITION_MODE*/
+ UCOL_ON = 17,
+
+ /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */
+ UCOL_SHIFTED = 20,
+ /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */
+ UCOL_NON_IGNORABLE = 21,
+
+ /** Valid for UCOL_CASE_FIRST -
+ lower case sorts before upper case */
+ UCOL_LOWER_FIRST = 24,
+ /** upper case sorts before lower case */
+ UCOL_UPPER_FIRST = 25,
+
+ UCOL_ATTRIBUTE_VALUE_COUNT
+
+} UColAttributeValue;
+
+/**
+ * Base letter represents a primary difference. Set comparison
+ * level to UCOL_PRIMARY to ignore secondary and tertiary differences.
+ * Use this to set the strength of a Collator object.
+ * Example of primary difference, "abc" &lt; "abd"
+ *
+ * Diacritical differences on the same base letter represent a secondary
+ * difference. Set comparison level to UCOL_SECONDARY to ignore tertiary
+ * differences. Use this to set the strength of a Collator object.
+ * Example of secondary difference, "&auml;" >> "a".
+ *
+ * Uppercase and lowercase versions of the same character represents a
+ * tertiary difference. Set comparison level to UCOL_TERTIARY to include
+ * all comparison differences. Use this to set the strength of a Collator
+ * object.
+ * Example of tertiary difference, "abc" &lt;&lt;&lt; "ABC".
+ *
+ * Two characters are considered "identical" when they have the same
+ * unicode spellings. UCOL_IDENTICAL.
+ * For example, "&auml;" == "&auml;".
+ *
+ * UCollationStrength is also used to determine the strength of sort keys
+ * generated from UCollator objects
+ * These values can be now found in the UColAttributeValue enum.
+ * @stable ICU 2.0
+ **/
+typedef UColAttributeValue UCollationStrength;
+
+/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT
+ * value, as well as the values specific to each one.
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** Attribute for direction of secondary weights - used in French.
+ * Acceptable values are UCOL_ON, which results in secondary weights
+ * being considered backwards and UCOL_OFF which treats secondary
+ * weights in the order they appear.*/
+ UCOL_FRENCH_COLLATION,
+ /** Attribute for handling variable elements.
+ * Acceptable values are UCOL_NON_IGNORABLE (default)
+ * which treats all the codepoints with non-ignorable
+ * primary weights in the same way,
+ * and UCOL_SHIFTED which causes codepoints with primary
+ * weights that are equal or below the variable top value
+ * to be ignored on primary level and moved to the quaternary
+ * level.*/
+ UCOL_ALTERNATE_HANDLING,
+ /** Controls the ordering of upper and lower case letters.
+ * Acceptable values are UCOL_OFF (default), which orders
+ * upper and lower case letters in accordance to their tertiary
+ * weights, UCOL_UPPER_FIRST which forces upper case letters to
+ * sort before lower case letters, and UCOL_LOWER_FIRST which does
+ * the opposite. */
+ UCOL_CASE_FIRST,
+ /** Controls whether an extra case level (positioned before the third
+ * level) is generated or not. Acceptable values are UCOL_OFF (default),
+ * when case level is not generated, and UCOL_ON which causes the case
+ * level to be generated. Contents of the case level are affected by
+ * the value of UCOL_CASE_FIRST attribute. A simple way to ignore
+ * accent differences in a string is to set the strength to UCOL_PRIMARY
+ * and enable case level. */
+ UCOL_CASE_LEVEL,
+ /** Controls whether the normalization check and necessary normalizations
+ * are performed. When set to UCOL_OFF (default) no normalization check
+ * is performed. The correctness of the result is guaranteed only if the
+ * input data is in so-called FCD form (see users manual for more info).
+ * When set to UCOL_ON, an incremental check is performed to see whether
+ * the input data is in the FCD form. If the data is not in the FCD form,
+ * incremental NFD normalization is performed. */
+ UCOL_NORMALIZATION_MODE,
+ /** An alias for UCOL_NORMALIZATION_MODE attribute */
+ UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE,
+ /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength
+ * for most locales (except Japanese) is tertiary. Quaternary strength
+ * is useful when combined with shifted setting for alternate handling
+ * attribute and for JIS x 4061 collation, when it is used to distinguish
+ * between Katakana and Hiragana (this is achieved by setting the
+ * UCOL_HIRAGANA_QUATERNARY mode to on. Otherwise, quaternary level
+ * is affected only by the number of non ignorable code points in
+ * the string. Identical strength is rarely useful, as it amounts
+ * to codepoints of the NFD form of the string. */
+ UCOL_STRENGTH,
+ /** When turned on, this attribute positions Hiragana before all
+ * non-ignorables on quaternary level This is a sneaky way to produce JIS
+ * sort order */
+ UCOL_HIRAGANA_QUATERNARY_MODE,
+ /** When turned on, this attribute generates a collation key
+ * for the numeric value of substrings of digits.
+ * This is a way to get '100' to sort AFTER '2'. */
+ UCOL_NUMERIC_COLLATION,
+ UCOL_ATTRIBUTE_COUNT
+} UColAttribute;
+
+/** Options for retrieving the rule string
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** Retrieve tailoring only */
+ UCOL_TAILORING_ONLY,
+ /** Retrieve UCA rules and tailoring */
+ UCOL_FULL_RULES
+} UColRuleOption ;
+
+/**
+ * Open a UCollator for comparing strings.
+ * The UCollator pointer is used in all the calls to the Collation
+ * service. After finished, collator must be disposed of by calling
+ * {@link #ucol_close }.
+ * @param loc The locale containing the required collation rules.
+ * Special values for locales can be passed in -
+ * if NULL is passed for the locale, the default locale
+ * collation rules will be used. If empty string ("") or
+ * "root" are passed, UCA rules will be used.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator, or 0 if an error occurred.
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_open(const char *loc, UErrorCode *status);
+
+/**
+ * Produce an UCollator instance according to the rules supplied.
+ * The rules are used to change the default ordering, defined in the
+ * UCA in a process called tailoring. The resulting UCollator pointer
+ * can be used in the same way as the one obtained by {@link #ucol_strcoll }.
+ * @param rules A string describing the collation rules. For the syntax
+ * of the rules please see users guide.
+ * @param rulesLength The length of rules, or -1 if null-terminated.
+ * @param normalizationMode The normalization mode: One of
+ * UCOL_OFF (expect the text to not need normalization),
+ * UCOL_ON (normalize), or
+ * UCOL_DEFAULT (set the mode according to the rules)
+ * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules.
+ * @param parseError A pointer to UParseError to recieve information about errors
+ * occurred during parsing. This argument can currently be set
+ * to NULL, but at users own risk. Please provide a real structure.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case
+ * of error - please use status argument to check for errors.
+ * @see ucol_open
+ * @see ucol_safeClone
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openRules( const UChar *rules,
+ int32_t rulesLength,
+ UColAttributeValue normalizationMode,
+ UCollationStrength strength,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/**
+ * Open a collator defined by a short form string.
+ * 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
+ * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final
+ * strength will be 3. 3066bis locale overrides individual locale parts.
+ * The call to this function is equivalent to a call to ucol_open, followed by a
+ * series of calls to ucol_setAttribute and ucol_setVariableTop.
+ * @param definition A short string containing a locale and a set of attributes.
+ * Attributes not explicitly mentioned are left at the default
+ * state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings are to be cached, should be set to FALSE.
+ * @param status Error code. Apart from regular error conditions connected to
+ * instantiating collators (like out of memory or similar), this
+ * API will return an error if an invalid attribute or attribute/value
+ * combination is specified.
+ * @return A pointer to a UCollator or 0 if an error occured (including an
+ * invalid attribute).
+ * @see ucol_open
+ * @see ucol_setAttribute
+ * @see ucol_setVariableTop
+ * @see ucol_getShortDefinitionString
+ * @see ucol_normalizeShortDefinitionString
+ * @stable ICU 3.0
+ *
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openFromShortString( const char *definition,
+ UBool forceDefaults,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/**
+ * Get a set containing the contractions defined by the collator. The set includes
+ * both the UCA contractions and the contractions defined by the collator. This set
+ * will contain only strings. If a tailoring explicitly suppresses contractions from
+ * the UCA (like Russian), removed contractions will not be in the resulting set.
+ * @param coll collator
+ * @param conts the set to hold the result. It gets emptied before
+ * contractions are added.
+ * @param status to hold the error code
+ * @return the size of the contraction set
+ *
+ * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead
+ */
+U_DEPRECATED int32_t U_EXPORT2
+ucol_getContractions( const UCollator *coll,
+ USet *conts,
+ UErrorCode *status);
+
+/**
+ * Get a set containing the expansions defined by the collator. The set includes
+ * both the UCA expansions and the expansions defined by the tailoring
+ * @param coll collator
+ * @param contractions if not NULL, the set to hold the contractions
+ * @param expansions if not NULL, the set to hold the expansions
+ * @param addPrefixes add the prefix contextual elements to contractions
+ * @param status to hold the error code
+ *
+ * @stable ICU 3.4
+ */
+U_STABLE void U_EXPORT2
+ucol_getContractionsAndExpansions( const UCollator *coll,
+ USet *contractions, USet *expansions,
+ UBool addPrefixes, UErrorCode *status);
+
+/**
+ * Close a UCollator.
+ * Once closed, a UCollator should not be used. Every open collator should
+ * be closed. Otherwise, a memory leak will result.
+ * @param coll The UCollator to close.
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_safeClone
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_close(UCollator *coll);
+
+/**
+ * Compare two strings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationResult U_EXPORT2
+ucol_strcoll( const UCollator *coll,
+ const UChar *source,
+ int32_t sourceLength,
+ const UChar *target,
+ int32_t targetLength);
+
+/**
+ * Determine if one string is greater than another.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greaterOrEqual
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_greater(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Determine if one string is greater than or equal to another.
+ * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is greater than or equal to target, FALSE otherwise.
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_equal
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_greaterOrEqual(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Compare two strings for equality.
+ * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL
+ * @param coll The UCollator containing the comparison rules.
+ * @param source The source string.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param target The target string.
+ * @param targetLength The length of target, or -1 if null-terminated.
+ * @return TRUE if source is equal to target, FALSE otherwise
+ * @see ucol_strcoll
+ * @see ucol_greater
+ * @see ucol_greaterOrEqual
+ * @stable ICU 2.0
+ */
+U_STABLE UBool U_EXPORT2
+ucol_equal(const UCollator *coll,
+ const UChar *source, int32_t sourceLength,
+ const UChar *target, int32_t targetLength);
+
+/**
+ * Compare two UTF-8 encoded trings.
+ * The strings will be compared using the options already specified.
+ * @param coll The UCollator containing the comparison rules.
+ * @param sIter The source string iterator.
+ * @param tIter The target string iterator.
+ * @return The result of comparing the strings; one of UCOL_EQUAL,
+ * UCOL_GREATER, UCOL_LESS
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @see ucol_strcoll
+ * @stable ICU 2.6
+ */
+U_STABLE UCollationResult U_EXPORT2
+ucol_strcollIter( const UCollator *coll,
+ UCharIterator *sIter,
+ UCharIterator *tIter,
+ UErrorCode *status);
+
+/**
+ * Get the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to query.
+ * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY,
+ * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL
+ * @see ucol_setStrength
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationStrength U_EXPORT2
+ucol_getStrength(const UCollator *coll);
+
+/**
+ * Set the collation strength used in a UCollator.
+ * The strength influences how strings are compared.
+ * @param coll The UCollator to set.
+ * @param strength The desired collation strength; one of UCOL_PRIMARY,
+ * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT
+ * @see ucol_getStrength
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setStrength(UCollator *coll,
+ UCollationStrength strength);
+
+/**
+ * Get the display name for a UCollator.
+ * The display name is suitable for presentation to a user.
+ * @param objLoc The locale of the collator in question.
+ * @param dispLoc The locale for display.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getDisplayName( const char *objLoc,
+ const char *dispLoc,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+ * Get a locale for which collation rules are available.
+ * A UCollator in a locale returned by this function will perform the correct
+ * collation for the locale.
+ * @param index The index of the desired locale.
+ * @return A locale for which collation rules are available, or 0 if none.
+ * @see ucol_countAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+ucol_getAvailable(int32_t index);
+
+/**
+ * Determine how many locales have collation rules available.
+ * This function is most useful as determining the loop ending condition for
+ * calls to {@link #ucol_getAvailable }.
+ * @return The number of locales for which collation rules are available.
+ * @see ucol_getAvailable
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_countAvailable(void);
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * Create a string enumerator of all locales for which a valid
+ * collator may be opened.
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_openAvailableLocales(UErrorCode *status);
+#endif
+
+/**
+ * Create a string enumerator of all possible keywords that are relevant to
+ * collation. At this point, the only recognized keyword for this
+ * service is "collation".
+ * @param status input-output error code
+ * @return a string enumeration over locale strings. The caller is
+ * responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_getKeywords(UErrorCode *status);
+
+/**
+ * Given a keyword, create a string enumeration of all values
+ * for that keyword that are currently in use.
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords. If any other keyword is passed in, *status is set
+ * to U_ILLEGAL_ARGUMENT_ERROR.
+ * @param status input-output error code
+ * @return a string enumeration over collation keyword values, or NULL
+ * upon error. The caller is responsible for closing the result.
+ * @stable ICU 3.0
+ */
+U_STABLE UEnumeration* U_EXPORT2
+ucol_getKeywordValues(const char *keyword, UErrorCode *status);
+
+/**
+ * Return the functionally equivalent locale for the given
+ * requested locale, with respect to given keyword, for the
+ * collation service. If two locales return the same result, then
+ * collators instantiated for these locales will behave
+ * equivalently. The converse is not always true; two collators
+ * may in fact be equivalent, but return different results, due to
+ * internal details. The return result has no other meaning than
+ * that stated above, and implies nothing as to the relationship
+ * between the two locales. This is intended for use by
+ * applications who wish to cache collators, or otherwise reuse
+ * collators when possible. The functional equivalent may change
+ * over time. For more information, please see the <a
+ * href="http://icu-project.org/userguide/locale.html#services">
+ * Locales and Services</a> section of the ICU User Guide.
+ * @param result fillin for the functionally equivalent locale
+ * @param resultCapacity capacity of the fillin buffer
+ * @param keyword a particular keyword as enumerated by
+ * ucol_getKeywords.
+ * @param locale the requested locale
+ * @param isAvailable if non-NULL, pointer to a fillin parameter that
+ * indicates whether the requested locale was 'available' to the
+ * collation service. A locale is defined as 'available' if it
+ * physically exists within the collation locale data.
+ * @param status pointer to input-output error code
+ * @return the actual buffer size needed for the locale. If greater
+ * than resultCapacity, the returned full name will be truncated and
+ * an error code will be returned.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity,
+ const char* keyword, const char* locale,
+ UBool* isAvailable, UErrorCode* status);
+
+/**
+ * Get the collation rules from a UCollator.
+ * The rules will follow the rule syntax.
+ * @param coll The UCollator to query.
+ * @param length
+ * @return The collation rules.
+ * @stable ICU 2.0
+ */
+U_STABLE const UChar* U_EXPORT2
+ucol_getRules( const UCollator *coll,
+ int32_t *length);
+
+/** Get the short definition string for a collator. This 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 API supports preflighting.
+ * @param coll a collator
+ * @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
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getShortDefinitionString(const UCollator *coll,
+ const char *locale,
+ char *buffer,
+ int32_t capacity,
+ UErrorCode *status);
+
+/** Verifies and normalizes short definition string.
+ * Normalized short definition string has all the option sorted by the argument name,
+ * so that equivalent definition strings are the same.
+ * This API supports preflighting.
+ * @param source definition string
+ * @param destination space to hold the resulting string
+ * @param capacity capacity of the buffer
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param status Error code. This API will return an error if an invalid attribute
+ * or attribute/value combination is specified. All the preflighting
+ * errors are also featured
+ * @return length of the resulting normalized string.
+ *
+ * @see ucol_openFromShortString
+ * @see ucol_getShortDefinitionString
+ *
+ * @stable ICU 3.0
+ */
+
+U_STABLE int32_t U_EXPORT2
+ucol_normalizeShortDefinitionString(const char *source,
+ char *destination,
+ int32_t capacity,
+ UParseError *parseError,
+ UErrorCode *status);
+
+
+/**
+ * Get a sort key for a string from a UCollator.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param coll The UCollator containing the collation rules.
+ * @param source The string to transform.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param result A pointer to a buffer to receive the attribute.
+ * @param resultLength The maximum size of result.
+ * @return The size needed to fully store the sort key..
+ * @see ucol_keyHashCode
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getSortKey(const UCollator *coll,
+ const UChar *source,
+ int32_t sourceLength,
+ uint8_t *result,
+ int32_t resultLength);
+
+
+/** Gets the next count bytes of a sort key. Caller needs
+ * to preserve state array between calls and to provide
+ * the same type of UCharIterator set with the same string.
+ * The destination buffer provided must be big enough to store
+ * the number of requested bytes. Generated sortkey is not
+ * compatible with sortkeys generated using ucol_getSortKey
+ * API, since we don't do any compression. If uncompressed
+ * sortkeys are required, this API can be used.
+ * @param coll The UCollator containing the collation rules.
+ * @param iter UCharIterator containing the string we need
+ * the sort key to be calculated for.
+ * @param state Opaque state of sortkey iteration.
+ * @param dest Buffer to hold the resulting sortkey part
+ * @param count number of sort key bytes required.
+ * @param status error code indicator.
+ * @return the actual number of bytes of a sortkey. It can be
+ * smaller than count if we have reached the end of
+ * the sort key.
+ * @stable ICU 2.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_nextSortKeyPart(const UCollator *coll,
+ UCharIterator *iter,
+ uint32_t state[2],
+ uint8_t *dest, int32_t count,
+ UErrorCode *status);
+
+/** enum that is taken by ucol_getBound API
+ * See below for explanation
+ * do not change the values assigned to the
+ * members of this enum. Underlying code
+ * depends on them having these numbers
+ * @stable ICU 2.0
+ */
+typedef enum {
+ /** lower bound */
+ UCOL_BOUND_LOWER = 0,
+ /** upper bound that will match strings of exact size */
+ UCOL_BOUND_UPPER = 1,
+ /** upper bound that will match all the strings that have the same initial substring as the given string */
+ UCOL_BOUND_UPPER_LONG = 2,
+ UCOL_BOUND_VALUE_COUNT
+} UColBoundMode;
+
+/**
+ * Produce a bound for a given sortkey and a number of levels.
+ * Return value is always the number of bytes needed, regardless of
+ * whether the result buffer was big enough or even valid.<br>
+ * Resulting bounds can be used to produce a range of strings that are
+ * between upper and lower bounds. For example, if bounds are produced
+ * for a sortkey of string "smith", strings between upper and lower
+ * bounds with one level would include "Smith", "SMITH", "sMiTh".<br>
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER
+ * is produced, strings matched would be as above. However, if bound
+ * produced using UCOL_BOUND_UPPER_LONG is used, the above example will
+ * also match "Smithsonian" and similar.<br>
+ * For more on usage, see example in cintltst/capitst.c in procedure
+ * TestBounds.
+ * Sort keys may be compared using <TT>strcmp</TT>.
+ * @param source The source sortkey.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * (If an unmodified sortkey is passed, it is always null
+ * terminated).
+ * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which
+ * produces a lower inclusive bound, UCOL_BOUND_UPPER, that
+ * produces upper bound that matches strings of the same length
+ * or UCOL_BOUND_UPPER_LONG that matches strings that have the
+ * same starting substring as the source string.
+ * @param noOfLevels Number of levels required in the resulting bound (for most
+ * uses, the recommended value is 1). See users guide for
+ * explanation on number of levels a sortkey can have.
+ * @param result A pointer to a buffer to receive the resulting sortkey.
+ * @param resultLength The maximum size of result.
+ * @param status Used for returning error code if something went wrong. If the
+ * number of levels requested is higher than the number of levels
+ * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is
+ * issued.
+ * @return The size needed to fully store the bound.
+ * @see ucol_keyHashCode
+ * @stable ICU 2.1
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getBound(const uint8_t *source,
+ int32_t sourceLength,
+ UColBoundMode boundType,
+ uint32_t noOfLevels,
+ uint8_t *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+ * Gets the version information for a Collator. Version is currently
+ * an opaque 32-bit number which depends, among other things, on major
+ * versions of the collator tailoring and UCA.
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_getVersion(const UCollator* coll, UVersionInfo info);
+
+/**
+ * Gets the UCA version information for a Collator. Version is the
+ * UCA version number (3.1.1, 4.0).
+ * @param coll The UCollator to query.
+ * @param info the version # information, the result will be filled in
+ * @stable ICU 2.8
+ */
+U_STABLE void U_EXPORT2
+ucol_getUCAVersion(const UCollator* coll, UVersionInfo info);
+
+/**
+ * Merge two sort keys. The levels are merged with their corresponding counterparts
+ * (primaries with primaries, secondaries with secondaries etc.). Between the values
+ * from the same level a separator is inserted.
+ * example (uncompressed):
+ * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00
+ * will be merged as
+ * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00
+ * This allows for concatenating of first and last names for sorting, among other things.
+ * If the destination buffer is not big enough, the results are undefined.
+ * If any of source lengths are zero or any of source pointers are NULL/undefined,
+ * result is of size zero.
+ * @param src1 pointer to the first sortkey
+ * @param src1Length length of the first sortkey
+ * @param src2 pointer to the second sortkey
+ * @param src2Length length of the second sortkey
+ * @param dest buffer to hold the result
+ * @param destCapacity size of the buffer for the result
+ * @return size of the result. If the buffer is big enough size is always
+ * src1Length+src2Length-1
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
+ const uint8_t *src2, int32_t src2Length,
+ uint8_t *dest, int32_t destCapacity);
+
+/**
+ * Universal attribute setter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @param value attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_getAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status);
+
+/**
+ * Universal attribute getter
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @stable ICU 2.0
+ */
+U_STABLE UColAttributeValue U_EXPORT2
+ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Variable top
+ * is a two byte primary value which causes all the codepoints with primary values that
+ * are less or equal than the variable top to be shifted when alternate handling is set
+ * to UCOL_SHIFTED.
+ * Sets the variable top to a collation element value of a string supplied.
+ * @param coll collator which variable top needs to be changed
+ * @param varTop one or more (if contraction) UChars to which the variable top should be set
+ * @param len length of variable top string. If -1 it is considered to be zero terminated.
+ * @param status error code. If error code is set, the return value is undefined.
+ * Errors set by this function are: <br>
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such
+ * a contraction<br>
+ * U_PRIMARY_TOO_LONG_ERROR if the primary for the variable top has more than two bytes
+ * @return a 32 bit value containing the value of the variable top in upper 16 bits.
+ * Lower 16 bits are undefined
+ * @see ucol_getVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2
+ucol_setVariableTop(UCollator *coll,
+ const UChar *varTop, int32_t len,
+ UErrorCode *status);
+
+/**
+ * Gets the variable top value of a Collator.
+ * Lower 16 bits are undefined and should be ignored.
+ * @param coll collator which variable top needs to be retrieved
+ * @param status error code (not changed by function). If error code is set,
+ * the return value is undefined.
+ * @return the variable top value of a Collator.
+ * @see ucol_setVariableTop
+ * @see ucol_restoreVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status);
+
+/**
+ * Sets the variable top to a collation element value supplied. Variable top is
+ * set to the upper 16 bits.
+ * Lower 16 bits are ignored.
+ * @param coll collator which variable top needs to be changed
+ * @param varTop CE value, as returned by ucol_setVariableTop or ucol)getVariableTop
+ * @param status error code (not changed by function)
+ * @see ucol_getVariableTop
+ * @see ucol_setVariableTop
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status);
+
+/**
+ * Thread safe cloning operation. The result is a clone of a given collator.
+ * @param coll collator to be cloned
+ * @param stackBuffer user allocated space for the new clone.
+ * If NULL new memory will be allocated.
+ * If buffer is not large enough, new memory will be allocated.
+ * Clients can use the U_COL_SAFECLONE_BUFFERSIZE.
+ * This will probably be enough to avoid memory allocations.
+ * @param pBufferSize pointer to size of allocated space.
+ * If *pBufferSize == 0, a sufficient size for use in cloning will
+ * be returned ('pre-flighting')
+ * If *pBufferSize is not enough for a stack-based safe clone,
+ * new memory will be allocated.
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any
+ * allocations were necessary.
+ * @return pointer to the new clone
+ * @see ucol_open
+ * @see ucol_openRules
+ * @see ucol_close
+ * @stable ICU 2.0
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_safeClone(const UCollator *coll,
+ void *stackBuffer,
+ int32_t *pBufferSize,
+ UErrorCode *status);
+
+/** default memory size for the new clone. It needs to be this large for os/400 large pointers
+ * @stable ICU 2.0
+ */
+#define U_COL_SAFECLONE_BUFFERSIZE 512
+
+/**
+ * Returns current rules. Delta defines whether full rules are returned or just the tailoring.
+ * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough
+ * to store rules, will store up to available space.
+ * @param coll collator to get the rules from
+ * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES.
+ * @param buffer buffer to store the result in. If NULL, you'll get no rules.
+ * @param bufferLen lenght of buffer to store rules in. If less then needed you'll get only the part that fits in.
+ * @return current rules
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen);
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ * locale. For description see the definition of
+ * ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes.
+ * If the collator was instantiated from rules, returns
+ * NULL.
+ * @deprecated ICU 2.8 Use ucol_getLocaleByType instead
+ */
+U_DEPRECATED const char * U_EXPORT2
+ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+
+/**
+ * gets the locale name of the collator. If the collator
+ * is instantiated from the rules, then this function returns
+ * NULL.
+ * @param coll The UCollator for which the locale is needed
+ * @param type You can choose between requested, valid and actual
+ * locale. For description see the definition of
+ * ULocDataLocaleType in uloc.h
+ * @param status error code of the operation
+ * @return real locale name from which the collation data comes.
+ * If the collator was instantiated from rules, returns
+ * NULL.
+ * @stable ICU 2.8
+ */
+U_STABLE const char * U_EXPORT2
+ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status);
+
+/**
+ * Get an Unicode set that contains all the characters and sequences tailored in
+ * this collator. The result must be disposed of by using uset_close.
+ * @param coll The UCollator for which we want to get tailored chars
+ * @param status error code of the operation
+ * @return a pointer to newly created USet. Must be be disposed by using uset_close
+ * @see ucol_openRules
+ * @see uset_close
+ * @stable ICU 2.4
+ */
+U_STABLE USet * U_EXPORT2
+ucol_getTailoredSet(const UCollator *coll, UErrorCode *status);
+
+#ifndef U_HIDE_INTERNAL_API
+/**
+ * Returned by ucol_collatorToIdentifier to signify that collator is
+ * not encodable as an identifier.
+ * @internal ICU 3.0
+ */
+#define UCOL_SIT_COLLATOR_NOT_ENCODABLE 0x80000000
+#endif /* U_HIDE_INTERNAL_API */
+
+/**
+ * Get a 31-bit identifier given a collator.
+ * @param coll UCollator
+ * @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 status holds error messages
+ * @return 31-bit identifier. MSB is used if the collator cannot be encoded. In that
+ * case UCOL_SIT_COLLATOR_NOT_ENCODABLE is returned
+ * @see ucol_openFromIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL uint32_t U_EXPORT2
+ucol_collatorToIdentifier(const UCollator *coll,
+ const char *locale,
+ UErrorCode *status);
+
+/**
+ * Open a collator given a 31-bit identifier
+ * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings that can be produced from a collator instantiated by
+ * calling this API are to be cached, should be set to FALSE.
+ * @param status for returning errors
+ * @return UCollator object
+ * @see ucol_collatorToIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL UCollator* U_EXPORT2
+ucol_openFromIdentifier(uint32_t identifier,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+
+/**
+ * Calculate the short definition string given an identifier. Supports preflighting.
+ * @param identifier 31-bit identifier, encoded by calling ucol_collatorToIdentifier
+ * @param buffer buffer to store the result
+ * @param capacity buffer capacity
+ * @param forceDefaults whether the settings that are the same as the default setting
+ * should be forced anyway. Setting this argument to FALSE reduces
+ * the number of different configurations, but decreases performace
+ * as a collator has to be instantiated.
+ * @param status for returning errors
+ * @return length of the short definition string
+ * @see ucol_collatorToIdentifier
+ * @see ucol_openFromIdentifier
+ * @see ucol_shortStringToIdentifier
+ * @internal ICU 3.0
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucol_identifierToShortString(uint32_t identifier,
+ char *buffer,
+ int32_t capacity,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+/**
+ * Calculate the identifier given a short definition string. Supports preflighting.
+ * @param definition short string definition
+ * @param forceDefaults whether the settings that are the same as the default setting
+ * should be forced anyway. Setting this argument to FALSE reduces
+ * the number of different configurations, but decreases performace
+ * as a collator has to be instantiated.
+ * @param status for returning errors
+ * @return identifier
+ * @see ucol_collatorToIdentifier
+ * @see ucol_openFromIdentifier
+ * @see ucol_identifierToShortString
+ * @internal ICU 3.0
+ */
+U_INTERNAL uint32_t U_EXPORT2
+ucol_shortStringToIdentifier(const char *definition,
+ UBool forceDefaults,
+ UErrorCode *status);
+
+
+
+/**
+ * Universal attribute getter that returns UCOL_DEFAULT if the value is default
+ * @param coll collator which attributes are to be changed
+ * @param attr attribute type
+ * @return attribute value or UCOL_DEFAULT if the value is default
+ * @param status to indicate whether the operation went on smoothly or there were errors
+ * @see UColAttribute
+ * @see UColAttributeValue
+ * @see ucol_setAttribute
+ * @internal ICU 3.0
+ */
+U_INTERNAL UColAttributeValue U_EXPORT2
+ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status);
+
+/** Check whether two collators are equal. Collators are considered equal if they
+ * will sort strings the same. This means that both the current attributes and the
+ * rules must be equivalent. Currently used for RuleBasedCollator::operator==.
+ * @param source first collator
+ * @param target second collator
+ * @return TRUE or FALSE
+ * @internal ICU 3.0
+ */
+U_INTERNAL UBool U_EXPORT2
+ucol_equals(const UCollator *source, const UCollator *target);
+
+/** Calculates the set of unsafe code points, given a collator.
+ * A character is unsafe if you could append any character and cause the ordering to alter significantly.
+ * Collation sorts in normalized order, so anything that rearranges in normalization can cause this.
+ * Thus if you have a character like a_umlaut, and you add a lower_dot to it,
+ * then it normalizes to a_lower_dot + umlaut, and sorts differently.
+ * @param coll Collator
+ * @param unsafe a fill-in set to receive the unsafe points
+ * @param status for catching errors
+ * @return number of elements in the set
+ * @internal ICU 3.0
+ */
+U_INTERNAL int32_t U_EXPORT2
+ucol_getUnsafeSet( const UCollator *coll,
+ USet *unsafe,
+ UErrorCode *status);
+
+/** Reset UCA's static pointers. You don't want to use this, unless your static memory can go away.
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_forgetUCA(void);
+
+/** Touches all resources needed for instantiating a collator from a short string definition,
+ * thus filling up the cache.
+ * @param definition A short string containing a locale and a set of attributes.
+ * Attributes not explicitly mentioned are left at the default
+ * state for a locale.
+ * @param parseError if not NULL, structure that will get filled with error's pre
+ * and post context in case of error.
+ * @param forceDefaults if FALSE, the settings that are the same as the collator
+ * default settings will not be applied (for example, setting
+ * French secondary on a French collator would not be executed).
+ * If TRUE, all the settings will be applied regardless of the
+ * collator default value. If the definition
+ * strings are to be cached, should be set to FALSE.
+ * @param status Error code. Apart from regular error conditions connected to
+ * instantiating collators (like out of memory or similar), this
+ * API will return an error if an invalid attribute or attribute/value
+ * combination is specified.
+ * @see ucol_openFromShortString
+ * @internal ICU 3.2.1
+ */
+U_INTERNAL void U_EXPORT2
+ucol_prepareShortStringOpen( const char *definition,
+ UBool forceDefaults,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/** Creates a binary image of a collator. This binary image can be stored and
+ * later used to instantiate a collator using ucol_openBinary.
+ * This API supports preflighting.
+ * @param coll Collator
+ * @param buffer a fill-in buffer to receive the binary image
+ * @param capacity capacity of the destination buffer
+ * @param status for catching errors
+ * @return size of the image
+ * @see ucol_openBinary
+ * @stable ICU 3.2
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_cloneBinary(const UCollator *coll,
+ uint8_t *buffer, int32_t capacity,
+ UErrorCode *status);
+
+/** Opens a collator from a collator binary image created using
+ * ucol_cloneBinary. Binary image used in instantiation of the
+ * collator remains owned by the user and should stay around for
+ * the lifetime of the collator. The API also takes a base collator
+ * which usualy should be UCA.
+ * @param bin binary image owned by the user and required through the
+ * lifetime of the collator
+ * @param length size of the image. If negative, the API will try to
+ * figure out the length of the image
+ * @param base fallback collator, usually UCA. Base is required to be
+ * present through the lifetime of the collator. Currently
+ * it cannot be NULL.
+ * @param status for catching errors
+ * @return newly created collator
+ * @see ucol_cloneBinary
+ * @stable ICU 3.2
+ */
+U_STABLE UCollator* U_EXPORT2
+ucol_openBinary(const uint8_t *bin, int32_t length,
+ const UCollator *base,
+ UErrorCode *status);
+
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucoleitr.h b/Build/source/libs/icu-xetex/i18n/unicode/ucoleitr.h
new file mode 100644
index 00000000000..7184e96a767
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucoleitr.h
@@ -0,0 +1,268 @@
+/*
+*******************************************************************************
+* Copyright (C) 2001-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+*
+* File ucoleitr.cpp
+*
+* Modification History:
+*
+* Date Name Description
+* 02/15/2001 synwee Modified all methods to process its own function
+* instead of calling the equivalent c++ api (coleitr.h)
+*******************************************************************************/
+
+#ifndef UCOLEITR_H
+#define UCOLEITR_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+/**
+ * This indicates an error has occured during processing or if no more CEs is
+ * to be returned.
+ * @stable ICU 2.0
+ */
+#define UCOL_NULLORDER ((int32_t)0xFFFFFFFF)
+
+#include "unicode/ucol.h"
+
+/**
+ * The UCollationElements struct.
+ * For usage in C programs.
+ * @stable ICU 2.0
+ */
+typedef struct UCollationElements UCollationElements;
+
+/**
+ * \file
+ * \brief C API: UCollationElements
+ *
+ * The UCollationElements API is used as an iterator to walk through each
+ * character of an international string. Use the iterator to return the
+ * ordering priority of the positioned character. The ordering priority of a
+ * character, which we refer to as a key, defines how a character is collated
+ * in the given collation object.
+ * For example, consider the following in Spanish:
+ * <pre>
+ * . "ca" -> the first key is key('c') and second key is key('a').
+ * . "cha" -> the first key is key('ch') and second key is key('a').
+ * </pre>
+ * And in German,
+ * <pre>
+ * . "<ae ligature>b"-> the first key is key('a'), the second key is key('e'), and
+ * . the third key is key('b').
+ * </pre>
+ * <p>Example of the iterator usage: (without error checking)
+ * <pre>
+ * . void CollationElementIterator_Example()
+ * . {
+ * . UChar *s;
+ * . t_int32 order, primaryOrder;
+ * . UCollationElements *c;
+ * . UCollatorOld *coll;
+ * . UErrorCode success = U_ZERO_ERROR;
+ * . s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) );
+ * . u_uastrcpy(s, "This is a test");
+ * . coll = ucol_open(NULL, &success);
+ * . c = ucol_openElements(coll, str, u_strlen(str), &status);
+ * . order = ucol_next(c, &success);
+ * . ucol_reset(c);
+ * . order = ucol_prev(c, &success);
+ * . free(s);
+ * . ucol_close(coll);
+ * . ucol_closeElements(c);
+ * . }
+ * </pre>
+ * <p>
+ * ucol_next() returns the collation order of the next.
+ * ucol_prev() returns the collation order of the previous character.
+ * The Collation Element Iterator moves only in one direction between calls to
+ * ucol_reset. That is, ucol_next() and ucol_prev can not be inter-used.
+ * Whenever ucol_prev is to be called after ucol_next() or vice versa,
+ * ucol_reset has to be called first to reset the status, shifting pointers to
+ * either the end or the start of the string. Hence at the next call of
+ * ucol_prev or ucol_next, the first or last collation order will be returned.
+ * If a change of direction is done without a ucol_reset, the result is
+ * undefined.
+ * The result of a forward iterate (ucol_next) and reversed result of the
+ * backward iterate (ucol_prev) on the same string are equivalent, if
+ * collation orders with the value UCOL_IGNORABLE are ignored.
+ * Character based on the comparison level of the collator. A collation order
+ * consists of primary order, secondary order and tertiary order. The data
+ * type of the collation order is <strong>t_int32</strong>.
+ *
+ * @see UCollator
+ */
+
+/**
+ * Open the collation elements for a string.
+ *
+ * @param coll The collator containing the desired collation rules.
+ * @param text The text to iterate over.
+ * @param textLength The number of characters in text, or -1 if null-terminated
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return a struct containing collation element information
+ * @stable ICU 2.0
+ */
+U_STABLE UCollationElements* U_EXPORT2
+ucol_openElements(const UCollator *coll,
+ const UChar *text,
+ int32_t textLength,
+ UErrorCode *status);
+
+/**
+ * get a hash code for a key... Not very useful!
+ * @param key the given key.
+ * @param length the size of the key array.
+ * @return the hash code.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_keyHashCode(const uint8_t* key, int32_t length);
+
+/**
+ * Close a UCollationElements.
+ * Once closed, a UCollationElements may no longer be used.
+ * @param elems The UCollationElements to close.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_closeElements(UCollationElements *elems);
+
+/**
+ * Reset the collation elements to their initial state.
+ * This will move the 'cursor' to the beginning of the text.
+ * Property settings for collation will be reset to the current status.
+ * @param elems The UCollationElements to reset.
+ * @see ucol_next
+ * @see ucol_previous
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_reset(UCollationElements *elems);
+
+/**
+ * Get the ordering priority of the next collation element in the text.
+ * A single character may contain more than one collation element.
+ * @param elems The UCollationElements containing the text.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return The next collation elements ordering, otherwise returns NULLORDER
+ * if an error has occured or if the end of string has been reached
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_next(UCollationElements *elems, UErrorCode *status);
+
+/**
+ * Get the ordering priority of the previous collation element in the text.
+ * A single character may contain more than one collation element.
+ * Note that internally a stack is used to store buffered collation elements.
+ * It is very rare that the stack will overflow, however if such a case is
+ * encountered, the problem can be solved by increasing the size
+ * UCOL_EXPAND_CE_BUFFER_SIZE in ucol_imp.h.
+ * @param elems The UCollationElements containing the text.
+ * @param status A pointer to an UErrorCode to receive any errors. Noteably
+ * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack
+ * buffer has been exhausted.
+ * @return The previous collation elements ordering, otherwise returns
+ * NULLORDER if an error has occured or if the start of string has
+ * been reached.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_previous(UCollationElements *elems, UErrorCode *status);
+
+/**
+ * Get the maximum length of any expansion sequences that end with the
+ * specified comparison order.
+ * This is useful for .... ?
+ * @param elems The UCollationElements containing the text.
+ * @param order A collation order returned by previous or next.
+ * @return maximum size of the expansion sequences ending with the collation
+ * element or 1 if collation element does not occur at the end of any
+ * expansion sequence
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getMaxExpansion(const UCollationElements *elems, int32_t order);
+
+/**
+ * Set the text containing the collation elements.
+ * Property settings for collation will remain the same.
+ * In order to reset the iterator to the current collation property settings,
+ * the API reset() has to be called.
+ * @param elems The UCollationElements to set.
+ * @param text The source text containing the collation elements.
+ * @param textLength The length of text, or -1 if null-terminated.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @see ucol_getText
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setText( UCollationElements *elems,
+ const UChar *text,
+ int32_t textLength,
+ UErrorCode *status);
+
+/**
+ * Get the offset of the current source character.
+ * This is an offset into the text of the character containing the current
+ * collation elements.
+ * @param elems The UCollationElements to query.
+ * @return The offset of the current source character.
+ * @see ucol_setOffset
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucol_getOffset(const UCollationElements *elems);
+
+/**
+ * Set the offset of the current source character.
+ * This is an offset into the text of the character to be processed.
+ * Property settings for collation will remain the same.
+ * In order to reset the iterator to the current collation property settings,
+ * the API reset() has to be called.
+ * @param elems The UCollationElements to set.
+ * @param offset The desired character offset.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @see ucol_getOffset
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+ucol_setOffset(UCollationElements *elems,
+ int32_t offset,
+ UErrorCode *status);
+
+/**
+* Get the primary order of a collation order.
+* @param order the collation order
+* @return the primary order of a collation order.
+* @stable ICU 2.6
+*/
+U_STABLE int32_t U_EXPORT2
+ucol_primaryOrder (int32_t order);
+
+/**
+* Get the secondary order of a collation order.
+* @param order the collation order
+* @return the secondary order of a collation order.
+* @stable ICU 2.6
+*/
+U_STABLE int32_t U_EXPORT2
+ucol_secondaryOrder (int32_t order);
+
+/**
+* Get the tertiary order of a collation order.
+* @param order the collation order
+* @return the tertiary order of a collation order.
+* @stable ICU 2.6
+*/
+U_STABLE int32_t U_EXPORT2
+ucol_tertiaryOrder (int32_t order);
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h b/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h
new file mode 100644
index 00000000000..31f622c01a4
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucsdet.h
@@ -0,0 +1,349 @@
+/*
+ **********************************************************************
+ * Copyright (C) 2005-2007, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ **********************************************************************
+ * file name: ucsdet.h
+ * encoding: US-ASCII
+ * indentation:4
+ *
+ * created on: 2005Aug04
+ * created by: Andy Heninger
+ *
+ * ICU Character Set Detection, API for C
+ *
+ * Draft version 18 Oct 2005
+ *
+ */
+
+#ifndef __UCSDET_H
+#define __UCSDET_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_CONVERSION
+#include "unicode/uenum.h"
+
+/**
+ * \file
+ * \brief C API: Charset Detection API
+ *
+ * This API provides a facility for detecting the
+ * charset or encoding of character data in an unknown text format.
+ * The input data can be from an array of bytes.
+ * <p>
+ * Character set detection is at best an imprecise operation. The detection
+ * process will attempt to identify the charset that best matches the characteristics
+ * of the byte data, but the process is partly statistical in nature, and
+ * the results can not be guaranteed to always be correct.
+ * <p>
+ * For best accuracy in charset detection, the input data should be primarily
+ * in a single language, and a minimum of a few hundred bytes worth of plain text
+ * in the language are needed. The detection process will attempt to
+ * ignore html or xml style markup that could otherwise obscure the content.
+ */
+
+
+struct UCharsetDetector;
+/**
+ * Structure representing a charset detector
+ * @stable ICU 3.6
+ */
+typedef struct UCharsetDetector UCharsetDetector;
+
+struct UCharsetMatch;
+/**
+ * Opaque structure representing a match that was identified
+ * from a charset detection operation.
+ * @stable ICU 3.6
+ */
+typedef struct UCharsetMatch UCharsetMatch;
+
+/**
+ * Open a charset detector.
+ *
+ * @param status Any error conditions occurring during the open
+ * operation are reported back in this variable.
+ * @return the newly opened charset detector.
+ * @stable ICU 3.6
+ */
+U_STABLE UCharsetDetector * U_EXPORT2
+ucsdet_open(UErrorCode *status);
+
+/**
+ * Close a charset detector. All storage and any other resources
+ * owned by this charset detector will be released. Failure to
+ * close a charset detector when finished with it can result in
+ * memory leaks in the application.
+ *
+ * @param ucsd The charset detector to be closed.
+ * @stable ICU 3.6
+ */
+U_STABLE void U_EXPORT2
+ucsdet_close(UCharsetDetector *ucsd);
+
+/**
+ * Set the input byte data whose charset is to detected.
+ *
+ * Ownership of the input text byte array remains with the caller.
+ * The input string must not be altered or deleted until the charset
+ * detector is either closed or reset to refer to different input text.
+ *
+ * @param ucsd the charset detector to be used.
+ * @param textIn the input text of unknown encoding. .
+ * @param len the length of the input text, or -1 if the text
+ * is NUL terminated.
+ * @param status any error conditions are reported back in this variable.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE void U_EXPORT2
+ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status);
+
+
+/** Set the declared encoding for charset detection.
+ * The declared encoding of an input text is an encoding obtained
+ * by the user from an http header or xml declaration or similar source that
+ * can be provided as an additional hint to the charset detector.
+ *
+ * How and whether the declared encoding will be used during the
+ * detection process is TBD.
+ *
+ * @param ucsd the charset detector to be used.
+ * @param encoding an encoding for the current data obtained from
+ * a header or declaration or other source outside
+ * of the byte data itself.
+ * @param length the length of the encoding name, or -1 if the name string
+ * is NUL terminated.
+ * @param status any error conditions are reported back in this variable.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE void U_EXPORT2
+ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status);
+
+
+/**
+ * Return the charset that best matches the supplied input data.
+ *
+ * Note though, that because the detection
+ * only looks at the start of the input data,
+ * there is a possibility that the returned charset will fail to handle
+ * the full set of input data.
+ * <p>
+ * The returned UCharsetMatch object is owned by the UCharsetDetector.
+ * It will remain valid until the detector input is reset, or until
+ * the detector is closed.
+ * <p>
+ * The function will fail if
+ * <ul>
+ * <li>no charset appears to match the data.</li>
+ * <li>no input text has been provided</li>
+ * </ul>
+ *
+ * @param ucsd the charset detector to be used.
+ * @param status any error conditions are reported back in this variable.
+ * @return a UCharsetMatch representing the best matching charset,
+ * or NULL if no charset matches the byte data.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE const UCharsetMatch * U_EXPORT2
+ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status);
+
+
+/**
+ * Find all charset matches that appear to be consistent with the input,
+ * returning an array of results. The results are ordered with the
+ * best quality match first.
+ *
+ * Because the detection only looks at a limited amount of the
+ * input byte data, some of the returned charsets may fail to handle
+ * the all of input data.
+ * <p>
+ * The returned UCharsetMatch objects are owned by the UCharsetDetector.
+ * They will remain valid until the detector is closed or modified
+ *
+ * <p>
+ * Return an error if
+ * <ul>
+ * <li>no charsets appear to match the input data.</li>
+ * <li>no input text has been provided</li>
+ * </ul>
+ *
+ * @param ucsd the charset detector to be used.
+ * @param matchesFound pointer to a variable that will be set to the
+ * number of charsets identified that are consistent with
+ * the input data. Output only.
+ * @param status any error conditions are reported back in this variable.
+ * @return A pointer to an array of pointers to UCharSetMatch objects.
+ * This array, and the UCharSetMatch instances to which it refers,
+ * are owned by the UCharsetDetector, and will remain valid until
+ * the detector is closed or modified.
+ * @stable ICU 3.6
+ */
+U_STABLE const UCharsetMatch ** U_EXPORT2
+ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status);
+
+
+
+/**
+ * Get the name of the charset represented by a UCharsetMatch.
+ *
+ * The storage for the returned name string is owned by the
+ * UCharsetMatch, and will remain valid while the UCharsetMatch
+ * is valid.
+ *
+ * The name returned is suitable for use with the ICU conversion APIs.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The name of the matching charset.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE const char * U_EXPORT2
+ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status);
+
+/**
+ * Get a confidence number for the quality of the match of the byte
+ * data with the charset. Confidence numbers range from zero to 100,
+ * with 100 representing complete confidence and zero representing
+ * no confidence.
+ *
+ * The confidence values are somewhat arbitrary. They define an
+ * an ordering within the results for any single detection operation
+ * but are not generally comparable between the results for different input.
+ *
+ * A confidence value of ten does have a general meaning - it is used
+ * for charsets that can represent the input data, but for which there
+ * is no other indication that suggests that the charset is the correct one.
+ * Pure 7 bit ASCII data, for example, is compatible with a
+ * great many charsets, most of which will appear as possible matches
+ * with a confidence of 10.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return A confidence number for the charset match.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status);
+
+/**
+ * Get the RFC 3066 code for the language of the input data.
+ *
+ * The Charset Detection service is intended primarily for detecting
+ * charsets, not language. For some, but not all, charsets, a language is
+ * identified as a byproduct of the detection process, and that is what
+ * is returned by this function.
+ *
+ * CAUTION:
+ * 1. Language information is not available for input data encoded in
+ * all charsets. In particular, no language is identified
+ * for UTF-8 input data.
+ *
+ * 2. Closely related languages may sometimes be confused.
+ *
+ * If more accurate language detection is required, a linguistic
+ * analysis package should be used.
+ *
+ * The storage for the returned name string is owned by the
+ * UCharsetMatch, and will remain valid while the UCharsetMatch
+ * is valid.
+ *
+ * @param ucsm The charset match object.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The RFC 3066 code for the language of the input data, or
+ * an empty string if the language could not be determined.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE const char * U_EXPORT2
+ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status);
+
+
+/**
+ * Get the entire input text as a UChar string, placing it into
+ * a caller-supplied buffer. A terminating
+ * NUL character will be appended to the buffer if space is available.
+ *
+ * The number of UChars in the output string, not including the terminating
+ * NUL, is returned.
+ *
+ * If the supplied buffer is smaller than required to hold the output,
+ * the contents of the buffer are undefined. The full output string length
+ * (in UChars) is returned as always, and can be used to allocate a buffer
+ * of the correct size.
+ *
+ *
+ * @param ucsm The charset match object.
+ * @param buf A UChar buffer to be filled with the converted text data.
+ * @param cap The capacity of the buffer in UChars.
+ * @param status Any error conditions are reported back in this variable.
+ * @return The number of UChars in the output string.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE int32_t U_EXPORT2
+ucsdet_getUChars(const UCharsetMatch *ucsm,
+ UChar *buf, int32_t cap, UErrorCode *status);
+
+
+
+/**
+ * Get an iterator over the set of all detectable charsets -
+ * over the charsets that are known to the charset detection
+ * service.
+ *
+ * The returned UEnumeration provides access to the names of
+ * the charsets.
+ *
+ * The state of the Charset detector that is passed in does not
+ * affect the result of this function, but requiring a valid, open
+ * charset detector as a parameter insures that the charset detection
+ * service has been safely initialized and that the required detection
+ * data is available.
+ *
+ * @param ucsd a Charset detector.
+ * @param status Any error conditions are reported back in this variable.
+ * @return an iterator providing access to the detectable charset names.
+ * @stable ICU 3.6
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status);
+
+
+/**
+ * Test whether input filtering is enabled for this charset detector.
+ * Input filtering removes text that appears to be HTML or xml
+ * markup from the input before applying the code page detection
+ * heuristics.
+ *
+ * @param ucsd The charset detector to check.
+ * @return TRUE if filtering is enabled.
+ * @stable ICU 3.6
+ */
+U_STABLE UBool U_EXPORT2
+ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd);
+
+
+/**
+ * Enable filtering of input text. If filtering is enabled,
+ * text within angle brackets ("<" and ">") will be removed
+ * before detection, which will remove most HTML or xml markup.
+ *
+ * @param ucsd the charset detector to be modified.
+ * @param filter <code>true</code> to enable input text filtering.
+ * @return The previous setting.
+ *
+ * @stable ICU 3.6
+ */
+U_STABLE UBool U_EXPORT2
+ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter);
+
+#endif
+#endif /* __UCSDET_H */
+
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h b/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h
new file mode 100644
index 00000000000..842b8864472
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ucurr.h
@@ -0,0 +1,225 @@
+/*
+**********************************************************************
+* Copyright (c) 2002-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+*/
+#ifndef _UCURR_H_
+#define _UCURR_H_
+
+#include "unicode/utypes.h"
+#include "unicode/uenum.h"
+
+/**
+ * \file
+ * \brief C API: Encapsulates information about a currency.
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+/**
+ * The ucurr API encapsulates information about a currency, as defined by
+ * ISO 4217. A currency is represented by a 3-character string
+ * containing its ISO 4217 code. This API can return various data
+ * necessary the proper display of a currency:
+ *
+ * <ul><li>A display symbol, for a specific locale
+ * <li>The number of fraction digits to display
+ * <li>A rounding increment
+ * </ul>
+ *
+ * The <tt>DecimalFormat</tt> class uses these data to display
+ * currencies.
+ * @author Alan Liu
+ * @since ICU 2.2
+ */
+
+/**
+ * Finds a currency code for the given locale.
+ * @param locale the locale for which to retrieve a currency code.
+ * Currency can be specified by the "currency" keyword
+ * in which case it overrides the default currency code
+ * @param buff fill in buffer. Can be NULL for preflighting.
+ * @param buffCapacity capacity of the fill in buffer. Can be 0 for
+ * preflighting. If it is non-zero, the buff parameter
+ * must not be NULL.
+ * @param ec error code
+ * @return length of the currency string. It should always be 3. If 0,
+ * currency couldn't be found or the input values are
+ * invalid.
+ * @stable ICU 2.8
+ */
+U_STABLE int32_t U_EXPORT2
+ucurr_forLocale(const char* locale,
+ UChar* buff,
+ int32_t buffCapacity,
+ UErrorCode* ec);
+
+/**
+ * Selector constants for ucurr_getName().
+ *
+ * @see ucurr_getName
+ * @stable ICU 2.6
+ */
+typedef enum UCurrNameStyle {
+ /**
+ * Selector for ucurr_getName indicating a symbolic name for a
+ * currency, such as "$" for USD.
+ * @stable ICU 2.6
+ */
+ UCURR_SYMBOL_NAME,
+
+ /**
+ * Selector for ucurr_getName indicating the long name for a
+ * currency, such as "US Dollar" for USD.
+ * @stable ICU 2.6
+ */
+ UCURR_LONG_NAME
+} UCurrNameStyle;
+
+#if !UCONFIG_NO_SERVICE
+/**
+ * @stable ICU 2.6
+ */
+typedef const void* UCurrRegistryKey;
+
+/**
+ * Register an (existing) ISO 4217 currency code for the given locale.
+ * Only the country code and the two variants EURO and PRE_EURO are
+ * recognized.
+ * @param isoCode the three-letter ISO 4217 currency code
+ * @param locale the locale for which to register this currency code
+ * @param status the in/out status code
+ * @return a registry key that can be used to unregister this currency code, or NULL
+ * if there was an error.
+ * @stable ICU 2.6
+ */
+U_STABLE UCurrRegistryKey U_EXPORT2
+ucurr_register(const UChar* isoCode,
+ const char* locale,
+ UErrorCode* status);
+/**
+ * Unregister the previously-registered currency definitions using the
+ * URegistryKey returned from ucurr_register. Key becomes invalid after
+ * a successful call and should not be used again. Any currency
+ * that might have been hidden by the original ucurr_register call is
+ * restored.
+ * @param key the registry key returned by a previous call to ucurr_register
+ * @param status the in/out status code, no special meanings are assigned
+ * @return TRUE if the currency for this key was successfully unregistered
+ * @stable ICU 2.6
+ */
+U_STABLE UBool U_EXPORT2
+ucurr_unregister(UCurrRegistryKey key, UErrorCode* status);
+#endif /* UCONFIG_NO_SERVICE */
+
+/**
+ * Returns the display name for the given currency in the
+ * given locale. For example, the display name for the USD
+ * currency object in the en_US locale is "$".
+ * @param currency null-terminated 3-letter ISO 4217 code
+ * @param locale locale in which to display currency
+ * @param nameStyle selector for which kind of name to return
+ * @param isChoiceFormat fill-in set to TRUE if the returned value
+ * is a ChoiceFormat pattern; otherwise it is a static string
+ * @param len fill-in parameter to receive length of result
+ * @param ec error code
+ * @return pointer to display string of 'len' UChars. If the resource
+ * data contains no entry for 'currency', then 'currency' itself is
+ * returned. If *isChoiceFormat is TRUE, then the result is a
+ * ChoiceFormat pattern. Otherwise it is a static string.
+ * @stable ICU 2.6
+ */
+U_STABLE const UChar* U_EXPORT2
+ucurr_getName(const UChar* currency,
+ const char* locale,
+ UCurrNameStyle nameStyle,
+ UBool* isChoiceFormat,
+ int32_t* len,
+ UErrorCode* ec);
+
+/**
+ * Returns the number of the number of fraction digits that should
+ * be displayed for the given currency.
+ * @param currency null-terminated 3-letter ISO 4217 code
+ * @param ec input-output error code
+ * @return a non-negative number of fraction digits to be
+ * displayed, or 0 if there is an error
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucurr_getDefaultFractionDigits(const UChar* currency,
+ UErrorCode* ec);
+
+/**
+ * Returns the rounding increment for the given currency, or 0.0 if no
+ * rounding is done by the currency.
+ * @param currency null-terminated 3-letter ISO 4217 code
+ * @param ec input-output error code
+ * @return the non-negative rounding increment, or 0.0 if none,
+ * or 0.0 if there is an error
+ * @stable ICU 3.0
+ */
+U_STABLE double U_EXPORT2
+ucurr_getRoundingIncrement(const UChar* currency,
+ UErrorCode* ec);
+
+/**
+ * Selector constants for ucurr_openCurrencies().
+ *
+ * @see ucurr_openCurrencies
+ * @stable ICU 3.2
+ */
+typedef enum UCurrCurrencyType {
+ /**
+ * Select all ISO-4217 currency codes.
+ * @stable ICU 3.2
+ */
+ UCURR_ALL = INT32_MAX,
+ /**
+ * Select only ISO-4217 commonly used currency codes.
+ * These currencies can be found in common use, and they usually have
+ * bank notes or coins associated with the currency code.
+ * This does not include fund codes, precious metals and other
+ * various ISO-4217 codes limited to special financial products.
+ * @stable ICU 3.2
+ */
+ UCURR_COMMON = 1,
+ /**
+ * Select ISO-4217 uncommon currency codes.
+ * These codes respresent fund codes, precious metals and other
+ * various ISO-4217 codes limited to special financial products.
+ * A fund code is a monetary resource associated with a currency.
+ * @stable ICU 3.2
+ */
+ UCURR_UNCOMMON = 2,
+ /**
+ * Select only deprecated ISO-4217 codes.
+ * These codes are no longer in general public use.
+ * @stable ICU 3.2
+ */
+ UCURR_DEPRECATED = 4,
+ /**
+ * Select only non-deprecated ISO-4217 codes.
+ * These codes are in general public use.
+ * @stable ICU 3.2
+ */
+ UCURR_NON_DEPRECATED = 8
+} UCurrCurrencyType;
+
+/**
+ * Provides a UEnumeration object for listing ISO-4217 codes.
+ * @param currType You can use one of several UCurrCurrencyType values for this
+ * variable. You can also | (or) them together to get a specific list of
+ * currencies. Most people will want to use the (UCURR_CURRENCY|UCURR_NON_DEPRECATED) value to
+ * get a list of current currencies.
+ * @param pErrorCode Error code
+ * @stable ICU 3.2
+ */
+U_STABLE UEnumeration * U_EXPORT2
+ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
+
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/udat.h b/Build/source/libs/icu-xetex/i18n/unicode/udat.h
new file mode 100644
index 00000000000..34573d2a1cf
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/udat.h
@@ -0,0 +1,826 @@
+/*
+ *******************************************************************************
+ * Copyright (C) 1996-2007, International Business Machines
+ * Corporation and others. All Rights Reserved.
+ *******************************************************************************
+*/
+
+#ifndef UDAT_H
+#define UDAT_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/ucal.h"
+#include "unicode/unum.h"
+/**
+ * \file
+ * \brief C API: DateFormat
+ *
+ * <h2> Date Format C API</h2>
+ *
+ * Date Format C API consists of functions that convert dates and
+ * times from their internal representations to textual form and back again in a
+ * language-independent manner. Converting from the internal representation (milliseconds
+ * since midnight, January 1, 1970) to text is known as "formatting," and converting
+ * from text to millis is known as "parsing." We currently define only one concrete
+ * structure UDateFormat, which can handle pretty much all normal
+ * date formatting and parsing actions.
+ * <P>
+ * Date Format helps you to format and parse dates for any locale. Your code can
+ * be completely independent of the locale conventions for months, days of the
+ * week, or even the calendar format: lunar vs. solar.
+ * <P>
+ * To format a date for the current Locale with default time and date style,
+ * use one of the static factory methods:
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * UChar *myString;
+ * int32_t myStrlen = 0;
+ * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &status);
+ * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status);
+ * if (status==U_BUFFER_OVERFLOW_ERROR){
+ * status=U_ZERO_ERROR;
+ * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ * udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status);
+ * }
+ * \endcode
+ * </pre>
+ * If you are formatting multiple numbers, it is more efficient to get the
+ * format and use it multiple times so that the system doesn't have to fetch the
+ * information about the local language and country conventions multiple times.
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * int32_t i, myStrlen = 0;
+ * UChar* myString;
+ * char buffer[1024];
+ * UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
+ * UDateFormat* df = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, 0, &status);
+ * for (i = 0; i < 3; i++) {
+ * myStrlen = udat_format(df, myDateArr[i], NULL, myStrlen, NULL, &status);
+ * if(status == U_BUFFER_OVERFLOW_ERROR){
+ * status = U_ZERO_ERROR;
+ * myString = (UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ * udat_format(df, myDateArr[i], myString, myStrlen+1, NULL, &status);
+ * printf("%s\n", u_austrcpy(buffer, myString) );
+ * free(myString);
+ * }
+ * }
+ * \endcode
+ * </pre>
+ * To get specific fields of a date, you can use UFieldPosition to
+ * get specific fields.
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * UFieldPosition pos;
+ * UChar *myString;
+ * int32_t myStrlen = 0;
+ * char buffer[1024];
+ *
+ * pos.field = 1; // Same as the DateFormat::EField enum
+ * UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, -1, NULL, 0, &status);
+ * myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status);
+ * if (status==U_BUFFER_OVERFLOW_ERROR){
+ * status=U_ZERO_ERROR;
+ * myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ * udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status);
+ * }
+ * printf("date format: %s\n", u_austrcpy(buffer, myString));
+ * buffer[pos.endIndex] = 0; // NULL terminate the string.
+ * printf("UFieldPosition position equals %s\n", &buffer[pos.beginIndex]);
+ * \endcode
+ * </pre>
+ * To format a date for a different Locale, specify it in the call to
+ * udat_open()
+ * <pre>
+ * \code
+ * UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", NULL, -1, NULL, 0, &status);
+ * \endcode
+ * </pre>
+ * You can use a DateFormat API udat_parse() to parse.
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * int32_t parsepos=0;
+ * UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
+ * \endcode
+ * </pre>
+ * You can pass in different options for the arguments for date and time style
+ * to control the length of the result; from SHORT to MEDIUM to LONG to FULL.
+ * The exact result depends on the locale, but generally:
+ * see UDateFormatStyle for more details
+ * <ul type=round>
+ * <li> UDAT_SHORT is completely numeric, such as 12/13/52 or 3:30pm
+ * <li> UDAT_MEDIUM is longer, such as Jan 12, 1952
+ * <li> UDAT_LONG is longer, such as January 12, 1952 or 3:30:32pm
+ * <li> UDAT_FULL is pretty completely specified, such as
+ * Tuesday, April 12, 1952 AD or 3:30:42pm PST.
+ * </ul>
+ * You can also set the time zone on the format if you wish.
+ * <P>
+ * You can also use forms of the parse and format methods with Parse Position and
+ * UFieldPosition to allow you to
+ * <ul type=round>
+ * <li> Progressively parse through pieces of a string.
+ * <li> Align any particular field, or find out where it is for selection
+ * on the screen.
+ * </ul>
+ */
+
+/** A date formatter.
+ * For usage in C programs.
+ * @stable ICU 2.6
+ */
+typedef void* UDateFormat;
+
+/** The possible date/time format styles
+ * @stable ICU 2.6
+ */
+typedef enum UDateFormatStyle {
+ /** Full style */
+ UDAT_FULL,
+ /** Long style */
+ UDAT_LONG,
+ /** Medium style */
+ UDAT_MEDIUM,
+ /** Short style */
+ UDAT_SHORT,
+ /** Default style */
+ UDAT_DEFAULT = UDAT_MEDIUM,
+
+ /** Bitfield for relative date */
+ UDAT_RELATIVE = (1 << 7),
+
+ UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
+
+ UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
+
+ UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
+
+ UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
+
+
+ /** No style */
+ UDAT_NONE = -1,
+ /** for internal API use only */
+ UDAT_IGNORE = -2
+
+} UDateFormatStyle;
+
+/**
+ * FieldPosition and UFieldPosition selectors for format fields
+ * defined by DateFormat and UDateFormat.
+ * @stable ICU 3.0
+ */
+typedef enum UDateFormatField {
+ /**
+ * FieldPosition and UFieldPosition selector for 'G' field alignment,
+ * corresponding to the UCAL_ERA field.
+ * @stable ICU 3.0
+ */
+ UDAT_ERA_FIELD = 0,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'y' field alignment,
+ * corresponding to the UCAL_YEAR field.
+ * @stable ICU 3.0
+ */
+ UDAT_YEAR_FIELD = 1,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'M' field alignment,
+ * corresponding to the UCAL_MONTH field.
+ * @stable ICU 3.0
+ */
+ UDAT_MONTH_FIELD = 2,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'd' field alignment,
+ * corresponding to the UCAL_DATE field.
+ * @stable ICU 3.0
+ */
+ UDAT_DATE_FIELD = 3,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'k' field alignment,
+ * corresponding to the UCAL_HOUR_OF_DAY field.
+ * UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.
+ * For example, 23:59 + 01:00 results in 24:59.
+ * @stable ICU 3.0
+ */
+ UDAT_HOUR_OF_DAY1_FIELD = 4,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'H' field alignment,
+ * corresponding to the UCAL_HOUR_OF_DAY field.
+ * UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.
+ * For example, 23:59 + 01:00 results in 00:59.
+ * @stable ICU 3.0
+ */
+ UDAT_HOUR_OF_DAY0_FIELD = 5,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'm' field alignment,
+ * corresponding to the UCAL_MINUTE field.
+ * @stable ICU 3.0
+ */
+ UDAT_MINUTE_FIELD = 6,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 's' field alignment,
+ * corresponding to the UCAL_SECOND field.
+ * @stable ICU 3.0
+ */
+ UDAT_SECOND_FIELD = 7,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'S' field alignment,
+ * corresponding to the UCAL_MILLISECOND field.
+ * @stable ICU 3.0
+ */
+ UDAT_FRACTIONAL_SECOND_FIELD = 8,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'E' field alignment,
+ * corresponding to the UCAL_DAY_OF_WEEK field.
+ * @stable ICU 3.0
+ */
+ UDAT_DAY_OF_WEEK_FIELD = 9,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'D' field alignment,
+ * corresponding to the UCAL_DAY_OF_YEAR field.
+ * @stable ICU 3.0
+ */
+ UDAT_DAY_OF_YEAR_FIELD = 10,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'F' field alignment,
+ * corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field.
+ * @stable ICU 3.0
+ */
+ UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'w' field alignment,
+ * corresponding to the UCAL_WEEK_OF_YEAR field.
+ * @stable ICU 3.0
+ */
+ UDAT_WEEK_OF_YEAR_FIELD = 12,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'W' field alignment,
+ * corresponding to the UCAL_WEEK_OF_MONTH field.
+ * @stable ICU 3.0
+ */
+ UDAT_WEEK_OF_MONTH_FIELD = 13,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'a' field alignment,
+ * corresponding to the UCAL_AM_PM field.
+ * @stable ICU 3.0
+ */
+ UDAT_AM_PM_FIELD = 14,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'h' field alignment,
+ * corresponding to the UCAL_HOUR field.
+ * UDAT_HOUR1_FIELD is used for the one-based 12-hour clock.
+ * For example, 11:30 PM + 1 hour results in 12:30 AM.
+ * @stable ICU 3.0
+ */
+ UDAT_HOUR1_FIELD = 15,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'K' field alignment,
+ * corresponding to the UCAL_HOUR field.
+ * UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock.
+ * For example, 11:30 PM + 1 hour results in 00:30 AM.
+ * @stable ICU 3.0
+ */
+ UDAT_HOUR0_FIELD = 16,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'z' field alignment,
+ * corresponding to the UCAL_ZONE_OFFSET and
+ * UCAL_DST_OFFSET fields.
+ * @stable ICU 3.0
+ */
+ UDAT_TIMEZONE_FIELD = 17,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'Y' field alignment,
+ * corresponding to the UCAL_YEAR_WOY field.
+ * @stable ICU 3.0
+ */
+ UDAT_YEAR_WOY_FIELD = 18,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'e' field alignment,
+ * corresponding to the UCAL_DOW_LOCAL field.
+ * @stable ICU 3.0
+ */
+ UDAT_DOW_LOCAL_FIELD = 19,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'u' field alignment,
+ * corresponding to the UCAL_EXTENDED_YEAR field.
+ * @stable ICU 3.0
+ */
+ UDAT_EXTENDED_YEAR_FIELD = 20,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'g' field alignment,
+ * corresponding to the UCAL_JULIAN_DAY field.
+ * @stable ICU 3.0
+ */
+ UDAT_JULIAN_DAY_FIELD = 21,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'A' field alignment,
+ * corresponding to the UCAL_MILLISECONDS_IN_DAY field.
+ * @stable ICU 3.0
+ */
+ UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'Z' field alignment,
+ * corresponding to the UCAL_ZONE_OFFSET and
+ * UCAL_DST_OFFSET fields.
+ * @stable ICU 3.0
+ */
+ UDAT_TIMEZONE_RFC_FIELD = 23,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'v' field alignment,
+ * corresponding to the UCAL_ZONE_OFFSET field.
+ * @stable ICU 3.4
+ */
+ UDAT_TIMEZONE_GENERIC_FIELD = 24,
+ /**
+ * FieldPosition selector for 'c' field alignment,
+ * corresponding to the {@link #UCAL_DAY} field.
+ * This displays the stand alone day name, if available.
+ * @stable ICU 3.4
+ */
+ UDAT_STANDALONE_DAY_FIELD = 25,
+
+ /**
+ * FieldPosition selector for 'L' field alignment,
+ * corresponding to the {@link #UCAL_MONTH} field.
+ * This displays the stand alone month name, if available.
+ * @stable ICU 3.4
+ */
+ UDAT_STANDALONE_MONTH_FIELD = 26,
+
+ /**
+ * FieldPosition selector for "Q" field alignment,
+ * corresponding to quarters. This is implemented
+ * using the {@link #UCAL_MONTH} field. This
+ * displays the quarter.
+ * @stable ICU 3.6
+ */
+ UDAT_QUARTER_FIELD = 27,
+
+ /**
+ * FieldPosition selector for the "q" field alignment,
+ * corresponding to stand-alone quarters. This is
+ * implemented using the {@link #UCAL_MONTH} field.
+ * This displays the stand-alone quarter.
+ * @stable ICU 3.6
+ */
+ UDAT_STANDALONE_QUARTER_FIELD = 28,
+
+ /**
+ * FieldPosition and UFieldPosition selector for 'V' field alignment,
+ * corresponding to the UCAL_ZONE_OFFSET field.
+ * @stable ICU 3.8
+ */
+ UDAT_TIMEZONE_SPECIAL_FIELD = 29,
+
+ /**
+ * Number of FieldPosition and UFieldPosition selectors for
+ * DateFormat and UDateFormat.
+ * Valid selectors range from 0 to UDAT_FIELD_COUNT-1.
+ * This value is subject to change if new fields are defined
+ * in the future.
+ * @stable ICU 3.0
+ */
+ UDAT_FIELD_COUNT = 30
+
+} UDateFormatField;
+
+/**
+ * Open a new UDateFormat for formatting and parsing dates and times.
+ * A UDateFormat may be used to format dates in calls to {@link #udat_format },
+ * and to parse dates in calls to {@link #udat_parse }.
+ * @param timeStyle The style used to format times; one of UDAT_FULL, UDAT_LONG,
+ * UDAT_MEDIUM, UDAT_SHORT, or UDAT_DEFAULT
+ * @param dateStyle The style used to format dates; one of UDAT_FULL, UDAT_LONG,
+ * UDAT_MEDIUM, UDAT_SHORT, or UDAT_DEFAULT
+ * @param locale The locale specifying the formatting conventions
+ * @param tzID A timezone ID specifying the timezone to use. If 0, use
+ * the default timezone.
+ * @param tzIDLength The length of tzID, or -1 if null-terminated.
+ * @param pattern A pattern specifying the format to use.
+ * @param patternLength The number of characters in the pattern, or -1 if null-terminated.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @return A pointer to a UDateFormat to use for formatting dates and times, or 0 if
+ * an error occurred.
+ * @stable ICU 2.0
+ */
+U_STABLE UDateFormat* U_EXPORT2
+udat_open(UDateFormatStyle timeStyle,
+ UDateFormatStyle dateStyle,
+ const char *locale,
+ const UChar *tzID,
+ int32_t tzIDLength,
+ const UChar *pattern,
+ int32_t patternLength,
+ UErrorCode *status);
+
+
+/**
+* Close a UDateFormat.
+* Once closed, a UDateFormat may no longer be used.
+* @param format The formatter to close.
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_close(UDateFormat* format);
+
+/**
+ * Open a copy of a UDateFormat.
+ * This function performs a deep copy.
+ * @param fmt The format to copy
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return A pointer to a UDateFormat identical to fmt.
+ * @stable ICU 2.0
+ */
+U_STABLE UDateFormat* U_EXPORT2
+udat_clone(const UDateFormat *fmt,
+ UErrorCode *status);
+
+/**
+* Format a date using an UDateFormat.
+* The date will be formatted using the conventions specified in {@link #udat_open }
+* @param format The formatter to use
+* @param dateToFormat The date to format
+* @param result A pointer to a buffer to receive the formatted number.
+* @param resultLength The maximum size of result.
+* @param position A pointer to a UFieldPosition. On input, position->field
+* is read. On output, position->beginIndex and position->endIndex indicate
+* the beginning and ending indices of field number position->field, if such
+* a field exists. This parameter may be NULL, in which case no field
+* position data is returned.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see udat_parse
+* @see UFieldPosition
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+udat_format( const UDateFormat* format,
+ UDate dateToFormat,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPosition* position,
+ UErrorCode* status);
+
+/**
+* Parse a string into an date/time using a UDateFormat.
+* The date will be parsed using the conventions specified in {@link #udat_open }
+* @param format The formatter to use.
+* @param text The text to parse.
+* @param textLength The length of text, or -1 if null-terminated.
+* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
+* to begin parsing. If not 0, on output the offset at which parsing ended.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The value of the parsed date/time
+* @see udat_format
+* @stable ICU 2.0
+*/
+U_STABLE UDate U_EXPORT2
+udat_parse( const UDateFormat* format,
+ const UChar* text,
+ int32_t textLength,
+ int32_t *parsePos,
+ UErrorCode *status);
+
+/**
+* Parse a string into an date/time using a UDateFormat.
+* The date will be parsed using the conventions specified in {@link #udat_open }
+* @param format The formatter to use.
+* @param calendar The calendar in which to store the parsed data.
+* @param text The text to parse.
+* @param textLength The length of text, or -1 if null-terminated.
+* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
+* to begin parsing. If not 0, on output the offset at which parsing ended.
+* @param status A pointer to an UErrorCode to receive any errors
+* @see udat_format
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_parseCalendar(const UDateFormat* format,
+ UCalendar* calendar,
+ const UChar* text,
+ int32_t textLength,
+ int32_t *parsePos,
+ UErrorCode *status);
+
+/**
+* Determine if an UDateFormat will perform lenient parsing.
+* With lenient parsing, the parser may use heuristics to interpret inputs that do not
+* precisely match the pattern. With strict parsing, inputs must match the pattern.
+* @param fmt The formatter to query
+* @return TRUE if fmt is set to perform lenient parsing, FALSE otherwise.
+* @see udat_setLenient
+* @stable ICU 2.0
+*/
+U_STABLE UBool U_EXPORT2
+udat_isLenient(const UDateFormat* fmt);
+
+/**
+* Specify whether an UDateFormat will perform lenient parsing.
+* With lenient parsing, the parser may use heuristics to interpret inputs that do not
+* precisely match the pattern. With strict parsing, inputs must match the pattern.
+* @param fmt The formatter to set
+* @param isLenient TRUE if fmt should perform lenient parsing, FALSE otherwise.
+* @see dat_isLenient
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_setLenient( UDateFormat* fmt,
+ UBool isLenient);
+
+/**
+* Get the UCalendar associated with an UDateFormat.
+* A UDateFormat uses a UCalendar to convert a raw value to, for example,
+* the day of the week.
+* @param fmt The formatter to query.
+* @return A pointer to the UCalendar used by fmt.
+* @see udat_setCalendar
+* @stable ICU 2.0
+*/
+U_STABLE const UCalendar* U_EXPORT2
+udat_getCalendar(const UDateFormat* fmt);
+
+/**
+* Set the UCalendar associated with an UDateFormat.
+* A UDateFormat uses a UCalendar to convert a raw value to, for example,
+* the day of the week.
+* @param fmt The formatter to set.
+* @param calendarToSet A pointer to an UCalendar to be used by fmt.
+* @see udat_setCalendar
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_setCalendar( UDateFormat* fmt,
+ const UCalendar* calendarToSet);
+
+/**
+* Get the UNumberFormat associated with an UDateFormat.
+* A UDateFormat uses a UNumberFormat to format numbers within a date,
+* for example the day number.
+* @param fmt The formatter to query.
+* @return A pointer to the UNumberFormat used by fmt to format numbers.
+* @see udat_setNumberFormat
+* @stable ICU 2.0
+*/
+U_STABLE const UNumberFormat* U_EXPORT2
+udat_getNumberFormat(const UDateFormat* fmt);
+
+/**
+* Set the UNumberFormat associated with an UDateFormat.
+* A UDateFormat uses a UNumberFormat to format numbers within a date,
+* for example the day number.
+* @param fmt The formatter to set.
+* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
+* @see udat_getNumberFormat
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_setNumberFormat( UDateFormat* fmt,
+ const UNumberFormat* numberFormatToSet);
+
+/**
+* Get a locale for which date/time formatting patterns are available.
+* A UDateFormat in a locale returned by this function will perform the correct
+* formatting and parsing for the locale.
+* @param index The index of the desired locale.
+* @return A locale for which date/time formatting patterns are available, or 0 if none.
+* @see udat_countAvailable
+* @stable ICU 2.0
+*/
+U_STABLE const char* U_EXPORT2
+udat_getAvailable(int32_t index);
+
+/**
+* Determine how many locales have date/time formatting patterns available.
+* This function is most useful as determining the loop ending condition for
+* calls to {@link #udat_getAvailable }.
+* @return The number of locales for which date/time formatting patterns are available.
+* @see udat_getAvailable
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+udat_countAvailable(void);
+
+/**
+* Get the year relative to which all 2-digit years are interpreted.
+* For example, if the 2-digit start year is 2100, the year 99 will be
+* interpreted as 2199.
+* @param fmt The formatter to query.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The year relative to which all 2-digit years are interpreted.
+* @see udat_Set2DigitYearStart
+* @stable ICU 2.0
+*/
+U_STABLE UDate U_EXPORT2
+udat_get2DigitYearStart( const UDateFormat *fmt,
+ UErrorCode *status);
+
+/**
+* Set the year relative to which all 2-digit years will be interpreted.
+* For example, if the 2-digit start year is 2100, the year 99 will be
+* interpreted as 2199.
+* @param fmt The formatter to set.
+* @param d The year relative to which all 2-digit years will be interpreted.
+* @param status A pointer to an UErrorCode to receive any errors
+* @see udat_Set2DigitYearStart
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_set2DigitYearStart( UDateFormat *fmt,
+ UDate d,
+ UErrorCode *status);
+
+/**
+* Extract the pattern from a UDateFormat.
+* The pattern will follow the pattern syntax rules.
+* @param fmt The formatter to query.
+* @param localized TRUE if the pattern should be localized, FALSE otherwise.
+* @param result A pointer to a buffer to receive the pattern.
+* @param resultLength The maximum size of result.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see udat_applyPattern
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+udat_toPattern( const UDateFormat *fmt,
+ UBool localized,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+* Set the pattern used by an UDateFormat.
+* The pattern should follow the pattern syntax rules.
+* @param format The formatter to set.
+* @param localized TRUE if the pattern is localized, FALSE otherwise.
+* @param pattern The new pattern
+* @param patternLength The length of pattern, or -1 if null-terminated.
+* @see udat_toPattern
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_applyPattern( UDateFormat *format,
+ UBool localized,
+ const UChar *pattern,
+ int32_t patternLength);
+
+/**
+ * The possible types of date format symbols
+ * @stable ICU 2.6
+ */
+typedef enum UDateFormatSymbolType {
+ /** The era names, for example AD */
+ UDAT_ERAS,
+ /** The month names, for example February */
+ UDAT_MONTHS,
+ /** The short month names, for example Feb. */
+ UDAT_SHORT_MONTHS,
+ /** The weekday names, for example Monday */
+ UDAT_WEEKDAYS,
+ /** The short weekday names, for example Mon. */
+ UDAT_SHORT_WEEKDAYS,
+ /** The AM/PM names, for example AM */
+ UDAT_AM_PMS,
+ /** The localized characters */
+ UDAT_LOCALIZED_CHARS,
+ /** The long era names, for example Anno Domini */
+ UDAT_ERA_NAMES,
+ /** The narrow month names, for example F */
+ UDAT_NARROW_MONTHS,
+ /** The narrow weekday names, for example N */
+ UDAT_NARROW_WEEKDAYS,
+ /** Standalone context versions of months */
+ UDAT_STANDALONE_MONTHS,
+ UDAT_STANDALONE_SHORT_MONTHS,
+ UDAT_STANDALONE_NARROW_MONTHS,
+ /** Standalone context versions of weekdays */
+ UDAT_STANDALONE_WEEKDAYS,
+ UDAT_STANDALONE_SHORT_WEEKDAYS,
+ UDAT_STANDALONE_NARROW_WEEKDAYS,
+ /** The quarters, for example 1st Quarter */
+ UDAT_QUARTERS,
+ /** The short quarter names, for example Q1 */
+ UDAT_SHORT_QUARTERS,
+ /** Standalone context versions of quarters */
+ UDAT_STANDALONE_QUARTERS,
+ UDAT_STANDALONE_SHORT_QUARTERS
+
+} UDateFormatSymbolType;
+
+struct UDateFormatSymbols;
+/** Date format symbols.
+ * For usage in C programs.
+ * @stable ICU 2.6
+ */
+typedef struct UDateFormatSymbols UDateFormatSymbols;
+
+/**
+* Get the symbols associated with an UDateFormat.
+* The symbols are what a UDateFormat uses to represent locale-specific data,
+* for example month or day names.
+* @param fmt The formatter to query.
+* @param type The type of symbols to get. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
+* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
+* @param index The desired symbol of type type.
+* @param result A pointer to a buffer to receive the pattern.
+* @param resultLength The maximum size of result.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see udat_countSymbols
+* @see udat_setSymbols
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+udat_getSymbols(const UDateFormat *fmt,
+ UDateFormatSymbolType type,
+ int32_t index,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status);
+
+/**
+* Count the number of particular symbols for an UDateFormat.
+* This function is most useful as for detemining the loop termination condition
+* for calls to {@link #udat_getSymbols }.
+* @param fmt The formatter to query.
+* @param type The type of symbols to count. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
+* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
+* @return The number of symbols of type type.
+* @see udat_getSymbols
+* @see udat_setSymbols
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+udat_countSymbols( const UDateFormat *fmt,
+ UDateFormatSymbolType type);
+
+/**
+* Set the symbols associated with an UDateFormat.
+* The symbols are what a UDateFormat uses to represent locale-specific data,
+* for example month or day names.
+* @param format The formatter to set
+* @param type The type of symbols to set. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS,
+* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS
+* @param index The index of the symbol to set of type type.
+* @param value The new value
+* @param valueLength The length of value, or -1 if null-terminated
+* @param status A pointer to an UErrorCode to receive any errors
+* @see udat_getSymbols
+* @see udat_countSymbols
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+udat_setSymbols( UDateFormat *format,
+ UDateFormatSymbolType type,
+ int32_t index,
+ UChar *value,
+ int32_t valueLength,
+ UErrorCode *status);
+
+/**
+ * Get the locale for this date format object.
+ * You can choose between valid and actual locale.
+ * @param fmt The formatter to get the locale from
+ * @param type type of the locale we're looking for (valid or actual)
+ * @param status error code for the operation
+ * @return the locale name
+ * @stable ICU 2.8
+ */
+U_STABLE const char* U_EXPORT2
+udat_getLocaleByType(const UDateFormat *fmt,
+ ULocDataLocaleType type,
+ UErrorCode* status);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/udatpg.h b/Build/source/libs/icu-xetex/i18n/unicode/udatpg.h
new file mode 100644
index 00000000000..4a7f29594dd
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/udatpg.h
@@ -0,0 +1,475 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2007, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: udatpg.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2007jul30
+* created by: Markus W. Scherer
+*/
+
+#ifndef __UDATPG_H__
+#define __UDATPG_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uenum.h"
+
+/**
+ * \file
+ * \brief C API: Wrapper for DateTimePatternGenerator (unicode/dtptngen.h).
+ *
+ * UDateTimePatternGenerator 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 udatpg_getBestPattern, since normally
+ * UDateTimePatternGenerator 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>
+ */
+
+/**
+ * Opaque type for a date/time pattern generator object.
+ * @draft ICU 3.8
+ */
+typedef void *UDateTimePatternGenerator;
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Field number constants for udatpg_getAppendItemFormats() and similar functions.
+ * These constants are separate from UDateFormatField despite semantic overlap
+ * because some fields are merged for the date/time pattern generator.
+ * @draft ICU 3.8
+ */
+typedef enum UDateTimePatternField {
+ /** @draft ICU 3.8 */
+ UDATPG_ERA_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_YEAR_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_QUARTER_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_MONTH_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_WEEK_OF_YEAR_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_WEEK_OF_MONTH_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_WEEKDAY_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_DAY_OF_YEAR_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_DAY_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_DAYPERIOD_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_HOUR_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_MINUTE_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_SECOND_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_FRACTIONAL_SECOND_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_ZONE_FIELD,
+ /** @draft ICU 3.8 */
+ UDATPG_FIELD_COUNT
+} UDateTimePatternField;
+
+/**
+ * Status return values from udatpg_addPattern().
+ * @draft ICU 3.8
+ */
+typedef enum UDateTimePatternConflict {
+ /** @draft ICU 3.8 */
+ UDATPG_NO_CONFLICT,
+ /** @draft ICU 3.8 */
+ UDATPG_BASE_CONFLICT,
+ /** @draft ICU 3.8 */
+ UDATPG_CONFLICT,
+ /** @draft ICU 3.8 */
+ UDATPG_CONFLICT_COUNT
+} UDateTimePatternConflict;
+
+#endif
+
+/**
+ * Open a generator according to a given locale.
+ * @param locale
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return a pointer to UDateTimePatternGenerator.
+ * @draft ICU 3.8
+ */
+U_DRAFT UDateTimePatternGenerator * U_EXPORT2
+udatpg_open(const char *locale, UErrorCode *pErrorCode);
+
+/**
+ * Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return a pointer to UDateTimePatternGenerator.
+ * @draft ICU 3.8
+ */
+U_DRAFT UDateTimePatternGenerator * U_EXPORT2
+udatpg_openEmpty(UErrorCode *pErrorCode);
+
+/**
+ * Close a generator.
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @draft ICU 3.8
+ */
+U_DRAFT void U_EXPORT2
+udatpg_close(UDateTimePatternGenerator *dtpg);
+
+/**
+ * Create a copy pf a generator.
+ * @param dtpg a pointer to UDateTimePatternGenerator to be copied.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return a pointer to a new UDateTimePatternGenerator.
+ * @draft ICU 3.8
+ */
+U_DRAFT UDateTimePatternGenerator * U_EXPORT2
+udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
+
+/**
+ * Get the best pattern matching the input skeleton. It is guaranteed to
+ * have all of the fields in the skeleton.
+ *
+ * Note that this function uses a non-const UDateTimePatternGenerator:
+ * It uses a stateful pattern parser which is set up for each generator object,
+ * rather than creating one for each function call.
+ * Consecutive calls to this function do not affect each other,
+ * but this function cannot be used concurrently on a single generator object.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param skeleton
+ * The skeleton is a pattern containing only the variable fields.
+ * For example, "MMMdd" and "mmhh" are skeletons.
+ * @param length the length of skeleton
+ * @param bestPattern
+ * The best pattern found from the given skeleton.
+ * @param capacity the capacity of bestPattern.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return the length of bestPattern.
+ * @draft ICU 3.8
+ */
+U_DRAFT int32_t U_EXPORT2
+udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
+ const UChar *skeleton, int32_t length,
+ UChar *bestPattern, int32_t capacity,
+ UErrorCode *pErrorCode);
+
+/**
+ * Get a unique skeleton from a given pattern. For example,
+ * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
+ *
+ * Note that this function uses a non-const UDateTimePatternGenerator:
+ * It uses a stateful pattern parser which is set up for each generator object,
+ * rather than creating one for each function call.
+ * Consecutive calls to this function do not affect each other,
+ * but this function cannot be used concurrently on a single generator object.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pattern input pattern, such as "dd/MMM".
+ * @param length the length of pattern.
+ * @param skeleton such as "MMMdd"
+ * @param capacity the capacity of skeleton.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return the length of skeleton.
+ * @draft ICU 3.8
+ */
+U_DRAFT int32_t U_EXPORT2
+udatpg_getSkeleton(UDateTimePatternGenerator *dtpg,
+ const UChar *pattern, int32_t length,
+ UChar *skeleton, int32_t capacity,
+ UErrorCode *pErrorCode);
+
+/**
+ * Get 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).
+ *
+ * Note that this function uses a non-const UDateTimePatternGenerator:
+ * It uses a stateful pattern parser which is set up for each generator object,
+ * rather than creating one for each function call.
+ * Consecutive calls to this function do not affect each other,
+ * but this function cannot be used concurrently on a single generator object.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pattern input pattern, such as "dd/MMM".
+ * @param length the length of pattern.
+ * @param baseSkeleton such as "Md"
+ * @param capacity the capacity of base skeleton.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return the length of baseSkeleton.
+ * @draft ICU 3.8
+ */
+U_DRAFT int32_t U_EXPORT2
+udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg,
+ const UChar *pattern, int32_t length,
+ UChar *baseSkeleton, int32_t capacity,
+ UErrorCode *pErrorCode);
+
+/**
+ * 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 dtpg a pointer to UDateTimePatternGenerator.
+ * @param pattern input pattern, such as "dd/MMM"
+ * @param patternLength the length of pattern.
+ * @param override When existing values are to be overridden use true,
+ * otherwise use false.
+ * @param conflictingPattern Previous pattern with the same skeleton.
+ * @param capacity the capacity of conflictingPattern.
+ * @param pLength a pointer to the length of conflictingPattern.
+ * @param pErrorCode a pointer to the UErrorCode 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.
+ * @draft ICU 3.8
+ */
+U_DRAFT UDateTimePatternConflict U_EXPORT2
+udatpg_addPattern(UDateTimePatternGenerator *dtpg,
+ const UChar *pattern, int32_t patternLength,
+ UBool override,
+ UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
+ UErrorCode *pErrorCode);
+
+/**
+ * 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 dtpg a pointer to UDateTimePatternGenerator.
+ * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
+ * @param value pattern, such as "{0}, {1}"
+ * @param length the length of value.
+ * @draft ICU 3.8
+ */
+U_DRAFT void U_EXPORT2
+udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ const UChar *value, int32_t length);
+
+/**
+ * Getter corresponding to setAppendItemFormat. Values below 0 or at or
+ * above UDATPG_FIELD_COUNT are illegal arguments.
+ *
+ * @param dtpg A pointer to UDateTimePatternGenerator.
+ * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
+ * @param pLength A pointer that will receive the length of appendItemFormat.
+ * @return appendItemFormat for field.
+ * @draft ICU 3.8
+ */
+U_DRAFT const UChar * U_EXPORT2
+udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ int32_t *pLength);
+
+/**
+ * Set the name 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 dtpg a pointer to UDateTimePatternGenerator.
+ * @param field UDateTimePatternField
+ * @param value name for the field.
+ * @param length the length of value.
+ * @draft ICU 3.8
+ */
+U_DRAFT void U_EXPORT2
+udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ const UChar *value, int32_t length);
+
+/**
+ * Getter corresponding to setAppendItemNames. Values below 0 or at or above
+ * UDATPG_FIELD_COUNT are illegal arguments.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
+ * @param pLength A pointer that will receive the length of the name for field.
+ * @return name for field
+ * @draft ICU 3.8
+ */
+U_DRAFT const UChar * U_EXPORT2
+udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ int32_t *pLength);
+
+/**
+ * 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 dtpg a pointer to UDateTimePatternGenerator.
+ * @param dtFormat
+ * message format pattern, here {0} will be replaced by the date
+ * pattern and {1} will be replaced by the time pattern.
+ * @param length the length of dtFormat.
+ * @draft ICU 3.8
+ */
+U_DRAFT void U_EXPORT2
+udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
+ const UChar *dtFormat, int32_t length);
+
+/**
+ * Getter corresponding to setDateTimeFormat.
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pLength A pointer that will receive the length of the format
+ * @return dateTimeFormat.
+ * @draft ICU 3.8
+ */
+U_DRAFT const UChar * U_EXPORT2
+udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
+ int32_t *pLength);
+
+/**
+ * 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 dtpg a pointer to UDateTimePatternGenerator.
+ * @param decimal
+ * @param length the length of decimal.
+ * @draft ICU 3.8
+ */
+U_DRAFT void U_EXPORT2
+udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
+ const UChar *decimal, int32_t length);
+
+/**
+ * Getter corresponding to setDecimal.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pLength A pointer that will receive the length of the decimal string.
+ * @return corresponding to the decimal point.
+ * @draft ICU 3.8
+ */
+U_DRAFT const UChar * U_EXPORT2
+udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
+ int32_t *pLength);
+
+/**
+ * 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.
+ *
+ * Note that this function uses a non-const UDateTimePatternGenerator:
+ * It uses a stateful pattern parser which is set up for each generator object,
+ * rather than creating one for each function call.
+ * Consecutive calls to this function do not affect each other,
+ * but this function cannot be used concurrently on a single generator object.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pattern Input pattern
+ * @param patternLength the length of input pattern.
+ * @param skeleton
+ * @param skeletonLength the length of input skeleton.
+ * @param dest pattern adjusted to match the skeleton fields widths and subtypes.
+ * @param destCapacity the capacity of dest.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return the length of dest.
+ * @draft ICU 3.8
+ */
+U_DRAFT int32_t U_EXPORT2
+udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
+ const UChar *pattern, int32_t patternLength,
+ const UChar *skeleton, int32_t skeletonLength,
+ UChar *dest, int32_t destCapacity,
+ UErrorCode *pErrorCode);
+
+/**
+ * Return a UEnumeration list of all the skeletons in canonical form.
+ * Call udatpg_getPatternForSkeleton() to get the corresponding pattern.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call
+ * @return a UEnumeration list of all the skeletons
+ * The caller must close the object.
+ * @draft ICU 3.8
+ */
+U_DRAFT UEnumeration * U_EXPORT2
+udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
+
+/**
+ * Return a UEnumeration list of all the base skeletons in canonical form.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param pErrorCode a pointer to the UErrorCode which must not indicate a
+ * failure before the function call.
+ * @return a UEnumeration list of all the base skeletons
+ * The caller must close the object.
+ * @draft ICU 3.8
+ */
+U_DRAFT UEnumeration * U_EXPORT2
+udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
+
+/**
+ * Get the pattern corresponding to a given skeleton.
+ *
+ * @param dtpg a pointer to UDateTimePatternGenerator.
+ * @param skeleton
+ * @param skeletonLength pointer to the length of skeleton.
+ * @param pLength pointer to the length of return pattern.
+ * @return pattern corresponding to a given skeleton.
+ * @draft ICU 3.8
+ */
+U_DRAFT const UChar * U_EXPORT2
+udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
+ const UChar *skeleton, int32_t skeletonLength,
+ int32_t *pLength);
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h b/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h
new file mode 100644
index 00000000000..6bcc47220a7
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/ulocdata.h
@@ -0,0 +1,194 @@
+/*
+******************************************************************************
+* *
+* Copyright (C) 2003-2007, International Business Machines *
+* Corporation and others. All Rights Reserved. *
+* *
+******************************************************************************
+* file name: ulocdata.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* created on: 2003Oct21
+* created by: Ram Viswanadha
+*/
+
+#ifndef __ULOCDATA_H__
+#define __ULOCDATA_H__
+
+#include "unicode/ures.h"
+#include "unicode/uloc.h"
+#include "unicode/uset.h"
+
+/**
+ * \file
+ * \brief C API: Provides access to locale data.
+ */
+
+/** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */
+struct ULocaleData;
+
+/** A locale data object. @stable ICU 3.6 */
+typedef struct ULocaleData ULocaleData;
+
+
+
+/** The possible types of exemplar character sets.
+ * @stable ICU 3.4
+ */
+typedef enum ULocaleDataExemplarSetType {
+ ULOCDATA_ES_STANDARD=0, /* Basic set */
+ ULOCDATA_ES_AUXILIARY=1, /* Auxiliary set */
+ ULOCDATA_ES_COUNT=2
+} ULocaleDataExemplarSetType;
+
+/** The possible types of delimiters.
+ * @stable ICU 3.4
+ */
+typedef enum ULocaleDataDelimiterType {
+#ifndef U_HIDE_DRAFT_API
+ ULOCDATA_QUOTATION_START = 0, /* Quotation start */
+ ULOCDATA_QUOTATION_END = 1, /* Quotation end */
+ ULOCDATA_ALT_QUOTATION_START = 2, /* Alternate quotation start */
+ ULOCDATA_ALT_QUOTATION_END = 3, /* Alternate quotation end */
+#endif
+ ULOCDATA_DELIMITER_COUNT = 4
+} ULocaleDataDelimiterType;
+
+/**
+ * Opens a locale data object for the given locale
+ *
+ * @param localeID Specifies the locale associated with this locale
+ * data object.
+ * @param status Pointer to error status code.
+ * @stable ICU 3.4
+ */
+U_STABLE ULocaleData* U_EXPORT2
+ulocdata_open(const char *localeID, UErrorCode *status);
+
+/**
+ * Closes a locale data object.
+ *
+ * @param uld The locale data object to close
+ * @stable ICU 3.4
+ */
+U_STABLE void U_EXPORT2
+ulocdata_close(ULocaleData *uld);
+
+/**
+ * Sets the "no Substitute" attribute of the locale data
+ * object. If true, then any methods associated with the
+ * locale data object will return null when there is no
+ * data available for that method, given the locale ID
+ * supplied to ulocdata_open().
+ *
+ * @param uld The locale data object to set.
+ * @param setting Value of the "no substitute" attribute.
+ * @stable ICU 3.4
+ */
+U_STABLE void U_EXPORT2
+ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting);
+
+/**
+ * Retrieves the current "no Substitute" value of the locale data
+ * object. If true, then any methods associated with the
+ * locale data object will return null when there is no
+ * data available for that method, given the locale ID
+ * supplied to ulocdata_open().
+ *
+ * @param uld Pointer to the The locale data object to set.
+ * @return UBool Value of the "no substitute" attribute.
+ * @stable ICU 3.4
+ */
+U_STABLE UBool U_EXPORT2
+ulocdata_getNoSubstitute(ULocaleData *uld);
+
+/**
+ * Returns the set of exemplar characters for a locale.
+ *
+ * @param uld Pointer to the locale data object from which the
+ * exemplar character set is to be retrieved.
+ * @param fillIn Pointer to a USet object to receive the
+ * exemplar character set for the given locale. Previous
+ * contents of fillIn are lost. <em>If fillIn is NULL,
+ * then a new USet is created and returned. The caller
+ * owns the result and must dispose of it by calling
+ * uset_close.</em>
+ * @param options Bitmask for options to apply to the exemplar pattern.
+ * Specify zero to retrieve the exemplar set as it is
+ * defined in the locale data. Specify
+ * USET_CASE_INSENSITIVE to retrieve a case-folded
+ * exemplar set. See uset_applyPattern for a complete
+ * list of valid options. The USET_IGNORE_SPACE bit is
+ * always set, regardless of the value of 'options'.
+ * @param extype Specifies the type of exemplar set to be retrieved.
+ * @param status Pointer to an input-output error code value;
+ * must not be NULL.
+ * @return USet* Either fillIn, or if fillIn is NULL, a pointer to
+ * a newly-allocated USet that the user must close.
+ * @stable ICU 3.4
+ */
+U_STABLE USet* U_EXPORT2
+ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
+ uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status);
+
+/**
+ * Returns one of the delimiter strings associated with a locale.
+ *
+ * @param uld Pointer to the locale data object from which the
+ * delimiter string is to be retrieved.
+ * @param type the type of delimiter to be retrieved.
+ * @param result A pointer to a buffer to receive the result.
+ * @param resultLength The maximum size of result.
+ * @param status Pointer to an error code value
+ * @return int32_t The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 3.4
+ */
+U_STABLE int32_t U_EXPORT2
+ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status);
+
+/**
+ * Enumeration for representing the measurement systems.
+ * @stable ICU 2.8
+ */
+typedef enum UMeasurementSystem {
+ UMS_SI, /** Measurement system specified by SI otherwise known as Metric system. */
+ UMS_US, /** Measurement system followed in the United States of America. */
+ UMS_LIMIT
+} UMeasurementSystem;
+
+/**
+ * Returns the measurement system used in the locale specified by the localeID.
+ * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
+ *
+ * @param localeID The id of the locale for which the measurement system to be retrieved.
+ * @param status Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @return UMeasurementSystem the measurement system used in the locale.
+ * @stable ICU 2.8
+ */
+U_STABLE UMeasurementSystem U_EXPORT2
+ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status);
+
+/**
+ * Returns the element gives the normal business letter size, and customary units.
+ * The units for the numbers are always in <em>milli-meters</em>.
+ * For US since 8.5 and 11 do not yeild an integral value when converted to milli-meters,
+ * the values are rounded off.
+ * So for A4 size paper the height and width are 297 mm and 210 mm repectively,
+ * and for US letter size the height and width are 279 mm and 216 mm respectively.
+ * Please note that this API will change in ICU 3.6 and will use an ulocdata object.
+ *
+ * @param localeID The id of the locale for which the paper size information to be retrieved.
+ * @param height A pointer to int to recieve the height information.
+ * @param width A pointer to int to recieve the width information.
+ * @param status Must be a valid pointer to an error code value,
+ * which must not indicate a failure before the function call.
+ * @stable ICU 2.8
+ */
+U_STABLE void U_EXPORT2
+ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status);
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/umsg.h b/Build/source/libs/icu-xetex/i18n/unicode/umsg.h
new file mode 100644
index 00000000000..32ed063c274
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/umsg.h
@@ -0,0 +1,647 @@
+/*
+*******************************************************************************
+* Copyright (C) 1996-2006, International Business Machines Corporation
+* and others. All Rights Reserved.
+*******************************************************************************
+*
+* file name: umsg.h
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*
+* Change history:
+*
+* 08/5/2001 Ram Added C wrappers for C++ API.
+*
+*
+*/
+
+#ifndef UMSG_H
+#define UMSG_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uloc.h"
+#include "unicode/parseerr.h"
+#include <stdarg.h>
+/**
+ * \file
+ * \brief C API: MessageFormat
+ *
+ * <h2>Message Format C API </h2>
+ *
+ * Provides means to produce concatenated messages in language-neutral way.
+ * Use this for all concatenations that show up to end users.
+ * <P>
+ * Takes a set of objects, formats them, then inserts the formatted
+ * strings into the pattern at the appropriate places.
+ * <P>
+ * Here are some examples of usage:
+ * Example 1:
+ * <pre>
+ * \code
+ * UChar *result, *tzID, *str;
+ * UChar pattern[100];
+ * int32_t resultLengthOut, resultlength;
+ * UCalendar *cal;
+ * UDate d1;
+ * UDateFormat *def1;
+ * UErrorCode status = U_ZERO_ERROR;
+ *
+ * str=(UChar*)malloc(sizeof(UChar) * (strlen("disturbance in force") +1));
+ * u_uastrcpy(str, "disturbance in force");
+ * tzID=(UChar*)malloc(sizeof(UChar) * 4);
+ * u_uastrcpy(tzID, "PST");
+ * cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_TRADITIONAL, &status);
+ * ucal_setDateTime(cal, 1999, UCAL_MARCH, 18, 0, 0, 0, &status);
+ * d1=ucal_getMillis(cal, &status);
+ * u_uastrcpy(pattern, "On {0, date, long}, there was a {1} on planet {2,number,integer}");
+ * resultlength=0;
+ * resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, d1, str, 7);
+ * if(status==U_BUFFER_OVERFLOW_ERROR){
+ * status=U_ZERO_ERROR;
+ * resultlength=resultLengthOut+1;
+ * result=(UChar*)realloc(result, sizeof(UChar) * resultlength);
+ * u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7);
+ * }
+ * printf("%s\n", austrdup(result) );//austrdup( a function used to convert UChar* to char*)
+ * //output>: "On March 18, 1999, there was a disturbance in force on planet 7
+ * \endcode
+ * </pre>
+ * Typically, the message format will come from resources, and the
+ * arguments will be dynamically set at runtime.
+ * <P>
+ * Example 2:
+ * <pre>
+ * \code
+ * UChar* str;
+ * UErrorCode status = U_ZERO_ERROR;
+ * UChar *result;
+ * UChar pattern[100];
+ * int32_t resultlength, resultLengthOut, i;
+ * double testArgs= { 100.0, 1.0, 0.0};
+ *
+ * str=(UChar*)malloc(sizeof(UChar) * 10);
+ * u_uastrcpy(str, "MyDisk");
+ * u_uastrcpy(pattern, "The disk {1} contains {0,choice,0#no files|1#one file|1<{0,number,integer} files}");
+ * for(i=0; i<3; i++){
+ * resultlength=0;
+ * resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str);
+ * if(status==U_BUFFER_OVERFLOW_ERROR){
+ * status=U_ZERO_ERROR;
+ * resultlength=resultLengthOut+1;
+ * result=(UChar*)malloc(sizeof(UChar) * resultlength);
+ * u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str);
+ * }
+ * printf("%s\n", austrdup(result) ); //austrdup( a function used to convert UChar* to char*)
+ * free(result);
+ * }
+ * // output, with different testArgs:
+ * // output: The disk "MyDisk" contains 100 files.
+ * // output: The disk "MyDisk" contains one file.
+ * // output: The disk "MyDisk" contains no files.
+ * \endcode
+ * </pre>
+ *
+ * The pattern is of the following form. Legend:
+ * <pre>
+ * \code
+ * {optional item}
+ * (group that may be repeated)*
+ * \endcode
+ * </pre>
+ * Do not confuse optional items with items inside quotes braces, such
+ * as this: "{". Quoted braces are literals.
+ * <pre>
+ * \code
+ * messageFormatPattern := string ( "{" messageFormatElement "}" string )*
+ *
+ * messageFormatElement := argument { "," elementFormat }
+ *
+ * elementFormat := "time" { "," datetimeStyle }
+ * | "date" { "," datetimeStyle }
+ * | "number" { "," numberStyle }
+ * | "choice" "," choiceStyle
+ *
+ * datetimeStyle := "short"
+ * | "medium"
+ * | "long"
+ * | "full"
+ * | dateFormatPattern
+ *
+ * numberStyle := "currency"
+ * | "percent"
+ * | "integer"
+ * | numberFormatPattern
+ *
+ * choiceStyle := choiceFormatPattern
+ * \endcode
+ * </pre>
+ * If there is no elementFormat, then the argument must be a string,
+ * which is substituted. If there is no dateTimeStyle or numberStyle,
+ * then the default format is used (e.g. NumberFormat.getInstance(),
+ * DateFormat.getDefaultTime() or DateFormat.getDefaultDate(). For
+ * a ChoiceFormat, the pattern must always be specified, since there
+ * is no default.
+ * <P>
+ * In strings, single quotes can be used to quote the "{" sign if
+ * necessary. A real single quote is represented by ''. Inside a
+ * messageFormatElement, quotes are [not] removed. For example,
+ * {1,number,$'#',##} will produce a number format with the pound-sign
+ * quoted, with a result such as: "$#31,45".
+ * <P>
+ * If a pattern is used, then unquoted braces in the pattern, if any,
+ * must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab
+ * {0'}' de" and "ab } de" are not.
+ * <p>
+ * <dl><dt><b>Warning:</b><dd>The rules for using quotes within message
+ * format patterns unfortunately have shown to be somewhat confusing.
+ * In particular, it isn't always obvious to localizers whether single
+ * quotes need to be doubled or not. Make sure to inform localizers about
+ * the rules, and tell them (for example, by using comments in resource
+ * bundle source files) which strings will be processed by MessageFormat.
+ * Note that localizers may need to use single quotes in translated
+ * strings where the original version doesn't have them.
+ * <br>Note also that the simplest way to avoid the problem is to
+ * use the real apostrophe (single quote) character U+2019 (') for
+ * human-readable text, and to use the ASCII apostrophe (U+0027 ' )
+ * only in program syntax, like quoting in MessageFormat.
+ * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p>
+ * </dl>
+ * <P>
+ * The argument is a number from 0 to 9, which corresponds to the
+ * arguments presented in an array to be formatted.
+ * <P>
+ * It is ok to have unused arguments in the array. With missing
+ * arguments or arguments that are not of the right class for the
+ * specified format, a failing UErrorCode result is set.
+ * <P>
+
+ * <P>
+ * [Note:] As we see above, the string produced by a choice Format in
+ * MessageFormat is treated specially; occurances of '{' are used to
+ * indicated subformats.
+ * <P>
+ * [Note:] Formats are numbered by order of variable in the string.
+ * This is [not] the same as the argument numbering!
+ * <pre>
+ * \code
+ * For example: with "abc{2}def{3}ghi{0}...",
+ *
+ * format0 affects the first variable {2}
+ * format1 affects the second variable {3}
+ * format2 affects the second variable {0}
+ * \endcode
+ * </pre>
+ * and so on.
+ */
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param locale The locale for which the message will be formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments specified
+ * in pattern.
+ * @return The total buffer size needed; if greater than resultLength, the
+ * output was truncated.
+ * @see u_parseMessage
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_formatMessage(const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param locale The locale for which the message will be formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param ap A variable-length argument list containing the arguments specified
+ * @param status A pointer to an UErrorCode to receive any errors
+ * in pattern.
+ * @return The total buffer size needed; if greater than resultLength, the
+ * output was truncated.
+ * @see u_parseMessage
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_vformatMessage( const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ UChar *result,
+ int32_t resultLength,
+ va_list ap,
+ UErrorCode *status);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #u_formatMessage }.
+ * @param locale The locale for which the message is formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments
+ * specified in pattern.
+ * @see u_formatMessage
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_parseMessage( const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ const UChar *source,
+ int32_t sourceLength,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #u_formatMessage }.
+ * @param locale The locale for which the message is formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param ap A variable-length argument list containing the arguments
+ * @param status A pointer to an UErrorCode to receive any errors
+ * specified in pattern.
+ * @see u_formatMessage
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_vparseMessage(const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ const UChar *source,
+ int32_t sourceLength,
+ va_list ap,
+ UErrorCode *status);
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param locale The locale for which the message will be formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments specified
+ * in pattern.
+ * @param parseError A pointer to UParseError to receive information about errors
+ * occurred during parsing.
+ * @return The total buffer size needed; if greater than resultLength, the
+ * output was truncated.
+ * @see u_parseMessage
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_formatMessageWithError( const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ UChar *result,
+ int32_t resultLength,
+ UParseError *parseError,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param locale The locale for which the message will be formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param parseError A pointer to UParseError to receive information about errors
+ * occurred during parsing.
+ * @param ap A variable-length argument list containing the arguments specified
+ * @param status A pointer to an UErrorCode to receive any errors
+ * in pattern.
+ * @return The total buffer size needed; if greater than resultLength, the
+ * output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+u_vformatMessageWithError( const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ UChar *result,
+ int32_t resultLength,
+ UParseError* parseError,
+ va_list ap,
+ UErrorCode *status);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #u_formatMessage }.
+ * @param locale The locale for which the message is formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param parseError A pointer to UParseError to receive information about errors
+ * occurred during parsing.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments
+ * specified in pattern.
+ * @see u_formatMessage
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_parseMessageWithError(const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ const UChar *source,
+ int32_t sourceLength,
+ UParseError *parseError,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #u_formatMessage }.
+ * @param locale The locale for which the message is formatted
+ * @param pattern The pattern specifying the message's format
+ * @param patternLength The length of pattern
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param ap A variable-length argument list containing the arguments
+ * @param parseError A pointer to UParseError to receive information about errors
+ * occurred during parsing.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * specified in pattern.
+ * @see u_formatMessage
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+u_vparseMessageWithError(const char *locale,
+ const UChar *pattern,
+ int32_t patternLength,
+ const UChar *source,
+ int32_t sourceLength,
+ va_list ap,
+ UParseError *parseError,
+ UErrorCode* status);
+
+/*----------------------- New experimental API --------------------------- */
+/**
+ * The message format object
+ * @stable ICU 2.0
+ */
+typedef void* UMessageFormat;
+
+
+/**
+ * Open a message formatter with given pattern and for the given locale.
+ * @param pattern A pattern specifying the format to use.
+ * @param patternLength Length of the pattern to use
+ * @param locale The locale for which the messages are formatted.
+ * @param parseError A pointer to UParseError struct to receive any errors
+ * occured during parsing. Can be NULL.
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return A pointer to a UMessageFormat to use for formatting
+ * messages, or 0 if an error occurred.
+ * @stable ICU 2.0
+ */
+U_STABLE UMessageFormat* U_EXPORT2
+umsg_open( const UChar *pattern,
+ int32_t patternLength,
+ const char *locale,
+ UParseError *parseError,
+ UErrorCode *status);
+
+/**
+ * Close a UMessageFormat.
+ * Once closed, a UMessageFormat may no longer be used.
+ * @param format The formatter to close.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+umsg_close(UMessageFormat* format);
+
+/**
+ * Open a copy of a UMessageFormat.
+ * This function performs a deep copy.
+ * @param fmt The formatter to copy
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return A pointer to a UDateFormat identical to fmt.
+ * @stable ICU 2.0
+ */
+U_STABLE UMessageFormat U_EXPORT2
+umsg_clone(const UMessageFormat *fmt,
+ UErrorCode *status);
+
+/**
+ * Sets the locale. This locale is used for fetching default number or date
+ * format information.
+ * @param fmt The formatter to set
+ * @param locale The locale the formatter should use.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+umsg_setLocale(UMessageFormat *fmt,
+ const char* locale);
+
+/**
+ * Gets the locale. This locale is used for fetching default number or date
+ * format information.
+ * @param fmt The formatter to querry
+ * @return the locale.
+ * @stable ICU 2.0
+ */
+U_STABLE const char* U_EXPORT2
+umsg_getLocale(const UMessageFormat *fmt);
+
+/**
+ * Sets the pattern.
+ * @param fmt The formatter to use
+ * @param pattern The pattern to be applied.
+ * @param patternLength Length of the pattern to use
+ * @param parseError Struct to receive information on position
+ * of error if an error is encountered.Can be NULL.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+umsg_applyPattern( UMessageFormat *fmt,
+ const UChar* pattern,
+ int32_t patternLength,
+ UParseError* parseError,
+ UErrorCode* status);
+
+/**
+ * Gets the pattern.
+ * @param fmt The formatter to use
+ * @param result A pointer to a buffer to receive the pattern.
+ * @param resultLength The maximum size of result.
+ * @param status Output param set to success/failure code on
+ * exit. If the pattern is invalid, this will be
+ * set to a failure result.
+ * @return the pattern of the format
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+umsg_toPattern(const UMessageFormat *fmt,
+ UChar* result,
+ int32_t resultLength,
+ UErrorCode* status);
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param fmt The formatter to use
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments
+ * specified in pattern.
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+umsg_format( const UMessageFormat *fmt,
+ UChar *result,
+ int32_t resultLength,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Format a message for a locale.
+ * This function may perform re-ordering of the arguments depending on the
+ * locale. For all numeric arguments, double is assumed unless the type is
+ * explicitly integer. All choice format arguments must be of type double.
+ * @param fmt The formatter to use
+ * @param result A pointer to a buffer to receive the formatted message.
+ * @param resultLength The maximum size of result.
+ * @param ap A variable-length argument list containing the arguments
+ * @param status A pointer to an UErrorCode to receive any errors
+ * specified in pattern.
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+umsg_vformat( const UMessageFormat *fmt,
+ UChar *result,
+ int32_t resultLength,
+ va_list ap,
+ UErrorCode *status);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #umsg_format }.
+ * @param fmt The formatter to use
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param count Output param to receive number of elements returned.
+ * @param status A pointer to an UErrorCode to receive any errors
+ * @param ... A variable-length argument list containing the arguments
+ * specified in pattern.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+umsg_parse( const UMessageFormat *fmt,
+ const UChar *source,
+ int32_t sourceLength,
+ int32_t *count,
+ UErrorCode *status,
+ ...);
+
+/**
+ * Parse a message.
+ * For numeric arguments, this function will always use doubles. Integer types
+ * should not be passed.
+ * This function is not able to parse all output from {@link #umsg_format }.
+ * @param fmt The formatter to use
+ * @param source The text to parse.
+ * @param sourceLength The length of source, or -1 if null-terminated.
+ * @param count Output param to receive number of elements returned.
+ * @param ap A variable-length argument list containing the arguments
+ * @param status A pointer to an UErrorCode to receive any errors
+ * specified in pattern.
+ * @see u_formatMessage
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+umsg_vparse(const UMessageFormat *fmt,
+ const UChar *source,
+ int32_t sourceLength,
+ int32_t *count,
+ va_list ap,
+ UErrorCode *status);
+
+
+/**
+ * Convert an 'apostrophe-friendly' pattern into a standard
+ * pattern. Standard patterns treat all apostrophes as
+ * quotes, which is problematic in some languages, e.g.
+ * French, where apostrophe is commonly used. This utility
+ * assumes that only an unpaired apostrophe immediately before
+ * a brace is a true quote. Other unpaired apostrophes are paired,
+ * and the resulting standard pattern string is returned.
+ *
+ * <p><b>Note</b> it is not guaranteed that the returned pattern
+ * is indeed a valid pattern. The only effect is to convert
+ * between patterns having different quoting semantics.
+ *
+ * @param pattern the 'apostrophe-friendly' patttern to convert
+ * @param patternLength the length of pattern, or -1 if unknown and pattern is null-terminated
+ * @param dest the buffer for the result, or NULL if preflight only
+ * @param destCapacity the length of the buffer, or 0 if preflighting
+ * @param ec the error code
+ * @return the length of the resulting text, not including trailing null
+ * if buffer has room for the trailing null, it is provided, otherwise
+ * not
+ * @stable ICU 3.4
+ */
+U_STABLE int32_t U_EXPORT2
+umsg_autoQuoteApostrophe(const UChar* pattern,
+ int32_t patternLength,
+ UChar* dest,
+ int32_t destCapacity,
+ UErrorCode* ec);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/unirepl.h b/Build/source/libs/icu-xetex/i18n/unicode/unirepl.h
new file mode 100644
index 00000000000..6b7746b2213
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/unirepl.h
@@ -0,0 +1,97 @@
+/*
+**********************************************************************
+* Copyright (c) 2002-2005, International Business Machines Corporation
+* and others. All Rights Reserved.
+**********************************************************************
+* Date Name Description
+* 01/14/2002 aliu Creation.
+**********************************************************************
+*/
+#ifndef UNIREPL_H
+#define UNIREPL_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: UnicodeReplacer
+ */
+
+U_NAMESPACE_BEGIN
+
+class Replaceable;
+class UnicodeString;
+class UnicodeSet;
+
+/**
+ * <code>UnicodeReplacer</code> defines a protocol for objects that
+ * replace a range of characters in a Replaceable string with output
+ * text. The replacement is done via the Replaceable API so as to
+ * preserve out-of-band data.
+ *
+ * <p>This is a mixin class.
+ * @author Alan Liu
+ * @stable ICU 2.4
+ */
+class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ {
+
+ public:
+
+ /**
+ * Destructor.
+ * @stable ICU 2.4
+ */
+ virtual ~UnicodeReplacer();
+
+ /**
+ * Replace characters in 'text' from 'start' to 'limit' with the
+ * output text of this object. Update the 'cursor' parameter to
+ * give the cursor position and return the length of the
+ * replacement text.
+ *
+ * @param text the text to be matched
+ * @param start inclusive start index of text to be replaced
+ * @param limit exclusive end index of text to be replaced;
+ * must be greater than or equal to start
+ * @param cursor output parameter for the cursor position.
+ * Not all replacer objects will update this, but in a complete
+ * tree of replacer objects, representing the entire output side
+ * of a transliteration rule, at least one must update it.
+ * @return the number of 16-bit code units in the text replacing
+ * the characters at offsets start..(limit-1) in text
+ * @stable ICU 2.4
+ */
+ virtual int32_t replace(Replaceable& text,
+ int32_t start,
+ int32_t limit,
+ int32_t& cursor) = 0;
+
+ /**
+ * Returns a string representation of this replacer. If the
+ * result of calling this function is passed to the appropriate
+ * parser, typically TransliteratorParser, it will produce another
+ * replacer that is equal to this one.
+ * @param result the string to receive the pattern. Previous
+ * contents will be deleted.
+ * @param escapeUnprintable if TRUE then convert unprintable
+ * character to their hex escape representations, \\uxxxx or
+ * \\Uxxxxxxxx. Unprintable characters are defined by
+ * Utility.isUnprintable().
+ * @return a reference to 'result'.
+ * @stable ICU 2.4
+ */
+ virtual UnicodeString& toReplacerPattern(UnicodeString& result,
+ UBool escapeUnprintable) const = 0;
+
+ /**
+ * Union the set of all characters that may output by this object
+ * into the given set.
+ * @param toUnionTo the set into which to union the output characters
+ * @stable ICU 2.4
+ */
+ virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0;
+};
+
+U_NAMESPACE_END
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/unum.h b/Build/source/libs/icu-xetex/i18n/unicode/unum.h
new file mode 100644
index 00000000000..c69d2f4b8b5
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/unum.h
@@ -0,0 +1,869 @@
+/*
+*******************************************************************************
+* Copyright (C) 1997-2007, International Business Machines Corporation and others.
+* All Rights Reserved.
+* Modification History:
+*
+* Date Name Description
+* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes
+*******************************************************************************
+*/
+
+#ifndef _UNUM
+#define _UNUM
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/uloc.h"
+#include "unicode/umisc.h"
+#include "unicode/parseerr.h"
+/**
+ * \file
+ * \brief C API: NumberFormat
+ *
+ * <h2> Number Format C API </h2>
+ *
+ * Number Format C API Provides functions for
+ * formatting and parsing a number. Also provides methods for
+ * determining which locales have number formats, and what their names
+ * are.
+ * <P>
+ * UNumberFormat helps you to format and parse numbers for any locale.
+ * Your code can be completely independent of the locale conventions
+ * for decimal points, thousands-separators, or even the particular
+ * decimal digits used, or whether the number format is even decimal.
+ * There are different number format styles like decimal, currency,
+ * percent and spellout.
+ * <P>
+ * To format a number for the current Locale, use one of the static
+ * factory methods:
+ * <pre>
+ * \code
+ * UChar myString[20];
+ * double myNumber = 7.0;
+ * UErrorCode status = U_ZERO_ERROR;
+ * UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
+ * unum_formatDouble(nf, myNumber, myString, 20, NULL, &status);
+ * printf(" Example 1: %s\n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
+ * \endcode
+ * </pre>
+ * If you are formatting multiple numbers, it is more efficient to get
+ * the format and use it multiple times so that the system doesn't
+ * have to fetch the information about the local language and country
+ * conventions multiple times.
+ * <pre>
+ * \code
+ * uint32_t i, resultlength, reslenneeded;
+ * UErrorCode status = U_ZERO_ERROR;
+ * UFieldPosition pos;
+ * uint32_t a[] = { 123, 3333, -1234567 };
+ * const uint32_t a_len = sizeof(a) / sizeof(a[0]);
+ * UNumberFormat* nf;
+ * UChar* result = NULL;
+ *
+ * nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
+ * for (i = 0; i < a_len; i++) {
+ * resultlength=0;
+ * reslenneeded=unum_format(nf, a[i], NULL, resultlength, &pos, &status);
+ * result = NULL;
+ * if(status==U_BUFFER_OVERFLOW_ERROR){
+ * status=U_ZERO_ERROR;
+ * resultlength=reslenneeded+1;
+ * result=(UChar*)malloc(sizeof(UChar) * resultlength);
+ * unum_format(nf, a[i], result, resultlength, &pos, &status);
+ * }
+ * printf( " Example 2: %s\n", austrdup(result));
+ * free(result);
+ * }
+ * \endcode
+ * </pre>
+ * To format a number for a different Locale, specify it in the
+ * call to unum_open().
+ * <pre>
+ * \code
+ * UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, "fr_FR", NULL, &success)
+ * \endcode
+ * </pre>
+ * You can use a NumberFormat API unum_parse() to parse.
+ * <pre>
+ * \code
+ * UErrorCode status = U_ZERO_ERROR;
+ * int32_t pos=0;
+ * int32_t num;
+ * num = unum_parse(nf, str, u_strlen(str), &pos, &status);
+ * \endcode
+ * </pre>
+ * Use UCAL_DECIMAL to get the normal number format for that country.
+ * There are other static options available. Use UCAL_CURRENCY
+ * to get the currency number format for that country. Use UCAL_PERCENT
+ * to get a format for displaying percentages. With this format, a
+ * fraction from 0.53 is displayed as 53%.
+ * <P>
+ * Use a pattern to create either a DecimalFormat or a RuleBasedNumberFormat
+ * formatter. The pattern must conform to the syntax defined for those
+ * formatters.
+ * <P>
+ * You can also control the display of numbers with such function as
+ * unum_getAttribues() and unum_setAtributes(), which let you set the
+ * miminum fraction digits, grouping, etc.
+ * @see UNumberFormatAttributes for more details
+ * <P>
+ * You can also use forms of the parse and format methods with
+ * ParsePosition and UFieldPosition to allow you to:
+ * <ul type=round>
+ * <li>(a) progressively parse through pieces of a string.
+ * <li>(b) align the decimal point and other areas.
+ * </ul>
+ * <p>
+ * It is also possible to change or set the symbols used for a particular
+ * locale like the currency symbol, the grouping seperator , monetary seperator
+ * etc by making use of functions unum_setSymbols() and unum_getSymbols().
+ */
+
+/** A number formatter.
+ * For usage in C programs.
+ * @stable ICU 2.0
+ */
+typedef void* UNumberFormat;
+
+/** The possible number format styles.
+ * @stable ICU 2.0
+ */
+typedef enum UNumberFormatStyle {
+ /**
+ * Decimal format defined by pattern
+ * @stable ICU 3.0
+ */
+ UNUM_PATTERN_DECIMAL=0,
+ /** Decimal format */
+ UNUM_DECIMAL=1,
+ /** Currency format */
+ UNUM_CURRENCY,
+ /** Percent format */
+ UNUM_PERCENT,
+ /** Scientific format */
+ UNUM_SCIENTIFIC,
+ /** Spellout rule-based format */
+ UNUM_SPELLOUT,
+ /**
+ * Ordinal rule-based format
+ * @stable ICU 3.0
+ */
+ UNUM_ORDINAL,
+ /**
+ * Duration rule-based format
+ * @stable ICU 3.0
+ */
+ UNUM_DURATION,
+ /**
+ * Rule-based format defined by pattern
+ * @stable ICU 3.0
+ */
+ UNUM_PATTERN_RULEBASED,
+ /** Default format */
+ UNUM_DEFAULT = UNUM_DECIMAL,
+ /** (Alias for UNUM_PATTERN_DECIMAL) */
+ UNUM_IGNORE = UNUM_PATTERN_DECIMAL
+} UNumberFormatStyle;
+
+/** The possible number format rounding modes.
+ * @stable ICU 2.0
+ */
+typedef enum UNumberFormatRoundingMode {
+ UNUM_ROUND_CEILING,
+ UNUM_ROUND_FLOOR,
+ UNUM_ROUND_DOWN,
+ UNUM_ROUND_UP,
+ /**
+ * Half-even rounding, misspelled name
+ * @deprecated, ICU 3.8
+ */
+ UNUM_FOUND_HALFEVEN,
+ UNUM_ROUND_HALFDOWN,
+ UNUM_ROUND_HALFUP,
+ /**
+ * Half-even rounding
+ * @stable, ICU 3.8
+ */
+ UNUM_ROUND_HALFEVEN = UNUM_FOUND_HALFEVEN
+} UNumberFormatRoundingMode;
+
+/** The possible number format pad positions.
+ * @stable ICU 2.0
+ */
+typedef enum UNumberFormatPadPosition {
+ UNUM_PAD_BEFORE_PREFIX,
+ UNUM_PAD_AFTER_PREFIX,
+ UNUM_PAD_BEFORE_SUFFIX,
+ UNUM_PAD_AFTER_SUFFIX
+} UNumberFormatPadPosition;
+
+/**
+ * Create and return a new UNumberFormat for formatting and parsing
+ * numbers. A UNumberFormat may be used to format numbers by calling
+ * {@link #unum_format }, and to parse numbers by calling {@link #unum_parse }.
+ * The caller must call {@link #unum_close } when done to release resources
+ * used by this object.
+ * @param style The type of number format to open: one of
+ * UNUM_DECIMAL, UNUM_CURRENCY, UNUM_PERCENT, UNUM_SCIENTIFIC, UNUM_SPELLOUT,
+ * UNUM_PATTERN_DECIMAL, UNUM_PATTERN_RULEBASED, or UNUM_DEFAULT.
+ * If UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED is passed then the
+ * number format is opened using the given pattern, which must conform
+ * to the syntax described in DecimalFormat or RuleBasedNumberFormat,
+ * respectively.
+ * @param pattern A pattern specifying the format to use.
+ * This parameter is ignored unless the style is
+ * UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED.
+ * @param patternLength The number of characters in the pattern, or -1
+ * if null-terminated. This parameter is ignored unless the style is
+ * UNUM_PATTERN.
+ * @param locale A locale identifier to use to determine formatting
+ * and parsing conventions, or NULL to use the default locale.
+ * @param parseErr A pointer to a UParseError struct to receive the
+ * details of any parsing errors, or NULL if no parsing error details
+ * are desired.
+ * @param status A pointer to an input-output UErrorCode.
+ * @return A pointer to a newly created UNumberFormat, or NULL if an
+ * error occurred.
+ * @see unum_close
+ * @see DecimalFormat
+ * @stable ICU 2.0
+ */
+U_STABLE UNumberFormat* U_EXPORT2
+unum_open( UNumberFormatStyle style,
+ const UChar* pattern,
+ int32_t patternLength,
+ const char* locale,
+ UParseError* parseErr,
+ UErrorCode* status);
+
+
+/**
+* Close a UNumberFormat.
+* Once closed, a UNumberFormat may no longer be used.
+* @param fmt The formatter to close.
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+unum_close(UNumberFormat* fmt);
+
+/**
+ * Open a copy of a UNumberFormat.
+ * This function performs a deep copy.
+ * @param fmt The format to copy
+ * @param status A pointer to an UErrorCode to receive any errors.
+ * @return A pointer to a UNumberFormat identical to fmt.
+ * @stable ICU 2.0
+ */
+U_STABLE UNumberFormat* U_EXPORT2
+unum_clone(const UNumberFormat *fmt,
+ UErrorCode *status);
+
+/**
+* Format an integer using a UNumberFormat.
+* The integer will be formatted according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param number The number to format.
+* @param result A pointer to a buffer to receive the formatted number.
+* @param resultLength The maximum size of result.
+* @param pos A pointer to a UFieldPosition. On input, position->field
+* is read. On output, position->beginIndex and position->endIndex indicate
+* the beginning and ending indices of field number position->field, if such
+* a field exists. This parameter may be NULL, in which case no field
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see unum_formatInt64
+* @see unum_formatDouble
+* @see unum_parse
+* @see unum_parseInt64
+* @see unum_parseDouble
+* @see UFieldPosition
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_format( const UNumberFormat* fmt,
+ int32_t number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPosition *pos,
+ UErrorCode* status);
+
+/**
+* Format an int64 using a UNumberFormat.
+* The int64 will be formatted according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param number The number to format.
+* @param result A pointer to a buffer to receive the formatted number.
+* @param resultLength The maximum size of result.
+* @param pos A pointer to a UFieldPosition. On input, position->field
+* is read. On output, position->beginIndex and position->endIndex indicate
+* the beginning and ending indices of field number position->field, if such
+* a field exists. This parameter may be NULL, in which case no field
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see unum_format
+* @see unum_formatDouble
+* @see unum_parse
+* @see unum_parseInt64
+* @see unum_parseDouble
+* @see UFieldPosition
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_formatInt64(const UNumberFormat *fmt,
+ int64_t number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPosition *pos,
+ UErrorCode* status);
+
+/**
+* Format a double using a UNumberFormat.
+* The double will be formatted according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param number The number to format.
+* @param result A pointer to a buffer to receive the formatted number.
+* @param resultLength The maximum size of result.
+* @param pos A pointer to a UFieldPosition. On input, position->field
+* is read. On output, position->beginIndex and position->endIndex indicate
+* the beginning and ending indices of field number position->field, if such
+* a field exists. This parameter may be NULL, in which case no field
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see unum_format
+* @see unum_formatInt64
+* @see unum_parse
+* @see unum_parseInt64
+* @see unum_parseDouble
+* @see UFieldPosition
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_formatDouble( const UNumberFormat* fmt,
+ double number,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPosition *pos, /* 0 if ignore */
+ UErrorCode* status);
+
+/**
+ * Format a double currency amount using a UNumberFormat.
+ * The double will be formatted according to the UNumberFormat's locale.
+ * @param fmt the formatter to use
+ * @param number the number to format
+ * @param currency the 3-letter null-terminated ISO 4217 currency code
+ * @param result a pointer to the buffer to receive the formatted number
+ * @param resultLength the maximum number of UChars to write to result
+ * @param pos a pointer to a UFieldPosition. On input,
+ * position->field is read. On output, position->beginIndex and
+ * position->endIndex indicate the beginning and ending indices of
+ * field number position->field, if such a field exists. This
+ * parameter may be NULL, in which case it is ignored.
+ * @param status a pointer to an input-output UErrorCode
+ * @return the total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @see unum_formatDouble
+ * @see unum_parseDoubleCurrency
+ * @see UFieldPosition
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+unum_formatDoubleCurrency(const UNumberFormat* fmt,
+ double number,
+ UChar* currency,
+ UChar* result,
+ int32_t resultLength,
+ UFieldPosition* pos, /* ignored if 0 */
+ UErrorCode* status);
+
+/**
+* Parse a string into an integer using a UNumberFormat.
+* The string will be parsed according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param text The text to parse.
+* @param textLength The length of text, or -1 if null-terminated.
+* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
+* to begin parsing. If not 0, on output the offset at which parsing ended.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The value of the parsed integer
+* @see unum_parseInt64
+* @see unum_parseDouble
+* @see unum_format
+* @see unum_formatInt64
+* @see unum_formatDouble
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_parse( const UNumberFormat* fmt,
+ const UChar* text,
+ int32_t textLength,
+ int32_t *parsePos /* 0 = start */,
+ UErrorCode *status);
+
+/**
+* Parse a string into an int64 using a UNumberFormat.
+* The string will be parsed according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param text The text to parse.
+* @param textLength The length of text, or -1 if null-terminated.
+* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
+* to begin parsing. If not 0, on output the offset at which parsing ended.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The value of the parsed integer
+* @see unum_parse
+* @see unum_parseDouble
+* @see unum_format
+* @see unum_formatInt64
+* @see unum_formatDouble
+* @stable ICU 2.8
+*/
+U_STABLE int64_t U_EXPORT2
+unum_parseInt64(const UNumberFormat* fmt,
+ const UChar* text,
+ int32_t textLength,
+ int32_t *parsePos /* 0 = start */,
+ UErrorCode *status);
+
+/**
+* Parse a string into a double using a UNumberFormat.
+* The string will be parsed according to the UNumberFormat's locale.
+* @param fmt The formatter to use.
+* @param text The text to parse.
+* @param textLength The length of text, or -1 if null-terminated.
+* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which
+* to begin parsing. If not 0, on output the offset at which parsing ended.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The value of the parsed double
+* @see unum_parse
+* @see unum_parseInt64
+* @see unum_format
+* @see unum_formatInt64
+* @see unum_formatDouble
+* @stable ICU 2.0
+*/
+U_STABLE double U_EXPORT2
+unum_parseDouble( const UNumberFormat* fmt,
+ const UChar* text,
+ int32_t textLength,
+ int32_t *parsePos /* 0 = start */,
+ UErrorCode *status);
+
+/**
+ * Parse a string into a double and a currency using a UNumberFormat.
+ * The string will be parsed according to the UNumberFormat's locale.
+ * @param fmt the formatter to use
+ * @param text the text to parse
+ * @param textLength the length of text, or -1 if null-terminated
+ * @param parsePos a pointer to an offset index into text at which to
+ * begin parsing. On output, *parsePos will point after the last
+ * parsed character. This parameter may be 0, in which case parsing
+ * begins at offset 0.
+ * @param currency a pointer to the buffer to receive the parsed null-
+ * terminated currency. This buffer must have a capacity of at least
+ * 4 UChars.
+ * @param status a pointer to an input-output UErrorCode
+ * @return the parsed double
+ * @see unum_parseDouble
+ * @see unum_formatDoubleCurrency
+ * @stable ICU 3.0
+ */
+U_STABLE double U_EXPORT2
+unum_parseDoubleCurrency(const UNumberFormat* fmt,
+ const UChar* text,
+ int32_t textLength,
+ int32_t* parsePos, /* 0 = start */
+ UChar* currency,
+ UErrorCode* status);
+
+/**
+ * Set the pattern used by a UNumberFormat. This can only be used
+ * on a DecimalFormat, other formats return U_ILLEGAL_ARGUMENT_ERROR
+ * in the status.
+ * @param format The formatter to set.
+ * @param localized TRUE if the pattern is localized, FALSE otherwise.
+ * @param pattern The new pattern
+ * @param patternLength The length of pattern, or -1 if null-terminated.
+ * @param parseError A pointer to UParseError to recieve information
+ * about errors occurred during parsing, or NULL if no parse error
+ * information is desired.
+ * @param status A pointer to an input-output UErrorCode.
+ * @see unum_toPattern
+ * @see DecimalFormat
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+unum_applyPattern( UNumberFormat *format,
+ UBool localized,
+ const UChar *pattern,
+ int32_t patternLength,
+ UParseError *parseError,
+ UErrorCode *status
+ );
+
+/**
+* Get a locale for which decimal formatting patterns are available.
+* A UNumberFormat in a locale returned by this function will perform the correct
+* formatting and parsing for the locale. The results of this call are not
+* valid for rule-based number formats.
+* @param index The index of the desired locale.
+* @return A locale for which number formatting patterns are available, or 0 if none.
+* @see unum_countAvailable
+* @stable ICU 2.0
+*/
+U_STABLE const char* U_EXPORT2
+unum_getAvailable(int32_t index);
+
+/**
+* Determine how many locales have decimal formatting patterns available. The
+* results of this call are not valid for rule-based number formats.
+* This function is useful for determining the loop ending condition for
+* calls to {@link #unum_getAvailable }.
+* @return The number of locales for which decimal formatting patterns are available.
+* @see unum_getAvailable
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_countAvailable(void);
+
+/** The possible UNumberFormat numeric attributes @stable ICU 2.0 */
+typedef enum UNumberFormatAttribute {
+ /** Parse integers only */
+ UNUM_PARSE_INT_ONLY,
+ /** Use grouping separator */
+ UNUM_GROUPING_USED,
+ /** Always show decimal point */
+ UNUM_DECIMAL_ALWAYS_SHOWN,
+ /** Maximum integer digits */
+ UNUM_MAX_INTEGER_DIGITS,
+ /** Minimum integer digits */
+ UNUM_MIN_INTEGER_DIGITS,
+ /** Integer digits */
+ UNUM_INTEGER_DIGITS,
+ /** Maximum fraction digits */
+ UNUM_MAX_FRACTION_DIGITS,
+ /** Minimum fraction digits */
+ UNUM_MIN_FRACTION_DIGITS,
+ /** Fraction digits */
+ UNUM_FRACTION_DIGITS,
+ /** Multiplier */
+ UNUM_MULTIPLIER,
+ /** Grouping size */
+ UNUM_GROUPING_SIZE,
+ /** Rounding Mode */
+ UNUM_ROUNDING_MODE,
+ /** Rounding increment */
+ UNUM_ROUNDING_INCREMENT,
+ /** The width to which the output of <code>format()</code> is padded. */
+ UNUM_FORMAT_WIDTH,
+ /** The position at which padding will take place. */
+ UNUM_PADDING_POSITION,
+ /** Secondary grouping size */
+ UNUM_SECONDARY_GROUPING_SIZE,
+ /** Use significant digits
+ * @stable ICU 3.0 */
+ UNUM_SIGNIFICANT_DIGITS_USED,
+ /** Minimum significant digits
+ * @stable ICU 3.0 */
+ UNUM_MIN_SIGNIFICANT_DIGITS,
+ /** Maximum significant digits
+ * @stable ICU 3.0 */
+ UNUM_MAX_SIGNIFICANT_DIGITS,
+ /** Lenient parse mode used by rule-based formats.
+ * @stable ICU 3.0
+ */
+ UNUM_LENIENT_PARSE
+} UNumberFormatAttribute;
+
+/**
+* Get a numeric attribute associated with a UNumberFormat.
+* An example of a numeric attribute is the number of integer digits a formatter will produce.
+* @param fmt The formatter to query.
+* @param attr The attribute to query; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED,
+* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS,
+* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER,
+* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE.
+* @return The value of attr.
+* @see unum_setAttribute
+* @see unum_getDoubleAttribute
+* @see unum_setDoubleAttribute
+* @see unum_getTextAttribute
+* @see unum_setTextAttribute
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_getAttribute(const UNumberFormat* fmt,
+ UNumberFormatAttribute attr);
+
+/**
+* Set a numeric attribute associated with a UNumberFormat.
+* An example of a numeric attribute is the number of integer digits a formatter will produce. If the
+* formatter does not understand the attribute, the call is ignored. Rule-based formatters only understand
+* the lenient-parse attribute.
+* @param fmt The formatter to set.
+* @param attr The attribute to set; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED,
+* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS,
+* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER,
+* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE,
+* or UNUM_LENIENT_PARSE.
+* @param newValue The new value of attr.
+* @see unum_getAttribute
+* @see unum_getDoubleAttribute
+* @see unum_setDoubleAttribute
+* @see unum_getTextAttribute
+* @see unum_setTextAttribute
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+unum_setAttribute( UNumberFormat* fmt,
+ UNumberFormatAttribute attr,
+ int32_t newValue);
+
+
+/**
+* Get a numeric attribute associated with a UNumberFormat.
+* An example of a numeric attribute is the number of integer digits a formatter will produce.
+* If the formatter does not understand the attribute, -1 is returned.
+* @param fmt The formatter to query.
+* @param attr The attribute to query; e.g. UNUM_ROUNDING_INCREMENT.
+* @return The value of attr.
+* @see unum_getAttribute
+* @see unum_setAttribute
+* @see unum_setDoubleAttribute
+* @see unum_getTextAttribute
+* @see unum_setTextAttribute
+* @stable ICU 2.0
+*/
+U_STABLE double U_EXPORT2
+unum_getDoubleAttribute(const UNumberFormat* fmt,
+ UNumberFormatAttribute attr);
+
+/**
+* Set a numeric attribute associated with a UNumberFormat.
+* An example of a numeric attribute is the number of integer digits a formatter will produce.
+* If the formatter does not understand the attribute, this call is ignored.
+* @param fmt The formatter to set.
+* @param attr The attribute to set; e.g. UNUM_ROUNDING_INCREMENT.
+* @param newValue The new value of attr.
+* @see unum_getAttribute
+* @see unum_setAttribute
+* @see unum_getDoubleAttribute
+* @see unum_getTextAttribute
+* @see unum_setTextAttribute
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+unum_setDoubleAttribute( UNumberFormat* fmt,
+ UNumberFormatAttribute attr,
+ double newValue);
+
+/** The possible UNumberFormat text attributes @stable ICU 2.0*/
+typedef enum UNumberFormatTextAttribute {
+ /** Positive prefix */
+ UNUM_POSITIVE_PREFIX,
+ /** Positive suffix */
+ UNUM_POSITIVE_SUFFIX,
+ /** Negative prefix */
+ UNUM_NEGATIVE_PREFIX,
+ /** Negative suffix */
+ UNUM_NEGATIVE_SUFFIX,
+ /** The character used to pad to the format width. */
+ UNUM_PADDING_CHARACTER,
+ /** The ISO currency code */
+ UNUM_CURRENCY_CODE,
+ /**
+ * The default rule set. This is only available with rule-based formatters.
+ * @stable ICU 3.0
+ */
+ UNUM_DEFAULT_RULESET,
+ /**
+ * The public rule sets. This is only available with rule-based formatters.
+ * This is a read-only attribute. The public rulesets are returned as a
+ * single string, with each ruleset name delimited by ';' (semicolon).
+ * @stable ICU 3.0
+ */
+ UNUM_PUBLIC_RULESETS
+} UNumberFormatTextAttribute;
+
+/**
+* Get a text attribute associated with a UNumberFormat.
+* An example of a text attribute is the suffix for positive numbers. If the formatter
+* does not understand the attributre, U_UNSUPPORTED_ERROR is returned as the status.
+* Rule-based formatters only understand UNUM_DEFAULT_RULESET and UNUM_PUBLIC_RULESETS.
+* @param fmt The formatter to query.
+* @param tag The attribute to query; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX,
+* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE,
+* UNUM_DEFAULT_RULESET, or UNUM_PUBLIC_RULESETS.
+* @param result A pointer to a buffer to receive the attribute.
+* @param resultLength The maximum size of result.
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The total buffer size needed; if greater than resultLength, the output was truncated.
+* @see unum_setTextAttribute
+* @see unum_getAttribute
+* @see unum_setAttribute
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_getTextAttribute( const UNumberFormat* fmt,
+ UNumberFormatTextAttribute tag,
+ UChar* result,
+ int32_t resultLength,
+ UErrorCode* status);
+
+/**
+* Set a text attribute associated with a UNumberFormat.
+* An example of a text attribute is the suffix for positive numbers. Rule-based formatters
+* only understand UNUM_DEFAULT_RULESET.
+* @param fmt The formatter to set.
+* @param tag The attribute to set; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX,
+* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE,
+* or UNUM_DEFAULT_RULESET.
+* @param newValue The new value of attr.
+* @param newValueLength The length of newValue, or -1 if null-terminated.
+* @param status A pointer to an UErrorCode to receive any errors
+* @see unum_getTextAttribute
+* @see unum_getAttribute
+* @see unum_setAttribute
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+unum_setTextAttribute( UNumberFormat* fmt,
+ UNumberFormatTextAttribute tag,
+ const UChar* newValue,
+ int32_t newValueLength,
+ UErrorCode *status);
+
+/**
+ * Extract the pattern from a UNumberFormat. The pattern will follow
+ * the DecimalFormat pattern syntax.
+ * @param fmt The formatter to query.
+ * @param isPatternLocalized TRUE if the pattern should be localized,
+ * FALSE otherwise. This is ignored if the formatter is a rule-based
+ * formatter.
+ * @param result A pointer to a buffer to receive the pattern.
+ * @param resultLength The maximum size of result.
+ * @param status A pointer to an input-output UErrorCode.
+ * @return The total buffer size needed; if greater than resultLength,
+ * the output was truncated.
+ * @see unum_applyPattern
+ * @see DecimalFormat
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+unum_toPattern( const UNumberFormat* fmt,
+ UBool isPatternLocalized,
+ UChar* result,
+ int32_t resultLength,
+ UErrorCode* status);
+
+
+/**
+ * Constants for specifying a number format symbol.
+ * @stable ICU 2.0
+ */
+typedef enum UNumberFormatSymbol {
+ /** The decimal separator */
+ UNUM_DECIMAL_SEPARATOR_SYMBOL = 0,
+ /** The grouping separator */
+ UNUM_GROUPING_SEPARATOR_SYMBOL = 1,
+ /** The pattern separator */
+ UNUM_PATTERN_SEPARATOR_SYMBOL = 2,
+ /** The percent sign */
+ UNUM_PERCENT_SYMBOL = 3,
+ /** Zero*/
+ UNUM_ZERO_DIGIT_SYMBOL = 4,
+ /** Character representing a digit in the pattern */
+ UNUM_DIGIT_SYMBOL = 5,
+ /** The minus sign */
+ UNUM_MINUS_SIGN_SYMBOL = 6,
+ /** The plus sign */
+ UNUM_PLUS_SIGN_SYMBOL = 7,
+ /** The currency symbol */
+ UNUM_CURRENCY_SYMBOL = 8,
+ /** The international currency symbol */
+ UNUM_INTL_CURRENCY_SYMBOL = 9,
+ /** The monetary separator */
+ UNUM_MONETARY_SEPARATOR_SYMBOL = 10,
+ /** The exponential symbol */
+ UNUM_EXPONENTIAL_SYMBOL = 11,
+ /** Per mill symbol */
+ UNUM_PERMILL_SYMBOL = 12,
+ /** Escape padding character */
+ UNUM_PAD_ESCAPE_SYMBOL = 13,
+ /** Infinity symbol */
+ UNUM_INFINITY_SYMBOL = 14,
+ /** Nan symbol */
+ UNUM_NAN_SYMBOL = 15,
+ /** Significant digit symbol
+ * @stable ICU 3.0 */
+ UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16,
+ /** The monetary grouping separator
+ * @stable ICU 3.6
+ */
+ UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17,
+ /** count symbol constants */
+ UNUM_FORMAT_SYMBOL_COUNT = 18
+} UNumberFormatSymbol;
+
+/**
+* Get a symbol associated with a UNumberFormat.
+* A UNumberFormat uses symbols to represent the special locale-dependent
+* characters in a number, for example the percent sign. This API is not
+* supported for rule-based formatters.
+* @param fmt The formatter to query.
+* @param symbol The UNumberFormatSymbol constant for the symbol to get
+* @param buffer The string buffer that will receive the symbol string;
+* if it is NULL, then only the length of the symbol is returned
+* @param size The size of the string buffer
+* @param status A pointer to an UErrorCode to receive any errors
+* @return The length of the symbol; the buffer is not modified if
+* <code>length&gt;=size</code>
+* @see unum_setSymbol
+* @stable ICU 2.0
+*/
+U_STABLE int32_t U_EXPORT2
+unum_getSymbol(const UNumberFormat *fmt,
+ UNumberFormatSymbol symbol,
+ UChar *buffer,
+ int32_t size,
+ UErrorCode *status);
+
+/**
+* Set a symbol associated with a UNumberFormat.
+* A UNumberFormat uses symbols to represent the special locale-dependent
+* characters in a number, for example the percent sign. This API is not
+* supported for rule-based formatters.
+* @param fmt The formatter to set.
+* @param symbol The UNumberFormatSymbol constant for the symbol to set
+* @param value The string to set the symbol to
+* @param length The length of the string, or -1 for a zero-terminated string
+* @param status A pointer to an UErrorCode to receive any errors.
+* @see unum_getSymbol
+* @stable ICU 2.0
+*/
+U_STABLE void U_EXPORT2
+unum_setSymbol(UNumberFormat *fmt,
+ UNumberFormatSymbol symbol,
+ const UChar *value,
+ int32_t length,
+ UErrorCode *status);
+
+
+/**
+ * Get the locale for this number format object.
+ * You can choose between valid and actual locale.
+ * @param fmt The formatter to get the locale from
+ * @param type type of the locale we're looking for (valid or actual)
+ * @param status error code for the operation
+ * @return the locale name
+ * @stable ICU 2.8
+ */
+U_STABLE const char* U_EXPORT2
+unum_getLocaleByType(const UNumberFormat *fmt,
+ ULocDataLocaleType type,
+ UErrorCode* status);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/uregex.h b/Build/source/libs/icu-xetex/i18n/unicode/uregex.h
new file mode 100644
index 00000000000..862cf344641
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/uregex.h
@@ -0,0 +1,631 @@
+/*
+**********************************************************************
+* Copyright (C) 2004-2006, International Business Machines
+* Corporation and others. All Rights Reserved.
+**********************************************************************
+* file name: regex.h
+* encoding: US-ASCII
+* indentation:4
+*
+* created on: 2004mar09
+* created by: Andy Heninger
+*
+* ICU Regular Expressions, API for C
+*/
+
+/**
+ * \file
+ * \brief C API: Regular Expressions
+ *
+ * <p>This is a C wrapper around the C++ RegexPattern and RegexMatcher classes.</p>
+ */
+
+#ifndef UREGEX_H
+#define UREGEX_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_REGULAR_EXPRESSIONS
+
+#include "unicode/parseerr.h"
+
+struct URegularExpression;
+/**
+ * Structure represeting a compiled regular rexpression, plus the results
+ * of a match operation.
+ * @stable ICU 3.0
+ */
+typedef struct URegularExpression URegularExpression;
+
+
+/**
+ * Constants for Regular Expression Match Modes.
+ * @stable ICU 2.4
+ */
+typedef enum URegexpFlag{
+
+#ifndef U_HIDE_DRAFT_API
+ /** Forces normalization of pattern and strings.
+ Not implemented yet, just a placeholder, hence draft.
+ @draft ICU 2.4 */
+ UREGEX_CANON_EQ = 128,
+#endif
+ /** Enable case insensitive matching. @stable ICU 2.4 */
+ UREGEX_CASE_INSENSITIVE = 2,
+
+ /** Allow white space and comments within patterns @stable ICU 2.4 */
+ UREGEX_COMMENTS = 4,
+
+ /** If set, '.' matches line terminators, otherwise '.' matching stops at line end.
+ * @stable ICU 2.4 */
+ UREGEX_DOTALL = 32,
+
+ /** Control behavior of "$" and "^"
+ * If set, recognize line terminators within string,
+ * otherwise, match only at start and end of input string.
+ * @stable ICU 2.4 */
+ UREGEX_MULTILINE = 8,
+
+ /** Unicode word boundaries.
+ * If set, \b uses the Unicode TR 29 definition of word boundaries.
+ * Warning: Unicode word boundaries are quite different from
+ * traditional regular expression word boundaries. See
+ * http://unicode.org/reports/tr29/#Word_Boundaries
+ * @stable ICU 2.8
+ */
+ UREGEX_UWORD = 256
+} URegexpFlag;
+
+/**
+ * Open (compile) an ICU regular expression. Compiles the regular expression in
+ * string form into an internal representation using the specified match mode flags.
+ * The resulting regular expression handle can then be used to perform various
+ * matching operations.
+ *
+ * @param pattern The Regular Expression pattern to be compiled.
+ * @param patternLength The length of the pattern, or -1 if the pattern is
+ * NUL termintated.
+ * @param flags Flags that alter the default matching behavior for
+ * the regular expression, UREGEX_CASE_INSENSITIVE, for
+ * example. For default behavior, set this parameter to zero.
+ * See <code>enum URegexpFlag</code>. All desired flags
+ * are bitwise-ORed together.
+ * @param pe Receives the position (line and column nubers) of any syntax
+ * error within the source regular expression string. If this
+ * information is not wanted, pass NULL for this parameter.
+ * @param status Receives error detected by this function.
+ * @stable ICU 3.0
+ *
+ */
+U_STABLE URegularExpression * U_EXPORT2
+uregex_open( const UChar *pattern,
+ int32_t patternLength,
+ uint32_t flags,
+ UParseError *pe,
+ UErrorCode *status);
+
+/**
+ * Open (compile) an ICU regular expression. The resulting regular expression
+ * handle can then be used to perform various matching operations.
+ * <p>
+ * This function is the same as uregex_open, except that the pattern
+ * is supplied as an 8 bit char * string in the default code page.
+ *
+ * @param pattern The Regular Expression pattern to be compiled,
+ * NUL termintated.
+ * @param flags Flags that alter the default matching behavior for
+ * the regular expression, UREGEX_CASE_INSENSITIVE, for
+ * example. For default behavior, set this parameter to zero.
+ * See <code>enum URegexpFlag</code>. All desired flags
+ * are bitwise-ORed together.
+ * @param pe Receives the position (line and column nubers) of any syntax
+ * error within the source regular expression string. If this
+ * information is not wanted, pass NULL for this parameter.
+ * @param status Receives errors detected by this function.
+ * @return The URegularExpression object representing the compiled
+ * pattern.
+ *
+ * @stable ICU 3.0
+ */
+#if !UCONFIG_NO_CONVERSION
+U_STABLE URegularExpression * U_EXPORT2
+uregex_openC( const char *pattern,
+ uint32_t flags,
+ UParseError *pe,
+ UErrorCode *status);
+#endif
+
+
+
+/**
+ * Close the regular expression, recovering all resources (memory) it
+ * was holding.
+ *
+ * @param regexp The regular expression to be closed.
+ * @stable ICU 3.0
+ */
+U_STABLE void U_EXPORT2
+uregex_close(URegularExpression *regexp);
+
+/**
+ * Make a copy of a compiled regular expression. Cloning a regular
+ * expression is faster than opening a second instance from the source
+ * form of the expression, and requires less memory.
+ * <p>
+ * Note that the current input string and the position of any matched text
+ * within it are not cloned; only the pattern itself and and the
+ * match mode flags are copied.
+ * <p>
+ * Cloning can be particularly useful to threaded applications that perform
+ * multiple match operations in parallel. Each concurrent RE
+ * operation requires its own instance of a URegularExpression.
+ *
+ * @param regexp The compiled regular expression to be cloned.
+ * @param status Receives indication of any errors encountered
+ * @return the cloned copy of the compiled regular expression.
+ * @stable ICU 3.0
+ */
+U_STABLE URegularExpression * U_EXPORT2
+uregex_clone(const URegularExpression *regexp, UErrorCode *status);
+
+/**
+ * Return a pointer to the source form of the pattern for this regular expression.
+ *
+ * @param regexp The compiled regular expression.
+ * @param patLength This output parameter will be set to the length of the
+ * pattern string. A NULL pointer may be used here if the
+ * pattern length is not needed, as would be the case if
+ * the pattern is known in advance to be a NUL terminated
+ * string.
+ * @param status Receives errors detected by this function.
+ * @return a pointer to the pattern string. The storage for the string is
+ * owned by the regular expression object, and must not be
+ * altered or deleted by the application. The returned string
+ * will remain valid until the regular expression is closed.
+ * @stable ICU 3.0
+ */
+U_STABLE const UChar * U_EXPORT2
+uregex_pattern(const URegularExpression *regexp,
+ int32_t *patLength,
+ UErrorCode *status);
+
+
+/**
+ * Get the match mode flags that were specified when compiling this regular expression.
+ * @param status Receives errors detected by this function.
+ * @param regexp The compiled regular expression.
+ * @return The match mode flags
+ * @see URegexpFlag
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_flags(const URegularExpression *regexp,
+ UErrorCode *status);
+
+
+/**
+ * Set the subject text string upon which the regular expression will look for matches.
+ * This function may be called any number of times, allowing the regular
+ * expression pattern to be applied to different strings.
+ * <p>
+ * Regular expression matching operations work directly on the application's
+ * string data. No copy is made. The subject string data must not be
+ * altered after calling this function until after all regular expression
+ * operations involving this string data are completed.
+ * <p>
+ * Zero length strings are permitted. In this case, no subsequent match
+ * operation will dereference the text string pointer.
+ *
+ * @param regexp The compiled regular expression.
+ * @param text The subject text string.
+ * @param textLength The length of the subject text, or -1 if the string
+ * is NUL terminated.
+ * @param status Receives errors detected by this function.
+ * @stable ICU 3.0
+ */
+U_STABLE void U_EXPORT2
+uregex_setText(URegularExpression *regexp,
+ const UChar *text,
+ int32_t textLength,
+ UErrorCode *status);
+
+/**
+ * Get the subject text that is currently associated with this
+ * regular expression object. This simply returns whatever string
+ * pointer was previously supplied via uregex_setText().
+ *
+ * @param regexp The compiled regular expression.
+ * @param textLength The length of the string is returned in this output parameter.
+ * A NULL pointer may be used here if the
+ * text length is not needed, as would be the case if
+ * the text is known in advance to be a NUL terminated
+ * string.
+ * @param status Receives errors detected by this function.
+ * @return Poiner to the subject text string currently associated with
+ * this regular expression.
+ * @stable ICU 3.0
+ */
+U_STABLE const UChar * U_EXPORT2
+uregex_getText(URegularExpression *regexp,
+ int32_t *textLength,
+ UErrorCode *status);
+
+/**
+ * Attempts to match the input string, beginning at startIndex, against the pattern.
+ * To succeed, the match must extend to the end of the input string.
+ *
+ * @param regexp The compiled regular expression.
+ * @param startIndex The input string index at which to begin matching.
+ * @param status Receives errors detected by this function.
+ * @return TRUE if there is a match
+ * @stable ICU 3.0
+ */
+U_STABLE UBool U_EXPORT2
+uregex_matches(URegularExpression *regexp,
+ int32_t startIndex,
+ UErrorCode *status);
+
+/**
+ * Attempts to match the input string, starting from the specified index, against the pattern.
+ * The match may be of any length, and is not required to extend to the end
+ * of the input string. Contrast with uregex_matches().
+ *
+ * <p>If the match succeeds then more information can be obtained via the
+ * <code>uregexp_start()</code>, <code>uregexp_end()</code>,
+ * and <code>uregexp_group()</code> functions.</p>
+ *
+ * @param regexp The compiled regular expression.
+ * @param startIndex The input string index at which to begin matching.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if there is a match.
+ * @stable ICU 3.0
+ */
+U_STABLE UBool U_EXPORT2
+uregex_lookingAt(URegularExpression *regexp,
+ int32_t startIndex,
+ UErrorCode *status);
+
+/**
+ * Find the first matching substring of the input string that matches the pattern.
+ * The search for a match begins at the specified index.
+ * If a match is found, <code>uregex_start(), uregex_end()</code>, and
+ * <code>uregex_group()</code> will provide more information regarding the match.
+ *
+ * @param regexp The compiled regular expression.
+ * @param startIndex The position in the input string to begin the search
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if a match is found.
+ * @stable ICU 3.0
+ */
+U_STABLE UBool U_EXPORT2
+uregex_find(URegularExpression *regexp,
+ int32_t startIndex,
+ UErrorCode *status);
+
+/**
+ * Find the next pattern match in the input string.
+ * Begin searching the input at the location following the end of
+ * the previous match, or at the start of the string if there is no previous match.
+ * If a match is found, <code>uregex_start(), uregex_end()</code>, and
+ * <code>uregex_group()</code> will provide more information regarding the match.
+ *
+ * @param regexp The compiled regular expression.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return TRUE if a match is found.
+ * @see uregex_reset
+ * @stable ICU 3.0
+ */
+U_STABLE UBool U_EXPORT2
+uregex_findNext(URegularExpression *regexp,
+ UErrorCode *status);
+
+/**
+ * Get the number of capturing groups in this regular expression's pattern.
+ * @param regexp The compiled regular expression.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return the number of capture groups
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_groupCount(URegularExpression *regexp,
+ UErrorCode *status);
+
+/** Extract the string for the specified matching expression or subexpression.
+ * Group #0 is the complete string of matched text.
+ * Group #1 is the text matched by the first set of capturing parentheses.
+ *
+ * @param regexp The compiled regular expression.
+ * @param groupNum The capture group to extract. Group 0 is the complete
+ * match. The value of this parameter must be
+ * less than or equal to the number of capture groups in
+ * the pattern.
+ * @param dest Buffer to receive the matching string data
+ * @param destCapacity Capacity of the dest buffer.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return Length of matching data,
+ * or -1 if no applicable match.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_group(URegularExpression *regexp,
+ int32_t groupNum,
+ UChar *dest,
+ int32_t destCapacity,
+ UErrorCode *status);
+
+
+/**
+ * Returns the index in the input string of the start of the text matched by the
+ * specified capture group during the previous match operation. Return -1 if
+ * the capture group was not part of the last match.
+ * Group #0 refers to the complete range of matched text.
+ * Group #1 refers to the text matched by the first set of capturing parentheses.
+ *
+ * @param regexp The compiled regular expression.
+ * @param groupNum The capture group number
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return the starting position in the input of the text matched
+ * by the specified group.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_start(URegularExpression *regexp,
+ int32_t groupNum,
+ UErrorCode *status);
+
+/**
+ * Returns the index in the input string of the position following the end
+ * of the text matched by the specified capture group.
+ * Return -1 if the capture group was not part of the last match.
+ * Group #0 refers to the complete range of matched text.
+ * Group #1 refers to the text matched by the first set of capturing parentheses.
+ *
+ * @param regexp The compiled regular expression.
+ * @param groupNum The capture group number
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return the index of the position following the last matched character.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_end(URegularExpression *regexp,
+ int32_t groupNum,
+ UErrorCode *status);
+
+/**
+ * Reset any saved state from the previous match. Has the effect of
+ * causing uregex_findNext to begin at the specified index, and causing
+ * uregex_start(), uregex_end() and uregex_group() to return an error
+ * indicating that there is no match information available.
+ *
+ * @param regexp The compiled regular expression.
+ * @param index The position in the text at which a
+ * uregex_findNext() should begin searching.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @stable ICU 3.0
+ */
+U_STABLE void U_EXPORT2
+uregex_reset(URegularExpression *regexp,
+ int32_t index,
+ UErrorCode *status);
+
+/**
+ * Replaces every substring of the input that matches the pattern
+ * with the given replacement string. This is a convenience function that
+ * provides a complete find-and-replace-all operation.
+ *
+ * This method scans the input string looking for matches of the pattern.
+ * Input that is not part of any match is copied unchanged to the
+ * destination buffer. Matched regions are replaced in the output
+ * buffer by the replacement string. The replacement string may contain
+ * references to capture groups; these take the form of $1, $2, etc.
+ *
+ * @param regexp The compiled regular expression.
+ * @param replacementText A string containing the replacement text.
+ * @param replacementLength The length of the replacement string, or
+ * -1 if it is NUL terminated.
+ * @param destBuf A (UChar *) buffer that will receive the result.
+ * @param destCapacity The capacity of the desitnation buffer.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The length of the string resulting from the find
+ * and replace operation. In the event that the
+ * destination capacity is inadequate, the return value
+ * is still the full length of the untruncated string.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_replaceAll(URegularExpression *regexp,
+ const UChar *replacementText,
+ int32_t replacementLength,
+ UChar *destBuf,
+ int32_t destCapacity,
+ UErrorCode *status);
+
+
+/**
+ * Replaces the first substring of the input that matches the pattern
+ * with the given replacement string. This is a convenience function that
+ * provides a complete find-and-replace operation.
+ *
+ * This method scans the input string looking for a match of the pattern.
+ * All input that is not part of the match is copied unchanged to the
+ * destination buffer. The matched region is replaced in the output
+ * buffer by the replacement string. The replacement string may contain
+ * references to capture groups; these take the form of $1, $2, etc.
+ *
+ * @param regexp The compiled regular expression.
+ * @param replacementText A string containing the replacement text.
+ * @param replacementLength The length of the replacement string, or
+ * -1 if it is NUL terminated.
+ * @param destBuf A (UChar *) buffer that will receive the result.
+ * @param destCapacity The capacity of the desitnation buffer.
+ * @param status a reference to a UErrorCode to receive any errors.
+ * @return The length of the string resulting from the find
+ * and replace operation. In the event that the
+ * destination capacity is inadequate, the return value
+ * is still the full length of the untruncated string.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_replaceFirst(URegularExpression *regexp,
+ const UChar *replacementText,
+ int32_t replacementLength,
+ UChar *destBuf,
+ int32_t destCapacity,
+ UErrorCode *status);
+
+
+/**
+ * Implements a replace operation intended to be used as part of an
+ * incremental find-and-replace.
+ *
+ * <p>The input string, starting from the end of the previous match and ending at
+ * the start of the current match, is appended to the destination string. Then the
+ * replacement string is appended to the output string,
+ * including handling any substitutions of captured text.</p>
+ *
+ * <p>A note on preflight computation of buffersize and error handling:
+ * Calls to uregex_appendReplacement() and uregex_appendTail() are
+ * designed to be chained, one after another, with the destination
+ * buffer pointer and buffer capacity updated after each in preparation
+ * to for the next. If the destination buffer is exhausted partway through such a
+ * sequence, a U_BUFFER_OVERFLOW_ERROR status will be returned. Normal
+ * ICU conventions are for a function to perform no action if it is
+ * called with an error status, but for this one case, uregex_appendRepacement()
+ * will operate normally so that buffer size computations will complete
+ * correctly.
+ *
+ * <p>For simple, prepackaged, non-incremental find-and-replace
+ * operations, see replaceFirst() or replaceAll().</p>
+ *
+ * @param regexp The regular expression object.
+ * @param replacementText The string that will replace the matched portion of the
+ * input string as it is copied to the destination buffer.
+ * The replacement text may contain references ($1, for
+ * example) to capture groups from the match.
+ * @param replacementLength The length of the replacement text string,
+ * or -1 if the string is NUL terminated.
+ * @param destBuf The buffer into which the results of the
+ * find-and-replace are placed. On return, this pointer
+ * will be updated to refer to the beginning of the
+ * unused portion of buffer, leaving it in position for
+ * a subsequent call to this function.
+ * @param destCapacity The size of the output buffer, On return, this
+ * parameter will be updated to reflect the space remaining
+ * unused in the output buffer.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The length of the result string. In the event that
+ * destCapacity is inadequate, the full length of the
+ * untruncated output string is returned.
+ *
+ * @stable ICU 3.0
+ *
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_appendReplacement(URegularExpression *regexp,
+ const UChar *replacementText,
+ int32_t replacementLength,
+ UChar **destBuf,
+ int32_t *destCapacity,
+ UErrorCode *status);
+
+
+/**
+ * As the final step in a find-and-replace operation, append the remainder
+ * of the input string, starting at the position following the last match,
+ * to the destination string. <code>uregex_appendTail()</code> is intended
+ * to be invoked after one or more invocations of the
+ * <code>uregex_appendReplacement()</code> function.
+ *
+ * @param regexp The regular expression object. This is needed to
+ * obtain the input string and with the position
+ * of the last match within it.
+ * @param destBuf The buffer in which the results of the
+ * find-and-replace are placed. On return, the pointer
+ * will be updated to refer to the beginning of the
+ * unused portion of buffer.
+ * @param destCapacity The size of the output buffer, On return, this
+ * value will be updated to reflect the space remaining
+ * unused in the output buffer.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The length of the result string. In the event that
+ * destCapacity is inadequate, the full length of the
+ * untruncated output string is returned.
+ *
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_appendTail(URegularExpression *regexp,
+ UChar **destBuf,
+ int32_t *destCapacity,
+ UErrorCode *status);
+
+
+
+
+ /**
+ * Split a string into fields. Somewhat like split() from Perl.
+ * The pattern matches identify delimiters that separate the input
+ * into fields. The input data between the matches becomes the
+ * fields themselves.
+ * <p>
+ * Each of the fields is copied from the input string to the destination
+ * buffer, and the NUL terminated. The position of each field within
+ * the destination buffer is returned in the destFields array.
+ *
+ * Note: another choice for the design of this function would be to not
+ * copy the resulting fields at all, but to return indexes and
+ * lengths within the source text.
+ * Advantages would be
+ * o Faster. No Copying.
+ * o Nothing extra needed when field data may contain embedded NUL chars.
+ * o Less memory needed if working on large data.
+ * Disadvantages
+ * o Less consistent with C++ split, which copies into an
+ * array of UnicodeStrings.
+ * o No NUL termination, extracted fields would be less convenient
+ * to use in most cases.
+ * o Possible problems in the future, when support Unicode Normalization
+ * could cause the fields to not correspond exactly to
+ * a range of the source text.
+ *
+ * @param regexp The compiled regular expression.
+ * @param destBuf A (UChar *) buffer to receive the fields that
+ * are extracted from the input string. These
+ * field pointers will refer to positions within the
+ * destination buffer supplied by the caller. Any
+ * extra positions within the destFields array will be
+ * set to NULL.
+ * @param destCapacity The capacity of the destBuf.
+ * @param requiredCapacity The actual capacity required of the destBuf.
+ * If destCapacity is too small, requiredCapacity will return
+ * the total capacity required to hold all of the output, and
+ * a U_BUFFER_OVERFLOW_ERROR will be returned.
+ * @param destFields An array to be filled with the position of each
+ * of the extracted fields within destBuf.
+ * @param destFieldsCapacity The number of elements in the destFields array.
+ * If the number of fields found is less than destFieldsCapacity,
+ * the extra destFields elements are set to zero.
+ * If destFieldsCapacity is too small, the trailing part of the
+ * input, including any field delimiters, is treated as if it
+ * were the last field - it is copied to the destBuf, and
+ * its position is in the destBuf is stored in the last element
+ * of destFields. This behavior mimics that of Perl. It is not
+ * an error condition, and no error status is returned when all destField
+ * positions are used.
+ * @param status A reference to a UErrorCode to receive any errors.
+ * @return The number of fields into which the input string was split.
+ * @stable ICU 3.0
+ */
+U_STABLE int32_t U_EXPORT2
+uregex_split( URegularExpression *regexp,
+ UChar *destBuf,
+ int32_t destCapacity,
+ int32_t *requiredCapacity,
+ UChar *destFields[],
+ int32_t destFieldsCapacity,
+ UErrorCode *status);
+
+
+
+#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
+#endif /* UREGEX_H */
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/usearch.h b/Build/source/libs/icu-xetex/i18n/unicode/usearch.h
new file mode 100644
index 00000000000..0de1abb9e1a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/usearch.h
@@ -0,0 +1,646 @@
+/*
+**********************************************************************
+* Copyright (C) 2001-2007 IBM and others. All rights reserved.
+**********************************************************************
+* Date Name Description
+* 06/28/2001 synwee Creation.
+**********************************************************************
+*/
+#ifndef USEARCH_H
+#define USEARCH_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_COLLATION
+
+#include "unicode/ucol.h"
+#include "unicode/ucoleitr.h"
+#include "unicode/ubrk.h"
+
+/**
+ * \file
+ * \brief C API: StringSearch
+ *
+ * C Apis for an engine that provides language-sensitive text searching based
+ * on the comparison rules defined in a <tt>UCollator</tt> data struct,
+ * see <tt>ucol.h</tt>. This ensures that language eccentricity can be
+ * handled, e.g. for the German collator, characters &szlig; and SS will be matched
+ * if case is chosen to be ignored.
+ * See the <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm">
+ * "ICU Collation Design Document"</a> for more information.
+ * <p>
+ * The algorithm implemented is a modified form of the Boyer Moore's search.
+ * For more information see
+ * <a href="http://icu-project.org/docs/papers/efficient_text_searching_in_java.html">
+ * "Efficient Text Searching in Java"</a>, published in <i>Java Report</i>
+ * in February, 1999, for further information on the algorithm.
+ * <p>
+ * There are 2 match options for selection:<br>
+ * Let S' be the sub-string of a text string S between the offsets start and
+ * end <start, end>.
+ * <br>
+ * A pattern string P matches a text string S at the offsets <start, end>
+ * if
+ * <pre>
+ * option 1. Some canonical equivalent of P matches some canonical equivalent
+ * of S'
+ * option 2. P matches S' and if P starts or ends with a combining mark,
+ * there exists no non-ignorable combining mark before or after S'
+ * in S respectively.
+ * </pre>
+ * Option 2. will be the default.
+ * <p>
+ * This search has APIs similar to that of other text iteration mechanisms
+ * such as the break iterators in <tt>ubrk.h</tt>. Using these
+ * APIs, it is easy to scan through text looking for all occurances of
+ * a given pattern. This search iterator allows changing of direction by
+ * calling a <tt>reset</tt> followed by a <tt>next</tt> or <tt>previous</tt>.
+ * Though a direction change can occur without calling <tt>reset</tt> first,
+ * this operation comes with some speed penalty.
+ * Generally, match results in the forward direction will match the result
+ * matches in the backwards direction in the reverse order
+ * <p>
+ * <tt>usearch.h</tt> provides APIs to specify the starting position
+ * within the text string to be searched, e.g. <tt>usearch_setOffset</tt>,
+ * <tt>usearch_preceding</tt> and <tt>usearch_following</tt>. Since the
+ * starting position will be set as it is specified, please take note that
+ * there are some dangerous positions which the search may render incorrect
+ * results:
+ * <ul>
+ * <li> The midst of a substring that requires normalization.
+ * <li> If the following match is to be found, the position should not be the
+ * second character which requires to be swapped with the preceding
+ * character. Vice versa, if the preceding match is to be found,
+ * position to search from should not be the first character which
+ * requires to be swapped with the next character. E.g certain Thai and
+ * Lao characters require swapping.
+ * <li> If a following pattern match is to be found, any position within a
+ * contracting sequence except the first will fail. Vice versa if a
+ * preceding pattern match is to be found, a invalid starting point
+ * would be any character within a contracting sequence except the last.
+ * </ul>
+ * <p>
+ * A breakiterator can be used if only matches at logical breaks are desired.
+ * Using a breakiterator will only give you results that exactly matches the
+ * boundaries given by the breakiterator. For instance the pattern "e" will
+ * not be found in the string "\u00e9" if a character break iterator is used.
+ * <p>
+ * Options are provided to handle overlapping matches.
+ * E.g. In English, overlapping matches produces the result 0 and 2
+ * for the pattern "abab" in the text "ababab", where else mutually
+ * exclusive matches only produce the result of 0.
+ * <p>
+ * Though collator attributes will be taken into consideration while
+ * performing matches, there are no APIs here for setting and getting the
+ * attributes. These attributes can be set by getting the collator
+ * from <tt>usearch_getCollator</tt> and using the APIs in <tt>ucol.h</tt>.
+ * Lastly to update String Search to the new collator attributes,
+ * usearch_reset() has to be called.
+ * <p>
+ * Restriction: <br>
+ * Currently there are no composite characters that consists of a
+ * character with combining class > 0 before a character with combining
+ * class == 0. However, if such a character exists in the future, the
+ * search mechanism does not guarantee the results for option 1.
+ *
+ * <p>
+ * Example of use:<br>
+ * <pre><code>
+ * char *tgtstr = "The quick brown fox jumped over the lazy fox";
+ * char *patstr = "fox";
+ * UChar target[64];
+ * UChar pattern[16];
+ * UErrorCode status = U_ZERO_ERROR;
+ * u_uastrcpy(target, tgtstr);
+ * u_uastrcpy(pattern, patstr);
+ *
+ * UStringSearch *search = usearch_open(pattern, -1, target, -1, "en_US",
+ * NULL, &status);
+ * if (U_SUCCESS(status)) {
+ * for (int pos = usearch_first(search, &status);
+ * pos != USEARCH_DONE;
+ * pos = usearch_next(search, &status))
+ * {
+ * printf("Found match at %d pos, length is %d\n", pos,
+ * usearch_getMatchLength(search));
+ * }
+ * }
+ *
+ * usearch_close(search);
+ * </code></pre>
+ * @stable ICU 2.4
+ */
+
+/**
+* DONE is returned by previous() and next() after all valid matches have
+* been returned, and by first() and last() if there are no matches at all.
+* @stable ICU 2.4
+*/
+#define USEARCH_DONE -1
+
+/**
+* Data structure for searching
+* @stable ICU 2.4
+*/
+struct UStringSearch;
+/**
+* Data structure for searching
+* @stable ICU 2.4
+*/
+typedef struct UStringSearch UStringSearch;
+
+/**
+* @stable ICU 2.4
+*/
+typedef enum {
+ /** Option for overlapping matches */
+ USEARCH_OVERLAP,
+ /**
+ Option for canonical matches. option 1 in header documentation.
+ The default value will be USEARCH_OFF
+ */
+ USEARCH_CANONICAL_MATCH,
+ USEARCH_ATTRIBUTE_COUNT
+} USearchAttribute;
+
+/**
+* @stable ICU 2.4
+*/
+typedef enum {
+ /** default value for any USearchAttribute */
+ USEARCH_DEFAULT = -1,
+ /** value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
+ USEARCH_OFF,
+ /** value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
+ USEARCH_ON,
+ USEARCH_ATTRIBUTE_VALUE_COUNT
+} USearchAttributeValue;
+
+/* open and close ------------------------------------------------------ */
+
+/**
+* Creating a search iterator data struct using the argument locale language
+* rule set. A collator will be created in the process, which will be owned by
+* this search and will be deleted in <tt>usearch_close</tt>.
+* @param pattern for matching
+* @param patternlength length of the pattern, -1 for null-termination
+* @param text text string
+* @param textlength length of the text string, -1 for null-termination
+* @param locale name of locale for the rules to be used
+* @param breakiter A BreakIterator that will be used to restrict the points
+* at which matches are detected. If a match is found, but
+* the match's start or end index is not a boundary as
+* determined by the <tt>BreakIterator</tt>, the match will
+* be rejected and another will be searched for.
+* If this parameter is <tt>NULL</tt>, no break detection is
+* attempted.
+* @param status for errors if it occurs. If pattern or text is NULL, or if
+* patternlength or textlength is 0 then an
+* U_ILLEGAL_ARGUMENT_ERROR is returned.
+* @return search iterator data structure, or NULL if there is an error.
+* @stable ICU 2.4
+*/
+U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern,
+ int32_t patternlength,
+ const UChar *text,
+ int32_t textlength,
+ const char *locale,
+ UBreakIterator *breakiter,
+ UErrorCode *status);
+
+/**
+* Creating a search iterator data struct using the argument collator language
+* rule set. Note, user retains the ownership of this collator, thus the
+* responsibility of deletion lies with the user.
+* NOTE: string search cannot be instantiated from a collator that has
+* collate digits as numbers (CODAN) turned on.
+* @param pattern for matching
+* @param patternlength length of the pattern, -1 for null-termination
+* @param text text string
+* @param textlength length of the text string, -1 for null-termination
+* @param collator used for the language rules
+* @param breakiter A BreakIterator that will be used to restrict the points
+* at which matches are detected. If a match is found, but
+* the match's start or end index is not a boundary as
+* determined by the <tt>BreakIterator</tt>, the match will
+* be rejected and another will be searched for.
+* If this parameter is <tt>NULL</tt>, no break detection is
+* attempted.
+* @param status for errors if it occurs. If collator, pattern or text is NULL,
+* or if patternlength or textlength is 0 then an
+* U_ILLEGAL_ARGUMENT_ERROR is returned.
+* @return search iterator data structure, or NULL if there is an error.
+* @stable ICU 2.4
+*/
+U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
+ const UChar *pattern,
+ int32_t patternlength,
+ const UChar *text,
+ int32_t textlength,
+ const UCollator *collator,
+ UBreakIterator *breakiter,
+ UErrorCode *status);
+
+/**
+* Destroying and cleaning up the search iterator data struct.
+* If a collator is created in <tt>usearch_open</tt>, it will be destroyed here.
+* @param searchiter data struct to clean up
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
+
+/* get and set methods -------------------------------------------------- */
+
+/**
+* Sets the current position in the text string which the next search will
+* start from. Clears previous states.
+* This method takes the argument index and sets the position in the text
+* string accordingly without checking if the index is pointing to a
+* valid starting point to begin searching.
+* Search positions that may render incorrect results are highlighted in the
+* header comments
+* @param strsrch search iterator data struct
+* @param position position to start next search from. If position is less
+* than or greater than the text range for searching,
+* an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+* @param status error status if any.
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch,
+ int32_t position,
+ UErrorCode *status);
+
+/**
+* Return the current index in the string text being searched.
+* If the iteration has gone past the end of the text (or past the beginning
+* for a backwards search), <tt>USEARCH_DONE</tt> is returned.
+* @param strsrch search iterator data struct
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch);
+
+/**
+* Sets the text searching attributes located in the enum USearchAttribute
+* with values from the enum USearchAttributeValue.
+* <tt>USEARCH_DEFAULT</tt> can be used for all attributes for resetting.
+* @param strsrch search iterator data struct
+* @param attribute text attribute to be set
+* @param value text attribute value
+* @param status for errors if it occurs
+* @see #usearch_getAttribute
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch,
+ USearchAttribute attribute,
+ USearchAttributeValue value,
+ UErrorCode *status);
+
+/**
+* Gets the text searching attributes.
+* @param strsrch search iterator data struct
+* @param attribute text attribute to be retrieve
+* @return text attribute value
+* @see #usearch_setAttribute
+* @stable ICU 2.4
+*/
+U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute(
+ const UStringSearch *strsrch,
+ USearchAttribute attribute);
+
+/**
+* Returns the index to the match in the text string that was searched.
+* This call returns a valid result only after a successful call to
+* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>,
+* or <tt>usearch_last</tt>.
+* Just after construction, or after a searching method returns
+* <tt>USEARCH_DONE</tt>, this method will return <tt>USEARCH_DONE</tt>.
+* <p>
+* Use <tt>usearch_getMatchedLength</tt> to get the matched string length.
+* @param strsrch search iterator data struct
+* @return index to a substring within the text string that is being
+* searched.
+* @see #usearch_first
+* @see #usearch_next
+* @see #usearch_previous
+* @see #usearch_last
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart(
+ const UStringSearch *strsrch);
+
+/**
+* Returns the length of text in the string which matches the search pattern.
+* This call returns a valid result only after a successful call to
+* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>,
+* or <tt>usearch_last</tt>.
+* Just after construction, or after a searching method returns
+* <tt>USEARCH_DONE</tt>, this method will return 0.
+* @param strsrch search iterator data struct
+* @return The length of the match in the string text, or 0 if there is no
+* match currently.
+* @see #usearch_first
+* @see #usearch_next
+* @see #usearch_previous
+* @see #usearch_last
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength(
+ const UStringSearch *strsrch);
+
+/**
+* Returns the text that was matched by the most recent call to
+* <tt>usearch_first</tt>, <tt>usearch_next</tt>, <tt>usearch_previous</tt>,
+* or <tt>usearch_last</tt>.
+* If the iterator is not pointing at a valid match (e.g. just after
+* construction or after <tt>USEARCH_DONE</tt> has been returned, returns
+* an empty string. If result is not large enough to store the matched text,
+* result will be filled with the partial text and an U_BUFFER_OVERFLOW_ERROR
+* will be returned in status. result will be null-terminated whenever
+* possible. If the buffer fits the matched text exactly, a null-termination
+* is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status.
+* Pre-flighting can be either done with length = 0 or the API
+* <tt>usearch_getMatchLength</tt>.
+* @param strsrch search iterator data struct
+* @param result UChar buffer to store the matched string
+* @param resultCapacity length of the result buffer
+* @param status error returned if result is not large enough
+* @return exact length of the matched text, not counting the null-termination
+* @see #usearch_first
+* @see #usearch_next
+* @see #usearch_previous
+* @see #usearch_last
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch,
+ UChar *result,
+ int32_t resultCapacity,
+ UErrorCode *status);
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/**
+* Set the BreakIterator that will be used to restrict the points at which
+* matches are detected.
+* @param strsrch search iterator data struct
+* @param breakiter A BreakIterator that will be used to restrict the points
+* at which matches are detected. If a match is found, but
+* the match's start or end index is not a boundary as
+* determined by the <tt>BreakIterator</tt>, the match will
+* be rejected and another will be searched for.
+* If this parameter is <tt>NULL</tt>, no break detection is
+* attempted.
+* @param status for errors if it occurs
+* @see #usearch_getBreakIterator
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch,
+ UBreakIterator *breakiter,
+ UErrorCode *status);
+
+/**
+* Returns the BreakIterator that is used to restrict the points at which
+* matches are detected. This will be the same object that was passed to the
+* constructor or to <tt>usearch_setBreakIterator</tt>. Note that
+* <tt>NULL</tt>
+* is a legal value; it means that break detection should not be attempted.
+* @param strsrch search iterator data struct
+* @return break iterator used
+* @see #usearch_setBreakIterator
+* @stable ICU 2.4
+*/
+U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator(
+ const UStringSearch *strsrch);
+
+#endif
+
+/**
+* Set the string text to be searched. Text iteration will hence begin at the
+* start of the text string. This method is useful if you want to re-use an
+* iterator to search for the same pattern within a different body of text.
+* @param strsrch search iterator data struct
+* @param text new string to look for match
+* @param textlength length of the new string, -1 for null-termination
+* @param status for errors if it occurs. If text is NULL, or textlength is 0
+* then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change
+* done to strsrch.
+* @see #usearch_getText
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch,
+ const UChar *text,
+ int32_t textlength,
+ UErrorCode *status);
+
+/**
+* Return the string text to be searched.
+* @param strsrch search iterator data struct
+* @param length returned string text length
+* @return string text
+* @see #usearch_setText
+* @stable ICU 2.4
+*/
+U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch,
+ int32_t *length);
+
+/**
+* Gets the collator used for the language rules.
+* <p>
+* Deleting the returned <tt>UCollator</tt> before calling
+* <tt>usearch_close</tt> would cause the string search to fail.
+* <tt>usearch_close</tt> will delete the collator if this search owns it.
+* @param strsrch search iterator data struct
+* @return collator
+* @stable ICU 2.4
+*/
+U_STABLE UCollator * U_EXPORT2 usearch_getCollator(
+ const UStringSearch *strsrch);
+
+/**
+* Sets the collator used for the language rules. User retains the ownership
+* of this collator, thus the responsibility of deletion lies with the user.
+* This method causes internal data such as Boyer-Moore shift tables to
+* be recalculated, but the iterator's position is unchanged.
+* @param strsrch search iterator data struct
+* @param collator to be used
+* @param status for errors if it occurs
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
+ const UCollator *collator,
+ UErrorCode *status);
+
+/**
+* Sets the pattern used for matching.
+* Internal data like the Boyer Moore table will be recalculated, but the
+* iterator's position is unchanged.
+* @param strsrch search iterator data struct
+* @param pattern string
+* @param patternlength pattern length, -1 for null-terminated string
+* @param status for errors if it occurs. If text is NULL, or textlength is 0
+* then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change
+* done to strsrch.
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch,
+ const UChar *pattern,
+ int32_t patternlength,
+ UErrorCode *status);
+
+/**
+* Gets the search pattern
+* @param strsrch search iterator data struct
+* @param length return length of the pattern, -1 indicates that the pattern
+* is null-terminated
+* @return pattern string
+* @stable ICU 2.4
+*/
+U_STABLE const UChar * U_EXPORT2 usearch_getPattern(
+ const UStringSearch *strsrch,
+ int32_t *length);
+
+/* methods ------------------------------------------------------------- */
+
+/**
+* Returns the first index at which the string text matches the search
+* pattern.
+* The iterator is adjusted so that its current index (as returned by
+* <tt>usearch_getOffset</tt>) is the match position if one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>.
+* @param strsrch search iterator data struct
+* @param status for errors if it occurs
+* @return The character index of the first match, or
+* <tt>USEARCH_DONE</tt> if there are no matches.
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch,
+ UErrorCode *status);
+
+/**
+* Returns the first index greater than <tt>position</tt> at which the string
+* text
+* matches the search pattern. The iterator is adjusted so that its current
+* index (as returned by <tt>usearch_getOffset</tt>) is the match position if
+* one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
+* <p>
+* Search positions that may render incorrect results are highlighted in the
+* header comments. If position is less than or greater than the text range
+* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+* @param strsrch search iterator data struct
+* @param position to start the search at
+* @param status for errors if it occurs
+* @return The character index of the first match following <tt>pos</tt>,
+* or <tt>USEARCH_DONE</tt> if there are no matches.
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch,
+ int32_t position,
+ UErrorCode *status);
+
+/**
+* Returns the last index in the target text at which it matches the search
+* pattern. The iterator is adjusted so that its current
+* index (as returned by <tt>usearch_getOffset</tt>) is the match position if
+* one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>.
+* @param strsrch search iterator data struct
+* @param status for errors if it occurs
+* @return The index of the first match, or <tt>USEARCH_DONE</tt> if there
+* are no matches.
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch,
+ UErrorCode *status);
+
+/**
+* Returns the first index less than <tt>position</tt> at which the string text
+* matches the search pattern. The iterator is adjusted so that its current
+* index (as returned by <tt>usearch_getOffset</tt>) is the match position if
+* one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
+* <p>
+* Search positions that may render incorrect results are highlighted in the
+* header comments. If position is less than or greater than the text range
+* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned
+* @param strsrch search iterator data struct
+* @param position index position the search is to begin at
+* @param status for errors if it occurs
+* @return The character index of the first match preceding <tt>pos</tt>,
+* or <tt>USEARCH_DONE</tt> if there are no matches.
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch,
+ int32_t position,
+ UErrorCode *status);
+
+/**
+* Returns the index of the next point at which the string text matches the
+* search pattern, starting from the current position.
+* The iterator is adjusted so that its current
+* index (as returned by <tt>usearch_getOffset</tt>) is the match position if
+* one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
+* @param strsrch search iterator data struct
+* @param status for errors if it occurs
+* @return The index of the next match after the current position, or
+* <tt>USEARCH_DONE</tt> if there are no more matches.
+* @see #usearch_first
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch,
+ UErrorCode *status);
+
+/**
+* Returns the index of the previous point at which the string text matches
+* the search pattern, starting at the current position.
+* The iterator is adjusted so that its current
+* index (as returned by <tt>usearch_getOffset</tt>) is the match position if
+* one was found.
+* If a match is not found, <tt>USEARCH_DONE</tt> will be returned and
+* the iterator will be adjusted to the index <tt>USEARCH_DONE</tt>
+* @param strsrch search iterator data struct
+* @param status for errors if it occurs
+* @return The index of the previous match before the current position,
+* or <tt>USEARCH_DONE</tt> if there are no more matches.
+* @see #usearch_last
+* @see #usearch_getOffset
+* @see #USEARCH_DONE
+* @stable ICU 2.4
+*/
+U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch,
+ UErrorCode *status);
+
+/**
+* Reset the iteration.
+* Search will begin at the start of the text string if a forward iteration
+* is initiated before a backwards iteration. Otherwise if a backwards
+* iteration is initiated before a forwards iteration, the search will begin
+* at the end of the text string.
+* @param strsrch search iterator data struct
+* @see #usearch_first
+* @stable ICU 2.4
+*/
+U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch);
+
+#endif /* #if !UCONFIG_NO_COLLATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h b/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h
new file mode 100644
index 00000000000..e903c88b7f8
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/utmscale.h
@@ -0,0 +1,481 @@
+/*
+*******************************************************************************
+* Copyright (C) 2004 - 2006, International Business Machines Corporation and
+* others. All Rights Reserved.
+*******************************************************************************
+*/
+
+#ifndef UTMSCALE_H
+#define UTMSCALE_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_FORMATTING
+
+/**
+ * \file
+ * \brief C API: Universal Time Scale
+ *
+ * There are quite a few different conventions for binary datetime, depending on different
+ * platforms and protocols. Some of these have severe drawbacks. For example, people using
+ * Unix time (seconds since Jan 1, 1970) think that they are safe until near the year 2038.
+ * But cases can and do arise where arithmetic manipulations causes serious problems. Consider
+ * the computation of the average of two datetimes, for example: if one calculates them with
+ * <code>averageTime = (time1 + time2)/2</code>, there will be overflow even with dates
+ * around the present. Moreover, even if these problems don't occur, there is the issue of
+ * conversion back and forth between different systems.
+ *
+ * <p>
+ * Binary datetimes differ in a number of ways: the datatype, the unit,
+ * and the epoch (origin). We'll refer to these as time scales. For example:
+ *
+ * <table border="1" cellspacing="0" cellpadding="4">
+ * <caption>Table 1: Binary Time Scales</caption>
+ * <tr>
+ * <th align="left">Source</th>
+ * <th align="left">Datatype</th>
+ * <th align="left">Unit</th>
+ * <th align="left">Epoch</th>
+ * </tr>
+ *
+ * <tr>
+ * <td>UDTS_JAVA_TIME</td>
+ * <td>int64_t</td>
+ * <td>milliseconds</td>
+ * <td>Jan 1, 1970</td>
+ * </tr>
+ * <tr>
+ *
+ * <td>UDTS_UNIX_TIME</td>
+ * <td>int32_t or int64_t</td>
+ * <td>seconds</td>
+ * <td>Jan 1, 1970</td>
+ * </tr>
+ * <tr>
+ * <td>UDTS_ICU4C_TIME</td>
+ *
+ * <td>double</td>
+ * <td>milliseconds</td>
+ * <td>Jan 1, 1970</td>
+ * </tr>
+ * <tr>
+ * <td>UDTS_WINDOWS_FILE_TIME</td>
+ * <td>int64_t</td>
+ *
+ * <td>ticks (100 nanoseconds)</td>
+ * <td>Jan 1, 1601</td>
+ * </tr>
+ * <tr>
+ * <td>UDTS_DOTNET_DATE_TIME</td>
+ * <td>int64_t</td>
+ * <td>ticks (100 nanoseconds)</td>
+ *
+ * <td>Jan 1, 0001</td>
+ * </tr>
+ * <tr>
+ * <td>UDTS_MAC_OLD_TIME</td>
+ * <td>int32_t or int64_t</td>
+ * <td>seconds</td>
+ * <td>Jan 1, 1904</td>
+ *
+ * </tr>
+ * <tr>
+ * <td>UDTS_MAC_TIME</td>
+ * <td>double</td>
+ * <td>seconds</td>
+ * <td>Jan 1, 2001</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>UDTS_EXCEL_TIME</td>
+ * <td>?</td>
+ * <td>days</td>
+ * <td>Dec 31, 1899</td>
+ * </tr>
+ * <tr>
+ *
+ * <td>UDTS_DB2_TIME</td>
+ * <td>?</td>
+ * <td>days</td>
+ * <td>Dec 31, 1899</td>
+ * </tr>
+ *
+ * <tr>
+ * <td>UDTS_UNIX_MICROSECONDS_TIME</td>
+ * <td>int64_t</td>
+ * <td>microseconds</td>
+ * <td>Jan 1, 1970</td>
+ * </tr>
+ * </table>
+ *
+ * <p>
+ * All of the epochs start at 00:00 am (the earliest possible time on the day in question),
+ * and are assumed to be UTC.
+ *
+ * <p>
+ * The ranges for different datatypes are given in the following table (all values in years).
+ * The range of years includes the entire range expressible with positive and negative
+ * values of the datatype. The range of years for double is the range that would be allowed
+ * without losing precision to the corresponding unit.
+ *
+ * <table border="1" cellspacing="0" cellpadding="4">
+ * <tr>
+ * <th align="left">Units</th>
+ * <th align="left">int64_t</th>
+ * <th align="left">double</th>
+ * <th align="left">int32_t</th>
+ * </tr>
+ *
+ * <tr>
+ * <td>1 sec</td>
+ * <td align="right">5.84542x10<sup>11</sup></td>
+ * <td align="right">285,420,920.94</td>
+ * <td align="right">136.10</td>
+ * </tr>
+ * <tr>
+ *
+ * <td>1 millisecond</td>
+ * <td align="right">584,542,046.09</td>
+ * <td align="right">285,420.92</td>
+ * <td align="right">0.14</td>
+ * </tr>
+ * <tr>
+ * <td>1 microsecond</td>
+ *
+ * <td align="right">584,542.05</td>
+ * <td align="right">285.42</td>
+ * <td align="right">0.00</td>
+ * </tr>
+ * <tr>
+ * <td>100 nanoseconds (tick)</td>
+ * <td align="right">58,454.20</td>
+ * <td align="right">28.54</td>
+ * <td align="right">0.00</td>
+ * </tr>
+ * <tr>
+ * <td>1 nanosecond</td>
+ * <td align="right">584.5420461</td>
+ * <td align="right">0.2854</td>
+ * <td align="right">0.00</td>
+ * </tr>
+ * </table>
+ *
+ * <p>
+ * These functions implement a universal time scale which can be used as a 'pivot',
+ * and provide conversion functions to and from all other major time scales.
+ * This datetimes to be converted to the pivot time, safely manipulated,
+ * and converted back to any other datetime time scale.
+ *
+ *<p>
+ * So what to use for this pivot? Java time has plenty of range, but cannot represent
+ * .NET <code>System.DateTime</code> values without severe loss of precision. ICU4C time addresses this by using a
+ * <code>double</code> that is otherwise equivalent to the Java time. However, there are disadvantages
+ * with <code>doubles</code>. They provide for much more graceful degradation in arithmetic operations.
+ * But they only have 53 bits of accuracy, which means that they will lose precision when
+ * converting back and forth to ticks. What would really be nice would be a
+ * <code>long double</code> (80 bits -- 64 bit mantissa), but that is not supported on most systems.
+ *
+ *<p>
+ * The Unix extended time uses a structure with two components: time in seconds and a
+ * fractional field (microseconds). However, this is clumsy, slow, and
+ * prone to error (you always have to keep track of overflow and underflow in the
+ * fractional field). <code>BigDecimal</code> would allow for arbitrary precision and arbitrary range,
+ * but we do not want to use this as the normal type, because it is slow and does not
+ * have a fixed size.
+ *
+ *<p>
+ * Because of these issues, we ended up concluding that the .NET framework's
+ * <code>System.DateTime</code> would be the best pivot. However, we use the full range
+ * allowed by the datatype, allowing for datetimes back to 29,000 BC and up to 29,000 AD.
+ * This time scale is very fine grained, does not lose precision, and covers a range that
+ * will meet almost all requirements. It will not handle the range that Java times do,
+ * but frankly, being able to handle dates before 29,000 BC or after 29,000 AD is of very limited interest.
+ *
+ */
+
+/**
+ * <code>UDateTimeScale</code> values are used to specify the time scale used for
+ * conversion into or out if the universal time scale.
+ *
+ * @stable ICU 3.2
+ */
+typedef enum UDateTimeScale {
+ /**
+ * Used in the JDK. Data is a Java <code>long</code> (<code>int64_t</code>). Value
+ * is milliseconds since January 1, 1970.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_JAVA_TIME = 0,
+
+ /**
+ * Used on Unix systems. Data is <code>int32_t</code> or <code>int64_t</code>. Value
+ * is seconds since January 1, 1970.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_UNIX_TIME,
+
+ /**
+ * Used in IUC4C. Data is a <code>double</code>. Value
+ * is milliseconds since January 1, 1970.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_ICU4C_TIME,
+
+ /**
+ * Used in Windows for file times. Data is an <code>int64_t</code>. Value
+ * is ticks (1 tick == 100 nanoseconds) since January 1, 1601.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_WINDOWS_FILE_TIME,
+
+ /**
+ * Used in the .NET framework's <code>System.DateTime</code> structure. Data is an <code>int64_t</code>. Value
+ * is ticks (1 tick == 100 nanoseconds) since January 1, 0001.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_DOTNET_DATE_TIME,
+
+ /**
+ * Used in older Macintosh systems. Data is <code>int32_t</code> or <code>int64_t</code>. Value
+ * is seconds since January 1, 1904.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_MAC_OLD_TIME,
+
+ /**
+ * Used in newer Macintosh systems. Data is a <code>double</code>. Value
+ * is seconds since January 1, 2001.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_MAC_TIME,
+
+ /**
+ * Used in Excel. Data is an <code>?unknown?</code>. Value
+ * is days since December 31, 1899.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_EXCEL_TIME,
+
+ /**
+ * Used in DB2. Data is an <code>?unknown?</code>. Value
+ * is days since December 31, 1899.
+ *
+ * @stable ICU 3.2
+ */
+ UDTS_DB2_TIME,
+
+ /**
+ * Data is a <code>long</code>. Value is microseconds since January 1, 1970.
+ * Similar to Unix time (linear value from 1970) and struct timeval
+ * (microseconds resolution).
+ *
+ * @draft ICU 3.8
+ */
+ UDTS_UNIX_MICROSECONDS_TIME,
+
+ /**
+ * The first unused time scale value. The limit of this enum
+ */
+ UDTS_MAX_SCALE
+} UDateTimeScale;
+
+/**
+ * <code>UTimeScaleValue</code> values are used to specify the time scale values
+ * to <code>utmscale_getTimeScaleValue</code>.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+typedef enum UTimeScaleValue {
+ /**
+ * The constant used to select the units vale
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_UNITS_VALUE = 0,
+
+ /**
+ * The constant used to select the epoch offset value
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_EPOCH_OFFSET_VALUE=1,
+
+ /**
+ * The constant used to select the minimum from value
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_FROM_MIN_VALUE=2,
+
+ /**
+ * The constant used to select the maximum from value
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_FROM_MAX_VALUE=3,
+
+ /**
+ * The constant used to select the minimum to value
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_TO_MIN_VALUE=4,
+
+ /**
+ * The constant used to select the maximum to value
+ * for a time scale.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @stable ICU 3.2
+ */
+ UTSV_TO_MAX_VALUE=5,
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * The constant used to select the epoch plus one value
+ * for a time scale.
+ *
+ * NOTE: This is an internal value. DO NOT USE IT. May not
+ * actually be equal to the epoch offset value plus one.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @internal ICU 3.2
+ */
+ UTSV_EPOCH_OFFSET_PLUS_1_VALUE=6,
+
+ /**
+ * The constant used to select the epoch plus one value
+ * for a time scale.
+ *
+ * NOTE: This is an internal value. DO NOT USE IT. May not
+ * actually be equal to the epoch offset value plus one.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @internal ICU 3.2
+ */
+ UTSV_EPOCH_OFFSET_MINUS_1_VALUE=7,
+
+ /**
+ * The constant used to select the units round value
+ * for a time scale.
+ *
+ * NOTE: This is an internal value. DO NOT USE IT.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @internal ICU 3.2
+ */
+ UTSV_UNITS_ROUND_VALUE=8,
+
+ /**
+ * The constant used to select the minimum safe rounding value
+ * for a time scale.
+ *
+ * NOTE: This is an internal value. DO NOT USE IT.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @internal ICU 3.2
+ */
+ UTSV_MIN_ROUND_VALUE=9,
+
+ /**
+ * The constant used to select the maximum safe rounding value
+ * for a time scale.
+ *
+ * NOTE: This is an internal value. DO NOT USE IT.
+ *
+ * @see utmscale_getTimeScaleValue
+ *
+ * @internal ICU 3.2
+ */
+ UTSV_MAX_ROUND_VALUE=10,
+
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * The number of time scale values, in other words limit of this enum.
+ *
+ * @see utmscale_getTimeScaleValue
+ */
+ UTSV_MAX_SCALE_VALUE=11
+
+} UTimeScaleValue;
+
+/**
+ * Get a value associated with a particular time scale.
+ *
+ * @param timeScale The time scale
+ * @param value A constant representing the value to get
+ * @param status The status code. Set to <code>U_ILLEGAL_ARGUMENT_ERROR</code> if arguments are invalid.
+ * @return - the value.
+ *
+ * @stable ICU 3.2
+ */
+U_STABLE int64_t U_EXPORT2
+ utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status);
+
+/* Conversion to 'universal time scale' */
+
+/**
+ * Convert a <code>int64_t</code> datetime from the given time scale to the universal time scale.
+ *
+ * @param otherTime The <code>int64_t</code> datetime
+ * @param timeScale The time scale to convert from
+ * @param status The status code. Set to <code>U_ILLEGAL_ARGUMENT_ERROR</code> if the conversion is out of range.
+ *
+ * @return The datetime converted to the universal time scale
+ *
+ * @stable ICU 3.2
+ */
+U_STABLE int64_t U_EXPORT2
+ utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status);
+
+/* Conversion from 'universal time scale' */
+
+/**
+ * Convert a datetime from the universal time scale to a <code>int64_t</code> in the given time scale.
+ *
+ * @param universalTime The datetime in the universal time scale
+ * @param timeScale The time scale to convert to
+ * @param status The status code. Set to <code>U_ILLEGAL_ARGUMENT_ERROR</code> if the conversion is out of range.
+ *
+ * @return The datetime converted to the given time scale
+ *
+ * @stable ICU 3.2
+ */
+U_STABLE int64_t U_EXPORT2
+ utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status);
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif
+
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/utrans.h b/Build/source/libs/icu-xetex/i18n/unicode/utrans.h
new file mode 100644
index 00000000000..a460a34c5b7
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/utrans.h
@@ -0,0 +1,583 @@
+/*
+*******************************************************************************
+* Copyright (C) 1997-2005, International Business Machines
+* Corporation and others. All Rights Reserved.
+*******************************************************************************
+* Date Name Description
+* 06/21/00 aliu Creation.
+*******************************************************************************
+*/
+
+#ifndef UTRANS_H
+#define UTRANS_H
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_TRANSLITERATION
+
+#include "unicode/urep.h"
+#include "unicode/parseerr.h"
+#include "unicode/uenum.h"
+
+/********************************************************************
+ * General Notes
+ ********************************************************************
+ */
+/**
+ * \file
+ * \brief C API: Transliterator
+ *
+ * <h2> Transliteration </h2>
+ * The data structures and functions described in this header provide
+ * transliteration services. Transliteration services are implemented
+ * as C++ classes. The comments and documentation in this header
+ * assume the reader is familiar with the C++ headers translit.h and
+ * associated documentation.
+ *
+ * A significant but incomplete subset of the C++ transliteration
+ * services are available to C code through this header. In order to
+ * access more complex transliteration services, refer to the C++
+ * headers and documentation.
+ *
+ * There are two sets of functions for working with transliterator IDs:
+ *
+ * An old, deprecated set uses char * IDs, which works for true and pure
+ * identifiers that these APIs were designed for,
+ * for example "Cyrillic-Latin".
+ * It does not work when the ID contains filters ("[:Script=Cyrl:]")
+ * or even a complete set of rules because then the ID string contains more
+ * than just "invariant" characters (see utypes.h).
+ *
+ * A new set of functions replaces the old ones and uses UChar * IDs,
+ * paralleling the UnicodeString IDs in the C++ API. (New in ICU 2.8.)
+ */
+
+/********************************************************************
+ * Data Structures
+ ********************************************************************/
+
+/**
+ * An opaque transliterator for use in C. Open with utrans_openxxx()
+ * and close with utrans_close() when done. Equivalent to the C++ class
+ * Transliterator and its subclasses.
+ * @see Transliterator
+ * @stable ICU 2.0
+ */
+typedef void* UTransliterator;
+
+/**
+ * Direction constant indicating the direction in a transliterator,
+ * e.g., the forward or reverse rules of a RuleBasedTransliterator.
+ * Specified when a transliterator is opened. An "A-B" transliterator
+ * transliterates A to B when operating in the forward direction, and
+ * B to A when operating in the reverse direction.
+ * @stable ICU 2.0
+ */
+typedef enum UTransDirection {
+
+ /**
+ * UTRANS_FORWARD means from &lt;source&gt; to &lt;target&gt; for a
+ * transliterator with ID &lt;source&gt;-&lt;target&gt;. For a transliterator
+ * opened using a rule, it means forward direction rules, e.g.,
+ * "A > B".
+ */
+ UTRANS_FORWARD,
+
+ /**
+ * UTRANS_REVERSE means from &lt;target&gt; to &lt;source&gt; for a
+ * transliterator with ID &lt;source&gt;-&lt;target&gt;. For a transliterator
+ * opened using a rule, it means reverse direction rules, e.g.,
+ * "A < B".
+ */
+ UTRANS_REVERSE
+
+} UTransDirection;
+
+/**
+ * Position structure for utrans_transIncremental() incremental
+ * transliteration. This structure defines two substrings of the text
+ * being transliterated. The first region, [contextStart,
+ * contextLimit), defines what characters the transliterator will read
+ * as context. The second region, [start, limit), defines what
+ * characters will actually be transliterated. The second region
+ * should be a subset of the first.
+ *
+ * <p>After a transliteration operation, some of the indices in this
+ * structure will be modified. See the field descriptions for
+ * details.
+ *
+ * <p>contextStart <= start <= limit <= contextLimit
+ *
+ * <p>Note: All index values in this structure must be at code point
+ * boundaries. That is, none of them may occur between two code units
+ * of a surrogate pair. If any index does split a surrogate pair,
+ * results are unspecified.
+ *
+ * @stable ICU 2.0
+ */
+typedef struct UTransPosition {
+
+ /**
+ * Beginning index, inclusive, of the context to be considered for
+ * a transliteration operation. The transliterator will ignore
+ * anything before this index. INPUT/OUTPUT parameter: This parameter
+ * is updated by a transliteration operation to reflect the maximum
+ * amount of antecontext needed by a transliterator.
+ * @stable ICU 2.4
+ */
+ int32_t contextStart;
+
+ /**
+ * Ending index, exclusive, of the context to be considered for a
+ * transliteration operation. The transliterator will ignore
+ * anything at or after this index. INPUT/OUTPUT parameter: This
+ * parameter is updated to reflect changes in the length of the
+ * text, but points to the same logical position in the text.
+ * @stable ICU 2.4
+ */
+ int32_t contextLimit;
+
+ /**
+ * Beginning index, inclusive, of the text to be transliteratd.
+ * INPUT/OUTPUT parameter: This parameter is advanced past
+ * characters that have already been transliterated by a
+ * transliteration operation.
+ * @stable ICU 2.4
+ */
+ int32_t start;
+
+ /**
+ * Ending index, exclusive, of the text to be transliteratd.
+ * INPUT/OUTPUT parameter: This parameter is updated to reflect
+ * changes in the length of the text, but points to the same
+ * logical position in the text.
+ * @stable ICU 2.4
+ */
+ int32_t limit;
+
+} UTransPosition;
+
+/********************************************************************
+ * General API
+ ********************************************************************/
+
+/**
+ * Open a custom transliterator, given a custom rules string
+ * OR
+ * a system transliterator, given its ID.
+ * Any non-NULL result from this function should later be closed with
+ * utrans_close().
+ *
+ * @param id a valid transliterator ID
+ * @param idLength the length of the ID string, or -1 if NUL-terminated
+ * @param dir the desired direction
+ * @param rules the transliterator rules. See the C++ header rbt.h for
+ * rules syntax. If NULL then a system transliterator matching
+ * the ID is returned.
+ * @param rulesLength the length of the rules, or -1 if the rules
+ * are NUL-terminated.
+ * @param parseError a pointer to a UParseError struct to receive the details
+ * of any parsing errors. This parameter may be NULL if no
+ * parsing error details are desired.
+ * @param pErrorCode a pointer to the UErrorCode
+ * @return a transliterator pointer that may be passed to other
+ * utrans_xxx() functions, or NULL if the open call fails.
+ * @stable ICU 2.8
+ */
+U_STABLE UTransliterator* U_EXPORT2
+utrans_openU(const UChar *id,
+ int32_t idLength,
+ UTransDirection dir,
+ const UChar *rules,
+ int32_t rulesLength,
+ UParseError *parseError,
+ UErrorCode *pErrorCode);
+
+/**
+ * Open an inverse of an existing transliterator. For this to work,
+ * the inverse must be registered with the system. For example, if
+ * the Transliterator "A-B" is opened, and then its inverse is opened,
+ * the result is the Transliterator "B-A", if such a transliterator is
+ * registered with the system. Otherwise the result is NULL and a
+ * failing UErrorCode is set. Any non-NULL result from this function
+ * should later be closed with utrans_close().
+ *
+ * @param trans the transliterator to open the inverse of.
+ * @param status a pointer to the UErrorCode
+ * @return a pointer to a newly-opened transliterator that is the
+ * inverse of trans, or NULL if the open call fails.
+ * @stable ICU 2.0
+ */
+U_STABLE UTransliterator* U_EXPORT2
+utrans_openInverse(const UTransliterator* trans,
+ UErrorCode* status);
+
+/**
+ * Create a copy of a transliterator. Any non-NULL result from this
+ * function should later be closed with utrans_close().
+ *
+ * @param trans the transliterator to be copied.
+ * @param status a pointer to the UErrorCode
+ * @return a transliterator pointer that may be passed to other
+ * utrans_xxx() functions, or NULL if the clone call fails.
+ * @stable ICU 2.0
+ */
+U_STABLE UTransliterator* U_EXPORT2
+utrans_clone(const UTransliterator* trans,
+ UErrorCode* status);
+
+/**
+ * Close a transliterator. Any non-NULL pointer returned by
+ * utrans_openXxx() or utrans_clone() should eventually be closed.
+ * @param trans the transliterator to be closed.
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_close(UTransliterator* trans);
+
+/**
+ * Return the programmatic identifier for this transliterator.
+ * If this identifier is passed to utrans_openU(), it will open
+ * a transliterator equivalent to this one, if the ID has been
+ * registered.
+ *
+ * @param trans the transliterator to return the ID of.
+ * @param resultLength pointer to an output variable receiving the length
+ * of the ID string; can be NULL
+ * @return the NUL-terminated ID string. This pointer remains
+ * valid until utrans_close() is called on this transliterator.
+ *
+ * @stable ICU 2.8
+ */
+U_STABLE const UChar * U_EXPORT2
+utrans_getUnicodeID(const UTransliterator *trans,
+ int32_t *resultLength);
+
+/**
+ * Register an open transliterator with the system. When
+ * utrans_open() is called with an ID string that is equal to that
+ * returned by utrans_getID(adoptedTrans,...), then
+ * utrans_clone(adoptedTrans,...) is returned.
+ *
+ * <p>NOTE: After this call the system owns the adoptedTrans and will
+ * close it. The user must not call utrans_close() on adoptedTrans.
+ *
+ * @param adoptedTrans a transliterator, typically the result of
+ * utrans_openRules(), to be registered with the system.
+ * @param status a pointer to the UErrorCode
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_register(UTransliterator* adoptedTrans,
+ UErrorCode* status);
+
+/**
+ * Unregister a transliterator from the system. After this call the
+ * system will no longer recognize the given ID when passed to
+ * utrans_open(). If the ID is invalid then nothing is done.
+ *
+ * @param id an ID to unregister
+ * @param idLength the length of id, or -1 if id is zero-terminated
+ * @stable ICU 2.8
+ */
+U_STABLE void U_EXPORT2
+utrans_unregisterID(const UChar* id, int32_t idLength);
+
+/**
+ * Set the filter used by a transliterator. A filter can be used to
+ * make the transliterator pass certain characters through untouched.
+ * The filter is expressed using a UnicodeSet pattern. If the
+ * filterPattern is NULL or the empty string, then the transliterator
+ * will be reset to use no filter.
+ *
+ * @param trans the transliterator
+ * @param filterPattern a pattern string, in the form accepted by
+ * UnicodeSet, specifying which characters to apply the
+ * transliteration to. May be NULL or the empty string to indicate no
+ * filter.
+ * @param filterPatternLen the length of filterPattern, or -1 if
+ * filterPattern is zero-terminated
+ * @param status a pointer to the UErrorCode
+ * @see UnicodeSet
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_setFilter(UTransliterator* trans,
+ const UChar* filterPattern,
+ int32_t filterPatternLen,
+ UErrorCode* status);
+
+/**
+ * Return the number of system transliterators.
+ * It is recommended to use utrans_openIDs() instead.
+ *
+ * @return the number of system transliterators.
+ * @stable ICU 2.0
+ */
+U_STABLE int32_t U_EXPORT2
+utrans_countAvailableIDs(void);
+
+/**
+ * Return a UEnumeration for the available transliterators.
+ *
+ * @param pErrorCode Pointer to the UErrorCode in/out parameter.
+ * @return UEnumeration for the available transliterators.
+ * Close with uenum_close().
+ *
+ * @stable ICU 2.8
+ */
+U_STABLE UEnumeration * U_EXPORT2
+utrans_openIDs(UErrorCode *pErrorCode);
+
+/********************************************************************
+ * Transliteration API
+ ********************************************************************/
+
+/**
+ * Transliterate a segment of a UReplaceable string. The string is
+ * passed in as a UReplaceable pointer rep and a UReplaceableCallbacks
+ * function pointer struct repFunc. Functions in the repFunc struct
+ * will be called in order to modify the rep string.
+ *
+ * @param trans the transliterator
+ * @param rep a pointer to the string. This will be passed to the
+ * repFunc functions.
+ * @param repFunc a set of function pointers that will be used to
+ * modify the string pointed to by rep.
+ * @param start the beginning index, inclusive; <code>0 <= start <=
+ * limit</code>.
+ * @param limit pointer to the ending index, exclusive; <code>start <=
+ * limit <= repFunc->length(rep)</code>. Upon return, *limit will
+ * contain the new limit index. The text previously occupying
+ * <code>[start, limit)</code> has been transliterated, possibly to a
+ * string of a different length, at <code>[start,
+ * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
+ * is the return value.
+ * @param status a pointer to the UErrorCode
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_trans(const UTransliterator* trans,
+ UReplaceable* rep,
+ UReplaceableCallbacks* repFunc,
+ int32_t start,
+ int32_t* limit,
+ UErrorCode* status);
+
+/**
+ * Transliterate the portion of the UReplaceable text buffer that can
+ * be transliterated unambiguosly. This method is typically called
+ * after new text has been inserted, e.g. as a result of a keyboard
+ * event. The transliterator will try to transliterate characters of
+ * <code>rep</code> between <code>index.cursor</code> and
+ * <code>index.limit</code>. Characters before
+ * <code>index.cursor</code> will not be changed.
+ *
+ * <p>Upon return, values in <code>index</code> will be updated.
+ * <code>index.start</code> will be advanced to the first
+ * character that future calls to this method will read.
+ * <code>index.cursor</code> and <code>index.limit</code> will
+ * be adjusted to delimit the range of text that future calls to
+ * this method may change.
+ *
+ * <p>Typical usage of this method begins with an initial call
+ * with <code>index.start</code> and <code>index.limit</code>
+ * set to indicate the portion of <code>text</code> to be
+ * transliterated, and <code>index.cursor == index.start</code>.
+ * Thereafter, <code>index</code> can be used without
+ * modification in future calls, provided that all changes to
+ * <code>text</code> are made via this method.
+ *
+ * <p>This method assumes that future calls may be made that will
+ * insert new text into the buffer. As a result, it only performs
+ * unambiguous transliterations. After the last call to this method,
+ * there may be untransliterated text that is waiting for more input
+ * to resolve an ambiguity. In order to perform these pending
+ * transliterations, clients should call utrans_trans() with a start
+ * of index.start and a limit of index.end after the last call to this
+ * method has been made.
+ *
+ * @param trans the transliterator
+ * @param rep a pointer to the string. This will be passed to the
+ * repFunc functions.
+ * @param repFunc a set of function pointers that will be used to
+ * modify the string pointed to by rep.
+ * @param pos a struct containing the start and limit indices of the
+ * text to be read and the text to be transliterated
+ * @param status a pointer to the UErrorCode
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_transIncremental(const UTransliterator* trans,
+ UReplaceable* rep,
+ UReplaceableCallbacks* repFunc,
+ UTransPosition* pos,
+ UErrorCode* status);
+
+/**
+ * Transliterate a segment of a UChar* string. The string is passed
+ * in in a UChar* buffer. The string is modified in place. If the
+ * result is longer than textCapacity, it is truncated. The actual
+ * length of the result is returned in *textLength, if textLength is
+ * non-NULL. *textLength may be greater than textCapacity, but only
+ * textCapacity UChars will be written to *text, including the zero
+ * terminator.
+ *
+ * @param trans the transliterator
+ * @param text a pointer to a buffer containing the text to be
+ * transliterated on input and the result text on output.
+ * @param textLength a pointer to the length of the string in text.
+ * If the length is -1 then the string is assumed to be
+ * zero-terminated. Upon return, the new length is stored in
+ * *textLength. If textLength is NULL then the string is assumed to
+ * be zero-terminated.
+ * @param textCapacity a pointer to the length of the text buffer.
+ * Upon return,
+ * @param start the beginning index, inclusive; <code>0 <= start <=
+ * limit</code>.
+ * @param limit pointer to the ending index, exclusive; <code>start <=
+ * limit <= repFunc->length(rep)</code>. Upon return, *limit will
+ * contain the new limit index. The text previously occupying
+ * <code>[start, limit)</code> has been transliterated, possibly to a
+ * string of a different length, at <code>[start,
+ * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
+ * is the return value.
+ * @param status a pointer to the UErrorCode
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_transUChars(const UTransliterator* trans,
+ UChar* text,
+ int32_t* textLength,
+ int32_t textCapacity,
+ int32_t start,
+ int32_t* limit,
+ UErrorCode* status);
+
+/**
+ * Transliterate the portion of the UChar* text buffer that can be
+ * transliterated unambiguosly. See utrans_transIncremental(). The
+ * string is passed in in a UChar* buffer. The string is modified in
+ * place. If the result is longer than textCapacity, it is truncated.
+ * The actual length of the result is returned in *textLength, if
+ * textLength is non-NULL. *textLength may be greater than
+ * textCapacity, but only textCapacity UChars will be written to
+ * *text, including the zero terminator. See utrans_transIncremental()
+ * for usage details.
+ *
+ * @param trans the transliterator
+ * @param text a pointer to a buffer containing the text to be
+ * transliterated on input and the result text on output.
+ * @param textLength a pointer to the length of the string in text.
+ * If the length is -1 then the string is assumed to be
+ * zero-terminated. Upon return, the new length is stored in
+ * *textLength. If textLength is NULL then the string is assumed to
+ * be zero-terminated.
+ * @param textCapacity the length of the text buffer
+ * @param pos a struct containing the start and limit indices of the
+ * text to be read and the text to be transliterated
+ * @param status a pointer to the UErrorCode
+ * @see utrans_transIncremental
+ * @stable ICU 2.0
+ */
+U_STABLE void U_EXPORT2
+utrans_transIncrementalUChars(const UTransliterator* trans,
+ UChar* text,
+ int32_t* textLength,
+ int32_t textCapacity,
+ UTransPosition* pos,
+ UErrorCode* status);
+
+/* deprecated API ----------------------------------------------------------- */
+
+/* see utrans.h documentation for why these functions are deprecated */
+
+/**
+ * Deprecated, use utrans_openU() instead.
+ * Open a custom transliterator, given a custom rules string
+ * OR
+ * a system transliterator, given its ID.
+ * Any non-NULL result from this function should later be closed with
+ * utrans_close().
+ *
+ * @param id a valid ID, as returned by utrans_getAvailableID()
+ * @param dir the desired direction
+ * @param rules the transliterator rules. See the C++ header rbt.h
+ * for rules syntax. If NULL then a system transliterator matching
+ * the ID is returned.
+ * @param rulesLength the length of the rules, or -1 if the rules
+ * are zero-terminated.
+ * @param parseError a pointer to a UParseError struct to receive the
+ * details of any parsing errors. This parameter may be NULL if no
+ * parsing error details are desired.
+ * @param status a pointer to the UErrorCode
+ * @return a transliterator pointer that may be passed to other
+ * utrans_xxx() functions, or NULL if the open call fails.
+ * @deprecated ICU 2.8 Use utrans_openU() instead, see utrans.h
+ */
+U_DEPRECATED UTransliterator* U_EXPORT2
+utrans_open(const char* id,
+ UTransDirection dir,
+ const UChar* rules, /* may be Null */
+ int32_t rulesLength, /* -1 if null-terminated */
+ UParseError* parseError, /* may be Null */
+ UErrorCode* status);
+
+/**
+ * Deprecated, use utrans_getUnicodeID() instead.
+ * Return the programmatic identifier for this transliterator.
+ * If this identifier is passed to utrans_open(), it will open
+ * a transliterator equivalent to this one, if the ID has been
+ * registered.
+ * @param trans the transliterator to return the ID of.
+ * @param buf the buffer in which to receive the ID. This may be
+ * NULL, in which case no characters are copied.
+ * @param bufCapacity the capacity of the buffer. Ignored if buf is
+ * NULL.
+ * @return the actual length of the ID, not including
+ * zero-termination. This may be greater than bufCapacity.
+ * @deprecated ICU 2.8 Use utrans_getUnicodeID() instead, see utrans.h
+ */
+U_DEPRECATED int32_t U_EXPORT2
+utrans_getID(const UTransliterator* trans,
+ char* buf,
+ int32_t bufCapacity);
+
+/**
+ * Deprecated, use utrans_unregisterID() instead.
+ * Unregister a transliterator from the system. After this call the
+ * system will no longer recognize the given ID when passed to
+ * utrans_open(). If the id is invalid then nothing is done.
+ *
+ * @param id a zero-terminated ID
+ * @deprecated ICU 2.8 Use utrans_unregisterID() instead, see utrans.h
+ */
+U_DEPRECATED void U_EXPORT2
+utrans_unregister(const char* id);
+
+/**
+ * Deprecated, use utrans_openIDs() instead.
+ * Return the ID of the index-th system transliterator. The result
+ * is placed in the given buffer. If the given buffer is too small,
+ * the initial substring is copied to buf. The result in buf is
+ * always zero-terminated.
+ *
+ * @param index the number of the transliterator to return. Must
+ * satisfy 0 <= index < utrans_countAvailableIDs(). If index is out
+ * of range then it is treated as if it were 0.
+ * @param buf the buffer in which to receive the ID. This may be
+ * NULL, in which case no characters are copied.
+ * @param bufCapacity the capacity of the buffer. Ignored if buf is
+ * NULL.
+ * @return the actual length of the index-th ID, not including
+ * zero-termination. This may be greater than bufCapacity.
+ * @deprecated ICU 2.8 Use utrans_openIDs() instead, see utrans.h
+ */
+U_DEPRECATED int32_t U_EXPORT2
+utrans_getAvailableID(int32_t index,
+ char* buf,
+ int32_t bufCapacity);
+
+#endif /* #if !UCONFIG_NO_TRANSLITERATION */
+
+#endif
diff --git a/Build/source/libs/icu-xetex/i18n/unicode/vtzone.h b/Build/source/libs/icu-xetex/i18n/unicode/vtzone.h
new file mode 100644
index 00000000000..420f61a2baa
--- /dev/null
+++ b/Build/source/libs/icu-xetex/i18n/unicode/vtzone.h
@@ -0,0 +1,443 @@
+/*
+*******************************************************************************
+* Copyright (C) 2007, International Business Machines Corporation and *
+* others. All Rights Reserved. *
+*******************************************************************************
+*/
+#ifndef VTZONE_H
+#define VTZONE_H
+
+#include "unicode/utypes.h"
+
+/**
+ * \file
+ * \brief C++ API: RFC2445 VTIMEZONE support
+ */
+
+#if !UCONFIG_NO_FORMATTING
+
+#include "unicode/basictz.h"
+
+U_NAMESPACE_BEGIN
+
+class VTZWriter;
+class VTZReader;
+class UVector;
+
+/**
+ * <code>VTimeZone</code> is a class implementing RFC2445 VTIMEZONE. You can create a
+ * <code>VTimeZone</code> instance from a time zone ID supported by <code>TimeZone</code>.
+ * With the <code>VTimeZone</code> instance created from the ID, you can write out the rule
+ * in RFC2445 VTIMEZONE format. Also, you can create a <code>VTimeZone</code> instance
+ * from RFC2445 VTIMEZONE data stream, which allows you to calculate time
+ * zone offset by the rules defined by the data.<br><br>
+ * Note: The consumer of this class reading or writing VTIMEZONE data is responsible to
+ * decode or encode Non-ASCII text. Methods reading/writing VTIMEZONE data in this class
+ * do nothing with MIME encoding.
+ * @draft ICU 3.8
+ */
+class U_I18N_API VTimeZone : public BasicTimeZone {
+public:
+ /**
+ * Copy constructor.
+ * @param source The <code>VTimeZone</code> object to be copied.
+ * @draft ICU 3.8
+ */
+ VTimeZone(const VTimeZone& source);
+
+ /**
+ * Destructor.
+ * @draft ICU 3.8
+ */
+ virtual ~VTimeZone();
+
+ /**
+ * Assignment operator.
+ * @param right The object to be copied.
+ * @draft ICU 3.8
+ */
+ VTimeZone& operator=(const VTimeZone& right);
+
+ /**
+ * Return true if the given <code>TimeZone</code> objects are
+ * semantically equal. Objects of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZone</code> objects are
+ *semantically equal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator==(const TimeZone& that) const;
+
+ /**
+ * Return true if the given <code>TimeZone</code> objects are
+ * semantically unequal. Objects of different subclasses are considered unequal.
+ * @param that The object to be compared with.
+ * @return true if the given <code>TimeZone</code> objects are
+ * semantically unequal.
+ * @draft ICU 3.8
+ */
+ virtual UBool operator!=(const TimeZone& that) const;
+
+ /**
+ * Create a <code>VTimeZone</code> instance by the time zone ID.
+ * @param ID The time zone ID, such as America/New_York
+ * @return A <code>VTimeZone</code> object initialized by the time zone ID,
+ * or NULL when the ID is unknown.
+ * @draft ICU 3.8
+ */
+ static VTimeZone* createVTimeZoneByID(const UnicodeString& ID);
+
+ /**
+ * Create a <code>VTimeZone</code> instance by RFC2445 VTIMEZONE data
+ *
+ * @param vtzdata The string including VTIMEZONE data block
+ * @param status Output param to filled in with a success or an error.
+ * @return A <code>VTimeZone</code> initialized by the VTIMEZONE data or
+ * NULL if failed to load the rule from the VTIMEZONE data.
+ * @draft ICU 3.8
+ */
+ static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status);
+
+ /**
+ * Gets the RFC2445 TZURL property value. When a <code>VTimeZone</code> instance was
+ * created from VTIMEZONE data, the initial value is set by the TZURL property value
+ * in the data. Otherwise, the initial value is not set.
+ * @param url Receives the RFC2445 TZURL property value.
+ * @return TRUE if TZURL attribute is available and value is set.
+ * @draft ICU 3.8
+ */
+ UBool getTZURL(UnicodeString& url) const;
+
+ /**
+ * Sets the RFC2445 TZURL property value.
+ * @param url The TZURL property value.
+ * @draft ICU 3.8
+ */
+ void setTZURL(const UnicodeString& url);
+
+ /**
+ * Gets the RFC2445 LAST-MODIFIED property value. When a <code>VTimeZone</code> instance
+ * was created from VTIMEZONE data, the initial value is set by the LAST-MODIFIED property
+ * value in the data. Otherwise, the initial value is not set.
+ * @param lastModified Receives the last modified date.
+ * @return TRUE if lastModified attribute is available and value is set.
+ * @draft ICU 3.8
+ */
+ UBool getLastModified(UDate& lastModified) const;
+
+ /**
+ * Sets the RFC2445 LAST-MODIFIED property value.
+ * @param lastModified The LAST-MODIFIED date.
+ * @draft ICU 3.8
+ */
+ void setLastModified(UDate lastModified);
+
+ /**
+ * Writes RFC2445 VTIMEZONE data for this time zone
+ * @param result Output param to filled in with the VTIMEZONE data.
+ * @param status Output param to filled in with a success or an error.
+ * @draft ICU 3.8
+ */
+ void write(UnicodeString& result, UErrorCode& status) const;
+
+ /**
+ * Writes RFC2445 VTIMEZONE data for this time zone applicalbe
+ * for dates after the specified start time.
+ * @param start The start date.
+ * @param result Output param to filled in with the VTIMEZONE data.
+ * @param status Output param to filled in with a success or an error.
+ * @draft ICU 3.8
+ */
+ void write(UDate start, UnicodeString& result, UErrorCode& status) /*const*/;
+
+ /**
+ * Writes RFC2445 VTIMEZONE data applicalbe for the specified date.
+ * Some common iCalendar implementations can only handle a single time
+ * zone property or a pair of standard and daylight time properties using
+ * BYDAY rule with day of week (such as BYDAY=1SUN). This method produce
+ * the VTIMEZONE data which can be handled these implementations. The rules
+ * produced by this method can be used only for calculating time zone offset
+ * around the specified date.
+ * @param time The date used for rule extraction.
+ * @param result Output param to filled in with the VTIMEZONE data.
+ * @param status Output param to filled in with a success or an error.
+ * @draft ICU 3.8
+ */
+ void writeSimple(UDate time, UnicodeString& result, UErrorCode& status) /*const*/;
+
+ /**
+ * Clones TimeZone objects polymorphically. Clients are responsible for deleting
+ * the TimeZone object cloned.
+ * @return A new copy of this TimeZone object.
+ * @draft ICU 3.8
+ */
+ virtual TimeZone* clone(void) const;
+
+ /**
+ * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time in this time zone, taking daylight savings time into
+ * account) as of a particular reference date. The reference date is used to determine
+ * whether daylight savings time is in effect and needs to be figured into the offset
+ * that is returned (in other words, what is the adjusted GMT offset in this time zone
+ * at this particular date and time?). For the time zones produced by createTimeZone(),
+ * the reference data is specified according to the Gregorian calendar, and the date
+ * and time fields are local standard time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, local standard time
+ * @param status Output param to filled in with a success or an error.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const;
+
+ /**
+ * Gets the time zone offset, for current date, modified in case of
+ * daylight savings. This is the offset to add *to* UTC to get local time.
+ *
+ * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload,
+ * which returns both the raw and the DST offset for a given time. This method
+ * is retained only for backward compatibility.
+ *
+ * @param era The reference date's era
+ * @param year The reference date's year
+ * @param month The reference date's month (0-based; 0 is January)
+ * @param day The reference date's day-in-month (1-based)
+ * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday)
+ * @param millis The reference date's milliseconds in day, local standard time
+ * @param monthLength The length of the given month in days.
+ * @param status Output param to filled in with a success or an error.
+ * @return The offset in milliseconds to add to GMT to get local time.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day,
+ uint8_t dayOfWeek, int32_t millis,
+ int32_t monthLength, UErrorCode& status) const;
+
+ /**
+ * Returns the time zone raw and GMT offset for the given moment
+ * in time. Upon return, local-millis = GMT-millis + rawOffset +
+ * dstOffset. All computations are performed in the proleptic
+ * Gregorian calendar. The default implementation in the TimeZone
+ * class delegates to the 8-argument getOffset().
+ *
+ * @param date moment in time for which to return offsets, in
+ * units of milliseconds from January 1, 1970 0:00 GMT, either GMT
+ * time or local wall time, depending on `local'.
+ * @param local if true, `date' is local wall time; otherwise it
+ * is in GMT time.
+ * @param rawOffset output parameter to receive the raw offset, that
+ * is, the offset not including DST adjustments
+ * @param dstOffset output parameter to receive the DST offset,
+ * that is, the offset to be added to `rawOffset' to obtain the
+ * total offset between local and GMT time. If DST is not in
+ * effect, this value is zero; otherwise it is a positive value,
+ * typically one hour.
+ * @param ec input-output error code
+ * @draft ICU 3.8
+ */
+ virtual void getOffset(UDate date, UBool local, int32_t& rawOffset,
+ int32_t& dstOffset, UErrorCode& ec) const;
+
+ /**
+ * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @param offsetMillis The new raw GMT offset for this time zone.
+ * @draft ICU 3.8
+ */
+ virtual void setRawOffset(int32_t offsetMillis);
+
+ /**
+ * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add
+ * to GMT to get local time, before taking daylight savings time into account).
+ *
+ * @return The TimeZone's raw GMT offset.
+ * @draft ICU 3.8
+ */
+ virtual int32_t getRawOffset(void) const;
+
+ /**
+ * Queries if this time zone uses daylight savings time.
+ * @return true if this time zone uses daylight savings time,
+ * false, otherwise.
+ * @draft ICU 3.8
+ */
+ virtual UBool useDaylightTime(void) const;
+
+ /**
+ * Queries if the given date is in daylight savings time in
+ * this time zone.
+ * This method is wasteful since it creates a new GregorianCalendar and
+ * deletes it each time it is called. This is a deprecated method
+ * and provided only for Java compatibility.
+ *
+ * @param date the given UDate.
+ * @param status Output param filled in with success/error code.
+ * @return true if the given date is in daylight savings time,
+ * false, otherwise.
+ * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead.
+ */
+ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const;
+
+ /**
+ * Returns true if this zone has the same rule and offset as another zone.
+ * That is, if this zone differs only in ID, if at all.
+ * @param other the <code>TimeZone</code> object to be compared with
+ * @return true if the given zone is the same as this one,
+ * with the possible exception of the ID
+ * @draft ICU 3.8
+ */
+ virtual UBool hasSameRules(const TimeZone& other) const;
+
+ /**
+ * Gets the first time zone transition after the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the first transition after the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Gets the most recent time zone transition before the base time.
+ * @param base The base time.
+ * @param inclusive Whether the base time is inclusive or not.
+ * @param result Receives the most recent transition before the base time.
+ * @return TRUE if the transition is found.
+ * @draft ICU 3.8
+ */
+ virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/;
+
+ /**
+ * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
+ * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
+ * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
+ * @param status Receives error status code.
+ * @return The number of <code>TimeZoneRule</code>s representing time transitions.
+ * @draft ICU 3.8
+ */
+ virtual int32_t countTransitionRules(UErrorCode& status) /*const*/;
+
+ /**
+ * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
+ * which represent time transitions for this time zone. On successful return,
+ * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+ * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
+ * instances up to the size specified by trscount. The results are referencing the
+ * rule instance held by this time zone instance. Therefore, after this time zone
+ * is destructed, they are no longer available.
+ * @param initial Receives the initial timezone rule
+ * @param trsrules Receives the timezone transition rules
+ * @param trscount On input, specify the size of the array 'transitions' receiving
+ * the timezone transition rules. On output, actual number of
+ * rules filled in the array will be set.
+ * @param status Receives error status code.
+ * @draft ICU 3.8
+ */
+ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
+ const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/;
+
+private:
+ enum { DEFAULT_VTIMEZONE_LINES = 100 };
+
+ /**
+ * Default constructor.
+ */
+ VTimeZone();
+ static VTimeZone* createVTimeZone(VTZReader* reader);
+ void write(VTZWriter& writer, UErrorCode& status) const;
+ void write(UDate start, VTZWriter& writer, UErrorCode& status) /*const*/;
+ void writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) /*const*/;
+ void load(VTZReader& reader, UErrorCode& status);
+ void parse(UErrorCode& status);
+
+ void writeZone(VTZWriter& w, BasicTimeZone& basictz, UVector* customProps,
+ UErrorCode& status) const;
+
+ void writeHeaders(VTZWriter& w, UErrorCode& status) const;
+ void writeFooter(VTZWriter& writer, UErrorCode& status) const;
+
+ void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE,
+ UErrorCode& status) const;
+ void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset,
+ int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime,
+ UErrorCode& status) const;
+ void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset,
+ int32_t month, int32_t weekInMonth, int32_t dayOfWeek,
+ UDate startTime, UDate untilTime, UErrorCode& status) const;
+ void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset,
+ int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ UDate startTime, UDate untilTime, UErrorCode& status) const;
+ void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth,
+ int32_t dayOfWeek, int32_t numDays,
+ UDate untilTime, int32_t fromOffset, UErrorCode& status) const;
+ void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset,
+ int32_t month, int32_t dayOfMonth, int32_t dayOfWeek,
+ UDate startTime, UDate untilTime, UErrorCode& status) const;
+ void writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRule* rule,
+ int32_t fromRawOffset, int32_t fromDSTSavings,
+ UDate startTime, UErrorCode& status) const;
+
+ void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& tzname,
+ int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const;
+ void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const;
+ void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const;
+ void appendUNTIL(VTZWriter& writer, const UnicodeString& until, UErrorCode& status) const;
+
+ BasicTimeZone *tz;
+ UVector *vtzlines;
+ UnicodeString tzurl;
+ UDate lastmod;
+ UnicodeString olsonzid;
+ UnicodeString icutzver;
+
+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.
+ * @draft ICU 3.8
+ */
+ 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.
+ * @draft ICU 3.8
+ */
+ virtual UClassID getDynamicClassID(void) const;
+};
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_FORMATTING */
+
+#endif // VTZONE_H
+//eof