Update ICU to 4.4

* Remove 4.2 sourcecode
 * ICU is now an optional package (mandatory)
 * Adjust the namespaces and libraries names where needed


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37498 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2010-07-13 19:04:40 +00:00
parent 546fac2d14
commit 5098ba1b94
3232 changed files with 9773 additions and 2011716 deletions
-3
View File
@@ -77,8 +77,6 @@ SYSTEM_PREFERENCES = Appearance Backgrounds CPUFrequency DataTranslations
SYSTEM_DEMOS = BSnow Chart Clock Cortex FontDemo
GLTeapot Haiku3d Mandelbrot Pairs Playground Pulse Sudoku
;
ICU_LIBS = libicu-common.so libicu-data.so libicu-i18n.so
;
SYSTEM_LIBS =
libbe.so libbsd.so libbnetapi.so
libdebug.so libdevice.so
@@ -100,7 +98,6 @@ PRIVATE_SYSTEM_LIBS =
libfluidsynth.so
libilmimf.so
liblinprog.so liblpsolve55.so
$(ICU_LIBS)
;
SYSTEM_SERVERS = app_server cddb_daemon debug_server input_server mail_daemon
media_addon_server media_server midi_server mount_server net_server
+47
View File
@@ -45,3 +45,50 @@ if $(HAIKU_BUILD_FEATURE_SSL) {
= [ FDirName $(HAIKU_OPENSSL_DIR) common include ] ;
}
}
# ICU
# Note ICU isn't actually optional, but is still an external package
local isHybridBuild ;
if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1
&& $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
isHybridBuild = 1 ;
}
if $(HAIKU_GCC_VERSION[1]) < 4 && !isHybridBuild) {
HAIKU_ICU_PACKAGE = icu-4.4.1-r1a2-x86-gcc2-2010-07-13-a.zip ;
} else {
HAIKU_ICU_PACKAGE = icu-4.4.1-r1a2-x86-gcc4-2010-07-13-a.zip ;
}
HAIKU_ICU_URL = $(baseURL)/$(HAIKU_ICU_PACKAGE) ;
if $(TARGET_ARCH) != x86 {
Echo "ICU not available for $(TARGET_ARCH)" ;
} else {
local zipFile = [ DownloadFile $(HAIKU_ICU_PACKAGE) : $(HAIKU_ICU_URL) ] ;
# zip file and output directory
HAIKU_ICU_ZIP_FILE = $(zipFile) ;
HAIKU_ICU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
$(HAIKU_ICU_PACKAGE:B) ] ;
# extract headers and libraries
# HAIKU_ICU_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ICU_DIR)
# : common/include/ : $(zipFile) ] ;
HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR)
:
system/lib/libicudata.so
system/lib/libicui18n.so
system/lib/libicuio.so
system/lib/libicule.so
system/lib/libiculx.so
system/lib/libicutu.so
system/lib/libicuuc.so
: $(zipFile)
] ;
HAIKU_ICU_HEADERS
= [ FDirName $(HAIKU_ICU_DIR) common include ] ;
}
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 1996-2009, International Business Machines Corporation and Others.
* Copyright (C) 1996-2010, International Business Machines Corporation and Others.
* All rights reserved.
*/
@@ -14,7 +14,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/ucol.h"
@@ -211,6 +211,7 @@ bms_open(UCD *ucd,
* storage associated with it.
*
* @param bms - the <code>BMS</code> object to close.
* @internal ICU 4.0.1 technology preview
*/
U_CAPI void U_EXPORT2
bms_close(BMS *bms);
+4 -2
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2009, International Business Machines *
* Copyright (C) 1996-2010, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
@@ -16,7 +16,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/uobject.h"
#include "unicode/ucol.h"
@@ -202,10 +202,12 @@ public:
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
virtual UClassID getDynamicClassID() const;
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
static UClassID getStaticClassID();
+3 -3
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2007, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -91,10 +91,10 @@ U_NAMESPACE_BEGIN
* plain C API with equivalent functionality is defined in the
* file ubrk.h
* <p>
* Code snippits illustrating the use of the Break Iterator APIs
* Code snippets illustrating the use of the Break Iterator APIs
* are available in the ICU User Guide,
* http://icu-project.org/userguide/boundaryAnalysis.html
* and in the sample program icu/source/samples/break/break.cpp"
* and in the sample program icu/source/samples/break/break.cpp
*
*/
class U_COMMON_API BreakIterator : public UObject {
+17 -17
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2009, International Business Machines
// Copyright (C) 2009-2010, International Business Machines
// Corporation and others. All Rights Reserved.
//
// Copyright 2007 Google Inc. All Rights Reserved.
@@ -43,18 +43,18 @@ U_NAMESPACE_BEGIN
/**
* A ByteSink can be filled with bytes.
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_COMMON_API ByteSink : public UMemory {
public:
/**
* Default constructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
ByteSink() { }
/**
* Virtual destructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~ByteSink() { }
@@ -62,7 +62,7 @@ public:
* Append "bytes[0,n-1]" to this.
* @param bytes the pointer to the bytes
* @param n the number of bytes; must be non-negative
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void Append(const char* bytes, int32_t n) = 0;
@@ -106,7 +106,7 @@ public:
* @param result_capacity pointer to an integer which will be set to the
* capacity of the returned buffer
* @return a buffer with *result_capacity>=min_capacity
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual char* GetAppendBuffer(int32_t min_capacity,
int32_t desired_capacity_hint,
@@ -118,7 +118,7 @@ public:
* Some byte sinks use internal buffers or provide buffering
* and require calling Flush() at the end of the stream.
* The default implementation of Flush() does nothing.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void Flush();
@@ -137,7 +137,7 @@ private:
* If more than capacity bytes are Append()ed, then excess bytes are ignored,
* and Overflowed() will return true.
* Overflow does not cause a runtime error.
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_COMMON_API CheckedArrayByteSink : public ByteSink {
public:
@@ -145,14 +145,14 @@ public:
* Constructs a ByteSink that will write to outbuf[0..capacity-1].
* @param outbuf buffer to write to
* @param capacity size of the buffer
* @draft ICU 4.2
* @stable ICU 4.2
*/
CheckedArrayByteSink(char* outbuf, int32_t capacity);
/**
* Append "bytes[0,n-1]" to this.
* @param bytes the pointer to the bytes
* @param n the number of bytes; must be non-negative
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void Append(const char* bytes, int32_t n);
/**
@@ -167,7 +167,7 @@ public:
* @param result_capacity pointer to an integer which will be set to the
* capacity of the returned buffer
* @return a buffer with *result_capacity>=min_capacity
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual char* GetAppendBuffer(int32_t min_capacity,
int32_t desired_capacity_hint,
@@ -176,14 +176,14 @@ public:
/**
* Returns the number of bytes actually written to the sink.
* @return number of bytes written to the buffer
* @draft ICU 4.2
* @stable ICU 4.2
*/
int32_t NumberOfBytesWritten() const { return size_; }
/**
* Returns true if any bytes were discarded, i.e., if there was an
* attempt to write more than 'capacity' bytes.
* @return TRUE if more than 'capacity' bytes were Append()ed
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool Overflowed() const { return overflowed_; }
private:
@@ -201,7 +201,7 @@ private:
/**
* Implementation of ByteSink that writes to a "string".
* The StringClass is usually instantiated with a std::string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
template<typename StringClass>
class StringByteSink : public ByteSink {
@@ -209,14 +209,14 @@ class StringByteSink : public ByteSink {
/**
* Constructs a ByteSink that will append bytes to the dest string.
* @param dest pointer to string object to append to
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringByteSink(StringClass* dest) : dest_(dest) { }
/**
* Append "bytes[0,n-1]" to this.
* @param bytes the pointer to the bytes
* @param data the pointer to the bytes
* @param n the number of bytes; must be non-negative
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void Append(const char* data, int32_t n) { dest_->append(data, n); }
private:
+73 -10
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -173,6 +173,12 @@ public:
*/
enum EDateFields {
#ifndef U_HIDE_DEPRECATED_API
/*
* ERA may be defined on other platforms. To avoid any potential problems undefined it here.
*/
#ifdef ERA
#undef ERA
#endif
ERA, // Example: 0..1
YEAR, // Example: 1..big number
MONTH, // Example: 0..11
@@ -192,11 +198,11 @@ public:
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
EXTENDED_YEAR,
JULIAN_DAY,
MILLISECONDS_IN_DAY,
IS_LEAP_MONTH,
EXTENDED_YEAR,
JULIAN_DAY,
MILLISECONDS_IN_DAY,
IS_LEAP_MONTH,
FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
#endif /* U_HIDE_DEPRECATED_API */
@@ -374,7 +380,7 @@ public:
* it will return all the available values for the locale.
* @param status ICU Error Code
* @return a string enumeration over keyword values for the given key and the locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
const Locale& locale, UBool commonlyUsed, UErrorCode& status);
@@ -1184,6 +1190,59 @@ public:
*/
virtual const char * getType() const = 0;
/**
* Returns whether the given day of the week is a weekday, a
* weekend day, or a day that transitions from one to the other,
* in this calendar system. If a transition occurs at midnight,
* then the days before and after the transition will have the
* type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time
* other than midnight, then the day of the transition will have
* the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the
* method getWeekendTransition() will return the point of
* transition.
* @param dayOfWeek The day of the week whose type is desired (UCAL_SUNDAY..UCAL_SATURDAY).
* @param status The error code for the operation.
* @return The UCalendarWeekdayType for the day of the week.
* @draft ICU 4.4
*/
virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
/**
* Returns the time during the day at which the weekend begins or ends in
* this calendar system. If getDayOfWeekType() rerturns UCAL_WEEKEND_ONSET
* for the specified dayOfWeek, return the time at which the weekend begins.
* If getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek,
* return the time at which the weekend ends. If getDayOfWeekType() returns
* some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition
* (U_ILLEGAL_ARGUMENT_ERROR).
* @param dayOfWeek The day of the week for which the weekend transition time is
* desired (UCAL_SUNDAY..UCAL_SATURDAY).
* @param status The error code for the operation.
* @return The milliseconds after midnight at which the weekend begins or ends.
* @draft ICU 4.4
*/
virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
/**
* Returns TRUE if the given UDate is in the weekend in
* this calendar system.
* @param date The UDate in question.
* @param status The error code for the operation.
* @return TRUE if the given UDate is in the weekend in
* this calendar system, FALSE otherwise.
* @draft ICU 4.4
*/
virtual UBool isWeekend(UDate date, UErrorCode &status) const;
/**
* Returns TRUE if this Calendar's current date-time is in the weekend in
* this calendar system.
* @return TRUE if this Calendar's current date-time is in the weekend in
* this calendar system, FALSE otherwise.
* @draft ICU 4.4
*/
virtual UBool isWeekend(void) const;
protected:
/**
@@ -1903,6 +1962,10 @@ private:
*/
UCalendarDaysOfWeek fFirstDayOfWeek;
uint8_t fMinimalDaysInFirstWeek;
UCalendarDaysOfWeek fWeekendOnset;
int32_t fWeekendOnsetMillis;
UCalendarDaysOfWeek fWeekendCease;
int32_t fWeekendCeaseMillis;
/**
* Sets firstDayOfWeek and minimalDaysInFirstWeek. Called at Calendar construction
@@ -1914,7 +1977,7 @@ private:
* the resource for the given locale. Returns U_ZERO_ERROR if
* constructed successfully.
*/
void setWeekCountData(const Locale& desiredLocale, const char *type, UErrorCode& success);
void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
/**
* Recompute the time and update the status fields isTimeSet
@@ -1965,7 +2028,7 @@ private:
*/
void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
protected:
protected:
/**
* Compute the Gregorian calendar year, month, and day of month from the
@@ -1976,7 +2039,7 @@ private:
*/
void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
private:
private:
/**
* Compute the fields WEEK_OF_YEAR, YEAR_WOY, WEEK_OF_MONTH,
+4 -1
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2006, International Business Machines Corporation and *
* Copyright (C) 1996-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -31,6 +31,7 @@
U_NAMESPACE_BEGIN
class Hashtable;
class Normalizer2;
/**
* This class allows one to iterate through all the strings that are canonically equivalent to a given
@@ -174,6 +175,8 @@ private:
// transient fields
UnicodeString buffer;
const Normalizer2 &nfd;
// we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
+60 -57
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2008, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -10,7 +10,7 @@
*
* Date Name Description
* 02/19/97 aliu Converted from java.
* 03/20/97 helena Finished first cut of implementation and got rid
* 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.
@@ -18,17 +18,17 @@
* 07/22/98 stephen Removed operator!= (implemented in Format)
********************************************************************************
*/
#ifndef CHOICFMT_H
#define CHOICFMT_H
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Choice Format.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/unistr.h"
@@ -48,32 +48,32 @@ class MessageFormat;
* 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
@@ -81,14 +81,14 @@ class MessageFormat;
* 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
@@ -103,15 +103,15 @@ class MessageFormat;
* 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
@@ -127,19 +127,19 @@ class MessageFormat;
* <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
@@ -147,14 +147,14 @@ class MessageFormat;
* 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
@@ -163,39 +163,39 @@ class MessageFormat;
* [-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[] = {
@@ -214,17 +214,17 @@ class MessageFormat;
* 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};
@@ -280,7 +280,7 @@ public:
* @param count Size of 'limits' and 'formats' arrays.
* @stable ICU 2.0
*/
ChoiceFormat(const double* limits,
const UnicodeString* formats,
int32_t count );
@@ -342,8 +342,8 @@ public:
* 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.
* @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;
@@ -362,7 +362,7 @@ public:
/**
* Sets the pattern.
* @param pattern The pattern to be applied.
* @param parseError Struct to recieve information on position
* @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
@@ -374,7 +374,7 @@ public:
UErrorCode& status);
/**
* Gets the pattern.
*
*
* @param pattern Output param which will recieve the pattern
* Previous contents are deleted.
* @return A reference to 'pattern'
@@ -396,7 +396,7 @@ public:
*/
virtual void setChoices(const double* limitsToCopy,
const UnicodeString* formatsToCopy,
int32_t count );
int32_t count );
/**
* Set the choices to be used in formatting. See class description
@@ -420,7 +420,7 @@ public:
* @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.
@@ -440,6 +440,9 @@ public:
*/
virtual const UnicodeString* getFormats(int32_t& count) const;
// using NumberFormat::format;
/**
* Format a double or long number using this object's choices.
*
@@ -494,7 +497,7 @@ public:
* @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.
* exit.
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
@@ -513,13 +516,13 @@ public:
* @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.
* exit.
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPosition& pos,
FieldPosition& pos,
UErrorCode& status) const;
/**
@@ -529,7 +532,7 @@ public:
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param status Output param set to success/failure code on
* exit.
* exit.
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
@@ -586,7 +589,7 @@ public:
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
@@ -606,8 +609,8 @@ public:
virtual void parse(const UnicodeString& text,
Formattable& result,
UErrorCode& status) const;
public:
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual override.
@@ -639,7 +642,7 @@ 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).
@@ -664,7 +667,7 @@ private:
* based on the pattern.
*
* @param newPattern Pattern used to construct object.
* @param parseError Struct to recieve information on position
* @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.
@@ -717,7 +720,7 @@ private:
UnicodeString* fChoiceFormats;
int32_t fCount;
};
inline UnicodeString&
ChoiceFormat::format(const Formattable& obj,
UnicodeString& appendTo,
+4 -4
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2009, International Business Machines *
* Copyright (C) 1996-2010, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
@@ -448,7 +448,7 @@ public:
* @param tIter the second ("target") string iterator
* @param status ICU status
* @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UCollationResult compare(UCharIterator &sIter,
UCharIterator &tIter,
@@ -465,7 +465,7 @@ public:
* @param target the second UTF-8 string
* @param status ICU status
* @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UCollationResult compareUTF8(const StringPiece &source,
const StringPiece &target,
@@ -682,7 +682,7 @@ public:
* it will return all the available values for the locale.
* @param status ICU status
* @return a string enumeration over keyword values for the given key and the locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* keyword, const Locale& locale,
UBool commonlyUsed, UErrorCode& status);
+16 -1
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2009, International Business Machines *
* Copyright (C) 1996-2010, International Business Machines *
* Corporation and others. All Rights Reserved. *
******************************************************************************
*/
@@ -25,28 +25,35 @@ U_NAMESPACE_BEGIN
/**
* The size of the internal buffer for the Collator's short description string.
* @internal ICU 4.0.1 technology preview
*/
#define KEY_BUFFER_SIZE 64
/**
* The size of the internal CE buffer in a <code>CEList</code> object
* @internal ICU 4.0.1 technology preview
*/
#define CELIST_BUFFER_SIZE 4
/**
* \def INSTRUMENT_CELIST
* Define this to enable the <code>CEList</code> objects to collect
* statistics.
* @internal ICU 4.0.1 technology preview
*/
//#define INSTRUMENT_CELIST
/**
* The size of the initial list in a <code>StringList</code> object.
* @internal ICU 4.0.1 technology preview
*/
#define STRING_LIST_BUFFER_SIZE 16
/**
* \def INSTRUMENT_STRING_LIST
* Define this to enable the <code>StringList</code> objects to
* collect statistics.
* @internal ICU 4.0.1 technology preview
*/
//#define INSTRUMENT_STRING_LIST
@@ -76,6 +83,7 @@ public:
/**
* The destructor.
* @internal ICU 4.0.1 technology preview
*/
~CEList();
@@ -125,10 +133,12 @@ public:
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
virtual UClassID getDynamicClassID() const;
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
static UClassID getStaticClassID();
@@ -220,10 +230,12 @@ public:
/**
* the UObject glue...
* @internal ICU 4.0.1 technology preview
*/
virtual UClassID getDynamicClassID() const;
/**
* the UObject glue...
* @internal ICU 4.0.1 technology preview
*/
static UClassID getStaticClassID();
@@ -297,6 +309,7 @@ public:
* Get the <code>UCollator</code> object used to create this object.
* The object returned may not be the exact object that was used to
* create this object, but it will have the same behavior.
* @internal ICU 4.0.1 technology preview
*/
UCollator *getCollator() const;
@@ -373,10 +386,12 @@ public:
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
virtual UClassID getDynamicClassID() const;
/**
* UObject glue...
* @internal ICU 4.0.1 technology preview
*/
static UClassID getStaticClassID();
+18 -18
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2009, International Business Machines Corporation and *
* Copyright (C) 2009-2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -41,7 +41,7 @@ class Hashtable;
* plural rule of the locale,
* currency plural pattern of the locale.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_I18N_API CurrencyPluralInfo : public UObject {
public:
@@ -49,7 +49,7 @@ public:
/**
* Create a CurrencyPluralInfo object for the default locale.
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
CurrencyPluralInfo(UErrorCode& status);
@@ -57,14 +57,14 @@ public:
* Create a CurrencyPluralInfo object for the given locale.
* @param locale the locale
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
CurrencyPluralInfo(const Locale& locale, UErrorCode& status);
/**
* Copy constructor
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
CurrencyPluralInfo(const CurrencyPluralInfo& info);
@@ -72,7 +72,7 @@ public:
/**
* Assignment operator
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info);
@@ -80,7 +80,7 @@ public:
/**
* Destructor
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~CurrencyPluralInfo();
@@ -88,7 +88,7 @@ public:
/**
* Equal operator.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool operator==(const CurrencyPluralInfo& info) const;
@@ -96,7 +96,7 @@ public:
/**
* Not equal operator
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool operator!=(const CurrencyPluralInfo& info) const;
@@ -104,7 +104,7 @@ public:
/**
* Clone
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
CurrencyPluralInfo* clone() const;
@@ -113,7 +113,7 @@ public:
* Gets plural rules of this locale, used for currency plural format
*
* @return plural rule
* @draft ICU 4.2
* @stable ICU 4.2
*/
const PluralRules* getPluralRules() const;
@@ -124,7 +124,7 @@ public:
* @param pluralCount currency plural count
* @param result output param to receive the pattern
* @return a currency plural pattern based on plural count
* @draft ICU 4.2
* @stable ICU 4.2
*/
UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount,
UnicodeString& result) const;
@@ -133,7 +133,7 @@ public:
* Get locale
*
* @return locale
* @draft ICU 4.2
* @stable ICU 4.2
*/
const Locale& getLocale() const;
@@ -146,7 +146,7 @@ public:
*
* @param ruleDescription new plural rule description
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setPluralRules(const UnicodeString& ruleDescription,
UErrorCode& status);
@@ -162,7 +162,7 @@ public:
* be overridden.
* @param pattern the new currency plural pattern
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setCurrencyPluralPattern(const UnicodeString& pluralCount,
const UnicodeString& pattern,
@@ -173,21 +173,21 @@ public:
*
* @param loc the new locale to set
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setLocale(const Locale& loc, UErrorCode& status);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UClassID getDynamicClassID() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UClassID U_EXPORT2 getStaticClassID();
+69 -8
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -30,7 +30,7 @@
#include "unicode/locid.h"
/**
* \file
* \file
* \brief C++ API: Abstract class for converting dates.
*/
@@ -141,7 +141,7 @@ public:
/**
* Constants for various style patterns. These reflect the order of items in
* the DateTimePatterns resource. There are 4 time patterns, 4 date patterns,
* the default date-time pattern, and 4 date-time patterns. Each block of 4 values
* the default date-time pattern, and 4 date-time patterns. Each block of 4 values
* in the resource occurs in the order full, long, medium, short.
* @stable ICU 2.4
*/
@@ -171,15 +171,15 @@ public:
// relative dates
kRelative = (1 << 7),
kFullRelative = (kFull | kRelative),
kLongRelative = kLong | kRelative,
kMediumRelative = kMedium | kRelative,
kShortRelative = kShort | kRelative,
kDefault = kMedium,
@@ -211,6 +211,9 @@ public:
*/
virtual UBool operator==(const Format&) const;
// using Format::format;
/**
* 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,
@@ -230,6 +233,25 @@ public:
FieldPosition& pos,
UErrorCode& status) 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField. Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Formats a date into a date/time string. This is an abstract method which
* concrete subclasses must implement.
@@ -267,6 +289,28 @@ public:
UnicodeString& appendTo,
FieldPosition& fieldPosition) const = 0;
/**
* Formats a date into a date/time string. Subclasses should implement this method.
*
* @param cal Calendar set to the date and time to be formatted
* into a date/time string. When the calendar type is
* different from the internal calendar held by this
* DateFormat instance, the date and the time zone will
* be inherited from the input calendar, but other calendar
* field values will be calculated by the internal calendar.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField. Can be NULL.
* @param status error status.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
virtual UnicodeString& format(Calendar& cal,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Formats a UDate into a date/time string.
* <P>
@@ -298,6 +342,23 @@ public:
UnicodeString& appendTo,
FieldPosition& fieldPosition) const;
/**
* Formats a UDate into a date/time string.
*
* @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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField. Can be NULL.
* @param status error status.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
UnicodeString& format(UDate date,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) 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
+4 -4
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -201,7 +201,7 @@ public:
/**
* 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.
* (characters with modifier letters) can be used.
*
* @param symbol Constant to indicate a number format symbol.
* @return the format symbols by the param 'symbol'
@@ -212,10 +212,10 @@ public:
/**
* 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.
* (characters with modifier letters) can be used.
*
* @param symbol Constant to indicate a number format symbol.
* @param value value of the format sybmol
* @param value value of the format symbol
* @stable ICU 2.0
*/
void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value);
+225 -102
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -20,44 +20,33 @@
* 07/20/98 stephen Changed documentation
********************************************************************************
*/
#ifndef DECIMFMT_H
#define DECIMFMT_H
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Formats decimal numbers.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/dcfmtsym.h"
#include "unicode/numfmt.h"
#include "unicode/locid.h"
#include "unicode/fpositer.h"
#include "unicode/stringpiece.h"
union UHashTok;
U_NAMESPACE_BEGIN
U_CDECL_BEGIN
/**
* @internal ICU 4.2
*/
UBool U_CALLCONV decimfmtAffixValueComparator(UHashTok val1, UHashTok val2) ;
/**
* @internal ICU 4.2
*/
UBool U_CALLCONV decimfmtAffixPatternValueComparator(UHashTok val1, UHashTok val2) ;
U_CDECL_END
class DigitList;
class ChoiceFormat;
class CurrencyPluralInfo;
class Hashtable;
class FieldPositionHandler;
/**
* DecimalFormat is a concrete subclass of NumberFormat that formats decimal
@@ -80,11 +69,11 @@ class Hashtable;
* // 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;
@@ -113,7 +102,7 @@ class Hashtable;
* cout << locales[i].getDisplayName(displayName) << ": " << pattern;
* cout << " -> " << form->format(myNumber,str) << endl;
* form->parse(form->format(myNumber,str), fmtable, success);
* delete form;
* delete form;
* }
* }
* }
@@ -130,14 +119,14 @@ class Hashtable;
* UErrorCode success = U_ZERO_ERROR;
* UnicodeString str;
* Formattable fmtable;
* for (int j=NumberFormat::kNumberStyle;
* j<=NumberFormat::kPluralCurrencyStyle;
* for (int j=NumberFormat::kNumberStyle;
* j<=NumberFormat::kPluralCurrencyStyle;
* ++j) {
* NumberFormat* format = NumberFormat::createInstance(locale, j, success);
* str.remove();
* cout << "format result " << form->format(myNumber, str) << endl;
* format->parse(form->format(myNumber, str), fmtable, success);
* }</pre></blockquote>
* }</pre>
*
*
* <p><strong>Patterns</strong>
@@ -149,7 +138,7 @@ class Hashtable;
* 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
@@ -329,7 +318,7 @@ class Hashtable;
* </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
@@ -344,7 +333,7 @@ class Hashtable;
* 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.
*
@@ -365,7 +354,7 @@ class Hashtable;
*
* <p>For currency parsing, the formatter is able to parse every currency
* style formats no matter which style the formatter is constructed with.
* For example, a formatter instance gotten from
* For example, a formatter instance gotten from
* NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse
* formats such as "USD1.00" and "3.00 US dollars".
*
@@ -763,7 +752,7 @@ public:
* @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 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
@@ -795,7 +784,7 @@ public:
/**
* Copy constructor.
*
*
* @param source the DecimalFormat object to be copied from.
* @stable ICU 2.0
*/
@@ -834,6 +823,9 @@ public:
*/
virtual UBool operator==(const Format& other) const;
// using NumberFormat::format;
/**
* Format a double or long number using base-10 representation.
*
@@ -844,10 +836,29 @@ public:
* 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 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(double number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a long number using base-10 representation.
*
@@ -862,6 +873,25 @@ public:
virtual UnicodeString& format(int32_t 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(int32_t number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format an int64 number using base-10 representation.
*
@@ -877,6 +907,87 @@ public:
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 posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(int64_t number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
* The syntax of the unformatted number is a "numeric string"
* as defined in the Decimal Arithmetic Specification, available at
* http://speleotrove.com/decimal
*
* @param number The unformatted number, as a string.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(const StringPiece &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
* The number is a DigitList wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that.
*
* @param number The number, a DigitList format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @internal
*/
virtual UnicodeString& format(const DigitList &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
* The number is a DigitList wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that.
*
* @param number The number, a DigitList format Decimal Floating Point.
* @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.
* @internal
*/
virtual UnicodeString& format(const DigitList &number,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
/**
* Format a Formattable using base-10 representation.
*
@@ -973,7 +1084,7 @@ public:
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.
@@ -981,8 +1092,8 @@ public:
* @param status Output parameter filled in with success or failure status.
* @stable ICU 2.0
*/
virtual void parse(const UnicodeString& text,
Formattable& result,
virtual void parse(const UnicodeString& text,
Formattable& result,
UErrorCode& status) const;
/**
@@ -1035,26 +1146,26 @@ public:
/**
* Returns the currency plural format information,
* Returns the currency plural format information,
* which is generally not changed by the programmer or user.
* @return desired CurrencyPluralInfo
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const;
/**
* Sets the currency plural format information,
* Sets the currency plural format information,
* which is generally not changed by the programmer or user.
* @param toAdopt CurrencyPluralInfo to be adopted.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt);
/**
* Sets the currency plural format information,
* Sets the currency plural format information,
* which is generally not changed by the programmer or user.
* @param info Currency Plural Info.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info);
@@ -1483,7 +1594,7 @@ public:
* @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.
@@ -1506,7 +1617,7 @@ public:
* 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
* @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
@@ -1523,7 +1634,7 @@ public:
* 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);
@@ -1550,7 +1661,7 @@ public:
* 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
* @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
@@ -1578,7 +1689,7 @@ public:
* 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
* @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
@@ -1588,8 +1699,8 @@ public:
/**
* 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
*
* @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
@@ -1600,7 +1711,7 @@ public:
* 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
* @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
@@ -1611,7 +1722,7 @@ public:
* 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
* @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
@@ -1642,7 +1753,7 @@ public:
* 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
* @param min the fewest significant digits to be shown
* @stable ICU 3.0
*/
void setMinimumSignificantDigits(int32_t min);
@@ -1654,7 +1765,7 @@ public:
* 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
* @param max the most significant digits to be shown
* @stable ICU 3.0
*/
void setMaximumSignificantDigits(int32_t max);
@@ -1734,12 +1845,16 @@ public:
virtual UClassID getDynamicClassID(void) const;
private:
friend UBool U_CALLCONV decimfmtAffixValueComparator(UHashTok val1, UHashTok val2);
friend UBool U_CALLCONV decimfmtAffixPatternValueComparator(UHashTok val1, UHashTok val2);
DecimalFormat(); // default constructor not implemented
int32_t precision(UBool isIntegral) const;
int32_t precision() const;
/**
* Initialize all fields of a new DecimalFormatter.
* Common code for use by constructors.
*/
void init();
/**
* Do real work of constructing a new DecimalFormat.
@@ -1764,7 +1879,7 @@ private:
* 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
* @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
@@ -1775,8 +1890,8 @@ private:
UParseError& parseError,
UErrorCode& status);
/*
* similar to applyPattern, but without re-gen affix for currency
/*
* similar to applyPattern, but without re-gen affix for currency
*/
void applyPatternInternally(const UnicodeString& pluralCount,
const UnicodeString& pattern,
@@ -1798,22 +1913,21 @@ private:
*/
void expandAffixAdjustWidth(const UnicodeString* pluralCount);
/**
* 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 handler Records information about field positions.
* @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;
FieldPositionHandler& handler,
DigitList& digits,
UBool isInteger) const;
void parse(const UnicodeString& text,
@@ -1826,7 +1940,7 @@ private:
fgStatusLength // Leave last in list.
} StatusFlags;
UBool subparse(const UnicodeString& text,
UBool subparse(const UnicodeString& text,
const UnicodeString* negPrefix,
const UnicodeString* negSuffix,
const UnicodeString* posPrefix,
@@ -1838,11 +1952,11 @@ private:
UChar* currency) const;
// Mixed style parsing for currency.
// It parses against the current currency pattern
// It parses against the current currency pattern
// using complex affix comparison
// parses against the currency plural patterns using complex affix comparison,
// and parses against the current pattern using simple affix comparison.
UBool parseForCurrency(const UnicodeString& text,
UBool parseForCurrency(const UnicodeString& text,
ParsePosition& parsePosition,
DigitList& digits,
UBool* status,
@@ -1858,15 +1972,15 @@ private:
UBool currencyParsing,
int8_t type,
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,
@@ -1884,8 +1998,11 @@ private:
*/
inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumberFormatSymbol symbol) const;
int32_t appendAffix(UnicodeString& buf, double number,
UBool isNegative, UBool isPrefix) const;
int32_t appendAffix(UnicodeString& buf,
double number,
FieldPositionHandler& handler,
UBool isNegative,
UBool isPrefix) const;
/**
* Append an affix to the given UnicodeString, using quotes if
@@ -1902,15 +2019,14 @@ private:
void expandAffix(const UnicodeString& pattern,
UnicodeString& affix,
double number,
FieldPositionHandler& handler,
UBool doFormat,
const UnicodeString* pluralCount) const;
void expandAffixes(const UnicodeString* pluralCount);
static double round(double a, ERoundingMode mode, UBool isNegative);
void addPadding(UnicodeString& appendTo,
FieldPosition& fieldPosition,
FieldPositionHandler& handler,
int32_t prefixLen, int32_t suffixLen) const;
UBool isGroupingPosition(int32_t pos) const;
@@ -1919,7 +2035,7 @@ private:
// similar to setCurrency without re-compute the affixes for currency.
// If currency changes, the affix pattern for currency is not changed,
// but the affix will be changed. So, affixes need to be
// but the affix will be changed. So, affixes need to be
// re-computed in setCurrency(), but not in setCurrencyInternally().
virtual void setCurrencyInternally(const UChar* theCurrency, UErrorCode& ec);
@@ -1931,13 +2047,13 @@ private:
// set up the currency affixes used in currency plural formatting.
// It sets up both fAffixesForCurrency for currency pattern if the current
// pattern contains 3 currency signs,
// pattern contains 3 currency signs,
// and it sets up fPluralAffixesForCurrency for currency plural patterns.
void setupCurrencyAffixes(const UnicodeString& pattern,
void setupCurrencyAffixes(const UnicodeString& pattern,
UBool setupForCurrentPattern,
UBool setupForPluralPattern,
UErrorCode& status);
// hashtable operations
Hashtable* initHashForAffixPattern(UErrorCode& status);
Hashtable* initHashForAffix(UErrorCode& status);
@@ -1950,6 +2066,17 @@ private:
void copyHashForAffix(const Hashtable* source,
Hashtable* target, UErrorCode& status);
UnicodeString& _format(int64_t number,
UnicodeString& appendTo,
FieldPositionHandler& handler) const;
UnicodeString& _format(double number,
UnicodeString& appendTo,
FieldPositionHandler& handler) const;
UnicodeString& _format(const DigitList &number,
UnicodeString& appendTo,
FieldPositionHandler& handler,
UErrorCode &status) const;
// currency sign count
enum {
fgCurrencySignCountZero,
@@ -1961,9 +2088,6 @@ private:
/**
* Constants.
*/
//static const int8_t fgMaxDigit; // The largest digit, in this case 9
/*transient*/ //DigitList* fDigitList;
UnicodeString fPositivePrefix;
UnicodeString fPositiveSuffix;
@@ -1981,7 +2105,7 @@ private:
*/
ChoiceFormat* fCurrencyChoice;
int32_t fMultiplier;
DigitList * fMultiplier; // NULL for multiplier of one
int32_t fGroupingSize;
int32_t fGroupingSize2;
UBool fDecimalSeparatorAlwaysShown;
@@ -1995,12 +2119,7 @@ private:
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;
DigitList* fRoundingIncrement; // NULL if no rounding increment specified.
ERoundingMode fRoundingMode;
UChar32 fPad;
@@ -2029,12 +2148,13 @@ private:
/* For currency parsing purose,
* Need to remember all prefix patterns and suffix patterns of
* every currency format pattern,
* Need to remember all prefix patterns and suffix patterns of
* every currency format pattern,
* including the pattern of default currecny style
* and plural currency style. And the patterns are set through applyPattern.
*/
// TODO: innerclass?
/* This is not needed in the class declaration, so it is moved into decimfmp.cpp
struct AffixPatternsForCurrency : public UMemory {
// negative prefix pattern
UnicodeString negPrefixPatternForCurrency;
@@ -2045,8 +2165,8 @@ private:
// positive suffix pattern
UnicodeString posSuffixPatternForCurrency;
int8_t patternType;
AffixPatternsForCurrency(const UnicodeString& negPrefix,
AffixPatternsForCurrency(const UnicodeString& negPrefix,
const UnicodeString& negSuffix,
const UnicodeString& posPrefix,
const UnicodeString& posSuffix,
@@ -2058,11 +2178,13 @@ private:
patternType = type;
}
};
*/
/* affix for currency formatting when the currency sign in the pattern
* equals to 3, such as the pattern contains 3 currency sign or
* equals to 3, such as the pattern contains 3 currency sign or
* the formatter style is currency plural format style.
*/
/* This is not needed in the class declaration, so it is moved into decimfmp.cpp
struct AffixesForCurrency : public UMemory {
// negative prefix
UnicodeString negPrefixForCurrency;
@@ -2072,7 +2194,7 @@ private:
UnicodeString posPrefixForCurrency;
// positive suffix
UnicodeString posSuffixForCurrency;
int32_t formatWidth;
AffixesForCurrency(const UnicodeString& negPrefix,
@@ -2085,11 +2207,12 @@ private:
posSuffixForCurrency = posSuffix;
}
};
*/
// Affix pattern set for currency.
// It is a set of AffixPatternsForCurrency,
// each element of the set saves the negative prefix pattern,
// negative suffix pattern, positive prefix pattern,
// negative suffix pattern, positive prefix pattern,
// and positive suffix pattern of a pattern.
// It is used for currency mixed style parsing.
// It is actually is a set.
@@ -2126,13 +2249,13 @@ protected:
*/
virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const;
/** number of integer digits
/** number of integer digits
* @stable ICU 2.4
*/
*/
static const int32_t kDoubleIntegerDigits;
/** number of fraction digits
/** number of fraction digits
* @stable ICU 2.4
*/
*/
static const int32_t kDoubleFractionDigits;
/**
+39 -5
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2008, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -214,11 +214,11 @@ public:
void setEraNames(const UnicodeString* eraNames, int32_t count);
/**
* Gets narrow era strings. For example: A" and "D".
* Gets narrow era strings. For example: "A" and "B".
*
* @param count Filled in with length of the array.
* @return the narrow era strings.
* @draft ICU 4.2
* @stable ICU 4.2
*/
const UnicodeString* getNarrowEras(int32_t& count) const;
@@ -226,7 +226,7 @@ public:
* Sets narrow era strings. For example: "A" and "B".
* @param narrowEras Array of narrow era strings (DateFormatSymbols retains ownership.)
* @param count Filled in with length of the array.
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setNarrowEras(const UnicodeString* narrowEras, int32_t count);
@@ -590,7 +590,41 @@ private:
int32_t fStandaloneShortQuartersCount;
/**
* The format data of all the timezones in this locale.
* Localized names of time zones in this locale. This is a
* two-dimensional array of strings of size n by m,
* where m is at least 5 and up to 7. Each of the n rows is an
* entry containing the localized names for a single TimeZone.
*
* Each such row contains (with i ranging from 0..n-1):
*
* zoneStrings[i][0] - time zone ID
* example: America/Los_Angeles
* zoneStrings[i][1] - long name of zone in standard time
* example: Pacific Standard Time
* zoneStrings[i][2] - short name of zone in standard time
* example: PST
* zoneStrings[i][3] - long name of zone in daylight savings time
* example: Pacific Daylight Time
* zoneStrings[i][4] - short name of zone in daylight savings time
* example: PDT
* zoneStrings[i][5] - location name of zone
* example: United States (Los Angeles)
* zoneStrings[i][6] - long generic name of zone
* example: Pacific Time
* zoneStrings[i][7] - short generic of zone
* example: PT
*
* The zone ID is not localized; it corresponds to the ID
* value associated with a system time zone object. All other entries
* are localized names. If a zone does not implement daylight savings
* time, the daylight savings time names are ignored.
*
* Note:CLDR 1.5 introduced metazone and its historical mappings.
* This simple two-dimensional array is no longer sufficient to represent
* localized names and its historic changes. Since ICU 3.8.1, localized
* zone names extracted from ICU locale data is stored in a ZoneStringFormat
* instance. But we still need to support the old way of customizing
* localized zone names, so we keep this field for the purpose.
*/
UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings
UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale
+142 -144
View File
@@ -1,5 +1,6 @@
/********************************************************************************
* Copyright (C) 2008-2009, International Business Machines Corporation and others. All Rights Reserved.
* Copyright (C) 2008-2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
* File DTITVFMT.H
@@ -14,10 +15,10 @@
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Format and parse date interval in a language-independent manner.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/ucal.h"
@@ -31,35 +32,34 @@ U_NAMESPACE_BEGIN
/**
* DateIntervalFormat is a class for formatting and parsing date
* intervals in a language-independent manner.
* Date interval formatting is supported in Gregorian calendar only.
* And only formatting is supported. Parsing is not supported.
* DateIntervalFormat is a class for formatting and parsing date
* intervals in a language-independent manner.
* Only formatting is supported, parsing is not supported.
*
* <P>
* Date interval means from one date to another date,
* for example, from "Jan 11, 2008" to "Jan 18, 2008".
* We introduced class DateInterval to represent it.
* DateInterval is a pair of UDate, which is
* DateInterval is a pair of UDate, which is
* the standard milliseconds since 24:00 GMT, Jan 1, 1970.
*
* <P>
* DateIntervalFormat formats a DateInterval into
* text as compactly as possible.
* text as compactly as possible.
* For example, the date interval format from "Jan 11, 2008" to "Jan 18,. 2008"
* is "Jan 11-18, 2008" for English.
* And it parses text into DateInterval,
* although initially, parsing is not supported.
* And it parses text into DateInterval,
* although initially, parsing is not supported.
*
* <P>
* There is no structural information in date time patterns.
* For any punctuations and string literals inside a date time pattern,
* we do not know whether it is just a separator, or a prefix, or a suffix.
* Without such information, so, it is difficult to generate a sub-pattern
* There is no structural information in date time patterns.
* For any punctuations and string literals inside a date time pattern,
* we do not know whether it is just a separator, or a prefix, or a suffix.
* Without such information, so, it is difficult to generate a sub-pattern
* (or super-pattern) by algorithm.
* So, formatting a DateInterval is pattern-driven. It is very
* similar to formatting in SimpleDateFormat.
* We introduce class DateIntervalInfo to save date interval
* We introduce class DateIntervalInfo to save date interval
* patterns, similar to date time pattern in SimpleDateFormat.
*
* <P>
@@ -68,26 +68,26 @@ U_NAMESPACE_BEGIN
* to (date_interval_pattern).
*
* <P>
* A skeleton
* A skeleton
* <ol>
* <li>
* only keeps the field pattern letter and ignores all other parts
* only keeps the field pattern letter and ignores all other parts
* in a pattern, such as space, punctuations, and string literals.
* </li>
* <li>
* hides the order of fields.
* hides the order of fields.
* </li>
* <li>
* might hide a field's pattern letter length.
* </li>
* </ol>
*
* For those non-digit calendar fields, the pattern letter length is
* important, such as MMM, MMMM, and MMMMM; EEE and EEEE,
* For those non-digit calendar fields, the pattern letter length is
* important, such as MMM, MMMM, and MMMMM; EEE and EEEE,
* and the field's pattern letter length is honored.
*
* For the digit calendar fields, such as M or MM, d or dd, yy or yyyy,
* the field pattern length is ignored and the best match, which is defined
*
* For the digit calendar fields, such as M or MM, d or dd, yy or yyyy,
* the field pattern length is ignored and the best match, which is defined
* in date time patterns, will be returned without honor the field pattern
* letter length in skeleton.
*
@@ -95,34 +95,34 @@ U_NAMESPACE_BEGIN
* The calendar fields we support for interval formatting are:
* year, month, date, day-of-week, am-pm, hour, hour-of-day, and minute.
* Those calendar fields can be defined in the following order:
* year > month > date > hour (in day) > minute
*
* year > month > date > hour (in day) > minute
*
* The largest different calendar fields between 2 calendars is the
* first different calendar field in above order.
*
* For example: the largest different calendar fields between "Jan 10, 2007"
* For example: the largest different calendar fields between "Jan 10, 2007"
* and "Feb 20, 2008" is year.
*
* <P>
* For other calendar fields, the compact interval formatting is not
* supported. And the interval format will be fall back to fall-back
* patterns, which is mostly "{date0} - {date1}".
*
*
* <P>
* There is a set of pre-defined static skeleton strings.
* There are pre-defined interval patterns for those pre-defined skeletons
* in locales' resource files.
* For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is "yMMMd",
* in en_US, if the largest different calendar field between date1 and date2
* is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy",
* such as "Jan 10, 2007 - Jan 10, 2008".
* If the largest different calendar field between date1 and date2 is "month",
* the date interval pattern is "MMM d - MMM d, yyyy",
* such as "Jan 10 - Feb 10, 2007".
* If the largest different calendar field between date1 and date2 is "day",
* the date interval pattern is ""MMM d-d, yyyy", such as "Jan 10-20, 2007".
* For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is &quot;yMMMd&quot;,
* in en_US, if the largest different calendar field between date1 and date2
* is &quot;year&quot;, the date interval pattern is &quot;MMM d, yyyy - MMM d, yyyy&quot;,
* such as &quot;Jan 10, 2007 - Jan 10, 2008&quot;.
* If the largest different calendar field between date1 and date2 is &quot;month&quot;,
* the date interval pattern is &quot;MMM d - MMM d, yyyy&quot;,
* such as &quot;Jan 10 - Feb 10, 2007&quot;.
* If the largest different calendar field between date1 and date2 is &quot;day&quot;,
* the date interval pattern is &quot;MMM d-d, yyyy&quot;, such as &quot;Jan 10-20, 2007&quot;.
*
* For date skeleton, the interval patterns when year, or month, or date is
* For date skeleton, the interval patterns when year, or month, or date is
* different are defined in resource files.
* For time skeleton, the interval patterns when am/pm, or hour, or minute is
* different are defined in resource files.
@@ -130,60 +130,60 @@ U_NAMESPACE_BEGIN
* <P>
* If a skeleton is not found in a locale's DateIntervalInfo, which means
* the interval patterns for the skeleton is not defined in resource file,
* the interval pattern will falls back to the interval "fallback" pattern
* the interval pattern will falls back to the interval "fallback" pattern
* defined in resource file.
* If the interval "fallback" pattern is not defined, the default fall-back
* is "{date0} - {data1}".
*
* <P>
* For the combination of date and time,
* For the combination of date and time,
* The rule to generate interval patterns are:
* <ol>
* <li>
* when the year, month, or day differs, falls back to fall-back
* interval pattern, which mostly is the concatenate the two original
* expressions with a separator between,
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 11, 2007 10:10am" is
* "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am"
* interval pattern, which mostly is the concatenate the two original
* expressions with a separator between,
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 11, 2007 10:10am" is
* "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am"
* </li>
* <li>
* otherwise, present the date followed by the range expression
* otherwise, present the date followed by the range expression
* for the time.
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 10, 2007 11:10am" is "Jan 10, 2007 10:10 am - 11:10am"
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 10, 2007 11:10am" is "Jan 10, 2007 10:10 am - 11:10am"
* </li>
* </ol>
*
*
* <P>
* If two dates are the same, the interval pattern is the single date pattern.
* For example, interval pattern from "Jan 10, 2007" to "Jan 10, 2007" is
* For example, interval pattern from "Jan 10, 2007" to "Jan 10, 2007" is
* "Jan 10, 2007".
*
* Or if the presenting fields between 2 dates have the exact same values,
* the interval pattern is the single date pattern.
* the interval pattern is the single date pattern.
* For example, if user only requests year and month,
* the interval pattern from "Jan 10, 2007" to "Jan 20, 2007" is "Jan 2007".
*
* <P>
* DateIntervalFormat needs the following information for correct
* formatting: time zone, calendar type, pattern, date format symbols,
* DateIntervalFormat needs the following information for correct
* formatting: time zone, calendar type, pattern, date format symbols,
* and date interval patterns.
* It can be instantiated in 2 ways:
* <ol>
* <li>
* create an instance using default or given locale plus given skeleton.
* Users are encouraged to created date interval formatter this way and
* Users are encouraged to created date interval formatter this way and
* to use the pre-defined skeleton macros, such as
* UDAT_YEAR_NUM_MONTH, which consists the calendar fields and
* the format style.
* the format style.
* </li>
* <li>
* create an instance using default or given locale plus given skeleton
* plus a given DateIntervalInfo.
* This factory method is for powerful users who want to provide their own
* interval patterns.
* This factory method is for powerful users who want to provide their own
* interval patterns.
* Locale provides the timezone, calendar, and format symbols information.
* Local plus skeleton provides full pattern information.
* DateIntervalInfo provides the date interval patterns.
@@ -194,7 +194,7 @@ U_NAMESPACE_BEGIN
* For the calendar field pattern letter, such as G, y, M, d, a, h, H, m, s etc.
* DateIntervalFormat uses the same syntax as that of
* DateTime format.
*
*
* <P>
* Code Sample: general usage
* <pre>
@@ -204,7 +204,7 @@ U_NAMESPACE_BEGIN
* DateInterval* dtInterval = new DateInterval(1000*3600*24, 1000*3600*24*2);
* UErrorCode status = U_ZERO_ERROR;
* DateIntervalFormat* dtIntervalFmt = DateIntervalFormat::createInstance(
* UDAT_YEAR_MONTH_DAY,
* UDAT_YEAR_MONTH_DAY,
* Locale("en", "GB", ""), status);
* UnicodeUnicodeString dateIntervalString;
* FieldPosition pos = 0;
@@ -221,9 +221,9 @@ public:
/**
* Construct a DateIntervalFormat from skeleton and the default locale.
*
* This is a convenient override of
* This is a convenient override of
* createInstance(const UnicodeString& skeleton, const Locale& locale,
* UErrorCode&)
* UErrorCode&)
* with the value of locale as default locale.
*
* @param skeleton the skeleton on which interval format based.
@@ -238,17 +238,17 @@ public:
/**
* Construct a DateIntervalFormat from skeleton and a given locale.
* <P>
* In this factory method,
* In this factory method,
* the date interval pattern information is load from resource files.
* Users are encouraged to created date interval formatter this way and
* Users are encouraged to created date interval formatter this way and
* to use the pre-defined skeleton macros.
*
* <P>
* There are pre-defined skeletons (defined in udate.h) having predefined
* There are pre-defined skeletons (defined in udate.h) having predefined
* interval patterns in resource files.
* Users are encouraged to use those macros.
* For example:
* DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status)
* For example:
* DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status)
*
* The given Locale provides the interval patterns.
* For example, for en_GB, if skeleton is UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY,
@@ -274,12 +274,12 @@ public:
* DateIntervalInfo, and default locale.
*
* This is a convenient override of
* createInstance(const UnicodeString& skeleton, const Locale& locale,
* createInstance(const UnicodeString& skeleton, const Locale& locale,
* const DateIntervalInfo& dtitvinf, UErrorCode&)
* with the locale value as default locale.
*
* @param skeleton the skeleton on which interval format based.
* @param dtitvinf the DateIntervalInfo object.
* @param dtitvinf the DateIntervalInfo object.
* @param status output param set to success/failure code on exit
* @return a date time interval formatter which the caller owns.
* @stable ICU 4.0
@@ -295,18 +295,18 @@ public:
*
* <P>
* In this factory method, user provides its own date interval pattern
* information, instead of using those pre-defined data in resource file.
* This factory method is for powerful users who want to provide their own
* interval patterns.
* information, instead of using those pre-defined data in resource file.
* This factory method is for powerful users who want to provide their own
* interval patterns.
* <P>
* There are pre-defined skeletons (defined in udate.h) having predefined
* There are pre-defined skeletons (defined in udate.h) having predefined
* interval patterns in resource files.
* Users are encouraged to use those macros.
* For example:
* DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status)
* For example:
* DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status)
*
* The DateIntervalInfo provides the interval patterns.
* and the DateIntervalInfo ownership remains to the caller.
* and the DateIntervalInfo ownership remains to the caller.
*
* User are encouraged to set default interval pattern in DateIntervalInfo
* as well, if they want to set other interval patterns ( instead of
@@ -315,7 +315,7 @@ public:
* field is not found ( if user not set it ), interval format fallback to
* the default interval pattern.
* If user does not provide default interval pattern, it fallback to
* "{date0} - {date1}"
* "{date0} - {date1}"
*
* @param skeleton the skeleton on which interval format based.
* @param locale the given locale
@@ -354,7 +354,7 @@ public:
virtual UBool operator==(const Format& other) const;
/**
* Return true if the given Format objects are not semantically equal.
* Return true if the given Format objects are not 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 not semantically equal.
@@ -362,13 +362,16 @@ public:
*/
UBool operator!=(const Format& other) const;
// using Format::format;
/**
* Format an object to produce a string. This method handles Formattable
* objects with a DateInterval type.
* objects with a DateInterval type.
* If a the Formattable object type is not a DateInterval,
* then it returns a failing UErrorCode.
*
* @param obj The object to format.
* @param obj The object to format.
* Must be a DateInterval.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
@@ -382,11 +385,11 @@ public:
UnicodeString& appendTo,
FieldPosition& fieldPosition,
UErrorCode& status) const ;
/**
* Format a DateInterval to produce a string.
* Format a DateInterval to produce a string.
*
* @param dtInterval DateInterval to be formatted.
* @param appendTo Output parameter to receive result.
@@ -401,10 +404,10 @@ public:
UnicodeString& appendTo,
FieldPosition& fieldPosition,
UErrorCode& status) const ;
/**
* Format 2 Calendars to produce a string.
* Format 2 Calendars to produce a string.
*
* Note: "fromCalendar" and "toCalendar" are not const,
* since calendar is not const in SimpleDateFormat::format(Calendar&),
@@ -433,7 +436,7 @@ public:
* Date interval parsing is not supported. Please do not use.
* <P>
* This method should handle parsing of
* date time interval strings into Formattable objects with
* date time interval strings into Formattable objects with
* DateInterval type, which is a pair of UDate.
* <P>
* Before calling, set parse_pos.index to the offset you want to start
@@ -470,7 +473,7 @@ public:
/**
* Set the date time interval patterns.
* Set the date time interval patterns.
* @param newIntervalPatterns the given interval patterns to copy.
* @param status output param set to success/failure code on exit
* @stable ICU 4.0
@@ -537,7 +540,7 @@ private:
* and a separator "-".
* The pattern is divided into 2 parts. For above example,
* the first part is "MMM d - ", and the second part is "MMM d, yyyy".
* Also, the first date appears in an interval pattern could be
* Also, the first date appears in an interval pattern could be
* the earlier date or the later date.
* And such information is saved in the interval pattern as well.
* @internal ICU 4.0
@@ -548,22 +551,22 @@ private:
/**
* Whether the first date in interval pattern is later date or not.
* Fallback format set the default ordering.
* And for a particular interval pattern, the order can be
* overriden by prefixing the interval pattern with "latestFirst:" or
* And for a particular interval pattern, the order can be
* overriden by prefixing the interval pattern with "latestFirst:" or
* "earliestFirst:"
* For example, given 2 date, Jan 10, 2007 to Feb 10, 2007.
* if the fallback format is "{0} - {1}",
* if the fallback format is "{0} - {1}",
* and the pattern is "d MMM - d MMM yyyy", the interval format is
* "10 Jan - 10 Feb, 2007".
* If the pattern is "latestFirst:d MMM - d MMM yyyy",
* If the pattern is "latestFirst:d MMM - d MMM yyyy",
* the interval format is "10 Feb - 10 Jan, 2007"
*/
UBool laterDateFirst;
};
/**
* default constructor
* default constructor
* @internal ICU 4.0
*/
DateIntervalFormat();
@@ -573,12 +576,12 @@ private:
* a DateIntervalInfo, and skeleton.
* DateFormat provides the timezone, calendar,
* full pattern, and date format symbols information.
* It should be a SimpleDateFormat object which
* It should be a SimpleDateFormat object which
* has a pattern in it.
* the DateIntervalInfo provides the interval patterns.
*
* Note: the DateIntervalFormat takes ownership of both
* DateFormat and DateIntervalInfo objects.
* Note: the DateIntervalFormat takes ownership of both
* DateFormat and DateIntervalInfo objects.
* Caller should not delete them.
*
* @param locale the locale of this date interval formatter.
@@ -590,7 +593,7 @@ private:
DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo,
const UnicodeString* skeleton, UErrorCode& status);
/**
* Construct a DateIntervalFormat from DateFormat
* and a DateIntervalInfo.
@@ -630,7 +633,7 @@ private:
/**
* Below are for generating interval patterns local to the formatter
* Below are for generating interval patterns local to the formatter
*/
@@ -660,10 +663,10 @@ private:
/**
/**
* Initialize interval patterns locale to this formatter
*
* This code is a bit complicated since
*
* This code is a bit complicated since
* 1. the interval patterns saved in resource bundle files are interval
* patterns based on date or time only.
* It does not have interval patterns based on both date and time.
@@ -671,32 +674,32 @@ private:
*
* For example, it has interval patterns on skeleton "dMy" and "hm",
* but it does not have interval patterns on skeleton "dMyhm".
*
* The rule to generate interval patterns for both date and time skeleton are
* 1) when the year, month, or day differs, concatenate the two original
* expressions with a separator between,
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 11, 2007 10:10am" is
* "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am"
*
* 2) otherwise, present the date followed by the range expression
* The rule to generate interval patterns for both date and time skeleton are
* 1) when the year, month, or day differs, concatenate the two original
* expressions with a separator between,
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 11, 2007 10:10am" is
* "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am"
*
* 2) otherwise, present the date followed by the range expression
* for the time.
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 10, 2007 11:10am" is
* "Jan 10, 2007 10:10 am - 11:10am"
* For example, interval pattern from "Jan 10, 2007 10:10 am"
* to "Jan 10, 2007 11:10am" is
* "Jan 10, 2007 10:10 am - 11:10am"
*
* 2. even a pattern does not request a certain calendar field,
* the interval pattern needs to include such field if such fields are
* different between 2 dates.
* For example, a pattern/skeleton is "hm", but the interval pattern
* For example, a pattern/skeleton is "hm", but the interval pattern
* includes year, month, and date when year, month, and date differs.
*
*
*
* @param status output param set to success/failure code on exit
* @internal ICU 4.0
* @internal ICU 4.0
*/
void initializePattern(UErrorCode& status);
void initializePattern(UErrorCode& status);
/**
@@ -705,15 +708,15 @@ private:
* @param field the largest different calendar field
* @param skeleton a skeleton
* @param status output param set to success/failure code on exit
* @internal ICU 4.0
* @internal ICU 4.0
*/
void setFallbackPattern(UCalendarDateFields field,
void setFallbackPattern(UCalendarDateFields field,
const UnicodeString& skeleton,
UErrorCode& status);
/**
/**
* get separated date and time skeleton from a combined skeleton.
*
* The difference between date skeleton and normalizedDateSkeleton are:
@@ -736,7 +739,7 @@ private:
* @param normalizedTime Output parameter for normalized time only
* skeleton.
*
* @internal ICU 4.0
* @internal ICU 4.0
*/
static void U_EXPORT2 getDateTimeSkeleton(const UnicodeString& skeleton,
UnicodeString& date,
@@ -750,7 +753,7 @@ private:
* Generate date or time interval pattern from resource,
* and set them into the interval pattern locale to this formatter.
*
* It needs to handle the following:
* It needs to handle the following:
* 1. need to adjust field width.
* For example, the interval patterns saved in DateIntervalInfo
* includes "dMMMy", but not "dMMMMy".
@@ -770,9 +773,9 @@ private:
* FALSE otherwise.
* @internal ICU 4.0
*/
UBool setSeparateDateTimePtn(const UnicodeString& dateSkeleton,
UBool setSeparateDateTimePtn(const UnicodeString& dateSkeleton,
const UnicodeString& timeSkeleton);
@@ -790,20 +793,20 @@ private:
* 0 means the best matched skeleton is the same as input skeleton
* 1 means the fields are the same, but field width are different
* 2 means the only difference between fields are v/z,
* -1 means there are other fields difference
* -1 means there are other fields difference
*
* @param extendedSkeleton extended skeleton
* @param extendedBestSkeleton extended best match skeleton
* @return whether the interval pattern is found
* @return whether the interval pattern is found
* through extending skeleton or not.
* TRUE if interval pattern is found by
* extending skeleton, FALSE otherwise.
* @internal ICU 4.0
*/
UBool setIntervalPattern(UCalendarDateFields field,
const UnicodeString* skeleton,
const UnicodeString* bestSkeleton,
int8_t differenceInfo,
UBool setIntervalPattern(UCalendarDateFields field,
const UnicodeString* skeleton,
const UnicodeString* bestSkeleton,
int8_t differenceInfo,
UnicodeString* extendedSkeleton = NULL,
UnicodeString* extendedBestSkeleton = NULL);
@@ -847,29 +850,29 @@ private:
* Concat a single date pattern with a time interval pattern,
* set it into the intervalPatterns, while field is time field.
* This is used to handle time interval patterns on skeleton with
* both time and date. Present the date followed by
* both time and date. Present the date followed by
* the range expression for the time.
* @param format date and time format
* @param formatLen format string length
* @param datePattern date pattern
* @param field time calendar field: AM_PM, HOUR, MINUTE
* @param status output param set to success/failure code on exit
* @internal ICU 4.0
* @internal ICU 4.0
*/
void concatSingleDate2TimeInterval(const UChar* format,
int32_t formatLen,
const UnicodeString& datePattern,
UCalendarDateFields field,
UErrorCode& status);
UErrorCode& status);
/**
* check whether a calendar field present in a skeleton.
* @param field calendar field need to check
* @param skeleton given skeleton on which to check the calendar field
* @return true if field present in a skeleton.
* @internal ICU 4.0
* @internal ICU 4.0
*/
static UBool U_EXPORT2 fieldExistsInSkeleton(UCalendarDateFields field,
static UBool U_EXPORT2 fieldExistsInSkeleton(UCalendarDateFields field,
const UnicodeString& skeleton);
@@ -953,17 +956,12 @@ private:
UnicodeString fSkeleton;
PatternInfo fIntervalPatterns[DateIntervalInfo::kIPI_MAX_INDEX];
};
inline UBool
inline UBool
DateIntervalFormat::operator!=(const Format& other) const {
return !operator==(other);
return !operator==(other);
}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
+33 -34
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2008-2009, International Business Machines Corporation and
* Copyright (C) 2008-2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -36,16 +36,6 @@ union UHashTok;
U_NAMESPACE_BEGIN
U_CDECL_BEGIN
/**
* @internal ICU 4.0
*/
UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) ;
U_CDECL_END
/**
* DateIntervalInfo is a public class for encapsulating localizable
* date time interval patterns. It is used by DateIntervalFormat.
@@ -96,22 +86,22 @@ U_CDECL_END
* The largest different calendar fields between 2 calendars is the
* first different calendar field in above order.
*
* For example: the largest different calendar fields between "Jan 10, 2007"
* and "Feb 20, 2008" is year.
* For example: the largest different calendar fields between &quot;Jan 10, 2007&quot;
* and &quot;Feb 20, 2008&quot; is year.
*
* <P>
* There is a set of pre-defined static skeleton strings.
* There are pre-defined interval patterns for those pre-defined skeletons
* in locales' resource files.
* For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is "yMMMd",
* For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is &quot;yMMMd&quot;,
* in en_US, if the largest different calendar field between date1 and date2
* is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy",
* such as "Jan 10, 2007 - Jan 10, 2008".
* If the largest different calendar field between date1 and date2 is "month",
* the date interval pattern is "MMM d - MMM d, yyyy",
* such as "Jan 10 - Feb 10, 2007".
* If the largest different calendar field between date1 and date2 is "day",
* the date interval pattern is ""MMM d-d, yyyy", such as "Jan 10-20, 2007".
* is &quot;year&quot;, the date interval pattern is &quot;MMM d, yyyy - MMM d, yyyy&quot;,
* such as &quot;Jan 10, 2007 - Jan 10, 2008&quot;.
* If the largest different calendar field between date1 and date2 is &quot;month&quot;,
* the date interval pattern is &quot;MMM d - MMM d, yyyy&quot;,
* such as &quot;Jan 10 - Feb 10, 2007&quot;.
* If the largest different calendar field between date1 and date2 is &quot;day&quot;,
* the date interval pattern is &quot;MMM d-d, yyyy&quot;, such as &quot;Jan 10-20, 2007&quot;.
*
* For date skeleton, the interval patterns when year, or month, or date is
* different are defined in resource files.
@@ -124,17 +114,17 @@ U_CDECL_END
* in an interval pattern is the earlier date. There might be a locale in which
* the first date in an interval pattern is the later date.
* We use fallback format for the default order for the locale.
* For example, if the fallback format is "{0} - {1}", it means
* For example, if the fallback format is &quot;{0} - {1}&quot;, it means
* the first date in the interval pattern for this locale is earlier date.
* If the fallback format is "{1} - {0}", it means the first date is the
* If the fallback format is &quot;{1} - {0}&quot;, it means the first date is the
* later date.
* For a particular interval pattern, the default order can be overriden
* by prefixing "latestFirst:" or "earliestFirst:" to the interval pattern.
* For example, if the fallback format is "{0}-{1}",
* but for skeleton "yMMMd", the interval pattern when day is different is
* "latestFirst:d-d MMM yy", it means by default, the first date in interval
* pattern is the earlier date. But for skeleton "yMMMd", when day is different,
* the first date in "d-d MMM yy" is the later date.
* by prefixing &quot;latestFirst:&quot; or &quot;earliestFirst:&quot; to the interval pattern.
* For example, if the fallback format is &quot;{0}-{1}&quot;,
* but for skeleton &quot;yMMMd&quot;, the interval pattern when day is different is
* &quot;latestFirst:d-d MMM yy&quot;, it means by default, the first date in interval
* pattern is the earlier date. But for skeleton &quot;yMMMd&quot;, when day is different,
* the first date in &quot;d-d MMM yy&quot; is the later date.
*
* <P>
* The recommended way to create a DateIntervalFormat object is to pass in
@@ -161,7 +151,8 @@ U_CDECL_END
* <P>
* DateIntervalInfo are not expected to be subclassed.
* Data for a calendar is loaded out of resource bundles.
* To ICU 4.0, date interval patterns are only supported in Gregorian calendar.
* Through ICU 4.4, date interval patterns are only supported in the Gregorian
* calendar; non-Gregorian calendars are supported from ICU 4.4.1.
* @stable ICU 4.0
**/
@@ -185,8 +176,8 @@ public:
/**
* Construct DateIntervalInfo for the given locale,
* @param locale the interval patterns are loaded from the Gregorian
* calendar data in this locale.
* @param locale the interval patterns are loaded from the appropriate calendar
* data (specified calendar or default calendar) in this locale.
* @param status output param set to success/failure code on exit
* @stable ICU 4.0
*/
@@ -354,8 +345,6 @@ private:
*/
friend class DateIntervalFormat;
friend UBool U_CALLCONV dtitvinfHashTableValueComparator(UHashTok val1, UHashTok val2) ;
/**
* Following is for saving the interval patterns.
* We only support interval patterns on
@@ -372,6 +361,16 @@ private:
kIPI_MINUTE,
kIPI_MAX_INDEX
};
public:
/**
* Max index for stored interval patterns
* @internal ICU 4.4
*/
enum {
kMaxIntervalPatternIndex = kIPI_MAX_INDEX
};
private:
/**
* Initialize the DateIntervalInfo from locale
+53 -2
View File
@@ -253,6 +253,30 @@ public:
UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status);
/**
* 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 options
* Options for forcing the length of specified fields in the
* returned pattern to match those in the skeleton (when this
* would not happen otherwise). For default behavior, use
* UDATPG_MATCH_NO_OPTIONS.
* @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 4.4
*/
UnicodeString getBestPattern(const UnicodeString& skeleton,
UDateTimePatternMatchOptions options,
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
@@ -273,6 +297,33 @@ public:
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 options
* Options controlling whether the length of specified fields in the
* pattern are adjusted to match those in the skeleton (when this
* would not happen otherwise). For default behavior, use
* UDATPG_MATCH_NO_OPTIONS.
* @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 4.4
*/
UnicodeString replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
UDateTimePatternMatchOptions options,
UErrorCode& status);
/**
* Return a list of all the skeletons (in canonical form) from this class.
*
@@ -409,8 +460,8 @@ private:
void getAppendName(UDateTimePatternField field, UnicodeString& value);
int32_t getCanonicalIndex(const UnicodeString& field);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0);
UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, UBool fixFractionalSeconds);
UnicodeString getBestAppending(int32_t missingFields);
UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, UBool fixFractionalSeconds, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
UnicodeString getBestAppending(int32_t missingFields, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
int32_t getTopBitNumber(int32_t foundMask);
void setAvailableFormat(const UnicodeString &key, UErrorCode& status);
UBool isAvailableFormatSet(const UnicodeString &key) const;
+27 -18
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2009, International Business Machines
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -62,7 +62,7 @@ U_NAMESPACE_BEGIN
* if(isFailure()) { handleFailure(); }
* }
* protected:
* virtual handleFailure() {
* virtual void handleFailure() const {
* log_failure(u_errorName(errorCode));
* exit(errorCode);
* }
@@ -74,51 +74,60 @@ U_NAMESPACE_BEGIN
* // IcuErrorCode destructor checks for success.
* \endcode
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_COMMON_API ErrorCode: public UMemory {
public:
/**
* Default constructor. Initializes its UErrorCode to U_ZERO_ERROR.
* @draft ICU 4.2
* @stable ICU 4.2
*/
ErrorCode() : errorCode(U_ZERO_ERROR) {}
/** Destructor, does nothing. See class documentation for details. @draft ICU 4.2 */
/** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */
virtual ~ErrorCode() {}
/** Conversion operator, returns a reference. @draft ICU 4.2 */
/** Conversion operator, returns a reference. @stable ICU 4.2 */
operator UErrorCode & () { return errorCode; }
/** Conversion operator, returns a pointer. @draft ICU 4.2 */
/** Conversion operator, returns a pointer. @stable ICU 4.2 */
operator UErrorCode * () { return &errorCode; }
/** Tests for U_SUCCESS(). @draft ICU 4.2 */
/** Tests for U_SUCCESS(). @stable ICU 4.2 */
UBool isSuccess() const { return U_SUCCESS(errorCode); }
/** Tests for U_FAILURE(). @draft ICU 4.2 */
/** Tests for U_FAILURE(). @stable ICU 4.2 */
UBool isFailure() const { return U_FAILURE(errorCode); }
/** Returns the UErrorCode value. @draft ICU 4.2 */
/** Returns the UErrorCode value. @stable ICU 4.2 */
UErrorCode get() const { return errorCode; }
/** Sets the UErrorCode value. @draft ICU 4.2 */
/** Sets the UErrorCode value. @stable ICU 4.2 */
void set(UErrorCode value) { errorCode=value; }
/** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @draft ICU 4.2 */
/** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */
UErrorCode reset();
/**
* Checks for a failure code:
* Asserts isSuccess().
* In other words, this method checks for a failure code,
* and the base class handles it like this:
* \code
* if(isFailure()) { handleFailure(); }
* \endcode
* @draft ICU 4.2
* @draft ICU 4.4
*/
void check() const;
void assertSuccess() const;
/**
* Return a string for the UErrorCode value.
* The string will be the same as the name of the error code constant
* in the UErrorCode enum.
* @draft ICU 4.4
*/
const char* errorName() const;
protected:
/**
* Internal UErrorCode, accessible to subclasses.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UErrorCode errorCode;
/**
* Called by check() if isFailure() is true.
* Called by assertSuccess() if isFailure() is true.
* A subclass should override this function to deal with a failure code:
* Throw an exception, log an error, terminate the program, or similar.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void handleFailure() const {}
};
+90 -6
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2006, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@@ -17,6 +17,8 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/stringpiece.h"
/**
* \file
* \brief C++ API: Formattable is a thin wrapper for primitive numeric types.
@@ -26,6 +28,9 @@
U_NAMESPACE_BEGIN
class DecimalNumberString;
class DigitList;
/**
* Formattable objects can be passed to the Format class or
* its subclasses for formatting. Formattable is a thin wrapper
@@ -102,6 +107,21 @@ public:
Formattable(const char* strToCopy);
#endif
/**
* Creates a Formattable object of an appropriate numeric type from a
* a decimal number in string form. The Formattable will retain the
* full precision of the input in decimal format, even when it exceeds
* what can be represented by a double of int64_t.
*
* @param number the unformatted (not localized) string representation
* of the Decimal number.
* @param status the error code. Possible errors include U_INVALID_FORMAT_ERROR
* if the format of the string does not conform to that of a
* decimal number.
* @draft ICU 4.4
*/
Formattable(const StringPiece &number, UErrorCode &status);
/**
* Creates a Formattable object with a UnicodeString object to copy from.
* @param strToCopy the UnicodeString string.
@@ -246,7 +266,7 @@ public:
/**
* Returns TRUE if the data type of this Formattable object
* is kDouble, kLong, or kInt64.
* is kDouble, kLong, kInt64 or kDecimalNumber.
* @return TRUE if this is a pure numeric object
* @stable ICU 3.0
*/
@@ -262,7 +282,7 @@ public:
/**
* Gets the double value of this object. If this object is of type
* long or int64 then a casting conversion is peformed, with
* long, int64 or Decimal Number then a 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
@@ -288,7 +308,7 @@ public:
* 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
* type kDouble or kDecimalNumber, then a 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
@@ -309,8 +329,8 @@ public:
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
* Gets the int64 value of this object. If this object is of a numeric
* type 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
@@ -441,6 +461,26 @@ public:
const UObject* getObject() const;
/**
* Returns a numeric string representation of the number contained within this
* formattable, or NULL if this object does not contain numeric type.
* For values obtained by parsing, the returned decimal number retains
* the full precision and range of the original input, unconstrained by
* the limits of a double floating point or a 64 bit int.
*
* This function is not thread safe, and therfore is not declared const,
* even though it is logically const.
*
* Possible errors include U_MEMORY_ALLOCATION_ERROR, and
* U_INVALID_STATE if the formattable object has not been set to
* a numeric type.
*
* @param status the error code.
* @return the unformatted string representation of a number.
* @draft ICU 4.4
*/
StringPiece getDecimalNumber(UErrorCode &status);
/**
* Sets the double value of this object and changes the type to
* kDouble.
* @param d the new double value to be set.
@@ -513,6 +553,23 @@ public:
*/
void adoptObject(UObject* objectToAdopt);
/**
* Sets the the numeric value from a decimal number string, and changes
* the type to to a numeric type appropriate for the number.
* The syntax of the number is a "numeric string"
* as defined in the Decimal Arithmetic Specification, available at
* http://speleotrove.com/decimal
* The full precision and range of the input number will be retained,
* even when it exceeds what can be represented by a double or an int64.
*
* @param numberString a string representation of the unformatted decimal number.
* @param status the error code. Set to U_INVALID_FORMAT_ERROR if the
* incoming string is not a valid decimal number.
* @draft ICU 4.4
*/
void setDecimalNumber(const StringPiece &numberString,
UErrorCode &status);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
@@ -535,12 +592,36 @@ public:
*/
inline int32_t getLong(UErrorCode* status) const;
/**
* Internal function, do not use.
* TODO: figure out how to make this be non-public.
* NumberFormat::format(Formattable, ...
* needs to get at the DigitList, if it exists, for
* big decimal formatting.
* @internal
*/
DigitList *getDigitList() const { return fDecimalNum;};
/**
* Adopt, and set value from, a DigitList
* Internal Function, do not use.
* @param dl the Digit List to be adopted
* @param status reports errors
* @internal
*/
void adoptDigitList(DigitList *dl);
private:
/**
* Cleans up the memory for unwanted values. For example, the adopted
* string or array objects.
*/
void dispose(void);
/**
* Common initialization, for use by constructors.
*/
void init();
UnicodeString* getBogus() const;
@@ -556,6 +637,9 @@ private:
} fArrayAndCount;
} fValue;
DecimalNumberString *fDecimalStr;
DigitList *fDecimalNum;
Type fType;
UnicodeString fBogus; // Bogus string when it's needed.
};
+22 -1
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2006, International Business Machines Corporation and others.
* Copyright (C) 1997-2010, International Business Machines Corporation and others.
* All Rights Reserved.
********************************************************************************
*
@@ -34,6 +34,7 @@
#include "unicode/unistr.h"
#include "unicode/fmtable.h"
#include "unicode/fieldpos.h"
#include "unicode/fpositer.h"
#include "unicode/parsepos.h"
#include "unicode/parseerr.h"
#include "unicode/locid.h"
@@ -159,6 +160,26 @@ public:
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const = 0;
/**
* Format an object to produce a string. Subclasses should override this
* method. 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Parse a string to produce an object. This is a pure virtual
+129
View File
@@ -0,0 +1,129 @@
/*
********************************************************************************
* Copyright (C) 2010, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
* File attiter.h
*
* Modification History:
*
* Date Name Description
* 12/15/2009 dougfelt Created
********************************************************************************
*/
#ifndef FPOSITER_H
#define FPOSITER_H
#include "unicode/utypes.h"
#include "unicode/uobject.h"
/**
* \file
* \brief C++ API: FieldPosition Iterator.
*/
#if UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
/*
* Allow the declaration of APIs with pointers to FieldPositionIterator
* even when formatting is removed from the build.
*/
class FieldPositionIterator;
U_NAMESPACE_END
#else
#include "unicode/fieldpos.h"
#include "unicode/umisc.h"
U_NAMESPACE_BEGIN
class UVector32;
/**
* FieldPositionIterator returns the field ids and their start/limit positions generated
* by a call to Format::format. See Format, NumberFormat, DecimalFormat.
* @draft ICU 4.4
*/
class U_I18N_API FieldPositionIterator : public UObject {
public:
/**
* Destructor.
* @draft ICU 4.4
*/
~FieldPositionIterator();
/**
* Constructs a new, empty iterator.
* @draft ICU 4.4
*/
FieldPositionIterator(void);
/**
* Copy constructor. If the copy failed for some reason, the new iterator will
* be empty.
* @draft ICU 4.4
*/
FieldPositionIterator(const FieldPositionIterator&);
/**
* Return true if another object is semantically equal to this
* one.
* <p>
* Return true if this FieldPositionIterator is at the same position in an
* equal array of run values.
* @draft ICU 4.4
*/
UBool operator==(const FieldPositionIterator&) const;
/**
* Returns the complement of the result of operator==
* @param rhs The FieldPositionIterator to be compared for inequality
* @return the complement of the result of operator==
* @draft ICU 4.4
*/
UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
/**
* If the current position is valid, updates the FieldPosition values, advances the iterator,
* and returns TRUE, otherwise returns FALSE.
* @draft ICU 4.4
*/
UBool next(FieldPosition& fp);
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @draft ICU 4.4
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @draft ICU 4.4
*/
virtual UClassID getDynamicClassID() const;
private:
friend class FieldPositionIteratorHandler;
/**
* Sets the data used by the iterator, and resets the position.
* Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
* (length is not a multiple of 3, or start >= limit for any run).
*/
void setData(UVector32 *adopt, UErrorCode& status);
UVector32 *data;
int32_t pos;
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // FPOSITER_H
+57
View File
@@ -0,0 +1,57 @@
/*
******************************************************************************
*
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*/
#ifndef __ICU_DATA_VER_H__
#define __ICU_DATA_VER_H__
#include "unicode/utypes.h"
/**
* @internal ICU 4.4
*/
#define U_ICU_VERSION_BUNDLE "icuver"
/**
* @internal ICU 4.4
*/
#define U_ICU_STD_BUNDLE "icustd"
/**
* @internal ICU 4.4
*/
#define U_ICU_DATA_KEY "DataVersion"
/**
* This function loads up icuver and compares the data version to the wired-in U_ICU_DATA_VERSION.
* If icuver shows something less than U_ICU_DATA_VERSION it returns TRUE, else FALSE. The version
* found will be returned in the first fillin parameter (if non-null), and *isModified will be set
* to TRUE if "icustd" is NOT found. Thus, if the data has been repackaged or modified, "icustd"
* (standard ICU) will be missing, and the function will alert the caller that the data is not standard.
*
* @param dataVersionFillin icuver data version information to be filled in if not-null
* @param isModifiedFillin if the data is not standard if not-null
* @param status stores the error code from the calls to resource bundle
*
* @return TRUE if U_ICU_DATA_VERSION is newer than icuver, else FALSE
*
* @internal ICU 4.4
*/
U_INTERNAL UBool U_EXPORT2 u_isDataOlder(UVersionInfo dataVersionFillin, UBool *isModifiedFillin, UErrorCode *status);
/**
* Retrieves the data version from icuver and stores it in dataVersionFillin.
*
* @param dataVersionFillin icuver data version information to be filled in if not-null
* @param status stores the error code from the calls to resource bundle
*
* @internal ICU 4.4
*/
U_INTERNAL void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);
#endif
+370
View File
@@ -0,0 +1,370 @@
/*
******************************************************************************
*
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* FILE NAME : icuplug.h
*
* Date Name Description
* 10/29/2009 sl New.
******************************************************************************
*/
/**
* \file
* \brief C API: ICU Plugin API
*
* <h2>C API: ICU Plugin API</h2>
*
* <p>C API allowing run-time loadable modules that extend or modify ICU functionality.</p>
*
* <h3>Loading and Configuration</h3>
*
* <p>At ICU startup time, the environment variable "ICU_PLUGINS" will be
* queried for a directory name. If it is not set, the preprocessor symbol
* "DEFAULT_ICU_PLUGINS" will be checked for a default value.</p>
*
* <p>Within the above-named directory, the file "icuplugins##.txt" will be
* opened, if present, where ## is the major+minor number of the currently
* running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)</p>
*
* <p>The configuration file has this format:</p>
*
* <ul>
* <li>Hash (#) begins a comment line</li>
*
* <li>Non-comment lines have two or three components:
* LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]</li>
*
* <li>Tabs or spaces separate the three items.</li>
*
* <li>LIBRARYNAME is the name of a shared library, either a short name if
* it is on the loader path, or a full pathname.</li>
*
* <li>ENTRYPOINT is the short (undecorated) symbol name of the plugin's
* entrypoint, as above.</li>
*
* <li>CONFIGURATION is the entire rest of the line . It's passed as-is to
* the plugin.</li>
* </ul>
*
* <p>An example configuration file is, in its entirety:</p>
*
* \code
* # this is icuplugins44.txt
* testplug.dll myPlugin hello=world
* \endcode
* <p>Plugins are categorized as "high" or "low" level. Low level are those
* which must be run BEFORE high level plugins, and before any operations
* which cause ICU to be 'initialized'. If a plugin is low level but
* causes ICU to allocate memory or become initialized, that plugin is said
* to cause a 'level change'. </p>
*
* <p>At load time, ICU first queries all plugins to determine their level,
* then loads all 'low' plugins first, and then loads all 'high' plugins.
* Plugins are otherwise loaded in the order listed in the configuration file.</p>
*
* <h3>Implementing a Plugin</h3>
* \code
* U_CAPI UPlugTokenReturn U_EXPORT2
* myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) {
* if(reason==UPLUG_REASON_QUERY) {
* uplug_setPlugName(plug, "Simple Plugin");
* uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH);
* } else if(reason==UPLUG_REASON_LOAD) {
* ... Set up some ICU things here....
* } else if(reason==UPLUG_REASON_UNLOAD) {
* ... unload, clean up ...
* }
* return UPLUG_TOKEN;
* }
* \endcode
*
* <p>The UPlugData* is an opaque pointer to the plugin-specific data, and is
* used in all other API calls.</p>
*
* <p>The API contract is:</p>
* <ol><li>The plugin MUST always return UPLUG_TOKEN as a return value- to
* indicate that it is a valid plugin.</li>
*
* <li>When the 'reason' parameter is set to UPLUG_REASON_QUERY, the
* plugin MUST call uplug_setPlugLevel() to indicate whether it is a high
* level or low level plugin.</li>
*
* <li>When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin
* SHOULD call uplug_setPlugName to indicate a human readable plugin name.</li></ol>
*
*
* \internal ICU 4.4 Technology Preview
*/
#ifndef ICUPLUG_H
#define ICUPLUG_H
#include "unicode/utypes.h"
/* === Basic types === */
/**
* @{
* Opaque structure passed to/from a plugin.
* use the APIs to access it.
* @internal ICU 4.4 Technology Preview
*/
struct UPlugData;
typedef struct UPlugData UPlugData;
/** @} */
/**
* Random Token to identify a valid ICU plugin. Plugins must return this
* from the entrypoint.
* @internal ICU 4.4 Technology Preview
*/
#define UPLUG_TOKEN 0x54762486
/**
* Max width of names, symbols, and configuration strings
* @internal ICU 4.4 Technology Preview
*/
#define UPLUG_NAME_MAX 100
/**
* Return value from a plugin entrypoint.
* Must always be set to UPLUG_TOKEN
* @see UPLUG_TOKEN
* @internal ICU 4.4 Technology Preview
*/
typedef uint32_t UPlugTokenReturn;
/**
* Reason code for the entrypoint's call
* @internal ICU 4.4 Technology Preview
*/
typedef enum {
UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/
UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/
UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/
UPLUG_REASON_COUNT /**< count of known reasons **/
} UPlugReason;
/**
* Level of plugin loading
* INITIAL: UNKNOWN
* QUERY: INVALID -> { LOW | HIGH }
* ERR -> INVALID
* @internal ICU 4.4 Technology Preview
*/
typedef enum {
UPLUG_LEVEL_INVALID = 0, /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/
UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/
UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/
UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/
UPLUG_LEVEL_COUNT /**< count of known reasons **/
} UPlugLevel;
/**
* Entrypoint for an ICU plugin.
* @param plug the UPlugData handle.
* @param status the plugin's extended status code.
* @return A valid plugin must return UPLUG_TOKEN
* @internal ICU 4.4 Technology Preview
*/
typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
UPlugData *plug,
UPlugReason reason,
UErrorCode *status);
/* === Needed for Implementing === */
/**
* Request that this plugin not be unloaded at cleanup time.
* This is appropriate for plugins which cannot be cleaned up.
* @see u_cleanup()
* @param plug plugin
* @param dontUnload set true if this plugin can't be unloaded
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void U_EXPORT2
uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
/**
* Set the level of this plugin.
* @param plug plugin data handle
* @param level the level of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void U_EXPORT2
uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
/**
* Get the level of this plugin.
* @param plug plugin data handle
* @return the level of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UPlugLevel U_EXPORT2
uplug_getPlugLevel(UPlugData *plug);
/**
* Get the lowest level of plug which can currently load.
* For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load
* if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load.
* @return the lowest level of plug which can currently load
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UPlugLevel U_EXPORT2
uplug_getCurrentLevel(void);
/**
* Get plug load status
* @return The error code of this plugin's load attempt.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UErrorCode U_EXPORT2
uplug_getPlugLoadStatus(UPlugData *plug);
/**
* Set the human-readable name of this plugin.
* @param plug plugin data handle
* @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void U_EXPORT2
uplug_setPlugName(UPlugData *plug, const char *name);
/**
* Get the human-readable name of this plugin.
* @param plug plugin data handle
* @return the name of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_CAPI const char * U_EXPORT2
uplug_getPlugName(UPlugData *plug);
/**
* Return the symbol name for this plugin, if known.
* @param plug plugin data handle
* @return the symbol name, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_CAPI const char * U_EXPORT2
uplug_getSymbolName(UPlugData *plug);
/**
* Return the library name for this plugin, if known.
* @param plug plugin data handle
* @param status error code
* @return the library name, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_CAPI const char * U_EXPORT2
uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
/**
* Return the library used for this plugin, if known.
* Plugins could use this to load data out of their
* @param plug plugin data handle
* @return the library, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void * U_EXPORT2
uplug_getLibrary(UPlugData *plug);
/**
* Return the plugin-specific context data.
* @param plug plugin data handle
* @return the context, or NULL if not set
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void * U_EXPORT2
uplug_getContext(UPlugData *plug);
/**
* Set the plugin-specific context data.
* @param plug plugin data handle
* @param context new context to set
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void U_EXPORT2
uplug_setContext(UPlugData *plug, void *context);
/**
* Get the configuration string, if available.
* The string is in the platform default codepage.
* @param plug plugin data handle
* @return configuration string, or else null.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI const char * U_EXPORT2
uplug_getConfiguration(UPlugData *plug);
/**
* Return all currently installed plugins, from newest to oldest
* Usage Example:
* \code
* UPlugData *plug = NULL;
* while(plug=uplug_nextPlug(plug)) {
* ... do something with 'plug' ...
* }
* \endcode
* Not thread safe- do not call while plugs are added or removed.
* @param prior pass in 'NULL' to get the first (most recent) plug,
* otherwise pass the value returned on a prior call to uplug_nextPlug
* @return the next oldest plugin, or NULL if no more.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UPlugData* U_EXPORT2
uplug_nextPlug(UPlugData *prior);
/**
* Inject a plugin as if it were loaded from a library.
* This is useful for testing plugins.
* Note that it will have a 'NULL' library pointer associated
* with it, and therefore no llibrary will be closed at cleanup time.
* Low level plugins may not be able to load, as ordering can't be enforced.
* @param entrypoint entrypoint to install
* @param config user specified configuration string, if available, or NULL.
* @param status error result
* @return the new UPlugData associated with this plugin, or NULL if error.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
/**
* Inject a plugin from a library, as if the information came from a config file.
* Low level plugins may not be able to load, and ordering can't be enforced.
* @param libName DLL name to load
* @param sym symbol of plugin (UPlugEntrypoint function)
* @param config configuration string, or NULL
* @param status error result
* @return the new UPlugData associated with this plugin, or NULL if error.
* @internal ICU 4.4 Technology Preview
*/
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
/**
* Remove a plugin.
* Will request the plugin to be unloaded, and close the library if needed
* @param plug plugin handle to close
* @param status error result
* @internal ICU 4.4 Technology Preview
*/
U_CAPI void U_EXPORT2
uplug_removePlug(UPlugData *plug, UErrorCode *status);
#endif
+300
View File
@@ -0,0 +1,300 @@
/*
*******************************************************************************
*
* Copyright (C) 2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: localpointer.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2009nov13
* created by: Markus W. Scherer
*/
#ifndef __LOCALPOINTER_H__
#define __LOCALPOINTER_H__
/**
* \file
* \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
*
* These classes are inspired by
* - std::auto_ptr
* - boost::scoped_ptr & boost::scoped_array
* - Taligent Safe Pointers (TOnlyPointerTo)
*
* but none of those provide for all of the goals for ICU smart pointers:
* - Smart pointer owns the object and releases it when it goes out of scope.
* - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust.
* - ICU-compatible: No exceptions.
* - Need to be able to orphan/release the pointer and its ownership.
* - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects.
*
* For details see http://site.icu-project.org/design/cpp/scoped_ptr
*/
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* "Smart pointer" base class; do not use directly: use LocalPointer etc.
*
* Base class for smart pointer classes that do not throw exceptions.
*
* Do not use this base class directly, since it does not delete its pointer.
* A subclass must implement methods that delete the pointer:
* Destructor and adoptInstead().
*
* There is no operator T *() provided because the programmer must decide
* whether to use getAlias() (without transfer of ownership) or orpan()
* (with transfer of ownership and NULLing of the pointer).
*
* @see LocalPointer
* @see LocalArray
* @see U_DEFINE_LOCAL_OPEN_POINTER
* @draft ICU 4.4
*/
template<typename T>
class LocalPointerBase {
public:
/**
* Constructor takes ownership.
* @param p simple pointer to an object that is adopted
* @draft ICU 4.4
*/
explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
/**
* Destructor deletes the object it owns.
* Subclass must override: Base class does nothing.
* @draft ICU 4.4
*/
~LocalPointerBase() { /* delete ptr; */ }
/**
* NULL check.
* @return TRUE if ==NULL
* @draft ICU 4.4
*/
UBool isNull() const { return ptr==NULL; }
/**
* NULL check.
* @return TRUE if !=NULL
* @draft ICU 4.4
*/
UBool isValid() const { return ptr!=NULL; }
/**
* Comparison with a simple pointer, so that existing code
* with ==NULL need not be changed.
* @param other simple pointer for comparison
* @return true if this pointer value equals other
* @draft ICU 4.4
*/
bool operator==(const T *other) const { return ptr==other; }
/**
* Comparison with a simple pointer, so that existing code
* with !=NULL need not be changed.
* @param other simple pointer for comparison
* @return true if this pointer value differs from other
* @draft ICU 4.4
*/
bool operator!=(const T *other) const { return ptr!=other; }
/**
* Access without ownership change.
* @return the pointer value
* @draft ICU 4.4
*/
T *getAlias() const { return ptr; }
/**
* Access without ownership change.
* @return the pointer value as a reference
* @draft ICU 4.4
*/
T &operator*() const { return *ptr; }
/**
* Access without ownership change.
* @return the pointer value
* @draft ICU 4.4
*/
T *operator->() const { return ptr; }
/**
* Gives up ownership; the internal pointer becomes NULL.
* @return the pointer value;
* caller becomes responsible for deleting the object
* @draft ICU 4.4
*/
T *orphan() {
T *p=ptr;
ptr=NULL;
return p;
}
/**
* Deletes the object it owns,
* and adopts (takes ownership of) the one passed in.
* Subclass must override: Base class does not delete the object.
* @param p simple pointer to an object that is adopted
* @draft ICU 4.4
*/
void adoptInstead(T *p) {
// delete ptr;
ptr=p;
}
protected:
T *ptr;
private:
// No comparison operators with other LocalPointerBases.
bool operator==(const LocalPointerBase &other);
bool operator!=(const LocalPointerBase &other);
// No ownership transfer: No copy constructor, no assignment operator.
LocalPointerBase(const LocalPointerBase &other);
void operator=(const LocalPointerBase &other);
// No heap allocation. Use only on the stack.
static void * U_EXPORT2 operator new(size_t size);
static void * U_EXPORT2 operator new[](size_t size);
#if U_HAVE_PLACEMENT_NEW
static void * U_EXPORT2 operator new(size_t, void *ptr);
#endif
};
/**
* "Smart pointer" class, deletes objects via the standard C++ delete operator.
* For most methods see the LocalPointerBase base class.
*
* Usage example:
* \code
* LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
* int32_t length=s->length(); // 2
* UChar lead=s->charAt(0); // 0xd900
* if(some condition) { return; } // no need to explicitly delete the pointer
* s.adoptInstead(new UnicodeString((UChar)0xfffc));
* length=s->length(); // 1
* // no need to explicitly delete the pointer
* \endcode
*
* @see LocalPointerBase
* @draft ICU 4.4
*/
template<typename T>
class LocalPointer : public LocalPointerBase<T> {
public:
/**
* Constructor takes ownership.
* @param p simple pointer to an object that is adopted
* @draft ICU 4.4
*/
explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
/**
* Destructor deletes the object it owns.
* @draft ICU 4.4
*/
~LocalPointer() {
delete LocalPointerBase<T>::ptr;
}
/**
* Deletes the object it owns,
* and adopts (takes ownership of) the one passed in.
* @param p simple pointer to an object that is adopted
* @draft ICU 4.4
*/
void adoptInstead(T *p) {
delete LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=p;
}
};
/**
* "Smart pointer" class, deletes objects via the C++ array delete[] operator.
* For most methods see the LocalPointerBase base class.
* Adds operator[] for array item access.
*
* Usage example:
* \code
* LocalArray<UnicodeString> a(new UnicodeString[2]);
* a[0].append((UChar)0x61);
* if(some condition) { return; } // no need to explicitly delete the array
* a.adoptInstead(new UnicodeString[4]);
* a[3].append((UChar)0x62).append((UChar)0x63).reverse();
* // no need to explicitly delete the array
* \endcode
*
* @see LocalPointerBase
* @draft ICU 4.4
*/
template<typename T>
class LocalArray : public LocalPointerBase<T> {
public:
/**
* Constructor takes ownership.
* @param p simple pointer to an array of T objects that is adopted
* @draft ICU 4.4
*/
explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
/**
* Destructor deletes the array it owns.
* @draft ICU 4.4
*/
~LocalArray() {
delete[] LocalPointerBase<T>::ptr;
}
/**
* Deletes the array it owns,
* and adopts (takes ownership of) the one passed in.
* @param p simple pointer to an array of T objects that is adopted
* @draft ICU 4.4
*/
void adoptInstead(T *p) {
delete[] LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=p;
}
/**
* Array item access (writable).
* No index bounds check.
* @param i array index
* @return reference to the array item
* @draft ICU 4.4
*/
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
};
/**
* \def U_DEFINE_LOCAL_OPEN_POINTER
* "Smart pointer" definition macro, deletes objects via the closeFunction.
* Defines a subclass of LocalPointerBase which works just
* like LocalPointer<Type> except that this subclass will use the closeFunction
* rather than the C++ delete operator.
*
* Requirement: The closeFunction must tolerate a NULL pointer.
* (We could add a NULL check here but it is normally redundant.)
*
* Usage example:
* \code
* LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
* utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
* utf8Out, (int32_t)sizeof(utf8Out),
* utf8In, utf8InLength, &errorCode);
* if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap
* \endcode
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
class LocalPointerClassName : public LocalPointerBase<Type> { \
public: \
explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
~LocalPointerClassName() { closeFunction(ptr); } \
void adoptInstead(Type *p) { \
closeFunction(ptr); \
ptr=p; \
} \
}
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#endif /* __LOCALPOINTER_H__ */
+191
View File
@@ -0,0 +1,191 @@
/*
******************************************************************************
* Copyright (C) 2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
#ifndef LOCDSPNM_H
#define LOCDSPNM_H
#include "unicode/utypes.h"
/**
* \file
* \brief C++ API: Provides display names of Locale and its components.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/locid.h"
#include "unicode/uscript.h"
#include "unicode/uldnames.h"
U_NAMESPACE_BEGIN
/**
* Returns display names of Locales and components of Locales. For
* more information on language, script, region, variant, key, and
* values, see Locale.
* @draft ICU 4.4
*/
class U_I18N_API LocaleDisplayNames : public UObject {
public:
/**
* Destructor.
* @draft ICU 4.4
*/
virtual ~LocaleDisplayNames();
/**
* Convenience overload of
* {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)}
* that specifies STANDARD dialect handling.
* @param locale the display locale
* @return a LocaleDisplayNames instance
* @draft ICU 4.4
*/
static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale);
/**
* Returns an instance of LocaleDisplayNames that returns names
* formatted for the provided locale, using the provided
* dialectHandling.
*
* @param locale the display locale
* @param dialectHandling how to select names for locales
* @return a LocaleDisplayNames instance
* @draft ICU 4.4
*/
static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale,
UDialectHandling dialectHandling);
// getters for state
/**
* Returns the locale used to determine the display names. This is
* not necessarily the same locale passed to {@link #getInstance}.
* @return the display locale
* @draft ICU 4.4
*/
virtual const Locale& getLocale() const = 0;
/**
* Returns the dialect handling used in the display names.
* @return the dialect handling enum
* @draft ICU 4.4
*/
virtual UDialectHandling getDialectHandling() const = 0;
// names for entire locales
/**
* Returns the display name of the provided locale.
* @param locale the locale whose display name to return
* @param result receives the locale's display name
* @return the display name of the provided locale
* @draft ICU 4.4
*/
virtual UnicodeString& localeDisplayName(const Locale& locale,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided locale id.
* @param localeId the id of the locale whose display name to return
* @param result receives the locale's display name
* @return the display name of the provided locale
* @draft ICU 4.4
*/
virtual UnicodeString& localeDisplayName(const char* localeId,
UnicodeString& result) const = 0;
// names for components of a locale id
/**
* Returns the display name of the provided language code.
* @param lang the language code
* @param result receives the language code's display name
* @return the display name of the provided language code
* @draft ICU 4.4
*/
virtual UnicodeString& languageDisplayName(const char* lang,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided script code.
* @param script the script code
* @param result receives the script code's display name
* @return the display name of the provided script code
* @draft ICU 4.4
*/
virtual UnicodeString& scriptDisplayName(const char* script,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided script code.
* @param scriptCode the script code number
* @param result receives the script code's display name
* @return the display name of the provided script code
* @draft ICU 4.4
*/
virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided region code.
* @param region the region code
* @param result receives the region code's display name
* @return the display name of the provided region code
* @draft ICU 4.4
*/
virtual UnicodeString& regionDisplayName(const char* region,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided variant.
* @param variant the variant string
* @param result receives the variant's display name
* @return the display name of the provided variant
* @draft ICU 4.4
*/
virtual UnicodeString& variantDisplayName(const char* variant,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided locale key.
* @param key the locale key name
* @param result receives the locale key's display name
* @return the display name of the provided locale key
* @draft ICU 4.4
*/
virtual UnicodeString& keyDisplayName(const char* key,
UnicodeString& result) const = 0;
/**
* Returns the display name of the provided value (used with the provided key).
* @param key the locale key name
* @param value the locale key's value
* @param result receives the value's display name
* @return the display name of the provided value
* @draft ICU 4.4
*/
virtual UnicodeString& keyValueDisplayName(const char* key, const char* value,
UnicodeString& result) const = 0;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @returns a UClassID for this class.
* @internal ICU 4.4 // TODO @draft ICU 4.6
*/
static UClassID U_EXPORT2 getStaticClassID();
};
inline LocaleDisplayNames::~LocaleDisplayNames() {
}
inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) {
return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES);
}
U_NAMESPACE_END
#endif
#endif
+24 -8
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1996-2006, International Business Machines
* Copyright (C) 1996-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -180,6 +180,8 @@
U_NAMESPACE_BEGIN
class U_COMMON_API Locale : public UObject {
public:
/** Useful constant for the Root locale. @draft ICU 4.4 */
static const Locale &U_EXPORT2 getRoot(void);
/** Useful constant for this language. @stable ICU 2.0 */
static const Locale &U_EXPORT2 getEnglish(void);
/** Useful constant for this language. @stable ICU 2.0 */
@@ -425,8 +427,9 @@ public:
/**
* Gets the list of keywords for the specified locale.
*
* @return pointer to StringEnumeration class. Client must dispose of it by calling delete.
* @param status Returns any error information while performing this operation.
* @param status the status code
* @return pointer to StringEnumeration class, or NULL if there are no keywords.
* Client must dispose of it by calling delete.
* @stable ICU 2.8
*/
StringEnumeration * createKeywords(UErrorCode &status) const;
@@ -435,15 +438,28 @@ public:
* Get the value for a keyword.
*
* @param keywordName name of the keyword for which we want the value. Case insensitive.
* @param status Returns any error information while performing this operation.
* @param buffer The buffer to receive the keyword value.
* @param bufferCapacity The capacity of receiving buffer
* @return the length of keyword value
* @param status Returns any error information while performing this operation.
* @return the length of the keyword value
*
* @stable ICU 2.8
*/
int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const;
/**
* Set the value for a keyword.
*
* @param keywordName name of the keyword to be set. Case insensitive.
* @param keywordValue value of the keyword to be set. If 0-length or
* NULL, will result in the keyword being removed. No error is given if
* that keyword does not exist.
* @param status Returns any error information while performing this operation.
*
* @internal
*/
void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status);
/**
* returns the locale's three-letter language code, as specified
* in ISO draft standard ISO-639-2.
@@ -633,7 +649,7 @@ public:
static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
/**
* Gets a list of all available 2-letter country codes defined in ISO 639. This is a
* Gets a list of all available 2-letter country codes defined in ISO 3166. This is a
* pointer to an array of pointers to arrays of char. All of these pointers are
* owned by ICU-- do not delete them, and do not write through them. The array is
* terminated with a null pointer.
@@ -745,7 +761,8 @@ Locale::getScript() const
inline const char *
Locale::getVariant() const
{
return &fullName[variantBegin];
getBaseName(); // lazy init
return &baseName[variantBegin];
}
inline const char *
@@ -762,4 +779,3 @@ Locale::isBogus(void) const {
U_NAMESPACE_END
#endif
+126 -92
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2007-2009, International Business Machines Corporation and others. All Rights Reserved.
* Copyright (C) 2007-2010, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************************
*
* File MSGFMT.H
@@ -11,8 +12,7 @@
* 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
@@ -20,10 +20,10 @@
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Formats messages in a language-neutral way.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/format.h"
@@ -38,68 +38,68 @@ 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
* MessageFormat produces concatenated messages in a language-neutral
* way. Use this whenever concatenating strings that are displayed 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
*
* <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
*
* <P>When formatting, 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
* formats it into a string. The resulting strings are then assembled
* within the string template of the MessageFormat to produce the
* final output string.
* <p>
* <strong>Note:</strong>
*
* <p><strong>Note:</strong>
* In ICU 4.0 MessageFormat supports named arguments. If a named argument
* is used, all arguments must be named. Names start with a character in
* <code>UCHAR_ID_START</code> and continue with characters in
* is used, all arguments must be named. Names start with a character in
* <code>UCHAR_ID_START</code> and continue with characters in
* <code>UCHARID_CONTINUE</code>, in particular they do not start with a digit.
* If named arguments are used, {@link #usesNamedArguments()} will return true.
* <p>
* The other new methods supporting named arguments are
*
* <p>The other new methods supporting named arguments are
* {@link #getFormatNames(UErrorCode& status)},
* {@link #getFormat(const UnicodeString& formatName, UErrorCode& status)}
* {@link #setFormat(const UnicodeString& formatName, const Format& format, UErrorCode& status)},
* {@link #adoptFormat(const UnicodeString& formatName, Format* formatToAdopt, UErrorCode& status)},
* {@link #format(const Formattable* arguments, const UnicodeString *argumentNames, int32_t cnt, UnicodeString& appendTo, FieldPosition& status, int32_t recursionProtection, UErrorCode& success)},
* {@link #format(const UnicodeString* argumentNames, const Formattable* arguments, int32_t count, UnicodeString& appendTo,UErrorCode& status)}.
* These methods are all compatible with patterns that do not used named arguments--
* in these cases the keys in the input or output use <code>UnicodeString</code>s
* {@link #format(const UnicodeString* argumentNames, const Formattable* arguments,
* int32_t count, UnicodeString& appendTo,UErrorCode& status)}.
* These methods are all compatible with patterns that do not used named arguments--
* in these cases the keys in the input or output use <code>UnicodeString</code>s
* that name the argument indices, e.g. "0", "1", "2"... etc.
* <p>
* When named arguments are used, certain methods on MessageFormat that take or
*
* <p>If this format uses named arguments, certain methods that take or
* return arrays do not perform any action, since it is not possible to
* identify positions in an array using a name. UErrorCode is set to
* U_ARGUMENT_TYPE_MISMATCH if there is a status/success field in the method.
* These methods are
* identify positions in an array using a name. Of these methods,
* UErrorCode is set to U_ILLEGAL_ARGUMENT_ERROR by format, and to
* U_ARGUMENT_TYPE_MISMATCH by parse.
* These methods are
* {@link #adoptFormats(Format** formatsToAdopt, int32_t count)},
* {@link #setFormats(const Format** newFormats,int32_t count)},
* {@link #adoptFormat(int32_t n, Format *newFormat)},
* {@link #getFormats(int32_t& count)},
* {@link #format(const Formattable* source,int32_t cnt,UnicodeString& appendTo, FieldPosition& ignore, UErrorCode& success)},
* {@link #setFormat(int32_t n, Format& newFormat)},
* {@link #format(const Formattable* source, int32_t count, UnicodeString& appendTo, FieldPosition& ignore, UErrorCode& success)},
* {@link #format(const UnicodeString& pattern,const Formattable* arguments,int32_t cnt,UnicodeString& appendTo,UErrorCode& success)},
* {@link #format(const Formattable& source, UnicodeString& appendTo,FieldPosition& ignore, UErrorCode& success)},
* {@link #format(const Formattable& source, UnicodeString& appendTo, FieldPosition& ignore, UErrorCode& success)},
* {@link #format(const Formattable* arguments, int32_t cnt, UnicodeString& appendTo, FieldPosition& status, int32_t recursionProtection,UErrorCode& success)},
* {@link #parse(const UnicodeString& source, ParsePosition& pos,int32_t& count)},
* {@link #parse(const UnicodeString& source, ParsePosition& pos, int32_t& count)},
* {@link #parse(const UnicodeString& source, int32_t& cnt, UErrorCode& status)}
* <p>
*
* <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
* against input 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
@@ -110,7 +110,7 @@ class DateFormat;
* <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
* <LI>If the format of an argument 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
@@ -178,7 +178,7 @@ class DateFormat;
* (group that may be repeated)*
* \endcode
* </pre>
* Do not confuse optional items with items inside quotes braces, such
* Do not confuse optional items with items inside quoted braces, such
* as this: "{". Quoted braces are literals.
* <pre>
* \code
@@ -190,6 +190,11 @@ class DateFormat;
* | "date" { "," datetimeStyle }
* | "number" { "," numberStyle }
* | "choice" "," choiceStyle
* | "spellout" { "," spelloutStyle }
* | "ordinal" { "," spelloutStyle }
* | "duration" { "," spelloutStyle }
* | "plural" "," pluralStyle
* | "select" "," selectStyle
*
* datetimeStyle := "short"
* | "medium"
@@ -203,16 +208,22 @@ class DateFormat;
* | numberFormatPattern
*
* choiceStyle := choiceFormatPattern
*
* pluralStyle := pluralFormatPattern
*
* pluralStyle := pluralFormatPattern
*
* selectStyle := selectFormatPattern
*
* spelloutStyle := ruleSetName
* \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.
* DateFormat::createTimeInstance(DateFormat::kDefault, ...) or
* DateFormat::createDateInstance(DateFormat::kDefault, ...). For
* a RuleBasedNumberFormat, if there is no ruleSetName, the default
* rule set is used. For a ChoiceFormat or PluralFormat or SelectFormat, 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
@@ -245,7 +256,7 @@ class DateFormat;
* 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
* 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
@@ -346,7 +357,7 @@ public:
* 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
* @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.
@@ -420,7 +431,7 @@ public:
* Applies the given pattern string to this message format.
*
* @param pattern The pattern to be applied.
* @param parseError Struct to recieve information on position
* @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.
@@ -448,7 +459,10 @@ public:
* 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.
*
*
* <p>If this format uses named arguments, the new formats are discarded
* and this format remains unchanged.
*
* @stable ICU 2.0
* @param formatsToAdopt the format to be adopted.
* @param count the size of the array.
@@ -461,7 +475,10 @@ public:
* 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.
*
*
* <p>If this format uses named arguments, the new formats are discarded
* and this format remains unchanged.
*
* @stable ICU 2.0
* @param newFormats the new format to be set.
* @param cnt the size of the array.
@@ -475,6 +492,10 @@ public:
* 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.
*
* <p>If this format uses named arguments, the new format is discarded
* and this format remains unchanged.
*
* @stable ICU 2.0
* @param formatNumber index of the subformat.
* @param formatToAdopt the format to be adopted.
@@ -494,32 +515,32 @@ public:
/**
* Gets format names. This function returns formatNames in StringEnumerations
* which can be used with getFormat() and setFormat() to export formattable
* array from current MessageFormat to another. It is caller's resposibility
* which can be used with getFormat() and setFormat() to export formattable
* array from current MessageFormat to another. It is caller's resposibility
* to delete the returned formatNames.
* @param status output param set to success/failure code.
* @stable ICU 4.0
*/
virtual StringEnumeration* getFormatNames(UErrorCode& status);
/**
* Gets subformat pointer for given format name.
* Gets subformat pointer for given format name.
* This function supports both named and numbered
* arguments-- if numbered, the formatName is the
* corresponding UnicodeStrings (e.g. "0", "1", "2"...).
* The returned Format object should not be deleted by the caller,
* nor should the ponter of other object . The pointer and its
* nor should the ponter of other object . The pointer and its
* contents remain valid only until the next call to any method
* of this class is made with this object.
* of this class is made with this object.
* @param formatName the name or number specifying a format
* @param status output param set to success/failure code.
* @stable ICU 4.0
*/
virtual Format* getFormat(const UnicodeString& formatName, UErrorCode& status);
/**
* Sets one subformat for given format name.
* See the class description about format name.
* See the class description about format name.
* This function supports both named and numbered
* arguments-- if numbered, the formatName is the
* corresponding UnicodeStrings (e.g. "0", "1", "2"...).
@@ -531,10 +552,10 @@ public:
* @stable ICU 4.0
*/
virtual void setFormat(const UnicodeString& formatName, const Format& format, UErrorCode& status);
/**
* Sets one subformat for given format name.
* See the class description about format name.
* See the class description about format name.
* This function supports both named and numbered
* arguments-- if numbered, the formatName is the
* corresponding UnicodeStrings (e.g. "0", "1", "2"...).
@@ -548,13 +569,13 @@ public:
*/
virtual void adoptFormat(const UnicodeString& formatName, Format* formatToAdopt, UErrorCode& status);
/**
* 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.
* until the next call to this format. 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.
@@ -562,10 +583,16 @@ public:
*/
virtual const Format** getFormats(int32_t& count) const;
// using Format::format;
/**
* Formats the given array of arguments into a user-readable string.
* Does not take ownership of the Formattable* array or its contents.
*
* <p>If this format uses named arguments, appendTo is unchanged and
* status is set to U_ILLEGAL_ARGUMENT_ERROR.
*
* @param source An array of objects to be formatted.
* @param count The number of elements of 'source'.
* @param appendTo Output parameter to receive result.
@@ -576,16 +603,19 @@ public:
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
UnicodeString& format( const Formattable* source,
int32_t count,
UnicodeString& appendTo,
FieldPosition& ignore,
UErrorCode& status) const;
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.
*
* <p>If this format uses named arguments, appendTo is unchanged and
* status is set to U_ILLEGAL_ARGUMENT_ERROR.
*
* @param pattern The pattern.
* @param arguments An array of objects to be formatted.
* @param count The number of elements of 'source'.
@@ -608,6 +638,9 @@ public:
* object of type kArray. If the Formattable object type is not of
* type kArray, then returns a failing UErrorCode.
*
* <p>If this format uses named arguments, appendTo is unchanged and
* status is set to U_ILLEGAL_ARGUMENT_ERROR.
*
* @param obj A Formattable of type kArray containing
* arguments to be formatted.
* @param appendTo Output parameter to receive result.
@@ -641,7 +674,7 @@ public:
UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
UErrorCode& status) const;
/**
* Formats the given array of arguments into a user-defined argument name
@@ -651,7 +684,7 @@ public:
*
* @param argumentNames argument name array
* @param arguments An array of objects to be formatted.
* @param count The number of elements of 'argumentNames' and
* @param count The number of elements of 'argumentNames' and
* arguments. The number of argumentNames and arguments
* must be the same.
* @param appendTo Output parameter to receive result.
@@ -679,27 +712,28 @@ public:
* the array and its contents.
* @stable ICU 2.0
*/
virtual Formattable* parse( const UnicodeString& source,
ParsePosition& pos,
int32_t& count) const;
virtual Formattable* parse(const UnicodeString& source,
ParsePosition& pos,
int32_t& count) const;
/**
* Parses the given string into an array of output arguments.
*
* <p>If this format uses named arguments, status is set to
* U_ARGUMENT_TYPE_MISMATCH.
*
* @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.
* If the MessageFormat is named argument, the status is
* set to U_ARGUMENT_TYPE_MISMATCH.
* pattern cannot be parsed, set to failure code.
* @return an array of parsed arguments. The caller owns both
* the array and its contents. Return NULL if status is not U_ZERO_ERROR.
*
* the array and its contents. Returns NULL if status is not U_ZERO_ERROR.
*
* @stable ICU 2.0
*/
virtual Formattable* parse( const UnicodeString& source,
int32_t& count,
UErrorCode& status) const;
virtual Formattable* parse(const UnicodeString& source,
int32_t& count,
UErrorCode& status) const;
/**
* Parses the given string into an array of output arguments
@@ -720,7 +754,7 @@ public:
/**
* Convert an 'apostrophe-friendly' pattern into a standard
* pattern. Standard patterns treat all apostrophes as
* quotes, which is problematic in some languages, e.g.
* 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,
@@ -736,9 +770,9 @@ public:
* @return the standard equivalent of the original pattern
* @stable ICU 3.4
*/
static UnicodeString autoQuoteApostrophe(const UnicodeString& pattern,
static UnicodeString autoQuoteApostrophe(const UnicodeString& pattern,
UErrorCode& status);
/**
* Returns true if this MessageFormat uses named arguments,
* and false otherwise. See class description.
@@ -747,7 +781,7 @@ public:
* @stable ICU 4.0
*/
UBool usesNamedArguments() const;
/**
* This API is for ICU internal use only.
@@ -786,7 +820,7 @@ public:
* @stable ICU 2.0
*/
static UClassID U_EXPORT2 getStaticClassID(void);
private:
Locale fLocale;
@@ -829,7 +863,7 @@ private:
/**
* Is true iff all argument names are non-negative numbers.
*
*
*/
UBool isArgNumeric;
@@ -885,8 +919,8 @@ private:
FieldPosition& status,
int32_t recursionProtection,
UErrorCode& success) const;
UnicodeString& format( const Formattable* arguments,
UnicodeString& format( const Formattable* arguments,
const UnicodeString *argumentNames,
int32_t cnt,
UnicodeString& appendTo,
@@ -916,7 +950,7 @@ private:
static void copyAndFixQuotes(const UnicodeString& appendTo, int32_t start, int32_t end, UnicodeString& target);
/**
* Returns array of argument types in the parsed pattern
* 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
@@ -925,16 +959,16 @@ private:
*/
const Formattable::Type* getArgTypeList(int32_t& listCount) const {
listCount = argTypeCount;
return argTypes;
return argTypes;
}
/**
* Returns FALSE if the argument name is not legal.
* @param argName argument name.
* @return TRUE if the argument name is legal, otherwise return FALSE.
*/
UBool isLegalArgName(const UnicodeString& argName) const;
friend class MessageFormatAdapter; // getFormatTypeList() access
};
@@ -944,10 +978,10 @@ MessageFormat::format(const Formattable& obj,
UErrorCode& status) const {
return Format::format(obj, appendTo, status);
}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // _MSGFMT
//eof
+479
View File
@@ -0,0 +1,479 @@
/*
*******************************************************************************
*
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: normalizer2.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2009nov22
* created by: Markus W. Scherer
*/
#ifndef __NORMALIZER2_H__
#define __NORMALIZER2_H__
/**
* \file
* \brief C++ API: New API for Unicode Normalization.
*/
#include "unicode/utypes.h"
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uniset.h"
#include "unicode/unistr.h"
#include "unicode/unorm2.h"
U_NAMESPACE_BEGIN
/**
* Unicode normalization functionality for standard Unicode normalization or
* for using custom mapping tables.
* All instances of this class are unmodifiable/immutable.
* Instances returned by getInstance() are singletons that must not be deleted by the caller.
*
* The primary functions are to produce a normalized string and to detect whether
* a string is already normalized.
* The most commonly used normalization forms are those defined in
* http://www.unicode.org/unicode/reports/tr15/
* However, this API supports additional normalization forms for specialized purposes.
* For example, NFKC_Casefold is provided via getInstance("nfkc_cf", COMPOSE)
* and can be used in implementations of UTS #46.
*
* Not only are the standard compose and decompose modes supplied,
* but additional modes are provided as documented in the Mode enum.
*
* Some of the functions in this class identify normalization boundaries.
* At a normalization boundary, the portions of the string
* before it and starting from it do not interact and can be handled independently.
*
* The spanQuickCheckYes() stops at a normalization boundary.
* When the goal is a normalized string, then the text before the boundary
* can be copied, and the remainder can be processed with normalizeSecondAndAppend().
*
* The hasBoundaryBefore(), hasBoundaryAfter() and isInert() functions test whether
* a character is guaranteed to be at a normalization boundary,
* regardless of context.
* This is used for moving from one normalization boundary to the next
* or preceding boundary, and for performing iterative normalization.
*
* Iterative normalization is useful when only a small portion of a
* longer string needs to be processed.
* For example, in ICU, iterative normalization is used by the NormalizationTransliterator
* (to avoid replacing already-normalized text) and ucol_nextSortKeyPart()
* (to process only the substring for which sort key bytes are computed).
*
* The set of normalization boundaries returned by these functions may not be
* complete: There may be more boundaries that could be returned.
* Different functions may return different boundaries.
* @draft ICU 4.4
*/
class U_COMMON_API Normalizer2 : public UObject {
public:
/**
* Returns a Normalizer2 instance which uses the specified data file
* (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
* and which composes or decomposes text according to the specified mode.
* Returns an unmodifiable singleton instance. Do not delete it.
*
* Use packageName=NULL for data files that are part of ICU's own data.
* Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
* Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
* Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
*
* @param packageName NULL for ICU built-in data, otherwise application data package name
* @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
* @param mode normalization mode (compose or decompose etc.)
* @param errorCode 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 requested Normalizer2, if successful
* @draft ICU 4.4
*/
static const Normalizer2 *
getInstance(const char *packageName,
const char *name,
UNormalization2Mode mode,
UErrorCode &errorCode);
/**
* Returns the normalized form of the source string.
* @param src source string
* @param errorCode 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 normalized src
* @draft ICU 4.4
*/
UnicodeString
normalize(const UnicodeString &src, UErrorCode &errorCode) const {
UnicodeString result;
normalize(src, result, errorCode);
return result;
}
/**
* Writes the normalized form of the source string to the destination string
* (replacing its contents) and returns the destination string.
* The source and destination strings must be different objects.
* @param src source string
* @param dest destination string; its contents is replaced with normalized src
* @param errorCode 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 dest
* @draft ICU 4.4
*/
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
UErrorCode &errorCode) const = 0;
/**
* Appends the normalized form of the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if the first string was normalized.
* The first and second strings must be different objects.
* @param first string, should be normalized
* @param second string, will be normalized
* @param errorCode 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 first
* @draft ICU 4.4
*/
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const = 0;
/**
* Appends the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if both the strings were normalized.
* The first and second strings must be different objects.
* @param first string, should be normalized
* @param second string, should be normalized
* @param errorCode 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 first
* @draft ICU 4.4
*/
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const = 0;
/**
* Tests if the string is normalized.
* Internally, in cases where the quickCheck() method would return "maybe"
* (which is only possible for the two COMPOSE modes) this method
* resolves to "yes" or "no" to provide a definitive result,
* at the cost of doing more work in those cases.
* @param s input string
* @param errorCode 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 TRUE if s is normalized
* @draft ICU 4.4
*/
virtual UBool
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0;
/**
* Tests if the string is normalized.
* For the two COMPOSE modes, the result could be "maybe" in cases that
* would take a little more work to resolve definitively.
* Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
* combination of quick check + normalization, to avoid
* re-checking the "yes" prefix.
* @param s input string
* @param errorCode 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 UNormalizationCheckResult
* @draft ICU 4.4
*/
virtual UNormalizationCheckResult
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const = 0;
/**
* Returns the end of the normalized substring of the input string.
* In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
* the substring <code>UnicodeString(s, 0, end)</code>
* will pass the quick check with a "yes" result.
*
* The returned end index is usually one or more characters before the
* "no" or "maybe" character: The end index is at a normalization boundary.
* (See the class documentation for more about normalization boundaries.)
*
* When the goal is a normalized string and most input strings are expected
* to be normalized already, then call this method,
* and if it returns a prefix shorter than the input string,
* copy that prefix and use normalizeSecondAndAppend() for the remainder.
* @param s input string
* @param errorCode 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 "yes" span end index
* @draft ICU 4.4
*/
virtual int32_t
spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const = 0;
/**
* Tests if the character always has a normalization boundary before it,
* regardless of context.
* If true, then the character does not normalization-interact with
* preceding characters.
* In other words, a string containing this character can be normalized
* by processing portions before this character and starting from this
* character independently.
* This is used for iterative normalization. See the class documentation for details.
* @param c character to test
* @return TRUE if c has a normalization boundary before it
* @draft ICU 4.4
*/
virtual UBool hasBoundaryBefore(UChar32 c) const = 0;
/**
* Tests if the character always has a normalization boundary after it,
* regardless of context.
* If true, then the character does not normalization-interact with
* following characters.
* In other words, a string containing this character can be normalized
* by processing portions up to this character and after this
* character independently.
* This is used for iterative normalization. See the class documentation for details.
* Note that this operation may be significantly slower than hasBoundaryBefore().
* @param c character to test
* @return TRUE if c has a normalization boundary after it
* @draft ICU 4.4
*/
virtual UBool hasBoundaryAfter(UChar32 c) const = 0;
/**
* Tests if the character is normalization-inert.
* If true, then the character does not change, nor normalization-interact with
* preceding or following characters.
* In other words, a string containing this character can be normalized
* by processing portions before this character and after this
* character independently.
* This is used for iterative normalization. See the class documentation for details.
* Note that this operation may be significantly slower than hasBoundaryBefore().
* @param c character to test
* @return TRUE if c is normalization-inert
* @draft ICU 4.4
*/
virtual UBool isInert(UChar32 c) const = 0;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @returns a UClassID for this class.
* @draft ICU 4.4
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @draft ICU 4.4
*/
virtual UClassID getDynamicClassID() const = 0;
};
/**
* Normalization filtered by a UnicodeSet.
* Normalizes portions of the text contained in the filter set and leaves
* portions not contained in the filter set unchanged.
* Filtering is done via UnicodeSet::span(..., USET_SPAN_SIMPLE).
* Not-in-the-filter text is treated as "is normalized" and "quick check yes".
* This class implements all of (and only) the Normalizer2 API.
* An instance of this class is unmodifiable/immutable but is constructed and
* must be destructed by the owner.
* @draft ICU 4.4
*/
class U_COMMON_API FilteredNormalizer2 : public Normalizer2 {
public:
/**
* Constructs a filtered normalizer wrapping any Normalizer2 instance
* and a filter set.
* Both are aliased and must not be modified or deleted while this object
* is used.
* The filter set should be frozen; otherwise the performance will suffer greatly.
* @param n2 wrapped Normalizer2 instance
* @param filterSet UnicodeSet which determines the characters to be normalized
* @draft ICU 4.4
*/
FilteredNormalizer2(const Normalizer2 &n2, const UnicodeSet &filterSet) :
norm2(n2), set(filterSet) {}
/**
* Writes the normalized form of the source string to the destination string
* (replacing its contents) and returns the destination string.
* The source and destination strings must be different objects.
* @param src source string
* @param dest destination string; its contents is replaced with normalized src
* @param errorCode 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 dest
* @draft ICU 4.4
*/
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
UErrorCode &errorCode) const;
/**
* Appends the normalized form of the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if the first string was normalized.
* The first and second strings must be different objects.
* @param first string, should be normalized
* @param second string, will be normalized
* @param errorCode 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 first
* @draft ICU 4.4
*/
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const;
/**
* Appends the second string to the first string
* (merging them at the boundary) and returns the first string.
* The result is normalized if both the strings were normalized.
* The first and second strings must be different objects.
* @param first string, should be normalized
* @param second string, should be normalized
* @param errorCode 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 first
* @draft ICU 4.4
*/
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const;
/**
* Tests if the string is normalized.
* For details see the Normalizer2 base class documentation.
* @param s input string
* @param errorCode 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 TRUE if s is normalized
* @draft ICU 4.4
*/
virtual UBool
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const;
/**
* Tests if the string is normalized.
* For details see the Normalizer2 base class documentation.
* @param s input string
* @param errorCode 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 UNormalizationCheckResult
* @draft ICU 4.4
*/
virtual UNormalizationCheckResult
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const;
/**
* Returns the end of the normalized substring of the input string.
* For details see the Normalizer2 base class documentation.
* @param s input string
* @param errorCode 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 "yes" span end index
* @draft ICU 4.4
*/
virtual int32_t
spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const;
/**
* Tests if the character always has a normalization boundary before it,
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c has a normalization boundary before it
* @draft ICU 4.4
*/
virtual UBool hasBoundaryBefore(UChar32 c) const;
/**
* Tests if the character always has a normalization boundary after it,
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c has a normalization boundary after it
* @draft ICU 4.4
*/
virtual UBool hasBoundaryAfter(UChar32 c) const;
/**
* Tests if the character is normalization-inert.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c is normalization-inert
* @draft ICU 4.4
*/
virtual UBool isInert(UChar32 c) const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @returns a UClassID for this class.
* @draft ICU 4.4
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @draft ICU 4.4
*/
virtual UClassID getDynamicClassID() const;
private:
UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
USetSpanCondition spanCondition,
UErrorCode &errorCode) const;
UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
UBool doNormalize,
UErrorCode &errorCode) const;
const Normalizer2 &norm2;
const UnicodeSet &set;
};
U_NAMESPACE_END
#endif // !UCONFIG_NO_NORMALIZATION
#endif // __NORMALIZER2_H__
+25 -51
View File
@@ -1,7 +1,7 @@
/*
********************************************************************
* COPYRIGHT:
* Copyright (c) 1996-2006, International Business Machines Corporation and
* Copyright (c) 1996-2010, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************
*/
@@ -18,14 +18,11 @@
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uobject.h"
#include "unicode/unistr.h"
#include "unicode/chariter.h"
#include "unicode/normalizer2.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
struct UCharIterator;
typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
/**
@@ -33,6 +30,10 @@ U_NAMESPACE_BEGIN
* <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
* Unicode Standard Annex #15: Unicode Normalization Forms</a>.
*
* Note: This API has been replaced by the Normalizer2 class and is only available
* for backward compatibility. This class simply delegates to the Normalizer2 class.
* There is one exception: The new API does not provide a replacement for Normalizer::compare().
*
* The Normalizer class consists of two parts:
* - static functions that normalize strings or test if strings are normalized
* - a Normalizer object is an iterator that takes any kind of text and
@@ -40,13 +41,11 @@ U_NAMESPACE_BEGIN
*
* The Normalizer class is not suitable for subclassing.
*
* The static functions are basically wrappers around the C implementation,
* using UnicodeString instead of UChar*.
* For basic information about normalization forms and details about the C API
* please see the documentation in unorm.h.
*
* The iterator API with the Normalizer constructors and the non-static functions
* uses a CharacterIterator as input. It is possible to pass a string which
* use a CharacterIterator as input. It is possible to pass a string which
* is then internally wrapped in a CharacterIterator.
* The input text is not normalized all at once, but incrementally where needed
* (providing efficient random access).
@@ -117,6 +116,14 @@ U_NAMESPACE_BEGIN
* then the internal index is 0 and one can return to this getIndex()
* later with setIndexOnly().
*
* Note: While the setIndex() and getIndex() refer to indices in the
* underlying Unicode input text, the next() and previous() methods
* iterate through characters in the normalized output.
* This means that there is not necessarily a one-to-one correspondence
* between characters returned by next() and previous() and the indices
* passed to and returned from setIndex() and getIndex().
* It is for this reason that Normalizer does not implement the CharacterIterator interface.
*
* @author Laura Werner, Mark Davis, Markus Scherer
* @stable ICU 2.0
*/
@@ -287,7 +294,7 @@ public:
* @see isNormalized
* @stable ICU 2.6
*/
static inline UNormalizationCheckResult
static UNormalizationCheckResult
quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status);
/**
@@ -328,7 +335,7 @@ public:
* @see quickCheck
* @stable ICU 2.6
*/
static inline UBool
static UBool
isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode);
/**
@@ -726,18 +733,20 @@ private:
UBool nextNormalize();
UBool previousNormalize();
void init(CharacterIterator *iter);
void init();
void clearBuffer(void);
//-------------------------------------------------------------------------
// Private data
//-------------------------------------------------------------------------
FilteredNormalizer2*fFilteredNorm2; // owned if not NULL
const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2
UNormalizationMode fUMode;
int32_t fOptions;
// The input text and our position in it
UCharIterator *text;
CharacterIterator *text;
// The normalization buffer is the result of normalization
// of the source in [currentIndex..nextIndex[ .
@@ -746,7 +755,6 @@ private:
// A buffer for holding intermediate results
UnicodeString buffer;
int32_t bufferPos;
};
//-------------------------------------------------------------------------
@@ -761,48 +769,14 @@ inline UNormalizationCheckResult
Normalizer::quickCheck(const UnicodeString& source,
UNormalizationMode mode,
UErrorCode &status) {
if(U_FAILURE(status)) {
return UNORM_MAYBE;
}
return unorm_quickCheck(source.getBuffer(), source.length(),
mode, &status);
}
inline UNormalizationCheckResult
Normalizer::quickCheck(const UnicodeString& source,
UNormalizationMode mode, int32_t options,
UErrorCode &status) {
if(U_FAILURE(status)) {
return UNORM_MAYBE;
}
return unorm_quickCheckWithOptions(source.getBuffer(), source.length(),
mode, options, &status);
return quickCheck(source, mode, 0, status);
}
inline UBool
Normalizer::isNormalized(const UnicodeString& source,
UNormalizationMode mode,
UErrorCode &status) {
if(U_FAILURE(status)) {
return FALSE;
}
return unorm_isNormalized(source.getBuffer(), source.length(),
mode, &status);
}
inline UBool
Normalizer::isNormalized(const UnicodeString& source,
UNormalizationMode mode, int32_t options,
UErrorCode &status) {
if(U_FAILURE(status)) {
return FALSE;
}
return unorm_isNormalizedWithOptions(source.getBuffer(), source.length(),
mode, options, &status);
return isNormalized(source, mode, 0, status);
}
inline int32_t
+169 -10
View File
@@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2009, International Business Machines Corporation and others.
* Copyright (C) 1997-2010, International Business Machines Corporation and others.
* All Rights Reserved.
********************************************************************************
*
@@ -25,16 +25,17 @@
#include "unicode/utypes.h"
/**
* \file
* \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"
#include "unicode/stringpiece.h"
U_NAMESPACE_BEGIN
@@ -108,16 +109,16 @@ class StringEnumeration;
* fraction from 0.53 is displayed as 53%.
* <P>
* Starting from ICU 4.2, you can use createInstance() by passing in a 'style'
* as parameter to get the correct instance.
* For example,
* as parameter to get the correct instance.
* For example,
* use createInstance(...kNumberStyle...) to get the normal number format,
* createInstance(...kPercentStyle...) to get a format for displaying
* createInstance(...kPercentStyle...) to get a format for displaying
* percentage,
* createInstance(...kScientificStyle...) to get a format for displaying
* createInstance(...kScientificStyle...) to get a format for displaying
* scientific number,
* createInstance(...kCurrencyStyle...) to get the currency number format,
* createInstance(...kCurrencyStyle...) to get the currency number format,
* in which the currency is represented by its symbol, for example, "$3.00".
* createInstance(...kIsoCurrencyStyle...) to get the currency number format,
* createInstance(...kIsoCurrencyStyle...) to get the currency number format,
* in which the currency is represented by its ISO code, for example "USD3.00".
* createInstance(...kPluralCurrencyStyle...) to get the currency number format,
* in which the currency is represented by its full name in plural format,
@@ -190,13 +191,25 @@ public:
* Signifies that the position of the integer part or fraction part of
* a formatted number should be returned.
*
* Note: as of ICU 4.4, the values in this enum have been extended to
* support identification of all number format fields, not just those
* pertaining to alignment.
*
* @see FieldPosition
* @stable ICU 2.0
*/
enum EAlignmentFields {
kIntegerField,
kFractionField,
kDecimalSeparatorField,
kExponentSymbolField,
kExponentSignField,
kExponentField,
kGroupingSeparatorField,
kCurrencyField,
kPercentField,
kPermillField,
kSignField,
/**
* These constants are provided for backwards compatibility only.
@@ -221,6 +234,9 @@ public:
*/
virtual UBool operator==(const Format& other) const;
// using Format::format;
/**
* Format an object to produce a string. This method handles
* Formattable objects with numeric types. If the Formattable
@@ -241,6 +257,27 @@ public:
FieldPosition& pos,
UErrorCode& status) 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Can be
* NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Parse a string to produce an object. This methods handles
* parsing of numeric strings into Formattable objects with numeric
@@ -327,6 +364,24 @@ public:
virtual UnicodeString& format(double number,
UnicodeString& appendTo,
FieldPosition& pos) const = 0;
/**
* Format a double number. Subclasses must implement
* this method.
*
* @param number The value to be formatted.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(double number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a long number. Concrete subclasses must implement
* these pure virtual methods.
@@ -343,6 +398,24 @@ public:
UnicodeString& appendTo,
FieldPosition& pos) const = 0;
/**
* Format an int32 number. Subclasses must implement
* this method.
*
* @param number The value to be formatted.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(int32_t number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format an int64 number. (Not abstract to retain compatibility
* with earlier releases, however subclasses should override this
@@ -359,6 +432,92 @@ public:
virtual UnicodeString& format(int64_t number,
UnicodeString& appendTo,
FieldPosition& pos) const;
/**
* Format an int64 number. Subclasses must implement
* this method.
*
* @param number The value to be formatted.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(int64_t number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number. Subclasses must implement
* this method. The syntax of the unformatted number is a "numeric string"
* as defined in the Decimal Arithmetic Specification, available at
* http://speleotrove.com/decimal
*
* @param number The unformatted number, as a string, to be formatted.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* Can be NULL.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @draft 4.4
*/
virtual UnicodeString& format(const StringPiece &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
public:
/**
* Format a decimal number.
* The number is a DigitList wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that. Subclasses of NumberFormat that want
* to specifically handle big decimal numbers must override this method.
* class DecimalFormat does so.
*
* @param number The number, a DigitList format Decimal Floating Point.
* @param appendTo Output parameter to receive result.
* Result is appended to existing contents.
* @param posIter On return, can be used to iterate over positions
* of fields generated by this format call.
* @param status Output param filled with success/failure status.
* @return Reference to 'appendTo' parameter.
* @internal
*/
virtual UnicodeString& format(const DigitList &number,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a decimal number.
* The number is a DigitList wrapper onto a floating point decimal number.
* The default implementation in NumberFormat converts the decimal number
* to a double and formats that. Subclasses of NumberFormat that want
* to specifically handle big decimal numbers must override this method.
* class DecimalFormat does so.
*
* @param number The number, a DigitList format Decimal Floating Point.
* @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.
* @internal
*/
virtual UnicodeString& format(const DigitList &number,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
public:
/**
* Redeclared Format method.
* @param obj The object to be formatted.
+14 -14
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2009, International Business Machines Corporation and
* Copyright (C) 2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -52,19 +52,19 @@ public:
/**
* Default Constructor.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
NumberingSystem();
/**
* Copy constructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
NumberingSystem(const NumberingSystem& other);
/**
* Destructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~NumberingSystem();
@@ -72,13 +72,13 @@ public:
* Create the default numbering system associated with the specified locale.
* @param inLocale The given locale.
* @param status ICU status
* @draft ICU 4.2
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstance(const Locale & inLocale, UErrorCode& status);
/**
* Create the default numbering system associated with the default locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstance(UErrorCode& status);
@@ -89,13 +89,13 @@ public:
* @param description The string representing the set of digits used in a numeric system, or the name of the RBNF
* ruleset to be used in an algorithmic system.
* @param status ICU status
* @draft ICU 4.2
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstance(int32_t radix, UBool isAlgorithmic, const UnicodeString& description, UErrorCode& status );
/**
* Return a StringEnumeration over all the names of numbering systems known to ICU.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status);
@@ -104,14 +104,14 @@ public:
* Create a numbering system from one of the predefined numbering systems known to ICU.
* @param name The name of the numbering system.
* @param status ICU status
* @draft ICU 4.2
* @stable ICU 4.2
*/
static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status);
/**
* Returns the radix of this numbering system.
* @draft ICU 4.2
* @stable ICU 4.2
*/
int32_t getRadix();
@@ -119,7 +119,7 @@ public:
* Returns the description string of this numbering system, which is either
* the string of digits in the case of simple systems, or the ruleset name
* in the case of algorithmic systems.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UnicodeString getDescription();
@@ -130,14 +130,14 @@ public:
*
* @return TRUE if the numbering system is algorithmic.
* Otherwise, return FALSE.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool isAlgorithmic() const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
* @draft ICU 4.2
* @stable ICU 4.2
*
*/
static UClassID U_EXPORT2 getStaticClassID(void);
@@ -145,7 +145,7 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UClassID getDynamicClassID() const;
+108 -88
View File
@@ -1,11 +1,15 @@
/*
******************************************************************************
*
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* Note: autoconf creates platform.h from platform.h.in at configure time.
*
******************************************************************************
*
* FILE NAME : platform.h
*
* Date Name Description
@@ -20,18 +24,36 @@
#define _PLATFORM_H
/**
* \file
* \brief Basic types for the platform
* \file
* \brief Basic types for the platform
*/
/* Define the platform we're on. */
#ifndef U_HAIKU
#define U_HAIKU
/* This file should be included before uvernum.h. */
#if defined(UVERNUM_H)
# error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h
#endif
/**
* Determine wheter to enable auto cleanup of libraries.
* @draft ICU 4.4
*/
#ifndef UCLN_NO_AUTO_CLEANUP
#define UCLN_NO_AUTO_CLEANUP 1
#endif
/* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
#ifndef CYGWINMSVC
/** Define the platform we're on. */
#ifndef U_UNKNOWN_PLATFORM
#define U_UNKNOWN_PLATFORM
#endif
/**
* \def U_HAVE_DIRENT_H
* Define whether dirent.h is available */
* Define whether dirent.h is available
* @internal
*/
#ifndef U_HAVE_DIRENT_H
#define U_HAVE_DIRENT_H 1
#endif
@@ -61,7 +83,7 @@
/**
* \def U_HAVE_STD_STRING
* Define whether the standard C++ (STL) <string> header is available.
* Define whether the standard C++ (STL) &lt;string&gt; header is available.
* For platforms that do not use platform.h and do not define this constant
* in their platform-specific headers, std_string.h defaults
* U_HAVE_STD_STRING to 1.
@@ -107,75 +129,7 @@
/** @} */
/*===========================================================================*/
/** @{ Generic data types */
/*===========================================================================*/
#include <sys/types.h>
/* If your platform does not have the <inttypes.h> header, you may
need to edit the typedefs below. */
#if U_HAVE_INTTYPES_H
/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
/* doesn't have uint8_t depending on the OS version. */
/* So we have this work around. */
#ifdef OS390
/* The features header is needed to get (u)int64_t sometimes. */
#include <features.h>
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if !defined(__uint8_t)
#define __uint8_t 1
typedef unsigned char uint8_t;
#endif
#endif /* OS390 */
#include <inttypes.h>
#else /* U_HAVE_INTTYPES_H */
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if ! U_HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif
#if ! U_HAVE_INT16_T
typedef signed short int16_t;
#endif
#if ! U_HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif
#if ! U_HAVE_INT32_T
typedef signed int int32_t;
#endif
#if ! U_HAVE_UINT32_T
typedef unsigned int uint32_t;
#endif
#if ! U_HAVE_INT64_T
typedef signed long long int64_t;
/* else we may not have a 64-bit type */
#endif
#if ! U_HAVE_UINT64_T
typedef unsigned long long uint64_t;
/* else we may not have a 64-bit type */
#endif
#endif
/** @} */
/*===========================================================================*/
/** @{ Compiler and environment features */
/** @{ Compiler and environment features */
/*===========================================================================*/
/* Define whether namespace is supported */
@@ -193,7 +147,9 @@ typedef unsigned int uint32_t;
#endif
/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
#ifndef ICU_USE_THREADS
#define ICU_USE_THREADS 1
#endif
/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -228,16 +184,28 @@ typedef unsigned int uint32_t;
#define U_ENABLE_TRACING 0
#endif
/* Do we allow ICU users to use the draft APIs by default? */
/**
* Whether to enable Dynamic loading in ICU
* @draft ICU 4.4
*/
#ifndef U_ENABLE_DYLOAD
#define U_ENABLE_DYLOAD 1
#endif
/**
* Whether to test Dynamic loading as an OS capabilty
* @draft ICU 4.4
*/
#ifndef U_CHECK_DYLOAD
#define U_CHECK_DYLOAD 1
#endif
/** Do we allow ICU users to use the draft APIs by default? */
#ifndef U_DEFAULT_SHOW_DRAFT
#define U_DEFAULT_SHOW_DRAFT 1
#endif
/* Define the library suffix in a C syntax. */
#define U_HAVE_LIB_SUFFIX 0
#define U_LIB_SUFFIX_C_NAME
#define U_LIB_SUFFIX_C_NAME_STRING ""
/** @} */
/*===========================================================================*/
@@ -274,11 +242,18 @@ typedef unsigned int uint32_t;
* Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
* instead.
* @internal
*
* \def U_GNUC_UTF16_STRING
* @internal
*/
#ifndef U_GNUC_UTF16_STRING
#define U_GNUC_UTF16_STRING 0
#endif
#if 1 || defined(U_CHECK_UTF16_STRING)
#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
|| (defined(__HP_aCC) && __HP_aCC >= 035000) \
|| (defined(__HP_cc) && __HP_cc >= 111106)
|| (defined(__HP_cc) && __HP_cc >= 111106) \
|| U_GNUC_UTF16_STRING
#define U_DECLARE_UTF16(string) u ## string
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
@@ -326,7 +301,7 @@ typedef unsigned int uint32_t;
#if 0
#define U_EXPORT __attribute__((visibility("default")))
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
#define U_EXPORT __global
/*#elif defined(__HP_aCC) || defined(__HP_cc)
#define U_EXPORT __declspec(dllexport)*/
@@ -338,10 +313,10 @@ typedef unsigned int uint32_t;
#define U_EXPORT2
/* cygwin needs to export/import data */
#ifdef U_CYGWIN
#if defined(U_CYGWIN) && !defined(__GNUC__)
#define U_IMPORT __declspec(dllimport)
#else
#define U_IMPORT
#define U_IMPORT
#endif
/* @} */
@@ -359,7 +334,21 @@ typedef unsigned int uint32_t;
#endif
#ifndef U_ALIGN_CODE
#define U_ALIGN_CODE(n)
#define U_ALIGN_CODE(n)
#endif
/** @} */
/*===========================================================================*/
/** @{ GCC built in functions for atomic memory operations */
/*===========================================================================*/
/**
* \def U_HAVE_GCC_ATOMICS
* @internal
*/
#ifndef U_HAVE_GCC_ATOMICS
#define U_HAVE_GCC_ATOMICS 0
#endif
/** @} */
@@ -378,4 +367,35 @@ typedef unsigned int uint32_t;
/** @} */
#endif /* CYGWINMSVC */
/*===========================================================================*/
/* Custom icu entry point renaming */
/*===========================================================================*/
/**
* Define the library suffix with C syntax.
* @internal
*/
# define U_LIB_SUFFIX_C_NAME
/**
* Define the library suffix as a string with C syntax
* @internal
*/
# define U_LIB_SUFFIX_C_NAME_STRING ""
/**
* 1 if a custom library suffix is set
* @internal
*/
# define U_HAVE_LIB_SUFFIX 0
#if U_HAVE_LIB_SUFFIX
# ifndef U_ICU_ENTRY_POINT_RENAME
/* Renaming pattern: u_strcpy_41_suffix */
# define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## 44 ##
# define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
# endif
#endif
#endif
+101 -81
View File
@@ -1,11 +1,15 @@
/*
******************************************************************************
*
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* Note: autoconf creates platform.h from platform.h.in at configure time.
*
******************************************************************************
*
* FILE NAME : platform.h
*
* Date Name Description
@@ -24,14 +28,32 @@
* \brief Basic types for the platform
*/
/* Define the platform we're on. */
/* This file should be included before uvernum.h. */
#if defined(UVERNUM_H)
# error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h
#endif
/**
* Determine wheter to enable auto cleanup of libraries.
* @draft ICU 4.4
*/
#ifndef UCLN_NO_AUTO_CLEANUP
#define UCLN_NO_AUTO_CLEANUP @UCLN_NO_AUTO_CLEANUP@
#endif
/* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
#ifndef CYGWINMSVC
/** Define the platform we're on. */
#ifndef @platform@
#define @platform@
#endif
/**
* \def U_HAVE_DIRENT_H
* Define whether dirent.h is available */
* Define whether dirent.h is available
* @internal
*/
#ifndef U_HAVE_DIRENT_H
#define U_HAVE_DIRENT_H @U_HAVE_DIRENT_H@
#endif
@@ -61,7 +83,7 @@
/**
* \def U_HAVE_STD_STRING
* Define whether the standard C++ (STL) <string> header is available.
* Define whether the standard C++ (STL) &lt;string&gt; header is available.
* For platforms that do not use platform.h and do not define this constant
* in their platform-specific headers, std_string.h defaults
* U_HAVE_STD_STRING to 1.
@@ -107,75 +129,7 @@
/** @} */
/*===========================================================================*/
/** @{ Generic data types */
/*===========================================================================*/
#include <sys/types.h>
/* If your platform does not have the <inttypes.h> header, you may
need to edit the typedefs below. */
#if U_HAVE_INTTYPES_H
/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
/* doesn't have uint8_t depending on the OS version. */
/* So we have this work around. */
#ifdef OS390
/* The features header is needed to get (u)int64_t sometimes. */
#include <features.h>
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if !defined(__uint8_t)
#define __uint8_t 1
typedef unsigned char uint8_t;
#endif
#endif /* OS390 */
#include <inttypes.h>
#else /* U_HAVE_INTTYPES_H */
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if ! U_HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif
#if ! U_HAVE_INT16_T
typedef signed short int16_t;
#endif
#if ! U_HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif
#if ! U_HAVE_INT32_T
typedef signed int int32_t;
#endif
#if ! U_HAVE_UINT32_T
typedef unsigned int uint32_t;
#endif
#if ! U_HAVE_INT64_T
typedef signed long long int64_t;
/* else we may not have a 64-bit type */
#endif
#if ! U_HAVE_UINT64_T
typedef unsigned long long uint64_t;
/* else we may not have a 64-bit type */
#endif
#endif
/** @} */
/*===========================================================================*/
/** @{ Compiler and environment features */
/** @{ Compiler and environment features */
/*===========================================================================*/
/* Define whether namespace is supported */
@@ -193,7 +147,9 @@ typedef unsigned int uint32_t;
#endif
/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
#ifndef ICU_USE_THREADS
#define ICU_USE_THREADS @ICU_USE_THREADS@
#endif
/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -228,16 +184,28 @@ typedef unsigned int uint32_t;
#define U_ENABLE_TRACING @U_ENABLE_TRACING@
#endif
/* Do we allow ICU users to use the draft APIs by default? */
/**
* Whether to enable Dynamic loading in ICU
* @draft ICU 4.4
*/
#ifndef U_ENABLE_DYLOAD
#define U_ENABLE_DYLOAD @U_ENABLE_DYLOAD@
#endif
/**
* Whether to test Dynamic loading as an OS capabilty
* @draft ICU 4.4
*/
#ifndef U_CHECK_DYLOAD
#define U_CHECK_DYLOAD @U_CHECK_DYLOAD@
#endif
/** Do we allow ICU users to use the draft APIs by default? */
#ifndef U_DEFAULT_SHOW_DRAFT
#define U_DEFAULT_SHOW_DRAFT @U_DEFAULT_SHOW_DRAFT@
#endif
/* Define the library suffix in a C syntax. */
#define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@
#define U_LIB_SUFFIX_C_NAME @ICULIBSUFFIXCNAME@
#define U_LIB_SUFFIX_C_NAME_STRING "@ICULIBSUFFIXCNAME@"
/** @} */
/*===========================================================================*/
@@ -274,11 +242,18 @@ typedef unsigned int uint32_t;
* Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
* instead.
* @internal
*
* \def U_GNUC_UTF16_STRING
* @internal
*/
#ifndef U_GNUC_UTF16_STRING
#define U_GNUC_UTF16_STRING @U_CHECK_GNUC_UTF16_STRING@
#endif
#if @U_CHECK_UTF16_STRING@ || defined(U_CHECK_UTF16_STRING)
#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
|| (defined(__HP_aCC) && __HP_aCC >= 035000) \
|| (defined(__HP_cc) && __HP_cc >= 111106)
|| (defined(__HP_cc) && __HP_cc >= 111106) \
|| U_GNUC_UTF16_STRING
#define U_DECLARE_UTF16(string) u ## string
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
@@ -338,7 +313,7 @@ typedef unsigned int uint32_t;
#define U_EXPORT2
/* cygwin needs to export/import data */
#ifdef U_CYGWIN
#if defined(U_CYGWIN) && !defined(__GNUC__)
#define U_IMPORT __declspec(dllimport)
#else
#define U_IMPORT
@@ -364,6 +339,20 @@ typedef unsigned int uint32_t;
/** @} */
/*===========================================================================*/
/** @{ GCC built in functions for atomic memory operations */
/*===========================================================================*/
/**
* \def U_HAVE_GCC_ATOMICS
* @internal
*/
#ifndef U_HAVE_GCC_ATOMICS
#define U_HAVE_GCC_ATOMICS @U_HAVE_GCC_ATOMICS@
#endif
/** @} */
/*===========================================================================*/
/** @{ Programs used by ICU code */
/*===========================================================================*/
@@ -378,4 +367,35 @@ typedef unsigned int uint32_t;
/** @} */
#endif /* CYGWINMSVC */
/*===========================================================================*/
/* Custom icu entry point renaming */
/*===========================================================================*/
/**
* Define the library suffix with C syntax.
* @internal
*/
# define U_LIB_SUFFIX_C_NAME @ICULIBSUFFIXCNAME@
/**
* Define the library suffix as a string with C syntax
* @internal
*/
# define U_LIB_SUFFIX_C_NAME_STRING "@ICULIBSUFFIXCNAME@"
/**
* 1 if a custom library suffix is set
* @internal
*/
# define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@
#if U_HAVE_LIB_SUFFIX
# ifndef U_ICU_ENTRY_POINT_RENAME
/* Renaming pattern: u_strcpy_41_suffix */
# define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## @LIB_VERSION_MAJOR@ ## @ICULIBSUFFIXCNAME@
# define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##@ICULIBSUFFIXCNAME@##major##minor##_dat
# endif
#endif
#endif
+14 -11
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007-2009, International Business Machines Corporation and
* Copyright (C) 2007-2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
@@ -97,7 +97,7 @@ class Hashtable;
* message text of the plural case "<code>other</code>" gets assigned to this
* plural case. If you specify more than one message for the same plural case,
* U_DUPLICATE_KEYWORD will be set to status.
* <br/>
* <br>
* Spaces between <code><i>caseKeyword</i></code> and
* <code><i>message</i></code> will be ignored; spaces within
* <code><i>message</i></code> will be preserved.
@@ -107,9 +107,9 @@ class Hashtable;
* can use the strings produced by <code>PluralFormat</code> with other
* formatters. If you are using <code>PluralFormat</code> inside a
* <code>MessageFormat</code> pattern, <code>MessageFormat</code> will
* automatically evaluate the resulting format pattern.<br/>
* automatically evaluate the resulting format pattern.<br>
* Thus, curly braces (<code>{</code>, <code>}</code>) are <i>only</i> allowed
* in message texts to define a nested format pattern.<br/>
* in message texts to define a nested format pattern.<br>
* The pound sign (<code>#</code>) will be interpreted as the number placeholder
* in the message text, if it is not contained in curly braces (to preserve
* <code>NumberFormat</code> patterns). <code>PluralFormat</code> will
@@ -138,11 +138,11 @@ class Hashtable;
* msgFmt->format(args2, 1, result, ignore, status);
* cout << result << endl;
* </pre>
* Produces the output:<br/>
* <code>C'est 0,0 fichier dans la liste.</code><br/>
* Produces the output:<br>
* <code>C'est 0,0 fichier dans la liste.</code><br>
* <code>Ce sont 3 fichiers dans la liste."</code>
* <p>
* <strong>Note:</strong><br/>
* <strong>Note:</strong><br>
* Currently <code>PluralFormat</code>
* does not make use of quotes like <code>MessageFormat</code>.
* If you use plural format strings with <code>MessageFormat</code> and want
@@ -307,6 +307,9 @@ public:
*/
void applyPattern(const UnicodeString& pattern, UErrorCode& status);
// using Format::format;
/**
* Formats a plural message for a given number.
*
@@ -319,8 +322,8 @@ public:
* @return the string containing the formatted plural message.
* @stable ICU 4.0
*/
UnicodeString format(int32_t number, UErrorCode& status) const;
UnicodeString format(int32_t number, UErrorCode& status) const;
/**
* Formats a plural message for a given number.
*
@@ -355,13 +358,13 @@ public:
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
/**
* Formats a plural message for a given number.
*
* @param number a number for which the plural message should be formatted
* for. If no pattern has been applied to this
* <code>PluralFormat</code> object yet, the formatted number
* PluralFormat object yet, the formatted number
* will be returned.
* @param appendTo output parameter to receive result.
* result is appended to existing contents.
+92
View File
@@ -0,0 +1,92 @@
/*
******************************************************************************
*
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* FILE NAME : ptypes.h
*
* Date Name Description
* 05/13/98 nos Creation (content moved here from ptypes.h).
* 03/02/99 stephen Added AS400 support.
* 03/30/99 stephen Added Linux support.
* 04/13/99 stephen Reworked for autoconf.
* 09/18/08 srl Moved basic types back to ptypes.h from platform.h
******************************************************************************
*/
#ifndef _PTYPES_H
#define _PTYPES_H
#include <sys/types.h>
#include "unicode/platform.h"
/*===========================================================================*/
/* Generic data types */
/*===========================================================================*/
/* If your platform does not have the <inttypes.h> header, you may
need to edit the typedefs below. */
#if U_HAVE_INTTYPES_H
/* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */
/* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */
/* doesn't have uint8_t depending on the OS version. */
/* So we have this work around. */
#ifdef OS390
/* The features header is needed to get (u)int64_t sometimes. */
#include <features.h>
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if !defined(__uint8_t)
#define __uint8_t 1
typedef unsigned char uint8_t;
#endif
#endif /* OS390 */
#include <inttypes.h>
#else /* U_HAVE_INTTYPES_H */
#if ! U_HAVE_INT8_T
typedef signed char int8_t;
#endif
#if ! U_HAVE_UINT8_T
typedef unsigned char uint8_t;
#endif
#if ! U_HAVE_INT16_T
typedef signed short int16_t;
#endif
#if ! U_HAVE_UINT16_T
typedef unsigned short uint16_t;
#endif
#if ! U_HAVE_INT32_T
typedef signed int int32_t;
#endif
#if ! U_HAVE_UINT32_T
typedef unsigned int uint32_t;
#endif
#if ! U_HAVE_INT64_T
typedef signed long long int64_t;
/* else we may not have a 64-bit type */
#endif
#if ! U_HAVE_UINT64_T
typedef unsigned long long uint64_t;
/* else we may not have a 64-bit type */
#endif
#endif /* U_HAVE_INTTYPES_H */
#endif /* _PTYPES_H */
+32 -2
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -181,7 +181,14 @@ typedef unsigned int uint32_t;
#define U_IS_BIG_ENDIAN 0
/** 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
#ifndef ICU_USE_THREADS
#define ICU_USE_THREADS 1
#endif
/** 0 or 1 to enable or disable auto cleanup of libraries. If undefined, default is: disabled. */
#ifndef UCLN_NO_AUTO_CLEANUP
#define UCLN_NO_AUTO_CLEANUP 1
#endif
/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check mutex lock. */
/**
@@ -240,9 +247,15 @@ Intel can define _M_IX86 or _M_X64
#endif
/** @{ Define the library suffix in a C syntax. */
#ifndef U_HAVE_LIB_SUFFIX
#define U_HAVE_LIB_SUFFIX 0
#define U_LIB_SUFFIX_C_NAME
#endif
#ifndef U_LIB_SUFFIX_C_NAME
#define U_LIB_SUFFIX_C_NAME
#endif
#ifndef U_LIB_SUFFIX_C_NAME_STRING
#define U_LIB_SUFFIX_C_NAME_STRING ""
#endif
/** @} */
/*===========================================================================*/
@@ -270,15 +283,27 @@ Intel can define _M_IX86 or _M_X64
/** @{ Information about POSIX support */
/*===========================================================================*/
/**
* @internal
*/
#if 1
#define U_TZSET _tzset
#endif
/**
* @internal
*/
#if 1
#define U_TIMEZONE _timezone
#endif
/**
* @internal
*/
#if 1
#define U_TZNAME _tzname
#endif
/**
* @internal
*/
#if 1
#define U_DAYLIGHT _daylight
#endif
@@ -286,6 +311,11 @@ Intel can define _M_IX86 or _M_X64
#define U_HAVE_MMAP 0
#define U_HAVE_POPEN 0
#ifndef U_ENABLE_DYLOAD
#define U_ENABLE_DYLOAD 1
#endif
/** @} */
/*===========================================================================*/
+16 -13
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2009, International Business Machines Corporation and others.
* Copyright (C) 1997-2010, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
@@ -11,7 +11,7 @@
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Rule Based Number Format
*/
@@ -490,9 +490,9 @@ class Collator;
* <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' >
* < < %foo, %bar, %baz >,
* < en, Foo, Bar, Baz >,
* < fr, 'le Foo', 'le Bar', 'le Baz' >
* < zh, \\u7532, \\u4e59, \\u4e19 > >
* </pre></p>
* @author Richard Gillam
@@ -521,7 +521,7 @@ public:
/**
* Creates a RuleBasedNumberFormat that behaves according to the description
* passed in. The formatter uses the default locale.
* 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
@@ -565,7 +565,7 @@ public:
/**
* Creates a RuleBasedNumberFormat that behaves according to the description
* passed in. The formatter uses the default locale.
* 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
@@ -697,7 +697,7 @@ public:
/**
* 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,
* 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
@@ -707,20 +707,23 @@ public:
* @see #getRuleSetName
* @stable ICU 3.2
*/
virtual UnicodeString getRuleSetDisplayName(int32_t index,
virtual UnicodeString getRuleSetDisplayName(int32_t index,
const Locale& locale = Locale::getDefault());
/**
* Return the rule set display name for the provided rule set and locale.
* 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,
virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName,
const Locale& locale = Locale::getDefault());
// using NumberFormat::format;
/**
* Formats the specified 32-bit number using the default ruleset.
* @param number The number to format.
@@ -965,8 +968,8 @@ 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,
// 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);
+498 -40
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2009, International Business Machines
* Copyright (C) 2002-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
@@ -48,6 +48,7 @@
#include "unicode/uobject.h"
#include "unicode/unistr.h"
#include "unicode/utext.h"
#include "unicode/parseerr.h"
#include "unicode/uregex.h"
@@ -61,6 +62,7 @@ class RegexMatcher;
class RegexPattern;
class UVector;
class UVector32;
class UVector64;
class UnicodeSet;
struct REStackFrame;
struct Regex8BitSet;
@@ -78,6 +80,7 @@ class RegexCImpl;
U_INTERNAL void U_EXPORT2
RegexPatternDump(const RegexPattern *pat);
#else
#undef RegexPatternDump
#define RegexPatternDump(pat)
#endif
@@ -186,6 +189,37 @@ public:
UParseError &pe,
UErrorCode &status);
/**
* 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. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
* @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.
*
* @internal ICU 4.4 technology preview
*/
static RegexPattern * U_EXPORT2 compile( UText *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,
@@ -203,7 +237,7 @@ public:
*
* @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
* @param pe Receives the position (line and column numbers) 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.
@@ -214,7 +248,39 @@ public:
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. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
* @param flags The match mode flags to be used.
* @param pe Receives the position (line and column numbers) 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.
*
* @internal ICU 4.4 technology preview
*/
static RegexPattern * U_EXPORT2 compile( UText *regex,
uint32_t flags,
UParseError &pe,
UErrorCode &status);
/**
* Compiles the regular expression in string form into a RegexPattern
@@ -243,6 +309,35 @@ public:
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. Note, the text referred
* to by this UText must not be deleted during the lifetime of the
* RegexPattern object or any RegexMatcher object created from it.
* @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.
*
* @internal ICU 4.4 technology preview
*/
static RegexPattern * U_EXPORT2 compile( UText *regex,
uint32_t flags,
UErrorCode &status);
/**
* Get the match mode flags that were used when compiling this pattern.
* @return the match mode flags
@@ -269,6 +364,36 @@ public:
*/
virtual RegexMatcher *matcher(const UnicodeString &input,
UErrorCode &status) const;
/**
* Flag to disambiguate RegexPattern::matcher signature
* @internal ICU 4.4 technology preview
*/
enum PatternIsUTextFlag { PATTERN_IS_UTEXT };
/**
* 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 make a shallow clone of the supplied input text, and all regexp
* pattern matching operations happen on this clone. While read-only operations on
* the supplied text are permitted, it is critical that the underlying string not be
* altered or deleted before use by the regular expression operations is complete.
*
* @param input The input text to which the regular expression will be applied.
* @param flag Must be RegexPattern::PATTERN_IS_UTEXT; used to disambiguate
* method signature.
* @param status A reference to a UErrorCode to receive any errors.
* @return A RegexMatcher object for this pattern and input.
*
* @internal ICU 4.4 technology preview
*/
virtual RegexMatcher *matcher(UText *input,
PatternIsUTextFlag flag,
UErrorCode &status) const;
private:
/**
@@ -279,6 +404,8 @@ private:
* 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>
* or in a UText, using
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
*
* @internal
*/
@@ -317,15 +444,52 @@ public:
*/
static UBool U_EXPORT2 matches(const UnicodeString &regex,
const UnicodeString &input,
UParseError &pe,
UErrorCode &status);
/**
* 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.
*
* @internal ICU 4.4 technology preview
*/
static UBool U_EXPORT2 matches(UText *regex,
UText *input,
UParseError &pe,
UErrorCode &status);
/**
* Returns the regular expression from which this pattern was compiled.
* @stable ICU 2.4
* Returns the regular expression from which this pattern was compiled. This method will work
* even if the pattern was compiled from a UText.
*
* Note: If the pattern was originally compiled from a UText, and that UText was modified,
* the returned string may no longer reflect the RegexPattern object.
* @stable ICU 2.4
*/
virtual UnicodeString pattern() const;
/**
* Returns the regular expression from which this pattern was compiled. This method will work
* even if the pattern was compiled from a UnicodeString.
*
* Note: This is the original input, not a clone. If the pattern was originally compiled from a
* UText, and that UText was modified, the returned UText may no longer reflect the RegexPattern
* object.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *patternText() const;
/**
@@ -359,6 +523,37 @@ public:
UErrorCode &status) 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 mutable UText structs to receive the results of the split.
* If a field is NULL, a new UText is allocated to contain the results for
* that field. This new UText is not guaranteed to be mutable.
* @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.
*
* @internal ICU 4.4 technology preview
*/
virtual int32_t split(UText *input,
UText *dest[],
int32_t destCapacity,
UErrorCode &status) const;
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
@@ -377,10 +572,11 @@ private:
//
// Implementation Data
//
UnicodeString fPattern; // The original pattern string.
UText *fPattern; // The original pattern string.
UnicodeString *fPatternString; // The original pattern UncodeString if relevant
uint32_t fFlags; // The flags used when compiling the pattern.
//
UVector32 *fCompiledPat; // The compiled pattern p-code.
UVector64 *fCompiledPat; // The compiled pattern p-code.
UnicodeString fLiteralText; // Any literal string data from the pattern,
// after un-escaping, for use during the match.
@@ -395,7 +591,7 @@ private:
// >= 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.
@@ -420,6 +616,7 @@ private:
UnicodeSet *fInitialChars;
UChar32 fInitialChar;
Regex8BitSet *fInitialChars8;
UBool fNeedsAltInput;
friend class RegexCompile;
friend class RegexMatcher;
@@ -467,6 +664,23 @@ public:
*/
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.
*
* @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.
*
* @internal ICU 4.4 technology preview
*/
RegexMatcher(UText *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
@@ -491,6 +705,30 @@ public:
RegexMatcher(const UnicodeString &regexp, const UnicodeString &input,
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 make a shallow clone of the supplied input text, and all regexp
* pattern matching operations happen on this clone. While read-only operations on
* the supplied text are permitted, it is critical that the underlying 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 shallow clone of the text.
* @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.
*
* @internal ICU 4.4 technology preview
*/
RegexMatcher(UText *regexp, UText *input,
uint32_t flags, UErrorCode &status);
private:
/**
* Cause a compilation error if an application accidently attempts to
@@ -500,6 +738,8 @@ private:
* 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>
* or in a UText, using
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
*
* @internal
*/
@@ -524,6 +764,7 @@ public:
*/
virtual UBool matches(UErrorCode &status);
/**
* Resets the matcher, then attempts to match the input beginning
* at the specified startIndex, and extending to the end of the input.
@@ -537,8 +778,6 @@ public:
virtual UBool matches(int32_t startIndex, UErrorCode &status);
/**
* Attempts to match the input string, starting from the beginning of the region,
* against the pattern. Like the matches() method, this function
@@ -570,6 +809,7 @@ public:
*/
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
@@ -609,6 +849,30 @@ public:
virtual UnicodeString group(UErrorCode &status) const;
/**
* Flag to disambiguate RegexMatcher::group signature
* @internal ICU 4.4 technology preview
*/
enum MatcherDestIsUTextFlag { MATCHER_DEST_IS_UTEXT };
/**
* 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 dest A mutable UText in which the matching text is placed.
* If NULL, a new UText will be created (which may not be mutable).
* @param flag Must be RegexMatcher::MATCHER_DEST_IS_UTEXT; used to
* disambiguate method signature.
* @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. If a pre-allocated UText
* was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *group(UText *dest, MatcherDestIsUTextFlag flag, 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.
@@ -624,6 +888,24 @@ public:
virtual UnicodeString group(int32_t groupNum, 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 dest A mutable UText in which the matching text is placed.
* If NULL, a new UText will be created (which may not be mutable).
* @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. If a pre-allocated UText
* was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *group(int32_t groupNum, UText *dest, UErrorCode &status) const;
/**
* Returns the number of capturing groups in this matcher's pattern.
* @return the number of capture groups
@@ -725,11 +1007,31 @@ public:
* 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.
* Note that while a reset on the matcher with an input string that is then
* modified across/during matcher operations may be supported currently for UnicodeString,
* this was not originally intended behavior, and support for this is not guaranteed
* in upcoming versions of ICU.
* @return this RegexMatcher.
* @stable ICU 2.4
*/
virtual RegexMatcher &reset(const UnicodeString &input);
/**
* 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 makes a shallow clone of the given text; ownership of the
* original string remains with the caller. Because no deep copy of the
* text is made, it is essential that the caller not modify the string
* until after regexp operations on it are done.
* @return this RegexMatcher.
*
* @internal ICU 4.4 technology preview
*/
virtual RegexMatcher &reset(UText *input);
private:
/**
* Cause a compilation error if an application accidently attempts to
@@ -739,6 +1041,8 @@ private:
* 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>
* or in a UText, using
* <code>utext_openUChars(UText *ut, const UChar *text, int64_t textLength, UErrorCode *status);</code>
*
* @internal
*/
@@ -746,13 +1050,34 @@ private:
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.
* Returns the input string being matched. Ownership of the string belongs to
* the matcher; it should not be altered or deleted. This method will work even if the input
* was originally supplied as a UText.
* @return the input string
* @stable ICU 2.4
*/
virtual const UnicodeString &input() const;
/**
* Returns the input string being matched. This is the live input text; it should not be
* altered or deleted. This method will work even if the input was originally supplied as
* a UnicodeString.
* @return the input text
*
* @internal ICU 4.4 technology preview
*/
virtual UText *inputText() const;
/**
* Returns the input string being matched, either by copying it into the provided
* UText parameter or by returning a shallow clone of the live input. Note that copying
* the entire input may cause significant performance and memory issues.
* @param dest The UText into which the input should be copied, or NULL to create a new UText
* @return dest if non-NULL, a shallow copy of the input text otherwise
*
* @internal ICU 4.4 technology preview
*/
virtual UText *getInput(UText *dest) const;
/** Sets the limits of this matcher's region.
@@ -837,6 +1162,7 @@ public:
*/
virtual UBool hasAnchoringBounds() const;
/**
* Set whether this matcher is using Anchoring Bounds for its region.
* With anchoring bounds, pattern anchors such as ^ and $ will match at the start
@@ -851,6 +1177,7 @@ public:
*/
virtual RegexMatcher &useAnchoringBounds(UBool b);
/**
* Return TRUE if the most recent matching operation touched the
* end of the text being processed. In this case, additional input text could
@@ -877,9 +1204,6 @@ public:
virtual UBool requireEnd() const;
/**
* Returns the pattern that is interpreted by this matcher.
* @return the RegexPattern for this RegexMatcher
@@ -907,6 +1231,29 @@ public:
virtual UnicodeString replaceAll(const UnicodeString &replacement, 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 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 dest a mutable UText in which the results are placed.
* If NULL, a new UText will be created (which may not be mutable).
* @param status a reference to a UErrorCode to receive any errors.
* @return a string containing the results of the find and replace.
* If a pre-allocated UText was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *replaceAll(UText *replacement, UText *dest, UErrorCode &status);
/**
* Replaces the first substring of the input that matches
* the pattern with the replacement string. This is a convenience
@@ -928,7 +1275,35 @@ public:
* @stable ICU 2.4
*/
virtual UnicodeString replaceFirst(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 dest a mutable UText in which the results are placed.
* If NULL, a new UText will be created (which may not be mutable).
* @param status a reference to a UErrorCode to receive any errors.
* @return a string containing the results of the find and replace.
* If a pre-allocated UText was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *replaceFirst(UText *replacement, UText *dest, UErrorCode &status);
/**
* Implements a replace operation intended to be used as part of an
* incremental find-and-replace.
@@ -958,6 +1333,37 @@ public:
*/
virtual RegexMatcher &appendReplacement(UnicodeString &dest,
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 mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
* @param replacement A UText 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
*
* @internal ICU 4.4 technology preview
*/
virtual RegexMatcher &appendReplacement(UText *dest,
UText *replacement, UErrorCode &status);
/**
@@ -973,13 +1379,26 @@ public:
virtual UnicodeString &appendTail(UnicodeString &dest);
/**
* 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 mutable UText to which the results of the find-and-replace are appended.
* Must not be NULL.
* @return the destination string.
*
* @internal ICU 4.4 technology preview
*/
virtual UText *appendTail(UText *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
@@ -1003,6 +1422,35 @@ public:
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.
*
* @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 mutable UText structs to receive the results of the split.
* If a field is NULL, a new UText is allocated to contain the results for
* that field. This new UText is not guaranteed to be mutable.
* @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.
*
* @internal ICU 4.4 technology preview
*/
virtual int32_t split(UText *input,
UText *dest[],
int32_t destCapacity,
UErrorCode &status);
/**
* Set a processing time limit for match operations with this Matcher.
*
@@ -1085,7 +1533,6 @@ public:
UErrorCode &status);
/**
* Get the callback function for this URegularExpression.
*
@@ -1131,7 +1578,7 @@ private:
RegexMatcher(const RegexMatcher &other);
RegexMatcher &operator =(const RegexMatcher &rhs);
void init(UErrorCode &status); // Common initialization
void init2(const UnicodeString &s, UErrorCode &e); // Common initialization, part 2.
void init2(UText *t, UErrorCode &e); // Common initialization, part 2.
friend class RegexPattern;
friend class RegexCImpl;
@@ -1144,34 +1591,43 @@ private:
// MatchAt This is the internal interface to the match engine itself.
// Match status comes back in matcher member variables.
//
void MatchAt(int32_t startIdx, UBool toEnd, 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
void MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status);
inline void backTrack(int64_t &inputIdx, int32_t &patIdx);
UBool isWordBoundary(int64_t pos); // perform Perl-like \b test
UBool isUWordBoundary(int64_t pos); // perform RBBI based \b test
REStackFrame *resetStack();
inline REStackFrame *StateSave(REStackFrame *fp, int32_t savePatIdx, UErrorCode &status);
inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status);
void IncrementTime(UErrorCode &status);
int64_t appendGroup(int32_t groupNum, UText *dest, UErrorCode &status) const;
UBool findUsingChunk();
void MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &status);
UBool isChunkWordBoundary(int32_t pos);
const RegexPattern *fPattern;
RegexPattern *fPatternOwned; // Non-NULL if this matcher owns the pattern, and
// should delete it when through.
const UnicodeString *fInput; // The text being matched. Is never NULL.
const UnicodeString *fInput; // The string being matched. Only used for input()
UText *fInputText; // The text being matched. Is never NULL.
UText *fAltInputText; // A shallow copy of the text being matched.
// Only created if the pattern contains backreferences.
int64_t fInputLength; // Full length of the input text.
int32_t fFrameSize; // The size of a frame in the backtrack stack.
int32_t fRegionStart; // Start of the input region, default = 0.
int32_t fRegionLimit; // End of input region, default to input.length.
int64_t fRegionStart; // Start of the input region, default = 0.
int64_t fRegionLimit; // End of input region, default to input.length.
int32_t fAnchorStart; // Region bounds for anchoring operations (^ or $).
int32_t fAnchorLimit; // See useAnchoringBounds
int64_t fAnchorStart; // Region bounds for anchoring operations (^ or $).
int64_t fAnchorLimit; // See useAnchoringBounds
int32_t fLookStart; // Region bounds for look-ahead/behind and
int32_t fLookLimit; // and other boundary tests. See
int64_t fLookStart; // Region bounds for look-ahead/behind and
int64_t fLookLimit; // and other boundary tests. See
// useTransparentBounds
int32_t fActiveStart; // Currently active bounds for matching.
int32_t fActiveLimit; // Usually is the same as region, but
int64_t fActiveStart; // Currently active bounds for matching.
int64_t fActiveLimit; // Usually is the same as region, but
// is changed to fLookStart/Limit when
// entering look around regions.
@@ -1179,13 +1635,13 @@ private:
UBool fAnchoringBounds; // True if using anchoring bounds.
UBool fMatch; // True if the last attempted 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
int64_t fMatchStart; // Position of the start of the most recent match
int64_t fMatchEnd; // First position after the end of the most recent match
// Zero if no previous match, even when a region
// is active.
int32_t fLastMatchEnd; // First position after the end of the previous match,
int64_t fLastMatchEnd; // First position after the end of the previous match,
// or -1 if there was no previous match.
int32_t fAppendPosition; // First position after the end of the previous
int64_t fAppendPosition; // First position after the end of the previous
// appendReplacement(). As described by the
// JavaDoc for Java Matcher, where it is called
// "append position"
@@ -1193,13 +1649,13 @@ private:
UBool fRequireEnd; // True if the last match required end-of-input
// (matched $ or Z)
UVector32 *fStack;
UVector64 *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.
int64_t *fData; // Data area for use by the compiled pattern.
int64_t fSmallData[8]; // Use this for data if it's enough.
int32_t fTimeLimit; // Max time (in arbitrary steps) to let the
// match engine run. Zero for unlimited.
@@ -1217,6 +1673,8 @@ private:
// NULL if there is no callback.
const void *fCallbackContext; // User Context ptr for callback function.
UBool fInputUniStrMaybeMutable; // Set when fInputText wraps a UnicodeString that may be mutable - compatibility.
UBool fTraceDebug; // Set true for debug tracing of match engine.
UErrorCode fDeferredStatus; // Save error state that cannot be immediately
+375
View File
@@ -0,0 +1,375 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation and
* others. All Rights Reserved.
* Copyright (C) 2010 , Yahoo! Inc.
********************************************************************
*
* File SELFMT.H
*
* Modification History:
*
* Date Name Description
* 11/11/09 kirtig Finished first cut of implementation.
********************************************************************/
#ifndef SELFMT
#define SELFMT
#include "unicode/utypes.h"
#include "unicode/numfmt.h"
/**
* \file
* \brief C++ API: SelectFormat object
*/
#if !UCONFIG_NO_FORMATTING
U_NAMESPACE_BEGIN
class Hashtable;
/**
* <p><code>SelectFormat</code> supports the creation of internationalized
* messages by selecting phrases based on keywords. The pattern specifies
* how to map keywords to phrases and provides a default phrase. The
* object provided to the format method is a string that's matched
* against the keywords. If there is a match, the corresponding phrase
* is selected; otherwise, the default phrase is used.</p>
*
* <h4>Using <code>SelectFormat</code> for Gender Agreement</h4>
*
* <p>The main use case for the select format is gender based inflection.
* When names or nouns are inserted into sentences, their gender can affect pronouns,
* verb forms, articles, and adjectives. Special care needs to be
* taken for the case where the gender cannot be determined.
* The impact varies between languages:</p>
* \htmlonly
* <ul>
* <li>English has three genders, and unknown gender is handled as a special
* case. Names use the gender of the named person (if known), nouns referring
* to people use natural gender, and inanimate objects are usually neutral.
* The gender only affects pronouns: "he", "she", "it", "they".
*
* <li>German differs from English in that the gender of nouns is rather
* arbitrary, even for nouns referring to people ("M&#x00E4;dchen", girl, is neutral).
* The gender affects pronouns ("er", "sie", "es"), articles ("der", "die",
* "das"), and adjective forms ("guter Mann", "gute Frau", "gutes M&#x00E4;dchen").
*
* <li>French has only two genders; as in German the gender of nouns
* is rather arbitrary - for sun and moon, the genders
* are the opposite of those in German. The gender affects
* pronouns ("il", "elle"), articles ("le", "la"),
* adjective forms ("bon", "bonne"), and sometimes
* verb forms ("all&#x00E9;", "all&#x00E9;e").
*
* <li>Polish distinguishes five genders (or noun classes),
* human masculine, animate non-human masculine, inanimate masculine,
* feminine, and neuter.
* </ul>
* \endhtmlonly
* <p>Some other languages have noun classes that are not related to gender,
* but similar in grammatical use.
* Some African languages have around 20 noun classes.</p>
*
* <p>To enable localizers to create sentence patterns that take their
* language's gender dependencies into consideration, software has to provide
* information about the gender associated with a noun or name to
* <code>MessageFormat</code>.
* Two main cases can be distinguished:</p>
*
* <ul>
* <li>For people, natural gender information should be maintained for each person.
* The keywords "male", "female", "mixed" (for groups of people)
* and "unknown" are used.
*
* <li>For nouns, grammatical gender information should be maintained for
* each noun and per language, e.g., in resource bundles.
* The keywords "masculine", "feminine", and "neuter" are commonly used,
* but some languages may require other keywords.
* </ul>
*
* <p>The resulting keyword is provided to <code>MessageFormat</code> as a
* parameter separate from the name or noun it's associated with. For example,
* to generate a message such as "Jean went to Paris", three separate arguments
* would be provided: The name of the person as argument 0, the gender of
* the person as argument 1, and the name of the city as argument 2.
* The sentence pattern for English, where the gender of the person has
* no impact on this simple sentence, would not refer to argument 1 at all:</p>
*
* <pre>{0} went to {2}.</pre>
*
* <p>The sentence pattern for French, where the gender of the person affects
* the form of the participle, uses a select format based on argument 1:</p>
*
* \htmlonly<pre>{0} est {1, select, female {all&#x00E9;e} other {all&#x00E9;}} &#x00E0; {2}.</pre>\endhtmlonly
*
* <p>Patterns can be nested, so that it's possible to handle interactions of
* number and gender where necessary. For example, if the above sentence should
* allow for the names of several people to be inserted, the following sentence
* pattern can be used (with argument 0 the list of people's names,
* argument 1 the number of people, argument 2 their combined gender, and
* argument 3 the city name):</p>
*
* \htmlonly
* <pre>{0} {1, plural,
* one {est {2, select, female {all&#x00E9;e} other {all&#x00E9;}}}
* other {sont {2, select, female {all&#x00E9;es} other {all&#x00E9;s}}}
* }&#x00E0; {3}.</pre>
* \endhtmlonly
*
* <h4>Patterns and Their Interpretation</h4>
*
* <p>The <code>SelectFormat</code> pattern text defines the phrase output
* for each user-defined keyword.
* The pattern is a sequence of <code><i>keyword</i>{<i>phrase</i>}</code>
* clauses.
* Each clause assigns the phrase <code><i>phrase</i></code>
* to the user-defined <code><i>keyword</i></code>.</p>
*
* <p>Keywords must match the pattern [a-zA-Z][a-zA-Z0-9_-]*; keywords
* that don't match this pattern result in the error code
* <code>U_ILLEGAL_CHARACTER</code>.
* You always have to define a phrase for the default keyword
* <code>other</code>; this phrase is returned when the keyword
* provided to
* the <code>format</code> method matches no other keyword.
* If a pattern does not provide a phrase for <code>other</code>, the method
* it's provided to returns the error <code>U_DEFAULT_KEYWORD_MISSING</code>.
* If a pattern provides more than one phrase for the same keyword, the
* error <code>U_DUPLICATE_KEYWORD</code> is returned.
* <br>
* Spaces between <code><i>keyword</i></code> and
* <code>{<i>phrase</i>}</code> will be ignored; spaces within
* <code>{<i>phrase</i>}</code> will be preserved.<p>
*
* <p>The phrase for a particular select case may contain other message
* format patterns. <code>SelectFormat</code> preserves these so that you
* can use the strings produced by <code>SelectFormat</code> with other
* formatters. If you are using <code>SelectFormat</code> inside a
* <code>MessageFormat</code> pattern, <code>MessageFormat</code> will
* automatically evaluate the resulting format pattern.
* Thus, curly braces (<code>{</code>, <code>}</code>) are <i>only</i> allowed
* in phrases to define a nested format pattern.</p>
*
* <p>Example:
* \htmlonly
*
* UErrorCode status = U_ZERO_ERROR;
* MessageFormat *msgFmt = new MessageFormat(UnicodeString("{0} est {1, select, female {all&#x00E9;e} other {all&#x00E9;}} &#x00E0; Paris."), Locale("fr"), status);
* if (U_FAILURE(status)) {
* return;
* }
* FieldPosition ignore(FieldPosition::DONT_CARE);
* UnicodeString result;
*
* char* str1= "Kirti,female";
* Formattable args1[] = {"Kirti","female"};
* msgFmt->format(args1, 2, result, ignore, status);
* cout << "Input is " << str1 << " and result is: " << result << endl;
* delete msgFmt;
*
* \endhtmlonly
* </p>
*
* Produces the output:<br>
* \htmlonly
* <code>Kirti est all&#x00E9;e &#x00E0; Paris.</code>
* \endhtmlonly
*
* @draft ICU 4.4
*/
class U_I18N_API SelectFormat : public Format {
public:
/**
* Creates a new <code>SelectFormat</code> for a given pattern string.
* @param pattern the pattern for this <code>SelectFormat</code>.
* errors are returned to status if the pattern is invalid.
* @param status output param set to success/failure code on exit, which
* must not indicate a failure before the function call.
* @draft ICU 4.4
*/
SelectFormat(const UnicodeString& pattern, UErrorCode& status);
/**
* copy constructor.
* @draft ICU 4.4
*/
SelectFormat(const SelectFormat& other);
/**
* Destructor.
* @draft ICU 4.4
*/
virtual ~SelectFormat();
/**
* Sets the pattern used by this select format.
* for the keyword rules.
* Patterns and their interpretation are specified in the class description.
*
* @param pattern the pattern for this select format
* errors are returned to status if the pattern is invalid.
* @param status output param set to success/failure code on exit, which
* must not indicate a failure before the function call.
* @draft ICU 4.4
*/
void applyPattern(const UnicodeString& pattern, UErrorCode& status);
// using Format::format;
/**
* Selects the phrase for the given keyword
*
* @param keyword The keyword that is used to select an alternative.
* @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, which
* must not indicate a failure before the function call.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
UnicodeString& format(const UnicodeString& keyword,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
/**
* Assignment operator
*
* @param other the SelectFormat object to copy from.
* @draft ICU 4.4
*/
SelectFormat& operator=(const SelectFormat& other);
/**
* Return true if another object is semantically equal to this one.
*
* @param other the SelectFormat object to be compared with.
* @return true if other is semantically equal to this.
* @draft ICU 4.4
*/
virtual UBool operator==(const Format& other) const;
/**
* Return true if another object is semantically unequal to this one.
*
* @param other the SelectFormat object to be compared with.
* @return true if other is semantically unequal to this.
* @draft ICU 4.4
*/
virtual UBool operator!=(const Format& other) const;
/**
* Clones this Format object polymorphically. The caller owns the
* result and should delete it when done.
* @draft ICU 4.4
*/
virtual Format* clone(void) const;
/**
* Format an object to produce a string.
* This method handles keyword strings.
* If the Formattable object is not a <code>UnicodeString</code>,
* then it returns a failing UErrorCode.
*
* @param obj A keyword string that is used to select an alternative.
* @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.
* @draft ICU 4.4
*/
UnicodeString& format(const Formattable& obj,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
/**
* Returns the pattern from applyPattern() or constructor.
*
* @param appendTo output parameter to receive result.
* Result is appended to existing contents.
* @return the UnicodeString with inserted pattern.
* @draft ICU 4.4
*/
UnicodeString& toPattern(UnicodeString& appendTo);
/**
* This method is not yet supported by <code>SelectFormat</code>.
* <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.
* @draft ICU 4.4
*/
virtual void parseObject(const UnicodeString& source,
Formattable& result,
ParsePosition& parse_pos) const;
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
* @draft ICU 4.4
*/
static UClassID U_EXPORT2 getStaticClassID(void);
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @draft ICU 4.4
*/
virtual UClassID getDynamicClassID() const;
private:
typedef enum classesForSelectFormat{
tStartKeyword,
tContinueKeyword,
tLeftBrace,
tRightBrace,
tSpace,
tOther
}CharacterClass;
UnicodeString pattern;
//Hash to store the keyword, phrase pairs.
Hashtable *parsedValuesHash;
SelectFormat(); // default constructor not implemented.
void init(UErrorCode& status);
//For the applyPattern , classifies char.s in one of the characterClass.
CharacterClass classifyCharacter(UChar ch) const;
//Checks if the "other" keyword is present in pattern.
UBool checkSufficientDefinition();
//Checks if the keyword passed is valid.
UBool checkValidKeyword(const UnicodeString& argKeyword) const;
void parsingFailure();
void copyHashtable(Hashtable *other, UErrorCode& status);
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif // _SELFMT
//eof
+140 -33
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 1997-2009, International Business Machines Corporation and others. All Rights Reserved.
* Copyright (C) 1997-2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*
* File SMPDTFMT.H
@@ -26,10 +27,10 @@
#include "unicode/utypes.h"
/**
* \file
* \file
* \brief C++ API: Format and parse dates in a language-independent manner.
*/
#if !UCONFIG_NO_FORMATTING
#include "unicode/datefmt.h"
@@ -39,6 +40,7 @@ U_NAMESPACE_BEGIN
class DateFormatSymbols;
class DateFormat;
class MessageFormat;
class FieldPositionHandler;
/**
*
@@ -256,7 +258,7 @@ public:
* @param pattern the pattern for the format.
* @param override the override string.
* @param status Output param set to success/failure code.
* @draft ICU 4.2
* @stable ICU 4.2
*/
SimpleDateFormat(const UnicodeString& pattern,
const UnicodeString& override,
@@ -297,7 +299,7 @@ public:
* @param override the numbering system override.
* @param locale the given locale.
* @param status Output param set to success/failure code.
* @draft ICU 4.2
* @stable ICU 4.2
*/
SimpleDateFormat(const UnicodeString& pattern,
const UnicodeString& override,
@@ -365,6 +367,9 @@ public:
*/
virtual UBool operator==(const Format& other) const;
// using DateFormat::format;
/**
* Format a date or time, which is the standard millis since 24:00 GMT, Jan
* 1, 1970. Overrides DateFormat pure virtual method.
@@ -385,6 +390,29 @@ public:
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 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField.
* @param status Input/output param set to success/failure code.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
virtual UnicodeString& format( Calendar& cal,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Format a date or time, which is the standard millis since 24:00 GMT, Jan
* 1, 1970. Overrides DateFormat pure virtual method.
@@ -400,7 +428,7 @@ public:
* 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.
* @param status Input/output param set to success/failure code.
* @return Reference to 'appendTo' parameter.
* @stable ICU 2.0
*/
@@ -409,6 +437,31 @@ public:
FieldPosition& pos,
UErrorCode& status) 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField.
* @param status Input/output param set to success/failure code.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
virtual UnicodeString& format( const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Redeclared DateFormat method.
* @param date the Date value to be formatted.
@@ -423,6 +476,23 @@ public:
UnicodeString& appendTo,
FieldPosition& fieldPosition) 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 posIter On return, can be used to iterate over positions
* of fields generated by this format call. Field values
* are defined in UDateFormatField.
* @param status Input/output param set to success/failure code.
* @return Reference to 'appendTo' parameter.
* @draft ICU 4.4
*/
UnicodeString& format(UDate date,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const;
/**
* Redeclared DateFormat method.
* @param obj Object to be formatted.
@@ -660,10 +730,10 @@ public:
/**
* This is for ICU internal use only. Please do not use.
* Check whether the 'field' is smaller than all the fields covered in
* pattern, return TRUE if it is. The sequence of calendar field,
* pattern, return TRUE if it is. The sequence of calendar field,
* from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,...
* @param field the calendar field need to check against
* @return TRUE if the 'field' is smaller than all the fields
* @return TRUE if the 'field' is smaller than all the fields
* covered in pattern. FALSE otherwise.
* @internal ICU 4.0
*/
@@ -673,15 +743,15 @@ public:
/**
* This is for ICU internal use only. Please do not use.
* Check whether the 'field' is smaller than all the fields covered in
* pattern, return TRUE if it is. The sequence of calendar field,
* pattern, return TRUE if it is. The sequence of calendar field,
* from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,...
* @param pattern the pattern to check against
* @param field the calendar field need to check against
* @return TRUE if the 'field' is smaller than all the fields
* @return TRUE if the 'field' is smaller than all the fields
* covered in pattern. FALSE otherwise.
* @internal ICU 4.0
*/
static UBool isFieldUnitIgnored(const UnicodeString& pattern,
static UBool isFieldUnitIgnored(const UnicodeString& pattern,
UCalendarDateFields field);
@@ -724,6 +794,12 @@ private:
*/
SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use default pattern
/**
* Hook called by format(... FieldPosition& ...) and format(...FieldPositionIterator&...)
*/
UnicodeString& _format(Calendar& cal, UnicodeString& appendTo, FieldPositionHandler& handler,
UErrorCode& status) const;
/**
* Called by format() to format a single field.
*
@@ -733,19 +809,16 @@ private:
* @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 handler Records information about field positions.
* @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
void subFormat(UnicodeString &appendTo,
UChar ch,
int32_t count,
FieldPositionHandler& handler,
Calendar& cal,
UErrorCode& status) const; // in case of illegal argument
/**
* Used by subFormat() to format a numeric value.
@@ -759,11 +832,11 @@ private:
* @param minDigits Minimum number of digits the result should have
* @param maxDigits Maximum number of digits the result should have
*/
void zeroPaddingNumber( NumberFormat *currentNumberFormat,
UnicodeString &appendTo,
int32_t value,
int32_t minDigits,
int32_t maxDigits) const;
void zeroPaddingNumber(NumberFormat *currentNumberFormat,
UnicodeString &appendTo,
int32_t value,
int32_t minDigits,
int32_t maxDigits) const;
/**
* Return true if the given format character, occuring count
@@ -846,13 +919,14 @@ private:
* @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 saveHebrewMonth Used to hang onto month until year is known.
* @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,
UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
int32_t patLoc) const;
void parseInt(const UnicodeString& text,
@@ -907,8 +981,8 @@ private:
* @param pos offset into input at which to begin matching
* @return length of input that matches, or -1 if match failure
*/
int32_t compareSimpleAffix(const UnicodeString& affix,
const UnicodeString& input,
int32_t compareSimpleAffix(const UnicodeString& affix,
const UnicodeString& input,
int32_t pos) const;
/**
@@ -947,7 +1021,8 @@ private:
/**
* Get the numbering system to be used for a particular field.
*/
NumberFormat * getNumberFormatByIndex(UDateFormatField index) const;
// using DateFormat::getNumberFormat; // Do not hide visibility of base class function
NumberFormat * getNumberFormat(UDateFormatField index) const;
/**
* Parse the given override string and set up structures for number formats
@@ -988,7 +1063,7 @@ private:
*/
UnicodeString fTimeOverride;
/**
* The original locale used (for reloading symbols)
*/
@@ -1054,13 +1129,13 @@ private:
// unexpectedly success parsing input GMT string without second field.
// See #6880 about this issue.
// TODO: SimpleDateFormat should provide an option to invalidate
//
//
int32_t fGMTFormatHmsMinLen[kNumGMTFormatMinLengths];
NumberFormat **fNumberFormatters;
NSOverride *fOverrideList;
UBool fHaveDefaultCentury;
};
@@ -1079,6 +1154,28 @@ SimpleDateFormat::format(const Formattable& obj,
return DateFormat::format(obj, appendTo, status);
}
inline UnicodeString&
SimpleDateFormat::format(const Formattable& obj,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const
{
// Don't use Format:: - use immediate base class only,
// in case immediate base modifies behavior later.
return DateFormat::format(obj, appendTo, pos, status);
}
inline UnicodeString&
SimpleDateFormat::format(const Formattable& obj,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const
{
// Don't use Format:: - use immediate base class only,
// in case immediate base modifies behavior later.
return DateFormat::format(obj, appendTo, posIter, status);
}
inline UnicodeString&
SimpleDateFormat::format(UDate date,
UnicodeString& appendTo,
@@ -1088,6 +1185,16 @@ SimpleDateFormat::format(UDate date,
return DateFormat::format(date, appendTo, fieldPosition);
}
inline UnicodeString&
SimpleDateFormat::format(UDate date,
UnicodeString& appendTo,
FieldPositionIterator* posIter,
UErrorCode& status) const {
// Don't use Format:: - use immediate base class only,
// in case immediate base modifies behavior later.
return DateFormat::format(date, appendTo, posIter, status);
}
inline UnicodeString&
SimpleDateFormat::format(UDate date, UnicodeString& appendTo) const {
return DateFormat::format(date, appendTo);
+3 -3
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2009, International Business Machines
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -19,7 +19,7 @@
/**
* \file
* \brief C++ API: Central ICU header for including the C++ standard <string>
* \brief C++ API: Central ICU header for including the C++ standard &lt;string&gt;
* header and for related definitions.
*/
@@ -27,7 +27,7 @@
/**
* \def U_HAVE_STD_STRING
* Define whether the standard C++ (STL) <string> header is available.
* Define whether the standard C++ (STL) &lt;string&gt; header is available.
* @draft ICU 4.2
*/
#ifndef U_HAVE_STD_STRING
+53 -17
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2009, International Business Machines
// Copyright (C) 2010, International Business Machines
// Corporation and others. All Rights Reserved.
//
// Copyright 2001 and onwards Google Inc.
@@ -47,7 +47,7 @@ U_NAMESPACE_BEGIN
* Systematic usage of StringPiece is encouraged as it will reduce unnecessary
* conversions from "const char*" to "string" and back again.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_COMMON_API StringPiece : public UMemory {
private:
@@ -57,19 +57,19 @@ class U_COMMON_API StringPiece : public UMemory {
public:
/**
* Default constructor, creates an empty StringPiece.
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece() : ptr_(NULL), length_(0) { }
/**
* Constructs from a NUL-terminated const char * pointer.
* @param str a NUL-terminated const char * pointer
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece(const char* str);
#if U_HAVE_STD_STRING
/**
* Constructs from a std::string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece(const U_STD_NSQ string& str)
: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
@@ -78,14 +78,14 @@ class U_COMMON_API StringPiece : public UMemory {
* Constructs from a const char * pointer and a specified length.
* @param offset a const char * pointer (need not be terminated)
* @param len the length of the string; must be non-negative
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
/**
* Substring of another StringPiece.
* @param x the other StringPiece
* @param pos start position in x; must be non-negative and <= x.length().
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece(const StringPiece& x, int32_t pos);
/**
@@ -94,7 +94,7 @@ class U_COMMON_API StringPiece : public UMemory {
* @param pos start position in x; must be non-negative and <= x.length().
* @param len length of the substring;
* must be non-negative and will be pinned to at most x.length() - pos.
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece(const StringPiece& x, int32_t pos, int32_t len);
@@ -106,38 +106,53 @@ class U_COMMON_API StringPiece : public UMemory {
* typically a mistake to pass data() to a routine that expects a NUL
* terminated string.
* @return the string pointer
* @draft ICU 4.2
* @stable ICU 4.2
*/
const char* data() const { return ptr_; }
/**
* Returns the string length. Same as length().
* @return the string length
* @draft ICU 4.2
* @stable ICU 4.2
*/
int32_t size() const { return length_; }
/**
* Returns the string length. Same as size().
* @return the string length
* @draft ICU 4.2
* @stable ICU 4.2
*/
int32_t length() const { return length_; }
/**
* Returns whether the string is empty.
* @return TRUE if the string is empty
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool empty() const { return length_ == 0; }
/**
* Sets to an empty string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
void clear() { ptr_ = NULL; length_ = 0; }
/**
* Reset the stringpiece to refer to new data.
* @param data pointer the new string data. Need not be nul terminated.
* @param len the length of the new data
* @internal
*/
void set(const char* data, int32_t len) { ptr_ = data; length_ = len; }
/**
* Reset the stringpiece to refer to new data.
* @param str a pointer to a NUL-terminated string.
* @internal
*/
void set(const char* str);
/**
* Removes the first n string units.
* @param n prefix length, must be non-negative and <=length()
* @draft ICU 4.2
* @stable ICU 4.2
*/
void remove_prefix(int32_t n) {
if (n >= 0) {
@@ -152,7 +167,7 @@ class U_COMMON_API StringPiece : public UMemory {
/**
* Removes the last n string units.
* @param n suffix length, must be non-negative and <=length()
* @draft ICU 4.2
* @stable ICU 4.2
*/
void remove_suffix(int32_t n) {
if (n >= 0) {
@@ -166,7 +181,7 @@ class U_COMMON_API StringPiece : public UMemory {
/**
* Maximum integer, used as a default value for substring methods.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static const int32_t npos = 0x7fffffff;
@@ -176,13 +191,34 @@ class U_COMMON_API StringPiece : public UMemory {
* @param len length of the substring;
* must be non-negative and will be pinned to at most length() - pos.
* @return the substring StringPiece
* @draft ICU 4.2
* @stable ICU 4.2
*/
StringPiece substr(int32_t pos, int32_t len = npos) const {
return StringPiece(*this, pos, len);
}
};
/**
* Global operator == for StringPiece
* @param x The first StringPiece to compare.
* @param y The second StringPiece to compare.
* @return TRUE if the string data is equal
* @internal
*/
U_EXPORT UBool U_EXPORT2
operator==(const StringPiece& x, const StringPiece& y);
/**
* Global operator != for StringPiece
* @param x The first StringPiece to compare.
* @param y The second StringPiece to compare.
* @return TRUE if the string data is not equal
* @internal
*/
inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
return !(x == y);
}
U_NAMESPACE_END
#endif // __STRINGPIECE_H__
+2 -2
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2009, International Business Machines Corporation and
* Copyright (C) 1996-2010, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
@@ -397,7 +397,7 @@ public:
* @param tIter the second ("target") string iterator
* @param status ICU status
* @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UCollationResult compare(UCharIterator &sIter,
UCharIterator &tIter,
+51 -76
View File
@@ -1,5 +1,5 @@
/*************************************************************************
* Copyright (c) 1997-2009, International Business Machines Corporation
* Copyright (c) 1997-2010, International Business Machines Corporation
* and others. All Rights Reserved.
**************************************************************************
*
@@ -186,72 +186,6 @@ public:
*/
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 time zone 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 time zone 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
@@ -521,7 +455,41 @@ public:
* Selector for long display name
* @stable ICU 2.4
*/
LONG
LONG,
/**
* Selector for short generic display name
* @draft ICU 4.4
*/
SHORT_GENERIC,
/**
* Selector for long generic display name
* @draft ICU 4.4
*/
LONG_GENERIC,
/**
* Selector for short display name derived
* from time zone offset
* @draft ICU 4.4
*/
SHORT_GMT,
/**
* Selector for long display name derived
* from time zone offset
* @draft ICU 4.4
*/
LONG_GMT,
/**
* Selector for short display name derived
* from the time zone's fallback name
* @draft ICU 4.4
*/
SHORT_COMMONLY_USED,
/**
* Selector for long display name derived
* from the time zone's fallback name
* @draft ICU 4.4
*/
GENERIC_LOCATION
};
/**
@@ -559,7 +527,7 @@ public:
* 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 style
* @param result the human-readable name of this time zone in the default locale.
* @return A reference to 'result'.
* @stable ICU 2.0
@@ -573,7 +541,7 @@ public:
* 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 style
* @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.
@@ -581,7 +549,7 @@ public:
* @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,
@@ -712,12 +680,18 @@ private:
* Resolve a link in Olson tzdata. When the given id is known and it's not a link,
* the id itself is returned. When the given id is known and it is a link, then
* dereferenced zone id is returned. When the given id is unknown, then it returns
* empty string.
* @param linkTo Input zone id string
* @param linkFrom Receives the dereferenced zone id string
* @return The reference to the result (linkFrom)
* NULL.
* @param id zone id string
* @return the dereferenced zone or NULL
*/
static UnicodeString& dereferOlsonLink(const UnicodeString& linkTo, UnicodeString& linkFrom);
static const UChar* dereferOlsonLink(const UnicodeString& id);
/**
* Returns the region code associated with the given zone.
* @param id zone id string
* @return the region associated with the given zone
*/
static const UChar* getRegion(const UnicodeString& id);
/**
* Parses the given custom time zone identifier
@@ -775,6 +749,7 @@ private:
static TimeZone* createSystemTimeZone(const UnicodeString& name);
UnicodeString fID; // this time zone's ID
};
+13 -13
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2009, Google, International Business Machines Corporation and *
* Copyright (C) 2009-2010, Google, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -25,13 +25,13 @@ U_NAMESPACE_BEGIN
* Measurement unit for time units.
* @see TimeUnitAmount
* @see TimeUnit
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_I18N_API TimeUnit: public MeasureUnit {
public:
/**
* Constants for all the time units we supported.
* @draft ICU 4.2
* @stable ICU 4.2
*/
enum UTimeUnitFields {
UTIMEUNIT_YEAR,
@@ -52,7 +52,7 @@ public:
* If the timeUnitField is invalid,
* then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
* @return a TimeUnit instance
* @draft ICU 4.2
* @stable ICU 4.2
*/
static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
UErrorCode& status);
@@ -60,33 +60,33 @@ public:
/**
* Override clone.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UObject* clone() const;
/**
* Copy operator.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnit(const TimeUnit& other);
/**
* Assignment operator.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnit& operator=(const TimeUnit& other);
/**
* Equality operator.
* @return true if 2 objects are the same.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UBool operator==(const UObject& other) const;
/**
* Non-Equality operator.
* @return true if 2 objects are not the same.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool operator!=(const UObject& other) const;
@@ -96,7 +96,7 @@ public:
* @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 4.2
* @stable ICU 4.2
*/
virtual UClassID getDynamicClassID() const;
@@ -104,7 +104,7 @@ public:
* 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.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UClassID U_EXPORT2 getStaticClassID();
@@ -112,13 +112,13 @@ public:
/**
* Get time unit field.
* @return time unit field.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UTimeUnitFields getTimeUnitField() const;
/**
* Destructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~TimeUnit();
+14 -14
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2009, Google, International Business Machines Corporation and *
* Copyright (C) 2009-2010, Google, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -26,7 +26,7 @@ U_NAMESPACE_BEGIN
* Express a duration as a time unit and number. Patterned after Currency.
* @see TimeUnitAmount
* @see TimeUnitFormat
* @draft ICU 4.2
* @stable ICU 4.2
*/
class U_I18N_API TimeUnitAmount: public Measure {
public:
@@ -40,7 +40,7 @@ public:
* is not valid,
* then this will be set to a failing value:
* U_ILLEGAL_ARGUMENT_ERROR.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitAmount(const Formattable& number,
TimeUnit::UTimeUnitFields timeUnitField,
@@ -56,7 +56,7 @@ public:
* If the timeUnitField is not valid,
* then this will be set to a failing value:
* U_ILLEGAL_ARGUMENT_ERROR.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField,
UErrorCode& status);
@@ -64,14 +64,14 @@ public:
/**
* Copy constructor
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitAmount(const TimeUnitAmount& other);
/**
* Assignment operator
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitAmount& operator=(const TimeUnitAmount& other);
@@ -79,14 +79,14 @@ public:
/**
* Clone.
* @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID().
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UObject* clone() const;
/**
* Destructor
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~TimeUnitAmount();
@@ -95,7 +95,7 @@ public:
* Equality operator.
* @param other the object to compare to.
* @return true if this object is equal to the given object.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UBool operator==(const UObject& other) const;
@@ -104,7 +104,7 @@ public:
* Not-equality operator.
* @param other the object to compare to.
* @return true if this object is not equal to the given object.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool operator!=(const UObject& other) const;
@@ -118,7 +118,7 @@ public:
* . erived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UClassID U_EXPORT2 getStaticClassID(void);
@@ -132,7 +132,7 @@ public:
* @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 4.2
* @stable ICU 4.2
*/
virtual UClassID getDynamicClassID(void) const;
@@ -140,14 +140,14 @@ public:
/**
* Get the time unit.
* @return time unit object.
* @draft ICU 4.2
* @stable ICU 4.2
*/
const TimeUnit& getTimeUnit() const;
/**
* Get the time unit field value.
* @return time unit field value.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnit::UTimeUnitFields getTimeUnitField() const;
};
+32 -41
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2008, Google, International Business Machines Corporation and *
* Copyright (C) 2010, Google, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@@ -33,16 +33,6 @@ union UHashTok;
U_NAMESPACE_BEGIN
U_CDECL_BEGIN
/**
* @internal ICU 4.2
*/
static UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2) ;
U_CDECL_END
class Hashtable;
@@ -50,7 +40,7 @@ class Hashtable;
* Format or parse a TimeUnitAmount, using plural rules for the units where available.
*
* <P>
* Code Sample:
* Code Sample:
* <pre>
* // create time unit amount instance - a combination of Number and time unit
* UErrorCode status = U_ZERO_ERROR;
@@ -66,7 +56,7 @@ class Hashtable;
* Formattable result;
* ((Format*)format)->parseObject(formatted, result, status);
* if (U_SUCCESS(status)) {
* assert (result == formattable);
* assert (result == formattable);
* }
* }
* </pre>
@@ -91,17 +81,17 @@ public:
kAbbreviate = 1,
kTotal = kAbbreviate + 1
};
/**
* Create TimeUnitFormat with default locale, and full name style.
* Create TimeUnitFormat with default locale, and full name style.
* Use setLocale and/or setFormat to modify.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitFormat(UErrorCode& status);
/**
* Create TimeUnitFormat given locale, and full name style.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitFormat(const Locale& locale, UErrorCode& status);
@@ -113,13 +103,13 @@ public:
/**
* Copy constructor.
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitFormat(const TimeUnitFormat&);
/**
* deconstructor
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual ~TimeUnitFormat();
@@ -127,13 +117,13 @@ public:
* Clone this Format object polymorphically. The caller owns the result and
* should delete it when done.
* @return A copy of the object.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual Format* clone(void) const;
/**
* Assignment operator
* @draft ICU 4.2
* @stable ICU 4.2
*/
TimeUnitFormat& operator=(const TimeUnitFormat& other);
@@ -143,16 +133,16 @@ public:
* of different subclasses are considered unequal.
* @param other the object to be compared with.
* @return true if the given Format objects are semantically equal.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UBool operator==(const Format& other) const;
/**
* Return true if the given Format objects are not semantically equal.
* Return true if the given Format objects are not 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 not semantically equal.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UBool operator!=(const Format& other) const;
@@ -160,38 +150,41 @@ public:
* Set the locale used for formatting or parsing.
* @param locale the locale to be set
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setLocale(const Locale& locale, UErrorCode& status);
/**
* Set the number format used for formatting or parsing.
* Set the number format used for formatting or parsing.
* @param format the number formatter to be set
* @param status output param set to success/failure code on exit
* @draft ICU 4.2
* @stable ICU 4.2
*/
void setNumberFormat(const NumberFormat& format, UErrorCode& status);
// using MeasureFormat::format;
/**
* Format a TimeUnitAmount.
* If the formattable object is not a time unit amount object,
* or the number in time unit amount is not a double type or long type
* numeric, it returns a failing status: U_ILLEGAL_ARGUMENT_ERROR.
* @see Format#format(const Formattable&, UnicodeString&, FieldPosition&, UErrorCode&) const
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UnicodeString& format(const Formattable& obj,
virtual UnicodeString& format(const Formattable& obj,
UnicodeString& toAppendTo,
FieldPosition& pos,
UErrorCode& status) const;
FieldPosition& pos,
UErrorCode& status) const;
/**
* Parse a TimeUnitAmount.
* @see Format#parseObject(const UnicodeString&, Formattable&, ParsePosition&) const;
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual void parseObject(const UnicodeString& source,
virtual void parseObject(const UnicodeString& source,
Formattable& result,
ParsePosition& pos) const;
@@ -204,7 +197,7 @@ public:
* . erived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UClassID U_EXPORT2 getStaticClassID(void);
@@ -217,7 +210,7 @@ public:
* @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 4.2
* @stable ICU 4.2
*/
virtual UClassID getDynamicClassID(void) const;
@@ -228,14 +221,12 @@ private:
PluralRules* fPluralRules;
EStyle fStyle;
friend UBool U_CALLCONV hashTableValueComparator(UHashTok val1, UHashTok val2);
void create(const Locale& locale, EStyle style, UErrorCode& status);
// it might actually be simpler to make them Decimal Formats later.
// initialize all private data members
void setup(UErrorCode& status);
void setup(UErrorCode& status);
// initialize data member without fill in data for fTimeUnitToCountToPattern
void initDataMembers(UErrorCode& status);
@@ -247,8 +238,8 @@ private:
void checkConsistency(EStyle style, const char* key, UErrorCode& status);
// fill in fTimeUnitToCountToPatterns from locale fall-back chain
void searchInLocaleChain(EStyle style, const char* key,
TimeUnit::UTimeUnitFields field, const char*,
void searchInLocaleChain(EStyle style, const char* key,
TimeUnit::UTimeUnitFields field, const char*,
const char*, Hashtable*, UErrorCode&);
// initialize hash table
+23 -5
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2008, International Business Machines
* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -19,6 +19,7 @@
#include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "unicode/localpointer.h"
/**
*\file
@@ -519,6 +520,25 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode);
U_STABLE void U_EXPORT2
ubidi_close(UBiDi *pBiDi);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUBiDiPointer
* "Smart pointer" class, closes a UBiDi via ubidi_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close);
U_NAMESPACE_END
#endif
/**
* Modify the operation of the Bidi algorithm such that it
* approximates an "inverse Bidi" algorithm. This function
@@ -791,12 +811,10 @@ typedef enum UBiDiReorderingMode {
*
* <li>When the reordering mode is set to
* <code>#UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the Logical to Visual
* Bidi algorithm used in Windows XP is used as an approximation of an
* "inverse Bidi" algorithm.
* Bidi algorithm used in Windows XP is used as an approximation of an "inverse Bidi" algorithm.
* <br>
* For example, an LTR paragraph with the content "abc FED123" (where
* upper case represents RTL characters) will be transformed to
* "abc 123DEF.</li>
* upper case represents RTL characters) will be transformed to "abc 123DEF."</li>
* </ul>
*
* <p>In all the reordering modes specifying an "inverse Bidi" algorithm
+24 -4
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2009, International Business Machines Corporation and others.
* Copyright (C) 1996-2010, International Business Machines Corporation and others.
* All Rights Reserved.
******************************************************************************
*/
@@ -11,6 +11,7 @@
#include "unicode/utypes.h"
#include "unicode/uloc.h"
#include "unicode/utext.h"
#include "unicode/localpointer.h"
/**
* A text-break iterator.
@@ -22,7 +23,7 @@
* Opaque type representing an ICU Break iterator object.
* @stable ICU 2.0
*/
typedef void UBreakIterator;
typedef struct UBreakIterator UBreakIterator;
#endif
#if !UCONFIG_NO_BREAK_ITERATION
@@ -76,10 +77,10 @@
* object oriented C++ API with equivalent functionality is defined in the
* file brkiter.h.
* <p>
* Code snippits illustrating the use of the Break Iterator APIs
* Code snippets illustrating the use of the Break Iterator APIs
* are available in the ICU User Guide,
* http://icu-project.org/userguide/boundaryAnalysis.html
* and in the sample program icu/source/samples/break/break.cpp"
* and in the sample program icu/source/samples/break/break.cpp
*/
/** The possible types of text boundaries. @stable ICU 2.0 */
@@ -277,6 +278,25 @@ ubrk_safeClone(
U_STABLE void U_EXPORT2
ubrk_close(UBreakIterator *bi);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUBreakIteratorPointer
* "Smart pointer" class, closes a UBreakIterator via ubrk_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close);
U_NAMESPACE_END
#endif
/**
* Sets an existing iterator to point to a new piece of text
* @param bi The iterator to use
+112 -14
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2009, International Business Machines Corporation and
* Copyright (C) 1996-2010, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@@ -11,6 +11,7 @@
#include "unicode/utypes.h"
#include "unicode/uenum.h"
#include "unicode/uloc.h"
#include "unicode/localpointer.h"
#if !UCONFIG_NO_FORMATTING
@@ -155,16 +156,16 @@ enum UCalendarType {
* @stable ICU 2.0
*/
UCAL_TRADITIONAL,
/**
* Unambiguously designates the Gregorian calendar for the locale.
* @stable ICU 2.0
*/
UCAL_GREGORIAN,
/**
* A better name for UCAL_TRADITIONAL.
* @draft ICU 4.2
*/
UCAL_DEFAULT = UCAL_TRADITIONAL
UCAL_DEFAULT = UCAL_TRADITIONAL,
/**
* Unambiguously designates the Gregorian calendar for the locale.
* @stable ICU 2.0
*/
UCAL_GREGORIAN
};
/** @stable ICU 2.0 */
@@ -644,6 +645,25 @@ ucal_open(const UChar* zoneID,
U_STABLE void U_EXPORT2
ucal_close(UCalendar *cal);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUCalendarPointer
* "Smart pointer" class, closes a UCalendar via ucal_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
U_NAMESPACE_END
#endif
/**
* Open a copy of a UCalendar.
* This function performs a deep copy.
@@ -652,7 +672,7 @@ ucal_close(UCalendar *cal);
* @return A pointer to a UCalendar identical to cal.
* @stable ICU 4.0
*/
U_DRAFT UCalendar* U_EXPORT2
U_STABLE UCalendar* U_EXPORT2
ucal_clone(const UCalendar* cal,
UErrorCode* status);
@@ -1121,7 +1141,7 @@ ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode*
* @return the version string, such as "2007f"
* @stable ICU 3.8
*/
U_DRAFT const char * U_EXPORT2
U_STABLE const char * U_EXPORT2
ucal_getTZDataVersion(UErrorCode* status);
/**
@@ -1142,7 +1162,7 @@ ucal_getTZDataVersion(UErrorCode* status);
* null.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
/**
@@ -1150,9 +1170,9 @@ ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
* @param cal The UCalendar to query.
* @param status The error code for the operation.
* @return The resource keyword value string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT const char * U_EXPORT2
U_STABLE const char * U_EXPORT2
ucal_getType(const UCalendar *cal, UErrorCode* status);
/**
@@ -1169,15 +1189,93 @@ ucal_getType(const UCalendar *cal, UErrorCode* status);
* it will return all the available values for the locale.
* @param status error status
* @return a string enumeration over keyword values for the given key and the locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UEnumeration* U_EXPORT2
U_STABLE UEnumeration* U_EXPORT2
ucal_getKeywordValuesForLocale(const char* key,
const char* locale,
UBool commonlyUsed,
UErrorCode* status);
/** Weekday types, as returned by ucal_getDayOfWeekType().
* @draft ICU 4.4
*/
enum UCalendarWeekdayType {
/**
* Designates a full weekday (no part of the day is included in the weekend).
*/
UCAL_WEEKDAY,
/**
* Designates a full weekend day (the entire day is included in the weekend).
*/
UCAL_WEEKEND,
/**
* Designates a day that starts as a weekday and transitions to the weekend.
* Call ucal_getWeekendTransition() to get the time of transition.
*/
UCAL_WEEKEND_ONSET,
/**
* Designates a day that starts as the weekend and transitions to a weekday.
* Call ucal_getWeekendTransition() to get the time of transition.
*/
UCAL_WEEKEND_CEASE
};
/** @draft ICU 4.4 */
typedef enum UCalendarWeekdayType UCalendarWeekdayType;
/**
* Returns whether the given day of the week is a weekday, a
* weekend day, or a day that transitions from one to the other,
* in this calendar system. If a transition occurs at midnight,
* then the days before and after the transition will have the
* type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time
* other than midnight, then the day of the transition will have
* the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the
* method getWeekendTransition() will return the point of
* transition.
* @param cal The UCalendar to query.
* @param dayOfWeek The day of the week whose type is desired (UCAL_SUNDAY..UCAL_SATURDAY).
* @param status The error code for the operation.
* @return The UCalendarWeekdayType for the day of the week.
* @draft ICU 4.4
*/
U_DRAFT UCalendarWeekdayType U_EXPORT2
ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
/**
* Returns the time during the day at which the weekend begins or ends in
* this calendar system. If ucal_getDayOfWeekType() rerturns UCAL_WEEKEND_ONSET
* for the specified dayOfWeek, return the time at which the weekend begins.
* If ucal_getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek,
* return the time at which the weekend ends. If ucal_getDayOfWeekType() returns
* some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition
* (U_ILLEGAL_ARGUMENT_ERROR).
* @param cal The UCalendar to query.
* @param dayOfWeek The day of the week for which the weekend transition time is
* desired (UCAL_SUNDAY..UCAL_SATURDAY).
* @param status The error code for the operation.
* @return The milliseconds after midnight at which the weekend begins or ends.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
/**
* Returns TRUE if the given UDate is in the weekend in
* this calendar system.
* @param cal The UCalendar to query.
* @param date The UDate in question.
* @param status The error code for the operation.
* @return TRUE if the given UDate is in the weekend in
* this calendar system, FALSE otherwise.
* @draft ICU 4.4
*/
U_DRAFT UBool U_EXPORT2
ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
+26 -6
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2009, International Business Machines
* Copyright (C) 2005-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -21,6 +21,7 @@
#include "unicode/utypes.h"
#include "unicode/ustring.h"
#include "unicode/localpointer.h"
/**
* \file
@@ -76,6 +77,25 @@ ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode);
U_STABLE void U_EXPORT2
ucasemap_close(UCaseMap *csm);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUCaseMapPointer
* "Smart pointer" class, closes a UCaseMap via ucasemap_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCaseMapPointer, UCaseMap, ucasemap_close);
U_NAMESPACE_END
#endif
/**
* Get the locale ID that is used for language-dependent case mappings.
* @param csm UCaseMap service object.
@@ -172,7 +192,7 @@ ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode);
* @return titlecasing break iterator
* @stable ICU 3.8
*/
U_DRAFT const UBreakIterator * U_EXPORT2
U_STABLE const UBreakIterator * U_EXPORT2
ucasemap_getBreakIterator(const UCaseMap *csm);
/**
@@ -195,7 +215,7 @@ ucasemap_getBreakIterator(const UCaseMap *csm);
* @see ucasemap_utf8ToTitle
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode);
/**
@@ -244,7 +264,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode
* @see u_strToTitle
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucasemap_toTitle(UCaseMap *csm,
UChar *dest, int32_t destCapacity,
const UChar *src, int32_t srcLength,
@@ -356,7 +376,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm,
* @see U_TITLECASE_NO_BREAK_ADJUSTMENT
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucasemap_utf8ToTitle(UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
@@ -392,7 +412,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
* @see U_FOLD_CASE_EXCLUDE_SPECIAL_I
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucasemap_utf8FoldCase(const UCaseMap *csm,
char *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
+109 -45
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -39,7 +39,7 @@ U_CDECL_BEGIN
* @see u_getUnicodeVersion
* @stable ICU 2.0
*/
#define U_UNICODE_VERSION "5.1"
#define U_UNICODE_VERSION "5.2"
/**
* \file
@@ -321,51 +321,29 @@ typedef enum UProperty {
/** Binary property NFD_Inert.
ICU-specific property for characters that are inert under NFD,
i.e., they do not interact with adjacent characters.
Used for example in normalizing transforms in incremental mode
to find the boundary of safely normalizable text despite possible
text additions.
There is one such property per normalization form.
These properties are computed as follows - an inert character is:
a) unassigned, or ALL of the following:
b) of combining class 0.
c) not decomposed by this normalization form.
AND if NFC or NFKC,
d) can never compose with a previous character.
e) can never compose with a following character.
f) can never change if another character is added.
Example: a-breve might satisfy all but f, but if you
add an ogonek it changes to a-ogonek + breve
See also com.ibm.text.UCD.NFSkippable in the ICU4J repository,
and icu/source/common/unormimp.h .
See the documentation for the Normalizer2 class and the
Normalizer2::isInert() method.
@stable ICU 3.0 */
UCHAR_NFD_INERT=37,
/** Binary property NFKD_Inert.
ICU-specific property for characters that are inert under NFKD,
i.e., they do not interact with adjacent characters.
Used for example in normalizing transforms in incremental mode
to find the boundary of safely normalizable text despite possible
text additions.
@see UCHAR_NFD_INERT
See the documentation for the Normalizer2 class and the
Normalizer2::isInert() method.
@stable ICU 3.0 */
UCHAR_NFKD_INERT=38,
/** Binary property NFC_Inert.
ICU-specific property for characters that are inert under NFC,
i.e., they do not interact with adjacent characters.
Used for example in normalizing transforms in incremental mode
to find the boundary of safely normalizable text despite possible
text additions.
@see UCHAR_NFD_INERT
See the documentation for the Normalizer2 class and the
Normalizer2::isInert() method.
@stable ICU 3.0 */
UCHAR_NFC_INERT=39,
/** Binary property NFKC_Inert.
ICU-specific property for characters that are inert under NFKC,
i.e., they do not interact with adjacent characters.
Used for example in normalizing transforms in incremental mode
to find the boundary of safely normalizable text despite possible
text additions.
@see UCHAR_NFD_INERT
See the documentation for the Normalizer2 class and the
Normalizer2::isInert() method.
@stable ICU 3.0 */
UCHAR_NFKC_INERT=40,
/** Binary Property Segment_Starter.
@@ -373,7 +351,7 @@ typedef enum UProperty {
Unicode normalization and combining character sequences.
They have ccc=0 and do not occur in non-initial position of the
canonical decomposition of any character
(like " in NFD(a-umlaut) and a Jamo T in an NFD(Hangul LVT)).
(like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)).
ICU uses this property for segmenting a string for generating a set of
canonically equivalent strings, e.g. for canonical closure while
processing collation tailoring rules.
@@ -414,8 +392,24 @@ typedef enum UProperty {
See the uchar.h file documentation.
@stable ICU 3.4 */
UCHAR_POSIX_XDIGIT=48,
/** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @draft ICU 4.4 */
UCHAR_CASED=49,
/** Binary property Case_Ignorable. Used in context-sensitive case mappings. @draft ICU 4.4 */
UCHAR_CASE_IGNORABLE=50,
/** Binary property Changes_When_Lowercased. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_LOWERCASED=51,
/** Binary property Changes_When_Uppercased. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_UPPERCASED=52,
/** Binary property Changes_When_Titlecased. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_TITLECASED=53,
/** Binary property Changes_When_Casefolded. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_CASEFOLDED=54,
/** Binary property Changes_When_Casemapped. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_CASEMAPPED=55,
/** Binary property Changes_When_NFKC_Casefolded. @draft ICU 4.4 */
UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56,
/** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */
UCHAR_BINARY_LIMIT=49,
UCHAR_BINARY_LIMIT=57,
/** Enumerated property Bidi_Class.
Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */
@@ -1291,8 +1285,63 @@ enum UBlockCode {
/** @stable ICU 4.0 */
UBLOCK_DOMINO_TILES = 171, /*[1F030]*/
/* New blocks in Unicode 5.2 */
/** @draft ICU 4.4 */
UBLOCK_SAMARITAN = 172, /*[0800]*/
/** @draft ICU 4.4 */
UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/
/** @draft ICU 4.4 */
UBLOCK_TAI_THAM = 174, /*[1A20]*/
/** @draft ICU 4.4 */
UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/
/** @draft ICU 4.4 */
UBLOCK_LISU = 176, /*[A4D0]*/
/** @draft ICU 4.4 */
UBLOCK_BAMUM = 177, /*[A6A0]*/
/** @draft ICU 4.4 */
UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/
/** @draft ICU 4.4 */
UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/
/** @draft ICU 4.4 */
UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/
/** @draft ICU 4.4 */
UBLOCK_JAVANESE = 181, /*[A980]*/
/** @draft ICU 4.4 */
UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/
/** @draft ICU 4.4 */
UBLOCK_TAI_VIET = 183, /*[AA80]*/
/** @draft ICU 4.4 */
UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/
/** @draft ICU 4.4 */
UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/
/** @draft ICU 4.4 */
UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/
/** @draft ICU 4.4 */
UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/
/** @draft ICU 4.4 */
UBLOCK_AVESTAN = 188, /*[10B00]*/
/** @draft ICU 4.4 */
UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/
/** @draft ICU 4.4 */
UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/
/** @draft ICU 4.4 */
UBLOCK_OLD_TURKIC = 191, /*[10C00]*/
/** @draft ICU 4.4 */
UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/
/** @draft ICU 4.4 */
UBLOCK_KAITHI = 193, /*[11080]*/
/** @draft ICU 4.4 */
UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/
/** @draft ICU 4.4 */
UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/
/** @draft ICU 4.4 */
UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/
/** @draft ICU 4.4 */
UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/
/** @stable ICU 2.0 */
UBLOCK_COUNT = 172,
UBLOCK_COUNT = 198,
/** @stable ICU 2.0 */
UBLOCK_INVALID_CODE=-1
@@ -1337,6 +1386,7 @@ typedef enum UCharNameChoice {
U_UNICODE_CHAR_NAME,
U_UNICODE_10_CHAR_NAME,
U_EXTENDED_CHAR_NAME,
U_CHAR_NAME_ALIAS, /**< Corrected name from NameAliases.txt. @draft ICU 4.4 */
U_CHAR_NAME_CHOICE_COUNT
} UCharNameChoice;
@@ -1465,6 +1515,8 @@ typedef enum UJoiningGroup {
U_JG_KHAPH, /**< @stable ICU 2.6 */
U_JG_ZHAIN, /**< @stable ICU 2.6 */
U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */
U_JG_FARSI_YEH, /**< @draft ICU 4.4 */
U_JG_NYA, /**< @draft ICU 4.4 */
U_JG_COUNT
} UJoiningGroup;
@@ -1584,7 +1636,8 @@ typedef enum ULineBreak {
U_LB_JL = 33, /*[JL]*/
U_LB_JT = 34, /*[JT]*/
U_LB_JV = 35, /*[JV]*/
U_LB_COUNT = 36
U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */
U_LB_COUNT = 37
} ULineBreak;
/**
@@ -2126,8 +2179,8 @@ u_isJavaSpaceChar(UChar32 c);
* A character is considered to be a Java whitespace character if and only
* if it satisfies one of the following criteria:
*
* - It is a Unicode separator (categories "Z"), but is not
* a no-break space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
* - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not
* also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP).
* - It is U+0009 HORIZONTAL TABULATION.
* - It is U+000A LINE FEED.
* - It is U+000B VERTICAL TABULATION.
@@ -2137,9 +2190,15 @@ u_isJavaSpaceChar(UChar32 c);
* - It is U+001D GROUP SEPARATOR.
* - It is U+001E RECORD SEPARATOR.
* - It is U+001F UNIT SEPARATOR.
* - It is U+0085 NEXT LINE.
*
* Same as java.lang.Character.isWhitespace() except that Java omits U+0085.
* This API tries to sync with the semantics of Java's
* java.lang.Character.isWhitespace(), but it may not return
* the exact same results because of the Unicode version
* difference.
*
* Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs)
* to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false.
* See http://www.unicode.org/versions/Unicode4.0.1/
*
* Note: There are several ICU whitespace functions; please see the uchar.h
* file documentation for a detailed comparison.
@@ -2457,6 +2516,9 @@ u_charName(UChar32 code, UCharNameChoice nameChoice,
* The ISO 10646 comment is an informative field in the Unicode Character
* Database (UnicodeData.txt field 11) and is from the ISO 10646 names list.
*
* Note: Unicode 5.2 removes all ISO comment data, resulting in empty strings
* returned for all characters.
*
* @param c The character (code point) for which to get the ISO comment.
* It must be <code>0<=c<=0x10ffff</code>.
* @param dest Destination address for copying the comment.
@@ -2687,7 +2749,7 @@ u_getPropertyValueName(UProperty property,
*
* @return a value integer or UCHAR_INVALID_CODE if the given name
* does not match any value of the given property, or if the
* property is invalid. Note: U CHAR_GENERAL_CATEGORY values
* property is invalid. Note: UCHAR_GENERAL_CATEGORY_MASK values
* are not values of UCharCategory, but rather mask values
* produced by U_GET_GC_MASK(). This allows grouped
* categories such as [:L:] to be represented.
@@ -2749,11 +2811,9 @@ u_isIDPart(UChar32 c);
* according to Java.
* True for characters with general category "Cf" (format controls) as well as
* non-whitespace ISO controls
* (U+0000..U+0008, U+000E..U+001B, U+007F..U+0084, U+0086..U+009F).
* (U+0000..U+0008, U+000E..U+001B, U+007F..U+009F).
*
* Same as java.lang.Character.isIdentifierIgnorable()
* except that Java also returns TRUE for U+0085 Next Line
* (it omits U+0085 from whitespace ISO controls).
* Same as java.lang.Character.isIdentifierIgnorable().
*
* Note that Unicode just recommends to ignore Cf (format controls).
*
@@ -3032,6 +3092,7 @@ u_charAge(UChar32 c, UVersionInfo versionArray);
U_STABLE void U_EXPORT2
u_getUnicodeVersion(UVersionInfo versionArray);
#if !UCONFIG_NO_NORMALIZATION
/**
* Get the FC_NFKC_Closure property string for a character.
* See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure"
@@ -3056,6 +3117,9 @@ u_getUnicodeVersion(UVersionInfo versionArray);
U_STABLE int32_t U_EXPORT2
u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode);
#endif
U_CDECL_END
#endif /*_UCHAR*/
+17 -33
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
* *
* Copyright (C) 2001-2005, International Business Machines *
* Copyright (C) 2001-2009, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@@ -24,38 +24,22 @@
*/
/**
* Initialize ICU. The description further below applies to ICU 2.6 to ICU 3.4.
* Starting with ICU 3.4, u_init() needs not be called any more for
* ensuring thread safety, but it can give an indication for whether ICU
* can load its data. In ICU 3.4, it will try to load the converter alias table
* (cnvalias.icu) and give an error code if that fails.
* This may change in the future.
* <p>
* For ensuring the availability of necessary data, an application should
* open the service objects (converters, collators, etc.) that it will use
* and check for error codes there.
* <p>
* Documentation for ICU 2.6 to ICU 3.4:
* <p>
* This function loads and initializes data items
* that are required internally by various ICU functions. Use of this explicit
* initialization is required in multi-threaded applications; in
* single threaded apps, use is optional, but incurs little additional
* cost, and is thus recommended.
* <p>
* In multi-threaded applications, u_init() should be called in the
* main thread before starting additional threads, or, alternatively
* it can be called in each individual thread once, before other ICU
* functions are called in that thread. In this second scenario, the
* application must guarantee that the first call to u_init() happen
* without contention, in a single thread only.
* <p>
* If <code>u_setMemoryFunctions()</code> or
* <code>u_setMutexFunctions</code> are needed (uncommon), they must be
* called _before_ <code>u_init()</code>.
* <p>
* Extra, repeated, or otherwise unneeded calls to u_init() do no harm,
* other than taking a small amount of time.
* Initialize ICU.
*
* Use of this function is optional. It is OK to simply use ICU
* services and functions without first having initialized
* ICU by calling u_init().
*
* u_init() will attempt to load some part of ICU's data, and is
* useful as a test for configuration or installation problems that
* leave the ICU data inaccessible. A successful invocation of u_init()
* does not, however, guarantee that all ICU data is accessible.
*
* Multiple calls to u_init() cause no harm, aside from the small amount
* of time required.
*
* In old versions of ICU, u_init() was required in multi-threaded applications
* to ensure the thread safety of ICU. u_init() is no longer needed for this purpose.
*
* @param status An ICU UErrorCode parameter. It must not be <code>NULL</code>.
* An Error will be returned if some required part of ICU data can not
+20
View File
@@ -49,6 +49,7 @@
#include "unicode/ucnv_err.h"
#include "unicode/uenum.h"
#include "unicode/localpointer.h"
#ifndef __USET_H__
@@ -523,6 +524,25 @@ ucnv_safeClone(const UConverter *cnv,
U_STABLE void U_EXPORT2
ucnv_close(UConverter * converter);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUConverterPointer
* "Smart pointer" class, closes a UConverter via ucnv_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
U_NAMESPACE_END
#endif
/**
* Fills in the output parameter, subChars, with the substitution characters
* as multiple bytes.
+33 -13
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2008, International Business Machines
* Copyright (C) 2008-2010, International Business Machines
* Corporation, Google and others. All Rights Reserved.
*
*******************************************************************************
@@ -24,6 +24,7 @@
#include "unicode/utf16.h"
#include "unicode/uenum.h"
#include "unicode/ucnv.h"
#include "unicode/localpointer.h"
/**
* \file
@@ -64,9 +65,9 @@ typedef struct UConverterSelector UConverterSelector;
* @param status an in/out ICU UErrorCode
* @return the new selector
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI UConverterSelector* U_EXPORT2
U_STABLE UConverterSelector* U_EXPORT2
ucnvsel_open(const char* const* converterList, int32_t converterListSize,
const USet* excludedCodePoints,
const UConverterUnicodeSet whichSet, UErrorCode* status);
@@ -82,11 +83,30 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
*
* @param sel selector to close
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI void U_EXPORT2
U_STABLE void U_EXPORT2
ucnvsel_close(UConverterSelector *sel);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUConverterSelectorPointer
* "Smart pointer" class, closes a UConverterSelector via ucnvsel_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close);
U_NAMESPACE_END
#endif
/**
* Open a selector from its serialized form.
* The buffer must remain valid and unchanged for the lifetime of the selector.
@@ -100,9 +120,9 @@ ucnvsel_close(UConverterSelector *sel);
* @param status an in/out ICU UErrorCode
* @return the new selector
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI UConverterSelector* U_EXPORT2
U_STABLE UConverterSelector* U_EXPORT2
ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status);
/**
@@ -117,9 +137,9 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
* @return the required buffer capacity to hold serialize data (even if the call fails
* with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity)
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucnvsel_serialize(const UConverterSelector* sel,
void* buffer, int32_t bufferCapacity, UErrorCode* status);
@@ -135,9 +155,9 @@ ucnvsel_serialize(const UConverterSelector* sel,
* The returned encoding names and their order will be the same as
* supplied when building the selector.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI UEnumeration * U_EXPORT2
U_STABLE UEnumeration * U_EXPORT2
ucnvsel_selectForString(const UConverterSelector* sel,
const UChar *s, int32_t length, UErrorCode *status);
@@ -153,9 +173,9 @@ ucnvsel_selectForString(const UConverterSelector* sel,
* The returned encoding names and their order will be the same as
* supplied when building the selector.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI UEnumeration * U_EXPORT2
U_STABLE UEnumeration * U_EXPORT2
ucnvsel_selectForUTF8(const UConverterSelector* sel,
const char *s, int32_t length, UErrorCode *status);
+28 -4
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (c) 1996-2009, International Business Machines Corporation and others.
* Copyright (c) 1996-2010, International Business Machines Corporation and others.
* All Rights Reserved.
*******************************************************************************
*/
@@ -13,6 +13,7 @@
#if !UCONFIG_NO_COLLATION
#include "unicode/unorm.h"
#include "unicode/localpointer.h"
#include "unicode/parseerr.h"
#include "unicode/uloc.h"
#include "unicode/uset.h"
@@ -220,7 +221,11 @@ typedef enum {
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'. */
* This is a way to get '100' to sort AFTER '2'. Note that the longest
* digit substring that can be treated as a single collation element is
* 254 digits (not counting leading zeros). If a digit substring is
* longer than that, the digits beyond the limit will be treated as a
* separate digit substring associated with a separate collation element. */
UCOL_NUMERIC_COLLATION,
UCOL_ATTRIBUTE_COUNT
} UColAttribute;
@@ -375,6 +380,25 @@ ucol_getContractionsAndExpansions( const UCollator *coll,
U_STABLE void U_EXPORT2
ucol_close(UCollator *coll);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUCollatorPointer
* "Smart pointer" class, closes a UCollator via ucol_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close);
U_NAMESPACE_END
#endif
/**
* Compare two strings.
* The strings will be compared using the options already specified.
@@ -592,9 +616,9 @@ ucol_getKeywordValues(const char *keyword, UErrorCode *status);
* it will return all the available values for the locale.
* @param status error status
* @return a string enumeration over keyword values for the given key and the locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UEnumeration* U_EXPORT2
U_STABLE UEnumeration* U_EXPORT2
ucol_getKeywordValuesForLocale(const char* key,
const char* locale,
UBool commonlyUsed,
+22 -1
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2007, International Business Machines
* Copyright (C) 2005-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: ucsdet.h
@@ -22,6 +22,8 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_CONVERSION
#include "unicode/localpointer.h"
#include "unicode/uenum.h"
/**
@@ -82,6 +84,25 @@ ucsdet_open(UErrorCode *status);
U_STABLE void U_EXPORT2
ucsdet_close(UCharsetDetector *ucsd);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUCharsetDetectorPointer
* "Smart pointer" class, closes a UCharsetDetector via ucsdet_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUCharsetDetectorPointer, UCharsetDetector, ucsdet_close);
U_NAMESPACE_END
#endif
/**
* Set the input byte data whose charset is to detected.
*
+6 -6
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2002-2009, International Business Machines
* Copyright (c) 2002-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@@ -152,7 +152,7 @@ ucurr_getName(const UChar* currency,
* @return pointer to display string of 'len' UChars. If the resource
* data contains no entry for 'currency', then 'currency' itself is
* returned.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_STABLE const UChar* U_EXPORT2
ucurr_getPluralName(const UChar* currency,
@@ -257,7 +257,7 @@ ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
* values are invalid.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucurr_countCurrencies(const char* locale,
UDate date,
UErrorCode* ec);
@@ -281,7 +281,7 @@ ucurr_countCurrencies(const char* locale,
* invalid.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ucurr_forLocaleAndDate(const char* locale,
UDate date,
int32_t index,
@@ -303,9 +303,9 @@ ucurr_forLocaleAndDate(const char* locale,
* it will return all the available values for the locale.
* @param status error status
* @return a string enumeration over keyword values for the given key and the locale.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UEnumeration* U_EXPORT2
U_STABLE UEnumeration* U_EXPORT2
ucurr_getKeywordValuesForLocale(const char* key,
const char* locale,
UBool commonlyUsed,
+41 -6
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2009, International Business Machines
* Copyright (C) 1996-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
@@ -12,6 +12,7 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/localpointer.h"
#include "unicode/ucal.h"
#include "unicode/unum.h"
/**
@@ -219,7 +220,8 @@ typedef enum UDateFormatStyle {
* Below are a set of pre-defined skeletons that
* have pre-defined interval patterns in resource files.
* Users are encouraged to use them in date interval format factory methods.
*
*
* @stable ICU 4.0
*/
#define UDAT_HOUR_MINUTE "hm"
#define UDAT_YEAR "y"
@@ -443,15 +445,15 @@ typedef enum UDateFormatField {
UDAT_TIMEZONE_GENERIC_FIELD = 24,
/**
* FieldPosition selector for 'c' field alignment,
* corresponding to the {@link #UCAL_DATE} field.
* corresponding to the {@link #UCAL_DOW_LOCAL} 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.
* corresponding to the {@link #UCAL_MONTH} field.
* This displays the stand alone month name, if available.
* @stable ICU 3.4
*/
@@ -483,7 +485,7 @@ typedef enum UDateFormatField {
UDAT_TIMEZONE_SPECIAL_FIELD = 29,
/**
* Number of FieldPosition and UFieldPosition selectors for
* 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
@@ -494,6 +496,19 @@ typedef enum UDateFormatField {
} UDateFormatField;
/**
* Maps from a UDateFormatField to the corresponding UCalendarDateFields.
* Note: since the mapping is many-to-one, there is no inverse mapping.
* @param field the UDateFormatField.
* @return the UCalendarDateField. This will be UCAL_FIELD_COUNT in case
* of error (e.g., the input field is UDAT_FIELD_COUNT).
* @draft ICU 4.4
*/
U_DRAFT UCalendarDateFields U_EXPORT2
udat_toCalendarDateField(UDateFormatField field);
/**
* 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 },
@@ -535,6 +550,25 @@ udat_open(UDateFormatStyle timeStyle,
U_STABLE void U_EXPORT2
udat_close(UDateFormat* format);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUDateFormatPointer
* "Smart pointer" class, closes a UDateFormat via udat_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close);
U_NAMESPACE_END
#endif
/**
* Open a copy of a UDateFormat.
* This function performs a deep copy.
@@ -957,6 +991,7 @@ udat_applyPatternRelative(UDateFormat *format,
int32_t timePatternLength,
UErrorCode *status);
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
+37 -11
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2008, International Business Machines
* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -18,6 +18,7 @@
#define __UDATA_H__
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
U_CDECL_BEGIN
@@ -256,6 +257,25 @@ udata_openChoice(const char *path, const char *type, const char *name,
U_STABLE void U_EXPORT2
udata_close(UDataMemory *pData);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUDataMemoryPointer
* "Smart pointer" class, closes a UDataMemory via udata_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
U_NAMESPACE_END
#endif
/**
* Get the pointer to the actual data inside the data memory.
* The data is read-only.
@@ -298,20 +318,27 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
* the data that has been loaded from a dll by the operating system,
* as shown in this code:
*
* extern const char U_IMPORT U_ICUDATA_ENTRY_POINT [];
* extern const char U_IMPORT U_ICUDATA_ENTRY_POINT [];
* // U_ICUDATA_ENTRY_POINT is same as entry point specified to pkgdata tool
* UErrorCode status = U_ZERO_ERROR;
*
* udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);
*
* Warning: ICU must NOT have even attempted to access its data yet
* when this call is made, or U_USING_DEFAULT_WARNING code will
* be returned. Be careful of UnicodeStrings in static initialization which
* may attempt to load a converter (use the UNICODE_STRING(x) macro instead).
*
* Also note that it is important that the declaration be as above. The entry point
* It is important that the declaration be as above. The entry point
* must not be declared as an extern void*.
*
* Starting with ICU 4.4, it is possible to set several data packages,
* one per call to this function.
* udata_open() will look for data in the multiple data packages in the order
* in which they were set.
* The position of the linked-in or default-name ICU .data package in the
* search list depends on when the first data item is loaded that is not contained
* in the already explicitly set packages.
* If data was loaded implicitly before the first call to this function
* (for example, via opening a converter, constructing a UnicodeString
* from default-codepage data, using formatting or collation APIs, etc.),
* then the default data will be first in the list.
*
* This function has no effect on application (non ICU) data. See udata_setAppData()
* for similar functionality for application data.
*
@@ -319,7 +346,6 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
* @param err outgoing error status <code>U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR</code>
* @stable ICU 2.0
*/
U_STABLE void U_EXPORT2
udata_setCommonData(const void *data, UErrorCode *err);
@@ -373,8 +399,8 @@ typedef enum UDataFileAccess {
/**
* This function may be called to control how ICU loads data. It must be called
* before any ICU data is loaded, including application data loaded with ures/ResourceBundle or
* udata APIs. It should be called before u_init. This function is not multithread safe.
* before any ICU data is loaded, including application data loaded with
* ures/ResourceBundle or udata APIs. This function is not multithread safe.
* The results of calling it while other threads are loading data are undefined.
* @param access The type of file access to be used
* @param status Error code.
+136 -21
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2007-2009, International Business Machines
* Copyright (C) 2007-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -19,6 +19,7 @@
#include "unicode/utypes.h"
#include "unicode/uenum.h"
#include "unicode/localpointer.h"
/**
* \file
@@ -86,6 +87,26 @@ typedef enum UDateTimePatternField {
UDATPG_FIELD_COUNT
} UDateTimePatternField;
/**
* Masks to control forcing the length of specified fields in the returned
* pattern to match those in the skeleton (when this would not happen
* otherwise). These may be combined to force the length of multiple fields.
* Used with udatpg_getBestPatternWithOptions, udatpg_replaceFieldTypesWithOptions.
* @draft ICU 4.4
*/
typedef enum UDateTimePatternMatchOptions {
/** @draft ICU 4.4 */
UDATPG_MATCH_NO_OPTIONS = 0,
/** @draft ICU 4.4 */
UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
/** @internal ICU 4.4 */
UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
/** @internal ICU 4.4 */
UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
/** @draft ICU 4.4 */
UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
} UDateTimePatternMatchOptions;
/**
* Status return values from udatpg_addPattern().
* @stable ICU 3.8
@@ -109,7 +130,7 @@ typedef enum UDateTimePatternConflict {
* @return a pointer to UDateTimePatternGenerator.
* @stable ICU 3.8
*/
U_DRAFT UDateTimePatternGenerator * U_EXPORT2
U_STABLE UDateTimePatternGenerator * U_EXPORT2
udatpg_open(const char *locale, UErrorCode *pErrorCode);
/**
@@ -119,7 +140,7 @@ udatpg_open(const char *locale, UErrorCode *pErrorCode);
* @return a pointer to UDateTimePatternGenerator.
* @stable ICU 3.8
*/
U_DRAFT UDateTimePatternGenerator * U_EXPORT2
U_STABLE UDateTimePatternGenerator * U_EXPORT2
udatpg_openEmpty(UErrorCode *pErrorCode);
/**
@@ -127,9 +148,28 @@ udatpg_openEmpty(UErrorCode *pErrorCode);
* @param dtpg a pointer to UDateTimePatternGenerator.
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
udatpg_close(UDateTimePatternGenerator *dtpg);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUDateTimePatternGeneratorPointer
* "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
U_NAMESPACE_END
#endif
/**
* Create a copy pf a generator.
* @param dtpg a pointer to UDateTimePatternGenerator to be copied.
@@ -138,7 +178,7 @@ udatpg_close(UDateTimePatternGenerator *dtpg);
* @return a pointer to a new UDateTimePatternGenerator.
* @stable ICU 3.8
*/
U_DRAFT UDateTimePatternGenerator * U_EXPORT2
U_STABLE UDateTimePatternGenerator * U_EXPORT2
udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
/**
@@ -164,12 +204,49 @@ udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
* @return the length of bestPattern.
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
const UChar *skeleton, int32_t length,
UChar *bestPattern, int32_t capacity,
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 options
* Options for forcing the length of specified fields in the
* returned pattern to match those in the skeleton (when this
* would not happen otherwise). For default behavior, use
* UDATPG_MATCH_NO_OPTIONS.
* @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 4.4
*/
U_DRAFT int32_t U_EXPORT2
udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
const UChar *skeleton, int32_t length,
UDateTimePatternMatchOptions options,
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".
@@ -190,7 +267,7 @@ udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
* @return the length of skeleton.
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
udatpg_getSkeleton(UDateTimePatternGenerator *dtpg,
const UChar *pattern, int32_t length,
UChar *skeleton, int32_t capacity,
@@ -219,7 +296,7 @@ udatpg_getSkeleton(UDateTimePatternGenerator *dtpg,
* @return the length of baseSkeleton.
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg,
const UChar *pattern, int32_t length,
UChar *baseSkeleton, int32_t capacity,
@@ -249,7 +326,7 @@ udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg,
* UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
* @stable ICU 3.8
*/
U_DRAFT UDateTimePatternConflict U_EXPORT2
U_STABLE UDateTimePatternConflict U_EXPORT2
udatpg_addPattern(UDateTimePatternGenerator *dtpg,
const UChar *pattern, int32_t patternLength,
UBool override,
@@ -276,7 +353,7 @@ udatpg_addPattern(UDateTimePatternGenerator *dtpg,
* @param length the length of value.
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
const UChar *value, int32_t length);
@@ -291,7 +368,7 @@ udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
* @return appendItemFormat for field.
* @stable ICU 3.8
*/
U_DRAFT const UChar * U_EXPORT2
U_STABLE const UChar * U_EXPORT2
udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
int32_t *pLength);
@@ -309,7 +386,7 @@ udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
* @param length the length of value.
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
const UChar *value, int32_t length);
@@ -324,7 +401,7 @@ udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
* @return name for field
* @stable ICU 3.8
*/
U_DRAFT const UChar * U_EXPORT2
U_STABLE const UChar * U_EXPORT2
udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
UDateTimePatternField field,
int32_t *pLength);
@@ -350,7 +427,7 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
* @param length the length of dtFormat.
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
const UChar *dtFormat, int32_t length);
@@ -361,7 +438,7 @@ udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
* @return dateTimeFormat.
* @stable ICU 3.8
*/
U_DRAFT const UChar * U_EXPORT2
U_STABLE const UChar * U_EXPORT2
udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
int32_t *pLength);
@@ -378,7 +455,7 @@ udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
* @param length the length of decimal.
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
const UChar *decimal, int32_t length);
@@ -390,7 +467,7 @@ udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
* @return corresponding to the decimal point.
* @stable ICU 3.8
*/
U_DRAFT const UChar * U_EXPORT2
U_STABLE const UChar * U_EXPORT2
udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
int32_t *pLength);
@@ -419,13 +496,51 @@ udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
* @return the length of dest.
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE 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);
/**
* 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 options
* Options controlling whether the length of specified fields in the
* pattern are adjusted to match those in the skeleton (when this
* would not happen otherwise). For default behavior, use
* UDATPG_MATCH_NO_OPTIONS.
* @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 4.4
*/
U_DRAFT int32_t U_EXPORT2
udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
const UChar *pattern, int32_t patternLength,
const UChar *skeleton, int32_t skeletonLength,
UDateTimePatternMatchOptions options,
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.
@@ -437,7 +552,7 @@ udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
* The caller must close the object.
* @stable ICU 3.8
*/
U_DRAFT UEnumeration * U_EXPORT2
U_STABLE UEnumeration * U_EXPORT2
udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
/**
@@ -450,7 +565,7 @@ udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCo
* The caller must close the object.
* @stable ICU 3.8
*/
U_DRAFT UEnumeration * U_EXPORT2
U_STABLE UEnumeration * U_EXPORT2
udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
/**
@@ -463,7 +578,7 @@ udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErr
* @return pattern corresponding to a given skeleton.
* @stable ICU 3.8
*/
U_DRAFT const UChar * U_EXPORT2
U_STABLE const UChar * U_EXPORT2
udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
const UChar *skeleton, int32_t skeletonLength,
int32_t *pLength);
+11 -11
View File
@@ -1,10 +1,10 @@
/*
*******************************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name:
* file name: udeprctd.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -34,15 +34,15 @@
# define utrans_open utrans_open_DEPRECATED_API_DO_NOT_USE
# define utrans_unregister utrans_unregister_DEPRECATED_API_DO_NOT_USE
# else
# define ucol_getContractions_4_2 ucol_getContractions_DEPRECATED_API_DO_NOT_USE
# define ucol_getLocale_4_2 ucol_getLocale_DEPRECATED_API_DO_NOT_USE
# define ures_countArrayItems_4_2 ures_countArrayItems_DEPRECATED_API_DO_NOT_USE
# define ures_getLocale_4_2 ures_getLocale_DEPRECATED_API_DO_NOT_USE
# define ures_getVersionNumber_4_2 ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE
# define utrans_getAvailableID_4_2 utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE
# define utrans_getID_4_2 utrans_getID_DEPRECATED_API_DO_NOT_USE
# define utrans_open_4_2 utrans_open_DEPRECATED_API_DO_NOT_USE
# define utrans_unregister_4_2 utrans_unregister_DEPRECATED_API_DO_NOT_USE
# define ucol_getContractions_4_4 ucol_getContractions_DEPRECATED_API_DO_NOT_USE
# define ucol_getLocale_4_4 ucol_getLocale_DEPRECATED_API_DO_NOT_USE
# define ures_countArrayItems_4_4 ures_countArrayItems_DEPRECATED_API_DO_NOT_USE
# define ures_getLocale_4_4 ures_getLocale_DEPRECATED_API_DO_NOT_USE
# define ures_getVersionNumber_4_4 ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE
# define utrans_getAvailableID_4_4 utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE
# define utrans_getID_4_4 utrans_getID_DEPRECATED_API_DO_NOT_USE
# define utrans_open_4_4 utrans_open_DEPRECATED_API_DO_NOT_USE
# define utrans_unregister_4_4 utrans_unregister_DEPRECATED_API_DO_NOT_USE
# endif /* U_DISABLE_RENAMING */
#endif /* U_HIDE_DEPRECATED_API */
+76 -84
View File
@@ -1,10 +1,10 @@
/*
*******************************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name:
* file name: udraft.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -24,91 +24,83 @@
#ifdef U_HIDE_DRAFT_API
# if U_DISABLE_RENAMING
# define u_compareVersions u_compareVersions_DRAFT_API_DO_NOT_USE
# define u_strFromUTF32WithSub u_strFromUTF32WithSub_DRAFT_API_DO_NOT_USE
# define u_strToUTF32WithSub u_strToUTF32WithSub_DRAFT_API_DO_NOT_USE
# define u_versionFromUString u_versionFromUString_DRAFT_API_DO_NOT_USE
# define ucal_getKeywordValuesForLocale ucal_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucal_getType ucal_getType_DRAFT_API_DO_NOT_USE
# define ucnvsel_close ucnvsel_close_DRAFT_API_DO_NOT_USE
# define ucnvsel_open ucnvsel_open_DRAFT_API_DO_NOT_USE
# define ucnvsel_openFromSerialized ucnvsel_openFromSerialized_DRAFT_API_DO_NOT_USE
# define ucnvsel_selectForString ucnvsel_selectForString_DRAFT_API_DO_NOT_USE
# define ucnvsel_selectForUTF8 ucnvsel_selectForUTF8_DRAFT_API_DO_NOT_USE
# define ucnvsel_serialize ucnvsel_serialize_DRAFT_API_DO_NOT_USE
# define ucol_getKeywordValuesForLocale ucol_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucurr_getKeywordValuesForLocale ucurr_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucurr_getPluralName ucurr_getPluralName_DRAFT_API_DO_NOT_USE
# define bamuScriptCode bamuScriptCode_DRAFT_API_DO_NOT_USE
# define u_fadopt u_fadopt_DRAFT_API_DO_NOT_USE
# define u_strFromJavaModifiedUTF8WithSub u_strFromJavaModifiedUTF8WithSub_DRAFT_API_DO_NOT_USE
# define u_strToJavaModifiedUTF8 u_strToJavaModifiedUTF8_DRAFT_API_DO_NOT_USE
# define ucal_getDayOfWeekType ucal_getDayOfWeekType_DRAFT_API_DO_NOT_USE
# define ucal_getWeekendTransition ucal_getWeekendTransition_DRAFT_API_DO_NOT_USE
# define ucal_isWeekend ucal_isWeekend_DRAFT_API_DO_NOT_USE
# define udat_toCalendarDateField udat_toCalendarDateField_DRAFT_API_DO_NOT_USE
# define udatpg_getBestPatternWithOptions udatpg_getBestPatternWithOptions_DRAFT_API_DO_NOT_USE
# define udatpg_replaceFieldTypesWithOptions udatpg_replaceFieldTypesWithOptions_DRAFT_API_DO_NOT_USE
# define uldn_close uldn_close_DRAFT_API_DO_NOT_USE
# define uldn_getDialectHandling uldn_getDialectHandling_DRAFT_API_DO_NOT_USE
# define uldn_getLocale uldn_getLocale_DRAFT_API_DO_NOT_USE
# define uldn_keyDisplayName uldn_keyDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_keyValueDisplayName uldn_keyValueDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_languageDisplayName uldn_languageDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_localeDisplayName uldn_localeDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_open uldn_open_DRAFT_API_DO_NOT_USE
# define uldn_regionDisplayName uldn_regionDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_scriptCodeDisplayName uldn_scriptCodeDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_scriptDisplayName uldn_scriptDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_variantDisplayName uldn_variantDisplayName_DRAFT_API_DO_NOT_USE
# define uloc_forLanguageTag uloc_forLanguageTag_DRAFT_API_DO_NOT_USE
# define uloc_toLanguageTag uloc_toLanguageTag_DRAFT_API_DO_NOT_USE
# define ulocdata_getCLDRVersion ulocdata_getCLDRVersion_DRAFT_API_DO_NOT_USE
# define ulocdata_getLocaleDisplayPattern ulocdata_getLocaleDisplayPattern_DRAFT_API_DO_NOT_USE
# define ulocdata_getLocaleSeparator ulocdata_getLocaleSeparator_DRAFT_API_DO_NOT_USE
# define uset_closeOver uset_closeOver_DRAFT_API_DO_NOT_USE
# define uset_openEmpty uset_openEmpty_DRAFT_API_DO_NOT_USE
# define uset_removeAllStrings uset_removeAllStrings_DRAFT_API_DO_NOT_USE
# define uspoof_areConfusable uspoof_areConfusable_DRAFT_API_DO_NOT_USE
# define uspoof_areConfusableUTF8 uspoof_areConfusableUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_check uspoof_check_DRAFT_API_DO_NOT_USE
# define uspoof_checkUTF8 uspoof_checkUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_clone uspoof_clone_DRAFT_API_DO_NOT_USE
# define uspoof_close uspoof_close_DRAFT_API_DO_NOT_USE
# define uspoof_getAllowedChars uspoof_getAllowedChars_DRAFT_API_DO_NOT_USE
# define uspoof_getAllowedLocales uspoof_getAllowedLocales_DRAFT_API_DO_NOT_USE
# define uspoof_getChecks uspoof_getChecks_DRAFT_API_DO_NOT_USE
# define uspoof_getSkeleton uspoof_getSkeleton_DRAFT_API_DO_NOT_USE
# define uspoof_getSkeletonUTF8 uspoof_getSkeletonUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_open uspoof_open_DRAFT_API_DO_NOT_USE
# define uspoof_openFromSerialized uspoof_openFromSerialized_DRAFT_API_DO_NOT_USE
# define uspoof_openFromSource uspoof_openFromSource_DRAFT_API_DO_NOT_USE
# define uspoof_serialize uspoof_serialize_DRAFT_API_DO_NOT_USE
# define uspoof_setAllowedChars uspoof_setAllowedChars_DRAFT_API_DO_NOT_USE
# define uspoof_setAllowedLocales uspoof_setAllowedLocales_DRAFT_API_DO_NOT_USE
# define uspoof_setChecks uspoof_setChecks_DRAFT_API_DO_NOT_USE
# define usprep_openByType usprep_openByType_DRAFT_API_DO_NOT_USE
# define unorm2_append unorm2_append_DRAFT_API_DO_NOT_USE
# define unorm2_close unorm2_close_DRAFT_API_DO_NOT_USE
# define unorm2_getInstance unorm2_getInstance_DRAFT_API_DO_NOT_USE
# define unorm2_hasBoundaryAfter unorm2_hasBoundaryAfter_DRAFT_API_DO_NOT_USE
# define unorm2_hasBoundaryBefore unorm2_hasBoundaryBefore_DRAFT_API_DO_NOT_USE
# define unorm2_isInert unorm2_isInert_DRAFT_API_DO_NOT_USE
# define unorm2_isNormalized unorm2_isNormalized_DRAFT_API_DO_NOT_USE
# define unorm2_normalize unorm2_normalize_DRAFT_API_DO_NOT_USE
# define unorm2_normalizeSecondAndAppend unorm2_normalizeSecondAndAppend_DRAFT_API_DO_NOT_USE
# define unorm2_openFiltered unorm2_openFiltered_DRAFT_API_DO_NOT_USE
# define unorm2_quickCheck unorm2_quickCheck_DRAFT_API_DO_NOT_USE
# define unorm2_spanQuickCheckYes unorm2_spanQuickCheckYes_DRAFT_API_DO_NOT_USE
# define unum_formatDecimal unum_formatDecimal_DRAFT_API_DO_NOT_USE
# define unum_parseDecimal unum_parseDecimal_DRAFT_API_DO_NOT_USE
# else
# define u_compareVersions_4_2 u_compareVersions_DRAFT_API_DO_NOT_USE
# define u_strFromUTF32WithSub_4_2 u_strFromUTF32WithSub_DRAFT_API_DO_NOT_USE
# define u_strToUTF32WithSub_4_2 u_strToUTF32WithSub_DRAFT_API_DO_NOT_USE
# define u_versionFromUString_4_2 u_versionFromUString_DRAFT_API_DO_NOT_USE
# define ucal_getKeywordValuesForLocale_4_2 ucal_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucal_getType_4_2 ucal_getType_DRAFT_API_DO_NOT_USE
# define ucnvsel_close_4_2 ucnvsel_close_DRAFT_API_DO_NOT_USE
# define ucnvsel_openFromSerialized_4_2 ucnvsel_openFromSerialized_DRAFT_API_DO_NOT_USE
# define ucnvsel_open_4_2 ucnvsel_open_DRAFT_API_DO_NOT_USE
# define ucnvsel_selectForString_4_2 ucnvsel_selectForString_DRAFT_API_DO_NOT_USE
# define ucnvsel_selectForUTF8_4_2 ucnvsel_selectForUTF8_DRAFT_API_DO_NOT_USE
# define ucnvsel_serialize_4_2 ucnvsel_serialize_DRAFT_API_DO_NOT_USE
# define ucol_getKeywordValuesForLocale_4_2 ucol_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucurr_getKeywordValuesForLocale_4_2 ucurr_getKeywordValuesForLocale_DRAFT_API_DO_NOT_USE
# define ucurr_getPluralName_4_2 ucurr_getPluralName_DRAFT_API_DO_NOT_USE
# define uloc_forLanguageTag_4_2 uloc_forLanguageTag_DRAFT_API_DO_NOT_USE
# define uloc_toLanguageTag_4_2 uloc_toLanguageTag_DRAFT_API_DO_NOT_USE
# define ulocdata_getCLDRVersion_4_2 ulocdata_getCLDRVersion_DRAFT_API_DO_NOT_USE
# define ulocdata_getLocaleDisplayPattern_4_2 ulocdata_getLocaleDisplayPattern_DRAFT_API_DO_NOT_USE
# define ulocdata_getLocaleSeparator_4_2 ulocdata_getLocaleSeparator_DRAFT_API_DO_NOT_USE
# define uset_closeOver_4_2 uset_closeOver_DRAFT_API_DO_NOT_USE
# define uset_openEmpty_4_2 uset_openEmpty_DRAFT_API_DO_NOT_USE
# define uset_removeAllStrings_4_2 uset_removeAllStrings_DRAFT_API_DO_NOT_USE
# define uspoof_areConfusableUTF8_4_2 uspoof_areConfusableUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_areConfusable_4_2 uspoof_areConfusable_DRAFT_API_DO_NOT_USE
# define uspoof_checkUTF8_4_2 uspoof_checkUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_check_4_2 uspoof_check_DRAFT_API_DO_NOT_USE
# define uspoof_clone_4_2 uspoof_clone_DRAFT_API_DO_NOT_USE
# define uspoof_close_4_2 uspoof_close_DRAFT_API_DO_NOT_USE
# define uspoof_getAllowedChars_4_2 uspoof_getAllowedChars_DRAFT_API_DO_NOT_USE
# define uspoof_getAllowedLocales_4_2 uspoof_getAllowedLocales_DRAFT_API_DO_NOT_USE
# define uspoof_getChecks_4_2 uspoof_getChecks_DRAFT_API_DO_NOT_USE
# define uspoof_getSkeletonUTF8_4_2 uspoof_getSkeletonUTF8_DRAFT_API_DO_NOT_USE
# define uspoof_getSkeleton_4_2 uspoof_getSkeleton_DRAFT_API_DO_NOT_USE
# define uspoof_openFromSerialized_4_2 uspoof_openFromSerialized_DRAFT_API_DO_NOT_USE
# define uspoof_openFromSource_4_2 uspoof_openFromSource_DRAFT_API_DO_NOT_USE
# define uspoof_open_4_2 uspoof_open_DRAFT_API_DO_NOT_USE
# define uspoof_serialize_4_2 uspoof_serialize_DRAFT_API_DO_NOT_USE
# define uspoof_setAllowedChars_4_2 uspoof_setAllowedChars_DRAFT_API_DO_NOT_USE
# define uspoof_setAllowedLocales_4_2 uspoof_setAllowedLocales_DRAFT_API_DO_NOT_USE
# define uspoof_setChecks_4_2 uspoof_setChecks_DRAFT_API_DO_NOT_USE
# define usprep_openByType_4_2 usprep_openByType_DRAFT_API_DO_NOT_USE
# define bamuScriptCode_4_4 bamuScriptCode_DRAFT_API_DO_NOT_USE
# define u_fadopt_4_4 u_fadopt_DRAFT_API_DO_NOT_USE
# define u_strFromJavaModifiedUTF8WithSub_4_4 u_strFromJavaModifiedUTF8WithSub_DRAFT_API_DO_NOT_USE
# define u_strToJavaModifiedUTF8_4_4 u_strToJavaModifiedUTF8_DRAFT_API_DO_NOT_USE
# define ucal_getDayOfWeekType_4_4 ucal_getDayOfWeekType_DRAFT_API_DO_NOT_USE
# define ucal_getWeekendTransition_4_4 ucal_getWeekendTransition_DRAFT_API_DO_NOT_USE
# define ucal_isWeekend_4_4 ucal_isWeekend_DRAFT_API_DO_NOT_USE
# define udat_toCalendarDateField_4_4 udat_toCalendarDateField_DRAFT_API_DO_NOT_USE
# define udatpg_getBestPatternWithOptions_4_4 udatpg_getBestPatternWithOptions_DRAFT_API_DO_NOT_USE
# define udatpg_replaceFieldTypesWithOptions_4_4 udatpg_replaceFieldTypesWithOptions_DRAFT_API_DO_NOT_USE
# define uldn_close_4_4 uldn_close_DRAFT_API_DO_NOT_USE
# define uldn_getDialectHandling_4_4 uldn_getDialectHandling_DRAFT_API_DO_NOT_USE
# define uldn_getLocale_4_4 uldn_getLocale_DRAFT_API_DO_NOT_USE
# define uldn_keyDisplayName_4_4 uldn_keyDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_keyValueDisplayName_4_4 uldn_keyValueDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_languageDisplayName_4_4 uldn_languageDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_localeDisplayName_4_4 uldn_localeDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_open_4_4 uldn_open_DRAFT_API_DO_NOT_USE
# define uldn_regionDisplayName_4_4 uldn_regionDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_scriptCodeDisplayName_4_4 uldn_scriptCodeDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_scriptDisplayName_4_4 uldn_scriptDisplayName_DRAFT_API_DO_NOT_USE
# define uldn_variantDisplayName_4_4 uldn_variantDisplayName_DRAFT_API_DO_NOT_USE
# define uloc_forLanguageTag_4_4 uloc_forLanguageTag_DRAFT_API_DO_NOT_USE
# define uloc_toLanguageTag_4_4 uloc_toLanguageTag_DRAFT_API_DO_NOT_USE
# define unorm2_append_4_4 unorm2_append_DRAFT_API_DO_NOT_USE
# define unorm2_close_4_4 unorm2_close_DRAFT_API_DO_NOT_USE
# define unorm2_getInstance_4_4 unorm2_getInstance_DRAFT_API_DO_NOT_USE
# define unorm2_hasBoundaryAfter_4_4 unorm2_hasBoundaryAfter_DRAFT_API_DO_NOT_USE
# define unorm2_hasBoundaryBefore_4_4 unorm2_hasBoundaryBefore_DRAFT_API_DO_NOT_USE
# define unorm2_isInert_4_4 unorm2_isInert_DRAFT_API_DO_NOT_USE
# define unorm2_isNormalized_4_4 unorm2_isNormalized_DRAFT_API_DO_NOT_USE
# define unorm2_normalizeSecondAndAppend_4_4 unorm2_normalizeSecondAndAppend_DRAFT_API_DO_NOT_USE
# define unorm2_normalize_4_4 unorm2_normalize_DRAFT_API_DO_NOT_USE
# define unorm2_openFiltered_4_4 unorm2_openFiltered_DRAFT_API_DO_NOT_USE
# define unorm2_quickCheck_4_4 unorm2_quickCheck_DRAFT_API_DO_NOT_USE
# define unorm2_spanQuickCheckYes_4_4 unorm2_spanQuickCheckYes_DRAFT_API_DO_NOT_USE
# define unum_formatDecimal_4_4 unum_formatDecimal_DRAFT_API_DO_NOT_USE
# define unum_parseDecimal_4_4 unum_parseDecimal_DRAFT_API_DO_NOT_USE
# endif /* U_DISABLE_RENAMING */
#endif /* U_HIDE_DRAFT_API */
+22 -2
View File
@@ -18,8 +18,9 @@
#define __UENUM_H
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
#include "unicode/strenum.h"
#endif
@@ -47,6 +48,25 @@ typedef struct UEnumeration UEnumeration;
U_STABLE void U_EXPORT2
uenum_close(UEnumeration* en);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUEnumerationPointer
* "Smart pointer" class, closes a UEnumeration via uenum_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
U_NAMESPACE_END
#endif
/**
* Returns the number of elements that the iterator traverses. If
* the iterator is out-of-sync with its service, status is set to
@@ -135,7 +155,7 @@ uenum_next(UEnumeration* en,
U_STABLE void U_EXPORT2
uenum_reset(UEnumeration* en, UErrorCode* status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Given a StringEnumeration, wrap it in a UEnumeration. The
+3 -5
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2007, International Business Machines
* Copyright (C) 2003-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -76,8 +76,7 @@
* This function implements the ToASCII operation as defined in the IDNA RFC.
* This operation is done on <b>single labels</b> before sending it to something that expects
* ASCII names. A label is an individual part of a domain name. Labels are usually
* separated by dots; e.g." "www.example.com" is composed of 3 labels
* "www","example", and "com".
* separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
*
*
* @param src Input UChar array containing label in Unicode.
@@ -123,8 +122,7 @@ uidna_toASCII(const UChar* src, int32_t srcLength,
* This function implements the ToUnicode operation as defined in the IDNA RFC.
* This operation is done on <b>single labels</b> before sending it to something that expects
* Unicode names. A label is an individual part of a domain name. Labels are usually
* separated by dots; for e.g." "www.example.com" is composed of 3 labels
* "www","example", and "com".
* separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com".
*
* @param src Input UChar array containing ASCII (ACE encoded) label.
* @param srcLength Number of UChars in src, or -1 if NUL-terminated.
+154 -102
View File
@@ -1,10 +1,10 @@
/*
*******************************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name:
* file name: uintrnal.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -25,17 +25,12 @@
# if U_DISABLE_RENAMING
# define RegexPatternDump RegexPatternDump_INTERNAL_API_DO_NOT_USE
# define bms.h bms.h_INTERNAL_API_DO_NOT_USE
# define bms_close bms_close_INTERNAL_API_DO_NOT_USE
# define bms_empty bms_empty_INTERNAL_API_DO_NOT_USE
# define bms_getData bms_getData_INTERNAL_API_DO_NOT_USE
# define bms_open bms_open_INTERNAL_API_DO_NOT_USE
# define bms_search bms_search_INTERNAL_API_DO_NOT_USE
# define bms_setTargetString bms_setTargetString_INTERNAL_API_DO_NOT_USE
# define bmsearch.h bmsearch.h_INTERNAL_API_DO_NOT_USE
# define colldata.h colldata.h_INTERNAL_API_DO_NOT_USE
# define decimfmtAffixPatternValueComparator decimfmtAffixPatternValueComparator_INTERNAL_API_DO_NOT_USE
# define decimfmtAffixValueComparator decimfmtAffixValueComparator_INTERNAL_API_DO_NOT_USE
# define dtitvinfHashTableValueComparator dtitvinfHashTableValueComparator_INTERNAL_API_DO_NOT_USE
# define pl_addFontRun pl_addFontRun_INTERNAL_API_DO_NOT_USE
# define pl_addLocaleRun pl_addLocaleRun_INTERNAL_API_DO_NOT_USE
# define pl_addValueRun pl_addValueRun_INTERNAL_API_DO_NOT_USE
@@ -108,111 +103,168 @@
# define udat_applyPatternRelative udat_applyPatternRelative_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeDate udat_toPatternRelativeDate_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeTime udat_toPatternRelativeTime_INTERNAL_API_DO_NOT_USE
# define uplug_getConfiguration uplug_getConfiguration_INTERNAL_API_DO_NOT_USE
# define uplug_getContext uplug_getContext_INTERNAL_API_DO_NOT_USE
# define uplug_getCurrentLevel uplug_getCurrentLevel_INTERNAL_API_DO_NOT_USE
# define uplug_getLibrary uplug_getLibrary_INTERNAL_API_DO_NOT_USE
# define uplug_getLibraryName uplug_getLibraryName_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugLevel uplug_getPlugLevel_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugLoadStatus uplug_getPlugLoadStatus_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugName uplug_getPlugName_INTERNAL_API_DO_NOT_USE
# define uplug_getSymbolName uplug_getSymbolName_INTERNAL_API_DO_NOT_USE
# define uplug_loadPlugFromEntrypoint uplug_loadPlugFromEntrypoint_INTERNAL_API_DO_NOT_USE
# define uplug_loadPlugFromLibrary uplug_loadPlugFromLibrary_INTERNAL_API_DO_NOT_USE
# define uplug_nextPlug uplug_nextPlug_INTERNAL_API_DO_NOT_USE
# define uplug_removePlug uplug_removePlug_INTERNAL_API_DO_NOT_USE
# define uplug_setContext uplug_setContext_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugLevel uplug_setPlugLevel_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugName uplug_setPlugName_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugNoUnload uplug_setPlugNoUnload_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultCodepage uprv_getDefaultCodepage_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_INTERNAL_API_DO_NOT_USE
# define uregex_appendReplacementUText uregex_appendReplacementUText_INTERNAL_API_DO_NOT_USE
# define uregex_appendTailUText uregex_appendTailUText_INTERNAL_API_DO_NOT_USE
# define uregex_getUText uregex_getUText_INTERNAL_API_DO_NOT_USE
# define uregex_groupUText uregex_groupUText_INTERNAL_API_DO_NOT_USE
# define uregex_openUText uregex_openUText_INTERNAL_API_DO_NOT_USE
# define uregex_patternUText uregex_patternUText_INTERNAL_API_DO_NOT_USE
# define uregex_replaceAllUText uregex_replaceAllUText_INTERNAL_API_DO_NOT_USE
# define uregex_replaceFirstUText uregex_replaceFirstUText_INTERNAL_API_DO_NOT_USE
# define uregex_setUText uregex_setUText_INTERNAL_API_DO_NOT_USE
# define uregex_splitUText uregex_splitUText_INTERNAL_API_DO_NOT_USE
# define ures_openFillIn ures_openFillIn_INTERNAL_API_DO_NOT_USE
# define usearch_search usearch_search_INTERNAL_API_DO_NOT_USE
# define usearch_searchBackwards usearch_searchBackwards_INTERNAL_API_DO_NOT_USE
# define utext_caseCompare utext_caseCompare_INTERNAL_API_DO_NOT_USE
# define utext_caseCompareNativeLimit utext_caseCompareNativeLimit_INTERNAL_API_DO_NOT_USE
# define utext_compare utext_compare_INTERNAL_API_DO_NOT_USE
# define utext_compareNativeLimit utext_compareNativeLimit_INTERNAL_API_DO_NOT_USE
# define utf8_appendCharSafeBody utf8_appendCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_back1SafeBody utf8_back1SafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_countTrailBytes utf8_countTrailBytes_INTERNAL_API_DO_NOT_USE
# define utf8_nextCharSafeBody utf8_nextCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_prevCharSafeBody utf8_prevCharSafeBody_INTERNAL_API_DO_NOT_USE
# else
# define RegexPatternDump_4_2 RegexPatternDump_INTERNAL_API_DO_NOT_USE
# define bms.h_4_2 bms.h_INTERNAL_API_DO_NOT_USE
# define bms_empty_4_2 bms_empty_INTERNAL_API_DO_NOT_USE
# define bms_getData_4_2 bms_getData_INTERNAL_API_DO_NOT_USE
# define bms_open_4_2 bms_open_INTERNAL_API_DO_NOT_USE
# define bms_search_4_2 bms_search_INTERNAL_API_DO_NOT_USE
# define bms_setTargetString_4_2 bms_setTargetString_INTERNAL_API_DO_NOT_USE
# define bmsearch.h_4_2 bmsearch.h_INTERNAL_API_DO_NOT_USE
# define colldata.h_4_2 colldata.h_INTERNAL_API_DO_NOT_USE
# define decimfmtAffixPatternValueComparator_4_2 decimfmtAffixPatternValueComparator_INTERNAL_API_DO_NOT_USE
# define decimfmtAffixValueComparator_4_2 decimfmtAffixValueComparator_INTERNAL_API_DO_NOT_USE
# define dtitvinfHashTableValueComparator_4_2 dtitvinfHashTableValueComparator_INTERNAL_API_DO_NOT_USE
# define pl_addFontRun_4_2 pl_addFontRun_INTERNAL_API_DO_NOT_USE
# define pl_addLocaleRun_4_2 pl_addLocaleRun_INTERNAL_API_DO_NOT_USE
# define pl_addValueRun_4_2 pl_addValueRun_INTERNAL_API_DO_NOT_USE
# define pl_closeFontRuns_4_2 pl_closeFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_closeLine_4_2 pl_closeLine_INTERNAL_API_DO_NOT_USE
# define pl_closeLocaleRuns_4_2 pl_closeLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_closeValueRuns_4_2 pl_closeValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_close_4_2 pl_close_INTERNAL_API_DO_NOT_USE
# define pl_countLineRuns_4_2 pl_countLineRuns_INTERNAL_API_DO_NOT_USE
# define pl_create_4_2 pl_create_INTERNAL_API_DO_NOT_USE
# define pl_getAscent_4_2 pl_getAscent_INTERNAL_API_DO_NOT_USE
# define pl_getDescent_4_2 pl_getDescent_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunCount_4_2 pl_getFontRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunFont_4_2 pl_getFontRunFont_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunLastLimit_4_2 pl_getFontRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunLimit_4_2 pl_getFontRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLeading_4_2 pl_getLeading_INTERNAL_API_DO_NOT_USE
# define pl_getLineAscent_4_2 pl_getLineAscent_INTERNAL_API_DO_NOT_USE
# define pl_getLineDescent_4_2 pl_getLineDescent_INTERNAL_API_DO_NOT_USE
# define pl_getLineLeading_4_2 pl_getLineLeading_INTERNAL_API_DO_NOT_USE
# define pl_getLineVisualRun_4_2 pl_getLineVisualRun_INTERNAL_API_DO_NOT_USE
# define pl_getLineWidth_4_2 pl_getLineWidth_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunCount_4_2 pl_getLocaleRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLastLimit_4_2 pl_getLocaleRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLimit_4_2 pl_getLocaleRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLocale_4_2 pl_getLocaleRunLocale_INTERNAL_API_DO_NOT_USE
# define pl_getParagraphLevel_4_2 pl_getParagraphLevel_INTERNAL_API_DO_NOT_USE
# define pl_getTextDirection_4_2 pl_getTextDirection_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunCount_4_2 pl_getValueRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunLastLimit_4_2 pl_getValueRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunLimit_4_2 pl_getValueRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunValue_4_2 pl_getValueRunValue_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunAscent_4_2 pl_getVisualRunAscent_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunDescent_4_2 pl_getVisualRunDescent_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunDirection_4_2 pl_getVisualRunDirection_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunFont_4_2 pl_getVisualRunFont_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphCount_4_2 pl_getVisualRunGlyphCount_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphToCharMap_4_2 pl_getVisualRunGlyphToCharMap_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphs_4_2 pl_getVisualRunGlyphs_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunLeading_4_2 pl_getVisualRunLeading_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunPositions_4_2 pl_getVisualRunPositions_INTERNAL_API_DO_NOT_USE
# define pl_isComplex_4_2 pl_isComplex_INTERNAL_API_DO_NOT_USE
# define pl_line_4_2 pl_line_INTERNAL_API_DO_NOT_USE
# define pl_nextLine_4_2 pl_nextLine_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyFontRuns_4_2 pl_openEmptyFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyLocaleRuns_4_2 pl_openEmptyLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyValueRuns_4_2 pl_openEmptyValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_openFontRuns_4_2 pl_openFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_openLocaleRuns_4_2 pl_openLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_openValueRuns_4_2 pl_openValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_paragraph_4_2 pl_paragraph_INTERNAL_API_DO_NOT_USE
# define pl_reflow_4_2 pl_reflow_INTERNAL_API_DO_NOT_USE
# define pl_resetFontRuns_4_2 pl_resetFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_resetLocaleRuns_4_2 pl_resetLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_resetValueRuns_4_2 pl_resetValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_visualRun_4_2 pl_visualRun_INTERNAL_API_DO_NOT_USE
# define ucd_close_4_2 ucd_close_INTERNAL_API_DO_NOT_USE
# define ucd_flushCache_4_2 ucd_flushCache_INTERNAL_API_DO_NOT_USE
# define ucd_freeCache_4_2 ucd_freeCache_INTERNAL_API_DO_NOT_USE
# define ucd_getCollator_4_2 ucd_getCollator_INTERNAL_API_DO_NOT_USE
# define ucd_open_4_2 ucd_open_INTERNAL_API_DO_NOT_USE
# define ucol_equals_4_2 ucol_equals_INTERNAL_API_DO_NOT_USE
# define ucol_forceHanImplicit_4_2 ucol_forceHanImplicit_INTERNAL_API_DO_NOT_USE
# define ucol_forgetUCA_4_2 ucol_forgetUCA_INTERNAL_API_DO_NOT_USE
# define ucol_getAttributeOrDefault_4_2 ucol_getAttributeOrDefault_INTERNAL_API_DO_NOT_USE
# define ucol_getUnsafeSet_4_2 ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE
# define ucol_nextProcessed_4_2 ucol_nextProcessed_INTERNAL_API_DO_NOT_USE
# define ucol_prepareShortStringOpen_4_2 ucol_prepareShortStringOpen_INTERNAL_API_DO_NOT_USE
# define ucol_previousProcessed_4_2 ucol_previousProcessed_INTERNAL_API_DO_NOT_USE
# define udat_applyPatternRelative_4_2 udat_applyPatternRelative_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeDate_4_2 udat_toPatternRelativeDate_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeTime_4_2 udat_toPatternRelativeTime_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultCodepage_4_2 uprv_getDefaultCodepage_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultLocaleID_4_2 uprv_getDefaultLocaleID_INTERNAL_API_DO_NOT_USE
# define ures_openFillIn_4_2 ures_openFillIn_INTERNAL_API_DO_NOT_USE
# define usearch_searchBackwards_4_2 usearch_searchBackwards_INTERNAL_API_DO_NOT_USE
# define usearch_search_4_2 usearch_search_INTERNAL_API_DO_NOT_USE
# define utf8_appendCharSafeBody_4_2 utf8_appendCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_back1SafeBody_4_2 utf8_back1SafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_countTrailBytes_4_2 utf8_countTrailBytes_INTERNAL_API_DO_NOT_USE
# define utf8_nextCharSafeBody_4_2 utf8_nextCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_prevCharSafeBody_4_2 utf8_prevCharSafeBody_INTERNAL_API_DO_NOT_USE
# define RegexPatternDump_4_4 RegexPatternDump_INTERNAL_API_DO_NOT_USE
# define bms_close_4_4 bms_close_INTERNAL_API_DO_NOT_USE
# define bms_empty_4_4 bms_empty_INTERNAL_API_DO_NOT_USE
# define bms_getData_4_4 bms_getData_INTERNAL_API_DO_NOT_USE
# define bms_open_4_4 bms_open_INTERNAL_API_DO_NOT_USE
# define bms_search_4_4 bms_search_INTERNAL_API_DO_NOT_USE
# define bms_setTargetString_4_4 bms_setTargetString_INTERNAL_API_DO_NOT_USE
# define pl_addFontRun_4_4 pl_addFontRun_INTERNAL_API_DO_NOT_USE
# define pl_addLocaleRun_4_4 pl_addLocaleRun_INTERNAL_API_DO_NOT_USE
# define pl_addValueRun_4_4 pl_addValueRun_INTERNAL_API_DO_NOT_USE
# define pl_closeFontRuns_4_4 pl_closeFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_closeLine_4_4 pl_closeLine_INTERNAL_API_DO_NOT_USE
# define pl_closeLocaleRuns_4_4 pl_closeLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_closeValueRuns_4_4 pl_closeValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_close_4_4 pl_close_INTERNAL_API_DO_NOT_USE
# define pl_countLineRuns_4_4 pl_countLineRuns_INTERNAL_API_DO_NOT_USE
# define pl_create_4_4 pl_create_INTERNAL_API_DO_NOT_USE
# define pl_getAscent_4_4 pl_getAscent_INTERNAL_API_DO_NOT_USE
# define pl_getDescent_4_4 pl_getDescent_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunCount_4_4 pl_getFontRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunFont_4_4 pl_getFontRunFont_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunLastLimit_4_4 pl_getFontRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getFontRunLimit_4_4 pl_getFontRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLeading_4_4 pl_getLeading_INTERNAL_API_DO_NOT_USE
# define pl_getLineAscent_4_4 pl_getLineAscent_INTERNAL_API_DO_NOT_USE
# define pl_getLineDescent_4_4 pl_getLineDescent_INTERNAL_API_DO_NOT_USE
# define pl_getLineLeading_4_4 pl_getLineLeading_INTERNAL_API_DO_NOT_USE
# define pl_getLineVisualRun_4_4 pl_getLineVisualRun_INTERNAL_API_DO_NOT_USE
# define pl_getLineWidth_4_4 pl_getLineWidth_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunCount_4_4 pl_getLocaleRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLastLimit_4_4 pl_getLocaleRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLimit_4_4 pl_getLocaleRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getLocaleRunLocale_4_4 pl_getLocaleRunLocale_INTERNAL_API_DO_NOT_USE
# define pl_getParagraphLevel_4_4 pl_getParagraphLevel_INTERNAL_API_DO_NOT_USE
# define pl_getTextDirection_4_4 pl_getTextDirection_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunCount_4_4 pl_getValueRunCount_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunLastLimit_4_4 pl_getValueRunLastLimit_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunLimit_4_4 pl_getValueRunLimit_INTERNAL_API_DO_NOT_USE
# define pl_getValueRunValue_4_4 pl_getValueRunValue_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunAscent_4_4 pl_getVisualRunAscent_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunDescent_4_4 pl_getVisualRunDescent_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunDirection_4_4 pl_getVisualRunDirection_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunFont_4_4 pl_getVisualRunFont_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphCount_4_4 pl_getVisualRunGlyphCount_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphToCharMap_4_4 pl_getVisualRunGlyphToCharMap_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunGlyphs_4_4 pl_getVisualRunGlyphs_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunLeading_4_4 pl_getVisualRunLeading_INTERNAL_API_DO_NOT_USE
# define pl_getVisualRunPositions_4_4 pl_getVisualRunPositions_INTERNAL_API_DO_NOT_USE
# define pl_isComplex_4_4 pl_isComplex_INTERNAL_API_DO_NOT_USE
# define pl_line_4_4 pl_line_INTERNAL_API_DO_NOT_USE
# define pl_nextLine_4_4 pl_nextLine_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyFontRuns_4_4 pl_openEmptyFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyLocaleRuns_4_4 pl_openEmptyLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_openEmptyValueRuns_4_4 pl_openEmptyValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_openFontRuns_4_4 pl_openFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_openLocaleRuns_4_4 pl_openLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_openValueRuns_4_4 pl_openValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_paragraph_4_4 pl_paragraph_INTERNAL_API_DO_NOT_USE
# define pl_reflow_4_4 pl_reflow_INTERNAL_API_DO_NOT_USE
# define pl_resetFontRuns_4_4 pl_resetFontRuns_INTERNAL_API_DO_NOT_USE
# define pl_resetLocaleRuns_4_4 pl_resetLocaleRuns_INTERNAL_API_DO_NOT_USE
# define pl_resetValueRuns_4_4 pl_resetValueRuns_INTERNAL_API_DO_NOT_USE
# define pl_visualRun_4_4 pl_visualRun_INTERNAL_API_DO_NOT_USE
# define ucd_close_4_4 ucd_close_INTERNAL_API_DO_NOT_USE
# define ucd_flushCache_4_4 ucd_flushCache_INTERNAL_API_DO_NOT_USE
# define ucd_freeCache_4_4 ucd_freeCache_INTERNAL_API_DO_NOT_USE
# define ucd_getCollator_4_4 ucd_getCollator_INTERNAL_API_DO_NOT_USE
# define ucd_open_4_4 ucd_open_INTERNAL_API_DO_NOT_USE
# define ucol_equals_4_4 ucol_equals_INTERNAL_API_DO_NOT_USE
# define ucol_forceHanImplicit_4_4 ucol_forceHanImplicit_INTERNAL_API_DO_NOT_USE
# define ucol_forgetUCA_4_4 ucol_forgetUCA_INTERNAL_API_DO_NOT_USE
# define ucol_getAttributeOrDefault_4_4 ucol_getAttributeOrDefault_INTERNAL_API_DO_NOT_USE
# define ucol_getUnsafeSet_4_4 ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE
# define ucol_nextProcessed_4_4 ucol_nextProcessed_INTERNAL_API_DO_NOT_USE
# define ucol_prepareShortStringOpen_4_4 ucol_prepareShortStringOpen_INTERNAL_API_DO_NOT_USE
# define ucol_previousProcessed_4_4 ucol_previousProcessed_INTERNAL_API_DO_NOT_USE
# define udat_applyPatternRelative_4_4 udat_applyPatternRelative_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeDate_4_4 udat_toPatternRelativeDate_INTERNAL_API_DO_NOT_USE
# define udat_toPatternRelativeTime_4_4 udat_toPatternRelativeTime_INTERNAL_API_DO_NOT_USE
# define uplug_getConfiguration_4_4 uplug_getConfiguration_INTERNAL_API_DO_NOT_USE
# define uplug_getContext_4_4 uplug_getContext_INTERNAL_API_DO_NOT_USE
# define uplug_getCurrentLevel_4_4 uplug_getCurrentLevel_INTERNAL_API_DO_NOT_USE
# define uplug_getLibraryName_4_4 uplug_getLibraryName_INTERNAL_API_DO_NOT_USE
# define uplug_getLibrary_4_4 uplug_getLibrary_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugLevel_4_4 uplug_getPlugLevel_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugLoadStatus_4_4 uplug_getPlugLoadStatus_INTERNAL_API_DO_NOT_USE
# define uplug_getPlugName_4_4 uplug_getPlugName_INTERNAL_API_DO_NOT_USE
# define uplug_getSymbolName_4_4 uplug_getSymbolName_INTERNAL_API_DO_NOT_USE
# define uplug_loadPlugFromEntrypoint_4_4 uplug_loadPlugFromEntrypoint_INTERNAL_API_DO_NOT_USE
# define uplug_loadPlugFromLibrary_4_4 uplug_loadPlugFromLibrary_INTERNAL_API_DO_NOT_USE
# define uplug_nextPlug_4_4 uplug_nextPlug_INTERNAL_API_DO_NOT_USE
# define uplug_removePlug_4_4 uplug_removePlug_INTERNAL_API_DO_NOT_USE
# define uplug_setContext_4_4 uplug_setContext_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugLevel_4_4 uplug_setPlugLevel_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugName_4_4 uplug_setPlugName_INTERNAL_API_DO_NOT_USE
# define uplug_setPlugNoUnload_4_4 uplug_setPlugNoUnload_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultCodepage_4_4 uprv_getDefaultCodepage_INTERNAL_API_DO_NOT_USE
# define uprv_getDefaultLocaleID_4_4 uprv_getDefaultLocaleID_INTERNAL_API_DO_NOT_USE
# define uregex_appendReplacementUText_4_4 uregex_appendReplacementUText_INTERNAL_API_DO_NOT_USE
# define uregex_appendTailUText_4_4 uregex_appendTailUText_INTERNAL_API_DO_NOT_USE
# define uregex_getUText_4_4 uregex_getUText_INTERNAL_API_DO_NOT_USE
# define uregex_groupUText_4_4 uregex_groupUText_INTERNAL_API_DO_NOT_USE
# define uregex_openUText_4_4 uregex_openUText_INTERNAL_API_DO_NOT_USE
# define uregex_patternUText_4_4 uregex_patternUText_INTERNAL_API_DO_NOT_USE
# define uregex_replaceAllUText_4_4 uregex_replaceAllUText_INTERNAL_API_DO_NOT_USE
# define uregex_replaceFirstUText_4_4 uregex_replaceFirstUText_INTERNAL_API_DO_NOT_USE
# define uregex_setUText_4_4 uregex_setUText_INTERNAL_API_DO_NOT_USE
# define uregex_splitUText_4_4 uregex_splitUText_INTERNAL_API_DO_NOT_USE
# define ures_openFillIn_4_4 ures_openFillIn_INTERNAL_API_DO_NOT_USE
# define usearch_searchBackwards_4_4 usearch_searchBackwards_INTERNAL_API_DO_NOT_USE
# define usearch_search_4_4 usearch_search_INTERNAL_API_DO_NOT_USE
# define utext_caseCompareNativeLimit_4_4 utext_caseCompareNativeLimit_INTERNAL_API_DO_NOT_USE
# define utext_caseCompare_4_4 utext_caseCompare_INTERNAL_API_DO_NOT_USE
# define utext_compareNativeLimit_4_4 utext_compareNativeLimit_INTERNAL_API_DO_NOT_USE
# define utext_compare_4_4 utext_compare_INTERNAL_API_DO_NOT_USE
# define utf8_appendCharSafeBody_4_4 utf8_appendCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_back1SafeBody_4_4 utf8_back1SafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_countTrailBytes_4_4 utf8_countTrailBytes_INTERNAL_API_DO_NOT_USE
# define utf8_nextCharSafeBody_4_4 utf8_nextCharSafeBody_INTERNAL_API_DO_NOT_USE
# define utf8_prevCharSafeBody_4_4 utf8_prevCharSafeBody_INTERNAL_API_DO_NOT_USE
# endif /* U_DISABLE_RENAMING */
#endif /* U_HIDE_INTERNAL_API */
+3 -3
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2002-2006, International Business Machines
* Copyright (C) 2002-2006,2009 International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -26,7 +26,7 @@
#include "unicode/utypes.h"
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
class CharacterIterator;
@@ -650,7 +650,7 @@ uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
U_STABLE void U_EXPORT2
uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Set up a UCharIterator to wrap around a C++ CharacterIterator.
+270
View File
@@ -0,0 +1,270 @@
/*
*******************************************************************************
* Copyright (C) 2010, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
#ifndef __ULDNAMES_H__
#define __ULDNAMES_H__
/**
* \file
* \brief C++ API: Provides display names of Locale ids and their components.
*/
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
#include "unicode/uscript.h"
/**
* Enum used in LocaleDisplayNames::createInstance.
* @draft ICU 4.4
*/
typedef enum {
/**
* Use standard names when generating a locale name,
* e.g. en_GB displays as 'English (United Kingdom)'.
* @draft ICU 4.4
*/
ULDN_STANDARD_NAMES = 0,
/**
* Use dialect names, when generating a locale name,
* e.g. en_GB displays as 'British English'.
* @draft ICU 4.4
*/
ULDN_DIALECT_NAMES
} UDialectHandling;
/**
* Opaque C service object type for the locale display names API
* @draft ICU 4.4
*/
struct ULocaleDisplayNames;
/**
* C typedef for struct ULocaleDisplayNames.
* @draft ICU 4.4
*/
typedef struct ULocaleDisplayNames ULocaleDisplayNames;
#if !UCONFIG_NO_FORMATTING
/**
* Returns an instance of LocaleDisplayNames that returns names
* formatted for the provided locale, using the provided
* dialectHandling. The usual value for dialectHandling is
* ULOC_STANDARD_NAMES.
*
* @param locale the display locale
* @param dialectHandling how to select names for locales
* @return a ULocaleDisplayNames instance
* @param pErrorCode the status code
* @draft ICU 4.4
*/
U_DRAFT ULocaleDisplayNames * U_EXPORT2
uldn_open(const char * locale,
UDialectHandling dialectHandling,
UErrorCode *pErrorCode);
/**
* Closes a ULocaleDisplayNames instance obtained from uldn_open().
* @param ldn the ULocaleDisplayNames instance to be closed
* @draft ICU 4.4
*/
U_DRAFT void U_EXPORT2
uldn_close(ULocaleDisplayNames *ldn);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalULocaleDisplayNamesPointer
* "Smart pointer" class, closes a ULocaleDisplayNames via uldn_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close);
U_NAMESPACE_END
#endif
/* getters for state */
/**
* Returns the locale used to determine the display names. This is
* not necessarily the same locale passed to {@link #uldn_open}.
* @param ldn the LocaleDisplayNames instance
* @return the display locale
* @draft ICU 4.4
*/
U_DRAFT const char * U_EXPORT2
uldn_getLocale(const ULocaleDisplayNames *ldn);
/**
* Returns the dialect handling used in the display names.
* @param ldn the LocaleDisplayNames instance
* @return the dialect handling enum
* @draft ICU 4.4
*/
U_DRAFT UDialectHandling U_EXPORT2
uldn_getDialectHandling(const ULocaleDisplayNames *ldn);
/* names for entire locales */
/**
* Returns the display name of the provided locale.
* @param ldn the LocaleDisplayNames instance
* @param locale the locale whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
const char *locale,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/* names for components of a locale */
/**
* Returns the display name of the provided language code.
* @param ldn the LocaleDisplayNames instance
* @param lang the language code whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
const char *lang,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided script.
* @param ldn the LocaleDisplayNames instance
* @param script the script whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
const char *script,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided script code.
* @param ldn the LocaleDisplayNames instance
* @param scriptCode the script code whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
UScriptCode scriptCode,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided region code.
* @param ldn the LocaleDisplayNames instance
* @param region the region code whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
const char *region,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided variant
* @param ldn the LocaleDisplayNames instance
* @param variant the variant whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
const char *variant,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided locale key
* @param ldn the LocaleDisplayNames instance
* @param key the locale key whose display name to return
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
/**
* Returns the display name of the provided value (used with the provided key).
* @param ldn the LocaleDisplayNames instance
* @param key the locale key
* @param value the locale key's value
* @param result receives the display name
* @param maxResultSize the size of the result buffer
* @param pErrorCode the status code
* @return the actual buffer size needed for the display name. If it's
* greater than maxResultSize, the returned name will be truncated.
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
const char *value,
UChar *result,
int32_t maxResultSize,
UErrorCode *pErrorCode);
#endif /* !UCONFIG_NO_FORMATTING */
#endif /* __ULDNAMES_H__ */
+6 -6
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1997-2009, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -876,7 +876,7 @@ typedef enum {
* @return an enum indicating the layout orientation for characters.
* @stable ICU 4.0
*/
U_DRAFT ULayoutType U_EXPORT2
U_STABLE ULayoutType U_EXPORT2
uloc_getCharacterOrientation(const char* localeId,
UErrorCode *status);
@@ -888,7 +888,7 @@ uloc_getCharacterOrientation(const char* localeId,
* @return an enum indicating the layout orientation for lines.
* @stable ICU 4.0
*/
U_DRAFT ULayoutType U_EXPORT2
U_STABLE ULayoutType U_EXPORT2
uloc_getLineOrientation(const char* localeId,
UErrorCode *status);
@@ -959,7 +959,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
* @return actual the actual size of the locale ID, not including NUL-termination
* @stable ICU 3.8
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
UErrorCode *status);
@@ -997,7 +997,7 @@ uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
* On error, the return value is -1.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uloc_addLikelySubtags(const char* localeID,
char* maximizedLocaleID,
int32_t maximizedLocaleIDCapacity,
@@ -1037,7 +1037,7 @@ uloc_addLikelySubtags(const char* localeID,
* On error, the return value is -1.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uloc_minimizeSubtags(const char* localeID,
char* minimizedLocaleID,
int32_t minimizedLocaleIDCapacity,
+27 -7
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
* *
* Copyright (C) 2003-2009, International Business Machines *
* Copyright (C) 2003-2010, International Business Machines *
* Corporation and others. All Rights Reserved. *
* *
******************************************************************************
@@ -20,6 +20,7 @@
#include "unicode/ures.h"
#include "unicode/uloc.h"
#include "unicode/uset.h"
#include "unicode/localpointer.h"
/**
* \file
@@ -74,6 +75,25 @@ ulocdata_open(const char *localeID, UErrorCode *status);
U_STABLE void U_EXPORT2
ulocdata_close(ULocaleData *uld);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalULocaleDataPointer
* "Smart pointer" class, closes a ULocaleData via ulocdata_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close);
U_NAMESPACE_END
#endif
/**
* Sets the "no Substitute" attribute of the locale data
* object. If true, then any methods associated with the
@@ -193,9 +213,9 @@ ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UEr
* Return the current CLDR version used by the library.
* @param versionArray fillin that will recieve the version number
* @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status);
/**
@@ -211,9 +231,9 @@ ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status);
* @return the actual buffer size needed for localeDisplayPattern. If it's greater
* than patternCapacity, the returned pattern will be truncated.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
UChar *pattern,
int32_t patternCapacity,
@@ -233,9 +253,9 @@ ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
* @return the actual buffer size needed for localeSeparator. If it's greater
* than separatorCapacity, the returned separator will be truncated.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ulocdata_getLocaleSeparator(ULocaleData *uld,
UChar *separator,
int32_t separatorCapacity,
+23 -6
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2008, International Business Machines
* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -44,9 +44,12 @@
#if defined(U_PALMOS)
# include "unicode/ppalmos.h"
#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
#ifdef CYGWINMSVC
# include "unicode/platform.h"
#endif
# include "unicode/pwin32.h"
#else
# include "unicode/platform.h"
# include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
#endif
/*
@@ -102,10 +105,18 @@
# define U_CDECL_END
#endif
/** This is used for GCC specific attributes*/
/**
* \def U_ATTRIBUTE_DEPRECATED
* This is used for GCC specific attributes
* @internal
*/
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
/** This is used for Visual C++ specific attributes */
/**
* \def U_ATTRIBUTE_DEPRECATED
* This is used for Visual C++ specific attributes
* @internal
*/
#elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
# define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
#else
@@ -284,17 +295,23 @@ typedef int8_t UBool;
/**
* \var UChar
* Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
* If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
* If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4
* can handle UTF16 string literals.
* This makes the definition of UChar platform-dependent
* but allows direct string type compatibility with platforms with
* 16-bit wchar_t types.
*
* @stable ICU 2.0
* @draft ICU 4.4
*/
/* Define UChar to be compatible with wchar_t if possible. */
#if U_SIZEOF_WCHAR_T==2
typedef wchar_t UChar;
#elif U_GNUC_UTF16_STRING
#if defined _GCC_
typedef __CHAR16_TYPE__ char16_t;
#endif
typedef char16_t UChar;
#else
typedef uint16_t UChar;
#endif
+81 -19
View File
@@ -1,20 +1,20 @@
/*
*******************************************************************************
* 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.
*
*
*/
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation and
* others. All Rights Reserved.
* Copyright (C) 2010 , Yahoo! Inc.
********************************************************************
*
* 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
@@ -23,6 +23,7 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/localpointer.h"
#include "unicode/uloc.h"
#include "unicode/parseerr.h"
#include <stdarg.h>
@@ -87,8 +88,8 @@
* 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);
* 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;
@@ -105,6 +106,45 @@
* \endcode
* </pre>
*
*
* Example 3:
* <pre>
* \code
* UChar* str;
* UChar* str1;
* UErrorCode status = U_ZERO_ERROR;
* UChar *result;
* UChar pattern[100];
* UChar expected[100];
* int32_t resultlength,resultLengthOut;
* str=(UChar*)malloc(sizeof(UChar) * 25);
* u_uastrcpy(str, "Kirti");
* str1=(UChar*)malloc(sizeof(UChar) * 25);
* u_uastrcpy(str1, "female");
* log_verbose("Testing message format with Select test #1\n:");
* u_uastrcpy(pattern, "{0} est {1, select, female {all\\u00E9e} other {all\\u00E9}} \\u00E0 Paris.");
* u_uastrcpy(expected, "Kirti est all\\u00E9e \\u00E0 Paris.");
* resultlength=0;
* resultLengthOut=u_formatMessage( "fr", pattern, u_strlen(pattern), NULL, resultlength, &status, str , str1);
* if(status==U_BUFFER_OVERFLOW_ERROR)
* {
* status=U_ZERO_ERROR;
* resultlength=resultLengthOut+1;
* result=(UChar*)malloc(sizeof(UChar) * resultlength);
* u_formatMessage( "fr", pattern, u_strlen(pattern), result, resultlength, &status, str , str1);
* if(u_strcmp(result, expected)==0)
* log_verbose("PASS: MessagFormat successful on Select test#1\n");
* else{
* log_err("FAIL: Error in MessageFormat on Select test#1\n GOT %s EXPECTED %s\n", austrdup(result),
* austrdup(expected) );
* }
* free(result);
* }
* \endcode
* </pre>
*
* The pattern is of the following form. Legend:
* <pre>
* \code
@@ -124,6 +164,7 @@
* | "date" { "," datetimeStyle }
* | "number" { "," numberStyle }
* | "choice" "," choiceStyle
* | "select" "," selectStyle
*
* datetimeStyle := "short"
* | "medium"
@@ -137,6 +178,8 @@
* | numberFormatPattern
*
* choiceStyle := choiceFormatPattern
*
* selectStyle := selectFormatPattern
* \endcode
* </pre>
* If there is no elementFormat, then the argument must be a string,
@@ -453,6 +496,25 @@ umsg_open( const UChar *pattern,
U_STABLE void U_EXPORT2
umsg_close(UMessageFormat* format);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUMessageFormatPointer
* "Smart pointer" class, closes a UMessageFormat via umsg_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUMessageFormatPointer, UMessageFormat, umsg_close);
U_NAMESPACE_END
#endif
/**
* Open a copy of a UMessageFormat.
* This function performs a deep copy.
+56 -7
View File
@@ -1,6 +1,6 @@
/*
***************************************************************************
* Copyright (C) 1999-2009, International Business Machines Corporation
* Copyright (C) 1999-2010, International Business Machines Corporation
* and others. All Rights Reserved.
***************************************************************************
* Date Name Description
@@ -476,7 +476,7 @@ public:
* @param uset a USet (the ICU plain C type for UnicodeSet)
* @return the corresponding UnicodeSet pointer.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
inline static UnicodeSet *fromUSet(USet *uset);
@@ -486,7 +486,7 @@ public:
* @param uset a const USet (the ICU plain C type for UnicodeSet)
* @return the corresponding UnicodeSet pointer.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
inline static const UnicodeSet *fromUSet(const USet *uset);
@@ -495,7 +495,7 @@ public:
* USet is the plain C type for UnicodeSet
*
* @return a USet pointer for this UnicodeSet
* @draft ICU 4.2
* @stable ICU 4.2
*/
inline USet *toUSet();
@@ -505,7 +505,7 @@ public:
* USet is the plain C type for UnicodeSet
*
* @return a const USet pointer for this UnicodeSet
* @draft ICU 4.2
* @stable ICU 4.2
*/
inline const USet * toUSet() const;
@@ -861,6 +861,20 @@ public:
*/
int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const;
/**
* Returns the end of the substring of the input string according to the USetSpanCondition.
* Same as <code>start+span(s.getBuffer()+start, s.length()-start, spanCondition)</code>
* after pinning start to 0<=start<=s.length().
* @param s the string
* @param start the start index in the string for the span operation
* @param spanCondition specifies the containment condition
* @return the exclusive end of the substring according to the spanCondition;
* the substring s.tempSubStringBetween(start, end) fulfills the spanCondition
* @draft ICU 4.4
* @see USetSpanCondition
*/
inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const;
/**
* Returns the start of the trailing substring of the input string which
* consists only of characters and strings that are contained in this set
@@ -880,6 +894,21 @@ public:
*/
int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const;
/**
* Returns the start of the substring of the input string according to the USetSpanCondition.
* Same as <code>spanBack(s.getBuffer(), limit, spanCondition)</code>
* after pinning limit to 0<=end<=s.length().
* @param s the string
* @param limit the exclusive-end index in the string for the span operation
* (use s.length() or INT32_MAX for spanning back from the end of the string)
* @param spanCondition specifies the containment condition
* @return the start of the substring according to the spanCondition;
* the substring s.tempSubStringBetween(start, limit) fulfills the spanCondition
* @draft ICU 4.4
* @see USetSpanCondition
*/
inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const;
/**
* Returns the length of the initial substring of the input string which
* consists only of characters and strings that are contained in this set
@@ -1293,7 +1322,7 @@ public:
* Currently only the USET_CASE bit is supported. Any undefined bits
* are ignored.
* @return a reference to this set.
* @draft ICU 4.2
* @stable ICU 4.2
*/
UnicodeSet& closeOver(int32_t attribute);
@@ -1301,7 +1330,7 @@ public:
* Remove all strings from this set.
*
* @return a reference to this set.
* @draft ICU 4.2
* @stable ICU 4.2
*/
virtual UnicodeSet &removeAllStrings();
@@ -1619,6 +1648,26 @@ inline const USet *UnicodeSet::toUSet() const {
return reinterpret_cast<const USet *>(this);
}
inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const {
int32_t sLength=s.length();
if(start<0) {
start=0;
} else if(start>sLength) {
start=sLength;
}
return start+span(s.getBuffer()+start, sLength-start, spanCondition);
}
inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const {
int32_t sLength=s.length();
if(limit<0) {
limit=0;
} else if(limit>sLength) {
limit=sLength;
}
return spanBack(s.getBuffer(), limit, spanCondition);
}
U_NAMESPACE_END
#endif
+99 -26
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1998-2009, International Business Machines
* Copyright (C) 1998-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -1566,6 +1566,33 @@ public:
#endif
/**
* Create a temporary substring for the specified range.
* Unlike the substring constructor and setTo() functions,
* the object returned here will be a read-only alias (using getBuffer())
* rather than copying the text.
* As a result, this substring operation is much faster but requires
* that the original string not be modified or deleted during the lifetime
* of the returned substring object.
* @param start offset of the first character visible in the substring
* @param length length of the substring
* @return a read-only alias UnicodeString object for the substring
* @draft ICU 4.4
*/
UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const;
/**
* Create a temporary substring for the specified range.
* Same as tempSubString(start, length) except that the substring range
* is specified as a (start, limit) pair (with an exclusive limit index)
* rather than a (start, length) pair.
* @param start offset of the first character visible in the substring
* @param limit offset immediately following the last character visible in the substring
* @return a read-only alias UnicodeString object for the substring
* @draft ICU 4.4
*/
inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const;
/**
* Convert the UnicodeString to UTF-8 and write the result
* to a ByteSink. This is called by toUTF8String().
@@ -1573,7 +1600,7 @@ public:
* Calls u_strToUTF8WithSub().
*
* @param sink A ByteSink to which the UTF-8 version of the string is written.
* @draft ICU 4.2
* @stable ICU 4.2
* @see toUTF8String
*/
void toUTF8(ByteSink &sink) const;
@@ -1586,10 +1613,10 @@ public:
* Unpaired surrogates are replaced with U+FFFD.
* Calls toUTF8().
*
* @param A standard string (or a compatible object)
* @param result A standard string (or a compatible object)
* to which the UTF-8 version of the string is appended.
* @return The string object.
* @draft ICU 4.2
* @stable ICU 4.2
* @see toUTF8
*/
template<typename StringClass>
@@ -1614,7 +1641,7 @@ public:
* function chaining. (See User Guide for details.)
* @return The length of the UTF-32 string.
* @see fromUTF32
* @draft ICU 4.2
* @stable ICU 4.2
*/
int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const;
@@ -1701,9 +1728,10 @@ public:
/**
* Determine if this object contains a valid string.
* A bogus string has no value. It is different from an empty string.
* It can be used to indicate that no string value is available.
* getBuffer() and getTerminatedBuffer() return NULL, and
* A bogus string has no value. It is different from an empty string,
* although in both cases isEmpty() returns TRUE and length() returns 0.
* setToBogus() and isBogus() can be used to indicate that no string value is available.
* For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and
* length() returns 0.
*
* @return TRUE if the string is valid, FALSE otherwise
@@ -2396,6 +2424,16 @@ public:
inline UnicodeString& removeBetween(int32_t start,
int32_t limit = (int32_t)INT32_MAX);
/**
* Retain only the characters in the range
* [<code>start</code>, <code>limit</code>) from the UnicodeString object.
* Removes characters before <code>start</code> and at and after <code>limit</code>.
* @param start the offset of the first character to retain
* @param limit the offset immediately following the range to retain
* @return a reference to this
* @draft ICU 4.4
*/
inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX);
/* Length operations */
@@ -3012,7 +3050,7 @@ public:
* @return A UnicodeString with equivalent UTF-16 contents.
* @see toUTF8
* @see toUTF8String
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UnicodeString fromUTF8(const StringPiece &utf8);
@@ -3025,7 +3063,7 @@ public:
* @param length Length of the input string, or -1 if NUL-terminated.
* @return A UnicodeString with equivalent UTF-16 contents.
* @see toUTF32
* @draft ICU 4.2
* @stable ICU 4.2
*/
static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length);
@@ -3045,7 +3083,7 @@ public:
*
* \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
* \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
* \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
* \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
*
* Anything else following a backslash is generically escaped. For
* example, "[a\\-z]" returns "[a-z]".
@@ -3242,7 +3280,6 @@ private:
// None of the following does releaseArray().
inline void setLength(int32_t len); // sets only fShortLength and fLength
inline void setToEmpty(); // sets fFlags=kShortString
inline void setToStackBuffer(int32_t len); // sets fFlags=kShortString
inline void setArray(UChar *array, int32_t len, int32_t capacity); // does not set fFlags
// allocate the array; result may be fStackBuffer
@@ -4048,7 +4085,13 @@ UnicodeString::extract(int32_t start,
{
// This dstSize value will be checked explicitly
#if defined(__GNUC__)
// Ticket #7039: Clip length to the maximum valid length to the end of addressable memory given the starting address
// This is only an issue when using GCC and certain optimizations are turned on.
return extract(start, _length, dst, dst!=0 ? ((dst >= (char*)((size_t)-1) - UINT32_MAX) ? (((char*)UINT32_MAX) - dst) : UINT32_MAX) : 0, codepage);
#else
return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
#endif
}
#endif
@@ -4063,6 +4106,11 @@ UnicodeString::extractBetween(int32_t start,
doExtract(start, limit - start, dst, dstStart);
}
inline UnicodeString
UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const {
return tempSubString(start, limit - start);
}
inline UChar
UnicodeString::doCharAt(int32_t offset) const
{
@@ -4142,12 +4190,6 @@ UnicodeString::setToEmpty() {
fFlags = kShortString;
}
inline void
UnicodeString::setToStackBuffer(int32_t len) {
fShortLength = (int8_t)len;
fFlags = kShortString;
}
inline void
UnicodeString::setArray(UChar *array, int32_t len, int32_t capacity) {
setLength(len);
@@ -4162,12 +4204,32 @@ UnicodeString::getTerminatedBuffer() {
} else {
UChar *array = getArrayStart();
int32_t len = length();
#ifndef U_VALGRIND
if(len < getCapacity() && array[len] == 0) {
if(len < getCapacity() && ((fFlags&kRefCounted) == 0 || refCount() == 1)) {
/*
* kRefCounted: Do not write the NUL if the buffer is shared.
* That is mostly safe, except when the length of one copy was modified
* without copy-on-write, e.g., via truncate(newLength) or remove(void).
* Then the NUL would be written into the middle of another copy's string.
*/
if(!(fFlags&kBufferIsReadonly)) {
/*
* We must not write to a readonly buffer, but it is known to be
* NUL-terminated if len<capacity.
* A shared, allocated buffer (refCount()>1) must not have its contents
* modified, but the NUL at [len] is beyond the string contents,
* and multiple string objects and threads writing the same NUL into the
* same location is harmless.
* In all other cases, the buffer is fully writable and it is anyway safe
* to write the NUL.
*
* Note: An earlier version of this code tested whether there is a NUL
* at [len] already, but, while safe, it generated lots of warnings from
* tools like valgrind and Purify.
*/
array[len] = 0;
}
return array;
}
#endif
if(cloneArrayIfNeeded(len+1)) {
} else if(cloneArrayIfNeeded(len+1)) {
array = getArrayStart();
array[len] = 0;
return array;
@@ -4319,10 +4381,12 @@ inline UnicodeString&
UnicodeString::remove()
{
// remove() of a bogus string makes the string empty and non-bogus
if(isBogus()) {
unBogus();
// we also un-alias a read-only alias to deal with NUL-termination
// issues with getTerminatedBuffer()
if(fFlags & (kIsBogus|kBufferIsReadonly)) {
setToEmpty();
} else {
setLength(0);
fShortLength = 0;
}
return *this;
}
@@ -4343,6 +4407,12 @@ UnicodeString::removeBetween(int32_t start,
int32_t limit)
{ return doReplace(start, limit - start, NULL, 0, 0); }
inline UnicodeString &
UnicodeString::retainBetween(int32_t start, int32_t limit) {
truncate(limit);
return doReplace(0, start, NULL, 0, 0);
}
inline UBool
UnicodeString::truncate(int32_t targetLength)
{
@@ -4352,6 +4422,9 @@ UnicodeString::truncate(int32_t targetLength)
return FALSE;
} else if((uint32_t)targetLength < (uint32_t)length()) {
setLength(targetLength);
if(fFlags&kBufferIsReadonly) {
fUnion.fFields.fCapacity = targetLength; // not NUL-terminated any more
}
return TRUE;
} else {
return FALSE;
+8 -23
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (c) 1996-2007, International Business Machines Corporation
* Copyright (c) 1996-2010, International Business Machines Corporation
* and others. All Rights Reserved.
*******************************************************************************
* File unorm.h
@@ -20,6 +20,7 @@
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uiter.h"
#include "unicode/unorm2.h"
/**
* \file
@@ -27,6 +28,11 @@
*
* <h2>Unicode normalization API</h2>
*
* Note: This API has been replaced by the unorm2.h API and is only available
* for backward compatibility. The functions here simply delegate to the
* unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize().
* There is one exception: The new API does not provide a replacement for unorm_compare().
*
* <code>unorm_normalize</code> transforms Unicode text into an equivalent composed or
* decomposed form, allowing for easier sorting and searching of text.
* <code>unorm_normalize</code> supports the standard normalization forms described in
@@ -202,28 +208,7 @@ unorm_normalize(const UChar *source, int32_t sourceLength,
UNormalizationMode mode, int32_t options,
UChar *result, int32_t resultLength,
UErrorCode *status);
#endif
/**
* Result values for unorm_quickCheck().
* For details see Unicode Technical Report 15.
* @stable ICU 2.0
*/
typedef enum UNormalizationCheckResult {
/**
* Indicates that string is not in the normalized format
*/
UNORM_NO,
/**
* Indicates that string is in the normalized format
*/
UNORM_YES,
/**
* Indicates that string cannot be determined if it is in the normalized
* format without further thorough checks.
*/
UNORM_MAYBE
} UNormalizationCheckResult;
#if !UCONFIG_NO_NORMALIZATION
/**
* Performing quick check on a string, to quickly determine if the string is
* in a particular normalization format.
+370
View File
@@ -0,0 +1,370 @@
/*
*******************************************************************************
*
* Copyright (C) 2009-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: unorm2.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2009dec15
* created by: Markus W. Scherer
*/
#ifndef __UNORM2_H__
#define __UNORM2_H__
/**
* \file
* \brief C API: New API for Unicode Normalization.
*
* Unicode normalization functionality for standard Unicode normalization or
* for using custom mapping tables.
* All instances of UNormalizer2 are unmodifiable/immutable.
* Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller.
* For more details see the Normalizer2 C++ class.
*/
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
#include "unicode/uset.h"
/**
* Constants for normalization modes.
* For details about standard Unicode normalization forms
* and about the algorithms which are also used with custom mapping tables
* see http://www.unicode.org/unicode/reports/tr15/
* @draft ICU 4.4
*/
typedef enum {
/**
* Decomposition followed by composition.
* Same as standard NFC when using an "nfc" instance.
* Same as standard NFKC when using an "nfkc" instance.
* For details about standard Unicode normalization forms
* see http://www.unicode.org/unicode/reports/tr15/
* @draft ICU 4.4
*/
UNORM2_COMPOSE,
/**
* Map, and reorder canonically.
* Same as standard NFD when using an "nfc" instance.
* Same as standard NFKD when using an "nfkc" instance.
* For details about standard Unicode normalization forms
* see http://www.unicode.org/unicode/reports/tr15/
* @draft ICU 4.4
*/
UNORM2_DECOMPOSE,
/**
* "Fast C or D" form.
* If a string is in this form, then further decomposition <i>without reordering</i>
* would yield the same form as DECOMPOSE.
* Text in "Fast C or D" form can be processed efficiently with data tables
* that are "canonically closed", that is, that provide equivalent data for
* equivalent text, without having to be fully normalized.
* Not a standard Unicode normalization form.
* Not a unique form: Different FCD strings can be canonically equivalent.
* For details see http://www.unicode.org/notes/tn5/#FCD
* @draft ICU 4.4
*/
UNORM2_FCD,
/**
* Compose only contiguously.
* Also known as "FCC" or "Fast C Contiguous".
* The result will often but not always be in NFC.
* The result will conform to FCD which is useful for processing.
* Not a standard Unicode normalization form.
* For details see http://www.unicode.org/notes/tn5/#FCC
* @draft ICU 4.4
*/
UNORM2_COMPOSE_CONTIGUOUS
} UNormalization2Mode;
/**
* Result values for normalization quick check functions.
* For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
* @stable ICU 2.0
*/
typedef enum UNormalizationCheckResult {
/**
* The input string is not in the normalization form.
* @stable ICU 2.0
*/
UNORM_NO,
/**
* The input string is in the normalization form.
* @stable ICU 2.0
*/
UNORM_YES,
/**
* The input string may or may not be in the normalization form.
* This value is only returned for composition forms like NFC and FCC,
* when a backward-combining character is found for which the surrounding text
* would have to be analyzed further.
* @stable ICU 2.0
*/
UNORM_MAYBE
} UNormalizationCheckResult;
/**
* Opaque C service object type for the new normalization API.
* @draft ICU 4.4
*/
struct UNormalizer2;
typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer2. @draft ICU 4.4 */
#if !UCONFIG_NO_NORMALIZATION
/**
* Returns a UNormalizer2 instance which uses the specified data file
* (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle)
* and which composes or decomposes text according to the specified mode.
* Returns an unmodifiable singleton instance. Do not delete it.
*
* Use packageName=NULL for data files that are part of ICU's own data.
* Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
* Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
* Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
*
* @param packageName NULL for ICU built-in data, otherwise application data package name
* @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
* @param mode normalization mode (compose or decompose etc.)
* @param pErrorCode 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 requested UNormalizer2, if successful
* @draft ICU 4.4
*/
U_DRAFT const UNormalizer2 * U_EXPORT2
unorm2_getInstance(const char *packageName,
const char *name,
UNormalization2Mode mode,
UErrorCode *pErrorCode);
/**
* Constructs a filtered normalizer wrapping any UNormalizer2 instance
* and a filter set.
* Both are aliased and must not be modified or deleted while this object
* is used.
* The filter set should be frozen; otherwise the performance will suffer greatly.
* @param norm2 wrapped Normalizer2 instance
* @param filterSet USet which determines the characters to be normalized
* @param pErrorCode 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 requested UNormalizer2, if successful
* @draft ICU 4.4
*/
U_DRAFT UNormalizer2 * U_EXPORT2
unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
/**
* Closes a UNormalizer2 instance from unorm2_openFiltered().
* Do not close instances from unorm2_getInstance()!
* @param norm2 UNormalizer2 instance to be closed
* @draft ICU 4.4
*/
U_DRAFT void U_EXPORT2
unorm2_close(UNormalizer2 *norm2);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUNormalizer2Pointer
* "Smart pointer" class, closes a UNormalizer2 via unorm2_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
U_NAMESPACE_END
#endif
/**
* Writes the normalized form of the source string to the destination string
* (replacing its contents) and returns the length of the destination string.
* The source and destination strings must be different buffers.
* @param norm2 UNormalizer2 instance
* @param src source string
* @param length length of the source string, or -1 if NUL-terminated
* @param dest destination string; its contents is replaced with normalized src
* @param capacity number of UChars that can be written to dest
* @param pErrorCode 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 dest
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unorm2_normalize(const UNormalizer2 *norm2,
const UChar *src, int32_t length,
UChar *dest, int32_t capacity,
UErrorCode *pErrorCode);
/**
* Appends the normalized form of the second string to the first string
* (merging them at the boundary) and returns the length of the first string.
* The result is normalized if the first string was normalized.
* The first and second strings must be different buffers.
* @param norm2 UNormalizer2 instance
* @param first string, should be normalized
* @param firstLength length of the first string, or -1 if NUL-terminated
* @param firstCapacity number of UChars that can be written to first
* @param second string, will be normalized
* @param secondLength length of the source string, or -1 if NUL-terminated
* @param pErrorCode 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 first
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
UChar *first, int32_t firstLength, int32_t firstCapacity,
const UChar *second, int32_t secondLength,
UErrorCode *pErrorCode);
/**
* Appends the second string to the first string
* (merging them at the boundary) and returns the length of the first string.
* The result is normalized if both the strings were normalized.
* The first and second strings must be different buffers.
* @param norm2 UNormalizer2 instance
* @param first string, should be normalized
* @param firstLength length of the first string, or -1 if NUL-terminated
* @param firstCapacity number of UChars that can be written to first
* @param second string, should be normalized
* @param secondLength length of the source string, or -1 if NUL-terminated
* @param pErrorCode 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 first
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unorm2_append(const UNormalizer2 *norm2,
UChar *first, int32_t firstLength, int32_t firstCapacity,
const UChar *second, int32_t secondLength,
UErrorCode *pErrorCode);
/**
* Tests if the string is normalized.
* Internally, in cases where the quickCheck() method would return "maybe"
* (which is only possible for the two COMPOSE modes) this method
* resolves to "yes" or "no" to provide a definitive result,
* at the cost of doing more work in those cases.
* @param norm2 UNormalizer2 instance
* @param s input string
* @param length length of the string, or -1 if NUL-terminated
* @param pErrorCode 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 TRUE if s is normalized
* @draft ICU 4.4
*/
U_DRAFT UBool U_EXPORT2
unorm2_isNormalized(const UNormalizer2 *norm2,
const UChar *s, int32_t length,
UErrorCode *pErrorCode);
/**
* Tests if the string is normalized.
* For the two COMPOSE modes, the result could be "maybe" in cases that
* would take a little more work to resolve definitively.
* Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster
* combination of quick check + normalization, to avoid
* re-checking the "yes" prefix.
* @param norm2 UNormalizer2 instance
* @param s input string
* @param length length of the string, or -1 if NUL-terminated
* @param pErrorCode 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 UNormalizationCheckResult
* @draft ICU 4.4
*/
U_DRAFT UNormalizationCheckResult U_EXPORT2
unorm2_quickCheck(const UNormalizer2 *norm2,
const UChar *s, int32_t length,
UErrorCode *pErrorCode);
/**
* Returns the end of the normalized substring of the input string.
* In other words, with <code>end=spanQuickCheckYes(s, ec);</code>
* the substring <code>UnicodeString(s, 0, end)</code>
* will pass the quick check with a "yes" result.
*
* The returned end index is usually one or more characters before the
* "no" or "maybe" character: The end index is at a normalization boundary.
* (See the class documentation for more about normalization boundaries.)
*
* When the goal is a normalized string and most input strings are expected
* to be normalized already, then call this method,
* and if it returns a prefix shorter than the input string,
* copy that prefix and use normalizeSecondAndAppend() for the remainder.
* @param norm2 UNormalizer2 instance
* @param s input string
* @param length length of the string, or -1 if NUL-terminated
* @param pErrorCode 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 "yes" span end index
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
const UChar *s, int32_t length,
UErrorCode *pErrorCode);
/**
* Tests if the character always has a normalization boundary before it,
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param norm2 UNormalizer2 instance
* @param c character to test
* @return TRUE if c has a normalization boundary before it
* @draft ICU 4.4
*/
U_DRAFT UBool U_EXPORT2
unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
/**
* Tests if the character always has a normalization boundary after it,
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param norm2 UNormalizer2 instance
* @param c character to test
* @return TRUE if c has a normalization boundary after it
* @draft ICU 4.4
*/
U_DRAFT UBool U_EXPORT2
unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
/**
* Tests if the character is normalization-inert.
* For details see the Normalizer2 base class documentation.
* @param norm2 UNormalizer2 instance
* @param c character to test
* @return TRUE if c is normalization-inert
* @draft ICU 4.4
*/
U_DRAFT UBool U_EXPORT2
unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
#endif /* !UCONFIG_NO_NORMALIZATION */
#endif /* __UNORM2_H__ */
+90 -1
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2009, International Business Machines Corporation and others.
* Copyright (C) 1997-2010, International Business Machines Corporation and others.
* All Rights Reserved.
* Modification History:
*
@@ -16,6 +16,7 @@
#if !UCONFIG_NO_FORMATTING
#include "unicode/localpointer.h"
#include "unicode/uloc.h"
#include "unicode/umisc.h"
#include "unicode/parseerr.h"
@@ -254,6 +255,25 @@ unum_open( UNumberFormatStyle style,
U_STABLE void U_EXPORT2
unum_close(UNumberFormat* fmt);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUNumberFormatPointer
* "Smart pointer" class, closes a UNumberFormat via unum_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close);
U_NAMESPACE_END
#endif
/**
* Open a copy of a UNumberFormat.
* This function performs a deep copy.
@@ -353,6 +373,40 @@ unum_formatDouble( const UNumberFormat* fmt,
UFieldPosition *pos, /* 0 if ignore */
UErrorCode* status);
/**
* Format a decimal number using a UNumberFormat.
* The number will be formatted according to the UNumberFormat's locale.
* The syntax of the input number is a "numeric string"
* as defined in the Decimal Arithmetic Specification, available at
* http://speleotrove.com/decimal
* @param fmt The formatter to use.
* @param number The number to format.
* @param length The length of the input number, or -1 if the input is nul-terminated.
* @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 it is ignored.
* @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
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unum_formatDecimal( const UNumberFormat* fmt,
const char * number,
int32_t length,
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.
@@ -455,6 +509,41 @@ unum_parseDouble( const UNumberFormat* fmt,
int32_t *parsePos /* 0 = start */,
UErrorCode *status);
/**
* Parse a number from a string into an unformatted numeric string using a UNumberFormat.
* The input string will be parsed according to the UNumberFormat's locale.
* The syntax of the output is a "numeric string"
* as defined in the Decimal Arithmetic Specification, available at
* http://speleotrove.com/decimal
* @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 outBuf A (char *) buffer to receive the parsed number as a string. The output string
* will be nul-terminated if there is sufficient space.
* @param outBufLength The size of the output buffer. May be zero, in which case
* the outBuf pointer may be NULL, and the function will return the
* size of the output string.
* @param status A pointer to an UErrorCode to receive any errors
* @return the length of the output string, not including any terminating nul.
* @see unum_parse
* @see unum_parseInt64
* @see unum_format
* @see unum_formatInt64
* @see unum_formatDouble
* @draft ICU 4.4
*/
U_DRAFT int32_t U_EXPORT2
unum_parseDecimal(const UNumberFormat* fmt,
const UChar* text,
int32_t textLength,
int32_t *parsePos /* 0 = start */,
char *outBuf,
int32_t outBufLength,
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.
+5 -2
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 2002-2009, International Business Machines
* Copyright (C) 2002-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -64,9 +64,10 @@ U_NAMESPACE_BEGIN
#endif
/**
* @{
* \def U_NO_THROW
* Define this to define the throw() specification so
certain functions do not throw any exceptions
* certain functions do not throw any exceptions
*
* UMemory operator new methods should have the throw() specification
* appended to them, so that the compiler adds the additional NULL check
@@ -80,6 +81,8 @@ U_NAMESPACE_BEGIN
#define U_NO_THROW throw()
#endif
/** @} */
/**
* UMemory is the common ICU base class.
* All other ICU C++ classes are derived from UMemory (starting with ICU 2.4).
+2 -2
View File
@@ -1,10 +1,10 @@
/*
*******************************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name:
* file name: uobslete.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
+304 -32
View File
@@ -1,9 +1,9 @@
/*
**********************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: regex.h
* file name: uregex.h
* encoding: US-ASCII
* indentation:4
*
@@ -23,10 +23,12 @@
#ifndef UREGEX_H
#define UREGEX_H
#include "unicode/utext.h"
#include "unicode/utypes.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "unicode/localpointer.h"
#include "unicode/parseerr.h"
struct URegularExpression;
@@ -62,7 +64,7 @@ typedef enum URegexpFlag{
/** If set, treat the entire pattern as a literal string.
* Metacharacters or escape sequences in the input sequence will be given
* no special meaning.
* no special meaning. Not implemented yet as of ICU 4.4.
*
* The flags CASE_INSENSITIVE and UNICODE_CASE retain their impact
* on matching when used in conjunction with this flag.
@@ -111,6 +113,7 @@ typedef enum URegexpFlag{
* 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
@@ -133,7 +136,36 @@ uregex_open( const UChar *pattern,
uint32_t flags,
UParseError *pe,
UErrorCode *status);
/**
* 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.
* <p>
* The contents of the pattern UText will be extracted and saved. Ownership of the
* UText struct itself remains with the caller. This is to match the behavior of
* uregex_open().
*
* @param pattern The Regular Expression pattern to be compiled.
* @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.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL URegularExpression * U_EXPORT2
uregex_openUText(UText *pattern,
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.
@@ -177,6 +209,25 @@ uregex_openC( const char *pattern,
U_STABLE void U_EXPORT2
uregex_close(URegularExpression *regexp);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalURegularExpressionPointer
* "Smart pointer" class, closes a URegularExpression via uregex_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close);
U_NAMESPACE_END
#endif
/**
* Make a copy of a compiled regular expression. Cloning a regular
* expression is faster than opening a second instance from the source
@@ -199,7 +250,8 @@ 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.
* Returns a pointer to the source form of the pattern for this regular expression.
* This function will work even if the pattern was originally specified as a UText.
*
* @param regexp The compiled regular expression.
* @param patLength This output parameter will be set to the length of the
@@ -215,9 +267,24 @@ uregex_clone(const URegularExpression *regexp, UErrorCode *status);
* @stable ICU 3.0
*/
U_STABLE const UChar * U_EXPORT2
uregex_pattern(const URegularExpression *regexp,
int32_t *patLength,
UErrorCode *status);
uregex_pattern(const URegularExpression *regexp,
int32_t *patLength,
UErrorCode *status);
/**
* Returns the source text of the pattern for this regular expression.
* This function will work even if the pattern was originally specified as a UChar string.
*
* @param regexp The compiled regular expression.
* @param status Receives errors detected by this function.
* @return the pattern text. The storage for the text is owned by the regular expression
* object, and must not be altered or deleted.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_patternUText(const URegularExpression *regexp,
UErrorCode *status);
/**
@@ -259,10 +326,36 @@ uregex_setText(URegularExpression *regexp,
int32_t textLength,
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; only a shallow clone 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.
*
* @param regexp The compiled regular expression.
* @param text The subject text string.
* @param status Receives errors detected by this function.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL void U_EXPORT2
uregex_setUText(URegularExpression *regexp,
UText *text,
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().
* regular expression object. If the input was supplied using uregex_setText(),
* that pointer will be returned. Otherwise, the characters in the input will
* be extracted to a buffer and returned. In either case, ownership remains
* with the regular expression object.
*
* This function will work even if the input was originally specified as a UText.
*
* @param regexp The compiled regular expression.
* @param textLength The length of the string is returned in this output parameter.
@@ -271,7 +364,7 @@ uregex_setText(URegularExpression *regexp,
* 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
* @return Pointer to the subject text string currently associated with
* this regular expression.
* @stable ICU 3.0
*/
@@ -279,6 +372,28 @@ U_STABLE const UChar * U_EXPORT2
uregex_getText(URegularExpression *regexp,
int32_t *textLength,
UErrorCode *status);
/**
* Get the subject text that is currently associated with this
* regular expression object.
*
* This function will work even if the input was originally specified as a UChar string.
*
* @param regexp The compiled regular expression.
* @param dest A mutable UText in which to store the current input.
* If NULL, a new UText will be created as an immutable shallow clone
* of the actual input string.
* @param status Receives errors detected by this function.
* @return The subject text currently associated with this regular expression.
* If a pre-allocated UText was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_getUText(URegularExpression *regexp,
UText *dest,
UErrorCode *status);
/**
* Attempts to match the input string against the pattern.
@@ -408,6 +523,29 @@ uregex_group(URegularExpression *regexp,
int32_t destCapacity,
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 Mutable UText to receive the matching string data.
* If NULL, a new UText will be created (which may not be mutable).
* @param status A reference to a UErrorCode to receive any errors.
* @return The matching string data. If a pre-allocated UText was provided,
* it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_groupUText(URegularExpression *regexp,
int32_t groupNum,
UText *dest,
UErrorCode *status);
/**
* Returns the index in the input string of the start of the text matched by the
@@ -484,7 +622,7 @@ uregex_reset(URegularExpression *regexp,
* @param status A pointer to a UErrorCode to receive any errors.
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_setRegion(URegularExpression *regexp,
int32_t regionStart,
int32_t regionLimit,
@@ -499,7 +637,7 @@ uregex_setRegion(URegularExpression *regexp,
* @return The starting index of this matcher's region.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uregex_regionStart(const URegularExpression *regexp,
UErrorCode *status);
@@ -515,7 +653,7 @@ uregex_regionStart(const URegularExpression *regexp,
* @return The ending point of this matcher's region.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uregex_regionEnd(const URegularExpression *regexp,
UErrorCode *status);
@@ -529,7 +667,7 @@ uregex_regionEnd(const URegularExpression *regexp,
* @return TRUE if this matcher is using opaque bounds, false if it is not.
* @stable ICU 4.0
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
uregex_hasTransparentBounds(const URegularExpression *regexp,
UErrorCode *status);
@@ -553,7 +691,7 @@ uregex_hasTransparentBounds(const URegularExpression *regexp,
* @param status A pointer to a UErrorCode to receive any errors.
* @stable ICU 4.0
**/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_useTransparentBounds(URegularExpression *regexp,
UBool b,
UErrorCode *status);
@@ -568,7 +706,7 @@ uregex_useTransparentBounds(URegularExpression *regexp,
* @return TRUE if this matcher is using anchoring bounds.
* @stable ICU 4.0
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
uregex_hasAnchoringBounds(const URegularExpression *regexp,
UErrorCode *status);
@@ -586,7 +724,7 @@ uregex_hasAnchoringBounds(const URegularExpression *regexp,
* @param status A pointer to a UErrorCode to receive any errors.
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_useAnchoringBounds(URegularExpression *regexp,
UBool b,
UErrorCode *status);
@@ -601,7 +739,7 @@ uregex_useAnchoringBounds(URegularExpression *regexp,
* @return TRUE if the most recent match hit the end of input
* @stable ICU 4.0
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
uregex_hitEnd(const URegularExpression *regexp,
UErrorCode *status);
@@ -616,7 +754,7 @@ uregex_hitEnd(const URegularExpression *regexp,
* @return TRUE if more input could cause the most recent match to no longer match.
* @stable ICU 4.0
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
uregex_requireEnd(const URegularExpression *regexp,
UErrorCode *status);
@@ -656,6 +794,32 @@ uregex_replaceAll(URegularExpression *regexp,
int32_t destCapacity,
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 replacement A string containing the replacement text.
* @param dest A mutable UText that will receive the result.
* If NULL, a new UText will be created (which may not be mutable).
* @param status A reference to a UErrorCode to receive any errors.
* @return A UText containing the results of the find and replace.
* If a pre-allocated UText was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_replaceAllUText(URegularExpression *regexp,
UText *replacement,
UText *dest,
UErrorCode *status);
/**
* Replaces the first substring of the input that matches the pattern
@@ -689,6 +853,33 @@ uregex_replaceFirst(URegularExpression *regexp,
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 replacement A string containing the replacement text.
* @param dest A mutable UText that will receive the result.
* If NULL, a new UText will be created (which may not be mutable).
* @param status A reference to a UErrorCode to receive any errors.
* @return A UText containing the results of the find and replace.
* If a pre-allocated UText was provided, it will always be used and returned.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_replaceFirstUText(URegularExpression *regexp,
UText *replacement,
UText *dest,
UErrorCode *status);
/**
* Implements a replace operation intended to be used as part of an
@@ -738,11 +929,40 @@ uregex_replaceFirst(URegularExpression *regexp,
*/
U_STABLE int32_t U_EXPORT2
uregex_appendReplacement(URegularExpression *regexp,
const UChar *replacementText,
int32_t replacementLength,
UChar **destBuf,
int32_t *destCapacity,
UErrorCode *status);
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>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 dest A mutable UText that will receive the result. Must not be NULL.
* @param status A reference to a UErrorCode to receive any errors.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL void U_EXPORT2
uregex_appendReplacementUText(URegularExpression *regexp,
UText *replacementText,
UText *dest,
UErrorCode *status);
/**
@@ -774,7 +994,26 @@ uregex_appendTail(URegularExpression *regexp,
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_appendTailUText()</code> is intended
* to be invoked after one or more invocations of the
* <code>uregex_appendReplacementUText()</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 dest A mutable UText that will receive the result. Must not be NULL.
* @return The destination UText.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL UText * U_EXPORT2
uregex_appendTailUText(URegularExpression *regexp,
UText *dest);
@@ -785,7 +1024,7 @@ uregex_appendTail(URegularExpression *regexp,
* 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
* buffer, and 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
@@ -842,6 +1081,39 @@ uregex_split( URegularExpression *regexp,
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>
* The behavior of this function is not very closely aligned with uregex_split();
* instead, it is based on (and implemented directly on top of) the C++ split method.
*
* @param regexp The compiled regular expression.
* @param destFields An array of mutable UText structs to receive the results of the split.
* If a field is NULL, a new UText is allocated to contain the results for
* that field. This new UText is not guaranteed to be mutable.
* @param destFieldsCapacity 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.
* 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.
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL int32_t U_EXPORT2
uregex_splitUText(URegularExpression *regexp,
UText *destFields[],
int32_t destFieldsCapacity,
UErrorCode *status);
/**
@@ -866,7 +1138,7 @@ uregex_split( URegularExpression *regexp,
* @param status A reference to a UErrorCode to receive any errors.
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_setTimeLimit(URegularExpression *regexp,
int32_t limit,
UErrorCode *status);
@@ -880,7 +1152,7 @@ uregex_setTimeLimit(URegularExpression *regexp,
* @return the maximum allowed time for a match, in units of processing steps.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uregex_getTimeLimit(const URegularExpression *regexp,
UErrorCode *status);
@@ -904,7 +1176,7 @@ uregex_getTimeLimit(const URegularExpression *regexp,
*
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_setStackLimit(URegularExpression *regexp,
int32_t limit,
UErrorCode *status);
@@ -916,7 +1188,7 @@ uregex_setStackLimit(URegularExpression *regexp,
* stack size is unlimited.
* @stable ICU 4.0
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uregex_getStackLimit(const URegularExpression *regexp,
UErrorCode *status);
@@ -959,7 +1231,7 @@ U_CDECL_END
* @param status A reference to a UErrorCode to receive any errors.
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_setMatchCallback(URegularExpression *regexp,
URegexMatchCallback *callback,
const void *context,
@@ -977,7 +1249,7 @@ uregex_setMatchCallback(URegularExpression *regexp,
* @param status A reference to a UErrorCode to receive any errors.
* @stable ICU 4.0
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uregex_getMatchCallback(const URegularExpression *regexp,
URegexMatchCallback **callback,
const void **context,
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1997-2005, International Business Machines
* Copyright (C) 1997-2010, International Business Machines
* Corporation and others. All Rights Reserved.
******************************************************************************
* Date Name Description
@@ -30,7 +30,7 @@ U_CDECL_BEGIN
********************************************************************/
/**
* \file
* \brief C API: Callbacks for UReplacebale
* \brief C API: Callbacks for UReplaceable
*/
/**
* An opaque replaceable text object. This will be manipulated only
+23 -15
View File
@@ -25,6 +25,7 @@
#include "unicode/utypes.h"
#include "unicode/uloc.h"
#include "unicode/localpointer.h"
/**
* \file
@@ -82,18 +83,6 @@ typedef enum {
*/
URES_ALIAS=3,
#ifndef U_HIDE_INTERNAL_API
/**
* Internal use only.
* Alternative resource type constant for tables of key-value pairs.
* Never returned by ures_getType().
* @internal
*/
URES_TABLE32=4,
#endif /* U_HIDE_INTERNAL_API */
/**
* Resource type constant for a single 28-bit integer, interpreted as
* signed or unsigned by the ures_getInt() or ures_getUInt() function.
@@ -250,6 +239,25 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
U_STABLE void U_EXPORT2
ures_close(UResourceBundle* resourceBundle);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUResourceBundlePointer
* "Smart pointer" class, closes a UResourceBundle via ures_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
U_NAMESPACE_END
#endif
/**
* Return the version number associated with this ResourceBundle as a string. Please
* use ures_getVersion as this function is going to be deprecated.
@@ -418,7 +426,7 @@ ures_getUTF8String(const UResourceBundle *resB,
* Always check the value of status. Don't count on returning NULL.
* could be a non-failing error
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
* @return a pointer to a chuck of unsigned bytes which live in a memory mapped/DLL file.
* @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file.
* @see ures_getString
* @see ures_getIntVector
* @see ures_getInt
@@ -440,7 +448,7 @@ ures_getBinary(const UResourceBundle* resourceBundle,
* Always check the value of status. Don't count on returning NULL.
* could be a non-failing error
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
* @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file.
* @return a pointer to a chunk of integers which live in a memory mapped/DLL file.
* @see ures_getBinary
* @see ures_getString
* @see ures_getInt
@@ -768,7 +776,7 @@ ures_getUTF8StringByKey(const UResourceBundle *resB,
UBool forceCopy,
UErrorCode *status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
+9 -3
View File
@@ -46,7 +46,7 @@
typedef enum UScriptCode {
USCRIPT_INVALID_CODE = -1,
USCRIPT_COMMON = 0 , /* Zyyy */
USCRIPT_INHERITED = 1, /* Qaai */
USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */
USCRIPT_ARABIC = 2, /* Arab */
USCRIPT_ARMENIAN = 3, /* Armn */
USCRIPT_BENGALI = 4, /* Beng */
@@ -156,7 +156,7 @@ typedef enum UScriptCode {
USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */
USCRIPT_TENGWAR = 98, /* Teng */
USCRIPT_VAI = 99, /* Vaii */
USCRIPT_VISIBLE_SPEECH = 100, /* Visp */
USCRIPT_VISIBLE_SPEECH = 100,/* Visp */
USCRIPT_CUNEIFORM = 101,/* Xsux */
USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */
USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
@@ -191,8 +191,14 @@ typedef enum UScriptCode {
USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */
USCRIPT_SYMBOLS = 129,/* Zsym */
/* New script codes from ISO 15924 @draft ICU 4.4 */
USCRIPT_BAMUM = 130,/* Bamu */
USCRIPT_LISU = 131,/* Lisu */
USCRIPT_NAKHI_GEBA = 132,/* Nkgb */
USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */
/* Private use codes from Qaaa - Qabx are not supported*/
USCRIPT_CODE_LIMIT = 130
USCRIPT_CODE_LIMIT = 134
} UScriptCode;
/**
+70 -7
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2001-2008 IBM and others. All rights reserved.
* Copyright (C) 2001-2010 IBM and others. All rights reserved.
**********************************************************************
* Date Name Description
* 06/28/2001 synwee Creation.
@@ -13,6 +13,7 @@
#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION
#include "unicode/localpointer.h"
#include "unicode/ucol.h"
#include "unicode/ucoleitr.h"
#include "unicode/ubrk.h"
@@ -156,10 +157,17 @@ typedef enum {
/** Option for overlapping matches */
USEARCH_OVERLAP,
/**
Option for canonical matches. option 1 in header documentation.
The default value will be USEARCH_OFF
*/
* Option for canonical matches. option 1 in header documentation.
* The default value will be USEARCH_OFF
*/
USEARCH_CANONICAL_MATCH,
/**
* Option to control how collation elements are compared.
* The default value will be USEARCH_STANDARD_ELEMENT_COMPARISON.
* @draft ICU 4.4
*/
USEARCH_ELEMENT_COMPARISON,
USEARCH_ATTRIBUTE_COUNT
} USearchAttribute;
@@ -167,12 +175,48 @@ typedef enum {
* @stable ICU 2.4
*/
typedef enum {
/** default value for any USearchAttribute */
/** Default value for any USearchAttribute */
USEARCH_DEFAULT = -1,
/** value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
/** Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
USEARCH_OFF,
/** value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
/** Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH */
USEARCH_ON,
/**
* Value (default) for USEARCH_ELEMENT_COMPARISON;
* standard collation element comparison at the specified collator
* strength.
* @draft ICU 4.4
*/
USEARCH_STANDARD_ELEMENT_COMPARISON,
/**
* Value for USEARCH_ELEMENT_COMPARISON;
* collation element comparison is modified to effectively provide
* behavior between the specified strength and strength - 1. Collation
* elements in the pattern that have the base weight for the specified
* strength are treated as "wildcards" that match an element with any
* other weight at that collation level in the searched text. For
* example, with a secondary-strength English collator, a plain 'e' in
* the pattern will match a plain e or an e with any diacritic in the
* searched text, but an e with diacritic in the pattern will only
* match an e with the same diacritic in the searched text.
* @draft ICU 4.4
*/
USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD,
/**
* Value for USEARCH_ELEMENT_COMPARISON.
* collation element comparison is modified to effectively provide
* behavior between the specified strength and strength - 1. Collation
* elements in either the pattern or the searched text that have the
* base weight for the specified strength are treated as "wildcards"
* that match an element with any other weight at that collation level.
* For example, with a secondary-strength English collator, a plain 'e'
* in the pattern will match a plain e or an e with any diacritic in the
* searched text, but an e with diacritic in the pattern will only
* match an e with the same diacritic or a plain e in the searched text.
* @draft ICU 4.4
*/
USEARCH_ANY_BASE_WEIGHT_IS_WILDCARD,
USEARCH_ATTRIBUTE_VALUE_COUNT
} USearchAttributeValue;
@@ -249,6 +293,25 @@ U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator(
*/
U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUStringSearchPointer
* "Smart pointer" class, closes a UStringSearch via usearch_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close);
U_NAMESPACE_END
#endif
/* get and set methods -------------------------------------------------- */
/**
+35 -15
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2002-2009, International Business Machines
* Copyright (C) 2002-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -29,6 +29,7 @@
#include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "unicode/localpointer.h"
#ifndef UCNV_H
struct USet;
@@ -243,9 +244,9 @@ typedef struct USerializedSet {
* Equivalent to uset_open(1, 0).
* @return a newly created USet. The caller must call uset_close() on
* it when done.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT USet* U_EXPORT2
U_STABLE USet* U_EXPORT2
uset_openEmpty();
/**
@@ -299,6 +300,25 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
U_STABLE void U_EXPORT2
uset_close(USet* set);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUSetPointer
* "Smart pointer" class, closes a USet via uset_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
U_NAMESPACE_END
#endif
/**
* Returns a copy of this object.
* If this set is frozen, then the clone will be frozen as well.
@@ -308,7 +328,7 @@ uset_close(USet* set);
* @see uset_cloneAsThawed
* @stable ICU 3.8
*/
U_DRAFT USet * U_EXPORT2
U_STABLE USet * U_EXPORT2
uset_clone(const USet *set);
/**
@@ -320,7 +340,7 @@ uset_clone(const USet *set);
* @see uset_cloneAsThawed
* @stable ICU 3.8
*/
U_DRAFT UBool U_EXPORT2
U_STABLE UBool U_EXPORT2
uset_isFrozen(const USet *set);
/**
@@ -337,7 +357,7 @@ uset_isFrozen(const USet *set);
* @see uset_cloneAsThawed
* @stable ICU 3.8
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uset_freeze(USet *set);
/**
@@ -350,7 +370,7 @@ uset_freeze(USet *set);
* @see uset_clone
* @stable ICU 3.8
*/
U_DRAFT USet * U_EXPORT2
U_STABLE USet * U_EXPORT2
uset_cloneAsThawed(const USet *set);
/**
@@ -707,18 +727,18 @@ uset_clear(USet* set);
* @param attributes bitmask for attributes to close over.
* Currently only the USET_CASE bit is supported. Any undefined bits
* are ignored.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uset_closeOver(USet* set, int32_t attributes);
/**
* Remove all strings from this set.
*
* @param set the set
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uset_removeAllStrings(USet* set);
/**
@@ -902,7 +922,7 @@ uset_containsSome(const USet* set1, const USet* set2);
* @stable ICU 3.8
* @see USetSpanCondition
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
/**
@@ -923,7 +943,7 @@ uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spa
* @stable ICU 3.8
* @see USetSpanCondition
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition);
/**
@@ -945,7 +965,7 @@ uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition
* @stable ICU 3.8
* @see USetSpanCondition
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
/**
@@ -966,7 +986,7 @@ uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition
* @stable ICU 3.8
* @see USetSpanCondition
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition);
/**
+39 -7
View File
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 2000-2009, International Business Machines
* Copyright (C) 2000-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -113,6 +113,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* Memory option: allow the result to have a different length than the source.
* Affects: LamAlef options
* This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_RESIZE 0
@@ -128,6 +129,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* If more room is necessary, then try to consume spaces next to modified characters.
* Affects: LamAlef options
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_NEAR 1
@@ -143,6 +145,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* If more room is necessary, then try to consume spaces at the end of the text.
* Affects: LamAlef options
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_END 2
@@ -158,6 +161,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* If more room is necessary, then try to consume spaces at the beginning of the text.
* Affects: LamAlef options
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_BEGIN 3
@@ -173,6 +177,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*
* Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END.
* Affects: LamAlef options
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_AUTO 0x10000
@@ -180,7 +185,10 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
#define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */
/** Bit mask for LamAlef memory options. */
/**
* Bit mask for LamAlef memory options.
* @draft ICU 4.2
*/
#define U_SHAPE_LAMALEF_MASK 0x10003 /* updated */
/** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */
@@ -191,6 +199,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* the source is in visual RTL order,
* the rightmost displayed character stored first.
* This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL
* @draft ICU 4.2
*/
#define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL 0
@@ -330,10 +339,14 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* De-shaping mode: Any Seen character followed by Tail character will be
* replaced by one cell Seen and a space will replace the Tail.
* Affects: Seen options
* @draft ICU 4.2
*/
#define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000
/** Bit mask for Seen memory options. */
/**
* Bit mask for Seen memory options.
* @draft ICU 4.2
*/
#define U_SHAPE_SEEN_MASK 0x700000
/* YehHamza option */
@@ -347,11 +360,15 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be
* replaced by one cell YehHamza and space will replace the Hamza.
* Affects: YehHamza options
* @draft ICU 4.2
*/
#define U_SHAPE_YEHHAMZA_TWOCELL_NEAR 0x1000000
/** Bit mask for YehHamza memory options. */
/**
* Bit mask for YehHamza memory options.
* @draft ICU 4.2
*/
#define U_SHAPE_YEHHAMZA_MASK 0x3800000
/* New Tashkeel options */
@@ -362,6 +379,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*
* De-shaping mode: N/A
* Affects: Tashkeel options
* @draft ICU 4.2
*/
#define U_SHAPE_TASHKEEL_BEGIN 0x40000
@@ -372,6 +390,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*
* De-shaping mode: N/A
* Affects: Tashkeel options
* @draft ICU 4.2
*/
#define U_SHAPE_TASHKEEL_END 0x60000
@@ -381,6 +400,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* De-shaping mode: N/A
*
* Affect: Tashkeel options
* @draft ICU 4.2
*/
#define U_SHAPE_TASHKEEL_RESIZE 0x80000
@@ -391,10 +411,14 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*
* De-shaping mode: N/A
* Affects: YehHamza options
* @draft ICU 4.2
*/
#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000
/** Bit mask for Tashkeel replacement with Space or Tatweel memory options. */
/**
* Bit mask for Tashkeel replacement with Space or Tatweel memory options.
* @draft ICU 4.2
*/
#define U_SHAPE_TASHKEEL_MASK 0xE0000
@@ -417,10 +441,14 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior.
* D. END For Logical text: Same as END in default behavior).
* Affects: All LamAlef BEGIN, END and AUTO options.
* @draft ICU 4.2
*/
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000
/** Bit mask for swapping BEGIN and END for Visual LTR text */
/**
* Bit mask for swapping BEGIN and END for Visual LTR text
* @draft ICU 4.2
*/
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000
/**
@@ -433,10 +461,14 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* Shaping Mode: Only shaping.
* De-shaping Mode: N/A.
* Affects: All Seen options
* @draft ICU 4.2
*/
#define SHAPE_TAIL_NEW_UNICODE 0x8000000
/** Bit mask for new Unicode Tail option */
/**
* Bit mask for new Unicode Tail option
* @draft ICU 4.2
*/
#define SHAPE_TAIL_TYPE_MASK 0x8000000
#endif
+117 -85
View File
@@ -1,6 +1,6 @@
/*
***************************************************************************
* Copyright (C) 2008-2009, International Business Machines Corporation
* Copyright (C) 2008-2010, International Business Machines Corporation
* and others. All Rights Reserved.
***************************************************************************
* file name: uspoof.h
@@ -25,12 +25,12 @@
#include "unicode/utypes.h"
#include "unicode/uset.h"
#include "unicode/parseerr.h"
#include "unicode/localpointer.h"
#if !UCONFIG_NO_NORMALIZATION
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
#include "unicode/unistr.h"
#include "unicode/uniset.h"
@@ -56,7 +56,7 @@ U_NAMESPACE_USE
* from these Unicode documents.
*
* The tests available on identifiers fall into two general categories:
* -# Single identier tests. Check whether an identifier is
* -# Single identifier tests. Check whether an identifier is
* potentially confusable with any other string, or is suspicious
* for other reasons.
* -# Two identifier tests. Check whether two specific identifiers are confusable.
@@ -70,7 +70,7 @@ U_NAMESPACE_USE
* -# Perform the checks using the pre-configured USpoofChecker. The results indicate
* which (if any) of the selected tests have identified possible problems with the identifier.
* Results are reported as a set of USpoofChecks flags; this mirrors the form in which
* the set of tests to perform was originally specified tothe USpoofChecker.
* the set of tests to perform was originally specified to the USpoofChecker.
*
* A USpoofChecker may be used repeatedly to perform checks on any number of identifiers.
*
@@ -88,19 +88,19 @@ U_NAMESPACE_USE
* When testing whether pairs of identifiers are confusable, with the uspoof_areConfusable()
* family of functions, the relevant tests are
*
* -# USPOOF_SINGLE_SCRIPT_CONFUSABLE: All of the characters from the two idenifiers are
* -# USPOOF_SINGLE_SCRIPT_CONFUSABLE: All of the characters from the two identifiers are
* from a single script, and the two identifiers are visually confusable.
* -# USPOOF_MIXED_SCRIPT_CONFUSABLE: At least one of the identifiers contains characters
* from more than one script, and the two identifiers are visually confusable.
* -# USPOOF_WHOLE_SCRIPT_CONFUSABLE: Each of the two idenifiers is of a single script, but
* the the two identifiers are from different scripts, and they are visually confusable.
* -# USPOOF_WHOLE_SCRIPT_CONFUSABLE: Each of the two identifiers is of a single script, but
* the two identifiers are from different scripts, and they are visually confusable.
*
* The safest approach is to enable all three of these checks as a group.
*
* USPOOF_ANY_CASE is a modifier for the above tests. If the identifiers being checked can
* be of mixed case and are used in a case-sensitive manner, this option should be specified.
*
* If the identiers being checked are used in a case-insensitive manner, and if they are
* If the identifiers being checked are used in a case-insensitive manner, and if they are
* displayed to users in lower-case form only, the USPOOF_ANY_CASE option should not be
* specified. Confusabality issues involving upper case letters will not be reported.
*
@@ -108,10 +108,10 @@ U_NAMESPACE_USE
* the relevant tests are:
*
* -# USPOOF_MIXED_SCRIPT_CONFUSABLE: the identifier contains characters from multiple
* scripts, and there exists an identier of a single script that is visually confusable.
* scripts, and there exists an identifier of a single script that is visually confusable.
* -# USPOOF_WHOLE_SCRIPT_CONFUSABLE: the identifier consists of characters from a single
* script, and there exists a visually confusable identifier.
* The visally confusable identifier also consists of characters from a single script.
* The visually confusable identifier also consists of characters from a single script.
* but not the same script as the identifier being checked.
* -# USPOOF_ANY_CASE: modifies the mixed script and whole script confusables tests. If
* specified, the checks will confusable characters of any case. If this flag is not
@@ -121,7 +121,7 @@ U_NAMESPACE_USE
* This is not a test for confusable identifiers
* -# USPOOF_INVISIBLE: check an identifier for the presence of invisible characters,
* such as zero-width spaces, or character sequences that are
* likely not to display, such as multiple occurences of the same
* likely not to display, such as multiple occurrences of the same
* non-spacing mark. This check does not test the input string as a whole
* for conformance to any particular syntax for identifiers.
* -# USPOOF_CHAR_LIMIT: check that an identifier contains only characters from a specified set
@@ -129,10 +129,23 @@ U_NAMESPACE_USE
* uspoof_setAllowedLocales().
*
* Note on Scripts:
* Characters from the Unicode Scripts "Common" and "Inherited" are ignored when consdering
* Characters from the Unicode Scripts "Common" and "Inherited" are ignored when considering
* the script of an identifier. Common characters include digits and symbols that
* are normally used with text from more than one script.
*
* Identifier Skeletons: A skeleton is a transformation of an identifier, such that
* all identifiers that are confusable with each other have the same skeleton.
* Using skeletons, it is possible to build a dictionary data structure for
* a set of identifiers, and then quickly test whether a new identifier is
* confusable with an identifier already in the set. The uspoof_getSkeleton()
* family of functions will produce the skeleton from an identifier.
*
* Note that skeletons are not guaranteed to be stable between versions
* of Unicode or ICU, so an applications should not rely on creating a permanent,
* or difficult to update, database of skeletons. Instabilities result from
* identifying new pairs or sequences of characters that are visually
* confusable, and thus must be mapped to the same skeleton character(s).
*
*/
struct USpoofChecker;
@@ -143,7 +156,7 @@ typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker
* These enum values are used both to select the set of checks that
* will be performed, and to report results from the check function.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
typedef enum USpoofChecks {
/** Single script confusable test.
@@ -156,9 +169,9 @@ typedef enum USpoofChecks {
/** Mixed script confusable test.
* When checking a single identifier, report a problem if
* the identifier contains multiple scripts, and
* is confusable with some other identifer in a single script
* is confusable with some other identifier in a single script
* When testing whether two identifiers are confusable, report that they are if
* the two IDs are visually confusable, and
* the two IDs are visually confusable,
* and at least one contains characters from more than one script.
*/
USPOOF_MIXED_SCRIPT_CONFUSABLE = 2,
@@ -167,7 +180,7 @@ typedef enum USpoofChecks {
* When checking a single identifier, report a problem if
* The identifier is of a single script, and
* there exists a confusable identifier in another script.
* When testing whether two identfiers are confusable, report that they are if
* When testing whether two identifiers are confusable, report that they are if
* each is of a single script,
* the scripts of the two identifiers are different, and
* the identifiers are visually confusable.
@@ -177,20 +190,20 @@ typedef enum USpoofChecks {
/** Any Case Modifier for confusable identifier tests.
If specified, consider all characters, of any case, when looking for confusables.
If USPOOF_ANY_CASE is not specified, identifiers being checked are assumed to have been
case folded. Upper case conusable characters will not be checked.
case folded. Upper case confusable characters will not be checked.
Selects between Lower Case Confusable and
Any Case Confusable. */
USPOOF_ANY_CASE = 8,
/** Check that an identifer contains only characters from a
/** Check that an identifier contains only characters from a
* single script (plus chars from the common and inherited scripts.)
* Applies to checks of a single identifier check only.
*/
USPOOF_SINGLE_SCRIPT = 16,
/** Check an identifier for the presence of invisble characters,
/** Check an identifier for the presence of invisible characters,
* such as zero-width spaces, or character sequences that are
* likely not to display, such as multiple occurences of the same
* likely not to display, such as multiple occurrences of the same
* non-spacing mark. This check does not test the input string as a whole
* for conformance to any particular syntax for identifiers.
*/
@@ -214,16 +227,16 @@ typedef enum USpoofChecks {
*
* @param status The error code, set if this function encounters a problem.
* @return the newly created Spoof Checker
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT USpoofChecker * U_EXPORT2
U_STABLE USpoofChecker * U_EXPORT2
uspoof_open(UErrorCode *status);
/**
* Open a Spoof checker from its serialized from, stored in 32-bit-aligned memory.
* Inverse of uspoof_serialize().
* The memory containing the serailized data must remain valid and unchanged
* The memory containing the serialized data must remain valid and unchanged
* as long as the spoof checker, or any cloned copies of the spoof checker,
* are in use. Ownership of the memory remains with the caller.
* The spoof checker (and any clones) must be closed prior to deleting the
@@ -239,7 +252,7 @@ uspoof_open(UErrorCode *status);
*
* @see uspoof_open
* @see uspoof_serialize
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI USpoofChecker * U_EXPORT2
uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
@@ -260,7 +273,7 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng
* input string is zero terminated.
* @param confusablesWholeScript
* a pointer to the whole script confusables definitions,
* as found in the file xonfusablesWholeScript.txt from unicode.org.
* as found in the file confusablesWholeScript.txt from unicode.org.
* @param confusablesWholeScriptLen The length of the whole script confusables text, or
* -1 if the input string is zero terminated.
* @param errType In the event of an error in the input, indicates
@@ -274,7 +287,7 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng
* U_PARSE_ERROR, which is used to report syntax errors
* in the input.
* @return A spoof checker that uses the rules from the input files.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI USpoofChecker * U_EXPORT2
uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
@@ -285,11 +298,30 @@ uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
/**
* Close a Spoof Checker, freeing any memory that was being held by
* its implementation.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uspoof_close(USpoofChecker *sc);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUSpoofCheckerPointer
* "Smart pointer" class, closes a USpoofChecker via uspoof_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close);
U_NAMESPACE_END
#endif
/**
* Clone a Spoof Checker. The clone will be set to perform the same checks
* as the original source.
@@ -297,9 +329,9 @@ uspoof_close(USpoofChecker *sc);
* @param sc The source USpoofChecker
* @param status The error code, set if this function encounters a problem.
* @return
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT USpoofChecker * U_EXPORT2
U_STABLE USpoofChecker * U_EXPORT2
uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
@@ -312,10 +344,10 @@ uspoof_clone(const USpoofChecker *sc, UErrorCode *status);
* The value is a bit set, obtained by OR-ing together
* values from enum USpoofChecks.
* @param status The error code, set if this function encounters a problem.
* @draft ICU 4.2
* @stable ICU 4.2
*
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
/**
@@ -326,10 +358,10 @@ uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status);
* @return The set of checks that this spoof checker will perform.
* The value is a bit set, obtained by OR-ing together
* values from enum USpoofChecks.
* @draft ICU 4.2
* @stable ICU 4.2
*
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
/**
@@ -372,9 +404,9 @@ uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status);
* the allowed characters.
*
* @param status The error code, set if this function encounters a problem.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status);
/**
@@ -396,9 +428,9 @@ uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode
* to the acceptable scripts, formatted like an
* HTTP Accept Language value.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT const char * U_EXPORT2
U_STABLE const char * U_EXPORT2
uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
@@ -413,14 +445,14 @@ uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status);
*
* @param sc The USpoofChecker
* @param chars A Unicode Set containing the list of
* charcters that are permitted. Ownership of the set
* characters that are permitted. Ownership of the set
* remains with the caller. The incoming set is cloned by
* this function, so there are no restrictions on modifying
* or deleting the USet after calling this function.
* @param status The error code, set if this function encounters a problem.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status);
@@ -442,13 +474,13 @@ uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status)
* @param status The error code, set if this function encounters a problem.
* @return A USet containing the characters that are permitted by
* the USPOOF_CHAR_LIMIT test.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT const USet * U_EXPORT2
U_STABLE const USet * U_EXPORT2
uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Limit the acceptable characters to those specified by a Unicode Set.
* Any previously specified character limit is
@@ -460,14 +492,14 @@ uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status);
*
* @param sc The USpoofChecker
* @param chars A Unicode Set containing the list of
* charcters that are permitted. Ownership of the set
* characters that are permitted. Ownership of the set
* remains with the caller. The incoming set is cloned by
* this function, so there are no restrictions on modifying
* or deleting the USet after calling this function.
* @param status The error code, set if this function encounters a problem.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status);
@@ -489,16 +521,16 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCo
* @param status The error code, set if this function encounters a problem.
* @return A UnicodeSet containing the characters that are permitted by
* the USPOOF_CHAR_LIMIT test.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT const UnicodeSet * U_EXPORT2
U_STABLE const UnicodeSet * U_EXPORT2
uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
#endif
/**
* Check the specified string for possible security issues.
* The text to be checked will typically be an indentifier of some sort.
* The text to be checked will typically be an identifier of some sort.
* The set of checks to be performed is specified with uspoof_setChecks().
*
* @param sc The USpoofChecker
@@ -514,7 +546,7 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
* is not needed.
* If the string passes the requested checks the
* parameter value will not be set.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Spoofing or security issues detected with the input string are
* not reported here, but through the function's return value.
@@ -522,9 +554,9 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
* or spoofing issues detected. The bits are defined by
* enum USpoofChecks. Zero is returned if no issues
* are found with the input string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_check(const USpoofChecker *sc,
const UChar *text, int32_t length,
int32_t *position,
@@ -533,7 +565,7 @@ uspoof_check(const USpoofChecker *sc,
/**
* Check the specified string for possible security issues.
* The text to be checked will typically be an indentifier of some sort.
* The text to be checked will typically be an identifier of some sort.
* The set of checks to be performed is specified with uspoof_setChecks().
*
* @param sc The USpoofChecker
@@ -547,7 +579,7 @@ uspoof_check(const USpoofChecker *sc,
* is not needed.
* If the string passes the requested checks the
* parameter value will not be set.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Spoofing or security issues detected with the input string are
* not reported here, but through the function's return value.
@@ -557,19 +589,19 @@ uspoof_check(const USpoofChecker *sc,
* or spoofing issues detected. The bits are defined by
* enum USpoofChecks. Zero is returned if no issues
* are found with the input string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_checkUTF8(const USpoofChecker *sc,
const char *text, int32_t length,
int32_t *position,
UErrorCode *status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Check the specified string for possible security issues.
* The text to be checked will typically be an indentifier of some sort.
* The text to be checked will typically be an identifier of some sort.
* The set of checks to be performed is specified with uspoof_setChecks().
*
* @param sc The USpoofChecker
@@ -581,7 +613,7 @@ uspoof_checkUTF8(const USpoofChecker *sc,
* is not needed.
* If the string passes the requested checks the
* parameter value will not be set.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Spoofing or security issues detected with the input string are
* not reported here, but through the function's return value.
@@ -590,9 +622,9 @@ uspoof_checkUTF8(const USpoofChecker *sc,
* or spoofing issues detected. The bits are defined by
* enum USpoofChecks. Zero is returned if no issues
* are found with the input string.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_checkUnicodeString(const USpoofChecker *sc,
const U_NAMESPACE_QUALIFIER UnicodeString &text,
int32_t *position,
@@ -630,7 +662,7 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
* @param length2 The length of the second string, expressed in
* 16 bit UTF-16 code units, or -1 if the string is
* zero terminated.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Confusability of the strings is not reported here,
* but through this function's return value.
@@ -638,9 +670,9 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
* the type of confusability found, as defined by
* enum USpoofChecks. Zero is returned if the strings
* are not confusable.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_areConfusable(const USpoofChecker *sc,
const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
@@ -663,7 +695,7 @@ uspoof_areConfusable(const USpoofChecker *sc,
* confusability. The strings are in UTF-18 format.
* @param length2 The length of the second string in bytes, or -1
* if the string is zero terminated.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Confusability of the strings is not reported here,
* but through this function's return value.
@@ -671,9 +703,9 @@ uspoof_areConfusable(const USpoofChecker *sc,
* the type of confusability found, as defined by
* enum USpoofChecks. Zero is returned if the strings
* are not confusable.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_areConfusableUTF8(const USpoofChecker *sc,
const char *s1, int32_t length1,
const char *s2, int32_t length2,
@@ -682,7 +714,7 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Check the whether two specified strings are visually confusable.
* The types of confusability to be tested - single script, mixed script,
@@ -694,7 +726,7 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
* confusability. The strings are in UTF-8 format.
* @param s2 The second of the two strings to be compared for
* confusability. The strings are in UTF-18 format.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* Confusability of the strings is not reported here,
* but through this function's return value.
@@ -702,9 +734,9 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
* the type of confusability found, as defined by
* enum USpoofChecks. Zero is returned if the strings
* are not confusable.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
const U_NAMESPACE_QUALIFIER UnicodeString &s1,
const U_NAMESPACE_QUALIFIER UnicodeString &s2,
@@ -736,15 +768,15 @@ uspoof_areConfusableUnicodeString(const USpoofChecker *sc,
* @param destCapacity The length of the output buffer, in 16 bit units.
* The destCapacity may be zero, in which case the function will
* return the actual length of the skeleton.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* @return The length of the skeleton string. The returned length
* is always that of the complete skeleton, even when the
* supplied buffer is too small (or of zero length)
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_getSkeleton(const USpoofChecker *sc,
uint32_t type,
const UChar *s, int32_t length,
@@ -775,7 +807,7 @@ uspoof_getSkeleton(const USpoofChecker *sc,
* @param destCapacity The length of the output buffer, in bytes.
* The destCapacity may be zero, in which case the function will
* return the actual length of the skeleton.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check. Possible Errors include U_INVALID_CHAR_FOUND
* for invalid UTF-8 sequences, and
* U_BUFFER_OVERFLOW_ERROR if the destination buffer is too small
@@ -784,16 +816,16 @@ uspoof_getSkeleton(const USpoofChecker *sc,
* is always that of the complete skeleton, even when the
* supplied buffer is too small (or of zero length)
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
uspoof_getSkeletonUTF8(const USpoofChecker *sc,
uint32_t type,
const char *s, int32_t length,
char *dest, int32_t destCapacity,
UErrorCode *status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Get the "skeleton" for an identifier string.
* Skeletons are a transformation of the input string;
@@ -816,19 +848,19 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
* @param destCapacity The length of the output buffer, in bytes.
* The destCapacity may be zero, in which case the function will
* return the actual length of the skeleton.
* @param status The error code, set if an error occured while attempting to
* @param status The error code, set if an error occurred while attempting to
* perform the check.
* @return A reference to the destination (skeleton) string.
*
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UnicodeString & U_EXPORT2
U_STABLE UnicodeString & U_EXPORT2
uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
uint32_t type,
const UnicodeString &s,
UnicodeString &dest,
UErrorCode *status);
#endif /* XP_CPLUSPLUS */
#endif /* U_SHOW_CPLUSPLUS_API */
/**
@@ -847,7 +879,7 @@ uspoof_getSkeletonUnicodeString(const USpoofChecker *sc,
* @return the number of bytes written or needed for the spoof data
*
* @see utrie2_openFromSerialized()
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_CAPI int32_t U_EXPORT2
uspoof_serialize(USpoofChecker *sc,
+38 -18
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2009, International Business Machines
* Copyright (C) 2003-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -23,6 +23,8 @@
*/
#include "unicode/utypes.h"
#include "unicode/localpointer.h"
/**
*
* StringPrep API implements the StingPrep framework as described by RFC 3454.
@@ -86,78 +88,78 @@ typedef struct UStringPrepProfile UStringPrepProfile;
* enums for the standard stringprep profile types
* supported by usprep_openByType.
* @see usprep_openByType
* @draft ICU 4.2
* @stable ICU 4.2
*/
typedef enum UStringPrepProfileType {
/**
* RFC3491 Nameprep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3491_NAMEPREP,
/**
* RFC3530 nfs4_cs_prep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3530_NFS4_CS_PREP,
/**
* RFC3530 nfs4_cs_prep with case insensitive option
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3530_NFS4_CS_PREP_CI,
/**
* RFC3530 nfs4_cis_prep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3530_NFS4_CIS_PREP,
/**
* RFC3530 nfs4_mixed_prep for prefix
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3530_NFS4_MIXED_PREP_PREFIX,
/**
* RFC3530 nfs4_mixed_prep for suffix
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3530_NFS4_MIXED_PREP_SUFFIX,
/**
* RFC3722 iSCSI
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3722_ISCSI,
/**
* RFC3920 XMPP Nodeprep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3920_NODEPREP,
/**
* RFC3920 XMPP Resourceprep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC3920_RESOURCEPREP,
/**
* RFC4011 Policy MIB Stringprep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC4011_MIB,
/**
* RFC4013 SASLprep
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC4013_SASLPREP,
/**
* RFC4505 trace
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC4505_TRACE,
/**
* RFC4518 LDAP
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC4518_LDAP,
/**
* RFC4518 LDAP for case ignore, numeric and stored prefix
* matching rules
* @draft ICU 4.2
* @stable ICU 4.2
*/
USPREP_RFC4518_LDAP_CI
} UStringPrepProfileType;
@@ -191,9 +193,9 @@ usprep_open(const char* path,
* @return Pointer to UStringPrepProfile that is opened. Should be closed by
* calling usprep_close()
* @see usprep_close()
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UStringPrepProfile* U_EXPORT2
U_STABLE UStringPrepProfile* U_EXPORT2
usprep_openByType(UStringPrepProfileType type,
UErrorCode* status);
@@ -205,6 +207,24 @@ usprep_openByType(UStringPrepProfileType type,
U_STABLE void U_EXPORT2
usprep_close(UStringPrepProfile* profile);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUStringPrepProfilePointer
* "Smart pointer" class, closes a UStringPrepProfile via usprep_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringPrepProfilePointer, UStringPrepProfile, usprep_close);
U_NAMESPACE_END
#endif
/**
* Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC),
+99 -8
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1998-2009, International Business Machines
* Copyright (C) 1998-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -23,7 +23,7 @@
/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/
#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
# define UBRK_TYPEDEF_UBREAK_ITERATOR
typedef void UBreakIterator;
typedef struct UBreakIterator UBreakIterator;
#endif
/**
@@ -147,7 +147,7 @@ u_strcat(UChar *dst,
*
* @param dst The destination string.
* @param src The source string.
* @param n The maximum number of characters to compare.
* @param n The maximum number of characters to append.
* @return A pointer to <code>dst</code>.
* @stable ICU 2.0
*/
@@ -967,7 +967,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count);
*
* \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A,
* \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B,
* \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
* \\&quot; => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C
*
* Anything else following a backslash is generically escaped. For
* example, "[a\\-z]" returns "[a-z]".
@@ -1546,9 +1546,9 @@ u_strFromUTF32(UChar *dest,
* @return The pointer to destination buffer.
* @see u_strToUTF32
* @see u_strFromUTF32WithSub
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UChar32* U_EXPORT2
U_STABLE UChar32* U_EXPORT2
u_strToUTF32WithSub(UChar32 *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -1591,9 +1591,9 @@ u_strToUTF32WithSub(UChar32 *dest,
* @return The pointer to destination buffer.
* @see u_strFromUTF32
* @see u_strToUTF32WithSub
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_DRAFT UChar* U_EXPORT2
U_STABLE UChar* U_EXPORT2
u_strFromUTF32WithSub(UChar *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -1602,4 +1602,95 @@ u_strFromUTF32WithSub(UChar *dest,
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode);
/**
* Convert a 16-bit Unicode string to Java Modified UTF-8.
* See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8
*
* This function behaves according to the documentation for Java DataOutput.writeUTF()
* except that it does not encode the output length in the destination buffer
* and does not have an output length restriction.
* See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String)
*
* The input string need not be well-formed UTF-16.
* (Therefore there is no subchar parameter.)
*
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of chars). If it is 0, then
* dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
* @param pDestLength A pointer to receive the number of units written to the destination. If
* pDestLength!=NULL then *pDestLength is always set to the
* number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
* @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 pointer to destination buffer.
* @draft ICU 4.4
* @see u_strToUTF8WithSub
* @see u_strFromJavaModifiedUTF8WithSub
*/
U_DRAFT char* U_EXPORT2
u_strToJavaModifiedUTF8(
char *dest,
int32_t destCapacity,
int32_t *pDestLength,
const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode);
/**
* Convert a Java Modified UTF-8 string to a 16-bit Unicode string.
* If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set.
*
* This function behaves according to the documentation for Java DataInput.readUTF()
* except that it takes a length parameter rather than
* interpreting the first two input bytes as the length.
* See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF()
*
* The output string may not be well-formed UTF-16.
*
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
* dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
* @param pDestLength A pointer to receive the number of units written to the destination. If
* pDestLength!=NULL then *pDestLength is always set to the
* number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
* @param subchar The substitution character to use in place of an illegal input sequence,
* or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead.
* A substitution character can be any valid Unicode code point (up to U+10FFFF)
* except for surrogate code points (U+D800..U+DFFF).
* The recommended value is U+FFFD "REPLACEMENT CHARACTER".
* @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0.
* Set to 0 if no substitutions occur or subchar<0.
* pNumSubstitutions can be NULL.
* @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 pointer to destination buffer.
* @see u_strFromUTF8WithSub
* @see u_strFromUTF8Lenient
* @see u_strToJavaModifiedUTF8
* @draft ICU 4.4
*/
U_DRAFT UChar* U_EXPORT2
u_strFromJavaModifiedUTF8WithSub(
UChar *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char *src,
int32_t srcLength,
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode);
#endif
+9 -9
View File
@@ -1,10 +1,10 @@
/*
*******************************************************************************
* Copyright (C) 2004-2009, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name:
* file name: usystem.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
@@ -32,13 +32,13 @@
# define uloc_getDefault uloc_getDefault_SYSTEM_API_DO_NOT_USE
# define uloc_setDefault uloc_setDefault_SYSTEM_API_DO_NOT_USE
# else
# define u_cleanup_4_2 u_cleanup_SYSTEM_API_DO_NOT_USE
# define u_setAtomicIncDecFunctions_4_2 u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE
# define u_setMemoryFunctions_4_2 u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE
# define u_setMutexFunctions_4_2 u_setMutexFunctions_SYSTEM_API_DO_NOT_USE
# define ucnv_setDefaultName_4_2 ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE
# define uloc_getDefault_4_2 uloc_getDefault_SYSTEM_API_DO_NOT_USE
# define uloc_setDefault_4_2 uloc_setDefault_SYSTEM_API_DO_NOT_USE
# define u_cleanup_4_4 u_cleanup_SYSTEM_API_DO_NOT_USE
# define u_setAtomicIncDecFunctions_4_4 u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE
# define u_setMemoryFunctions_4_4 u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE
# define u_setMutexFunctions_4_4 u_setMutexFunctions_SYSTEM_API_DO_NOT_USE
# define ucnv_setDefaultName_4_4 ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE
# define uloc_getDefault_4_4 uloc_getDefault_SYSTEM_API_DO_NOT_USE
# define uloc_setDefault_4_4 uloc_setDefault_SYSTEM_API_DO_NOT_USE
# endif /* U_DISABLE_RENAMING */
#endif /* U_HIDE_SYSTEM_API */
+179 -4
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2004-2008, International Business Machines
* Copyright (C) 2004-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -136,7 +136,9 @@
#include "unicode/utypes.h"
#ifdef XP_CPLUSPLUS
#include "unicode/uchar.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#include "unicode/rep.h"
#include "unicode/unistr.h"
#include "unicode/chariter.h"
@@ -179,6 +181,24 @@ typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */
U_STABLE UText * U_EXPORT2
utext_close(UText *ut);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUTextPointer
* "Smart pointer" class, closes a UText via utext_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close);
U_NAMESPACE_END
#endif
/**
* Open a read-only UText implementation for UTF-8 strings.
@@ -223,7 +243,7 @@ U_STABLE UText * U_EXPORT2
utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status);
#ifdef XP_CPLUSPLUS
#if U_SHOW_CPLUSPLUS_API
/**
* Open a writable UText for a non-const UnicodeString.
*
@@ -655,6 +675,148 @@ utext_extract(UText *ut,
UErrorCode *status);
/**
* Compare two UTexts (binary order). The comparison begins at each source text's
* iteration position. The iteration position of each UText will be left following
* the last character compared.
*
* The comparison is done in code point order; unlike u_strCompare, you
* cannot choose to use code unit order. This is because the characters
* in a UText are accessed one code point at a time, and may not be from a UTF-16
* context.
*
* This functions works with strings of different explicitly specified lengths
* unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
* A length argument of -1 signifies that as much of the string should be used as
* is necessary to compare with the other string. If both length arguments are -1,
* the entire remaining portionss of both strings are used.
*
* @param s1 First source string.
* @param length1 Length of first source string in UTF-32 code points.
*
* @param s2 Second source string.
* @param length2 Length of second source string in UTF-32 code points.
*
* @return <0 or 0 or >0 as usual for string comparisons
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL int32_t U_EXPORT2
utext_compare(UText *s1, int32_t length1,
UText *s2, int32_t length2);
/**
* Compare two UTexts (binary order). The comparison begins at each source text's
* iteration position. The iteration position of each UText will be left following
* the last character compared. This method differs from utext_compare in that
* it accepts native limits rather than lengths for each string.
*
* The comparison is done in code point order; unlike u_strCompare, you
* cannot choose to use code unit order. This is because the characters
* in a UText are accessed one code point at a time, and may not be from a UTF-16
* context.
*
* This functions works with strings of different explicitly specified lengths
* unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
* A limit argument of -1 signifies that as much of the string should be used as
* is necessary to compare with the other string. If both limit arguments are -1,
* the entire remaining portionss of both strings are used.
*
* @param s1 First source string.
* @param limit1 Native index of the last character in the first source string to be considered.
*
* @param s2 Second source string.
* @param limit2 Native index of the last character in the second source string to be considered.
*
* @return <0 or 0 or >0 as usual for string comparisons
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL int32_t U_EXPORT2
utext_compareNativeLimit(UText *s1, int64_t limit1,
UText *s2, int64_t limit2);
/**
* Compare two UTexts case-insensitively using full case folding. The comparison
* begins at each source text's iteration position. The iteration position of each
* UText will be left following the last character compared.
*
* The comparison is done in code point order; this is because the characters
* in a UText are accessed one code point at a time, and may not be from a UTF-16
* context.
*
* This functions works with strings of different explicitly specified lengths
* unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
* A length argument of -1 signifies that as much of the string should be used as
* is necessary to compare with the other string. If both length arguments are -1,
* the entire remaining portionss of both strings are used.
*
* @param s1 First source string.
* @param length1 Length of first source string in UTF-32 code points.
*
* @param s2 Second source string.
* @param length2 Length of second source string in UTF-32 code points.
*
* @param options A bit set of options:
* - U_FOLD_CASE_DEFAULT or 0 is used for default options:
* Comparison in code point order with default case folding.
*
* - U_FOLD_CASE_EXCLUDE_SPECIAL_I
*
* @param pErrorCode Must be a valid pointer to an error code value,
* which must not indicate a failure before the function call.
*
* @return <0 or 0 or >0 as usual for string comparisons
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL int32_t U_EXPORT2
utext_caseCompare(UText *s1, int32_t length1,
UText *s2, int32_t length2,
uint32_t options, UErrorCode *pErrorCode);
/**
* Compare two UTexts case-insensitively using full case folding. The comparison
* begins at each source text's iteration position. The iteration position of each
* UText will be left following the last character compared. This method differs from
* utext_caseCompare in that it accepts native limits rather than lengths for each
* string.
*
* The comparison is done in code point order; this is because the characters
* in a UText are accessed one code point at a time, and may not be from a UTF-16
* context.
*
* This functions works with strings of different explicitly specified lengths
* unlike the ANSI C-like u_strcmp() and u_memcmp() etc.
* A limit argument of -1 signifies that as much of the string should be used as
* is necessary to compare with the other string. If both length arguments are -1,
* the entire remaining portionss of both strings are used.
*
* @param s1 First source string.
* @param limit1 Native index of the last character in the first source string to be considered.
*
* @param s2 Second source string.
* @param limit2 Native index of the last character in the second source string to be considered.
*
* @param options A bit set of options:
* - U_FOLD_CASE_DEFAULT or 0 is used for default options:
* Comparison in code point order with default case folding.
*
* - U_FOLD_CASE_EXCLUDE_SPECIAL_I
*
* @param pErrorCode Must be a valid pointer to an error code value,
* which must not indicate a failure before the function call.
*
* @return <0 or 0 or >0 as usual for string comparisons
*
* @internal ICU 4.4 technology preview
*/
U_INTERNAL int32_t U_EXPORT2
utext_caseCompareNativeLimit(UText *s1, int64_t limit1,
UText *s2, int64_t limit2,
uint32_t options, UErrorCode *pErrorCode);
/************************************************************************************
*
* #define inline versions of selected performance-critical text access functions
@@ -670,6 +832,19 @@ utext_extract(UText *ut,
*
************************************************************************************/
/**
* inline version of utext_current32(), for performance-critical situations.
*
* Get the code point at the current iteration position of the UText.
* Returns U_SENTINEL (-1) if the position is at the end of the
* text.
*
* @internal ICU 4.4 technology preview
*/
#define UTEXT_CURRENT32(ut) \
((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \
((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut))
/**
* inline version of utext_next32(), for performance-critical situations.
*
@@ -1272,8 +1447,8 @@ struct UTextFuncs {
* (private) Spare function pointer
* @internal
*/
UTextClose *spare1;
/**
* (private) Spare function pointer
* @internal
+36 -5
View File
@@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2007, International Business Machines
* Copyright (C) 1999-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@@ -45,6 +45,11 @@
* \var utf8_countTrailBytes
* Internal array with numbers of trail bytes for any given byte used in
* lead byte position.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is called by public macros in this file and thus must remain stable,
* and should not be hidden when other internal functions are hidden (otherwise
* public macros would fail to compile).
* @internal
*/
#ifdef U_UTF8_IMPL
@@ -58,42 +63,68 @@ utf8_countTrailBytes[256];
/**
* Count the trail bytes for a UTF-8 lead byte.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is called by public macros in this file and thus must remain stable.
* @internal
*/
#define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte])
/**
* Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is called by public macros in this file and thus must remain stable.
* @internal
*/
#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
/**
* Function for handling "next code point" with error-checking.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
* file and thus must remain stable, and should not be hidden when other internal
* functions are hidden (otherwise public macros would fail to compile).
* @internal
*/
U_INTERNAL UChar32 U_EXPORT2
U_STABLE UChar32 U_EXPORT2
utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
/**
* Function for handling "append code point" with error-checking.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
* file and thus must remain stable, and should not be hidden when other internal
* functions are hidden (otherwise public macros would fail to compile).
* @internal
*/
U_INTERNAL int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
/**
* Function for handling "previous code point" with error-checking.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
* file and thus must remain stable, and should not be hidden when other internal
* functions are hidden (otherwise public macros would fail to compile).
* @internal
*/
U_INTERNAL UChar32 U_EXPORT2
U_STABLE UChar32 U_EXPORT2
utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
/**
* Function for handling "skip backward one code point" with error-checking.
*
* This is internal since it is not meant to be called directly by external clients;
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
* file and thus must remain stable, and should not be hidden when other internal
* functions are hidden (otherwise public macros would fail to compile).
* @internal
*/
U_INTERNAL int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
/* single-code point definitions -------------------------------------------- */
+21 -1
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2005, International Business Machines
* Copyright (C) 1997-2009, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* Date Name Description
@@ -15,6 +15,7 @@
#if !UCONFIG_NO_TRANSLITERATION
#include "unicode/localpointer.h"
#include "unicode/urep.h"
#include "unicode/parseerr.h"
#include "unicode/uenum.h"
@@ -235,6 +236,25 @@ utrans_clone(const UTransliterator* trans,
U_STABLE void U_EXPORT2
utrans_close(UTransliterator* trans);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
/**
* \class LocalUTransliteratorPointer
* "Smart pointer" class, closes a UTransliterator via utrans_close().
* For most methods see the LocalPointerBase base class.
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 4.4
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
U_NAMESPACE_END
#endif
/**
* Return the programmatic identifier for this transliterator.
* If this identifier is passed to utrans_openU(), it will open
+52 -16
View File
@@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 1996-2009, International Business Machines
* Copyright (C) 1996-2010, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -38,6 +38,32 @@
#include "unicode/uversion.h"
#include "unicode/uconfig.h"
/*!
* \file
* \brief Basic definitions for ICU, for both C and C++ APIs
*
* This file defines basic types, constants, and enumerations directly or
* indirectly by including other header files, especially utf.h for the
* basic character and string definitions and umachine.h for consistent
* integer and other types.
*/
/**
* \def U_SHOW_CPLUSPLUS_API
* @internal
*/
#ifdef XP_CPLUSPLUS
# ifndef U_SHOW_CPLUSPLUS_API
# define U_SHOW_CPLUSPLUS_API 1
# endif
#else
# undef U_SHOW_CPLUSPLUS_API
# define U_SHOW_CPLUSPLUS_API 0
#endif
/** @{ API visibility control */
/**
* \def U_HIDE_DRAFT_API
* Define this to 1 to request that draft API be "hidden"
@@ -45,6 +71,9 @@
#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API)
#define U_HIDE_DRAFT_API 1
#endif
#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API)
#define U_HIDE_INTERNAL_API 1
#endif
#ifdef U_HIDE_DRAFT_API
#include "unicode/udraft.h"
@@ -66,15 +95,8 @@
#include "unicode/usystem.h"
#endif
/*!
* \file
* \brief Basic definitions for ICU, for both C and C++ APIs
*
* This file defines basic types, constants, and enumerations directly or
* indirectly by including other header files, especially utf.h for the
* basic character and string definitions and umachine.h for consistent
* integer and other types.
*/
/** @} */
/*===========================================================================*/
/* char Character set family */
@@ -210,8 +232,9 @@
* ICU 1.8.x on EBCDIC, etc..
* @stable ICU 2.0
*/
#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER
#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */
#define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */
#define U_USE_USRDATA 1 /**< @internal */
/**
* U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
@@ -235,7 +258,10 @@
* Do not use.
* @internal
*/
#ifndef U_DEF_ICUDATA_ENTRY_POINT
/* affected by symbol renaming. See platform.h */
#define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat
#endif
/**
* \def U_CALLCONV
@@ -248,7 +274,7 @@
* you must use the U_CAPI and U_EXPORT2 qualifiers.
* @stable ICU 2.0
*/
#if defined(OS390) && (__COMPILER_VER__ < 0x41020000) && defined(XP_CPLUSPLUS)
#if defined(OS390) && defined(XP_CPLUSPLUS)
# define U_CALLCONV __cdecl
#else
# define U_CALLCONV U_EXPORT2
@@ -613,6 +639,8 @@ typedef enum UErrorCode {
U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */
U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
U_ERROR_WARNING_LIMIT, /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */
@@ -712,8 +740,9 @@ typedef enum UErrorCode {
U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */
U_ARGUMENT_TYPE_MISMATCH, /**< Argument name and argument index mismatch in MessageFormat functions */
U_DUPLICATE_KEYWORD, /**< Duplicate keyword in PluralFormat */
U_UNDEFINED_KEYWORD, /**< Undefined Pluarl keyword */
U_UNDEFINED_KEYWORD, /**< Undefined Plural keyword */
U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */
U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */
U_FMT_PARSE_ERROR_LIMIT, /**< The limit for format library errors */
/*
@@ -782,9 +811,16 @@ typedef enum UErrorCode {
U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
/*
* The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes
*/
U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */
U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */
U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */
U_PLUGIN_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for plugin errors */
U_ERROR_LIMIT=U_IDNA_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
} UErrorCode;
/* Use the following to determine if an UErrorCode represents */
+148
View File
@@ -0,0 +1,148 @@
/*
*******************************************************************************
* Copyright (C) 2000-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
* file name: uvernum.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* Created by: Vladimir Weinstein
* Updated by: Steven R. Loomis
*
* Gets included by uversion.h and other files.
*
* IMPORTANT: When updating version, the following things need to be done:
* source/common/unicode/uvernum.h - this file: update major, minor,
* patchlevel, suffix, version, short version constants, namespace,
* renaming macro, and copyright
*
* The following files need to be updated as well, which can be done
* by running the UNIX makefile target 'update-windows-makefiles' in icu/source.
*
*
* source/common/common.vcproj - update 'Output file name' on the link tab so
* that it contains the new major/minor combination
* source/i18n/i18n.vcproj - same as for the common.vcproj
* source/layout/layout.vcproj - same as for the common.vcproj
* source/layoutex/layoutex.vcproj - same
* source/stubdata/stubdata.vcproj - same as for the common.vcproj
* source/io/io.vcproj - same as for the common.vcproj
* source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
* the new major/minor combination and the Unicode version.
*/
#ifndef UVERNUM_H
#define UVERNUM_H
/** The standard copyright notice that gets compiled into each library.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_COPYRIGHT_STRING \
" Copyright (C) 2010, International Business Machines Corporation and others. All Rights Reserved. "
/** The current ICU major version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION_MAJOR_NUM 4
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_MINOR_NUM 4
/** The current ICU patchlevel version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION_PATCHLEVEL_NUM 1
/** The current ICU build level version as an integer.
* This value is for use by ICU clients. It defaults to 0.
* @stable ICU 4.0
*/
#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
#define U_ICU_VERSION_BUILDLEVEL_NUM 0
#endif
/** Glued version suffix for renamers
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SUFFIX _44
/** Glued version suffix function for renamers
* This value will change in the subsequent releases of ICU.
* If a custom suffix (such as matching library suffixes) is desired, this can be modified.
* Note that if present, platform.h may contain an earlier definition of this macro.
* @draft ICU 4.2
*/
#ifndef U_ICU_ENTRY_POINT_RENAME
#define U_ICU_ENTRY_POINT_RENAME(x) x ## _44
#endif
/** The current ICU library version as a dotted-decimal string. The patchlevel
* only appears in this string if it non-zero.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION "4.4.1"
/** The current ICU library major/minor version as a string without dots, for library name suffixes.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SHORT "44"
/** Data version in ICU4C.
* @internal ICU 4.4 Internal Use Only
**/
#define U_ICU_DATA_VERSION "4.4.0.1"
/*===========================================================================
* ICU collation framework version information
* Version info that can be obtained from a collator is affected by these
* numbers in a secret and magic way. Please use collator version as whole
*===========================================================================
*/
/** Collation runtime version (sort key generator, strcoll).
* If the version is different, sortkeys for the same string could be different
* version 2 was in ICU 1.8.1. changed is: compression intervals, French secondary
* compression, generating quad level always when strength is quad or more
* version 4 - ICU 2.2 - tracking UCA changes, ignore completely ignorables
* in contractions, ignore primary ignorables after shifted
* version 5 - ICU 2.8 - changed implicit generation code
* version 6 - ICU 3.4 - with the UCA 4.1, Thai tag is no longer generated or used
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_RUNTIME_VERSION 6
/** Builder code version. When this is different, same tailoring might result
* in assigning different collation elements to code points
* version 2 was in ICU 1.8.1. added support for prefixes, tweaked canonical
* closure. However, the tailorings should probably get same CEs assigned
* version 5 - ICU 2.2 - fixed some bugs, renamed some indirect values.
* version 6 - ICU 2.8 - fixed bug in builder that allowed 0xFF in primary values
* version 7 - ICU 3.4 - with the UCA 4.1 Thai tag is no longer processed, complete ignorables
* now break contractions
* Backward compatible with the old rules.
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_BUILDER_VERSION 7
/** This is the version of the tailorings
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_TAILORINGS_VERSION 1
#endif
+29 -136
View File
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2000-2009, International Business Machines
* Copyright (C) 2000-2010, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*
@@ -11,13 +11,12 @@
*
* Created by: Vladimir Weinstein
*
* Contains all the important version numbers for ICU.
* Gets included by utypes.h and Windows .rc files
*/
/**
* \file
* \brief C API: Contains all the important version numbers for ICU.
* \brief C API: API for accessing ICU version numbers.
*/
/*===========================================================================*/
/* Main ICU version information */
@@ -26,83 +25,16 @@
#ifndef UVERSION_H
#define UVERSION_H
/**
* IMPORTANT: When updating version, the following things need to be done:
* source/common/unicode/uversion.h - this file: update major, minor,
* patchlevel, suffix, version, short version constants, namespace,
* and copyright
* source/common/common.vcproj - update 'Output file name' on the link tab so
* that it contains the new major/minor combination
* source/i18n/i18n.vcproj - same as for the common.vcproj
* source/layout/layout.vcproj - same as for the common.vcproj
* source/layoutex/layoutex.vcproj - same
* source/stubdata/stubdata.vcproj - same as for the common.vcproj
* source/io/io.vcproj - same as for the common.vcproj
* source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
* the new major/minor combination
* source/tools/genren/genren.pl - use this script according to the README
* in that folder
*/
#include "unicode/umachine.h"
/** The standard copyright notice that gets compiled into each library.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_COPYRIGHT_STRING \
" Copyright (C) 2009, International Business Machines Corporation and others. All Rights Reserved. "
/* Actual version info lives in uvernum.h */
#include "unicode/uvernum.h"
/** Maximum length of the copyright string.
* @stable ICU 2.4
*/
#define U_COPYRIGHT_STRING_LENGTH 128
/** The current ICU major version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION_MAJOR_NUM 4
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_MINOR_NUM 2
/** The current ICU patchlevel version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION_PATCHLEVEL_NUM 1
/** The current ICU build level version as an integer.
* This value is for use by ICU clients. It defaults to 0.
* @stable ICU 4.0
*/
#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
#define U_ICU_VERSION_BUILDLEVEL_NUM 0
#endif
/** Glued version suffix for renamers
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SUFFIX _4_2
/** The current ICU library version as a dotted-decimal string. The patchlevel and buildlevel
* only appears in this string if it non-zero.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define U_ICU_VERSION "4.2.1"
/** The current ICU library major/minor version as a string without dots, for library name suffixes.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
#define U_ICU_VERSION_SHORT "42"
/** An ICU version consists of up to 4 numbers from 0..255.
* @stable ICU 2.4
*/
@@ -119,6 +51,7 @@
#define U_MAX_VERSION_STRING_LENGTH 20
/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
* To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
* @stable ICU 2.4
*/
typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
@@ -130,14 +63,22 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
/**
* \def U_NAMESPACE_BEGIN
* This is used to begin a declaration of a public ICU C++ API.
* If the compiler doesn't support namespaces, this does nothing.
* When not compiling for C++, it does nothing.
* When compiling for C++, it begins an extern "C++" linkage block (to protect
* against cases in which an external client includes ICU header files inside
* an extern "C" linkage block).
* If the C++ compiler supports namespaces, it also begins a namespace block.
* @stable ICU 2.4
*/
/**
* \def U_NAMESPACE_END
* This is used to end a declaration of a public ICU C++ API
* If the compiler doesn't support namespaces, this does nothing.
* This is used to end a declaration of a public ICU C++ API.
* When not compiling for C++, it does nothing.
* When compiling for C++, it ends the extern "C++" block begun by
* U_NAMESPACE_BEGIN.
* If the C++ compiler supports namespaces, it also ends the namespace block
* begun by U_NAMESPACE_BEGIN.
* @stable ICU 2.4
*/
@@ -158,18 +99,19 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
*/
/* Define namespace symbols if the compiler supports it. */
#if U_HAVE_NAMESPACE && defined(XP_CPLUSPLUS)
#ifdef XP_CPLUSPLUS
#if U_HAVE_NAMESPACE
# if U_DISABLE_RENAMING
# define U_ICU_NAMESPACE icu
namespace U_ICU_NAMESPACE { }
# else
# define U_ICU_NAMESPACE icu_4_2
# define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
namespace U_ICU_NAMESPACE { }
namespace icu = U_ICU_NAMESPACE;
# endif
# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
# define U_NAMESPACE_END }
# define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
# define U_NAMESPACE_END } }
# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
@@ -180,13 +122,18 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
U_NAMESPACE_USE
# endif
#else
# define U_NAMESPACE_BEGIN extern "C++" {
# define U_NAMESPACE_END }
# define U_NAMESPACE_USE
# define U_NAMESPACE_QUALIFIER
#endif
#else
# define U_NAMESPACE_BEGIN
# define U_NAMESPACE_END
# define U_NAMESPACE_USE
# define U_NAMESPACE_QUALIFIER
#endif
/*===========================================================================*/
/* General version helper functions. Definitions in putil.c */
/*===========================================================================*/
@@ -214,11 +161,12 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString);
* @param versionString A Unicode string with dotted-decimal version
* information, with up to four non-negative number
* fields with values of up to 255 each.
* @draft ICU 4.2
* @stable ICU 4.2
*/
U_STABLE void U_EXPORT2
u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
/**
* Write a string with dotted-decimal version information according
* to the input UVersionInfo.
@@ -244,59 +192,4 @@ u_versionToString(UVersionInfo versionArray, char *versionString);
*/
U_STABLE void U_EXPORT2
u_getVersion(UVersionInfo versionArray);
/**
* Compare two version numbers, v1 and v2, numerically.
* Returns 0 if v1 == v2
* Returns -1 if v1 < v2 (v1 is older, v2 is newer)
* Returns +1 if v1 > v2 (v1 is newer, v2 is older)
* @param v1 version to compare
* @param v2 version to compare
* @return comparison result
* @draft ICU 4.2
*/
U_STABLE int32_t U_EXPORT2
u_compareVersions(UVersionInfo v1, UVersionInfo v2);
/*===========================================================================
* ICU collation framework version information
* Version info that can be obtained from a collator is affected by these
* numbers in a secret and magic way. Please use collator version as whole
*===========================================================================
*/
/** Collation runtime version (sort key generator, strcoll).
* If the version is different, sortkeys for the same string could be different
* version 2 was in ICU 1.8.1. changed is: compression intervals, French secondary
* compression, generating quad level always when strength is quad or more
* version 4 - ICU 2.2 - tracking UCA changes, ignore completely ignorables
* in contractions, ignore primary ignorables after shifted
* version 5 - ICU 2.8 - changed implicit generation code
* version 6 - ICU 3.4 - with the UCA 4.1, Thai tag is no longer generated or used
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_RUNTIME_VERSION 6
/** Builder code version. When this is different, same tailoring might result
* in assigning different collation elements to code points
* version 2 was in ICU 1.8.1. added support for prefixes, tweaked canonical
* closure. However, the tailorings should probably get same CEs assigned
* version 5 - ICU 2.2 - fixed some bugs, renamed some indirect values.
* version 6 - ICU 2.8 - fixed bug in builder that allowed 0xFF in primary values
* version 7 - ICU 3.4 - with the UCA 4.1 Thai tag is no longer processed, complete ignorables
* now break contractions
* Backward compatible with the old rules.
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_BUILDER_VERSION 7
/** This is the version of the tailorings
* This value may change in the subsequent releases of ICU
* @stable ICU 2.4
*/
#define UCOL_TAILORINGS_VERSION 1
#endif
+9 -6
View File
@@ -9,11 +9,12 @@
class BBitmap;
namespace icu_4_2 {
namespace icu_44 {
class DateFormat;
class Locale;
}
enum {
B_METRIC = 0,
B_US
@@ -41,6 +42,8 @@ class BCountry {
bool longFormat);
virtual void FormatTime(BString* string, time_t time,
bool longFormat);
virtual void FormatTime(BString* string, int*& fieldPositions,
int& fieldCount, time_t time);
bool DateFormat(BString&, bool longFormat) const;
void SetDateFormat(const char* formatString,
@@ -85,12 +88,12 @@ class BCountry {
virtual int32 MonFracDigits() const;
private:
icu_4_2::DateFormat* fICULongDateFormatter;
icu_4_2::DateFormat* fICUShortDateFormatter;
icu_4_2::DateFormat* fICULongTimeFormatter;
icu_4_2::DateFormat* fICUShortTimeFormatter;
icu_44::DateFormat* fICULongDateFormatter;
icu_44::DateFormat* fICUShortDateFormatter;
icu_44::DateFormat* fICULongTimeFormatter;
icu_44::DateFormat* fICUShortTimeFormatter;
const char** fStrings;
icu_4_2::Locale* fICULocale;
icu_44::Locale* fICULocale;
};
#endif /* _COUNTRY_H_ */

Some files were not shown because too many files have changed in this diff Show More