| bytestream.h | | bytestream.h | |
|
| // Copyright (C) 2009, International Business Machines | | // Copyright (C) 2009-2010, International Business Machines | |
| // Corporation and others. All Rights Reserved. | | // Corporation and others. All Rights Reserved. | |
| // | | // | |
| // Copyright 2007 Google Inc. All Rights Reserved. | | // Copyright 2007 Google Inc. All Rights Reserved. | |
| // Author: sanjay@google.com (Sanjay Ghemawat) | | // Author: sanjay@google.com (Sanjay Ghemawat) | |
| // | | // | |
| // Abstract interface that consumes a sequence of bytes (ByteSink). | | // Abstract interface that consumes a sequence of bytes (ByteSink). | |
| // | | // | |
| // Used so that we can write a single piece of code that can operate | | // Used so that we can write a single piece of code that can operate | |
| // on a variety of output string types. | | // on a variety of output string types. | |
| // | | // | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| */ | | */ | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| #include "unicode/uobject.h" | | #include "unicode/uobject.h" | |
| #include "unicode/std_string.h" | | #include "unicode/std_string.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * A ByteSink can be filled with bytes. | | * A ByteSink can be filled with bytes. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_COMMON_API ByteSink : public UMemory { | | class U_COMMON_API ByteSink : public UMemory { | |
| public: | | public: | |
| /** | | /** | |
| * Default constructor. | | * Default constructor. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| ByteSink() { } | | ByteSink() { } | |
| /** | | /** | |
| * Virtual destructor. | | * Virtual destructor. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual ~ByteSink() { } | | virtual ~ByteSink() { } | |
| | | | |
| /** | | /** | |
| * Append "bytes[0,n-1]" to this. | | * Append "bytes[0,n-1]" to this. | |
| * @param bytes the pointer to the bytes | | * @param bytes the pointer to the bytes | |
| * @param n the number of bytes; must be non-negative | | * @param n the number of bytes; must be non-negative | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void Append(const char* bytes, int32_t n) = 0; | | virtual void Append(const char* bytes, int32_t n) = 0; | |
| | | | |
| /** | | /** | |
| * Returns a writable buffer for appending and writes the buffer's capaci
ty to | | * Returns a writable buffer for appending and writes the buffer's capaci
ty to | |
| * *result_capacity. Guarantees *result_capacity>=min_capacity. | | * *result_capacity. Guarantees *result_capacity>=min_capacity. | |
| * May return a pointer to the caller-owned scratch buffer which must hav
e | | * May return a pointer to the caller-owned scratch buffer which must hav
e | |
| * scratch_capacity>=min_capacity. | | * scratch_capacity>=min_capacity. | |
| * The returned buffer is only valid until the next operation | | * The returned buffer is only valid until the next operation | |
| * on this ByteSink. | | * on this ByteSink. | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 109 | |
| * | | * | |
| * @param min_capacity required minimum capacity of the returned buffer; | | * @param min_capacity required minimum capacity of the returned buffer; | |
| * must be non-negative | | * must be non-negative | |
| * @param desired_capacity_hint desired capacity of the returned buffer; | | * @param desired_capacity_hint desired capacity of the returned buffer; | |
| * must be non-negative | | * must be non-negative | |
| * @param scratch default caller-owned buffer | | * @param scratch default caller-owned buffer | |
| * @param scratch_capacity capacity of the scratch buffer | | * @param scratch_capacity capacity of the scratch buffer | |
| * @param result_capacity pointer to an integer which will be set to the | | * @param result_capacity pointer to an integer which will be set to the | |
| * capacity of the returned buffer | | * capacity of the returned buffer | |
| * @return a buffer with *result_capacity>=min_capacity | | * @return a buffer with *result_capacity>=min_capacity | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual char* GetAppendBuffer(int32_t min_capacity, | | virtual char* GetAppendBuffer(int32_t min_capacity, | |
| int32_t desired_capacity_hint, | | int32_t desired_capacity_hint, | |
| char* scratch, int32_t scratch_capacity, | | char* scratch, int32_t scratch_capacity, | |
| int32_t* result_capacity); | | int32_t* result_capacity); | |
| | | | |
| /** | | /** | |
| * Flush internal buffers. | | * Flush internal buffers. | |
| * Some byte sinks use internal buffers or provide buffering | | * Some byte sinks use internal buffers or provide buffering | |
| * and require calling Flush() at the end of the stream. | | * and require calling Flush() at the end of the stream. | |
| * The default implementation of Flush() does nothing. | | * The default implementation of Flush() does nothing. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void Flush(); | | virtual void Flush(); | |
| | | | |
| private: | | private: | |
| ByteSink(const ByteSink &); // copy constructor not implemented | | ByteSink(const ByteSink &); // copy constructor not implemented | |
| ByteSink &operator=(const ByteSink &); // assignment operator not impleme
nted | | ByteSink &operator=(const ByteSink &); // assignment operator not impleme
nted | |
| }; | | }; | |
| | | | |
| // ------------------------------------------------------------- | | // ------------------------------------------------------------- | |
| // Some standard implementations | | // Some standard implementations | |
| | | | |
| /** | | /** | |
| * Implementation of ByteSink that writes to a flat byte array, | | * Implementation of ByteSink that writes to a flat byte array, | |
| * with bounds-checking: | | * with bounds-checking: | |
| * This sink will not write more than capacity bytes to outbuf. | | * This sink will not write more than capacity bytes to outbuf. | |
| * If more than capacity bytes are Append()ed, then excess bytes are ignore
d, | | * If more than capacity bytes are Append()ed, then excess bytes are ignore
d, | |
| * and Overflowed() will return true. | | * and Overflowed() will return true. | |
| * Overflow does not cause a runtime error. | | * Overflow does not cause a runtime error. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_COMMON_API CheckedArrayByteSink : public ByteSink { | | class U_COMMON_API CheckedArrayByteSink : public ByteSink { | |
| public: | | public: | |
| /** | | /** | |
| * Constructs a ByteSink that will write to outbuf[0..capacity-1]. | | * Constructs a ByteSink that will write to outbuf[0..capacity-1]. | |
| * @param outbuf buffer to write to | | * @param outbuf buffer to write to | |
| * @param capacity size of the buffer | | * @param capacity size of the buffer | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CheckedArrayByteSink(char* outbuf, int32_t capacity); | | CheckedArrayByteSink(char* outbuf, int32_t capacity); | |
| /** | | /** | |
| * Append "bytes[0,n-1]" to this. | | * Append "bytes[0,n-1]" to this. | |
| * @param bytes the pointer to the bytes | | * @param bytes the pointer to the bytes | |
| * @param n the number of bytes; must be non-negative | | * @param n the number of bytes; must be non-negative | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void Append(const char* bytes, int32_t n); | | virtual void Append(const char* bytes, int32_t n); | |
| /** | | /** | |
| * Returns a writable buffer for appending and writes the buffer's capaci
ty to | | * Returns a writable buffer for appending and writes the buffer's capaci
ty to | |
| * *result_capacity. For details see the base class documentation. | | * *result_capacity. For details see the base class documentation. | |
| * @param min_capacity required minimum capacity of the returned buffer; | | * @param min_capacity required minimum capacity of the returned buffer; | |
| * must be non-negative | | * must be non-negative | |
| * @param desired_capacity_hint desired capacity of the returned buffer; | | * @param desired_capacity_hint desired capacity of the returned buffer; | |
| * must be non-negative | | * must be non-negative | |
| * @param scratch default caller-owned buffer | | * @param scratch default caller-owned buffer | |
| * @param scratch_capacity capacity of the scratch buffer | | * @param scratch_capacity capacity of the scratch buffer | |
| * @param result_capacity pointer to an integer which will be set to the | | * @param result_capacity pointer to an integer which will be set to the | |
| * capacity of the returned buffer | | * capacity of the returned buffer | |
| * @return a buffer with *result_capacity>=min_capacity | | * @return a buffer with *result_capacity>=min_capacity | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual char* GetAppendBuffer(int32_t min_capacity, | | virtual char* GetAppendBuffer(int32_t min_capacity, | |
| int32_t desired_capacity_hint, | | int32_t desired_capacity_hint, | |
| char* scratch, int32_t scratch_capacity, | | char* scratch, int32_t scratch_capacity, | |
| int32_t* result_capacity); | | int32_t* result_capacity); | |
| /** | | /** | |
| * Returns the number of bytes actually written to the sink. | | * Returns the number of bytes actually written to the sink. | |
| * @return number of bytes written to the buffer | | * @return number of bytes written to the buffer | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| int32_t NumberOfBytesWritten() const { return size_; } | | int32_t NumberOfBytesWritten() const { return size_; } | |
| /** | | /** | |
| * Returns true if any bytes were discarded, i.e., if there was an | | * Returns true if any bytes were discarded, i.e., if there was an | |
| * attempt to write more than 'capacity' bytes. | | * attempt to write more than 'capacity' bytes. | |
| * @return TRUE if more than 'capacity' bytes were Append()ed | | * @return TRUE if more than 'capacity' bytes were Append()ed | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool Overflowed() const { return overflowed_; } | | UBool Overflowed() const { return overflowed_; } | |
| private: | | private: | |
| char* outbuf_; | | char* outbuf_; | |
| const int32_t capacity_; | | const int32_t capacity_; | |
| int32_t size_; | | int32_t size_; | |
| bool overflowed_; | | bool overflowed_; | |
| CheckedArrayByteSink(); ///< default constructor not implemented | | CheckedArrayByteSink(); ///< default constructor not implemented | |
| CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor
not implemented | | CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor
not implemented | |
| CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assig
nment operator not implemented | | CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assig
nment operator not implemented | |
| }; | | }; | |
| | | | |
| #if U_HAVE_STD_STRING | | #if U_HAVE_STD_STRING | |
| | | | |
| /** | | /** | |
| * Implementation of ByteSink that writes to a "string". | | * Implementation of ByteSink that writes to a "string". | |
| * The StringClass is usually instantiated with a std::string. | | * The StringClass is usually instantiated with a std::string. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| template<typename StringClass> | | template<typename StringClass> | |
| class StringByteSink : public ByteSink { | | class StringByteSink : public ByteSink { | |
| public: | | public: | |
| /** | | /** | |
| * Constructs a ByteSink that will append bytes to the dest string. | | * Constructs a ByteSink that will append bytes to the dest string. | |
| * @param dest pointer to string object to append to | | * @param dest pointer to string object to append to | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringByteSink(StringClass* dest) : dest_(dest) { } | | StringByteSink(StringClass* dest) : dest_(dest) { } | |
| /** | | /** | |
| * Append "bytes[0,n-1]" to this. | | * Append "bytes[0,n-1]" to this. | |
| * @param bytes the pointer to the bytes | | * @param bytes the pointer to the bytes | |
| * @param n the number of bytes; must be non-negative | | * @param n the number of bytes; must be non-negative | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void Append(const char* data, int32_t n) { dest_->append(data, n)
; } | | virtual void Append(const char* data, int32_t n) { dest_->append(data, n)
; } | |
| private: | | private: | |
| StringClass* dest_; | | StringClass* dest_; | |
| StringByteSink(); ///< default constructor not implemented | | StringByteSink(); ///< default constructor not implemented | |
| StringByteSink(const StringByteSink &); ///< copy constructor not impleme
nted | | StringByteSink(const StringByteSink &); ///< copy constructor not impleme
nted | |
| StringByteSink &operator=(const StringByteSink &); ///< assignment operat
or not implemented | | StringByteSink &operator=(const StringByteSink &); ///< assignment operat
or not implemented | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 16 lines changed or deleted | | 16 lines changed or added | |
|
| currpinf.h | | currpinf.h | |
| /* | | /* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
|
| * Copyright (C) 2009, International Business Machines Corporation and
* | | * Copyright (C) 2009-2010, International Business Machines Corporation and
* | |
| * others. All Rights Reserved.
* | | * others. All Rights Reserved.
* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
| */ | | */ | |
| #ifndef CURRPINF_H | | #ifndef CURRPINF_H | |
| #define CURRPINF_H | | #define CURRPINF_H | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| * CurrencyPluralInfo from its locale data. | | * CurrencyPluralInfo from its locale data. | |
| * If you need to change any of these symbols, you can get the | | * If you need to change any of these symbols, you can get the | |
| * CurrencyPluralInfo object from your | | * CurrencyPluralInfo object from your | |
| * DecimalFormat and modify it. | | * DecimalFormat and modify it. | |
| * | | * | |
| * Following are the information needed for currency plural format and pars
e: | | * Following are the information needed for currency plural format and pars
e: | |
| * locale information, | | * locale information, | |
| * plural rule of the locale, | | * plural rule of the locale, | |
| * currency plural pattern of the locale. | | * currency plural pattern of the locale. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_I18N_API CurrencyPluralInfo : public UObject { | | class U_I18N_API CurrencyPluralInfo : public UObject { | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Create a CurrencyPluralInfo object for the default locale. | | * Create a CurrencyPluralInfo object for the default locale. | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CurrencyPluralInfo(UErrorCode& status); | | CurrencyPluralInfo(UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Create a CurrencyPluralInfo object for the given locale. | | * Create a CurrencyPluralInfo object for the given locale. | |
| * @param locale the locale | | * @param locale the locale | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CurrencyPluralInfo(const Locale& locale, UErrorCode& status); | | CurrencyPluralInfo(const Locale& locale, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Copy constructor | | * Copy constructor | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CurrencyPluralInfo(const CurrencyPluralInfo& info); | | CurrencyPluralInfo(const CurrencyPluralInfo& info); | |
| | | | |
| /** | | /** | |
| * Assignment operator | | * Assignment operator | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info); | | CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info); | |
| | | | |
| /** | | /** | |
| * Destructor | | * Destructor | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual ~CurrencyPluralInfo(); | | virtual ~CurrencyPluralInfo(); | |
| | | | |
| /** | | /** | |
| * Equal operator. | | * Equal operator. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool operator==(const CurrencyPluralInfo& info) const; | | UBool operator==(const CurrencyPluralInfo& info) const; | |
| | | | |
| /** | | /** | |
| * Not equal operator | | * Not equal operator | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool operator!=(const CurrencyPluralInfo& info) const; | | UBool operator!=(const CurrencyPluralInfo& info) const; | |
| | | | |
| /** | | /** | |
| * Clone | | * Clone | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| CurrencyPluralInfo* clone() const; | | CurrencyPluralInfo* clone() const; | |
| | | | |
| /** | | /** | |
| * Gets plural rules of this locale, used for currency plural format | | * Gets plural rules of this locale, used for currency plural format | |
| * | | * | |
| * @return plural rule | | * @return plural rule | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| const PluralRules* getPluralRules() const; | | const PluralRules* getPluralRules() const; | |
| | | | |
| /** | | /** | |
| * Given a plural count, gets currency plural pattern of this locale, | | * Given a plural count, gets currency plural pattern of this locale, | |
| * used for currency plural format | | * used for currency plural format | |
| * | | * | |
| * @param pluralCount currency plural count | | * @param pluralCount currency plural count | |
| * @param result output param to receive the pattern | | * @param result output param to receive the pattern | |
| * @return a currency plural pattern based on plural count | | * @return a currency plural pattern based on plural count | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCoun
t, | | UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCoun
t, | |
| UnicodeString& result) const; | | UnicodeString& result) const; | |
| | | | |
| /** | | /** | |
| * Get locale | | * Get locale | |
| * | | * | |
| * @return locale | | * @return locale | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| const Locale& getLocale() const; | | const Locale& getLocale() const; | |
| | | | |
| /** | | /** | |
| * Set plural rules. | | * Set plural rules. | |
| * The plural rule is set when CurrencyPluralInfo | | * The plural rule is set when CurrencyPluralInfo | |
| * instance is created. | | * instance is created. | |
| * You can call this method to reset plural rules only if you want | | * You can call this method to reset plural rules only if you want | |
| * to modify the default plural rule of the locale. | | * to modify the default plural rule of the locale. | |
| * | | * | |
| * @param ruleDescription new plural rule description | | * @param ruleDescription new plural rule description | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void setPluralRules(const UnicodeString& ruleDescription, | | void setPluralRules(const UnicodeString& ruleDescription, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Set currency plural pattern. | | * Set currency plural pattern. | |
| * The currency plural pattern is set when CurrencyPluralInfo | | * The currency plural pattern is set when CurrencyPluralInfo | |
| * instance is created. | | * instance is created. | |
| * You can call this method to reset currency plural pattern only if | | * You can call this method to reset currency plural pattern only if | |
| * you want to modify the default currency plural pattern of the locale
. | | * you want to modify the default currency plural pattern of the locale
. | |
| * | | * | |
| * @param pluralCount the plural count for which the currency pattern w
ill | | * @param pluralCount the plural count for which the currency pattern w
ill | |
| * be overridden. | | * be overridden. | |
| * @param pattern the new currency plural pattern | | * @param pattern the new currency plural pattern | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void setCurrencyPluralPattern(const UnicodeString& pluralCount, | | void setCurrencyPluralPattern(const UnicodeString& pluralCount, | |
| const UnicodeString& pattern, | | const UnicodeString& pattern, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Set locale | | * Set locale | |
| * | | * | |
| * @param loc the new locale to set | | * @param loc the new locale to set | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void setLocale(const Locale& loc, UErrorCode& status); | | void setLocale(const Locale& loc, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for the actual class. | | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID() const; | | virtual UClassID getDynamicClassID() const; | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for this class. | | * ICU "poor man's RTTI", returns a UClassID for this class. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(); | | static UClassID U_EXPORT2 getStaticClassID(); | |
| | | | |
| private: | | private: | |
| friend class DecimalFormat; | | friend class DecimalFormat; | |
| | | | |
| void initialize(const Locale& loc, UErrorCode& status); | | void initialize(const Locale& loc, UErrorCode& status); | |
| | | | |
| void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status); | | void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status); | |
| | | | |
| | | | |
End of changes. 18 change blocks. |
| 18 lines changed or deleted | | 18 lines changed or added | |
|
| datefmt.h | | datefmt.h | |
| /* | | /* | |
| **************************************************************************
****** | | **************************************************************************
****** | |
|
| * Copyright (C) 1997-2009, International Business Machines | | * Copyright (C) 1997-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| **************************************************************************
****** | | **************************************************************************
****** | |
| * | | * | |
| * File DATEFMT.H | | * File DATEFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 04/01/97 aliu Added support for centuries. | | * 04/01/97 aliu Added support for centuries. | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 231 | |
| * @param status Output param filled with success/failure status. | | * @param status Output param filled with success/failure status. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(const Formattable& obj, | | virtual UnicodeString& format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos, | | FieldPosition& pos, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
|
| | | * Format an object to produce a string. This method handles Formattabl | |
| | | e | |
| | | * 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 val | |
| | | ues | |
| | | * are defined in UDateFormatField. | |
| | | * @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 w
hich | | * Formats a date into a date/time string. This is an abstract method w
hich | |
| * concrete subclasses must implement. | | * concrete subclasses must implement. | |
| * <P> | | * <P> | |
| * On input, the FieldPosition parameter may have its "field" member fi
lled with | | * On input, the FieldPosition parameter may have its "field" member fi
lled with | |
| * an enum value specifying a field. On output, the FieldPosition will
be filled | | * an enum value specifying a field. On output, the FieldPosition will
be filled | |
| * in with the text offsets for that field. | | * in with the text offsets for that field. | |
| * <P> For example, given a time text | | * <P> For example, given a time text | |
| * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is | | * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is | |
| * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and | | * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and | |
| * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively
. | | * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively
. | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 287 | |
| * @param fieldPosition On input: an alignment field, if desired (see e
xamples above) | | * @param fieldPosition On input: an alignment field, if desired (see e
xamples above) | |
| * On output: the offsets of the alignment field (
see examples above) | | * On output: the offsets of the alignment field (
see examples above) | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.1 | | * @stable ICU 2.1 | |
| */ | | */ | |
| virtual UnicodeString& format( Calendar& cal, | | virtual UnicodeString& format( Calendar& cal, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& fieldPosition) const = 0
; | | 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 wil | |
| | | l | |
| | | * be inherited from the input calendar, but other cal | |
| | | endar | |
| | | * field values will be calculated by the internal cal | |
| | | endar. | |
| | | * @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 val | |
| | | ues | |
| | | * are defined in UDateFormatField. | |
| | | * @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. | | * Formats a UDate into a date/time string. | |
| * <P> | | * <P> | |
| * On input, the FieldPosition parameter may have its "field" member fi
lled with | | * On input, the FieldPosition parameter may have its "field" member fi
lled with | |
| * an enum value specifying a field. On output, the FieldPosition will
be filled | | * an enum value specifying a field. On output, the FieldPosition will
be filled | |
| * in with the text offsets for that field. | | * in with the text offsets for that field. | |
| * <P> For example, given a time text | | * <P> For example, given a time text | |
| * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is | | * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is | |
| * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and | | * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and | |
| * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively
. | | * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively
. | |
| * <P> Notice | | * <P> Notice | |
| | | | |
| skipping to change at line 299 | | skipping to change at line 340 | |
| * @param fieldPosition On input: an alignment field, if desired (see e
xamples above) | | * @param fieldPosition On input: an alignment field, if desired (see e
xamples above) | |
| * On output: the offsets of the alignment field (
see examples above) | | * On output: the offsets of the alignment field (
see examples above) | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format( UDate date, | | UnicodeString& format( UDate date, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& fieldPosition) const; | | 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 val | |
| | | ues | |
| | | * are defined in UDateFormatField. | |
| | | * @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 | | * 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 ta
kes a | | * know, using this method. Use the overloaded format() method which ta
kes a | |
| * FieldPosition& to detect formatting problems. | | * FieldPosition& to detect formatting problems. | |
| * | | * | |
| * @param date The UDate value to be formatted into a string. | | * @param date The UDate value to be formatted into a string. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 68 lines changed or added | |
|
| decimfmt.h | | decimfmt.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2009, International Business Machines | | * Copyright (C) 1997-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File DECIMFMT.H | | * File DECIMFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/20/97 clhuang Updated per C++ implementation. | | * 03/20/97 clhuang Updated per C++ implementation. | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Formats decimal numbers. | | * \brief C++ API: Formats decimal numbers. | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/dcfmtsym.h" | | #include "unicode/dcfmtsym.h" | |
| #include "unicode/numfmt.h" | | #include "unicode/numfmt.h" | |
| #include "unicode/locid.h" | | #include "unicode/locid.h" | |
|
| | | #include "unicode/fpositer.h" | |
| | | #include "unicode/stringpiece.h" | |
| | | | |
| union UHashTok; | | union UHashTok; | |
| | | | |
| U_NAMESPACE_BEGIN | | 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, UHashTo | | | |
| k val2) ; | | | |
| | | | |
| U_CDECL_END | | | |
| | | | |
| class DigitList; | | class DigitList; | |
| class ChoiceFormat; | | class ChoiceFormat; | |
| class CurrencyPluralInfo; | | class CurrencyPluralInfo; | |
| class Hashtable; | | class Hashtable; | |
|
| | | class FieldPositionHandler; | |
| | | | |
| /** | | /** | |
| * DecimalFormat is a concrete subclass of NumberFormat that formats decima
l | | * DecimalFormat is a concrete subclass of NumberFormat that formats decima
l | |
| * numbers. It has a variety of features designed to make it possible to pa
rse | | * numbers. It has a variety of features designed to make it possible to pa
rse | |
| * and format numbers in any locale, including support for Western, Arabic,
or | | * and format numbers in any locale, including support for Western, Arabic,
or | |
| * Indic digits. It also supports different flavors of numbers, including | | * Indic digits. It also supports different flavors of numbers, including | |
| * integers ("123"), fixed-point numbers ("123.4"), scientific notation | | * integers ("123"), fixed-point numbers ("123.4"), scientific notation | |
| * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", | | * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", | |
| * "123 US dollars"). All of these flavors can be easily localized. | | * "123 US dollars"). All of these flavors can be easily localized. | |
| * | | * | |
| | | | |
| skipping to change at line 851 | | skipping to change at line 840 | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(double number, | | virtual UnicodeString& format(double number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | 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. | |
| | | * @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. | | * Format a long number using base-10 representation. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(int32_t number, | | virtual UnicodeString& format(int32_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | 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. | |
| | | * @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. | | * Format an int64 number using base-10 representation. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| virtual UnicodeString& format(int64_t number, | | virtual UnicodeString& format(int64_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | 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. | |
| | | * @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. | |
| | | * @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 Formattable using base-10 representation. | | * Format a Formattable using base-10 representation. | |
| * | | * | |
| * @param obj The value to be formatted. | | * @param obj The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @param status Error code indicating success or failure. | | * @param status Error code indicating success or failure. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| | | | |
| skipping to change at line 1040 | | skipping to change at line 1102 | |
| * by the programmer or user. | | * by the programmer or user. | |
| * @param symbols DecimalFormatSymbols. | | * @param symbols DecimalFormatSymbols. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbol
s); | | virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbol
s); | |
| | | | |
| /** | | /** | |
| * Returns the currency plural format information, | | * Returns the currency plural format information, | |
| * which is generally not changed by the programmer or user. | | * which is generally not changed by the programmer or user. | |
| * @return desired CurrencyPluralInfo | | * @return desired CurrencyPluralInfo | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const; | | 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. | | * which is generally not changed by the programmer or user. | |
| * @param toAdopt CurrencyPluralInfo to be adopted. | | * @param toAdopt CurrencyPluralInfo to be adopted. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt); | | 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. | | * which is generally not changed by the programmer or user. | |
| * @param info Currency Plural Info. | | * @param info Currency Plural Info. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); | | virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); | |
| | | | |
| /** | | /** | |
| * Get the positive prefix. | | * Get the positive prefix. | |
| * | | * | |
| * @param result Output param which will receive the positive prefix
. | | * @param result Output param which will receive the positive prefix
. | |
| * @return A reference to 'result'. | | * @return A reference to 'result'. | |
| * Examples: +123, $123, sFr123 | | * Examples: +123, $123, sFr123 | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| | | | |
| skipping to change at line 1734 | | skipping to change at line 1796 | |
| * clone() methods call this method. | | * clone() methods call this method. | |
| * | | * | |
| * @return The class ID for this object. All objects of a | | * @return The class ID for this object. All objects of a | |
| * given class have the same class ID. Objects of | | * given class have the same class ID. Objects of | |
| * other classes have different class IDs. | | * other classes have different class IDs. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID(void) const; | | virtual UClassID getDynamicClassID(void) const; | |
| | | | |
| private: | | private: | |
|
| friend UBool U_CALLCONV decimfmtAffixValueComparator(UHashTok val1, UHa | | | |
| shTok val2); | | | |
| friend UBool U_CALLCONV decimfmtAffixPatternValueComparator(UHashTok va | | | |
| l1, UHashTok val2); | | | |
| | | | |
| DecimalFormat(); // default constructor not implemented | | DecimalFormat(); // default constructor not implemented | |
| | | | |
| int32_t precision(UBool isIntegral) const; | | int32_t precision(UBool isIntegral) const; | |
| | | | |
| /** | | /** | |
| * Do real work of constructing a new DecimalFormat. | | * Do real work of constructing a new DecimalFormat. | |
| */ | | */ | |
| void construct(UErrorCode& status, | | void construct(UErrorCode& status, | |
| UParseError& parseErr, | | UParseError& parseErr, | |
| | | | |
| skipping to change at line 1802 | | skipping to change at line 1862 | |
| /* | | /* | |
| * expand affixes (after apply patter) and re-compute fFormatWidth | | * expand affixes (after apply patter) and re-compute fFormatWidth | |
| */ | | */ | |
| void expandAffixAdjustWidth(const UnicodeString* pluralCount); | | void expandAffixAdjustWidth(const UnicodeString* pluralCount); | |
| | | | |
| /** | | /** | |
| * Do the work of formatting a number, either a double or a long. | | * Do the work of formatting a number, either a double or a long. | |
| * | | * | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
|
| * @param fieldPosition On input: an alignment field, if desired. | | * @param handler Records information about field positions. | |
| * On output: the offsets of the alignment field. | | | |
| * @param digits the digits to be formatted. | | * @param digits the digits to be formatted. | |
| * @param isInteger if TRUE format the digits as Integer. | | * @param isInteger if TRUE format the digits as Integer. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| */ | | */ | |
| UnicodeString& subformat(UnicodeString& appendTo, | | UnicodeString& subformat(UnicodeString& appendTo, | |
|
| FieldPosition& fieldPosition, | | FieldPositionHandler& handler, | |
| DigitList& digits, | | DigitList& digits, | |
| UBool isInteger) const; | | UBool isInteger) const; | |
| | | | |
| void parse(const UnicodeString& text, | | void parse(const UnicodeString& text, | |
| Formattable& result, | | Formattable& result, | |
| ParsePosition& pos, | | ParsePosition& pos, | |
| UBool parseCurrency) const; | | UBool parseCurrency) const; | |
| | | | |
| enum { | | enum { | |
| fgStatusInfinite, | | fgStatusInfinite, | |
| fgStatusLength // Leave last in list. | | fgStatusLength // Leave last in list. | |
| } StatusFlags; | | } StatusFlags; | |
| | | | |
| skipping to change at line 1881 | | skipping to change at line 1940 | |
| | | | |
| static int32_t match(const UnicodeString& text, int32_t pos, const Unic
odeString& str); | | static int32_t match(const UnicodeString& text, int32_t pos, const Unic
odeString& str); | |
| | | | |
| /** | | /** | |
| * Get a decimal format symbol. | | * Get a decimal format symbol. | |
| * Returns a const reference to the symbol string. | | * Returns a const reference to the symbol string. | |
| * @internal | | * @internal | |
| */ | | */ | |
| inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumbe
rFormatSymbol symbol) const; | | inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumbe
rFormatSymbol symbol) const; | |
| | | | |
|
| int32_t appendAffix(UnicodeString& buf, double number, | | int32_t appendAffix(UnicodeString& buf, | |
| UBool isNegative, UBool isPrefix) const; | | double number, | |
| | | FieldPositionHandler& handler, | |
| | | UBool isNegative, | |
| | | UBool isPrefix) const; | |
| | | | |
| /** | | /** | |
| * Append an affix to the given UnicodeString, using quotes if | | * Append an affix to the given UnicodeString, using quotes if | |
| * there are special characters. Single quotes themselves must be | | * there are special characters. Single quotes themselves must be | |
| * escaped in either case. | | * escaped in either case. | |
| */ | | */ | |
| void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& a
ffix, | | void appendAffixPattern(UnicodeString& appendTo, const UnicodeString& a
ffix, | |
| UBool localized) const; | | UBool localized) const; | |
| | | | |
| void appendAffixPattern(UnicodeString& appendTo, | | void appendAffixPattern(UnicodeString& appendTo, | |
| const UnicodeString* affixPattern, | | const UnicodeString* affixPattern, | |
| const UnicodeString& expAffix, UBool localized)
const; | | const UnicodeString& expAffix, UBool localized)
const; | |
| | | | |
| void expandAffix(const UnicodeString& pattern, | | void expandAffix(const UnicodeString& pattern, | |
| UnicodeString& affix, | | UnicodeString& affix, | |
| double number, | | double number, | |
|
| | | FieldPositionHandler& handler, | |
| UBool doFormat, | | UBool doFormat, | |
| const UnicodeString* pluralCount) const; | | const UnicodeString* pluralCount) const; | |
| | | | |
| void expandAffixes(const UnicodeString* pluralCount); | | void expandAffixes(const UnicodeString* pluralCount); | |
| | | | |
| static double round(double a, ERoundingMode mode, UBool isNegative); | | static double round(double a, ERoundingMode mode, UBool isNegative); | |
| | | | |
| void addPadding(UnicodeString& appendTo, | | void addPadding(UnicodeString& appendTo, | |
|
| FieldPosition& fieldPosition, | | FieldPositionHandler& handler, | |
| int32_t prefixLen, int32_t suffixLen) const; | | int32_t prefixLen, int32_t suffixLen) const; | |
| | | | |
| UBool isGroupingPosition(int32_t pos) const; | | UBool isGroupingPosition(int32_t pos) const; | |
| | | | |
| void setCurrencyForSymbols(); | | void setCurrencyForSymbols(); | |
| | | | |
| // similar to setCurrency without re-compute the affixes for currency. | | // similar to setCurrency without re-compute the affixes for currency. | |
| // If currency changes, the affix pattern for currency is not changed, | | // 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(). | | // re-computed in setCurrency(), but not in setCurrencyInternally(). | |
| | | | |
| skipping to change at line 1947 | | skipping to change at line 2010 | |
| Hashtable* initHashForAffix(UErrorCode& status); | | Hashtable* initHashForAffix(UErrorCode& status); | |
| | | | |
| void deleteHashForAffixPattern(); | | void deleteHashForAffixPattern(); | |
| void deleteHashForAffix(Hashtable*& table); | | void deleteHashForAffix(Hashtable*& table); | |
| | | | |
| void copyHashForAffixPattern(const Hashtable* source, | | void copyHashForAffixPattern(const Hashtable* source, | |
| Hashtable* target, UErrorCode& status); | | Hashtable* target, UErrorCode& status); | |
| void copyHashForAffix(const Hashtable* source, | | void copyHashForAffix(const Hashtable* source, | |
| Hashtable* target, UErrorCode& status); | | Hashtable* target, UErrorCode& status); | |
| | | | |
|
| | | UnicodeString& _format(int64_t number, | |
| | | UnicodeString& appendTo, | |
| | | FieldPositionHandler& handler) const; | |
| | | UnicodeString& _format(double number, | |
| | | UnicodeString& appendTo, | |
| | | FieldPositionHandler& handler) const; | |
| | | | |
| // currency sign count | | // currency sign count | |
| enum { | | enum { | |
| fgCurrencySignCountZero, | | fgCurrencySignCountZero, | |
| fgCurrencySignCountInSymbolFormat, | | fgCurrencySignCountInSymbolFormat, | |
| fgCurrencySignCountInISOFormat, | | fgCurrencySignCountInISOFormat, | |
| fgCurrencySignCountInPluralFormat | | fgCurrencySignCountInPluralFormat | |
| } CurrencySignCount; | | } CurrencySignCount; | |
| | | | |
| /** | | /** | |
| * Constants. | | * Constants. | |
| | | | |
| skipping to change at line 2031 | | skipping to change at line 2101 | |
| */ | | */ | |
| int fCurrencySignCount; | | int fCurrencySignCount; | |
| | | | |
| /* For currency parsing purose, | | /* For currency parsing purose, | |
| * Need to remember all prefix patterns and suffix patterns of | | * Need to remember all prefix patterns and suffix patterns of | |
| * every currency format pattern, | | * every currency format pattern, | |
| * including the pattern of default currecny style | | * including the pattern of default currecny style | |
| * and plural currency style. And the patterns are set through applyPat
tern. | | * and plural currency style. And the patterns are set through applyPat
tern. | |
| */ | | */ | |
| // TODO: innerclass? | | // TODO: innerclass? | |
|
| | | /* This is not needed in the class declaration, so it is moved into
decimfmp.cpp | |
| struct AffixPatternsForCurrency : public UMemory { | | struct AffixPatternsForCurrency : public UMemory { | |
| // negative prefix pattern | | // negative prefix pattern | |
| UnicodeString negPrefixPatternForCurrency; | | UnicodeString negPrefixPatternForCurrency; | |
| // negative suffix pattern | | // negative suffix pattern | |
| UnicodeString negSuffixPatternForCurrency; | | UnicodeString negSuffixPatternForCurrency; | |
| // positive prefix pattern | | // positive prefix pattern | |
| UnicodeString posPrefixPatternForCurrency; | | UnicodeString posPrefixPatternForCurrency; | |
| // positive suffix pattern | | // positive suffix pattern | |
| UnicodeString posSuffixPatternForCurrency; | | UnicodeString posSuffixPatternForCurrency; | |
| int8_t patternType; | | int8_t patternType; | |
| | | | |
| skipping to change at line 2054 | | skipping to change at line 2125 | |
| const UnicodeString& posPrefix, | | const UnicodeString& posPrefix, | |
| const UnicodeString& posSuffix, | | const UnicodeString& posSuffix, | |
| int8_t type) { | | int8_t type) { | |
| negPrefixPatternForCurrency = negPrefix; | | negPrefixPatternForCurrency = negPrefix; | |
| negSuffixPatternForCurrency = negSuffix; | | negSuffixPatternForCurrency = negSuffix; | |
| posPrefixPatternForCurrency = posPrefix; | | posPrefixPatternForCurrency = posPrefix; | |
| posSuffixPatternForCurrency = posSuffix; | | posSuffixPatternForCurrency = posSuffix; | |
| patternType = type; | | patternType = type; | |
| } | | } | |
| }; | | }; | |
|
| | | */ | |
| | | | |
| /* affix for currency formatting when the currency sign in the pattern | | /* 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. | | * 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 { | | struct AffixesForCurrency : public UMemory { | |
| // negative prefix | | // negative prefix | |
| UnicodeString negPrefixForCurrency; | | UnicodeString negPrefixForCurrency; | |
| // negative suffix | | // negative suffix | |
| UnicodeString negSuffixForCurrency; | | UnicodeString negSuffixForCurrency; | |
| // positive prefix | | // positive prefix | |
| UnicodeString posPrefixForCurrency; | | UnicodeString posPrefixForCurrency; | |
| // positive suffix | | // positive suffix | |
| UnicodeString posSuffixForCurrency; | | UnicodeString posSuffixForCurrency; | |
| | | | |
| | | | |
| skipping to change at line 2081 | | skipping to change at line 2154 | |
| AffixesForCurrency(const UnicodeString& negPrefix, | | AffixesForCurrency(const UnicodeString& negPrefix, | |
| const UnicodeString& negSuffix, | | const UnicodeString& negSuffix, | |
| const UnicodeString& posPrefix, | | const UnicodeString& posPrefix, | |
| const UnicodeString& posSuffix) { | | const UnicodeString& posSuffix) { | |
| negPrefixForCurrency = negPrefix; | | negPrefixForCurrency = negPrefix; | |
| negSuffixForCurrency = negSuffix; | | negSuffixForCurrency = negSuffix; | |
| posPrefixForCurrency = posPrefix; | | posPrefixForCurrency = posPrefix; | |
| posSuffixForCurrency = posSuffix; | | posSuffixForCurrency = posSuffix; | |
| } | | } | |
| }; | | }; | |
|
| | | */ | |
| | | | |
| // Affix pattern set for currency. | | // Affix pattern set for currency. | |
| // It is a set of AffixPatternsForCurrency, | | // It is a set of AffixPatternsForCurrency, | |
| // each element of the set saves the negative prefix pattern, | | // 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. | | // and positive suffix pattern of a pattern. | |
| // It is used for currency mixed style parsing. | | // It is used for currency mixed style parsing. | |
| // It is actually is a set. | | // It is actually is a set. | |
| // The set contains the default currency pattern from the locale, | | // The set contains the default currency pattern from the locale, | |
| // and the currency plural patterns. | | // and the currency plural patterns. | |
| | | | |
End of changes. 21 change blocks. |
| 32 lines changed or deleted | | 102 lines changed or added | |
|
| dtptngen.h | | dtptngen.h | |
| | | | |
| skipping to change at line 255 | | skipping to change at line 255 | |
| * For example, "MMMdd" and "mmhh" are skeletons. | | * For example, "MMMdd" and "mmhh" are skeletons. | |
| * @param status Output param set to success/failure code on exit, | | * @param status Output param set to success/failure code on exit, | |
| * which must not indicate a failure before the function
call. | | * which must not indicate a failure before the function
call. | |
| * @return bestPattern | | * @return bestPattern | |
| * The best pattern found from the given skeleton. | | * The best pattern found from the given skeleton. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode
& status); | | UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode
& status); | |
| | | | |
| /** | | /** | |
|
| | | * Return the best pattern matching the input skeleton. It is guarantee | |
| | | d to | |
| | | * have all of the fields in the skeleton. | |
| | | * | |
| | | * @param skeleton | |
| | | * The skeleton is a pattern containing only the variable fi | |
| | | elds. | |
| | | * 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 thi | |
| | | s | |
| | | * 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 cal | |
| | | l. | |
| | | * @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 wh
at is | | * Adjusts the field types (width and subtype) of a pattern to match wh
at is | |
| * in a skeleton. That is, if you supply a pattern like "d-M H:m", and
a | | * 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 | | * 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 t
he | | * "dd-MMMM hh:mm". This is used internally to get the best match for t
he | |
| * input skeleton, but can also be used externally. | | * input skeleton, but can also be used externally. | |
| * | | * | |
| * @param pattern Input pattern | | * @param pattern Input pattern | |
| * @param skeleton | | * @param skeleton | |
| * The skeleton is a pattern containing only the variable fi
elds. | | * The skeleton is a pattern containing only the variable fi
elds. | |
| * For example, "MMMdd" and "mmhh" are skeletons. | | * For example, "MMMdd" and "mmhh" are skeletons. | |
| * @param status Output param set to success/failure code on exit, | | * @param status Output param set to success/failure code on exit, | |
| * which must not indicate a failure before the function
call. | | * which must not indicate a failure before the function
call. | |
| * @return pattern adjusted to match the skeleton fields widths and sub
types. | | * @return pattern adjusted to match the skeleton fields widths and sub
types. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| UnicodeString replaceFieldTypes(const UnicodeString& pattern, | | UnicodeString replaceFieldTypes(const UnicodeString& pattern, | |
| const UnicodeString& skeleton, | | const UnicodeString& skeleton, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
|
| | | * Adjusts the field types (width and subtype) of a pattern to match wh | |
| | | at 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 t | |
| | | he | |
| | | * input skeleton, but can also be used externally. | |
| | | * | |
| | | * @param pattern Input pattern | |
| | | * @param skeleton | |
| | | * The skeleton is a pattern containing only the variable fi | |
| | | elds. | |
| | | * For example, "MMMdd" and "mmhh" are skeletons. | |
| | | * @param options | |
| | | * Options controlling whether the length of specified field | |
| | | s 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 cal | |
| | | l. | |
| | | * @return pattern adjusted to match the skeleton fields widths and sub | |
| | | types. | |
| | | * @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 cla
ss. | | * Return a list of all the skeletons (in canonical form) from this cla
ss. | |
| * | | * | |
| * Call getPatternForSkeleton() to get the corresponding pattern. | | * Call getPatternForSkeleton() to get the corresponding pattern. | |
| * | | * | |
| * @param status Output param set to success/failure code on exit, | | * @param status Output param set to success/failure code on exit, | |
| * which must not indicate a failure before the function
call. | | * which must not indicate a failure before the function
call. | |
| * @return StringEnumeration with the skeletons. | | * @return StringEnumeration with the skeletons. | |
| * The caller must delete the object. | | * The caller must delete the object. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| | | | |
| skipping to change at line 410 | | skipping to change at line 460 | |
| void addCLDRData(const Locale& locale, UErrorCode& status); | | void addCLDRData(const Locale& locale, UErrorCode& status); | |
| UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pa
ttern, const UnicodeString * skeletonToUse, UBool override, UnicodeString&
conflictingPattern, UErrorCode& status); | | UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pa
ttern, const UnicodeString * skeletonToUse, UBool override, UnicodeString&
conflictingPattern, UErrorCode& status); | |
| void initHashtable(UErrorCode& status); | | void initHashtable(UErrorCode& status); | |
| void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status); | | void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status); | |
| void setDecimalSymbols(const Locale& locale, UErrorCode& status); | | void setDecimalSymbols(const Locale& locale, UErrorCode& status); | |
| UDateTimePatternField getAppendFormatNumber(const char* field) const; | | UDateTimePatternField getAppendFormatNumber(const char* field) const; | |
| UDateTimePatternField getAppendNameNumber(const char* field) const; | | UDateTimePatternField getAppendNameNumber(const char* field) const; | |
| void getAppendName(UDateTimePatternField field, UnicodeString& value); | | void getAppendName(UDateTimePatternField field, UnicodeString& value); | |
| int32_t getCanonicalIndex(const UnicodeString& field); | | int32_t getCanonicalIndex(const UnicodeString& field); | |
| const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includ
eMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPt
r = 0); | | const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includ
eMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPt
r = 0); | |
|
| UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnS | | UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnS | |
| keleton* specifiedSkeleton, UBool fixFractionalSeconds); | | keleton* specifiedSkeleton, UBool fixFractionalSeconds, UDateTimePatternMat | |
| UnicodeString getBestAppending(int32_t missingFields); | | chOptions options = UDATPG_MATCH_NO_OPTIONS); | |
| | | UnicodeString getBestAppending(int32_t missingFields, UDateTimePatternM | |
| | | atchOptions options = UDATPG_MATCH_NO_OPTIONS); | |
| int32_t getTopBitNumber(int32_t foundMask); | | int32_t getTopBitNumber(int32_t foundMask); | |
| void setAvailableFormat(const UnicodeString &key, UErrorCode& status); | | void setAvailableFormat(const UnicodeString &key, UErrorCode& status); | |
| UBool isAvailableFormatSet(const UnicodeString &key) const; | | UBool isAvailableFormatSet(const UnicodeString &key) const; | |
| void copyHashtable(Hashtable *other, UErrorCode &status); | | void copyHashtable(Hashtable *other, UErrorCode &status); | |
| UBool isCanonicalItem(const UnicodeString& item) const; | | UBool isCanonicalItem(const UnicodeString& item) const; | |
| } ;// end class DateTimePatternGenerator | | } ;// end class DateTimePatternGenerator | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 67 lines changed or added | |
|
| fmtable.h | | fmtable.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2006, International Business Machines | | * Copyright (C) 1997-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File FMTABLE.H | | * File FMTABLE.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/29/97 aliu Creation. | | * 02/29/97 aliu Creation. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| */ | | */ | |
| #ifndef FMTABLE_H | | #ifndef FMTABLE_H | |
| #define FMTABLE_H | | #define FMTABLE_H | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| #include "unicode/unistr.h" | | #include "unicode/unistr.h" | |
|
| | | #include "unicode/stringpiece.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Formattable is a thin wrapper for primitive numeric type
s. | | * \brief C++ API: Formattable is a thin wrapper for primitive numeric type
s. | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 108 | |
| /** | | /** | |
| * Creates a Formattable object with a char string pointer. | | * Creates a Formattable object with a char string pointer. | |
| * Assumes that the char string is null terminated. | | * Assumes that the char string is null terminated. | |
| * @param strToCopy the char string. | | * @param strToCopy the char string. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| Formattable(const char* strToCopy); | | Formattable(const char* strToCopy); | |
| #endif | | #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_FO | |
| | | RMAT_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 fro
m. | | * Creates a Formattable object with a UnicodeString object to copy fro
m. | |
| * @param strToCopy the UnicodeString string. | | * @param strToCopy the UnicodeString string. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| Formattable(const UnicodeString& strToCopy); | | Formattable(const UnicodeString& strToCopy); | |
| | | | |
| /** | | /** | |
| * Creates a Formattable object with a UnicodeString object to adopt fr
om. | | * Creates a Formattable object with a UnicodeString object to adopt fr
om. | |
| * @param strToAdopt the UnicodeString string. | | * @param strToAdopt the UnicodeString string. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| | | | |
| skipping to change at line 249 | | skipping to change at line 266 | |
| | | | |
| /** | | /** | |
| * Gets the data type of this Formattable object. | | * Gets the data type of this Formattable object. | |
| * @return the data type of this Formattable object. | | * @return the data type of this Formattable object. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| Type getType(void) const; | | Type getType(void) const; | |
| | | | |
| /** | | /** | |
| * Returns TRUE if the data type of this Formattable object | | * 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 | | * @return TRUE if this is a pure numeric object | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| UBool isNumeric() const; | | UBool isNumeric() const; | |
| | | | |
| /** | | /** | |
| * Gets the double value of this object. If this object is not of type | | * Gets the double value of this object. If this object is not of type | |
| * kDouble then the result is undefined. | | * kDouble then the result is undefined. | |
| * @return the double value of this object. | | * @return the double value of this object. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| double getDouble(void) const { return fValue.fDouble; } | | double getDouble(void) const { return fValue.fDouble; } | |
| | | | |
| /** | | /** | |
| * Gets the double value of this object. If this object is of type | | * 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 | | * possible loss of precision. If the type is kObject and the | |
| * object is a Measure, then the result of | | * object is a Measure, then the result of | |
| * getNumber().getDouble(status) is returned. If this object is | | * getNumber().getDouble(status) is returned. If this object is | |
| * neither a numeric type nor a Measure, then 0 is returned and | | * neither a numeric type nor a Measure, then 0 is returned and | |
| * the status is set to U_INVALID_FORMAT_ERROR. | | * the status is set to U_INVALID_FORMAT_ERROR. | |
| * @param status the error code | | * @param status the error code | |
| * @return the double value of this object. | | * @return the double value of this object. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| double getDouble(UErrorCode& status) const; | | double getDouble(UErrorCode& status) const; | |
| | | | |
| skipping to change at line 291 | | skipping to change at line 308 | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| int32_t getLong(void) const { return (int32_t)fValue.fInt64; } | | int32_t getLong(void) const { return (int32_t)fValue.fInt64; } | |
| | | | |
| /** | | /** | |
| * Gets the long value of this object. If the magnitude is too | | * Gets the long value of this object. If the magnitude is too | |
| * large to fit in a long, then the maximum or minimum long value, | | * large to fit in a long, then the maximum or minimum long value, | |
| * as appropriate, is returned and the status is set to | | * as appropriate, is returned and the status is set to | |
| * U_INVALID_FORMAT_ERROR. If this object is of type kInt64 and | | * 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 | | * 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 | | * truncation of any fractional part. If the type is kObject and | |
| * the object is a Measure, then the result of | | * the object is a Measure, then the result of | |
| * getNumber().getLong(status) is returned. If this object is | | * getNumber().getLong(status) is returned. If this object is | |
| * neither a numeric type nor a Measure, then 0 is returned and | | * neither a numeric type nor a Measure, then 0 is returned and | |
| * the status is set to U_INVALID_FORMAT_ERROR. | | * the status is set to U_INVALID_FORMAT_ERROR. | |
| * @param status the error code | | * @param status the error code | |
| * @return the long value of this object. | | * @return the long value of this object. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| int32_t getLong(UErrorCode& status) const; | | int32_t getLong(UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
| * Gets the int64 value of this object. If this object is not of type | | * Gets the int64 value of this object. If this object is not of type | |
| * kInt64 then the result is undefined. | | * kInt64 then the result is undefined. | |
| * @return the int64 value of this object. | | * @return the int64 value of this object. | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| int64_t getInt64(void) const { return fValue.fInt64; } | | int64_t getInt64(void) const { return fValue.fInt64; } | |
| | | | |
| /** | | /** | |
|
| * Gets the int64 value of this object. If this object is of type | | * Gets the int64 value of this object. If this object is of a numeric | |
| * kDouble and the magnitude is too large to fit in an int64, then | | * type and the magnitude is too large to fit in an int64, then | |
| * the maximum or minimum int64 value, as appropriate, is returned | | * the maximum or minimum int64 value, as appropriate, is returned | |
| * and the status is set to U_INVALID_FORMAT_ERROR. If the | | * and the status is set to U_INVALID_FORMAT_ERROR. If the | |
| * magnitude fits in an int64, then a casting conversion is | | * magnitude fits in an int64, then a casting conversion is | |
| * peformed, with truncation of any fractional part. If the type | | * peformed, with truncation of any fractional part. If the type | |
| * is kObject and the object is a Measure, then the result of | | * is kObject and the object is a Measure, then the result of | |
| * getNumber().getDouble(status) is returned. If this object is | | * getNumber().getDouble(status) is returned. If this object is | |
| * neither a numeric type nor a Measure, then 0 is returned and | | * neither a numeric type nor a Measure, then 0 is returned and | |
| * the status is set to U_INVALID_FORMAT_ERROR. | | * the status is set to U_INVALID_FORMAT_ERROR. | |
| * @param status the error code | | * @param status the error code | |
| * @return the int64 value of this object. | | * @return the int64 value of this object. | |
| | | | |
| skipping to change at line 444 | | skipping to change at line 461 | |
| | | | |
| /** | | /** | |
| * Returns a pointer to the UObject contained within this | | * Returns a pointer to the UObject contained within this | |
| * formattable, or NULL if this object does not contain a UObject. | | * formattable, or NULL if this object does not contain a UObject. | |
| * @return a UObject pointer, or NULL | | * @return a UObject pointer, or NULL | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| const UObject* getObject() const; | | const UObject* getObject() const; | |
| | | | |
| /** | | /** | |
|
| | | * Returns a numeric string representation of the number contained with | |
| | | in 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. | |
| | | * | |
| | | * @return the unformatted string representation of a number. | |
| | | * @draft ICU 4.4 | |
| | | */ | |
| | | const StringPiece &getDecimalNumber() const; | |
| | | | |
| | | /** | |
| * Sets the double value of this object and changes the type to | | * Sets the double value of this object and changes the type to | |
| * kDouble. | | * kDouble. | |
| * @param d the new double value to be set. | | * @param d the new double value to be set. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| void setDouble(double d); | | void setDouble(double d); | |
| | | | |
| /** | | /** | |
| * Sets the long value of this object and changes the type to | | * Sets the long value of this object and changes the type to | |
| * kLong. | | * kLong. | |
| | | | |
| skipping to change at line 517 | | skipping to change at line 546 | |
| /** | | /** | |
| * Sets and adopts the UObject value of this object and changes | | * Sets and adopts the UObject value of this object and changes | |
| * the type to kObject. After this call, the caller must not | | * the type to kObject. After this call, the caller must not | |
| * delete the given object. | | * delete the given object. | |
| * @param objectToAdopt the UObject value to be adopted | | * @param objectToAdopt the UObject value to be adopted | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| void adoptObject(UObject* objectToAdopt); | | 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 deci | |
| | | mal 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. | | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
| * | | * | |
| * @stable ICU 2.2 | | * @stable ICU 2.2 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID() const; | | virtual UClassID getDynamicClassID() const; | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for this class. | | * ICU "poor man's RTTI", returns a UClassID for this class. | |
| * | | * | |
| * @stable ICU 2.2 | | * @stable ICU 2.2 | |
| | | | |
End of changes. 9 change blocks. |
| 6 lines changed or deleted | | 58 lines changed or added | |
|
| msgfmt.h | | msgfmt.h | |
| /* | | /* | |
|
| * Copyright (C) 2007-2009, International Business Machines Corporation and | | * Copyright (C) 2007-2010, International Business Machines Corporation and | |
| others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File MSGFMT.H | | * File MSGFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/20/97 helena Finished first cut of implementation. | | * 03/20/97 helena Finished first cut of implementation. | |
| * 07/22/98 stephen Removed operator!= (defined in Format) | | * 07/22/98 stephen Removed operator!= (defined in Format) | |
| * 08/19/2002 srl Removing Javaisms | | * 08/19/2002 srl Removing Javaisms | |
|
| *************************************************************************** | | *************************************************************************** | |
| ***** | | ****/ | |
| */ | | | |
| | | | |
| #ifndef MSGFMT_H | | #ifndef MSGFMT_H | |
| #define MSGFMT_H | | #define MSGFMT_H | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Formats messages in a language-neutral way. | | * \brief C++ API: Formats messages in a language-neutral way. | |
| */ | | */ | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| #include "unicode/parseerr.h" | | #include "unicode/parseerr.h" | |
| #include "unicode/uchar.h" | | #include "unicode/uchar.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class NumberFormat; | | class NumberFormat; | |
| class DateFormat; | | class DateFormat; | |
| | | | |
| /** | | /** | |
| * | | * | |
|
| * A MessageFormat produces concatenated messages in a | | * MessageFormat produces concatenated messages in a language-neutral | |
| * language-neutral way. It should be used for all string | | * way. Use this whenever concatenating strings that are displayed to | |
| * concatenations that are visible to end users. | | * end users. | |
| * <P> | | * | |
| * A MessageFormat contains an array of <EM>subformats</EM> arranged | | * <P>A MessageFormat contains an array of <EM>subformats</EM> arranged | |
| * within a <EM>template string</EM>. Together, the subformats and | | * within a <EM>template string</EM>. Together, the subformats and | |
| * template string determine how the MessageFormat will operate during | | * template string determine how the MessageFormat will operate during | |
| * formatting and parsing. | | * 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 | | * specified at once in a <EM>pattern</EM>. By using different | |
| * patterns for different locales, messages may be localized. | | * 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 | | * and produces a user-readable string. Each argument is a | |
| * Formattable object; they may be passed in in an array, or as a | | * Formattable object; they may be passed in in an array, or as a | |
| * single Formattable object which itself contains an array. Each | | * single Formattable object which itself contains an array. Each | |
| * argument is matched up with its corresponding subformat, which then | | * 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 | | * within the string template of the MessageFormat to produce the | |
| * final output string. | | * final output string. | |
|
| * <p> | | * | |
| * <strong>Note:</strong> | | * <p><strong>Note:</strong> | |
| * In ICU 4.0 MessageFormat supports named arguments. If a named argument | | * 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 | | * is used, all arguments must be named. Names start with a character in | |
| * <code>UCHAR_ID_START</code> and continue with characters in | | * <code>UCHAR_ID_START</code> and continue with characters in | |
| * <code>UCHARID_CONTINUE</code>, in particular they do not start with a di
git. | | * <code>UCHARID_CONTINUE</code>, in particular they do not start with a di
git. | |
| * If named arguments are used, {@link #usesNamedArguments()} will return t
rue. | | * If named arguments are used, {@link #usesNamedArguments()} will return t
rue. | |
|
| * <p> | | * | |
| * The other new methods supporting named arguments are | | * <p>The other new methods supporting named arguments are | |
| * {@link #getFormatNames(UErrorCode& status)}, | | * {@link #getFormatNames(UErrorCode& status)}, | |
| * {@link #getFormat(const UnicodeString& formatName, UErrorCode& status)} | | * {@link #getFormat(const UnicodeString& formatName, UErrorCode& status)} | |
| * {@link #setFormat(const UnicodeString& formatName, const Format& format,
UErrorCode& status)}, | | * {@link #setFormat(const UnicodeString& formatName, const Format& format,
UErrorCode& status)}, | |
| * {@link #adoptFormat(const UnicodeString& formatName, Format* formatToAdo
pt, UErrorCode& status)}, | | * {@link #adoptFormat(const UnicodeString& formatName, Format* formatToAdo
pt, UErrorCode& status)}, | |
|
| * {@link #format(const Formattable* arguments, const UnicodeString *argume | | * {@link #format(const UnicodeString* argumentNames, const Formattable* ar | |
| ntNames, int32_t cnt, UnicodeString& appendTo, FieldPosition& status, int32 | | guments, | |
| _t recursionProtection, UErrorCode& success)}, | | * int32_t count, UnicodeString& appendTo,UErrorCode& status)}. | |
| * {@link #format(const UnicodeString* argumentNames, const Formattable* ar | | | |
| guments, int32_t count, UnicodeString& appendTo,UErrorCode& status)}. | | | |
| * These methods are all compatible with patterns that do not used named ar
guments-- | | * These methods are all compatible with patterns that do not used named ar
guments-- | |
| * in these cases the keys in the input or output use <code>UnicodeString</
code>s | | * 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. | | * that name the argument indices, e.g. "0", "1", "2"... etc. | |
|
| * <p> | | * | |
| * When named arguments are used, certain methods on MessageFormat that tak | | * <p>If this format uses named arguments, certain methods that take or | |
| e or | | | |
| * return arrays do not perform any action, since it is not possible to | | * 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 | | * identify positions in an array using a name. Of these methods, | |
| * U_ARGUMENT_TYPE_MISMATCH if there is a status/success field in the metho | | * UErrorCode is set to U_ILLEGAL_ARGUMENT_ERROR by format, and to | |
| d. | | * U_ARGUMENT_TYPE_MISMATCH by parse. | |
| * These methods are | | * These methods are | |
| * {@link #adoptFormats(Format** formatsToAdopt, int32_t count)}, | | * {@link #adoptFormats(Format** formatsToAdopt, int32_t count)}, | |
| * {@link #setFormats(const Format** newFormats,int32_t count)}, | | * {@link #setFormats(const Format** newFormats,int32_t count)}, | |
| * {@link #adoptFormat(int32_t n, Format *newFormat)}, | | * {@link #adoptFormat(int32_t n, Format *newFormat)}, | |
|
| * {@link #getFormats(int32_t& count)}, | | * {@link #setFormat(int32_t n, Format& newFormat)}, | |
| * {@link #format(const Formattable* source,int32_t cnt,UnicodeString& appe | | * {@link #format(const Formattable* source, int32_t count, UnicodeString& | |
| ndTo, FieldPosition& ignore, UErrorCode& success)}, | | appendTo, FieldPosition& ignore, UErrorCode& success)}, | |
| * {@link #format(const UnicodeString& pattern,const Formattable* arguments
,int32_t cnt,UnicodeString& appendTo,UErrorCode& success)}, | | * {@link #format(const UnicodeString& pattern,const Formattable* arguments
,int32_t cnt,UnicodeString& appendTo,UErrorCode& success)}, | |
|
| * {@link #format(const Formattable& source, UnicodeString& appendTo,FieldP
osition& ignore, UErrorCode& success)}, | | * {@link #format(const Formattable& source, UnicodeString& appendTo, Field
Position& ignore, UErrorCode& success)}, | |
| * {@link #format(const Formattable* arguments, int32_t cnt, UnicodeString&
appendTo, FieldPosition& status, int32_t recursionProtection,UErrorCode& s
uccess)}, | | * {@link #format(const Formattable* arguments, int32_t cnt, UnicodeString&
appendTo, FieldPosition& status, int32_t recursionProtection,UErrorCode& s
uccess)}, | |
|
| * {@link #parse(const UnicodeString& source, ParsePosition& pos,int32_t& c
ount)}, | | * {@link #parse(const UnicodeString& source, ParsePosition& pos, int32_t&
count)}, | |
| * {@link #parse(const UnicodeString& source, int32_t& cnt, UErrorCode& sta
tus)} | | * {@link #parse(const UnicodeString& source, int32_t& cnt, UErrorCode& sta
tus)} | |
|
| * <p> | | | |
| * | | * | |
| * <P> | | * <P> | |
| * During parsing, an input string is matched against the string | | * During parsing, an input string is matched against the string | |
| * template of the MessageFormat to produce an array of Formattable | | * template of the MessageFormat to produce an array of Formattable | |
| * objects. Plain text of the template string is matched directly | | * 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 | | * a subformat is located, the subformat is called to parse the | |
| * corresponding segment of input text to produce an output argument. | | * corresponding segment of input text to produce an output argument. | |
| * In this way, an array of arguments is created which together | | * In this way, an array of arguments is created which together | |
| * constitute the parse result. | | * constitute the parse result. | |
| * <P> | | * <P> | |
| * Parsing may fail or produce unexpected results in a number of | | * Parsing may fail or produce unexpected results in a number of | |
| * circumstances. | | * circumstances. | |
| * <UL> | | * <UL> | |
| * <LI>If one of the arguments does not occur in the pattern, it | | * <LI>If one of the arguments does not occur in the pattern, it | |
| * will be returned as a default Formattable. | | * 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 | | * a choice format where a large number formats to "many", then the | |
| * parse may not correspond to the originally formatted argument. | | * parse may not correspond to the originally formatted argument. | |
| * <LI>MessageFormat does not handle ChoiceFormat recursion during | | * <LI>MessageFormat does not handle ChoiceFormat recursion during | |
| * parsing; such parses will fail. | | * parsing; such parses will fail. | |
| * <LI>Parsing will not always find a match (or the correct match) if | | * <LI>Parsing will not always find a match (or the correct match) if | |
| * some part of the parse is ambiguous. For example, if the pattern | | * some part of the parse is ambiguous. For example, if the pattern | |
| * "{1},{2}" is used with the string arguments {"a,b", "c"}, it will | | * "{1},{2}" is used with the string arguments {"a,b", "c"}, it will | |
| * format as "a,b,c". When the result is parsed, it will return {"a", | | * format as "a,b,c". When the result is parsed, it will return {"a", | |
| * "b,c"}. | | * "b,c"}. | |
| * <LI>If a single argument is formatted more than once in the string, | | * <LI>If a single argument is formatted more than once in the string, | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 181 | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
| * | | * | |
| * The pattern is of the following form. Legend: | | * The pattern is of the following form. Legend: | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * {optional item} | | * {optional item} | |
| * (group that may be repeated)* | | * (group that may be repeated)* | |
| * \endcode | | * \endcode | |
| * </pre> | | * </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. | | * as this: "{". Quoted braces are literals. | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * messageFormatPattern := string ( "{" messageFormatElement "}" stri
ng )* | | * messageFormatPattern := string ( "{" messageFormatElement "}" stri
ng )* | |
| * | | * | |
| * messageFormatElement := argumentIndex | argumentName { "," element
Format } | | * messageFormatElement := argumentIndex | argumentName { "," element
Format } | |
| * | | * | |
| * elementFormat := "time" { "," datetimeStyle } | | * elementFormat := "time" { "," datetimeStyle } | |
| * | "date" { "," datetimeStyle } | | * | "date" { "," datetimeStyle } | |
| * | "number" { "," numberStyle } | | * | "number" { "," numberStyle } | |
| * | "choice" "," choiceStyle | | * | "choice" "," choiceStyle | |
|
| | | * | "spellout" { "," spelloutStyle } | |
| | | * | "ordinal" { "," spelloutStyle } | |
| | | * | "duration" { "," spelloutStyle } | |
| | | * | "plural" "," pluralStyle | |
| | | * | "select" "," selectStyle | |
| * | | * | |
| * datetimeStyle := "short" | | * datetimeStyle := "short" | |
| * | "medium" | | * | "medium" | |
| * | "long" | | * | "long" | |
| * | "full" | | * | "full" | |
| * | dateFormatPattern | | * | dateFormatPattern | |
| * | | * | |
| * numberStyle := "currency" | | * numberStyle := "currency" | |
| * | "percent" | | * | "percent" | |
| * | "integer" | | * | "integer" | |
| * | numberFormatPattern | | * | numberFormatPattern | |
| * | | * | |
| * choiceStyle := choiceFormatPattern | | * choiceStyle := choiceFormatPattern | |
| * | | * | |
|
| * pluralStyle := pluralFormatPattern | | * pluralStyle := pluralFormatPattern | |
| | | * | |
| | | * selectStyle := selectFormatPattern | |
| | | * | |
| | | * spelloutStyle := ruleSetName | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
| * If there is no elementFormat, then the argument must be a string, | | * If there is no elementFormat, then the argument must be a string, | |
| * which is substituted. If there is no dateTimeStyle or numberStyle, | | * which is substituted. If there is no dateTimeStyle or numberStyle, | |
| * then the default format is used (e.g. NumberFormat::createInstance(), | | * then the default format is used (e.g. NumberFormat::createInstance(), | |
|
| * DateFormat::createTimeInstance(DateFormat::kDefault, ...) or DateFormat: | | * DateFormat::createTimeInstance(DateFormat::kDefault, ...) or | |
| :createDateInstance(DateFormat::kDefault, ...). For | | * DateFormat::createDateInstance(DateFormat::kDefault, ...). For | |
| * a ChoiceFormat, the pattern must always be specified, since there | | * a RuleBasedNumberFormat, if there is no ruleSetName, the default | |
| * is no default. | | * rule set is used. For a ChoiceFormat or PluralFormat or SelectFormat, th | |
| | | e pattern | |
| | | * must always be specified, since there is no default. | |
| * <P> | | * <P> | |
| * In strings, single quotes can be used to quote syntax characters. | | * In strings, single quotes can be used to quote syntax characters. | |
| * A literal single quote is represented by '', both within and outside | | * A literal single quote is represented by '', both within and outside | |
| * of single-quoted segments. Inside a | | * of single-quoted segments. Inside a | |
| * messageFormatElement, quotes are <EM>not</EM> removed. For example, | | * messageFormatElement, quotes are <EM>not</EM> removed. For example, | |
| * {1,number,$'#',##} will produce a number format with the pound-sign | | * {1,number,$'#',##} will produce a number format with the pound-sign | |
| * quoted, with a result such as: "$#31,45". | | * quoted, with a result such as: "$#31,45". | |
| * <P> | | * <P> | |
| * If a pattern is used, then unquoted braces in the pattern, if any, | | * If a pattern is used, then unquoted braces in the pattern, if any, | |
| * must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab | | * must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab | |
| | | | |
| skipping to change at line 248 | | skipping to change at line 259 | |
| * human-readable text, and to use the ASCII apostrophe (U+0027 ' ) | | * human-readable text, and to use the ASCII apostrophe (U+0027 ' ) | |
| * only in program syntax, like quoting in MessageFormat. | | * only in program syntax, like quoting in MessageFormat. | |
| * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p> | | * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p> | |
| * </dl> | | * </dl> | |
| * <P> | | * <P> | |
| * The argumentIndex is a non-negative integer, which corresponds to the | | * The argumentIndex is a non-negative integer, which corresponds to the | |
| * index of the arguments presented in an array to be formatted. The | | * index of the arguments presented in an array to be formatted. The | |
| * first argument has argumentIndex 0. | | * first argument has argumentIndex 0. | |
| * <P> | | * <P> | |
| * It is acceptable to have unused arguments in the array. With missing | | * 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. | | * specified format, a failing UErrorCode result is set. | |
| * <P> | | * <P> | |
| * For more sophisticated patterns, you can use a ChoiceFormat to get | | * For more sophisticated patterns, you can use a ChoiceFormat to get | |
| * output: | | * output: | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * UErrorCode success = U_ZERO_ERROR; | | * UErrorCode success = U_ZERO_ERROR; | |
| * MessageFormat* form("The disk \"{1}\" contains {0}.", success); | | * MessageFormat* form("The disk \"{1}\" contains {0}.", success); | |
| * double filelimits[] = {0,1,2}; | | * double filelimits[] = {0,1,2}; | |
| * UnicodeString filepart[] = {"no files","one file","{0,number} files"
}; | | * UnicodeString filepart[] = {"no files","one file","{0,number} files"
}; | |
| | | | |
| skipping to change at line 452 | | skipping to change at line 463 | |
| | | | |
| /** | | /** | |
| * Sets subformats. | | * Sets subformats. | |
| * See the class description about format numbering. | | * See the class description about format numbering. | |
| * The caller should not delete the Format objects after this call. | | * The caller should not delete the Format objects after this call. | |
| * <EM>The array formatsToAdopt is not itself adopted.</EM> Its | | * <EM>The array formatsToAdopt is not itself adopted.</EM> Its | |
| * ownership is retained by the caller. If the call fails because | | * ownership is retained by the caller. If the call fails because | |
| * memory cannot be allocated, then the formats will be deleted | | * memory cannot be allocated, then the formats will be deleted | |
| * by this method, and this object will remain unchanged. | | * by this method, and this object will remain unchanged. | |
| * | | * | |
|
| | | * <p>If this format uses named arguments, the new formats are discarde | |
| | | d | |
| | | * and this format remains unchanged. | |
| | | * | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| * @param formatsToAdopt the format to be adopted. | | * @param formatsToAdopt the format to be adopted. | |
| * @param count the size of the array. | | * @param count the size of the array. | |
| */ | | */ | |
| virtual void adoptFormats(Format** formatsToAdopt, int32_t count); | | virtual void adoptFormats(Format** formatsToAdopt, int32_t count); | |
| | | | |
| /** | | /** | |
| * Sets subformats. | | * Sets subformats. | |
| * See the class description about format numbering. | | * See the class description about format numbering. | |
| * Each item in the array is cloned into the internal array. | | * Each item in the array is cloned into the internal array. | |
| * If the call fails because memory cannot be allocated, then this | | * If the call fails because memory cannot be allocated, then this | |
| * object will remain unchanged. | | * object will remain unchanged. | |
| * | | * | |
|
| | | * <p>If this format uses named arguments, the new formats are discarde | |
| | | d | |
| | | * and this format remains unchanged. | |
| | | * | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| * @param newFormats the new format to be set. | | * @param newFormats the new format to be set. | |
| * @param cnt the size of the array. | | * @param cnt the size of the array. | |
| */ | | */ | |
| virtual void setFormats(const Format** newFormats, int32_t cnt); | | virtual void setFormats(const Format** newFormats, int32_t cnt); | |
| | | | |
| /** | | /** | |
| * Sets one subformat. | | * Sets one subformat. | |
| * See the class description about format numbering. | | * See the class description about format numbering. | |
| * The caller should not delete the Format object after this call. | | * The caller should not delete the Format object after this call. | |
| * If the number is over the number of formats already set, | | * If the number is over the number of formats already set, | |
| * the item will be deleted and ignored. | | * 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 | | * @stable ICU 2.0 | |
| * @param formatNumber index of the subformat. | | * @param formatNumber index of the subformat. | |
| * @param formatToAdopt the format to be adopted. | | * @param formatToAdopt the format to be adopted. | |
| */ | | */ | |
| virtual void adoptFormat(int32_t formatNumber, Format* formatToAdopt); | | virtual void adoptFormat(int32_t formatNumber, Format* formatToAdopt); | |
| | | | |
| /** | | /** | |
| * Sets one subformat. | | * Sets one subformat. | |
| * See the class description about format numbering. | | * See the class description about format numbering. | |
| * If the number is over the number of formats already set, | | * If the number is over the number of formats already set, | |
| | | | |
| skipping to change at line 554 | | skipping to change at line 575 | |
| * @param formatToAdopt Format to be adopted. | | * @param formatToAdopt Format to be adopted. | |
| * @param status output param set to success/failure code. | | * @param status output param set to success/failure code. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| virtual void adoptFormat(const UnicodeString& formatName, Format* forma
tToAdopt, UErrorCode& status); | | virtual void adoptFormat(const UnicodeString& formatName, Format* forma
tToAdopt, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Gets an array of subformats of this object. The returned array | | * Gets an array of subformats of this object. The returned array | |
| * should not be deleted by the caller, nor should the pointers | | * should not be deleted by the caller, nor should the pointers | |
| * within the array. The array and its contents remain valid only | | * within the array. The array and its contents remain valid only | |
|
| * until the next call to any method of this class is made with | | * until the next call to this format. See the class description | |
| * this object. See the class description about format numbering. | | * about format numbering. | |
| | | * | |
| * @param count output parameter to receive the size of the array | | * @param count output parameter to receive the size of the array | |
| * @return an array of count Format* objects, or NULL if out of | | * @return an array of count Format* objects, or NULL if out of | |
| * memory. Any or all of the array elements may be NULL. | | * memory. Any or all of the array elements may be NULL. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual const Format** getFormats(int32_t& count) const; | | virtual const Format** getFormats(int32_t& count) const; | |
| | | | |
| /** | | /** | |
| * Formats the given array of arguments into a user-readable string. | | * Formats the given array of arguments into a user-readable string. | |
| * Does not take ownership of the Formattable* array or its contents. | | * 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 source An array of objects to be formatted. | |
| * @param count The number of elements of 'source'. | | * @param count The number of elements of 'source'. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param ignore Not used; inherited from base class API. | | * @param ignore Not used; inherited from base class API. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
|
| UnicodeString& format( const Formattable* source, | | UnicodeString& format(const Formattable* source, | |
| int32_t count, | | int32_t count, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& ignore, | | FieldPosition& ignore, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
| * Formats the given array of arguments into a user-readable string | | * Formats the given array of arguments into a user-readable string | |
| * using the given pattern. | | * 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 pattern The pattern. | |
| * @param arguments An array of objects to be formatted. | | * @param arguments An array of objects to be formatted. | |
| * @param count The number of elements of 'source'. | | * @param count The number of elements of 'source'. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| | | | |
| skipping to change at line 609 | | skipping to change at line 637 | |
| int32_t count, | | int32_t count, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Formats the given array of arguments into a user-readable | | * Formats the given array of arguments into a user-readable | |
| * string. The array must be stored within a single Formattable | | * string. The array must be stored within a single Formattable | |
| * object of type kArray. If the Formattable object type is not of | | * object of type kArray. If the Formattable object type is not of | |
| * type kArray, then returns a failing UErrorCode. | | * 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 | | * @param obj A Formattable of type kArray containing | |
| * arguments to be formatted. | | * arguments to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| | | | |
| skipping to change at line 679 | | skipping to change at line 710 | |
| * @param source String to be parsed. | | * @param source String to be parsed. | |
| * @param pos On input, starting position for parse. On output, | | * @param pos On input, starting position for parse. On output, | |
| * final position after parse. Unchanged if parse | | * final position after parse. Unchanged if parse | |
| * fails. | | * fails. | |
| * @param count Output parameter to receive the number of arguments | | * @param count Output parameter to receive the number of arguments | |
| * parsed. | | * parsed. | |
| * @return an array of parsed arguments. The caller owns both | | * @return an array of parsed arguments. The caller owns both | |
| * the array and its contents. | | * the array and its contents. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
|
| virtual Formattable* parse( const UnicodeString& source, | | virtual Formattable* parse(const UnicodeString& source, | |
| ParsePosition& pos, | | ParsePosition& pos, | |
| int32_t& count) const; | | int32_t& count) const; | |
| | | | |
| /** | | /** | |
| * Parses the given string into an array of output arguments. | | * 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 source String to be parsed. | |
| * @param count Output param to receive size of returned array. | | * @param count Output param to receive size of returned array. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
|
| * If the MessageFormat is named argument, the status | | | |
| is | | | |
| * set to U_ARGUMENT_TYPE_MISMATCH. | | | |
| * @return an array of parsed arguments. The caller owns both | | * @return an array of parsed arguments. The caller owns both | |
|
| * the array and its contents. Return NULL if status is not U_ZERO_ERRO
R. | | * the array and its contents. Returns NULL if status is not U_ZERO_ERR
OR. | |
| * | | * | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
|
| virtual Formattable* parse( const UnicodeString& source, | | virtual Formattable* parse(const UnicodeString& source, | |
| int32_t& count, | | int32_t& count, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
| * Parses the given string into an array of output arguments | | * Parses the given string into an array of output arguments | |
| * stored within a single Formattable of type kArray. | | * stored within a single Formattable of type kArray. | |
| * | | * | |
| * @param source The string to be parsed into an object. | | * @param source The string to be parsed into an object. | |
| * @param result Formattable to be set to the parse result. | | * @param result Formattable to be set to the parse result. | |
| * If parse fails, return contents are undefined. | | * If parse fails, return contents are undefined. | |
| * @param pos On input, starting position for parse. On output, | | * @param pos On input, starting position for parse. On output, | |
| * final position after parse. Unchanged if parse | | * final position after parse. Unchanged if parse | |
| | | | |
End of changes. 35 change blocks. |
| 62 lines changed or deleted | | 90 lines changed or added | |
|
| normlzr.h | | normlzr.h | |
| /* | | /* | |
| ******************************************************************** | | ******************************************************************** | |
| * COPYRIGHT: | | * COPYRIGHT: | |
|
| * Copyright (c) 1996-2006, International Business Machines Corporation and | | * Copyright (c) 1996-2010, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ******************************************************************** | | ******************************************************************** | |
| */ | | */ | |
| | | | |
| #ifndef NORMLZR_H | | #ifndef NORMLZR_H | |
| #define NORMLZR_H | | #define NORMLZR_H | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Unicode Normalization | | * \brief C++ API: Unicode Normalization | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_NORMALIZATION | | #if !UCONFIG_NO_NORMALIZATION | |
| | | | |
|
| #include "unicode/uobject.h" | | | |
| #include "unicode/unistr.h" | | | |
| #include "unicode/chariter.h" | | #include "unicode/chariter.h" | |
|
| | | #include "unicode/normalizer2.h" | |
| | | #include "unicode/unistr.h" | |
| #include "unicode/unorm.h" | | #include "unicode/unorm.h" | |
|
| | | #include "unicode/uobject.h" | |
| struct UCharIterator; | | | |
| typedef struct UCharIterator UCharIterator; /**< C typedef for struct UChar | | | |
| Iterator. @stable ICU 2.1 */ | | | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| /** | | /** | |
| * The Normalizer class supports the standard normalization forms described
in | | * The Normalizer class supports the standard normalization forms described
in | |
| * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> | | * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode"> | |
| * Unicode Standard Annex #15: Unicode Normalization Forms</a>. | | * Unicode Standard Annex #15: Unicode Normalization Forms</a>. | |
| * | | * | |
|
| | | * Note: This API has been replaced by the Normalizer2 class and is only av | |
| | | ailable | |
| | | * for backward compatibility. This class simply delegates to the Normalize | |
| | | r2 class. | |
| | | * There is one exception: The new API does not provide a replacement for N | |
| | | ormalizer::compare(). | |
| | | * | |
| * The Normalizer class consists of two parts: | | * The Normalizer class consists of two parts: | |
| * - static functions that normalize strings or test if strings are normali
zed | | * - static functions that normalize strings or test if strings are normali
zed | |
| * - a Normalizer object is an iterator that takes any kind of text and | | * - a Normalizer object is an iterator that takes any kind of text and | |
| * provides iteration over its normalized form | | * provides iteration over its normalized form | |
| * | | * | |
| * The Normalizer class is not suitable for subclassing. | | * 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 | | * For basic information about normalization forms and details about the C
API | |
| * please see the documentation in unorm.h. | | * please see the documentation in unorm.h. | |
| * | | * | |
| * The iterator API with the Normalizer constructors and the non-static fun
ctions | | * The iterator API with the Normalizer constructors and the non-static fun
ctions | |
|
| * 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. | | * is then internally wrapped in a CharacterIterator. | |
| * The input text is not normalized all at once, but incrementally where ne
eded | | * The input text is not normalized all at once, but incrementally where ne
eded | |
| * (providing efficient random access). | | * (providing efficient random access). | |
| * This allows to pass in a large text but spend only a small amount of tim
e | | * This allows to pass in a large text but spend only a small amount of tim
e | |
| * normalizing a small part of that text. | | * normalizing a small part of that text. | |
| * However, if the entire text is normalized, then the iterator will be | | * However, if the entire text is normalized, then the iterator will be | |
| * slower than normalizing the entire text at once and iterating over the r
esult. | | * slower than normalizing the entire text at once and iterating over the r
esult. | |
| * A possible use of the Normalizer iterator is also to report an index int
o the | | * A possible use of the Normalizer iterator is also to report an index int
o the | |
| * original text that is close to where the normalized characters come from
. | | * original text that is close to where the normalized characters come from
. | |
| * | | * | |
| | | | |
| skipping to change at line 288 | | skipping to change at line 288 | |
| * | | * | |
| * @param source string for determining if it is in a normalized fo
rmat | | * @param source string for determining if it is in a normalized fo
rmat | |
| * @param mode normalization format | | * @param mode normalization format | |
| * @param options the optional features to be enabled (0 for no opti
ons) | | * @param options the optional features to be enabled (0 for no opti
ons) | |
| * @param status A reference to a UErrorCode to receive any errors | | * @param status A reference to a UErrorCode to receive any errors | |
| * @return UNORM_YES, UNORM_NO or UNORM_MAYBE | | * @return UNORM_YES, UNORM_NO or UNORM_MAYBE | |
| * | | * | |
| * @see isNormalized | | * @see isNormalized | |
| * @stable ICU 2.6 | | * @stable ICU 2.6 | |
| */ | | */ | |
|
| static inline UNormalizationCheckResult | | static UNormalizationCheckResult | |
| quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t
options, UErrorCode &status); | | quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t
options, UErrorCode &status); | |
| | | | |
| /** | | /** | |
| * Test if a string is in a given normalization form. | | * Test if a string is in a given normalization form. | |
| * This is semantically equivalent to source.equals(normalize(source, mod
e)) . | | * This is semantically equivalent to source.equals(normalize(source, mod
e)) . | |
| * | | * | |
| * Unlike unorm_quickCheck(), this function returns a definitive result, | | * Unlike unorm_quickCheck(), this function returns a definitive result, | |
| * never a "maybe". | | * never a "maybe". | |
| * For NFD, NFKD, and FCD, both functions work exactly the same. | | * For NFD, NFKD, and FCD, both functions work exactly the same. | |
| * For NFC and NFKC where quickCheck may return "maybe", this function wi
ll | | * For NFC and NFKC where quickCheck may return "maybe", this function wi
ll | |
| | | | |
| skipping to change at line 329 | | skipping to change at line 329 | |
| * @param mode Which normalization form to test for. | | * @param mode Which normalization form to test for. | |
| * @param options the optional features to be enabled (0 for no opti
ons) | | * @param options the optional features to be enabled (0 for no opti
ons) | |
| * @param errorCode ICU error code in/out parameter. | | * @param errorCode ICU error code in/out parameter. | |
| * Must fulfill U_SUCCESS before the function call. | | * Must fulfill U_SUCCESS before the function call. | |
| * @return Boolean value indicating whether the source string is in the | | * @return Boolean value indicating whether the source string is in the | |
| * "mode" normalization form. | | * "mode" normalization form. | |
| * | | * | |
| * @see quickCheck | | * @see quickCheck | |
| * @stable ICU 2.6 | | * @stable ICU 2.6 | |
| */ | | */ | |
|
| static inline UBool | | static UBool | |
| isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t o
ptions, UErrorCode &errorCode); | | isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t o
ptions, UErrorCode &errorCode); | |
| | | | |
| /** | | /** | |
| * Concatenate normalized strings, making sure that the result is normali
zed as well. | | * Concatenate normalized strings, making sure that the result is normali
zed as well. | |
| * | | * | |
| * If both the left and the right strings are in | | * If both the left and the right strings are in | |
| * the normalization form according to "mode/options", | | * the normalization form according to "mode/options", | |
| * then the result will be | | * then the result will be | |
| * | | * | |
| * \code | | * \code | |
| | | | |
| skipping to change at line 727 | | skipping to change at line 727 | |
| //-----------------------------------------------------------------------
-- | | //-----------------------------------------------------------------------
-- | |
| | | | |
| Normalizer(); // default constructor not implemented | | Normalizer(); // default constructor not implemented | |
| Normalizer &operator=(const Normalizer &that); // assignment operator not
implemented | | Normalizer &operator=(const Normalizer &that); // assignment operator not
implemented | |
| | | | |
| // Private utility methods for iteration | | // Private utility methods for iteration | |
| // For documentation, see the source code | | // For documentation, see the source code | |
| UBool nextNormalize(); | | UBool nextNormalize(); | |
| UBool previousNormalize(); | | UBool previousNormalize(); | |
| | | | |
|
| void init(CharacterIterator *iter); | | void init(); | |
| void clearBuffer(void); | | void clearBuffer(void); | |
| | | | |
| //-----------------------------------------------------------------------
-- | | //-----------------------------------------------------------------------
-- | |
| // Private data | | // Private data | |
| //-----------------------------------------------------------------------
-- | | //-----------------------------------------------------------------------
-- | |
| | | | |
|
| | | FilteredNormalizer2*fFilteredNorm2; // owned if not NULL | |
| | | const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 | |
| UNormalizationMode fUMode; | | UNormalizationMode fUMode; | |
| int32_t fOptions; | | int32_t fOptions; | |
| | | | |
| // The input text and our position in it | | // The input text and our position in it | |
|
| UCharIterator *text; | | CharacterIterator *text; | |
| | | | |
| // The normalization buffer is the result of normalization | | // The normalization buffer is the result of normalization | |
| // of the source in [currentIndex..nextIndex[ . | | // of the source in [currentIndex..nextIndex[ . | |
| int32_t currentIndex, nextIndex; | | int32_t currentIndex, nextIndex; | |
| | | | |
| // A buffer for holding intermediate results | | // A buffer for holding intermediate results | |
| UnicodeString buffer; | | UnicodeString buffer; | |
| int32_t bufferPos; | | int32_t bufferPos; | |
|
| | | | |
| }; | | }; | |
| | | | |
| //------------------------------------------------------------------------- | | //------------------------------------------------------------------------- | |
| // Inline implementations | | // Inline implementations | |
| //------------------------------------------------------------------------- | | //------------------------------------------------------------------------- | |
| | | | |
| inline UBool | | inline UBool | |
| Normalizer::operator!= (const Normalizer& other) const | | Normalizer::operator!= (const Normalizer& other) const | |
| { return ! operator==(other); } | | { return ! operator==(other); } | |
| | | | |
| | | | |
| skipping to change at line 762 | | skipping to change at line 763 | |
| //------------------------------------------------------------------------- | | //------------------------------------------------------------------------- | |
| | | | |
| inline UBool | | inline UBool | |
| Normalizer::operator!= (const Normalizer& other) const | | Normalizer::operator!= (const Normalizer& other) const | |
| { return ! operator==(other); } | | { return ! operator==(other); } | |
| | | | |
| inline UNormalizationCheckResult | | inline UNormalizationCheckResult | |
| Normalizer::quickCheck(const UnicodeString& source, | | Normalizer::quickCheck(const UnicodeString& source, | |
| UNormalizationMode mode, | | UNormalizationMode mode, | |
| UErrorCode &status) { | | UErrorCode &status) { | |
|
| if(U_FAILURE(status)) { | | return quickCheck(source, mode, 0, 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); | | | |
| } | | } | |
| | | | |
| inline UBool | | inline UBool | |
| Normalizer::isNormalized(const UnicodeString& source, | | Normalizer::isNormalized(const UnicodeString& source, | |
| UNormalizationMode mode, | | UNormalizationMode mode, | |
| UErrorCode &status) { | | UErrorCode &status) { | |
|
| if(U_FAILURE(status)) { | | return isNormalized(source, mode, 0, 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); | | | |
| } | | } | |
| | | | |
| inline int32_t | | inline int32_t | |
| Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, | | Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, | |
| uint32_t options, | | uint32_t options, | |
| UErrorCode &errorCode) { | | UErrorCode &errorCode) { | |
| // all argument checking is done in unorm_compare | | // all argument checking is done in unorm_compare | |
| return unorm_compare(s1.getBuffer(), s1.length(), | | return unorm_compare(s1.getBuffer(), s1.length(), | |
| s2.getBuffer(), s2.length(), | | s2.getBuffer(), s2.length(), | |
| options, | | options, | |
| | | | |
End of changes. 15 change blocks. |
| 52 lines changed or deleted | | 20 lines changed or added | |
|
| numfmt.h | | numfmt.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2009, International Business Machines Corporation and
others. | | * Copyright (C) 1997-2010, International Business Machines Corporation and
others. | |
| * All Rights Reserved. | | * All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File NUMFMT.H | | * File NUMFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/18/97 clhuang Updated per C++ implementation. | | * 03/18/97 clhuang Updated per C++ implementation. | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| * \file | | * \file | |
| * \brief C++ API: Abstract base class for all number formats. | | * \brief C++ API: Abstract base class for all number formats. | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/unistr.h" | | #include "unicode/unistr.h" | |
| #include "unicode/format.h" | | #include "unicode/format.h" | |
| #include "unicode/unum.h" // UNumberFormatStyle | | #include "unicode/unum.h" // UNumberFormatStyle | |
| #include "unicode/locid.h" | | #include "unicode/locid.h" | |
|
| | | #include "unicode/stringpiece.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| #if !UCONFIG_NO_SERVICE | | #if !UCONFIG_NO_SERVICE | |
| class NumberFormatFactory; | | class NumberFormatFactory; | |
| class StringEnumeration; | | class StringEnumeration; | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * | | * | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 193 | |
| kIsoCurrencyStyle, | | kIsoCurrencyStyle, | |
| kPluralCurrencyStyle, | | kPluralCurrencyStyle, | |
| kStyleCount // ALWAYS LAST ENUM: number of styles | | kStyleCount // ALWAYS LAST ENUM: number of styles | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Alignment Field constants used to construct a FieldPosition object. | | * Alignment Field constants used to construct a FieldPosition object. | |
| * Signifies that the position of the integer part or fraction part of | | * Signifies that the position of the integer part or fraction part of | |
| * a formatted number should be returned. | | * 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 | | * @see FieldPosition | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| enum EAlignmentFields { | | enum EAlignmentFields { | |
| kIntegerField, | | kIntegerField, | |
| kFractionField, | | kFractionField, | |
|
| | | kDecimalSeparatorField, | |
| | | kExponentSymbolField, | |
| | | kExponentSignField, | |
| | | kExponentField, | |
| | | kGroupingSeparatorField, | |
| | | kCurrencyField, | |
| | | kPercentField, | |
| | | kPermillField, | |
| | | kSignField, | |
| | | | |
| /** | | /** | |
| * These constants are provided for backwards compatibility only. | | * These constants are provided for backwards compatibility only. | |
| * Please use the C++ style constants defined above. | | * Please use the C++ style constants defined above. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| INTEGER_FIELD = kIntegerField, | | INTEGER_FIELD = kIntegerField, | |
| FRACTION_FIELD = kFractionField | | FRACTION_FIELD = kFractionField | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 243 | | skipping to change at line 257 | |
| * @param status Output param filled with success/failure status. | | * @param status Output param filled with success/failure status. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(const Formattable& obj, | | virtual UnicodeString& format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos, | | FieldPosition& pos, | |
| UErrorCode& status) const; | | 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. | |
| | | * @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 | | * Parse a string to produce an object. This methods handles | |
| * parsing of numeric strings into Formattable objects with numeric | | * parsing of numeric strings into Formattable objects with numeric | |
| * types. | | * types. | |
| * <P> | | * <P> | |
| * Before calling, set parse_pos.index to the offset you want to | | * Before calling, set parse_pos.index to the offset you want to | |
| * start parsing at in the source. After calling, parse_pos.index | | * start parsing at in the source. After calling, parse_pos.index | |
| * indicates the position after the successfully parsed text. If | | * indicates the position after the successfully parsed text. If | |
| * an error occurs, parse_pos.index is unchanged. | | * an error occurs, parse_pos.index is unchanged. | |
| * <P> | | * <P> | |
| * When parsing, leading whitespace is discarded (with successful | | * When parsing, leading whitespace is discarded (with successful | |
| | | | |
| skipping to change at line 329 | | skipping to change at line 363 | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(double number, | | virtual UnicodeString& format(double number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const = 0; | | 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. | |
| | | * @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 | | * Format a long number. Concrete subclasses must implement | |
| * these pure virtual methods. | | * these pure virtual methods. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(int32_t number, | | virtual UnicodeString& format(int32_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const = 0; | | 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. | |
| | | * @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 | | * Format an int64 number. (Not abstract to retain compatibility | |
| * with earlier releases, however subclasses should override this | | * with earlier releases, however subclasses should override this | |
| * method as it just delegates to format(int32_t number...); | | * method as it just delegates to format(int32_t number...); | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| virtual UnicodeString& format(int64_t number, | | virtual UnicodeString& format(int64_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | 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. | |
| | | * @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 str | |
| | | ing" | |
| | | * as defined in the Decimal Arithmetic Specification, available at | |
| | | * http://speleotrove.com/decimal | |
| | | * | |
| | | * @param number The unformatted number, as a string, to be formatte | |
| | | d. | |
| | | * @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 4.4 | |
| | | */ | |
| | | virtual UnicodeString& format(const StringPiece &number, | |
| | | UnicodeString& appendTo, | |
| | | FieldPositionIterator& posIter, | |
| | | UErrorCode& status) const; | |
| | | | |
| | | // TODO: do we also want a format of a decimal number that takes a | |
| | | // FieldPosition parameter? | |
| | | | |
| | | /** | |
| * Redeclared Format method. | | * Redeclared Format method. | |
| * @param obj The object to be formatted. | | * @param obj The object to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param status Output parameter set to a failure error code | | * @param status Output parameter set to a failure error code | |
| * when a failure occurs. | | * when a failure occurs. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format(const Formattable& obj, | | UnicodeString& format(const Formattable& obj, | |
| | | | |
End of changes. 8 change blocks. |
| 1 lines changed or deleted | | 112 lines changed or added | |
|
| smpdtfmt.h | | smpdtfmt.h | |
| /* | | /* | |
|
| * 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 | | * File SMPDTFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 07/09/97 helena Make ParsePosition into a class. | | * 07/09/97 helena Make ParsePosition into a class. | |
| * 07/21/98 stephen Added GMT_PLUS, GMT_MINUS | | * 07/21/98 stephen Added GMT_PLUS, GMT_MINUS | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/datefmt.h" | | #include "unicode/datefmt.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class DateFormatSymbols; | | class DateFormatSymbols; | |
| class DateFormat; | | class DateFormat; | |
| class MessageFormat; | | class MessageFormat; | |
|
| | | class FieldPositionHandler; | |
| | | | |
| /** | | /** | |
| * | | * | |
| * SimpleDateFormat is a concrete class for formatting and parsing dates in
a | | * SimpleDateFormat is a concrete class for formatting and parsing dates in
a | |
| * language-independent manner. It allows for formatting (millis -> text), | | * language-independent manner. It allows for formatting (millis -> text), | |
| * parsing (text -> millis), and normalization. Formats/Parses a date or ti
me, | | * parsing (text -> millis), and normalization. Formats/Parses a date or ti
me, | |
| * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. | | * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. | |
| * <P> | | * <P> | |
| * Clients are encouraged to create a date-time formatter using DateFormat:
:getInstance(), | | * Clients are encouraged to create a date-time formatter using DateFormat:
:getInstance(), | |
| * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather th
an | | * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather th
an | |
| | | | |
| skipping to change at line 259 | | skipping to change at line 260 | |
| * as "thai". To specify that just the year portion of the date be for
matted using Hebrew numbering, | | * as "thai". To specify that just the year portion of the date be for
matted using Hebrew numbering, | |
| * use the override string "y=hebrew". Numbering system overrides can
be combined using a semi-colon | | * use the override string "y=hebrew". Numbering system overrides can
be combined using a semi-colon | |
| * character in the override string, such as "d=decimal;M=arabic;y=hebr
ew", etc. | | * character in the override string, such as "d=decimal;M=arabic;y=hebr
ew", etc. | |
| * | | * | |
| * <P> | | * <P> | |
| * [Note:] Not all locales support SimpleDateFormat; for full generalit
y, | | * [Note:] Not all locales support SimpleDateFormat; for full generalit
y, | |
| * use the factory methods in the DateFormat class. | | * use the factory methods in the DateFormat class. | |
| * @param pattern the pattern for the format. | | * @param pattern the pattern for the format. | |
| * @param override the override string. | | * @param override the override string. | |
| * @param status Output param set to success/failure code. | | * @param status Output param set to success/failure code. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| SimpleDateFormat(const UnicodeString& pattern, | | SimpleDateFormat(const UnicodeString& pattern, | |
| const UnicodeString& override, | | const UnicodeString& override, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Construct a SimpleDateFormat using the given pattern and locale. | | * Construct a SimpleDateFormat using the given pattern and locale. | |
| * The locale is used to obtain the symbols used in formatting (e.g., t
he | | * The locale is used to obtain the symbols used in formatting (e.g., t
he | |
| * names of the months), but not to provide the pattern. | | * names of the months), but not to provide the pattern. | |
| * <P> | | * <P> | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 301 | |
| * as "thai". To specify that just the year portion of the date be for
matted using Hebrew numbering, | | * as "thai". To specify that just the year portion of the date be for
matted using Hebrew numbering, | |
| * use the override string "y=hebrew". Numbering system overrides can
be combined using a semi-colon | | * use the override string "y=hebrew". Numbering system overrides can
be combined using a semi-colon | |
| * character in the override string, such as "d=decimal;M=arabic;y=hebr
ew", etc. | | * character in the override string, such as "d=decimal;M=arabic;y=hebr
ew", etc. | |
| * <P> | | * <P> | |
| * [Note:] Not all locales support SimpleDateFormat; for full generalit
y, | | * [Note:] Not all locales support SimpleDateFormat; for full generalit
y, | |
| * use the factory methods in the DateFormat class. | | * use the factory methods in the DateFormat class. | |
| * @param pattern the pattern for the format. | | * @param pattern the pattern for the format. | |
| * @param override the numbering system override. | | * @param override the numbering system override. | |
| * @param locale the given locale. | | * @param locale the given locale. | |
| * @param status Output param set to success/failure code. | | * @param status Output param set to success/failure code. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| SimpleDateFormat(const UnicodeString& pattern, | | SimpleDateFormat(const UnicodeString& pattern, | |
| const UnicodeString& override, | | const UnicodeString& override, | |
| const Locale& locale, | | const Locale& locale, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Construct a SimpleDateFormat using the given pattern and locale-spec
ific | | * Construct a SimpleDateFormat using the given pattern and locale-spec
ific | |
| * symbol data. The formatter takes ownership of the DateFormatSymbols
object; | | * symbol data. The formatter takes ownership of the DateFormatSymbols
object; | |
| * the caller is no longer responsible for deleting it. | | * the caller is no longer responsible for deleting it. | |
| | | | |
| skipping to change at line 395 | | skipping to change at line 396 | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | FieldPosition& pos) const; | |
| | | | |
| /** | | /** | |
| * Format a date or time, which is the standard millis since 24:00 GMT,
Jan | | * Format a date or time, which is the standard millis since 24:00 GMT,
Jan | |
| * 1, 1970. Overrides DateFormat pure virtual method. | | * 1, 1970. Overrides DateFormat pure virtual method. | |
| * <P> | | * <P> | |
| * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> | | * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> | |
| * 1996.07.10 AD at 15:08:56 PDT | | * 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 val | |
| | | ues | |
| | | * 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. | |
| | | * <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 | | * @param obj A Formattable containing the date-time value to be
formatted | |
| * into a date-time string. If the type of the Format
table | | * into a date-time string. If the type of the Format
table | |
| * is a numeric type, it is treated as if it were an | | * is a numeric type, it is treated as if it were an | |
| * instance of Date. | | * instance of Date. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos The formatting position. On input: an alignment fie
ld, | | * @param pos The formatting position. On input: an alignment fie
ld, | |
| * if desired. On output: the offsets of the 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. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format( const Formattable& obj, | | virtual UnicodeString& format( const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos, | | FieldPosition& pos, | |
| UErrorCode& status) const; | | 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 Format | |
| | | table | |
| | | * 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 val | |
| | | ues | |
| | | * 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. | | * Redeclared DateFormat method. | |
| * @param date the Date value to be formatted. | | * @param date the Date value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param fieldPosition The formatting position. On input: an alignment
field, | | * @param fieldPosition The formatting position. On input: an alignment
field, | |
| * if desired. On output: the offsets of the align
ment field. | | * if desired. On output: the offsets of the align
ment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.1 | | * @stable ICU 2.1 | |
| */ | | */ | |
| UnicodeString& format(UDate date, | | UnicodeString& format(UDate date, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& fieldPosition) const; | | FieldPosition& fieldPosition) const; | |
| | | | |
| /** | | /** | |
| * Redeclared DateFormat method. | | * 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 position | |
| | | s | |
| | | * 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. | | * @param obj Object to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param status Input/output success/failure code. | | * @param status Input/output success/failure code. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format(const Formattable& obj, | | UnicodeString& format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| skipping to change at line 723 | | skipping to change at line 789 | |
| * Construct a SimpleDateFormat for the given locale. If no resource d
ata | | * Construct a SimpleDateFormat for the given locale. If no resource d
ata | |
| * is available, create an object of last resort, using hard-coded stri
ngs. | | * is available, create an object of last resort, using hard-coded stri
ngs. | |
| * This is an internal method, called by DateFormat. It should never f
ail. | | * This is an internal method, called by DateFormat. It should never f
ail. | |
| * @param locale the given locale. | | * @param locale the given locale. | |
| * @param status Output param set to success/failure code on | | * @param status Output param set to success/failure code on | |
| * exit. | | * exit. | |
| */ | | */ | |
| SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use defa
ult pattern | | SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use defa
ult pattern | |
| | | | |
| /** | | /** | |
|
| | | * Hook called by format(... FieldPosition& ...) and format(...FieldPos | |
| | | itionIterator&...) | |
| | | */ | |
| | | UnicodeString& _format(Calendar& cal, UnicodeString& appendTo, FieldPos | |
| | | itionHandler& handler, | |
| | | UErrorCode& status) const; | |
| | | | |
| | | /** | |
| * Called by format() to format a single field. | | * Called by format() to format a single field. | |
| * | | * | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param ch The format character we encountered in the pattern. | | * @param ch The format character we encountered in the pattern. | |
| * @param count Number of characters in the current pattern symbol
(e.g., | | * @param count Number of characters in the current pattern symbol
(e.g., | |
| * "yyyy" in the pattern would result in a call to thi
s function | | * "yyyy" in the pattern would result in a call to thi
s function | |
| * with ch equal to 'y' and count equal to 4) | | * with ch equal to 'y' and count equal to 4) | |
|
| * @param pos The FieldPosition being filled in by the format() c | | * @param handler Records information about field positions. | |
| all. If | | | |
| * this function is formatting the field specfied by p | | | |
| os, it | | | |
| * will fill in pos with the beginning and ending offs | | | |
| ets of the | | | |
| * field. | | | |
| * @param status Receives a status code, which will be U_ZERO_ERROR
if the operation | | * @param status Receives a status code, which will be U_ZERO_ERROR
if the operation | |
| * succeeds. | | * succeeds. | |
| */ | | */ | |
|
| void subFormat( UnicodeString &appendTo, | | void subFormat(UnicodeString &appendTo, | |
| UChar ch, | | UChar ch, | |
| int32_t count, | | int32_t count, | |
| FieldPosition& pos, | | FieldPositionHandler& handler, | |
| Calendar& cal, | | Calendar& cal, | |
| UErrorCode& status) const; // in case of il | | UErrorCode& status) const; // in case of illegal argumen | |
| legal argument | | t | |
| | | | |
| /** | | /** | |
| * Used by subFormat() to format a numeric value. | | * Used by subFormat() to format a numeric value. | |
| * Appends to toAppendTo a string representation of "value" | | * Appends to toAppendTo a string representation of "value" | |
| * having a number of digits between "minDigits" and | | * having a number of digits between "minDigits" and | |
| * "maxDigits". Uses the DateFormat's NumberFormat. | | * "maxDigits". Uses the DateFormat's NumberFormat. | |
| * | | * | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Formatted number is appended to existing contents. | | * Formatted number is appended to existing contents. | |
| * @param value Value to format. | | * @param value Value to format. | |
| * @param minDigits Minimum number of digits the result should have | | * @param minDigits Minimum number of digits the result should have | |
| * @param maxDigits Maximum number of digits the result should have | | * @param maxDigits Maximum number of digits the result should have | |
| */ | | */ | |
|
| void zeroPaddingNumber( NumberFormat *currentNumberFormat, | | void zeroPaddingNumber(NumberFormat *currentNumberFormat, | |
| UnicodeString &appendTo, | | UnicodeString &appendTo, | |
| int32_t value, | | int32_t value, | |
| int32_t minDigits, | | int32_t minDigits, | |
| int32_t maxDigits) const; | | int32_t maxDigits) const; | |
| | | | |
| /** | | /** | |
| * Return true if the given format character, occuring count | | * Return true if the given format character, occuring count | |
| * times, represents a numeric field. | | * times, represents a numeric field. | |
| */ | | */ | |
| static UBool isNumeric(UChar formatChar, int32_t count); | | static UBool isNumeric(UChar formatChar, int32_t count); | |
| | | | |
| /** | | /** | |
| * initializes fCalendar from parameters. Returns fCalendar as a conve
nience. | | * initializes fCalendar from parameters. Returns fCalendar as a conve
nience. | |
| * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDe
fault(). | | * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDe
fault(). | |
| | | | |
| skipping to change at line 1079 | | skipping to change at line 1148 | |
| inline UnicodeString& | | inline UnicodeString& | |
| SimpleDateFormat::format(const Formattable& obj, | | SimpleDateFormat::format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const { | | UErrorCode& status) const { | |
| // Don't use Format:: - use immediate base class only, | | // Don't use Format:: - use immediate base class only, | |
| // in case immediate base modifies behavior later. | | // in case immediate base modifies behavior later. | |
| return DateFormat::format(obj, appendTo, status); | | return DateFormat::format(obj, appendTo, status); | |
| } | | } | |
| | | | |
| inline UnicodeString& | | 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, | | SimpleDateFormat::format(UDate date, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& fieldPosition) const { | | FieldPosition& fieldPosition) const { | |
| // Don't use Format:: - use immediate base class only, | | // Don't use Format:: - use immediate base class only, | |
| // in case immediate base modifies behavior later. | | // in case immediate base modifies behavior later. | |
| return DateFormat::format(date, appendTo, fieldPosition); | | return DateFormat::format(date, appendTo, fieldPosition); | |
| } | | } | |
| | | | |
| inline UnicodeString& | | 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 { | | SimpleDateFormat::format(UDate date, UnicodeString& appendTo) const { | |
| return DateFormat::format(date, appendTo); | | return DateFormat::format(date, appendTo); | |
| } | | } | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif /* #if !UCONFIG_NO_FORMATTING */ | | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
| | | | |
| #endif // _SMPDTFMT | | #endif // _SMPDTFMT | |
| //eof | | //eof | |
| | | | |
End of changes. 14 change blocks. |
| 23 lines changed or deleted | | 131 lines changed or added | |
|
| stringpiece.h | | stringpiece.h | |
|
| // Copyright (C) 2009, International Business Machines | | // Copyright (C) 2010, International Business Machines | |
| // Corporation and others. All Rights Reserved. | | // Corporation and others. All Rights Reserved. | |
| // | | // | |
| // Copyright 2001 and onwards Google Inc. | | // Copyright 2001 and onwards Google Inc. | |
| // Author: Sanjay Ghemawat | | // Author: Sanjay Ghemawat | |
| | | | |
| // This code is a contribution of Google code, and the style used here is | | // This code is a contribution of Google code, and the style used here is | |
| // a compromise between the original Google code and the ICU coding guideli
nes. | | // a compromise between the original Google code and the ICU coding guideli
nes. | |
| // For example, data types are ICU-ified (size_t,int->int32_t), | | // For example, data types are ICU-ified (size_t,int->int32_t), | |
| // and API comments doxygen-ified, but function names and behavior are | | // and API comments doxygen-ified, but function names and behavior are | |
| // as in the original, if possible. | | // as in the original, if possible. | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| * in a "const char*" or a "string" wherever a "StringPiece" is | | * in a "const char*" or a "string" wherever a "StringPiece" is | |
| * expected. | | * expected. | |
| * | | * | |
| * Functions or methods may use const StringPiece& parameters to accept eit
her | | * Functions or methods may use const StringPiece& parameters to accept eit
her | |
| * a "const char*" or a "string" value that will be implicitly converted to | | * a "const char*" or a "string" value that will be implicitly converted to | |
| * a StringPiece. | | * a StringPiece. | |
| * | | * | |
| * Systematic usage of StringPiece is encouraged as it will reduce unnecess
ary | | * Systematic usage of StringPiece is encouraged as it will reduce unnecess
ary | |
| * conversions from "const char*" to "string" and back again. | | * conversions from "const char*" to "string" and back again. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_COMMON_API StringPiece : public UMemory { | | class U_COMMON_API StringPiece : public UMemory { | |
| private: | | private: | |
| const char* ptr_; | | const char* ptr_; | |
| int32_t length_; | | int32_t length_; | |
| | | | |
| public: | | public: | |
| /** | | /** | |
| * Default constructor, creates an empty StringPiece. | | * Default constructor, creates an empty StringPiece. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece() : ptr_(NULL), length_(0) { } | | StringPiece() : ptr_(NULL), length_(0) { } | |
| /** | | /** | |
| * Constructs from a NUL-terminated const char * pointer. | | * Constructs from a NUL-terminated const char * pointer. | |
| * @param str a NUL-terminated const char * pointer | | * @param str a NUL-terminated const char * pointer | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece(const char* str); | | StringPiece(const char* str); | |
| #if U_HAVE_STD_STRING | | #if U_HAVE_STD_STRING | |
| /** | | /** | |
| * Constructs from a std::string. | | * Constructs from a std::string. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece(const U_STD_NSQ string& str) | | StringPiece(const U_STD_NSQ string& str) | |
| : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { } | | : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { } | |
| #endif | | #endif | |
| /** | | /** | |
| * Constructs from a const char * pointer and a specified length. | | * Constructs from a const char * pointer and a specified length. | |
| * @param offset a const char * pointer (need not be terminated) | | * @param offset a const char * pointer (need not be terminated) | |
| * @param len the length of the string; must be non-negative | | * @param len the length of the string; must be non-negative | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len)
{ } | | StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len)
{ } | |
| /** | | /** | |
| * Substring of another StringPiece. | | * Substring of another StringPiece. | |
| * @param x the other StringPiece | | * @param x the other StringPiece | |
| * @param pos start position in x; must be non-negative and <= x.length()
. | | * @param pos start position in x; must be non-negative and <= x.length()
. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece(const StringPiece& x, int32_t pos); | | StringPiece(const StringPiece& x, int32_t pos); | |
| /** | | /** | |
| * Substring of another StringPiece. | | * Substring of another StringPiece. | |
| * @param x the other StringPiece | | * @param x the other StringPiece | |
| * @param pos start position in x; must be non-negative and <= x.length()
. | | * @param pos start position in x; must be non-negative and <= x.length()
. | |
| * @param len length of the substring; | | * @param len length of the substring; | |
| * must be non-negative and will be pinned to at most x.length
() - pos. | | * must be non-negative and will be pinned to at most x.length
() - pos. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece(const StringPiece& x, int32_t pos, int32_t len); | | StringPiece(const StringPiece& x, int32_t pos, int32_t len); | |
| | | | |
| /** | | /** | |
| * Returns the string pointer. May be NULL if it is empty. | | * Returns the string pointer. May be NULL if it is empty. | |
| * | | * | |
| * data() may return a pointer to a buffer with embedded NULs, and the | | * data() may return a pointer to a buffer with embedded NULs, and the | |
| * returned buffer may or may not be null terminated. Therefore it is | | * returned buffer may or may not be null terminated. Therefore it is | |
| * typically a mistake to pass data() to a routine that expects a NUL | | * typically a mistake to pass data() to a routine that expects a NUL | |
| * terminated string. | | * terminated string. | |
| * @return the string pointer | | * @return the string pointer | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| const char* data() const { return ptr_; } | | const char* data() const { return ptr_; } | |
| /** | | /** | |
| * Returns the string length. Same as length(). | | * Returns the string length. Same as length(). | |
| * @return the string length | | * @return the string length | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| int32_t size() const { return length_; } | | int32_t size() const { return length_; } | |
| /** | | /** | |
| * Returns the string length. Same as size(). | | * Returns the string length. Same as size(). | |
| * @return the string length | | * @return the string length | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| int32_t length() const { return length_; } | | int32_t length() const { return length_; } | |
| /** | | /** | |
| * Returns whether the string is empty. | | * Returns whether the string is empty. | |
| * @return TRUE if the string is empty | | * @return TRUE if the string is empty | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool empty() const { return length_ == 0; } | | UBool empty() const { return length_ == 0; } | |
| | | | |
| /** | | /** | |
| * Sets to an empty string. | | * Sets to an empty string. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void clear() { ptr_ = NULL; length_ = 0; } | | void clear() { ptr_ = NULL; length_ = 0; } | |
| | | | |
| /** | | /** | |
| * Removes the first n string units. | | * Removes the first n string units. | |
| * @param n prefix length, must be non-negative and <=length() | | * @param n prefix length, must be non-negative and <=length() | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void remove_prefix(int32_t n) { | | void remove_prefix(int32_t n) { | |
| if (n >= 0) { | | if (n >= 0) { | |
| if (n > length_) { | | if (n > length_) { | |
| n = length_; | | n = length_; | |
| } | | } | |
| ptr_ += n; | | ptr_ += n; | |
| length_ -= n; | | length_ -= n; | |
| } | | } | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Removes the last n string units. | | * Removes the last n string units. | |
| * @param n suffix length, must be non-negative and <=length() | | * @param n suffix length, must be non-negative and <=length() | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void remove_suffix(int32_t n) { | | void remove_suffix(int32_t n) { | |
| if (n >= 0) { | | if (n >= 0) { | |
| if (n <= length_) { | | if (n <= length_) { | |
| length_ -= n; | | length_ -= n; | |
| } else { | | } else { | |
| length_ = 0; | | length_ = 0; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Maximum integer, used as a default value for substring methods. | | * Maximum integer, used as a default value for substring methods. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static const int32_t npos = 0x7fffffff; | | static const int32_t npos = 0x7fffffff; | |
| | | | |
| /** | | /** | |
| * Returns a substring of this StringPiece. | | * Returns a substring of this StringPiece. | |
| * @param pos start position; must be non-negative and <= length(). | | * @param pos start position; must be non-negative and <= length(). | |
| * @param len length of the substring; | | * @param len length of the substring; | |
| * must be non-negative and will be pinned to at most length()
- pos. | | * must be non-negative and will be pinned to at most length()
- pos. | |
| * @return the substring StringPiece | | * @return the substring StringPiece | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| StringPiece substr(int32_t pos, int32_t len = npos) const { | | StringPiece substr(int32_t pos, int32_t len = npos) const { | |
| return StringPiece(*this, pos, len); | | return StringPiece(*this, pos, len); | |
| } | | } | |
| }; | | }; | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif // __STRINGPIECE_H__ | | #endif // __STRINGPIECE_H__ | |
| | | | |
End of changes. 17 change blocks. |
| 17 lines changed or deleted | | 17 lines changed or added | |
|
| tmutamt.h | | tmutamt.h | |
| /* | | /* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
|
| * Copyright (C) 2009, Google, International Business Machines Corporation
and * | | * Copyright (C) 2009-2010, Google, International Business Machines Corpora
tion and * | |
| * others. All Rights Reserved.
* | | * others. All Rights Reserved.
* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
| */ | | */ | |
| | | | |
| #ifndef __TMUTAMT_H__ | | #ifndef __TMUTAMT_H__ | |
| #define __TMUTAMT_H__ | | #define __TMUTAMT_H__ | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: time unit amount object. | | * \brief C++ API: time unit amount object. | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| #include "unicode/tmunit.h" | | #include "unicode/tmunit.h" | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * Express a duration as a time unit and number. Patterned after Currency. | | * Express a duration as a time unit and number. Patterned after Currency. | |
| * @see TimeUnitAmount | | * @see TimeUnitAmount | |
| * @see TimeUnitFormat | | * @see TimeUnitFormat | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_I18N_API TimeUnitAmount: public Measure { | | class U_I18N_API TimeUnitAmount: public Measure { | |
| public: | | public: | |
| /** | | /** | |
| * Construct TimeUnitAmount object with the given number and the | | * Construct TimeUnitAmount object with the given number and the | |
| * given time unit. | | * given time unit. | |
| * @param number a numeric object; number.isNumeric() must be TR
UE | | * @param number a numeric object; number.isNumeric() must be TR
UE | |
| * @param timeUnitField the time unit field of a time unit | | * @param timeUnitField the time unit field of a time unit | |
| * @param status the input-output error code. | | * @param status the input-output error code. | |
| * If the number is not numeric or the timeUnitFie
ld | | * If the number is not numeric or the timeUnitFie
ld | |
| * is not valid, | | * is not valid, | |
| * then this will be set to a failing value: | | * then this will be set to a failing value: | |
| * U_ILLEGAL_ARGUMENT_ERROR. | | * U_ILLEGAL_ARGUMENT_ERROR. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitAmount(const Formattable& number, | | TimeUnitAmount(const Formattable& number, | |
| TimeUnit::UTimeUnitFields timeUnitField, | | TimeUnit::UTimeUnitFields timeUnitField, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Construct TimeUnitAmount object with the given numeric amount and th
e | | * Construct TimeUnitAmount object with the given numeric amount and th
e | |
| * given time unit. | | * given time unit. | |
| * @param amount a numeric amount. | | * @param amount a numeric amount. | |
| * @param timeUnitField the time unit field on which a time unit amount | | * @param timeUnitField the time unit field on which a time unit amount | |
| * object will be created. | | * object will be created. | |
| * @param status the input-output error code. | | * @param status the input-output error code. | |
| * If the timeUnitField is not valid, | | * If the timeUnitField is not valid, | |
| * then this will be set to a failing value: | | * then this will be set to a failing value: | |
| * U_ILLEGAL_ARGUMENT_ERROR. | | * U_ILLEGAL_ARGUMENT_ERROR. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField, | | TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Copy constructor | | * Copy constructor | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitAmount(const TimeUnitAmount& other); | | TimeUnitAmount(const TimeUnitAmount& other); | |
| | | | |
| /** | | /** | |
| * Assignment operator | | * Assignment operator | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitAmount& operator=(const TimeUnitAmount& other); | | TimeUnitAmount& operator=(const TimeUnitAmount& other); | |
| | | | |
| /** | | /** | |
| * Clone. | | * Clone. | |
| * @return a polymorphic clone of this object. The result will have the
same class as returned by getDynamicClassID(). | | * @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.4 | |
| */ | | */ | |
| virtual UObject* clone() const; | | virtual UObject* clone() const; | |
| | | | |
| /** | | /** | |
| * Destructor | | * Destructor | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual ~TimeUnitAmount(); | | virtual ~TimeUnitAmount(); | |
| | | | |
| /** | | /** | |
| * Equality operator. | | * Equality operator. | |
| * @param other the object to compare to. | | * @param other the object to compare to. | |
| * @return true if this object is equal to the given object. | | * @return true if this object is equal to the given object. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UBool operator==(const UObject& other) const; | | virtual UBool operator==(const UObject& other) const; | |
| | | | |
| /** | | /** | |
| * Not-equality operator. | | * Not-equality operator. | |
| * @param other the object to compare to. | | * @param other the object to compare to. | |
| * @return true if this object is not equal to the given object. | | * @return true if this object is not equal to the given object. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool operator!=(const UObject& other) const; | | UBool operator!=(const UObject& other) const; | |
| | | | |
| /** | | /** | |
| * Return the class ID for this class. This is useful only for comparin
g to | | * Return the class ID for this class. This is useful only for comparin
g to | |
| * a return value from getDynamicClassID(). For example: | | * a return value from getDynamicClassID(). For example: | |
| * <pre> | | * <pre> | |
| * . Base* polymorphic_pointer = createPolymorphicObject(); | | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
| * . if (polymorphic_pointer->getDynamicClassID() == | | * . if (polymorphic_pointer->getDynamicClassID() == | |
| * . erived::getStaticClassID()) ... | | * . erived::getStaticClassID()) ... | |
| * </pre> | | * </pre> | |
| * @return The class ID for all objects of this class. | | * @return The class ID for all objects of this class. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| /** | | /** | |
| * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. Th
is | | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. Th
is | |
| * method is to implement a simple version of RTTI, since not all C++ | | * method is to implement a simple version of RTTI, since not all C++ | |
| * compilers support genuine RTTI. Polymorphic operator==() and clone() | | * compilers support genuine RTTI. Polymorphic operator==() and clone() | |
| * methods call this method. | | * methods call this method. | |
| * | | * | |
| * @return The class ID for this object. All objects of a | | * @return The class ID for this object. All objects of a | |
| * given class have the same class ID. Objects of | | * given class have the same class ID. Objects of | |
| * other classes have different class IDs. | | * other classes have different class IDs. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID(void) const; | | virtual UClassID getDynamicClassID(void) const; | |
| | | | |
| /** | | /** | |
| * Get the time unit. | | * Get the time unit. | |
| * @return time unit object. | | * @return time unit object. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| const TimeUnit& getTimeUnit() const; | | const TimeUnit& getTimeUnit() const; | |
| | | | |
| /** | | /** | |
| * Get the time unit field value. | | * Get the time unit field value. | |
| * @return time unit field value. | | * @return time unit field value. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnit::UTimeUnitFields getTimeUnitField() const; | | TimeUnit::UTimeUnitFields getTimeUnitField() const; | |
| }; | | }; | |
| | | | |
| inline UBool | | inline UBool | |
| TimeUnitAmount::operator!=(const UObject& other) const { | | TimeUnitAmount::operator!=(const UObject& other) const { | |
| return !operator==(other); | | return !operator==(other); | |
| } | | } | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
End of changes. 14 change blocks. |
| 14 lines changed or deleted | | 14 lines changed or added | |
|
| tmutfmt.h | | tmutfmt.h | |
| /* | | /* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
|
| * Copyright (C) 2009, Google, International Business Machines Corporation
and * | | * Copyright (C) 2010, Google, International Business Machines Corporation
and * | |
| * others. All Rights Reserved.
* | | * others. All Rights Reserved.
* | |
| **************************************************************************
***** | | **************************************************************************
***** | |
| */ | | */ | |
| | | | |
| #ifndef __TMUTFMT_H__ | | #ifndef __TMUTFMT_H__ | |
| #define __TMUTFMT_H__ | | #define __TMUTFMT_H__ | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include "unicode/plurrule.h" | | #include "unicode/plurrule.h" | |
| | | | |
| /** | | /** | |
| * @internal ICU 4.2 | | * @internal ICU 4.2 | |
| */ | | */ | |
| | | | |
| union UHashTok; | | union UHashTok; | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
|
| U_CDECL_BEGIN | | | |
| | | | |
| /** | | | |
| * @internal ICU 4.2 | | | |
| */ | | | |
| UBool U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, UHashTok va | | | |
| l2) ; | | | |
| | | | |
| U_CDECL_END | | | |
| | | | |
| class Hashtable; | | class Hashtable; | |
| | | | |
| /** | | /** | |
| * Format or parse a TimeUnitAmount, using plural rules for the units where
available. | | * Format or parse a TimeUnitAmount, using plural rules for the units where
available. | |
| * | | * | |
| * <P> | | * <P> | |
| * Code Sample: | | * Code Sample: | |
| * <pre> | | * <pre> | |
| * // create time unit amount instance - a combination of Number and time
unit | | * // create time unit amount instance - a combination of Number and time
unit | |
| * UErrorCode status = U_ZERO_ERROR; | | * UErrorCode status = U_ZERO_ERROR; | |
| | | | |
| skipping to change at line 74 | | skipping to change at line 65 | |
| * ((Format*)format)->parseObject(formatted, result, status); | | * ((Format*)format)->parseObject(formatted, result, status); | |
| * if (U_SUCCESS(status)) { | | * if (U_SUCCESS(status)) { | |
| * assert (result == formattable); | | * assert (result == formattable); | |
| * } | | * } | |
| * } | | * } | |
| * </pre> | | * </pre> | |
| * | | * | |
| * <P> | | * <P> | |
| * @see TimeUnitAmount | | * @see TimeUnitAmount | |
| * @see TimeUnitFormat | | * @see TimeUnitFormat | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| class U_I18N_API TimeUnitFormat: public MeasureFormat { | | class U_I18N_API TimeUnitFormat: public MeasureFormat { | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Constants for various styles. | | * Constants for various styles. | |
| * There are 2 styles: full name and abbreviated name. | | * There are 2 styles: full name and abbreviated name. | |
| * For example, for English, the full name for hour duration is "3 hour
s", | | * For example, for English, the full name for hour duration is "3 hour
s", | |
| * and the abbreviated name is "3 hrs". | | * and the abbreviated name is "3 hrs". | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| enum EStyle { | | enum EStyle { | |
| kFull = 0, | | kFull = 0, | |
| kAbbreviate = 1, | | kAbbreviate = 1, | |
| kTotal = 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. | | * Use setLocale and/or setFormat to modify. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitFormat(UErrorCode& status); | | TimeUnitFormat(UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Create TimeUnitFormat given locale, and full name style. | | * Create TimeUnitFormat given locale, and full name style. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitFormat(const Locale& locale, UErrorCode& status); | | TimeUnitFormat(const Locale& locale, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Create TimeUnitFormat given locale and style. | | * Create TimeUnitFormat given locale and style. | |
| * @draft ICU 4.2 | | * @draft ICU 4.2 | |
| */ | | */ | |
| TimeUnitFormat(const Locale& locale, EStyle style, UErrorCode& status); | | TimeUnitFormat(const Locale& locale, EStyle style, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Copy constructor. | | * Copy constructor. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitFormat(const TimeUnitFormat&); | | TimeUnitFormat(const TimeUnitFormat&); | |
| | | | |
| /** | | /** | |
| * deconstructor | | * deconstructor | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual ~TimeUnitFormat(); | | virtual ~TimeUnitFormat(); | |
| | | | |
| /** | | /** | |
| * Clone this Format object polymorphically. The caller owns the result
and | | * Clone this Format object polymorphically. The caller owns the result
and | |
| * should delete it when done. | | * should delete it when done. | |
| * @return A copy of the object. | | * @return A copy of the object. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual Format* clone(void) const; | | virtual Format* clone(void) const; | |
| | | | |
| /** | | /** | |
| * Assignment operator | | * Assignment operator | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| TimeUnitFormat& operator=(const TimeUnitFormat& other); | | TimeUnitFormat& operator=(const TimeUnitFormat& other); | |
| | | | |
| /** | | /** | |
| * Return true if the given Format objects are semantically equal. Obje
cts | | * Return true if the given Format objects are semantically equal. Obje
cts | |
| * of different subclasses are considered unequal. | | * of different subclasses are considered unequal. | |
| * @param other the object to be compared with. | | * @param other the object to be compared with. | |
| * @return true if the given Format objects are semantically eq
ual. | | * @return true if the given Format objects are semantically eq
ual. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UBool operator==(const Format& other) const; | | 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. | | * Objects of different subclasses are considered unequal. | |
| * @param other the object to be compared with. | | * @param other the object to be compared with. | |
| * @return true if the given Format objects are not semantically e
qual. | | * @return true if the given Format objects are not semantically e
qual. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UBool operator!=(const Format& other) const; | | UBool operator!=(const Format& other) const; | |
| | | | |
| /** | | /** | |
| * Set the locale used for formatting or parsing. | | * Set the locale used for formatting or parsing. | |
| * @param locale the locale to be set | | * @param locale the locale to be set | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void setLocale(const Locale& locale, UErrorCode& status); | | 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 format the number formatter to be set | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| void setNumberFormat(const NumberFormat& format, UErrorCode& status); | | void setNumberFormat(const NumberFormat& format, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Format a TimeUnitAmount. | | * Format a TimeUnitAmount. | |
| * If the formattable object is not a time unit amount object, | | * 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 | | * 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. | | * numeric, it returns a failing status: U_ILLEGAL_ARGUMENT_ERROR. | |
| * @see Format#format(const Formattable&, UnicodeString&, FieldPosition
&, UErrorCode&) const | | * @see Format#format(const Formattable&, UnicodeString&, FieldPosition
&, UErrorCode&) const | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UnicodeString& format(const Formattable& obj, | | virtual UnicodeString& format(const Formattable& obj, | |
| UnicodeString& toAppendTo, | | UnicodeString& toAppendTo, | |
| FieldPosition& pos, | | FieldPosition& pos, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
| * Parse a TimeUnitAmount. | | * Parse a TimeUnitAmount. | |
| * @see Format#parseObject(const UnicodeString&, Formattable&, ParsePos
ition&) const; | | * @see Format#parseObject(const UnicodeString&, Formattable&, ParsePos
ition&) const; | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual void parseObject(const UnicodeString& source, | | virtual void parseObject(const UnicodeString& source, | |
| Formattable& result, | | Formattable& result, | |
| ParsePosition& pos) const; | | ParsePosition& pos) const; | |
| | | | |
| /** | | /** | |
| * Return the class ID for this class. This is useful only for comparin
g to | | * Return the class ID for this class. This is useful only for comparin
g to | |
| * a return value from getDynamicClassID(). For example: | | * a return value from getDynamicClassID(). For example: | |
| * <pre> | | * <pre> | |
| * . Base* polymorphic_pointer = createPolymorphicObject(); | | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
| * . if (polymorphic_pointer->getDynamicClassID() == | | * . if (polymorphic_pointer->getDynamicClassID() == | |
| * . erived::getStaticClassID()) ... | | * . erived::getStaticClassID()) ... | |
| * </pre> | | * </pre> | |
| * @return The class ID for all objects of this class. | | * @return The class ID for all objects of this class. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| /** | | /** | |
| * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. Th
is | | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. Th
is | |
| * method is to implement a simple version of RTTI, since not all C++ | | * method is to implement a simple version of RTTI, since not all C++ | |
| * compilers support genuine RTTI. Polymorphic operator==() and clone() | | * compilers support genuine RTTI. Polymorphic operator==() and clone() | |
| * methods call this method. | | * methods call this method. | |
| * | | * | |
| * @return The class ID for this object. All objects of a | | * @return The class ID for this object. All objects of a | |
| * given class have the same class ID. Objects of | | * given class have the same class ID. Objects of | |
| * other classes have different class IDs. | | * other classes have different class IDs. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID(void) const; | | virtual UClassID getDynamicClassID(void) const; | |
| | | | |
| private: | | private: | |
| NumberFormat* fNumberFormat; | | NumberFormat* fNumberFormat; | |
| Locale fLocale; | | Locale fLocale; | |
| Hashtable* fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUN
T]; | | Hashtable* fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUN
T]; | |
| PluralRules* fPluralRules; | | PluralRules* fPluralRules; | |
| EStyle fStyle; | | EStyle fStyle; | |
| | | | |
|
| friend UBool U_CALLCONV tmutfmtHashTableValueComparator(UHashTok val1, | | | |
| UHashTok val2); | | | |
| | | | |
| void create(const Locale& locale, EStyle style, UErrorCode& status); | | void create(const Locale& locale, EStyle style, UErrorCode& status); | |
| | | | |
| // it might actually be simpler to make them Decimal Formats later. | | // it might actually be simpler to make them Decimal Formats later. | |
| // initialize all private data members | | // initialize all private data members | |
| void setup(UErrorCode& status); | | void setup(UErrorCode& status); | |
| | | | |
| // initialize data member without fill in data for fTimeUnitToCountToPa
ttern | | // initialize data member without fill in data for fTimeUnitToCountToPa
ttern | |
| void initDataMembers(UErrorCode& status); | | void initDataMembers(UErrorCode& status); | |
| | | | |
| // initialize fTimeUnitToCountToPatterns from current locale's resource
. | | // initialize fTimeUnitToCountToPatterns from current locale's resource
. | |
| | | | |
End of changes. 19 change blocks. |
| 30 lines changed or deleted | | 17 lines changed or added | |
|
| uchar.h | | uchar.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1997-2009, International Business Machines | | * Copyright (C) 1997-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * File UCHAR.H | | * File UCHAR.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 04/02/97 aliu Creation. | | * 04/02/97 aliu Creation. | |
| * 03/29/99 helena Updated for C APIs. | | * 03/29/99 helena Updated for C APIs. | |
| | | | |
| skipping to change at line 324 | | skipping to change at line 324 | |
| UCHAR_S_TERM=35, | | UCHAR_S_TERM=35, | |
| /** Binary property Variation_Selector (new in Unicode 4.0.1). | | /** Binary property Variation_Selector (new in Unicode 4.0.1). | |
| Indicates all those characters that qualify as Variation Selectors. | | Indicates all those characters that qualify as Variation Selectors. | |
| For details on the behavior of these characters, | | For details on the behavior of these characters, | |
| see StandardizedVariants.html and 15.6 Variation Selectors. | | see StandardizedVariants.html and 15.6 Variation Selectors. | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_VARIATION_SELECTOR=36, | | UCHAR_VARIATION_SELECTOR=36, | |
| /** Binary property NFD_Inert. | | /** Binary property NFD_Inert. | |
| ICU-specific property for characters that are inert under NFD, | | ICU-specific property for characters that are inert under NFD, | |
| i.e., they do not interact with adjacent characters. | | i.e., they do not interact with adjacent characters. | |
|
| Used for example in normalizing transforms in incremental mode | | See the documentation for the Normalizer2 class and the | |
| to find the boundary of safely normalizable text despite possible | | Normalizer2::isInert() method. | |
| 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 . | | | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_NFD_INERT=37, | | UCHAR_NFD_INERT=37, | |
| /** Binary property NFKD_Inert. | | /** Binary property NFKD_Inert. | |
| ICU-specific property for characters that are inert under NFKD, | | ICU-specific property for characters that are inert under NFKD, | |
| i.e., they do not interact with adjacent characters. | | i.e., they do not interact with adjacent characters. | |
|
| Used for example in normalizing transforms in incremental mode | | See the documentation for the Normalizer2 class and the | |
| to find the boundary of safely normalizable text despite possible | | Normalizer2::isInert() method. | |
| text additions. | | | |
| @see UCHAR_NFD_INERT | | | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_NFKD_INERT=38, | | UCHAR_NFKD_INERT=38, | |
| /** Binary property NFC_Inert. | | /** Binary property NFC_Inert. | |
| ICU-specific property for characters that are inert under NFC, | | ICU-specific property for characters that are inert under NFC, | |
| i.e., they do not interact with adjacent characters. | | i.e., they do not interact with adjacent characters. | |
|
| Used for example in normalizing transforms in incremental mode | | See the documentation for the Normalizer2 class and the | |
| to find the boundary of safely normalizable text despite possible | | Normalizer2::isInert() method. | |
| text additions. | | | |
| @see UCHAR_NFD_INERT | | | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_NFC_INERT=39, | | UCHAR_NFC_INERT=39, | |
| /** Binary property NFKC_Inert. | | /** Binary property NFKC_Inert. | |
| ICU-specific property for characters that are inert under NFKC, | | ICU-specific property for characters that are inert under NFKC, | |
| i.e., they do not interact with adjacent characters. | | i.e., they do not interact with adjacent characters. | |
|
| Used for example in normalizing transforms in incremental mode | | See the documentation for the Normalizer2 class and the | |
| to find the boundary of safely normalizable text despite possible | | Normalizer2::isInert() method. | |
| text additions. | | | |
| @see UCHAR_NFD_INERT | | | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_NFKC_INERT=40, | | UCHAR_NFKC_INERT=40, | |
| /** Binary Property Segment_Starter. | | /** Binary Property Segment_Starter. | |
| ICU-specific property for characters that are starters in terms of | | ICU-specific property for characters that are starters in terms of | |
| Unicode normalization and combining character sequences. | | Unicode normalization and combining character sequences. | |
| They have ccc=0 and do not occur in non-initial position of the | | They have ccc=0 and do not occur in non-initial position of the | |
| canonical decomposition of any character | | 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 | | ICU uses this property for segmenting a string for generating a set
of | |
| canonically equivalent strings, e.g. for canonical closure while | | canonically equivalent strings, e.g. for canonical closure while | |
| processing collation tailoring rules. | | processing collation tailoring rules. | |
| @stable ICU 3.0 */ | | @stable ICU 3.0 */ | |
| UCHAR_SEGMENT_STARTER=41, | | UCHAR_SEGMENT_STARTER=41, | |
| /** Binary property Pattern_Syntax (new in Unicode 4.1). | | /** Binary property Pattern_Syntax (new in Unicode 4.1). | |
| See UAX #31 Identifier and Pattern Syntax | | See UAX #31 Identifier and Pattern Syntax | |
| (http://www.unicode.org/reports/tr31/) | | (http://www.unicode.org/reports/tr31/) | |
| @stable ICU 3.4 */ | | @stable ICU 3.4 */ | |
| UCHAR_PATTERN_SYNTAX=42, | | UCHAR_PATTERN_SYNTAX=42, | |
| | | | |
| skipping to change at line 431 | | skipping to change at line 409 | |
| /** Binary property Changes_When_Lowercased. @draft ICU 4.4 */ | | /** Binary property Changes_When_Lowercased. @draft ICU 4.4 */ | |
| UCHAR_CHANGES_WHEN_LOWERCASED=51, | | UCHAR_CHANGES_WHEN_LOWERCASED=51, | |
| /** Binary property Changes_When_Uppercased. @draft ICU 4.4 */ | | /** Binary property Changes_When_Uppercased. @draft ICU 4.4 */ | |
| UCHAR_CHANGES_WHEN_UPPERCASED=52, | | UCHAR_CHANGES_WHEN_UPPERCASED=52, | |
| /** Binary property Changes_When_Titlecased. @draft ICU 4.4 */ | | /** Binary property Changes_When_Titlecased. @draft ICU 4.4 */ | |
| UCHAR_CHANGES_WHEN_TITLECASED=53, | | UCHAR_CHANGES_WHEN_TITLECASED=53, | |
| /** Binary property Changes_When_Casefolded. @draft ICU 4.4 */ | | /** Binary property Changes_When_Casefolded. @draft ICU 4.4 */ | |
| UCHAR_CHANGES_WHEN_CASEFOLDED=54, | | UCHAR_CHANGES_WHEN_CASEFOLDED=54, | |
| /** Binary property Changes_When_Casemapped. @draft ICU 4.4 */ | | /** Binary property Changes_When_Casemapped. @draft ICU 4.4 */ | |
| UCHAR_CHANGES_WHEN_CASEMAPPED=55, | | 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. @sta
ble ICU 2.1 */ | | /** One more than the last constant for binary Unicode properties. @sta
ble ICU 2.1 */ | |
|
| UCHAR_BINARY_LIMIT=56, | | UCHAR_BINARY_LIMIT=57, | |
| | | | |
| /** Enumerated property Bidi_Class. | | /** Enumerated property Bidi_Class. | |
| Same as u_charDirection, returns UCharDirection values. @stable ICU
2.2 */ | | Same as u_charDirection, returns UCharDirection values. @stable ICU
2.2 */ | |
| UCHAR_BIDI_CLASS=0x1000, | | UCHAR_BIDI_CLASS=0x1000, | |
| /** First constant for enumerated/integer Unicode properties. @stable I
CU 2.2 */ | | /** First constant for enumerated/integer Unicode properties. @stable I
CU 2.2 */ | |
| UCHAR_INT_START=UCHAR_BIDI_CLASS, | | UCHAR_INT_START=UCHAR_BIDI_CLASS, | |
| /** Enumerated property Block. | | /** Enumerated property Block. | |
| Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2
*/ | | Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2
*/ | |
| UCHAR_BLOCK=0x1001, | | UCHAR_BLOCK=0x1001, | |
| /** Enumerated property Canonical_Combining_Class. | | /** Enumerated property Canonical_Combining_Class. | |
| | | | |
End of changes. 8 change blocks. |
| 33 lines changed or deleted | | 13 lines changed or added | |
|
| ucnvsel.h | | ucnvsel.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
|
| * Copyright (C) 2008-2009, International Business Machines | | * Copyright (C) 2008-2010, International Business Machines | |
| * Corporation, Google and others. All Rights Reserved. | | * Corporation, Google and others. All Rights Reserved. | |
| * | | * | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| */ | | */ | |
| /* | | /* | |
| * Author : eldawy@google.com (Mohamed Eldawy) | | * Author : eldawy@google.com (Mohamed Eldawy) | |
| * ucnvsel.h | | * ucnvsel.h | |
| * | | * | |
| * Purpose: To generate a list of encodings capable of handling | | * Purpose: To generate a list of encodings capable of handling | |
| * a given Unicode text | | * a given Unicode text | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| * If 0, builds a selector for all available conve
rters. | | * If 0, builds a selector for all available conve
rters. | |
| * @param excludedCodePoints a set of code points to be excluded from consi
deration. | | * @param excludedCodePoints a set of code points to be excluded from consi
deration. | |
| * That is, excluded code points in a string do n
ot change | | * That is, excluded code points in a string do n
ot change | |
| * the selection result. (They might be handled b
y a callback.) | | * the selection result. (They might be handled b
y a callback.) | |
| * Use NULL to exclude nothing. | | * Use NULL to exclude nothing. | |
| * @param whichSet what converter set to use? Use this to determine whether | | * @param whichSet what converter set to use? Use this to determine whether | |
| * to consider only roundtrip mappings or also fallbacks. | | * to consider only roundtrip mappings or also fallbacks. | |
| * @param status an in/out ICU UErrorCode | | * @param status an in/out ICU UErrorCode | |
| * @return the new selector | | * @return the new selector | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI UConverterSelector* U_EXPORT2 | | U_STABLE UConverterSelector* U_EXPORT2 | |
| ucnvsel_open(const char* const* converterList, int32_t converterListSize, | | ucnvsel_open(const char* const* converterList, int32_t converterListSize, | |
| const USet* excludedCodePoints, | | const USet* excludedCodePoints, | |
| const UConverterUnicodeSet whichSet, UErrorCode* status); | | const UConverterUnicodeSet whichSet, UErrorCode* status); | |
| | | | |
| /** | | /** | |
| * Closes a selector. | | * Closes a selector. | |
| * If any Enumerations were returned by ucnv_select*, they become invalid. | | * If any Enumerations were returned by ucnv_select*, they become invalid. | |
| * They can be closed before or after calling ucnv_closeSelector, | | * They can be closed before or after calling ucnv_closeSelector, | |
| * but should never be used after the selector is closed. | | * but should never be used after the selector is closed. | |
| * | | * | |
| * @see ucnv_selectForString | | * @see ucnv_selectForString | |
| * @see ucnv_selectForUTF8 | | * @see ucnv_selectForUTF8 | |
| * | | * | |
| * @param sel selector to close | | * @param sel selector to close | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| ucnvsel_close(UConverterSelector *sel); | | ucnvsel_close(UConverterSelector *sel); | |
| | | | |
|
| #ifdef XP_CPLUSPLUS | | #if U_SHOW_CPLUSPLUS_API | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * \class LocalUConverterSelectorPointer | | * \class LocalUConverterSelectorPointer | |
| * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). | | * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). | |
| * For most methods see the LocalPointerBase base class. | | * For most methods see the LocalPointerBase base class. | |
| * | | * | |
| * @see LocalPointerBase | | * @see LocalPointerBase | |
| * @see LocalPointer | | * @see LocalPointer | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 123 | |
| * This is much faster than creating a selector from scratch. | | * This is much faster than creating a selector from scratch. | |
| * Using a serialized form from a different machine (endianness/charset) is
supported. | | * Using a serialized form from a different machine (endianness/charset) is
supported. | |
| * | | * | |
| * @param buffer pointer to the serialized form of a converter selector; | | * @param buffer pointer to the serialized form of a converter selector; | |
| * must be 32-bit-aligned | | * must be 32-bit-aligned | |
| * @param length the capacity of this buffer (can be equal to or larger tha
n | | * @param length the capacity of this buffer (can be equal to or larger tha
n | |
| * the actual data length) | | * the actual data length) | |
| * @param status an in/out ICU UErrorCode | | * @param status an in/out ICU UErrorCode | |
| * @return the new selector | | * @return the new selector | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI UConverterSelector* U_EXPORT2 | | U_STABLE UConverterSelector* U_EXPORT2 | |
| ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode*
status); | | ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode*
status); | |
| | | | |
| /** | | /** | |
| * Serialize a selector into a linear buffer. | | * Serialize a selector into a linear buffer. | |
| * The serialized form is portable to different machines. | | * The serialized form is portable to different machines. | |
| * | | * | |
| * @param sel selector to consider | | * @param sel selector to consider | |
| * @param buffer pointer to 32-bit-aligned memory to be filled with the | | * @param buffer pointer to 32-bit-aligned memory to be filled with the | |
| * serialized form of this converter selector | | * serialized form of this converter selector | |
| * @param bufferCapacity the capacity of this buffer | | * @param bufferCapacity the capacity of this buffer | |
| * @param status an in/out ICU UErrorCode | | * @param status an in/out ICU UErrorCode | |
| * @return the required buffer capacity to hold serialize data (even if the
call fails | | * @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 capa
city) | | * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capa
city) | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| ucnvsel_serialize(const UConverterSelector* sel, | | ucnvsel_serialize(const UConverterSelector* sel, | |
| void* buffer, int32_t bufferCapacity, UErrorCode* status)
; | | void* buffer, int32_t bufferCapacity, UErrorCode* status)
; | |
| | | | |
| /** | | /** | |
| * Select converters that can map all characters in a UTF-16 string, | | * Select converters that can map all characters in a UTF-16 string, | |
| * ignoring the excluded code points. | | * ignoring the excluded code points. | |
| * | | * | |
| * @param sel a selector | | * @param sel a selector | |
| * @param s UTF-16 string | | * @param s UTF-16 string | |
| * @param length length of the string, or -1 if NUL-terminated | | * @param length length of the string, or -1 if NUL-terminated | |
| * @param status an in/out ICU UErrorCode | | * @param status an in/out ICU UErrorCode | |
| * @return an enumeration containing encoding names. | | * @return an enumeration containing encoding names. | |
| * The returned encoding names and their order will be the same as | | * The returned encoding names and their order will be the same as | |
| * supplied when building the selector. | | * supplied when building the selector. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI UEnumeration * U_EXPORT2 | | U_STABLE UEnumeration * U_EXPORT2 | |
| ucnvsel_selectForString(const UConverterSelector* sel, | | ucnvsel_selectForString(const UConverterSelector* sel, | |
| const UChar *s, int32_t length, UErrorCode *status)
; | | const UChar *s, int32_t length, UErrorCode *status)
; | |
| | | | |
| /** | | /** | |
| * Select converters that can map all characters in a UTF-8 string, | | * Select converters that can map all characters in a UTF-8 string, | |
| * ignoring the excluded code points. | | * ignoring the excluded code points. | |
| * | | * | |
| * @param sel a selector | | * @param sel a selector | |
| * @param s UTF-8 string | | * @param s UTF-8 string | |
| * @param length length of the string, or -1 if NUL-terminated | | * @param length length of the string, or -1 if NUL-terminated | |
| * @param status an in/out ICU UErrorCode | | * @param status an in/out ICU UErrorCode | |
| * @return an enumeration containing encoding names. | | * @return an enumeration containing encoding names. | |
| * The returned encoding names and their order will be the same as | | * The returned encoding names and their order will be the same as | |
| * supplied when building the selector. | | * supplied when building the selector. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_CAPI UEnumeration * U_EXPORT2 | | U_STABLE UEnumeration * U_EXPORT2 | |
| ucnvsel_selectForUTF8(const UConverterSelector* sel, | | ucnvsel_selectForUTF8(const UConverterSelector* sel, | |
| const char *s, int32_t length, UErrorCode *status); | | const char *s, int32_t length, UErrorCode *status); | |
| | | | |
| #endif /* __ICU_UCNV_SEL_H__ */ | | #endif /* __ICU_UCNV_SEL_H__ */ | |
| | | | |
End of changes. 14 change blocks. |
| 14 lines changed or deleted | | 14 lines changed or added | |
|
| udatpg.h | | udatpg.h | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 91 | |
| UDATPG_SECOND_FIELD, | | UDATPG_SECOND_FIELD, | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_FRACTIONAL_SECOND_FIELD, | | UDATPG_FRACTIONAL_SECOND_FIELD, | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_ZONE_FIELD, | | UDATPG_ZONE_FIELD, | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_FIELD_COUNT | | UDATPG_FIELD_COUNT | |
| } UDateTimePatternField; | | } 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_replaceFieldTypesWith | |
| | | Options. | |
| | | * @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, | |
| | | /** @draft ICU 4.4 */ | |
| | | UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1 | |
| | | } UDateTimePatternMatchOptions; | |
| | | | |
| | | /** | |
| * Status return values from udatpg_addPattern(). | | * Status return values from udatpg_addPattern(). | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| typedef enum UDateTimePatternConflict { | | typedef enum UDateTimePatternConflict { | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_NO_CONFLICT, | | UDATPG_NO_CONFLICT, | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_BASE_CONFLICT, | | UDATPG_BASE_CONFLICT, | |
| /** @stable ICU 3.8 */ | | /** @stable ICU 3.8 */ | |
| UDATPG_CONFLICT, | | UDATPG_CONFLICT, | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 150 | |
| udatpg_openEmpty(UErrorCode *pErrorCode); | | udatpg_openEmpty(UErrorCode *pErrorCode); | |
| | | | |
| /** | | /** | |
| * Close a generator. | | * Close a generator. | |
| * @param dtpg a pointer to UDateTimePatternGenerator. | | * @param dtpg a pointer to UDateTimePatternGenerator. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| udatpg_close(UDateTimePatternGenerator *dtpg); | | udatpg_close(UDateTimePatternGenerator *dtpg); | |
| | | | |
|
| #ifdef XP_CPLUSPLUS | | #if U_SHOW_CPLUSPLUS_API | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * \class LocalUDateTimePatternGeneratorPointer | | * \class LocalUDateTimePatternGeneratorPointer | |
| * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_clo
se(). | | * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_clo
se(). | |
| * For most methods see the LocalPointerBase base class. | | * For most methods see the LocalPointerBase base class. | |
| * | | * | |
| * @see LocalPointerBase | | * @see LocalPointerBase | |
| * @see LocalPointer | | * @see LocalPointer | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 210 | |
| * @return the length of bestPattern. | | * @return the length of bestPattern. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| U_DRAFT int32_t U_EXPORT2 | | U_DRAFT int32_t U_EXPORT2 | |
| udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, | | udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, | |
| const UChar *skeleton, int32_t length, | | const UChar *skeleton, int32_t length, | |
| UChar *bestPattern, int32_t capacity, | | UChar *bestPattern, int32_t capacity, | |
| UErrorCode *pErrorCode); | | 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 obj | |
| | | ect, | |
| | | * 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 obje | |
| | | ct. | |
| | | * | |
| | | * @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, | | * Get a unique skeleton from a given pattern. For example, | |
| * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". | | * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". | |
| * | | * | |
| * Note that this function uses a non-const UDateTimePatternGenerator: | | * Note that this function uses a non-const UDateTimePatternGenerator: | |
| * It uses a stateful pattern parser which is set up for each generator ob
ject, | | * It uses a stateful pattern parser which is set up for each generator ob
ject, | |
| * rather than creating one for each function call. | | * rather than creating one for each function call. | |
| * Consecutive calls to this function do not affect each other, | | * Consecutive calls to this function do not affect each other, | |
| * but this function cannot be used concurrently on a single generator obj
ect. | | * but this function cannot be used concurrently on a single generator obj
ect. | |
| * | | * | |
| * @param dtpg a pointer to UDateTimePatternGenerator. | | * @param dtpg a pointer to UDateTimePatternGenerator. | |
| | | | |
| skipping to change at line 450 | | skipping to change at line 503 | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| U_DRAFT int32_t U_EXPORT2 | | U_DRAFT int32_t U_EXPORT2 | |
| udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, | | udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, | |
| const UChar *pattern, int32_t patternLength, | | const UChar *pattern, int32_t patternLength, | |
| const UChar *skeleton, int32_t skeletonLength, | | const UChar *skeleton, int32_t skeletonLength, | |
| UChar *dest, int32_t destCapacity, | | UChar *dest, int32_t destCapacity, | |
| UErrorCode *pErrorCode); | | UErrorCode *pErrorCode); | |
| | | | |
| /** | | /** | |
|
| | | * Adjusts the field types (width and subtype) of a pattern to match what i | |
| | | s | |
| | | * 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 obj | |
| | | ect, | |
| | | * 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 obje | |
| | | ct. | |
| | | * | |
| | | * @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 thi | |
| | | s | |
| | | * would not happen otherwise). For default behavior, use | |
| | | * UDATPG_MATCH_NO_OPTIONS. | |
| | | * @param dest pattern adjusted to match the skeleton fields widths and su | |
| | | btypes. | |
| | | * @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 patternLe | |
| | | ngth, | |
| | | const UChar *skeleton, int32_t skeleton | |
| | | Length, | |
| | | UDateTimePatternMatchOptions options, | |
| | | UChar *dest, int32_t destCapacity, | |
| | | UErrorCode *pErrorCode); | |
| | | | |
| | | /** | |
| * Return a UEnumeration list of all the skeletons in canonical form. | | * Return a UEnumeration list of all the skeletons in canonical form. | |
| * Call udatpg_getPatternForSkeleton() to get the corresponding pattern. | | * Call udatpg_getPatternForSkeleton() to get the corresponding pattern. | |
| * | | * | |
| * @param dtpg a pointer to UDateTimePatternGenerator. | | * @param dtpg a pointer to UDateTimePatternGenerator. | |
| * @param pErrorCode a pointer to the UErrorCode which must not indicate a | | * @param pErrorCode a pointer to the UErrorCode which must not indicate a | |
| * failure before the function call | | * failure before the function call | |
| * @return a UEnumeration list of all the skeletons | | * @return a UEnumeration list of all the skeletons | |
| * The caller must close the object. | | * The caller must close the object. | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 105 lines changed or added | |
|
| umsg.h | | umsg.h | |
|
| /* | | /******************************************************************** | |
| *************************************************************************** | | * COPYRIGHT: | |
| **** | | * Copyright (c) 1997-2010, International Business Machines Corporation and | |
| * Copyright (C) 1996-2009, International Business Machines Corporation | | * others. All Rights Reserved. | |
| * and others. All Rights Reserved. | | * Copyright (C) 2010 , Yahoo! Inc. | |
| *************************************************************************** | | ******************************************************************** | |
| **** | | * | |
| * | | * file name: umsg.h | |
| * file name: umsg.h | | * encoding: US-ASCII | |
| * encoding: US-ASCII | | * tab size: 8 (not used) | |
| * tab size: 8 (not used) | | * indentation:4 | |
| * indentation:4 | | * | |
| * | | * Change history: | |
| * Change history: | | * | |
| * | | * 08/5/2001 Ram Added C wrappers for C++ API. | |
| * 08/5/2001 Ram Added C wrappers for C++ API. | | * | |
| * | | ********************************************************************/ | |
| * | | | |
| */ | | | |
| | | | |
| #ifndef UMSG_H | | #ifndef UMSG_H | |
| #define UMSG_H | | #define UMSG_H | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/localpointer.h" | | #include "unicode/localpointer.h" | |
| #include "unicode/uloc.h" | | #include "unicode/uloc.h" | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 109 | |
| * printf("%s\n", austrdup(result) ); //austrdup( a function used to
convert UChar* to char*) | | * printf("%s\n", austrdup(result) ); //austrdup( a function used to
convert UChar* to char*) | |
| * free(result); | | * free(result); | |
| * } | | * } | |
| * // output, with different testArgs: | | * // output, with different testArgs: | |
| * // output: The disk "MyDisk" contains 100 files. | | * // output: The disk "MyDisk" contains 100 files. | |
| * // output: The disk "MyDisk" contains one file. | | * // output: The disk "MyDisk" contains one file. | |
| * // output: The disk "MyDisk" contains no files. | | * // output: The disk "MyDisk" contains no files. | |
| * \endcode | | * \endcode | |
| * </pre> | | * </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, resultle | |
| | | ngth, &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: | | * The pattern is of the following form. Legend: | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * {optional item} | | * {optional item} | |
| * (group that may be repeated)* | | * (group that may be repeated)* | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
| * Do not confuse optional items with items inside quotes braces, such | | * Do not confuse optional items with items inside quotes braces, such | |
| * as this: "{". Quoted braces are literals. | | * as this: "{". Quoted braces are literals. | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * messageFormatPattern := string ( "{" messageFormatElement "}" stri
ng )* | | * messageFormatPattern := string ( "{" messageFormatElement "}" stri
ng )* | |
| * | | * | |
| * messageFormatElement := argument { "," elementFormat } | | * messageFormatElement := argument { "," elementFormat } | |
| * | | * | |
| * elementFormat := "time" { "," datetimeStyle } | | * elementFormat := "time" { "," datetimeStyle } | |
| * | "date" { "," datetimeStyle } | | * | "date" { "," datetimeStyle } | |
| * | "number" { "," numberStyle } | | * | "number" { "," numberStyle } | |
| * | "choice" "," choiceStyle | | * | "choice" "," choiceStyle | |
|
| | | * | "select" "," selectStyle | |
| * | | * | |
| * datetimeStyle := "short" | | * datetimeStyle := "short" | |
| * | "medium" | | * | "medium" | |
| * | "long" | | * | "long" | |
| * | "full" | | * | "full" | |
| * | dateFormatPattern | | * | dateFormatPattern | |
| * | | * | |
| * numberStyle := "currency" | | * numberStyle := "currency" | |
| * | "percent" | | * | "percent" | |
| * | "integer" | | * | "integer" | |
| * | numberFormatPattern | | * | numberFormatPattern | |
| * | | * | |
| * choiceStyle := choiceFormatPattern | | * choiceStyle := choiceFormatPattern | |
|
| | | * | |
| | | * selectStyle := selectFormatPattern | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
| * If there is no elementFormat, then the argument must be a string, | | * If there is no elementFormat, then the argument must be a string, | |
| * which is substituted. If there is no dateTimeStyle or numberStyle, | | * which is substituted. If there is no dateTimeStyle or numberStyle, | |
| * then the default format is used (e.g. NumberFormat.getInstance(), | | * then the default format is used (e.g. NumberFormat.getInstance(), | |
| * DateFormat.getDefaultTime() or DateFormat.getDefaultDate(). For | | * DateFormat.getDefaultTime() or DateFormat.getDefaultDate(). For | |
| * a ChoiceFormat, the pattern must always be specified, since there | | * a ChoiceFormat, the pattern must always be specified, since there | |
| * is no default. | | * is no default. | |
| * <P> | | * <P> | |
| * In strings, single quotes can be used to quote the "{" sign if | | * In strings, single quotes can be used to quote the "{" sign if | |
| | | | |
| skipping to change at line 456 | | skipping to change at line 498 | |
| | | | |
| /** | | /** | |
| * Close a UMessageFormat. | | * Close a UMessageFormat. | |
| * Once closed, a UMessageFormat may no longer be used. | | * Once closed, a UMessageFormat may no longer be used. | |
| * @param format The formatter to close. | | * @param format The formatter to close. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| umsg_close(UMessageFormat* format); | | umsg_close(UMessageFormat* format); | |
| | | | |
|
| #ifdef XP_CPLUSPLUS | | #if U_SHOW_CPLUSPLUS_API | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * \class LocalUMessageFormatPointer | | * \class LocalUMessageFormatPointer | |
| * "Smart pointer" class, closes a UMessageFormat via umsg_close(). | | * "Smart pointer" class, closes a UMessageFormat via umsg_close(). | |
| * For most methods see the LocalPointerBase base class. | | * For most methods see the LocalPointerBase base class. | |
| * | | * | |
| * @see LocalPointerBase | | * @see LocalPointerBase | |
| * @see LocalPointer | | * @see LocalPointer | |
| | | | |
End of changes. 5 change blocks. |
| 20 lines changed or deleted | | 65 lines changed or added | |
|
| uniset.h | | uniset.h | |
| /* | | /* | |
| *************************************************************************** | | *************************************************************************** | |
|
| * Copyright (C) 1999-2009, International Business Machines Corporation | | * Copyright (C) 1999-2010, International Business Machines Corporation | |
| * and others. All Rights Reserved. | | * and others. All Rights Reserved. | |
| *************************************************************************** | | *************************************************************************** | |
| * Date Name Description | | * Date Name Description | |
| * 10/20/99 alan Creation. | | * 10/20/99 alan Creation. | |
| *************************************************************************** | | *************************************************************************** | |
| */ | | */ | |
| | | | |
| #ifndef UNICODESET_H | | #ifndef UNICODESET_H | |
| #define UNICODESET_H | | #define UNICODESET_H | |
| | | | |
| | | | |
| skipping to change at line 479 | | skipping to change at line 479 | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual int32_t hashCode(void) const; | | virtual int32_t hashCode(void) const; | |
| | | | |
| /** | | /** | |
| * Get a UnicodeSet pointer from a USet | | * Get a UnicodeSet pointer from a USet | |
| * | | * | |
| * @param uset a USet (the ICU plain C type for UnicodeSet) | | * @param uset a USet (the ICU plain C type for UnicodeSet) | |
| * @return the corresponding UnicodeSet pointer. | | * @return the corresponding UnicodeSet pointer. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| inline static UnicodeSet *fromUSet(USet *uset); | | inline static UnicodeSet *fromUSet(USet *uset); | |
| | | | |
| /** | | /** | |
| * Get a UnicodeSet pointer from a const USet | | * Get a UnicodeSet pointer from a const USet | |
| * | | * | |
| * @param uset a const USet (the ICU plain C type for UnicodeSet) | | * @param uset a const USet (the ICU plain C type for UnicodeSet) | |
| * @return the corresponding UnicodeSet pointer. | | * @return the corresponding UnicodeSet pointer. | |
| * | | * | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| inline static const UnicodeSet *fromUSet(const USet *uset); | | inline static const UnicodeSet *fromUSet(const USet *uset); | |
| | | | |
| /** | | /** | |
| * Produce a USet * pointer for this UnicodeSet. | | * Produce a USet * pointer for this UnicodeSet. | |
| * USet is the plain C type for UnicodeSet | | * USet is the plain C type for UnicodeSet | |
| * | | * | |
| * @return a USet pointer for this UnicodeSet | | * @return a USet pointer for this UnicodeSet | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| inline USet *toUSet(); | | inline USet *toUSet(); | |
| | | | |
| /** | | /** | |
| * Produce a const USet * pointer for this UnicodeSet. | | * Produce a const USet * pointer for this UnicodeSet. | |
| * USet is the plain C type for UnicodeSet | | * USet is the plain C type for UnicodeSet | |
| * | | * | |
| * @return a const USet pointer for this UnicodeSet | | * @return a const USet pointer for this UnicodeSet | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| inline const USet * toUSet() const; | | inline const USet * toUSet() const; | |
| | | | |
| //---------------------------------------------------------------- | | //---------------------------------------------------------------- | |
| // Freezable API | | // Freezable API | |
| //---------------------------------------------------------------- | | //---------------------------------------------------------------- | |
| | | | |
| /** | | /** | |
| * Determines whether the set has been frozen (made immutable) or not. | | * Determines whether the set has been frozen (made immutable) or not. | |
| * See the ICU4J Freezable interface for details. | | * See the ICU4J Freezable interface for details. | |
| | | | |
| skipping to change at line 863 | | skipping to change at line 863 | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the length of the initial substring according to the spanCon
dition; | | * @return the length of the initial substring according to the spanCon
dition; | |
| * 0 if the start of the string does not fit the spanCondition | | * 0 if the start of the string does not fit the spanCondition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @see USetSpanCondition | |
| */ | | */ | |
| int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCond
ition) const; | | int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCond
ition) const; | |
| | | | |
| /** | | /** | |
|
| | | * Returns the end of the substring of the input string according to th | |
| | | e USetSpanCondition. | |
| | | * Same as <code>start+span(s.getBuffer()+start, s.length()-start, span | |
| | | Condition)</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 spanCond | |
| | | ition; | |
| | | * the substring s.tempSubStringBetween(start, end) fulfills th | |
| | | e spanCondition | |
| | | * @draft ICU 4.4 | |
| | | * @see USetSpanCondition | |
| | | */ | |
| | | inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCond | |
| | | ition spanCondition) const; | |
| | | | |
| | | /** | |
| * Returns the start of the trailing substring of the input string whic
h | | * Returns the start of the trailing substring of the input string whic
h | |
| * consists only of characters and strings that are contained in this s
et | | * consists only of characters and strings that are contained in this s
et | |
| * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | | * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | |
| * or only of characters and strings that are not contained | | * or only of characters and strings that are not contained | |
| * in this set (USET_SPAN_NOT_CONTAINED). | | * in this set (USET_SPAN_NOT_CONTAINED). | |
| * See USetSpanCondition for details. | | * See USetSpanCondition for details. | |
| * Unpaired surrogates are treated according to contains() of their sur
rogate code points. | | * Unpaired surrogates are treated according to contains() of their sur
rogate code points. | |
| * This function works faster with a frozen set and with a non-negative
string length argument. | | * This function works faster with a frozen set and with a non-negative
string length argument. | |
| * @param s start of the string | | * @param s start of the string | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the start of the trailing substring according to the spanCon
dition; | | * @return the start of the trailing substring according to the spanCon
dition; | |
| * the string length if the end of the string does not fit the
spanCondition | | * the string length if the end of the string does not fit the
spanCondition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @see USetSpanCondition | |
| */ | | */ | |
| int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition span
Condition) const; | | int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition span
Condition) 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 oper | |
| | | ation | |
| | | * (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, USetSpan | |
| | | Condition spanCondition) const; | |
| | | | |
| | | /** | |
| * Returns the length of the initial substring of the input string whic
h | | * Returns the length of the initial substring of the input string whic
h | |
| * consists only of characters and strings that are contained in this s
et | | * consists only of characters and strings that are contained in this s
et | |
| * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | | * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | |
| * or only of characters and strings that are not contained | | * or only of characters and strings that are not contained | |
| * in this set (USET_SPAN_NOT_CONTAINED). | | * in this set (USET_SPAN_NOT_CONTAINED). | |
| * See USetSpanCondition for details. | | * See USetSpanCondition for details. | |
| * Similar to the strspn() C library function. | | * Similar to the strspn() C library function. | |
| * Malformed byte sequences are treated according to contains(0xfffd). | | * Malformed byte sequences are treated according to contains(0xfffd). | |
| * This function works faster with a frozen set and with a non-negative
string length argument. | | * This function works faster with a frozen set and with a non-negative
string length argument. | |
| * @param s start of the string (UTF-8) | | * @param s start of the string (UTF-8) | |
| | | | |
| skipping to change at line 1292 | | skipping to change at line 1321 | |
| * (Here foldCase(x) refers to the operation u_strFoldCase, and a | | * (Here foldCase(x) refers to the operation u_strFoldCase, and a | |
| * == b denotes that the contents are the same, not pointer | | * == b denotes that the contents are the same, not pointer | |
| * comparison.) | | * comparison.) | |
| * | | * | |
| * A frozen set will not be modified. | | * A frozen set will not be modified. | |
| * | | * | |
| * @param attribute bitmask for attributes to close over. | | * @param attribute bitmask for attributes to close over. | |
| * Currently only the USET_CASE bit is supported. Any undefined bits | | * Currently only the USET_CASE bit is supported. Any undefined bits | |
| * are ignored. | | * are ignored. | |
| * @return a reference to this set. | | * @return a reference to this set. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| UnicodeSet& closeOver(int32_t attribute); | | UnicodeSet& closeOver(int32_t attribute); | |
| | | | |
| /** | | /** | |
| * Remove all strings from this set. | | * Remove all strings from this set. | |
| * | | * | |
| * @return a reference to this set. | | * @return a reference to this set. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UnicodeSet &removeAllStrings(); | | virtual UnicodeSet &removeAllStrings(); | |
| | | | |
| /** | | /** | |
| * Iteration method that returns the number of ranges contained in | | * Iteration method that returns the number of ranges contained in | |
| * this set. | | * this set. | |
| * @see #getRangeStart | | * @see #getRangeStart | |
| * @see #getRangeEnd | | * @see #getRangeEnd | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| | | | |
| skipping to change at line 1616 | | skipping to change at line 1645 | |
| } | | } | |
| | | | |
| inline USet *UnicodeSet::toUSet() { | | inline USet *UnicodeSet::toUSet() { | |
| return reinterpret_cast<USet *>(this); | | return reinterpret_cast<USet *>(this); | |
| } | | } | |
| | | | |
| inline const USet *UnicodeSet::toUSet() const { | | inline const USet *UnicodeSet::toUSet() const { | |
| return reinterpret_cast<const USet *>(this); | | return reinterpret_cast<const USet *>(this); | |
| } | | } | |
| | | | |
|
| | | inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USet | |
| | | SpanCondition 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 | | U_NAMESPACE_END | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 10 change blocks. |
| 7 lines changed or deleted | | 68 lines changed or added | |
|
| unistr.h | | unistr.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1998-2009, International Business Machines | | * Copyright (C) 1998-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * File unistr.h | | * File unistr.h | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 09/25/98 stephen Creation. | | * 09/25/98 stephen Creation. | |
| * 11/11/98 stephen Changed per 11/9 code review. | | * 11/11/98 stephen Changed per 11/9 code review. | |
| | | | |
| skipping to change at line 1568 | | skipping to change at line 1568 | |
| * and a buffer of the indicated length would need to be passed i
n | | * and a buffer of the indicated length would need to be passed i
n | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| int32_t extract(char *dest, int32_t destCapacity, | | int32_t extract(char *dest, int32_t destCapacity, | |
| UConverter *cnv, | | UConverter *cnv, | |
| UErrorCode &errorCode) const; | | UErrorCode &errorCode) const; | |
| | | | |
| #endif | | #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 lifetim | |
| | | e | |
| | | * 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) co | |
| | | nst; | |
| | | | |
| | | /** | |
| | | * 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 i | |
| | | n 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=IN | |
| | | T32_MAX) const; | |
| | | | |
| | | /** | |
| * Convert the UnicodeString to UTF-8 and write the result | | * Convert the UnicodeString to UTF-8 and write the result | |
| * to a ByteSink. This is called by toUTF8String(). | | * to a ByteSink. This is called by toUTF8String(). | |
| * Unpaired surrogates are replaced with U+FFFD. | | * Unpaired surrogates are replaced with U+FFFD. | |
| * Calls u_strToUTF8WithSub(). | | * Calls u_strToUTF8WithSub(). | |
| * | | * | |
| * @param sink A ByteSink to which the UTF-8 version of the string is wri
tten. | | * @param sink A ByteSink to which the UTF-8 version of the string is wri
tten. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| * @see toUTF8String | | * @see toUTF8String | |
| */ | | */ | |
| void toUTF8(ByteSink &sink) const; | | void toUTF8(ByteSink &sink) const; | |
| | | | |
| #if U_HAVE_STD_STRING | | #if U_HAVE_STD_STRING | |
| | | | |
| /** | | /** | |
| * Convert the UnicodeString to UTF-8 and append the result | | * Convert the UnicodeString to UTF-8 and append the result | |
| * to a standard string. | | * to a standard string. | |
| * Unpaired surrogates are replaced with U+FFFD. | | * Unpaired surrogates are replaced with U+FFFD. | |
| * Calls toUTF8(). | | * 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. | | * to which the UTF-8 version of the string is appended. | |
| * @return The string object. | | * @return The string object. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| * @see toUTF8 | | * @see toUTF8 | |
| */ | | */ | |
| template<typename StringClass> | | template<typename StringClass> | |
| StringClass &toUTF8String(StringClass &result) const { | | StringClass &toUTF8String(StringClass &result) const { | |
| StringByteSink<StringClass> sbs(&result); | | StringByteSink<StringClass> sbs(&result); | |
| toUTF8(sbs); | | toUTF8(sbs); | |
| return result; | | return result; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 1615 | | skipping to change at line 1642 | |
| * Calls u_strToUTF32WithSub(). | | * Calls u_strToUTF32WithSub(). | |
| * | | * | |
| * @param utf32 destination string buffer, can be NULL if capacity==0 | | * @param utf32 destination string buffer, can be NULL if capacity==0 | |
| * @param capacity the number of UChar32s available at utf32 | | * @param capacity the number of UChar32s available at utf32 | |
| * @param errorCode Standard ICU error code. Its input value must | | * @param errorCode Standard ICU error code. Its input value must | |
| * pass the U_SUCCESS() test, or else the function retur
ns | | * pass the U_SUCCESS() test, or else the function retur
ns | |
| * immediately. Check for U_FAILURE() on output or use w
ith | | * immediately. Check for U_FAILURE() on output or use w
ith | |
| * function chaining. (See User Guide for details.) | | * function chaining. (See User Guide for details.) | |
| * @return The length of the UTF-32 string. | | * @return The length of the UTF-32 string. | |
| * @see fromUTF32 | | * @see fromUTF32 | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode)
const; | | int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode)
const; | |
| | | | |
| /* Length operations */ | | /* Length operations */ | |
| | | | |
| /** | | /** | |
| * Return the length of the UnicodeString object. | | * Return the length of the UnicodeString object. | |
| * The length is the number of UChar code units are in the UnicodeString. | | * The length is the number of UChar code units are in the UnicodeString. | |
| * If you want the number of code points, please use countChar32(). | | * If you want the number of code points, please use countChar32(). | |
| * @return the length of the UnicodeString object | | * @return the length of the UnicodeString object | |
| | | | |
| skipping to change at line 2392 | | skipping to change at line 2419 | |
| * Remove the characters in the range | | * Remove the characters in the range | |
| * [<TT>start</TT>, <TT>limit</TT>) from the UnicodeString object. | | * [<TT>start</TT>, <TT>limit</TT>) from the UnicodeString object. | |
| * @param start the offset of the first character to remove | | * @param start the offset of the first character to remove | |
| * @param limit the offset immediately following the range to remove | | * @param limit the offset immediately following the range to remove | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& removeBetween(int32_t start, | | inline UnicodeString& removeBetween(int32_t start, | |
| int32_t limit = (int32_t)INT32_MAX); | | 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>li | |
| | | mit</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 */ | | /* Length operations */ | |
| | | | |
| /** | | /** | |
| * Pad the start of this UnicodeString with the character <TT>padChar</TT
>. | | * Pad the start of this UnicodeString with the character <TT>padChar</TT
>. | |
| * If the length of this UnicodeString is less than targetLength, | | * If the length of this UnicodeString is less than targetLength, | |
| * length() - targetLength copies of padChar will be added to the | | * length() - targetLength copies of padChar will be added to the | |
| * beginning of this UnicodeString. | | * beginning of this UnicodeString. | |
| * @param targetLength the desired length of the string | | * @param targetLength the desired length of the string | |
| * @param padChar the character to use for padding. Defaults to | | * @param padChar the character to use for padding. Defaults to | |
| * space (U+0020) | | * space (U+0020) | |
| | | | |
| skipping to change at line 3005 | | skipping to change at line 3043 | |
| * Create a UnicodeString from a UTF-8 string. | | * Create a UnicodeString from a UTF-8 string. | |
| * Illegal input is replaced with U+FFFD. Otherwise, errors result in a b
ogus string. | | * Illegal input is replaced with U+FFFD. Otherwise, errors result in a b
ogus string. | |
| * Calls u_strFromUTF8WithSub(). | | * Calls u_strFromUTF8WithSub(). | |
| * | | * | |
| * @param utf8 UTF-8 input string. | | * @param utf8 UTF-8 input string. | |
| * Note that a StringPiece can be implicitly constructed | | * Note that a StringPiece can be implicitly constructed | |
| * from a std::string or a NUL-terminated const char * string
. | | * from a std::string or a NUL-terminated const char * string
. | |
| * @return A UnicodeString with equivalent UTF-16 contents. | | * @return A UnicodeString with equivalent UTF-16 contents. | |
| * @see toUTF8 | | * @see toUTF8 | |
| * @see toUTF8String | | * @see toUTF8String | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static UnicodeString fromUTF8(const StringPiece &utf8); | | static UnicodeString fromUTF8(const StringPiece &utf8); | |
| | | | |
| /** | | /** | |
| * Create a UnicodeString from a UTF-32 string. | | * Create a UnicodeString from a UTF-32 string. | |
| * Illegal input is replaced with U+FFFD. Otherwise, errors result in a b
ogus string. | | * Illegal input is replaced with U+FFFD. Otherwise, errors result in a b
ogus string. | |
| * Calls u_strFromUTF32WithSub(). | | * Calls u_strFromUTF32WithSub(). | |
| * | | * | |
| * @param utf32 UTF-32 input string. Must not be NULL. | | * @param utf32 UTF-32 input string. Must not be NULL. | |
| * @param length Length of the input string, or -1 if NUL-terminated. | | * @param length Length of the input string, or -1 if NUL-terminated. | |
| * @return A UnicodeString with equivalent UTF-16 contents. | | * @return A UnicodeString with equivalent UTF-16 contents. | |
| * @see toUTF32 | | * @see toUTF32 | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
| static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length); | | static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length); | |
| | | | |
| /* Miscellaneous operations */ | | /* Miscellaneous operations */ | |
| | | | |
| /** | | /** | |
| * Unescape a string of characters and return a string containing | | * Unescape a string of characters and return a string containing | |
| * the result. The following escape sequences are recognized: | | * the result. The following escape sequences are recognized: | |
| * | | * | |
| * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] | | * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] | |
| | | | |
| skipping to change at line 4060 | | skipping to change at line 4098 | |
| inline void | | inline void | |
| UnicodeString::extractBetween(int32_t start, | | UnicodeString::extractBetween(int32_t start, | |
| int32_t limit, | | int32_t limit, | |
| UChar *dst, | | UChar *dst, | |
| int32_t dstStart) const { | | int32_t dstStart) const { | |
| pinIndex(start); | | pinIndex(start); | |
| pinIndex(limit); | | pinIndex(limit); | |
| doExtract(start, limit - start, dst, dstStart); | | doExtract(start, limit - start, dst, dstStart); | |
| } | | } | |
| | | | |
|
| | | inline UnicodeString | |
| | | UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { | |
| | | return tempSubString(start, limit - start); | |
| | | } | |
| | | | |
| inline UChar | | inline UChar | |
| UnicodeString::doCharAt(int32_t offset) const | | UnicodeString::doCharAt(int32_t offset) const | |
| { | | { | |
| if((uint32_t)offset < (uint32_t)length()) { | | if((uint32_t)offset < (uint32_t)length()) { | |
| return getArrayStart()[offset]; | | return getArrayStart()[offset]; | |
| } else { | | } else { | |
| return kInvalidUChar; | | return kInvalidUChar; | |
| } | | } | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 4153 | | skipping to change at line 4196 | |
| fUnion.fFields.fCapacity = capacity; | | fUnion.fFields.fCapacity = capacity; | |
| } | | } | |
| | | | |
| inline const UChar * | | inline const UChar * | |
| UnicodeString::getTerminatedBuffer() { | | UnicodeString::getTerminatedBuffer() { | |
| if(!isWritable()) { | | if(!isWritable()) { | |
| return 0; | | return 0; | |
| } else { | | } else { | |
| UChar *array = getArrayStart(); | | UChar *array = getArrayStart(); | |
| int32_t len = length(); | | int32_t len = length(); | |
|
| if(len < getCapacity()) { | | 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 modifi | |
| | | ed | |
| | | * without copy-on-write, e.g., via truncate(newLength) or remove(voi | |
| | | d). | |
| | | * Then the NUL would be written into the middle of another copy's st | |
| | | ring. | |
| | | */ | |
| if(!(fFlags&kBufferIsReadonly)) { | | if(!(fFlags&kBufferIsReadonly)) { | |
| /* | | /* | |
| * We must not write to a readonly buffer, but it is known to be | | * We must not write to a readonly buffer, but it is known to be | |
| * NUL-terminated if len<capacity. | | * NUL-terminated if len<capacity. | |
| * A shared, allocated buffer (refCount()>1) must not have its cont
ents | | * A shared, allocated buffer (refCount()>1) must not have its cont
ents | |
| * modified, but the NUL at [len] is beyond the string contents, | | * modified, but the NUL at [len] is beyond the string contents, | |
| * and multiple string objects and threads writing the same NUL int
o the | | * and multiple string objects and threads writing the same NUL int
o the | |
| * same location is harmless. | | * same location is harmless. | |
| * In all other cases, the buffer is fully writable and it is anywa
y safe | | * In all other cases, the buffer is fully writable and it is anywa
y safe | |
| * to write the NUL. | | * to write the NUL. | |
| | | | |
| skipping to change at line 4323 | | skipping to change at line 4372 | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::insert(int32_t start, | | UnicodeString::insert(int32_t start, | |
| UChar32 srcChar) | | UChar32 srcChar) | |
| { return replace(start, 0, srcChar); } | | { return replace(start, 0, srcChar); } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::remove() | | UnicodeString::remove() | |
| { | | { | |
| // remove() of a bogus string makes the string empty and non-bogus | | // remove() of a bogus string makes the string empty and non-bogus | |
|
| if(isBogus()) { | | // we also un-alias a read-only alias to deal with NUL-termination | |
| unBogus(); | | // issues with getTerminatedBuffer() | |
| | | if(fFlags & (kIsBogus|kBufferIsReadonly)) { | |
| | | setToEmpty(); | |
| } else { | | } else { | |
|
| setLength(0); | | fShortLength = 0; | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::remove(int32_t start, | | UnicodeString::remove(int32_t start, | |
| int32_t _length) | | int32_t _length) | |
| { | | { | |
| if(start <= 0 && _length == INT32_MAX) { | | if(start <= 0 && _length == INT32_MAX) { | |
| // remove(guaranteed everything) of a bogus string makes the string
empty and non-bogus | | // remove(guaranteed everything) of a bogus string makes the string
empty and non-bogus | |
| return remove(); | | return remove(); | |
| } | | } | |
| return doReplace(start, _length, NULL, 0, 0); | | return doReplace(start, _length, NULL, 0, 0); | |
| } | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::removeBetween(int32_t start, | | UnicodeString::removeBetween(int32_t start, | |
| int32_t limit) | | int32_t limit) | |
| { return doReplace(start, limit - start, NULL, 0, 0); } | | { 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 | | inline UBool | |
| UnicodeString::truncate(int32_t targetLength) | | UnicodeString::truncate(int32_t targetLength) | |
| { | | { | |
| if(isBogus() && targetLength == 0) { | | if(isBogus() && targetLength == 0) { | |
| // truncate(0) of a bogus string makes the string empty and non-bogus | | // truncate(0) of a bogus string makes the string empty and non-bogus | |
| unBogus(); | | unBogus(); | |
| return FALSE; | | return FALSE; | |
| } else if((uint32_t)targetLength < (uint32_t)length()) { | | } else if((uint32_t)targetLength < (uint32_t)length()) { | |
| setLength(targetLength); | | setLength(targetLength); | |
|
| | | if(fFlags&kBufferIsReadonly) { | |
| | | fUnion.fFields.fCapacity = targetLength; // not NUL-terminated any m | |
| | | ore | |
| | | } | |
| return TRUE; | | return TRUE; | |
| } else { | | } else { | |
| return FALSE; | | return FALSE; | |
| } | | } | |
| } | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::reverse() | | UnicodeString::reverse() | |
| { return doReverse(0, length()); } | | { return doReverse(0, length()); } | |
| | | | |
| | | | |
End of changes. 15 change blocks. |
| 11 lines changed or deleted | | 83 lines changed or added | |
|
| unum.h | | unum.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
|
| * Copyright (C) 1997-2009, International Business Machines Corporation and
others. | | * Copyright (C) 1997-2010, International Business Machines Corporation and
others. | |
| * All Rights Reserved. | | * All Rights Reserved. | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug
fixes | | * 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug
fixes | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| */ | | */ | |
| | | | |
| #ifndef _UNUM | | #ifndef _UNUM | |
| #define _UNUM | | #define _UNUM | |
| | | | |
| skipping to change at line 257 | | skipping to change at line 257 | |
| | | | |
| /** | | /** | |
| * Close a UNumberFormat. | | * Close a UNumberFormat. | |
| * Once closed, a UNumberFormat may no longer be used. | | * Once closed, a UNumberFormat may no longer be used. | |
| * @param fmt The formatter to close. | | * @param fmt The formatter to close. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| unum_close(UNumberFormat* fmt); | | unum_close(UNumberFormat* fmt); | |
| | | | |
|
| #ifdef XP_CPLUSPLUS | | #if U_SHOW_CPLUSPLUS_API | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * \class LocalUNumberFormatPointer | | * \class LocalUNumberFormatPointer | |
| * "Smart pointer" class, closes a UNumberFormat via unum_close(). | | * "Smart pointer" class, closes a UNumberFormat via unum_close(). | |
| * For most methods see the LocalPointerBase base class. | | * For most methods see the LocalPointerBase base class. | |
| * | | * | |
| * @see LocalPointerBase | | * @see LocalPointerBase | |
| * @see LocalPointer | | * @see LocalPointer | |
| | | | |
| skipping to change at line 376 | | skipping to change at line 376 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| unum_formatDouble( const UNumberFormat* fmt, | | unum_formatDouble( const UNumberFormat* fmt, | |
| double number, | | double number, | |
| UChar* result, | | UChar* result, | |
| int32_t resultLength, | | int32_t resultLength, | |
| UFieldPosition *pos, /* 0 if ignore */ | | UFieldPosition *pos, /* 0 if ignore */ | |
| UErrorCode* status); | | 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-t | |
| | | erminated. | |
| | | * @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->end | |
| | | Index 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 o | |
| | | utput 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. | | * Format a double currency amount using a UNumberFormat. | |
| * The double will be formatted according to the UNumberFormat's locale. | | * The double will be formatted according to the UNumberFormat's locale. | |
| * @param fmt the formatter to use | | * @param fmt the formatter to use | |
| * @param number the number to format | | * @param number the number to format | |
| * @param currency the 3-letter null-terminated ISO 4217 currency code | | * @param currency the 3-letter null-terminated ISO 4217 currency code | |
| * @param result a pointer to the buffer to receive the formatted number | | * @param result a pointer to the buffer to receive the formatted number | |
| * @param resultLength the maximum number of UChars to write to result | | * @param resultLength the maximum number of UChars to write to result | |
| * @param pos a pointer to a UFieldPosition. On input, | | * @param pos a pointer to a UFieldPosition. On input, | |
| * position->field is read. On output, position->beginIndex and | | * position->field is read. On output, position->beginIndex and | |
| * position->endIndex indicate the beginning and ending indices of | | * position->endIndex indicate the beginning and ending indices of | |
| | | | |
| skipping to change at line 478 | | skipping to change at line 512 | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| U_STABLE double U_EXPORT2 | | U_STABLE double U_EXPORT2 | |
| unum_parseDouble( const UNumberFormat* fmt, | | unum_parseDouble( const UNumberFormat* fmt, | |
| const UChar* text, | | const UChar* text, | |
| int32_t textLength, | | int32_t textLength, | |
| int32_t *parsePos /* 0 = start */, | | int32_t *parsePos /* 0 = start */, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| | | * Parse a number from a string into an unformatted numeric string using a U | |
| | | NumberFormat. | |
| | | * 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 whic | |
| | | h 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 retur | |
| | | n 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 nu | |
| | | l. | |
| | | * @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. | | * Parse a string into a double and a currency using a UNumberFormat. | |
| * The string will be parsed according to the UNumberFormat's locale. | | * The string will be parsed according to the UNumberFormat's locale. | |
| * @param fmt the formatter to use | | * @param fmt the formatter to use | |
| * @param text the text to parse | | * @param text the text to parse | |
| * @param textLength the length of text, or -1 if null-terminated | | * @param textLength the length of text, or -1 if null-terminated | |
| * @param parsePos a pointer to an offset index into text at which to | | * @param parsePos a pointer to an offset index into text at which to | |
| * begin parsing. On output, *parsePos will point after the last | | * begin parsing. On output, *parsePos will point after the last | |
| * parsed character. This parameter may be 0, in which case parsing | | * parsed character. This parameter may be 0, in which case parsing | |
| * begins at offset 0. | | * begins at offset 0. | |
| * @param currency a pointer to the buffer to receive the parsed null- | | * @param currency a pointer to the buffer to receive the parsed null- | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 82 lines changed or added | |
|
| uset.h | | uset.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
|
| * Copyright (C) 2002-2009, International Business Machines | | * Copyright (C) 2002-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| * | | * | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * file name: uset.h | | * file name: uset.h | |
| * encoding: US-ASCII | | * encoding: US-ASCII | |
| * tab size: 8 (not used) | | * tab size: 8 (not used) | |
| * indentation:4 | | * indentation:4 | |
| * | | * | |
| * created on: 2002mar07 | | * created on: 2002mar07 | |
| * created by: Markus W. Scherer | | * created by: Markus W. Scherer | |
| | | | |
| skipping to change at line 246 | | skipping to change at line 246 | |
| | | | |
| /********************************************************************* | | /********************************************************************* | |
| * USet API | | * USet API | |
| *********************************************************************/ | | *********************************************************************/ | |
| | | | |
| /** | | /** | |
| * Create an empty USet object. | | * Create an empty USet object. | |
| * Equivalent to uset_open(1, 0). | | * Equivalent to uset_open(1, 0). | |
| * @return a newly created USet. The caller must call uset_close() on | | * @return a newly created USet. The caller must call uset_close() on | |
| * it when done. | | * it when done. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_DRAFT USet* U_EXPORT2 | | U_STABLE USet* U_EXPORT2 | |
| uset_openEmpty(); | | uset_openEmpty(); | |
| | | | |
| /** | | /** | |
| * Creates a USet object that contains the range of characters | | * Creates a USet object that contains the range of characters | |
| * start..end, inclusive. If <code>start > end</code> | | * start..end, inclusive. If <code>start > end</code> | |
| * then an empty set is created (same as using uset_openEmpty()). | | * then an empty set is created (same as using uset_openEmpty()). | |
| * @param start first character of the range, inclusive | | * @param start first character of the range, inclusive | |
| * @param end last character of the range, inclusive | | * @param end last character of the range, inclusive | |
| * @return a newly created USet. The caller must call uset_close() on | | * @return a newly created USet. The caller must call uset_close() on | |
| * it when done. | | * it when done. | |
| | | | |
| skipping to change at line 302 | | skipping to change at line 302 | |
| | | | |
| /** | | /** | |
| * Disposes of the storage used by a USet object. This function should | | * Disposes of the storage used by a USet object. This function should | |
| * be called exactly once for objects returned by uset_open(). | | * be called exactly once for objects returned by uset_open(). | |
| * @param set the object to dispose of | | * @param set the object to dispose of | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uset_close(USet* set); | | uset_close(USet* set); | |
| | | | |
|
| #ifdef XP_CPLUSPLUS | | #if U_SHOW_CPLUSPLUS_API | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| /** | | /** | |
| * \class LocalUSetPointer | | * \class LocalUSetPointer | |
| * "Smart pointer" class, closes a USet via uset_close(). | | * "Smart pointer" class, closes a USet via uset_close(). | |
| * For most methods see the LocalPointerBase base class. | | * For most methods see the LocalPointerBase base class. | |
| * | | * | |
| * @see LocalPointerBase | | * @see LocalPointerBase | |
| * @see LocalPointer | | * @see LocalPointer | |
| | | | |
| skipping to change at line 330 | | skipping to change at line 330 | |
| | | | |
| /** | | /** | |
| * Returns a copy of this object. | | * Returns a copy of this object. | |
| * If this set is frozen, then the clone will be frozen as well. | | * If this set is frozen, then the clone will be frozen as well. | |
| * Use uset_cloneAsThawed() for a mutable clone of a frozen set. | | * Use uset_cloneAsThawed() for a mutable clone of a frozen set. | |
| * @param set the original set | | * @param set the original set | |
| * @return the newly allocated copy of the set | | * @return the newly allocated copy of the set | |
| * @see uset_cloneAsThawed | | * @see uset_cloneAsThawed | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
|
| U_DRAFT USet * U_EXPORT2 | | U_STABLE USet * U_EXPORT2 | |
| uset_clone(const USet *set); | | uset_clone(const USet *set); | |
| | | | |
| /** | | /** | |
| * Determines whether the set has been frozen (made immutable) or not. | | * Determines whether the set has been frozen (made immutable) or not. | |
| * See the ICU4J Freezable interface for details. | | * See the ICU4J Freezable interface for details. | |
| * @param set the set | | * @param set the set | |
| * @return TRUE/FALSE for whether the set has been frozen | | * @return TRUE/FALSE for whether the set has been frozen | |
| * @see uset_freeze | | * @see uset_freeze | |
| * @see uset_cloneAsThawed | | * @see uset_cloneAsThawed | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
|
| U_DRAFT UBool U_EXPORT2 | | U_STABLE UBool U_EXPORT2 | |
| uset_isFrozen(const USet *set); | | uset_isFrozen(const USet *set); | |
| | | | |
| /** | | /** | |
| * Freeze the set (make it immutable). | | * Freeze the set (make it immutable). | |
| * Once frozen, it cannot be unfrozen and is therefore thread-safe | | * Once frozen, it cannot be unfrozen and is therefore thread-safe | |
| * until it is deleted. | | * until it is deleted. | |
| * See the ICU4J Freezable interface for details. | | * See the ICU4J Freezable interface for details. | |
| * Freezing the set may also make some operations faster, for example | | * Freezing the set may also make some operations faster, for example | |
| * uset_contains() and uset_span(). | | * uset_contains() and uset_span(). | |
| * A frozen set will not be modified. (It remains frozen.) | | * A frozen set will not be modified. (It remains frozen.) | |
| * @param set the set | | * @param set the set | |
| * @return the same set, now frozen | | * @return the same set, now frozen | |
| * @see uset_isFrozen | | * @see uset_isFrozen | |
| * @see uset_cloneAsThawed | | * @see uset_cloneAsThawed | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
|
| U_DRAFT void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uset_freeze(USet *set); | | uset_freeze(USet *set); | |
| | | | |
| /** | | /** | |
| * Clone the set and make the clone mutable. | | * Clone the set and make the clone mutable. | |
| * See the ICU4J Freezable interface for details. | | * See the ICU4J Freezable interface for details. | |
| * @param set the set | | * @param set the set | |
| * @return the mutable clone | | * @return the mutable clone | |
| * @see uset_freeze | | * @see uset_freeze | |
| * @see uset_isFrozen | | * @see uset_isFrozen | |
| * @see uset_clone | | * @see uset_clone | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| */ | | */ | |
|
| U_DRAFT USet * U_EXPORT2 | | U_STABLE USet * U_EXPORT2 | |
| uset_cloneAsThawed(const USet *set); | | uset_cloneAsThawed(const USet *set); | |
| | | | |
| /** | | /** | |
| * Causes the USet object to represent the range <code>start - end</code>. | | * Causes the USet object to represent the range <code>start - end</code>. | |
| * If <code>start > end</code> then this USet is set to an empty range. | | * If <code>start > end</code> then this USet is set to an empty range. | |
| * A frozen set will not be modified. | | * A frozen set will not be modified. | |
| * @param set the object to set to the given range | | * @param set the object to set to the given range | |
| * @param start first character in the set, inclusive | | * @param start first character in the set, inclusive | |
| * @param end last character in the set, inclusive | | * @param end last character in the set, inclusive | |
| * @stable ICU 3.2 | | * @stable ICU 3.2 | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 729 | |
| * == b denotes that the contents are the same, not pointer | | * == b denotes that the contents are the same, not pointer | |
| * comparison.) | | * comparison.) | |
| * | | * | |
| * A frozen set will not be modified. | | * A frozen set will not be modified. | |
| * | | * | |
| * @param set the set | | * @param set the set | |
| * | | * | |
| * @param attributes bitmask for attributes to close over. | | * @param attributes bitmask for attributes to close over. | |
| * Currently only the USET_CASE bit is supported. Any undefined bits | | * Currently only the USET_CASE bit is supported. Any undefined bits | |
| * are ignored. | | * are ignored. | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_DRAFT void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uset_closeOver(USet* set, int32_t attributes); | | uset_closeOver(USet* set, int32_t attributes); | |
| | | | |
| /** | | /** | |
| * Remove all strings from this set. | | * Remove all strings from this set. | |
| * | | * | |
| * @param set the set | | * @param set the set | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_DRAFT void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uset_removeAllStrings(USet* set); | | uset_removeAllStrings(USet* set); | |
| | | | |
| /** | | /** | |
| * Returns TRUE if the given USet contains no characters and no | | * Returns TRUE if the given USet contains no characters and no | |
| * strings. | | * strings. | |
| * @param set the set | | * @param set the set | |
| * @return true if set is empty | | * @return true if set is empty | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| U_STABLE UBool U_EXPORT2 | | U_STABLE UBool U_EXPORT2 | |
| | | | |
| skipping to change at line 924 | | skipping to change at line 924 | |
| * This function works faster with a frozen set and with a non-negative str
ing length argument. | | * This function works faster with a frozen set and with a non-negative str
ing length argument. | |
| * @param set the set | | * @param set the set | |
| * @param s start of the string | | * @param s start of the string | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the length of the initial substring according to the spanConditi
on; | | * @return the length of the initial substring according to the spanConditi
on; | |
| * 0 if the start of the string does not fit the spanCondition | | * 0 if the start of the string does not fit the spanCondition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @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, USetSpanConditio
n spanCondition); | | uset_span(const USet *set, const UChar *s, int32_t length, USetSpanConditio
n spanCondition); | |
| | | | |
| /** | | /** | |
| * Returns the start of the trailing substring of the input string which | | * Returns the start of the trailing substring of the input string which | |
| * consists only of characters and strings that are contained in this set | | * consists only of characters and strings that are contained in this set | |
| * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | | * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | |
| * or only of characters and strings that are not contained | | * or only of characters and strings that are not contained | |
| * in this set (USET_SPAN_NOT_CONTAINED). | | * in this set (USET_SPAN_NOT_CONTAINED). | |
| * See USetSpanCondition for details. | | * See USetSpanCondition for details. | |
| * Unpaired surrogates are treated according to contains() of their surroga
te code points. | | * Unpaired surrogates are treated according to contains() of their surroga
te code points. | |
| * This function works faster with a frozen set and with a non-negative str
ing length argument. | | * This function works faster with a frozen set and with a non-negative str
ing length argument. | |
| * @param set the set | | * @param set the set | |
| * @param s start of the string | | * @param s start of the string | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the start of the trailing substring according to the spanConditi
on; | | * @return the start of the trailing substring according to the spanConditi
on; | |
| * the string length if the end of the string does not fit the span
Condition | | * the string length if the end of the string does not fit the span
Condition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @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, USetSpanCond
ition spanCondition); | | uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCond
ition spanCondition); | |
| | | | |
| /** | | /** | |
| * Returns the length of the initial substring of the input string which | | * Returns the length of the initial substring of the input string which | |
| * consists only of characters and strings that are contained in this set | | * consists only of characters and strings that are contained in this set | |
| * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | | * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | |
| * or only of characters and strings that are not contained | | * or only of characters and strings that are not contained | |
| * in this set (USET_SPAN_NOT_CONTAINED). | | * in this set (USET_SPAN_NOT_CONTAINED). | |
| * See USetSpanCondition for details. | | * See USetSpanCondition for details. | |
| * Similar to the strspn() C library function. | | * Similar to the strspn() C library function. | |
| | | | |
| skipping to change at line 967 | | skipping to change at line 967 | |
| * This function works faster with a frozen set and with a non-negative str
ing length argument. | | * This function works faster with a frozen set and with a non-negative str
ing length argument. | |
| * @param set the set | | * @param set the set | |
| * @param s start of the string (UTF-8) | | * @param s start of the string (UTF-8) | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the length of the initial substring according to the spanConditi
on; | | * @return the length of the initial substring according to the spanConditi
on; | |
| * 0 if the start of the string does not fit the spanCondition | | * 0 if the start of the string does not fit the spanCondition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @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, USetSpanCondi
tion spanCondition); | | uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondi
tion spanCondition); | |
| | | | |
| /** | | /** | |
| * Returns the start of the trailing substring of the input string which | | * Returns the start of the trailing substring of the input string which | |
| * consists only of characters and strings that are contained in this set | | * consists only of characters and strings that are contained in this set | |
| * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | | * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), | |
| * or only of characters and strings that are not contained | | * or only of characters and strings that are not contained | |
| * in this set (USET_SPAN_NOT_CONTAINED). | | * in this set (USET_SPAN_NOT_CONTAINED). | |
| * See USetSpanCondition for details. | | * See USetSpanCondition for details. | |
| * Malformed byte sequences are treated according to contains(0xfffd). | | * Malformed byte sequences are treated according to contains(0xfffd). | |
| * This function works faster with a frozen set and with a non-negative str
ing length argument. | | * This function works faster with a frozen set and with a non-negative str
ing length argument. | |
| * @param set the set | | * @param set the set | |
| * @param s start of the string (UTF-8) | | * @param s start of the string (UTF-8) | |
| * @param length of the string; can be -1 for NUL-terminated | | * @param length of the string; can be -1 for NUL-terminated | |
| * @param spanCondition specifies the containment condition | | * @param spanCondition specifies the containment condition | |
| * @return the start of the trailing substring according to the spanConditi
on; | | * @return the start of the trailing substring according to the spanConditi
on; | |
| * the string length if the end of the string does not fit the span
Condition | | * the string length if the end of the string does not fit the span
Condition | |
| * @stable ICU 3.8 | | * @stable ICU 3.8 | |
| * @see USetSpanCondition | | * @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, USetSpanC
ondition spanCondition); | | uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanC
ondition spanCondition); | |
| | | | |
| /** | | /** | |
| * Returns true if set1 contains all of the characters and strings | | * Returns true if set1 contains all of the characters and strings | |
| * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?
' | | * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?
' | |
| * @param set1 set to be checked for containment | | * @param set1 set to be checked for containment | |
| * @param set2 set to be checked for containment | | * @param set2 set to be checked for containment | |
| * @return true if the test condition is met | | * @return true if the test condition is met | |
| * @stable ICU 3.2 | | * @stable ICU 3.2 | |
| */ | | */ | |
| | | | |
End of changes. 16 change blocks. |
| 16 lines changed or deleted | | 16 lines changed or added | |
|
| ustring.h | | ustring.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1998-2009, International Business Machines | | * Copyright (C) 1998-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * File ustring.h | | * File ustring.h | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 12/07/98 bertrand Creation. | | * 12/07/98 bertrand Creation. | |
| ***************************************************************************
*** | | ***************************************************************************
*** | |
| | | | |
| skipping to change at line 1549 | | skipping to change at line 1549 | |
| * @param pNumSubstitutions Output parameter receiving the number of substi
tutions if subchar>=0. | | * @param pNumSubstitutions Output parameter receiving the number of substi
tutions if subchar>=0. | |
| * Set to 0 if no substitutions occur or subchar<0. | | * Set to 0 if no substitutions occur or subchar<0. | |
| * pNumSubstitutions can be NULL. | | * pNumSubstitutions can be NULL. | |
| * @param pErrorCode Pointer to a standard ICU error code. Its input val
ue must | | * @param pErrorCode Pointer to a standard ICU error code. Its input val
ue must | |
| * pass the U_SUCCESS() test, or else the function ret
urns | | * pass the U_SUCCESS() test, or else the function ret
urns | |
| * immediately. Check for U_FAILURE() on output or use
with | | * immediately. Check for U_FAILURE() on output or use
with | |
| * function chaining. (See User Guide for details.) | | * function chaining. (See User Guide for details.) | |
| * @return The pointer to destination buffer. | | * @return The pointer to destination buffer. | |
| * @see u_strToUTF32 | | * @see u_strToUTF32 | |
| * @see u_strFromUTF32WithSub | | * @see u_strFromUTF32WithSub | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_DRAFT UChar32* U_EXPORT2 | | U_STABLE UChar32* U_EXPORT2 | |
| u_strToUTF32WithSub(UChar32 *dest, | | u_strToUTF32WithSub(UChar32 *dest, | |
| int32_t destCapacity, | | int32_t destCapacity, | |
| int32_t *pDestLength, | | int32_t *pDestLength, | |
| const UChar *src, | | const UChar *src, | |
| int32_t srcLength, | | int32_t srcLength, | |
| UChar32 subchar, int32_t *pNumSubstitutions, | | UChar32 subchar, int32_t *pNumSubstitutions, | |
| UErrorCode *pErrorCode); | | UErrorCode *pErrorCode); | |
| | | | |
| /** | | /** | |
| * Convert a UTF-32 string to UTF-16. | | * Convert a UTF-32 string to UTF-16. | |
| | | | |
| skipping to change at line 1594 | | skipping to change at line 1594 | |
| * @param pNumSubstitutions Output parameter receiving the number of substi
tutions if subchar>=0. | | * @param pNumSubstitutions Output parameter receiving the number of substi
tutions if subchar>=0. | |
| * Set to 0 if no substitutions occur or subchar<0. | | * Set to 0 if no substitutions occur or subchar<0. | |
| * pNumSubstitutions can be NULL. | | * pNumSubstitutions can be NULL. | |
| * @param pErrorCode Pointer to a standard ICU error code. Its input val
ue must | | * @param pErrorCode Pointer to a standard ICU error code. Its input val
ue must | |
| * pass the U_SUCCESS() test, or else the function ret
urns | | * pass the U_SUCCESS() test, or else the function ret
urns | |
| * immediately. Check for U_FAILURE() on output or use
with | | * immediately. Check for U_FAILURE() on output or use
with | |
| * function chaining. (See User Guide for details.) | | * function chaining. (See User Guide for details.) | |
| * @return The pointer to destination buffer. | | * @return The pointer to destination buffer. | |
| * @see u_strFromUTF32 | | * @see u_strFromUTF32 | |
| * @see u_strToUTF32WithSub | | * @see u_strToUTF32WithSub | |
|
| * @draft ICU 4.2 | | * @stable ICU 4.4 | |
| */ | | */ | |
|
| U_DRAFT UChar* U_EXPORT2 | | U_STABLE UChar* U_EXPORT2 | |
| u_strFromUTF32WithSub(UChar *dest, | | u_strFromUTF32WithSub(UChar *dest, | |
| int32_t destCapacity, | | int32_t destCapacity, | |
| int32_t *pDestLength, | | int32_t *pDestLength, | |
| const UChar32 *src, | | const UChar32 *src, | |
| int32_t srcLength, | | int32_t srcLength, | |
| UChar32 subchar, int32_t *pNumSubstitutions, | | UChar32 subchar, int32_t *pNumSubstitutions, | |
| UErrorCode *pErrorCode); | | 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#modifie | |
| | | d-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 buff | |
| | | er | |
| | | * and does not have an output length restriction. | |
| | | * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeU | |
| | | TF(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 (pr | |
| | | e-flighting). | |
| | | * @param pDestLength A pointer to receive the number of units written to | |
| | | the destination. If | |
| | | * pDestLength!=NULL then *pDestLength is always set t | |
| | | o the | |
| | | * number of output units corresponding to the transfo | |
| | | rmation of | |
| | | * all the input units, even in case of a buffer overf | |
| | | low. | |
| | | * @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 val | |
| | | ue must | |
| | | * pass the U_SUCCESS() test, or else the function ret | |
| | | urns | |
| | | * 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 er | |
| | | ror 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 (pr | |
| | | e-flighting). | |
| | | * @param pDestLength A pointer to receive the number of units written to | |
| | | the destination. If | |
| | | * pDestLength!=NULL then *pDestLength is always set t | |
| | | o the | |
| | | * number of output units corresponding to the transfo | |
| | | rmation of | |
| | | * all the input units, even in case of a buffer overf | |
| | | low. | |
| | | * @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 il | |
| | | legal input sequence, | |
| | | * or U_SENTINEL if the function is to return with U_I | |
| | | NVALID_CHAR_FOUND instead. | |
| | | * A substitution character can be any valid Unicode c | |
| | | ode point (up to U+10FFFF) | |
| | | * except for surrogate code points (U+D800..U+DFFF). | |
| | | * The recommended value is U+FFFD "REPLACEMENT CHARAC | |
| | | TER". | |
| | | * @param pNumSubstitutions Output parameter receiving the number of substi | |
| | | tutions 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 val | |
| | | ue must | |
| | | * pass the U_SUCCESS() test, or else the function ret | |
| | | urns | |
| | | * 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 | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 132 lines changed or added | |
|
| utypes.h | | utypes.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1996-2009, International Business Machines | | * Copyright (C) 1996-2010, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * FILE NAME : UTYPES.H (formerly ptypes.h) | | * FILE NAME : UTYPES.H (formerly ptypes.h) | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 12/11/96 helena Creation. | | * 12/11/96 helena Creation. | |
| * 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32
, | | * 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32
, | |
| * uint8, uint16, and uint32. | | * uint8, uint16, and uint32. | |
| * 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C
as | | * 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C
as | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| */ | | */ | |
| | | | |
| #ifndef UTYPES_H | | #ifndef UTYPES_H | |
| #define UTYPES_H | | #define UTYPES_H | |
| | | | |
| #include "unicode/umachine.h" | | #include "unicode/umachine.h" | |
| #include "unicode/utf.h" | | #include "unicode/utf.h" | |
| #include "unicode/uversion.h" | | #include "unicode/uversion.h" | |
| #include "unicode/uconfig.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. | |
| | | */ | |
| | | | |
| | | #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 | | * \def U_HIDE_DRAFT_API | |
| * Define this to 1 to request that draft API be "hidden" | | * Define this to 1 to request that draft API be "hidden" | |
| */ | | */ | |
| #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) | | #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) | |
| #define U_HIDE_DRAFT_API 1 | | #define U_HIDE_DRAFT_API 1 | |
| #endif | | #endif | |
|
| | | #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API) | |
| | | #define U_HIDE_INTERNAL_API 1 | |
| | | #endif | |
| | | | |
| #ifdef U_HIDE_DRAFT_API | | #ifdef U_HIDE_DRAFT_API | |
| #include "unicode/udraft.h" | | #include "unicode/udraft.h" | |
| #endif | | #endif | |
| | | | |
| #ifdef U_HIDE_DEPRECATED_API | | #ifdef U_HIDE_DEPRECATED_API | |
| #include "unicode/udeprctd.h" | | #include "unicode/udeprctd.h" | |
| #endif | | #endif | |
| | | | |
| #ifdef U_HIDE_DEPRECATED_API | | #ifdef U_HIDE_DEPRECATED_API | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 92 | |
| #endif | | #endif | |
| | | | |
| #ifdef U_HIDE_INTERNAL_API | | #ifdef U_HIDE_INTERNAL_API | |
| #include "unicode/uintrnal.h" | | #include "unicode/uintrnal.h" | |
| #endif | | #endif | |
| | | | |
| #ifdef U_HIDE_SYSTEM_API | | #ifdef U_HIDE_SYSTEM_API | |
| #include "unicode/usystem.h" | | #include "unicode/usystem.h" | |
| #endif | | #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
*/ | | /* char Character set family
*/ | |
| /*=========================================================================
==*/ | | /*=========================================================================
==*/ | |
| | | | |
| /** | | /** | |
| * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII ba
sed platform. | | * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII ba
sed platform. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| #define U_ASCII_FAMILY 0 | | #define U_ASCII_FAMILY 0 | |
| | | | |
| skipping to change at line 213 | | skipping to change at line 229 | |
| # define U_ICUDATA_TYPE_LITLETTER l | | # define U_ICUDATA_TYPE_LITLETTER l | |
| # endif | | # endif | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * A single string literal containing the icudata stub name. i.e. 'icudt18e
' for | | * A single string literal containing the icudata stub name. i.e. 'icudt18e
' for | |
| * ICU 1.8.x on EBCDIC, etc.. | | * ICU 1.8.x on EBCDIC, etc.. | |
| * @stable ICU 2.0 | | * @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 | |
|
| | | #define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER | |
| | | #define U_USE_USRDATA 1 | |
| | | | |
| /** | | /** | |
| * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data li
brary. | | * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data li
brary. | |
| * Defined as a literal, not a string. | | * Defined as a literal, not a string. | |
| * Tricky Preprocessor use - ## operator replaces macro paramters with t
he literal string | | * Tricky Preprocessor use - ## operator replaces macro paramters with t
he literal string | |
| * from the corresponding macro invocation, _b
efore_ other macro substitutions. | | * from the corresponding macro invocation, _b
efore_ other macro substitutions. | |
| * Need a nested \#defines to get the actual v
ersion numbers rather than | | * Need a nested \#defines to get the actual v
ersion numbers rather than | |
| * the literal text U_ICU_VERSION_MAJOR_NUM in
to the name. | | * the literal text U_ICU_VERSION_MAJOR_NUM in
to the name. | |
| * The net result will be something of the for
m | | * The net result will be something of the for
m | |
| * \#define U_ICU_ENTRY_POINT icudt19_dat | | * \#define U_ICU_ENTRY_POINT icudt19_dat | |
| | | | |
| skipping to change at line 616 | | skipping to change at line 634 | |
| U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility l
ayer to construct the service. Expect performance/memory usage degradation.
Consider upgrading */ | | U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility l
ayer to construct the service. Expect performance/memory usage degradation.
Consider upgrading */ | |
| | | | |
| U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not
be NUL-terminated because output length==destCapacity. */ | | U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not
be NUL-terminated because output length==destCapacity. */ | |
| | | | |
| U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in
getBound is higher than the number of levels in the sort key */ | | U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in
getBound is higher than the number of levels in the sort key */ | |
| | | | |
| U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to
different converter implementations */ | | U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to
different converter implementations */ | |
| | | | |
| U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismat
ch between UCA version and collator image version, so the collator was cons
tructed from rules. No impact to further function */ | | U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismat
ch between UCA version and collator image version, so the collator was cons
tructed from rules. No impact to further function */ | |
| | | | |
|
| | | U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level cha | |
| | | nge. May not be an error, but later plugins may not load. */ | |
| | | | |
| U_ERROR_WARNING_LIMIT, /**< This must always be the last w
arning value to indicate the limit for UErrorCode warnings (last warning co
de +1) */ | | U_ERROR_WARNING_LIMIT, /**< This must always be the last w
arning value to indicate the limit for UErrorCode warnings (last warning co
de +1) */ | |
| | | | |
| U_ZERO_ERROR = 0, /**< No error, no warning. */ | | U_ZERO_ERROR = 0, /**< No error, no warning. */ | |
| | | | |
| U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating fail
ure */ | | U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating fail
ure */ | |
| U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot
be found */ | | U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot
be found */ | |
| U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is exp
ected */ | | U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is exp
ected */ | |
| U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be f
ound */ | | U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be f
ound */ | |
| U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library
code */ | | U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library
code */ | |
| U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (mes
sage format) */ | | U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (mes
sage format) */ | |
| | | | |
| skipping to change at line 784 | | skipping to change at line 804 | |
| U_IDNA_ZERO_LENGTH_LABEL_ERROR, | | U_IDNA_ZERO_LENGTH_LABEL_ERROR, | |
| U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, | | U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, | |
| U_IDNA_ERROR_LIMIT, | | U_IDNA_ERROR_LIMIT, | |
| /* | | /* | |
| * Aliases for StringPrep | | * Aliases for StringPrep | |
| */ | | */ | |
| U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, | | U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, | |
| U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, | | U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, | |
| U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, | | U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, | |
| | | | |
|
| U_ERROR_LIMIT=U_IDNA_ERROR_LIMIT /**< This must always be the last | | /* | |
| value to indicate the limit for UErrorCode (last error code +1) */ | | * The error code in the range 0x10500-0x105ff are reserved for Plugin | |
| | | related error codes | |
| | | */ | |
| | | U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating pl | |
| | | ugin failures */ | |
| | | U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too hi | |
| | | gh 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_PLUGIN_ERROR_LIMIT /**< This must always be the la | |
| | | st value to indicate the limit for UErrorCode (last error code +1) */ | |
| } UErrorCode; | | } UErrorCode; | |
| | | | |
| /* Use the following to determine if an UErrorCode represents */ | | /* Use the following to determine if an UErrorCode represents */ | |
| /* operational success or failure. */ | | /* operational success or failure. */ | |
| | | | |
| #ifdef XP_CPLUSPLUS | | #ifdef XP_CPLUSPLUS | |
| /** | | /** | |
| * Does the error code indicate success? | | * Does the error code indicate success? | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| | | | |
End of changes. 7 change blocks. |
| 12 lines changed or deleted | | 46 lines changed or added | |
|