diff options
author | mcheshkov <mcheshkov@yandex-team.ru> | 2022-02-10 16:46:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:15 +0300 |
commit | e9d19cec64684c9c1e6b0c98297e5b895cf904fe (patch) | |
tree | 2768b1223e96a8a0610a93d18425d9647c1123c8 /contrib/libs/icu/include/unicode | |
parent | 60040c91ffe701a84689b2c6310ff845e65cff42 (diff) | |
download | ydb-e9d19cec64684c9c1e6b0c98297e5b895cf904fe.tar.gz |
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/icu/include/unicode')
187 files changed, 19607 insertions, 19607 deletions
diff --git a/contrib/libs/icu/include/unicode/alphaindex.h b/contrib/libs/icu/include/unicode/alphaindex.h index e3c68ea7cc..c423448d26 100644 --- a/contrib/libs/icu/include/unicode/alphaindex.h +++ b/contrib/libs/icu/include/unicode/alphaindex.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -13,12 +13,12 @@ #define INDEXCHARS_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/locid.h" -#include "unicode/unistr.h" +#include "unicode/unistr.h" #if !UCONFIG_NO_COLLATION @@ -269,8 +269,8 @@ public: * Use getBucket() to get the bucket's properties. * * @param name the string to be sorted into an index bucket - * @param errorCode Error code, will be set with the reason if the - * operation fails. + * @param errorCode Error code, will be set with the reason if the + * operation fails. * @return the bucket number for the name * @stable ICU 51 */ @@ -382,11 +382,11 @@ public: /** - * Get the default label used for abbreviated buckets *between* other index characters. - * For example, consider the labels when Latin (X Y Z) and Greek (Α Β Γ) are used: - * - * X Y Z ... Α Β Γ. + * Get the default label used for abbreviated buckets *between* other index characters. + * For example, consider the labels when Latin (X Y Z) and Greek (Α Β Γ) are used: * + * X Y Z ... Α Β Γ. + * * @return inflow label * @stable ICU 4.8 */ @@ -654,7 +654,7 @@ private: /** * No assignment. */ - AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;} + AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;} /** * No Equality operators. @@ -706,7 +706,7 @@ public: /** * A (name, data) pair, to be sorted by name into one of the index buckets. * The user data is not used by the index implementation. - * \cond + * \cond * @internal */ struct Record: public UMemory { @@ -715,7 +715,7 @@ public: Record(const UnicodeString &name, const void *data); ~Record(); }; - /** \endcond */ + /** \endcond */ #endif /* U_HIDE_INTERNAL_API */ private: @@ -760,7 +760,7 @@ private: U_NAMESPACE_END #endif // !UCONFIG_NO_COLLATION - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/appendable.h b/contrib/libs/icu/include/unicode/appendable.h index 4beacaf658..ad9322c823 100644 --- a/contrib/libs/icu/include/unicode/appendable.h +++ b/contrib/libs/icu/include/unicode/appendable.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: appendable.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -19,13 +19,13 @@ /** * \file - * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts). + * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts). */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" U_NAMESPACE_BEGIN @@ -37,10 +37,10 @@ class UnicodeString; * Combines elements of Java Appendable and ICU4C ByteSink. * * This class can be used in APIs where it does not matter whether the actual destination is - * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object + * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object * that receives and processes characters and/or strings. * - * Implementation classes must implement at least appendCodeUnit(char16_t). + * Implementation classes must implement at least appendCodeUnit(char16_t). * The base class provides default implementations for the other methods. * * The methods do not take UErrorCode parameters. @@ -65,11 +65,11 @@ public: * @return TRUE if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendCodeUnit(char16_t c) = 0; + virtual UBool appendCodeUnit(char16_t c) = 0; /** * Appends a code point. - * The default implementation calls appendCodeUnit(char16_t) once or twice. + * The default implementation calls appendCodeUnit(char16_t) once or twice. * @param c code point 0..0x10ffff * @return TRUE if the operation succeeded * @stable ICU 4.8 @@ -78,20 +78,20 @@ public: /** * Appends a string. - * The default implementation calls appendCodeUnit(char16_t) for each code unit. + * The default implementation calls appendCodeUnit(char16_t) for each code unit. * @param s string, must not be NULL if length!=0 * @param length string length, or -1 if NUL-terminated * @return TRUE if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendString(const char16_t *s, int32_t length); + virtual UBool appendString(const char16_t *s, int32_t length); /** * Tells the object that the caller is going to append roughly - * appendCapacity char16_ts. A subclass might use this to pre-allocate + * appendCapacity char16_ts. A subclass might use this to pre-allocate * a larger buffer if necessary. * The default implementation does nothing. (It always returns TRUE.) - * @param appendCapacity estimated number of char16_ts that will be appended + * @param appendCapacity estimated number of char16_ts that will be appended * @return TRUE if the operation succeeded * @stable ICU 4.8 */ @@ -105,19 +105,19 @@ public: * The returned buffer is only valid until the next operation * on this Appendable. * - * After writing at most *resultCapacity char16_ts, call appendString() with the - * pointer returned from this function and the number of char16_ts written. - * Many appendString() implementations will avoid copying char16_ts if this function + * After writing at most *resultCapacity char16_ts, call appendString() with the + * pointer returned from this function and the number of char16_ts written. + * Many appendString() implementations will avoid copying char16_ts if this function * returned an internal buffer. * * Partial usage example: * \code * int32_t capacity; - * char16_t* buffer = app.getAppendBuffer(..., &capacity); - * ... Write n char16_ts into buffer, with n <= capacity. + * char16_t* buffer = app.getAppendBuffer(..., &capacity); + * ... Write n char16_ts into buffer, with n <= capacity. * app.appendString(buffer, n); * \endcode - * In many implementations, that call to append will avoid copying char16_ts. + * In many implementations, that call to append will avoid copying char16_ts. * * If the Appendable allocates or reallocates an internal buffer, it should use * the desiredCapacityHint if appropriate. @@ -141,9 +141,9 @@ public: * @return a buffer with *resultCapacity>=minCapacity * @stable ICU 4.8 */ - virtual char16_t *getAppendBuffer(int32_t minCapacity, + virtual char16_t *getAppendBuffer(int32_t minCapacity, int32_t desiredCapacityHint, - char16_t *scratch, int32_t scratchCapacity, + char16_t *scratch, int32_t scratchCapacity, int32_t *resultCapacity); }; @@ -174,7 +174,7 @@ public: * @return TRUE if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendCodeUnit(char16_t c); + virtual UBool appendCodeUnit(char16_t c); /** * Appends a code point to the string. @@ -191,12 +191,12 @@ public: * @return TRUE if the operation succeeded * @stable ICU 4.8 */ - virtual UBool appendString(const char16_t *s, int32_t length); + virtual UBool appendString(const char16_t *s, int32_t length); /** * Tells the UnicodeString that the caller is going to append roughly - * appendCapacity char16_ts. - * @param appendCapacity estimated number of char16_ts that will be appended + * appendCapacity char16_ts. + * @param appendCapacity estimated number of char16_ts that will be appended * @return TRUE if the operation succeeded * @stable ICU 4.8 */ @@ -223,9 +223,9 @@ public: * @return a buffer with *resultCapacity>=minCapacity * @stable ICU 4.8 */ - virtual char16_t *getAppendBuffer(int32_t minCapacity, + virtual char16_t *getAppendBuffer(int32_t minCapacity, int32_t desiredCapacityHint, - char16_t *scratch, int32_t scratchCapacity, + char16_t *scratch, int32_t scratchCapacity, int32_t *resultCapacity); private: @@ -234,6 +234,6 @@ private: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __APPENDABLE_H__ diff --git a/contrib/libs/icu/include/unicode/basictz.h b/contrib/libs/icu/include/unicode/basictz.h index fc2cb8e59f..1da4b88af2 100644 --- a/contrib/libs/icu/include/unicode/basictz.h +++ b/contrib/libs/icu/include/unicode/basictz.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/timezone.h" @@ -44,14 +44,14 @@ public: virtual ~BasicTimeZone(); /** - * Clones this object polymorphically. - * The caller owns the result and should delete it when done. - * @return clone, or nullptr if an error occurred - * @stable ICU 3.8 - */ - virtual BasicTimeZone* clone() const = 0; - - /** + * Clones this object polymorphically. + * The caller owns the result and should delete it when done. + * @return clone, or nullptr if an error occurred + * @stable ICU 3.8 + */ + virtual BasicTimeZone* clone() const = 0; + + /** * Gets the first time zone transition after the base time. * @param base The base time. * @param inclusive Whether the base time is inclusive or not. @@ -207,12 +207,12 @@ protected: BasicTimeZone(const BasicTimeZone& source); /** - * Copy assignment. - * @stable ICU 3.8 - */ - BasicTimeZone& operator=(const BasicTimeZone&) = default; - - /** + * Copy assignment. + * @stable ICU 3.8 + */ + BasicTimeZone& operator=(const BasicTimeZone&) = default; + + /** * Gets the set of TimeZoneRule instances applicable to the specified time and after. * @param start The start date used for extracting time zone rules * @param initial Receives the InitialTimeZone, always not NULL @@ -227,8 +227,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // BASICTZ_H //eof diff --git a/contrib/libs/icu/include/unicode/brkiter.h b/contrib/libs/icu/include/unicode/brkiter.h index b944497345..9ad42373e6 100644 --- a/contrib/libs/icu/include/unicode/brkiter.h +++ b/contrib/libs/icu/include/unicode/brkiter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -29,10 +29,10 @@ * \brief C++ API: Break Iterator. */ -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #if UCONFIG_NO_BREAK_ITERATION U_NAMESPACE_BEGIN @@ -139,7 +139,7 @@ public: * method which subclasses implement. * @stable ICU 2.0 */ - virtual BreakIterator* clone() const = 0; + virtual BreakIterator* clone() const = 0; /** * Return a polymorphic class ID for this object. Different subclasses @@ -254,7 +254,7 @@ public: virtual int32_t next(void) = 0; /** - * Return character index of the current iterator position within the text. + * Return character index of the current iterator position within the text. * @return The boundary most recently returned. * @stable ICU 2.0 */ @@ -281,7 +281,7 @@ public: virtual int32_t preceding(int32_t offset) = 0; /** - * Return true if the specified position is a boundary position. + * Return true if the specified position is a boundary position. * As a side effect, the current position of the iterator is set * to the first boundary position at or following the specified offset. * @param offset the offset to check. @@ -296,20 +296,20 @@ public: * does nothing. Negative values move to previous boundaries * and positive values move to later boundaries. * @return The new iterator position, or - * DONE if there are fewer than |n| boundaries in the specified direction. + * DONE if there are fewer than |n| boundaries in the specified direction. * @stable ICU 2.0 */ virtual int32_t next(int32_t n) = 0; /** - * For RuleBasedBreakIterators, return the status tag from the break rule - * that determined the boundary at the current iteration position. + * For RuleBasedBreakIterators, return the status tag from the break rule + * that determined the boundary at the current iteration position. * <p> * For break iterator types that do not support a rule status, * a default value of 0 is returned. * <p> - * @return the status from the break rule that determined the boundary at - * the current iteration position. + * @return the status from the break rule that determined the boundary at + * the current iteration position. * @see RuleBaseBreakIterator::getRuleStatus() * @see UWordBreak * @stable ICU 52 @@ -318,7 +318,7 @@ public: /** * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) - * that determined the boundary at the current iteration position. + * that determined the boundary at the current iteration position. * <p> * For break iterator types that do not support rule status, * no values are returned. @@ -334,10 +334,10 @@ public: * @param fillInVec an array to be filled in with the status values. * @param capacity the length of the supplied vector. A length of zero causes * the function to return the number of status values, in the - * normal way, without attempting to store any values. + * normal way, without attempting to store any values. * @param status receives error codes. * @return The number of rule status values from rules that determined - * the boundary at the current iteration position. + * the boundary at the current iteration position. * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value * is the total number of status values that were available, * not the reduced number that were actually returned. @@ -435,13 +435,13 @@ public: static BreakIterator* U_EXPORT2 createSentenceInstance(const Locale& where, UErrorCode& status); -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * Create BreakIterator for title-casing breaks using the specified locale * Returns an instance of a BreakIterator implementing title breaks. * The iterator returned locates title boundaries as described for * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, - * please use a word boundary iterator. See {@link #createWordInstance }. + * please use a word boundary iterator. See {@link #createWordInstance }. * * @param where the locale. * @param status The error code. @@ -456,11 +456,11 @@ public: * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. - * @deprecated ICU 64 Use createWordInstance instead. + * @deprecated ICU 64 Use createWordInstance instead. */ static BreakIterator* U_EXPORT2 createTitleInstance(const Locale& where, UErrorCode& status); -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ /** * Get the set of Locales for which TextBoundaries are installed. @@ -474,7 +474,7 @@ public: static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); /** - * Get name of the object for the desired Locale, in the desired language. + * Get name of the object for the desired Locale, in the desired language. * @param objectLocale must be from getAvailableLocales. * @param displayLocale specifies the desired locale for output. * @param name the fill-in parameter of the return value @@ -487,7 +487,7 @@ public: UnicodeString& name); /** - * Get name of the object for the desired Locale, in the language of the + * Get name of the object for the desired Locale, in the language of the * default locale. * @param objectLocale must be from getMatchingLocales * @param name the fill-in parameter of the return value @@ -497,7 +497,7 @@ public: static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, UnicodeString& name); -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Deprecated functionality. Use clone() instead. * @@ -520,7 +520,7 @@ public: virtual BreakIterator * createBufferClone(void *stackBuffer, int32_t &BufferSize, UErrorCode &status) = 0; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API #ifndef U_HIDE_DEPRECATED_API @@ -623,7 +623,7 @@ public: virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; private: - static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); + static BreakIterator* buildInstance(const Locale& loc, const char *type, UErrorCode& status); static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); @@ -636,17 +636,17 @@ protected: /** @internal */ BreakIterator(); /** @internal */ - BreakIterator (const BreakIterator &other); + BreakIterator (const BreakIterator &other); #ifndef U_HIDE_INTERNAL_API /** @internal */ - BreakIterator (const Locale& valid, const Locale &actual); - /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ - BreakIterator &operator = (const BreakIterator &other); + BreakIterator (const Locale& valid, const Locale &actual); + /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ + BreakIterator &operator = (const BreakIterator &other); #endif /* U_HIDE_INTERNAL_API */ private: - /** @internal (private) */ + /** @internal (private) */ char actualLocale[ULOC_FULLNAME_CAPACITY]; char validLocale[ULOC_FULLNAME_CAPACITY]; }; @@ -664,7 +664,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // BRKITER_H +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // BRKITER_H //eof diff --git a/contrib/libs/icu/include/unicode/bytestream.h b/contrib/libs/icu/include/unicode/bytestream.h index 7fe2406222..d9101cda7c 100644 --- a/contrib/libs/icu/include/unicode/bytestream.h +++ b/contrib/libs/icu/include/unicode/bytestream.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // Copyright (C) 2009-2012, International Business Machines // Corporation and others. All Rights Reserved. @@ -38,9 +38,9 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/std_string.h" @@ -71,41 +71,41 @@ public: */ virtual void Append(const char* bytes, int32_t n) = 0; -#ifndef U_HIDE_DRAFT_API - /** - * Appends n bytes to this. Same as Append(). - * Call AppendU8() with u8"string literals" which are const char * in C++11 - * but const char8_t * in C++20. - * If the compiler does support char8_t as a distinct type, - * then an AppendU8() overload for that is defined and will be chosen. - * - * @param bytes the pointer to the bytes - * @param n the number of bytes; must be non-negative - * @draft ICU 67 - */ - inline void AppendU8(const char* bytes, int32_t n) { - Append(bytes, n); - } - -#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) - /** - * Appends n bytes to this. Same as Append() but for a const char8_t * pointer. - * Call AppendU8() with u8"string literals" which are const char * in C++11 - * but const char8_t * in C++20. - * If the compiler does support char8_t as a distinct type, - * then this AppendU8() overload for that is defined and will be chosen. - * - * @param bytes the pointer to the bytes - * @param n the number of bytes; must be non-negative - * @draft ICU 67 - */ - inline void AppendU8(const char8_t* bytes, int32_t n) { - Append(reinterpret_cast<const char*>(bytes), n); - } -#endif -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API /** + * Appends n bytes to this. Same as Append(). + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then an AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @draft ICU 67 + */ + inline void AppendU8(const char* bytes, int32_t n) { + Append(bytes, n); + } + +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) + /** + * Appends n bytes to this. Same as Append() but for a const char8_t * pointer. + * Call AppendU8() with u8"string literals" which are const char * in C++11 + * but const char8_t * in C++20. + * If the compiler does support char8_t as a distinct type, + * then this AppendU8() overload for that is defined and will be chosen. + * + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @draft ICU 67 + */ + inline void AppendU8(const char8_t* bytes, int32_t n) { + Append(reinterpret_cast<const char*>(bytes), n); + } +#endif +#endif // U_HIDE_DRAFT_API + + /** * Returns a writable buffer for appending and writes the buffer's capacity to * *result_capacity. Guarantees *result_capacity>=min_capacity. * May return a pointer to the caller-owned scratch buffer which must have @@ -163,8 +163,8 @@ public: virtual void Flush(); private: - ByteSink(const ByteSink &) = delete; - ByteSink &operator=(const ByteSink &) = delete; + ByteSink(const ByteSink &) = delete; + ByteSink &operator=(const ByteSink &) = delete; }; // ------------------------------------------------------------- @@ -254,10 +254,10 @@ private: int32_t size_; int32_t appended_; UBool overflowed_; - - CheckedArrayByteSink() = delete; - CheckedArrayByteSink(const CheckedArrayByteSink &) = delete; - CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete; + + CheckedArrayByteSink() = delete; + CheckedArrayByteSink(const CheckedArrayByteSink &) = delete; + CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete; }; /** @@ -275,19 +275,19 @@ class StringByteSink : public ByteSink { */ StringByteSink(StringClass* dest) : dest_(dest) { } /** - * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string. - * - * @param dest pointer to string object to append to - * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d - * @stable ICU 60 - */ - StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) { - if (initialAppendCapacity > 0 && - (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) { - dest->reserve(dest->length() + initialAppendCapacity); - } - } - /** + * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string. + * + * @param dest pointer to string object to append to + * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d + * @stable ICU 60 + */ + StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) { + if (initialAppendCapacity > 0 && + (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) { + dest->reserve(dest->length() + initialAppendCapacity); + } + } + /** * Append "bytes[0,n-1]" to this. * @param data the pointer to the bytes * @param n the number of bytes; must be non-negative @@ -296,14 +296,14 @@ class StringByteSink : public ByteSink { virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } private: StringClass* dest_; - - StringByteSink() = delete; - StringByteSink(const StringByteSink &) = delete; - StringByteSink &operator=(const StringByteSink &) = delete; + + StringByteSink() = delete; + StringByteSink(const StringByteSink &) = delete; + StringByteSink &operator=(const StringByteSink &) = delete; }; U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __BYTESTREAM_H__ diff --git a/contrib/libs/icu/include/unicode/bytestrie.h b/contrib/libs/icu/include/unicode/bytestrie.h index 51405f64a1..d6550af23d 100644 --- a/contrib/libs/icu/include/unicode/bytestrie.h +++ b/contrib/libs/icu/include/unicode/bytestrie.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: bytestrie.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -23,9 +23,9 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/stringpiece.h" #include "unicode/uobject.h" #include "unicode/ustringtrie.h" @@ -97,42 +97,42 @@ public: return *this; } -#ifndef U_HIDE_DRAFT_API - /** - * Returns the state of this trie as a 64-bit integer. - * The state value is never 0. - * - * @return opaque state value - * @see resetToState64 - * @draft ICU 65 - */ - uint64_t getState64() const { - return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) | - (uint64_t)(pos_ - bytes_); - } - - /** - * Resets this trie to the saved state. - * Unlike resetToState(State), the 64-bit state value - * must be from getState64() from the same trie object or - * from one initialized the exact same way. - * Because of no validation, this method is faster. - * - * @param state The opaque trie state value from getState64(). - * @return *this - * @see getState64 - * @see resetToState - * @see reset - * @draft ICU 65 - */ - BytesTrie &resetToState64(uint64_t state) { - remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2; - pos_ = bytes_ + (state & kState64PosMask); - return *this; - } -#endif /* U_HIDE_DRAFT_API */ - +#ifndef U_HIDE_DRAFT_API /** + * Returns the state of this trie as a 64-bit integer. + * The state value is never 0. + * + * @return opaque state value + * @see resetToState64 + * @draft ICU 65 + */ + uint64_t getState64() const { + return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) | + (uint64_t)(pos_ - bytes_); + } + + /** + * Resets this trie to the saved state. + * Unlike resetToState(State), the 64-bit state value + * must be from getState64() from the same trie object or + * from one initialized the exact same way. + * Because of no validation, this method is faster. + * + * @param state The opaque trie state value from getState64(). + * @return *this + * @see getState64 + * @see resetToState + * @see reset + * @draft ICU 65 + */ + BytesTrie &resetToState64(uint64_t state) { + remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2; + pos_ = bytes_ + (state & kState64PosMask); + return *this; + } +#endif /* U_HIDE_DRAFT_API */ + + /** * BytesTrie state object, for saving a trie's current state * and resetting the trie back to this state later. * @stable ICU 4.8 @@ -540,13 +540,13 @@ private: static const int32_t kMaxTwoByteDelta=((kMinThreeByteDeltaLead-kMinTwoByteDeltaLead)<<8)-1; // 0x2fff static const int32_t kMaxThreeByteDelta=((kFourByteDeltaLead-kMinThreeByteDeltaLead)<<16)-1; // 0xdffff - // For getState64(): - // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 - // so we need at least 5 bits for that. - // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. - static constexpr int32_t kState64RemainingShift = 59; - static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; - + // For getState64(): + // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 + // so we need at least 5 bits for that. + // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. + static constexpr int32_t kState64RemainingShift = 59; + static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; + uint8_t *ownedArray_; // Fixed value referencing the BytesTrie bytes. @@ -562,6 +562,6 @@ private: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __BYTESTRIE_H__ diff --git a/contrib/libs/icu/include/unicode/bytestriebuilder.h b/contrib/libs/icu/include/unicode/bytestriebuilder.h index b98374bb8f..d0887d9937 100644 --- a/contrib/libs/icu/include/unicode/bytestriebuilder.h +++ b/contrib/libs/icu/include/unicode/bytestriebuilder.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: bytestriebuilder.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -23,9 +23,9 @@ #define __BYTESTRIEBUILDER_H__ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/bytestrie.h" #include "unicode/stringpiece.h" #include "unicode/stringtriebuilder.h" @@ -130,14 +130,14 @@ private: void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode); virtual int32_t getElementStringLength(int32_t i) const; - virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; + virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; virtual int32_t getElementValue(int32_t i) const; virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const; virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const; virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; - virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; virtual UBool matchNodesCanHaveValues() const { return FALSE; } @@ -146,7 +146,7 @@ private: virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; } /** - * @internal (private) + * @internal (private) */ class BTLinearMatchNode : public LinearMatchNode { public: @@ -182,6 +182,6 @@ private: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __BYTESTRIEBUILDER_H__ diff --git a/contrib/libs/icu/include/unicode/calendar.h b/contrib/libs/icu/include/unicode/calendar.h index 2a8c2935ca..91d1e06899 100644 --- a/contrib/libs/icu/include/unicode/calendar.h +++ b/contrib/libs/icu/include/unicode/calendar.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -29,10 +29,10 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** - * \file + * \file * \brief C++ API: Calendar object */ #if !UCONFIG_NO_FORMATTING @@ -54,64 +54,64 @@ typedef int32_t UFieldResolutionTable[12][8]; class BasicTimeZone; /** - * `Calendar` is an abstract base class for converting between - * a `UDate` object and a set of integer fields such as - * `YEAR`, `MONTH`, `DAY`, `HOUR`, and so on. - * (A `UDate` object represents a specific instant in + * `Calendar` is an abstract base class for converting between + * a `UDate` object and a set of integer fields such as + * `YEAR`, `MONTH`, `DAY`, `HOUR`, and so on. + * (A `UDate` object represents a specific instant in * time with millisecond precision. See UDate - * for information about the `UDate` class.) + * for information about the `UDate` class.) * - * Subclasses of `Calendar` interpret a `UDate` + * Subclasses of `Calendar` interpret a `UDate` * according to the rules of a specific calendar system. - * The most commonly used subclass of `Calendar` is - * `GregorianCalendar`. Other subclasses could represent + * The most commonly used subclass of `Calendar` is + * `GregorianCalendar`. Other subclasses could represent * the various types of lunar calendars in use in many parts of the world. * - * **NOTE**: (ICU 2.6) The subclass interface should be considered unstable - - * it WILL change. + * **NOTE**: (ICU 2.6) The subclass interface should be considered unstable - + * it WILL change. * - * Like other locale-sensitive classes, `Calendar` provides a - * static method, `createInstance`, for getting a generally useful - * object of this type. `Calendar`'s `createInstance` method - * returns the appropriate `Calendar` subclass whose + * Like other locale-sensitive classes, `Calendar` provides a + * static method, `createInstance`, for getting a generally useful + * object of this type. `Calendar`'s `createInstance` method + * returns the appropriate `Calendar` subclass whose * time fields have been initialized with the current date and time: * - * Calendar *rightNow = Calendar::createInstance(errCode); - * - * A `Calendar` object can produce all the time field values + * Calendar *rightNow = Calendar::createInstance(errCode); + * + * A `Calendar` object can produce all the time field values * needed to implement the date-time formatting for a particular language * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). * - * When computing a `UDate` from time fields, some special circumstances + * When computing a `UDate` from time fields, some special circumstances * may arise: there may be insufficient information to compute the - * `UDate` (such as only year and month but no day in the month), + * `UDate` (such as only year and month but no day in the month), * there may be inconsistent information (such as "Tuesday, July 15, 1996" * -- July 15, 1996 is actually a Monday), or the input time might be ambiguous * because of time zone transition. * - * **Insufficient information.** The calendar will use default + * **Insufficient information.** The calendar will use default * information to specify the missing fields. This may vary by calendar; for * the Gregorian calendar, the default for a field is the same as that of the * start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc. * - * **Inconsistent information.** If fields conflict, the calendar + * **Inconsistent information.** If fields conflict, the calendar * will give preference to fields set more recently. For example, when * determining the day, the calendar will look for one of the following * combinations of fields. The most recent combination, as determined by the * most recently set single field, will be used. * - * MONTH + DAY_OF_MONTH - * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK - * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK - * DAY_OF_YEAR - * DAY_OF_WEEK + WEEK_OF_YEAR + * MONTH + DAY_OF_MONTH + * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK + * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK + * DAY_OF_YEAR + * DAY_OF_WEEK + WEEK_OF_YEAR * * For the time of day: * - * HOUR_OF_DAY - * AM_PM + HOUR + * HOUR_OF_DAY + * AM_PM + HOUR * - * **Ambiguous Wall Clock Time.** When time offset from UTC has + * **Ambiguous Wall Clock Time.** When time offset from UTC has * changed, it produces an ambiguous time slot around the transition. For example, * many US locations observe daylight saving time. On the date switching to daylight * saving time in US, wall clock time jumps from 12:59 AM (standard) to 2:00 AM @@ -120,73 +120,73 @@ class BasicTimeZone; * Calendar resolves the time using the UTC offset before the transition by default. * In this example, 1:30 AM is interpreted as 1:30 AM standard time (non-exist), * so the final result will be 2:30 AM daylight time. - * - * On the date switching back to standard time, wall clock time is moved back one + * + * On the date switching back to standard time, wall clock time is moved back one * hour at 2:00 AM. So wall clock time from 1:00 AM to 1:59 AM occur twice. In this * case, the ICU Calendar resolves the time using the UTC offset after the transition * by default. For example, 1:30 AM on the date is resolved as 1:30 AM standard time. * - * Ambiguous wall clock time resolution behaviors can be customized by Calendar APIs + * Ambiguous wall clock time resolution behaviors can be customized by Calendar APIs * {@link #setRepeatedWallTimeOption} and {@link #setSkippedWallTimeOption}. * These methods are available in ICU 49 or later versions. * - * **Note:** for some non-Gregorian calendars, different + * **Note:** for some non-Gregorian calendars, different * fields may be necessary for complete disambiguation. For example, a full - * specification of the historical Arabic astronomical calendar requires year, - * month, day-of-month *and* day-of-week in some cases. + * specification of the historical Arabic astronomical calendar requires year, + * month, day-of-month *and* day-of-week in some cases. * - * **Note:** There are certain possible ambiguities in + * **Note:** There are certain possible ambiguities in * interpretation of certain singular times, which are resolved in the * following ways: * - * 1. 24:00:00 "belongs" to the following day. That is, - * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970 - * 2. Although historically not precise, midnight also belongs to "am", - * and noon belongs to "pm", so on the same day, - * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm + * 1. 24:00:00 "belongs" to the following day. That is, + * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970 + * 2. Although historically not precise, midnight also belongs to "am", + * and noon belongs to "pm", so on the same day, + * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm * * The date or time format strings are not part of the definition of a * calendar, as those must be modifiable or overridable by the user at - * runtime. Use `DateFormat` to format dates. + * runtime. Use `DateFormat` to format dates. * - * `Calendar` provides an API for field "rolling", where fields + * `Calendar` provides an API for field "rolling", where fields * can be incremented or decremented, but wrap around. For example, rolling the - * month up in the date December 12, **1996** results in - * January 12, **1996**. + * month up in the date December 12, **1996** results in + * January 12, **1996**. * - * `Calendar` also provides a date arithmetic function for + * `Calendar` also provides a date arithmetic function for * adding the specified (signed) amount of time to a particular time field. - * For example, subtracting 5 days from the date `September 12, 1996` - * results in `September 7, 1996`. + * For example, subtracting 5 days from the date `September 12, 1996` + * results in `September 7, 1996`. * - * ***Supported range*** + * ***Supported range*** * - * The allowable range of `Calendar` has been narrowed. `GregorianCalendar` used - * to attempt to support the range of dates with millisecond values from - * `Long.MIN_VALUE` to `Long.MAX_VALUE`. The new `Calendar` protocol specifies the + * The allowable range of `Calendar` has been narrowed. `GregorianCalendar` used + * to attempt to support the range of dates with millisecond values from + * `Long.MIN_VALUE` to `Long.MAX_VALUE`. The new `Calendar` protocol specifies the * maximum range of supportable dates as those having Julian day numbers - * of `-0x7F000000` to `+0x7F000000`. This corresponds to years from ~5,800,000 BCE - * to ~5,800,000 CE. Programmers should use the protected constants in `Calendar` to - * specify an extremely early or extremely late date. - * - * <p> - * The Japanese calendar uses a combination of era name and year number. - * When an emperor of Japan abdicates and a new emperor ascends the throne, - * a new era is declared and year number is reset to 1. Even if the date of - * abdication is scheduled ahead of time, the new era name might not be - * announced until just before the date. In such case, ICU4C may include - * a start date of future era without actual era name, but not enabled - * by default. ICU4C users who want to test the behavior of the future era - * can enable the tentative era by: - * <ul> - * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li> - * </ul> + * of `-0x7F000000` to `+0x7F000000`. This corresponds to years from ~5,800,000 BCE + * to ~5,800,000 CE. Programmers should use the protected constants in `Calendar` to + * specify an extremely early or extremely late date. * + * <p> + * The Japanese calendar uses a combination of era name and year number. + * When an emperor of Japan abdicates and a new emperor ascends the throne, + * a new era is declared and year number is reset to 1. Even if the date of + * abdication is scheduled ahead of time, the new era name might not be + * announced until just before the date. In such case, ICU4C may include + * a start date of future era without actual era name, but not enabled + * by default. ICU4C users who want to test the behavior of the future era + * can enable the tentative era by: + * <ul> + * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li> + * </ul> + * * @stable ICU 2.0 */ class U_I18N_API Calendar : public UObject { public: -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Field IDs for date and time. Used to specify date/time fields. ERA is calendar * specific. Example ranges given are for illustration only; see specific Calendar @@ -220,7 +220,7 @@ public: DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized - + EXTENDED_YEAR, JULIAN_DAY, MILLISECONDS_IN_DAY, @@ -229,7 +229,7 @@ public: FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields. #endif /* U_HIDE_DEPRECATED_API */ }; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API #ifndef U_HIDE_DEPRECATED_API /** @@ -290,7 +290,7 @@ public: * @return a polymorphic copy of this calendar. * @stable ICU 2.0 */ - virtual Calendar* clone() const = 0; + virtual Calendar* clone() const = 0; /** * Creates a Calendar using the default timezone and locale. Clients are responsible @@ -521,7 +521,7 @@ public: */ UBool after(const Calendar& when, UErrorCode& status) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * UDate Arithmetic function. Adds the specified (signed) amount of time to the given * time field, based on the calendar's rules. For example, to subtract 5 days from @@ -543,7 +543,7 @@ public: * @deprecated ICU 2.6. use add(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. */ virtual void add(EDateFields field, int32_t amount, UErrorCode& status); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * UDate Arithmetic function. Adds the specified (signed) amount of time to the given @@ -637,7 +637,7 @@ public: */ inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status); -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Time Field Rolling function. Rolls by the given amount on the given * time field. For example, to roll the current date up by one day, call @@ -670,7 +670,7 @@ public: * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. */ virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Time Field Rolling function. Rolls by the given amount on the given @@ -705,7 +705,7 @@ public: */ virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status); -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Return the difference between the given time and the time this * calendar object is set to. If this calendar is set @@ -762,7 +762,7 @@ public: * @deprecated ICU 2.6. Use fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status). */ virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Return the difference between the given time and the time this @@ -895,7 +895,7 @@ public: /** * Sets the behavior for handling wall time repeating multiple times * at negative time zone offset transitions. For example, 1:30 AM on - * November 6, 2011 in US Eastern time (America/New_York) occurs twice; + * November 6, 2011 in US Eastern time (America/New_York) occurs twice; * 1:30 AM EDT, then 1:30 AM EST one hour later. When <code>UCAL_WALLTIME_FIRST</code> * is used, the wall time 1:30AM in this example will be interpreted as 1:30 AM EDT * (first occurrence). When <code>UCAL_WALLTIME_LAST</code> is used, it will be @@ -906,7 +906,7 @@ public: * option for this. When the argument is neither <code>UCAL_WALLTIME_FIRST</code> * nor <code>UCAL_WALLTIME_LAST</code>, this method has no effect and will keep * the current setting. - * + * * @param option the behavior for handling repeating wall time, either * <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>. * @see #getRepeatedWallTimeOption @@ -917,7 +917,7 @@ public: /** * Gets the behavior for handling wall time repeating multiple times * at negative time zone offset transitions. - * + * * @return the behavior for handling repeating wall time, either * <code>UCAL_WALLTIME_FIRST</code> or <code>UCAL_WALLTIME_LAST</code>. * @see #setRepeatedWallTimeOption @@ -938,12 +938,12 @@ public: * <p> * <b>Note:</b>This option is effective only when this calendar is lenient. * When the calendar is strict, such non-existing wall time will cause an error. - * + * * @param option the behavior for handling skipped wall time at positive time zone * offset transitions, one of <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code> and * <code>UCAL_WALLTIME_NEXT_VALID</code>. * @see #getSkippedWallTimeOption - * + * * @stable ICU 49 */ void setSkippedWallTimeOption(UCalendarWallTimeOption option); @@ -951,7 +951,7 @@ public: /** * Gets the behavior for handling skipped wall time at positive time zone offset * transitions. - * + * * @return the behavior for handling skipped wall time, one of * <code>UCAL_WALLTIME_FIRST</code>, <code>UCAL_WALLTIME_LAST</code> * and <code>UCAL_WALLTIME_NEXT_VALID</code>. @@ -1019,7 +1019,7 @@ public: */ uint8_t getMinimalDaysInFirstWeek(void) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the minimum value for the given time field. e.g., for Gregorian * DAY_OF_MONTH, 1. @@ -1029,7 +1029,7 @@ public: * @deprecated ICU 2.6. Use getMinimum(UCalendarDateFields field) instead. */ virtual int32_t getMinimum(EDateFields field) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the minimum value for the given time field. e.g., for Gregorian @@ -1041,7 +1041,7 @@ public: */ virtual int32_t getMinimum(UCalendarDateFields field) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH, * 31. @@ -1051,7 +1051,7 @@ public: * @deprecated ICU 2.6. Use getMaximum(UCalendarDateFields field) instead. */ virtual int32_t getMaximum(EDateFields field) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH, @@ -1063,7 +1063,7 @@ public: */ virtual int32_t getMaximum(UCalendarDateFields field) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the highest minimum value for the given field if varies. Otherwise same as * getMinimum(). For Gregorian, no difference. @@ -1073,7 +1073,7 @@ public: * @deprecated ICU 2.6. Use getGreatestMinimum(UCalendarDateFields field) instead. */ virtual int32_t getGreatestMinimum(EDateFields field) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the highest minimum value for the given field if varies. Otherwise same as @@ -1085,7 +1085,7 @@ public: */ virtual int32_t getGreatestMinimum(UCalendarDateFields field) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the lowest maximum value for the given field if varies. Otherwise same as * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28. @@ -1095,7 +1095,7 @@ public: * @deprecated ICU 2.6. Use getLeastMaximum(UCalendarDateFields field) instead. */ virtual int32_t getLeastMaximum(EDateFields field) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the lowest maximum value for the given field if varies. Otherwise same as @@ -1718,7 +1718,7 @@ protected: /** * Validate a single field of this calendar. Subclasses should * override this method to validate any calendar-specific fields. - * Generic fields can be handled by `Calendar::validateField()`. + * Generic fields can be handled by `Calendar::validateField()`. * @internal */ virtual void validateField(UCalendarDateFields field, UErrorCode &status); @@ -1739,7 +1739,7 @@ protected: * reflects local zone wall time. * @internal */ - double computeMillisInDay(); + double computeMillisInDay(); /** * This method can assume EXTENDED_YEAR has been set. @@ -1750,7 +1750,7 @@ protected: * when this function fails. * @internal */ - int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec); + int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec); /** @@ -1912,13 +1912,13 @@ protected: */ int32_t fFields[UCAL_FIELD_COUNT]; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * The flags which tell if a specified time field for the calendar is set. * @deprecated ICU 2.8 use (fStamp[n]!=kUnset) */ UBool fIsSet[UCAL_FIELD_COUNT]; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** Special values of stamp[] * @stable ICU 2.0 @@ -2171,7 +2171,7 @@ private: TimeZone* fZone; /** - * Option for repeated wall time + * Option for repeated wall time * @see #setRepeatedWallTimeOption */ UCalendarWallTimeOption fRepeatedWallTime; @@ -2454,7 +2454,7 @@ private: BasicTimeZone* getBasicTimeZone() const; /** - * Find the previous zone transition near the given time. + * Find the previous zone transition near the given time. * @param base The base time, inclusive * @param transitionTime Receives the result time * @param status The error status @@ -2546,6 +2546,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _CALENDAR diff --git a/contrib/libs/icu/include/unicode/caniter.h b/contrib/libs/icu/include/unicode/caniter.h index 13e524ff6a..fad9daf77f 100644 --- a/contrib/libs/icu/include/unicode/caniter.h +++ b/contrib/libs/icu/include/unicode/caniter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -12,8 +12,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_NORMALIZATION #include "unicode/uobject.h" @@ -155,13 +155,13 @@ private: /** * Copy constructor. Private for now. - * @internal (private) + * @internal (private) */ CanonicalIterator(const CanonicalIterator& other); /** * Assignment operator. Private for now. - * @internal (private) + * @internal (private) */ CanonicalIterator& operator=(const CanonicalIterator& other); @@ -189,7 +189,7 @@ private: UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) //Set getEquivalents2(String segment); - Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status); + Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status); //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); /** @@ -198,7 +198,7 @@ private: * If so, take the remainder, and return the equivalents */ //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); - Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); + Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); void cleanPieces(); @@ -209,6 +209,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_NORMALIZATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/casemap.h b/contrib/libs/icu/include/unicode/casemap.h index 53af84fa74..35fbcf72dd 100644 --- a/contrib/libs/icu/include/unicode/casemap.h +++ b/contrib/libs/icu/include/unicode/casemap.h @@ -1,497 +1,497 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// casemap.h -// created: 2017jan12 Markus W. Scherer - -#ifndef __CASEMAP_H__ -#define __CASEMAP_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/stringpiece.h" -#include "unicode/uobject.h" - -/** - * \file - * \brief C++ API: Low-level C++ case mapping functions. - */ - -U_NAMESPACE_BEGIN - -class BreakIterator; -class ByteSink; -class Edits; - -/** - * Low-level C++ case mapping functions. - * - * @stable ICU 59 - */ -class U_COMMON_API CaseMap U_FINAL : public UMemory { -public: - /** - * Lowercases a UTF-16 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of char16_ts). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see u_strToLower - * @stable ICU 59 - */ - static int32_t toLower( - const char *locale, uint32_t options, - const char16_t *src, int32_t srcLength, - char16_t *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - - /** - * Uppercases a UTF-16 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of char16_ts). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see u_strToUpper - * @stable ICU 59 - */ - static int32_t toUpper( - const char *locale, uint32_t options, - const char16_t *src, int32_t srcLength, - char16_t *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - -#if !UCONFIG_NO_BREAK_ITERATION - - /** - * Titlecases a UTF-16 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. (This can be modified with options bits.) - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, - * U_TITLECASE_NO_LOWERCASE, - * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, - * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. - * @param iter A break iterator to find the first characters of words that are to be titlecased. - * It is set to the source string (setText()) - * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used - * (or something equivalent). - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of char16_ts). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see u_strToTitle - * @see ucasemap_toTitle - * @stable ICU 59 - */ - static int32_t toTitle( - const char *locale, uint32_t options, BreakIterator *iter, - const char16_t *src, int32_t srcLength, - char16_t *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - -#endif // UCONFIG_NO_BREAK_ITERATION - - /** - * Case-folds a UTF-16 string and optionally records edits. - * - * Case folding is locale-independent and not context-sensitive, - * but there is an option for whether to include or exclude mappings for dotted I - * and dotless i that are marked with 'T' in CaseFolding.txt. - * - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, - * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of char16_ts). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see u_strFoldCase - * @stable ICU 59 - */ - static int32_t fold( - uint32_t options, - const char16_t *src, int32_t srcLength, - char16_t *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - - /** - * Lowercases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param sink A ByteSink to which the result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * - * @see ucasemap_utf8ToLower - * @stable ICU 60 - */ - static void utf8ToLower( - const char *locale, uint32_t options, - StringPiece src, ByteSink &sink, Edits *edits, - UErrorCode &errorCode); - - /** - * Uppercases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param sink A ByteSink to which the result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * - * @see ucasemap_utf8ToUpper - * @stable ICU 60 - */ - static void utf8ToUpper( - const char *locale, uint32_t options, - StringPiece src, ByteSink &sink, Edits *edits, - UErrorCode &errorCode); - -#if !UCONFIG_NO_BREAK_ITERATION - - /** - * Titlecases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. (This can be modified with options bits.) - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, - * U_TITLECASE_NO_LOWERCASE, - * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, - * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. - * @param iter A break iterator to find the first characters of words that are to be titlecased. - * It is set to the source string (setUText()) - * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used - * (or something equivalent). - * @param src The original string. - * @param sink A ByteSink to which the result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * - * @see ucasemap_utf8ToTitle - * @stable ICU 60 - */ - static void utf8ToTitle( - const char *locale, uint32_t options, BreakIterator *iter, - StringPiece src, ByteSink &sink, Edits *edits, - UErrorCode &errorCode); - -#endif // UCONFIG_NO_BREAK_ITERATION - - /** - * Case-folds a UTF-8 string and optionally records edits. - * - * Case folding is locale-independent and not context-sensitive, - * but there is an option for whether to include or exclude mappings for dotted I - * and dotless i that are marked with 'T' in CaseFolding.txt. - * - * The result may be longer or shorter than the original. - * - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param sink A ByteSink to which the result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * - * @see ucasemap_utf8FoldCase - * @stable ICU 60 - */ - static void utf8Fold( - uint32_t options, - StringPiece src, ByteSink &sink, Edits *edits, - UErrorCode &errorCode); - - /** - * Lowercases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of bytes). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see ucasemap_utf8ToLower - * @stable ICU 59 - */ - static int32_t utf8ToLower( - const char *locale, uint32_t options, - const char *src, int32_t srcLength, - char *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - - /** - * Uppercases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of bytes). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see ucasemap_utf8ToUpper - * @stable ICU 59 - */ - static int32_t utf8ToUpper( - const char *locale, uint32_t options, - const char *src, int32_t srcLength, - char *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - -#if !UCONFIG_NO_BREAK_ITERATION - - /** - * Titlecases a UTF-8 string and optionally records edits. - * Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. (This can be modified with options bits.) - * - * @param locale The locale ID. ("" = root locale, NULL = default locale.) - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, - * U_TITLECASE_NO_LOWERCASE, - * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, - * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. - * @param iter A break iterator to find the first characters of words that are to be titlecased. - * It is set to the source string (setUText()) - * and used one or more times for iteration (first() and next()). - * If NULL, then a word break iterator for the locale is used - * (or something equivalent). - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of bytes). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see ucasemap_utf8ToTitle - * @stable ICU 59 - */ - static int32_t utf8ToTitle( - const char *locale, uint32_t options, BreakIterator *iter, - const char *src, int32_t srcLength, - char *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - -#endif // UCONFIG_NO_BREAK_ITERATION - - /** - * Case-folds a UTF-8 string and optionally records edits. - * - * Case folding is locale-independent and not context-sensitive, - * but there is an option for whether to include or exclude mappings for dotted I - * and dotless i that are marked with 'T' in CaseFolding.txt. - * - * The result may be longer or shorter than the original. - * The source string and the destination buffer must not overlap. - * - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, - * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. - * @param src The original string. - * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. - * @param dest A buffer for the result string. The result will be NUL-terminated if - * the buffer is large enough. - * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of bytes). 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. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be NULL. - * @param errorCode Reference to an in/out error code value - * which must not indicate a failure before the function call. - * @return The length of the result string, if successful. - * When the result would be longer than destCapacity, - * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. - * - * @see ucasemap_utf8FoldCase - * @stable ICU 59 - */ - static int32_t utf8Fold( - uint32_t options, - const char *src, int32_t srcLength, - char *dest, int32_t destCapacity, Edits *edits, - UErrorCode &errorCode); - -private: - CaseMap() = delete; - CaseMap(const CaseMap &other) = delete; - CaseMap &operator=(const CaseMap &other) = delete; -}; - -U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __CASEMAP_H__ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// casemap.h +// created: 2017jan12 Markus W. Scherer + +#ifndef __CASEMAP_H__ +#define __CASEMAP_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Low-level C++ case mapping functions. + */ + +U_NAMESPACE_BEGIN + +class BreakIterator; +class ByteSink; +class Edits; + +/** + * Low-level C++ case mapping functions. + * + * @stable ICU 59 + */ +class U_COMMON_API CaseMap U_FINAL : public UMemory { +public: + /** + * Lowercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToLower + * @stable ICU 59 + */ + static int32_t toLower( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToUpper + * @stable ICU 59 + */ + static int32_t toUpper( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToTitle + * @see ucasemap_toTitle + * @stable ICU 59 + */ + static int32_t toTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-16 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strFoldCase + * @stable ICU 59 + */ + static int32_t fold( + uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToLower + * @stable ICU 60 + */ + static void utf8ToLower( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToUpper + * @stable ICU 60 + */ + static void utf8ToUpper( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToTitle + * @stable ICU 60 + */ + static void utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8FoldCase + * @stable ICU 60 + */ + static void utf8Fold( + uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToLower + * @stable ICU 59 + */ + static int32_t utf8ToLower( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToUpper + * @stable ICU 59 + */ + static int32_t utf8ToUpper( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToTitle + * @stable ICU 59 + */ + static int32_t utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). 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. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8FoldCase + * @stable ICU 59 + */ + static int32_t utf8Fold( + uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +private: + CaseMap() = delete; + CaseMap(const CaseMap &other) = delete; + CaseMap &operator=(const CaseMap &other) = delete; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __CASEMAP_H__ diff --git a/contrib/libs/icu/include/unicode/char16ptr.h b/contrib/libs/icu/include/unicode/char16ptr.h index c8a9ae6c35..3a7450cc2b 100644 --- a/contrib/libs/icu/include/unicode/char16ptr.h +++ b/contrib/libs/icu/include/unicode/char16ptr.h @@ -1,313 +1,313 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// char16ptr.h -// created: 2017feb28 Markus W. Scherer - -#ifndef __CHAR16PTR_H__ -#define __CHAR16PTR_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include <cstddef> - -/** - * \file - * \brief C++ API: char16_t pointer wrappers with - * implicit conversion from bit-compatible raw pointer types. - * Also conversion functions from char16_t * to UChar * and OldUChar *. - */ - -U_NAMESPACE_BEGIN - -/** - * \def U_ALIASING_BARRIER - * Barrier for pointer anti-aliasing optimizations even across function boundaries. - * @internal - */ -#ifdef U_ALIASING_BARRIER - // Use the predefined value. -#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT -# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory") -#elif defined(U_IN_DOXYGEN) -# define U_ALIASING_BARRIER(ptr) -#endif - -/** - * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. - * @stable ICU 59 - */ -class U_COMMON_API Char16Ptr U_FINAL { -public: - /** - * Copies the pointer. - * @param p pointer - * @stable ICU 59 - */ - inline Char16Ptr(char16_t *p); -#if !U_CHAR16_IS_TYPEDEF - /** - * Converts the pointer to char16_t *. - * @param p pointer to be converted - * @stable ICU 59 - */ - inline Char16Ptr(uint16_t *p); -#endif -#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) - /** - * Converts the pointer to char16_t *. - * (Only defined if U_SIZEOF_WCHAR_T==2.) - * @param p pointer to be converted - * @stable ICU 59 - */ - inline Char16Ptr(wchar_t *p); -#endif - /** - * nullptr constructor. - * @param p nullptr - * @stable ICU 59 - */ - inline Char16Ptr(std::nullptr_t p); - /** - * Destructor. - * @stable ICU 59 - */ - inline ~Char16Ptr(); - - /** - * Pointer access. - * @return the wrapped pointer - * @stable ICU 59 - */ - inline char16_t *get() const; - /** - * char16_t pointer access via type conversion (e.g., static_cast). - * @return the wrapped pointer - * @stable ICU 59 - */ - inline operator char16_t *() const { return get(); } - -private: - Char16Ptr() = delete; - -#ifdef U_ALIASING_BARRIER - template<typename T> static char16_t *cast(T *t) { - U_ALIASING_BARRIER(t); - return reinterpret_cast<char16_t *>(t); - } - - char16_t *p_; -#else - union { - char16_t *cp; - uint16_t *up; - wchar_t *wp; - } u_; -#endif -}; - -/// \cond -#ifdef U_ALIASING_BARRIER - -Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {} -#if !U_CHAR16_IS_TYPEDEF -Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {} -#endif -#if U_SIZEOF_WCHAR_T==2 -Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {} -#endif -Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {} -Char16Ptr::~Char16Ptr() { - U_ALIASING_BARRIER(p_); -} - -char16_t *Char16Ptr::get() const { return p_; } - -#else - -Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; } -#if !U_CHAR16_IS_TYPEDEF -Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; } -#endif -#if U_SIZEOF_WCHAR_T==2 -Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; } -#endif -Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; } -Char16Ptr::~Char16Ptr() {} - -char16_t *Char16Ptr::get() const { return u_.cp; } - -#endif -/// \endcond - -/** - * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. - * @stable ICU 59 - */ -class U_COMMON_API ConstChar16Ptr U_FINAL { -public: - /** - * Copies the pointer. - * @param p pointer - * @stable ICU 59 - */ - inline ConstChar16Ptr(const char16_t *p); -#if !U_CHAR16_IS_TYPEDEF - /** - * Converts the pointer to char16_t *. - * @param p pointer to be converted - * @stable ICU 59 - */ - inline ConstChar16Ptr(const uint16_t *p); -#endif -#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) - /** - * Converts the pointer to char16_t *. - * (Only defined if U_SIZEOF_WCHAR_T==2.) - * @param p pointer to be converted - * @stable ICU 59 - */ - inline ConstChar16Ptr(const wchar_t *p); -#endif - /** - * nullptr constructor. - * @param p nullptr - * @stable ICU 59 - */ - inline ConstChar16Ptr(const std::nullptr_t p); - - /** - * Destructor. - * @stable ICU 59 - */ - inline ~ConstChar16Ptr(); - - /** - * Pointer access. - * @return the wrapped pointer - * @stable ICU 59 - */ - inline const char16_t *get() const; - /** - * char16_t pointer access via type conversion (e.g., static_cast). - * @return the wrapped pointer - * @stable ICU 59 - */ - inline operator const char16_t *() const { return get(); } - -private: - ConstChar16Ptr() = delete; - -#ifdef U_ALIASING_BARRIER - template<typename T> static const char16_t *cast(const T *t) { - U_ALIASING_BARRIER(t); - return reinterpret_cast<const char16_t *>(t); - } - - const char16_t *p_; -#else - union { - const char16_t *cp; - const uint16_t *up; - const wchar_t *wp; - } u_; -#endif -}; - -/// \cond -#ifdef U_ALIASING_BARRIER - -ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {} -#if !U_CHAR16_IS_TYPEDEF -ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {} -#endif -#if U_SIZEOF_WCHAR_T==2 -ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {} -#endif -ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {} -ConstChar16Ptr::~ConstChar16Ptr() { - U_ALIASING_BARRIER(p_); -} - -const char16_t *ConstChar16Ptr::get() const { return p_; } - -#else - -ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; } -#if !U_CHAR16_IS_TYPEDEF -ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; } -#endif -#if U_SIZEOF_WCHAR_T==2 -ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; } -#endif -ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; } -ConstChar16Ptr::~ConstChar16Ptr() {} - -const char16_t *ConstChar16Ptr::get() const { return u_.cp; } - -#endif -/// \endcond - -/** - * Converts from const char16_t * to const UChar *. - * Includes an aliasing barrier if available. - * @param p pointer - * @return p as const UChar * - * @stable ICU 59 - */ -inline const UChar *toUCharPtr(const char16_t *p) { -#ifdef U_ALIASING_BARRIER - U_ALIASING_BARRIER(p); -#endif - return reinterpret_cast<const UChar *>(p); -} - -/** - * Converts from char16_t * to UChar *. - * Includes an aliasing barrier if available. - * @param p pointer - * @return p as UChar * - * @stable ICU 59 - */ -inline UChar *toUCharPtr(char16_t *p) { -#ifdef U_ALIASING_BARRIER - U_ALIASING_BARRIER(p); -#endif - return reinterpret_cast<UChar *>(p); -} - -/** - * Converts from const char16_t * to const OldUChar *. - * Includes an aliasing barrier if available. - * @param p pointer - * @return p as const OldUChar * - * @stable ICU 59 - */ -inline const OldUChar *toOldUCharPtr(const char16_t *p) { -#ifdef U_ALIASING_BARRIER - U_ALIASING_BARRIER(p); -#endif - return reinterpret_cast<const OldUChar *>(p); -} - -/** - * Converts from char16_t * to OldUChar *. - * Includes an aliasing barrier if available. - * @param p pointer - * @return p as OldUChar * - * @stable ICU 59 - */ -inline OldUChar *toOldUCharPtr(char16_t *p) { -#ifdef U_ALIASING_BARRIER - U_ALIASING_BARRIER(p); -#endif - return reinterpret_cast<OldUChar *>(p); -} - -U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __CHAR16PTR_H__ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// char16ptr.h +// created: 2017feb28 Markus W. Scherer + +#ifndef __CHAR16PTR_H__ +#define __CHAR16PTR_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include <cstddef> + +/** + * \file + * \brief C++ API: char16_t pointer wrappers with + * implicit conversion from bit-compatible raw pointer types. + * Also conversion functions from char16_t * to UChar * and OldUChar *. + */ + +U_NAMESPACE_BEGIN + +/** + * \def U_ALIASING_BARRIER + * Barrier for pointer anti-aliasing optimizations even across function boundaries. + * @internal + */ +#ifdef U_ALIASING_BARRIER + // Use the predefined value. +#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT +# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory") +#elif defined(U_IN_DOXYGEN) +# define U_ALIASING_BARRIER(ptr) +#endif + +/** + * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @stable ICU 59 + */ +class U_COMMON_API Char16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @stable ICU 59 + */ + inline Char16Ptr(char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @stable ICU 59 + */ + inline Char16Ptr(uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @stable ICU 59 + */ + inline Char16Ptr(wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @stable ICU 59 + */ + inline Char16Ptr(std::nullptr_t p); + /** + * Destructor. + * @stable ICU 59 + */ + inline ~Char16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @stable ICU 59 + */ + inline char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @stable ICU 59 + */ + inline operator char16_t *() const { return get(); } + +private: + Char16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template<typename T> static char16_t *cast(T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast<char16_t *>(t); + } + + char16_t *p_; +#else + union { + char16_t *cp; + uint16_t *up; + wchar_t *wp; + } u_; +#endif +}; + +/// \cond +#ifdef U_ALIASING_BARRIER + +Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {} +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {} +Char16Ptr::~Char16Ptr() { + U_ALIASING_BARRIER(p_); +} + +char16_t *Char16Ptr::get() const { return p_; } + +#else + +Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; } +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; } +Char16Ptr::~Char16Ptr() {} + +char16_t *Char16Ptr::get() const { return u_.cp; } + +#endif +/// \endcond + +/** + * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @stable ICU 59 + */ +class U_COMMON_API ConstChar16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @stable ICU 59 + */ + inline ConstChar16Ptr(const char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @stable ICU 59 + */ + inline ConstChar16Ptr(const uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @stable ICU 59 + */ + inline ConstChar16Ptr(const wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @stable ICU 59 + */ + inline ConstChar16Ptr(const std::nullptr_t p); + + /** + * Destructor. + * @stable ICU 59 + */ + inline ~ConstChar16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @stable ICU 59 + */ + inline const char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @stable ICU 59 + */ + inline operator const char16_t *() const { return get(); } + +private: + ConstChar16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template<typename T> static const char16_t *cast(const T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast<const char16_t *>(t); + } + + const char16_t *p_; +#else + union { + const char16_t *cp; + const uint16_t *up; + const wchar_t *wp; + } u_; +#endif +}; + +/// \cond +#ifdef U_ALIASING_BARRIER + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {} +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {} +ConstChar16Ptr::~ConstChar16Ptr() { + U_ALIASING_BARRIER(p_); +} + +const char16_t *ConstChar16Ptr::get() const { return p_; } + +#else + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; } +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; } +ConstChar16Ptr::~ConstChar16Ptr() {} + +const char16_t *ConstChar16Ptr::get() const { return u_.cp; } + +#endif +/// \endcond + +/** + * Converts from const char16_t * to const UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const UChar * + * @stable ICU 59 + */ +inline const UChar *toUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast<const UChar *>(p); +} + +/** + * Converts from char16_t * to UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as UChar * + * @stable ICU 59 + */ +inline UChar *toUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast<UChar *>(p); +} + +/** + * Converts from const char16_t * to const OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const OldUChar * + * @stable ICU 59 + */ +inline const OldUChar *toOldUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast<const OldUChar *>(p); +} + +/** + * Converts from char16_t * to OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as OldUChar * + * @stable ICU 59 + */ +inline OldUChar *toOldUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast<OldUChar *>(p); +} + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __CHAR16PTR_H__ diff --git a/contrib/libs/icu/include/unicode/chariter.h b/contrib/libs/icu/include/unicode/chariter.h index db86f79e42..25f29b9f4b 100644 --- a/contrib/libs/icu/include/unicode/chariter.h +++ b/contrib/libs/icu/include/unicode/chariter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************** @@ -13,9 +13,9 @@ #define CHARITER_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/unistr.h" /** @@ -81,7 +81,7 @@ U_NAMESPACE_BEGIN * } * * void function1(ForwardCharacterIterator &it) { - * char16_t c; + * char16_t c; * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) { * // use c * } @@ -152,7 +152,7 @@ public: * @return the current code unit. * @stable ICU 2.0 */ - virtual char16_t nextPostInc(void) = 0; + virtual char16_t nextPostInc(void) = 0; /** * Gets the current code point for returning and advances to the next code point @@ -233,7 +233,7 @@ protected: * showing a way to convert simple for() loops: * \code * void forward2(CharacterIterator &it) { - * char16_t c; + * char16_t c; * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { * // use c * } @@ -252,7 +252,7 @@ protected: * Backward iteration with a more traditional for() loop: * \code * void backward2(CharacterIterator &it) { - * char16_t c; + * char16_t c; * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { * // use c * } @@ -269,7 +269,7 @@ protected: * // get the position * int32_t pos=it.getIndex(); * // get the previous code unit - * char16_t u=it.previous(); + * char16_t u=it.previous(); * // move back one more code unit * it.move(-1, CharacterIterator::kCurrent); * // set the position back to where it was @@ -286,7 +286,7 @@ protected: * Function processing characters, in this example simple output * <pre> * \code - * void processChar( char16_t c ) + * void processChar( char16_t c ) * { * cout << " " << c; * } @@ -297,7 +297,7 @@ protected: * \code * void traverseForward(CharacterIterator& iter) * { - * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { + * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { * processChar(c); * } * } @@ -308,7 +308,7 @@ protected: * \code * void traverseBackward(CharacterIterator& iter) * { - * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { + * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) { * processChar(c); * } * } @@ -320,7 +320,7 @@ protected: * \code * void traverseOut(CharacterIterator& iter, int32_t pos) * { - * char16_t c; + * char16_t c; * for (c = iter.setIndex(pos); * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c)); * c = iter.next()) {} @@ -380,7 +380,7 @@ public: * @return a pointer to a new CharacterIterator * @stable ICU 2.0 */ - virtual CharacterIterator* clone() const = 0; + virtual CharacterIterator* clone() const = 0; /** * Sets the iterator to refer to the first code unit in its @@ -389,7 +389,7 @@ public: * @return the first code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t first(void) = 0; + virtual char16_t first(void) = 0; /** * Sets the iterator to refer to the first code unit in its @@ -399,7 +399,7 @@ public: * @return the first code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t firstPostInc(void); + virtual char16_t firstPostInc(void); /** * Sets the iterator to refer to the first code point in its @@ -438,7 +438,7 @@ public: * @return the last code unit. * @stable ICU 2.0 */ - virtual char16_t last(void) = 0; + virtual char16_t last(void) = 0; /** * Sets the iterator to refer to the last code point in its @@ -466,7 +466,7 @@ public: * @return the "position"-th code unit. * @stable ICU 2.0 */ - virtual char16_t setIndex(int32_t position) = 0; + virtual char16_t setIndex(int32_t position) = 0; /** * Sets the iterator to refer to the beginning of the code point @@ -486,7 +486,7 @@ public: * @return the current code unit. * @stable ICU 2.0 */ - virtual char16_t current(void) const = 0; + virtual char16_t current(void) const = 0; /** * Returns the code point the iterator currently refers to. @@ -502,7 +502,7 @@ public: * @return the next code unit. * @stable ICU 2.0 */ - virtual char16_t next(void) = 0; + virtual char16_t next(void) = 0; /** * Advances to the next code point in the iteration range @@ -523,7 +523,7 @@ public: * @return the previous code unit. * @stable ICU 2.0 */ - virtual char16_t previous(void) = 0; + virtual char16_t previous(void) = 0; /** * Advances to the previous code point in the iteration range @@ -572,7 +572,7 @@ public: * Returns the numeric index in the underlying text-storage * object of the character the iterator currently refers to * (i.e., the character returned by current()). - * @return the numeric index in the text-storage object of + * @return the numeric index in the text-storage object of * the character the iterator currently refers to * @stable ICU 2.0 */ @@ -610,10 +610,10 @@ public: * @return the new position * @stable ICU 2.0 */ -#ifdef move32 - // One of the system headers right now is sometimes defining a conflicting macro we don't use -#undef move32 -#endif +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif virtual int32_t move32(int32_t delta, EOrigin origin) = 0; /** @@ -728,7 +728,7 @@ CharacterIterator::getLength(void) const { } U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/choicfmt.h b/contrib/libs/icu/include/unicode/choicfmt.h index 3b2f48cb1f..107e621591 100644 --- a/contrib/libs/icu/include/unicode/choicfmt.h +++ b/contrib/libs/icu/include/unicode/choicfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -26,8 +26,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Choice Format. @@ -41,8 +41,8 @@ #include "unicode/numfmt.h" #include "unicode/unistr.h" -#ifndef U_HIDE_DEPRECATED_API - +#ifndef U_HIDE_DEPRECATED_API + U_NAMESPACE_BEGIN class MessageFormat; @@ -251,7 +251,7 @@ public: * @return a copy of this object * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. */ - virtual ChoiceFormat* clone() const; + virtual ChoiceFormat* clone() const; /** * Returns true if the given Format objects are semantically equal. @@ -595,7 +595,7 @@ U_NAMESPACE_END #endif // U_HIDE_DEPRECATED_API #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // CHOICFMT_H //eof diff --git a/contrib/libs/icu/include/unicode/coleitr.h b/contrib/libs/icu/include/unicode/coleitr.h index e3ec0e01a1..aa3ef43ceb 100644 --- a/contrib/libs/icu/include/unicode/coleitr.h +++ b/contrib/libs/icu/include/unicode/coleitr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -35,8 +35,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_COLLATION #include "unicode/unistr.h" @@ -49,7 +49,7 @@ U_NAMESPACE_BEGIN struct CollationData; -class CharacterIterator; +class CharacterIterator; class CollationIterator; class RuleBasedCollator; class UCollationPCE; @@ -406,6 +406,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/coll.h b/contrib/libs/icu/include/unicode/coll.h index f5564c7394..72b6e2103d 100644 --- a/contrib/libs/icu/include/unicode/coll.h +++ b/contrib/libs/icu/include/unicode/coll.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -54,13 +54,13 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_COLLATION #include "unicode/uobject.h" #include "unicode/ucol.h" -#include "unicode/unorm.h" +#include "unicode/unorm.h" #include "unicode/locid.h" #include "unicode/uniset.h" #include "unicode/umisc.h" @@ -160,7 +160,7 @@ class CollationKey; * @see CollationKey * @see CollationElementIterator * @see Locale -* @see Normalizer2 +* @see Normalizer2 * @version 2.0 11/15/01 */ @@ -206,7 +206,7 @@ public: // Cannot use #ifndef U_HIDE_DEPRECATED_API for the following, it is // used by virtual methods that cannot have that conditional. -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * LESS is returned if source string is compared to be less than target * string in the compare() method. @@ -223,7 +223,7 @@ public: EQUAL = UCOL_EQUAL, // 0 GREATER = UCOL_GREATER // 1 }; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API // Collator public destructor ----------------------------------------- @@ -239,16 +239,16 @@ public: * Returns TRUE if "other" is the same as "this". * * The base class implementation returns TRUE if "other" has the same type/class as "this": - * `typeid(*this) == typeid(other)`. + * `typeid(*this) == typeid(other)`. * * Subclass implementations should do something like the following: * - * if (this == &other) { return TRUE; } - * if (!Collator::operator==(other)) { return FALSE; } // not the same class - * - * const MyCollator &o = (const MyCollator&)other; - * (compare this vs. o's subclass fields) - * + * if (this == &other) { return TRUE; } + * if (!Collator::operator==(other)) { return FALSE; } // not the same class + * + * const MyCollator &o = (const MyCollator&)other; + * (compare this vs. o's subclass fields) + * * @param other Collator object to be compared * @return TRUE if other is the same as this. * @stable ICU 2.0 @@ -269,7 +269,7 @@ public: * @return a copy of this object, owned by the caller * @stable ICU 2.0 */ - virtual Collator* clone() const = 0; + virtual Collator* clone() const = 0; /** * Creates the Collator object for the current default locale. @@ -327,7 +327,7 @@ public: */ static Collator* U_EXPORT2 createInstance(const Locale& loc, UErrorCode& err); -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * The comparison function compares the character data stored in two * different strings. Returns information about whether a string is less @@ -341,7 +341,7 @@ public: */ virtual EComparisonResult compare(const UnicodeString& source, const UnicodeString& target) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * The comparison function compares the character data stored in two @@ -359,7 +359,7 @@ public: const UnicodeString& target, UErrorCode &status) const = 0; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Does the same thing as compare but limits the comparison to a specified * length @@ -375,7 +375,7 @@ public: virtual EComparisonResult compare(const UnicodeString& source, const UnicodeString& target, int32_t length) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Does the same thing as compare but limits the comparison to a specified @@ -395,15 +395,15 @@ public: int32_t length, UErrorCode &status) const = 0; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * The comparison function compares the character data stored in two * different string arrays. Returns information about whether a string array * is less than, greater than or equal to another string array. * <p>Example of use: * <pre> - * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC" - * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc" + * . char16_t ABC[] = {0x41, 0x42, 0x43, 0}; // = "ABC" + * . char16_t abc[] = {0x61, 0x62, 0x63, 0}; // = "abc" * . UErrorCode status = U_ZERO_ERROR; * . Collator *myCollation = * . Collator::createInstance(Locale::getUS(), status); @@ -429,10 +429,10 @@ public: * target * @deprecated ICU 2.6 use the overload with UErrorCode & */ - virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength, - const char16_t* target, int32_t targetLength) + virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * The comparison function compares the character data stored in two @@ -450,8 +450,8 @@ public: * than target * @stable ICU 2.6 */ - virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, - const char16_t* target, int32_t targetLength, + virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength, UErrorCode &status) const = 0; /** @@ -527,7 +527,7 @@ public: * @see CollationKey#compare * @stable ICU 2.0 */ - virtual CollationKey& getCollationKey(const char16_t*source, + virtual CollationKey& getCollationKey(const char16_t*source, int32_t sourceLength, CollationKey& key, UErrorCode& status) const = 0; @@ -537,7 +537,7 @@ public: */ virtual int32_t hashCode(void) const = 0; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the locale of the Collator * @@ -551,7 +551,7 @@ public: * in ICU 3.0. */ virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const = 0; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Convenience method for comparing two strings based on the collation rules. @@ -588,7 +588,7 @@ public: */ UBool equals(const UnicodeString& source, const UnicodeString& target) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Determines the minimum strength that will be used in comparison or * transformation. @@ -620,7 +620,7 @@ public: * @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead */ virtual void setStrength(ECollationStrength newStrength); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Retrieves the reordering codes for this collator. @@ -686,7 +686,7 @@ public: UErrorCode& status); /** - * Get name of the object for the desired Locale, in the desired language + * Get name of the object for the desired Locale, in the desired language * @param objectLocale must be from getAvailableLocales * @param displayLocale specifies the desired locale for output * @param name the fill-in parameter of the return value @@ -699,7 +699,7 @@ public: UnicodeString& name); /** - * Get name of the object for the desired Locale, in the language of the + * Get name of the object for the desired Locale, in the language of the * default locale. * @param objectLocale must be from getAvailableLocales * @param name the fill-in parameter of the return value @@ -918,7 +918,7 @@ public: */ virtual UColReorderCode getMaxVariable() const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Sets the variable top to the primary weight of the specified string. * @@ -926,7 +926,7 @@ public: * the top of one of the supported reordering groups, * and it must not be beyond the last of those groups. * See setMaxVariable(). - * @param varTop one or more (if contraction) char16_ts to which the variable top should be set + * @param varTop one or more (if contraction) char16_ts to which the variable top should be set * @param len length of variable top string. If -1 it is considered to be zero terminated. * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> @@ -935,7 +935,7 @@ public: * @return variable top primary weight * @deprecated ICU 53 Call setMaxVariable() instead. */ - virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0; + virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0; /** * Sets the variable top to the primary weight of the specified string. @@ -944,7 +944,7 @@ public: * the top of one of the supported reordering groups, * and it must not be beyond the last of those groups. * See setMaxVariable(). - * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set + * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond @@ -966,7 +966,7 @@ public: * @deprecated ICU 53 Call setMaxVariable() instead. */ virtual void setVariableTop(uint32_t varTop, UErrorCode &status) = 0; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the variable top value of a Collator. @@ -988,7 +988,7 @@ public: */ virtual UnicodeSet *getTailoredSet(UErrorCode &status) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Same as clone(). * The base class implementation simply calls clone(). @@ -996,8 +996,8 @@ public: * @see clone() * @deprecated ICU 50 no need to have two methods for cloning */ - virtual Collator* safeClone() const; -#endif // U_FORCE_HIDE_DEPRECATED_API + virtual Collator* safeClone() const; +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Get the sort key as an array of bytes from a UnicodeString. @@ -1020,7 +1020,7 @@ public: int32_t resultLength) const = 0; /** - * Get the sort key as an array of bytes from a char16_t buffer. + * Get the sort key as an array of bytes from a char16_t buffer. * Sort key byte arrays are zero-terminated and can be compared using * strcmp(). * @@ -1038,7 +1038,7 @@ public: * @return Number of bytes needed for storing the sort key * @stable ICU 2.2 */ - virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength, + virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength, uint8_t*result, int32_t resultLength) const = 0; /** @@ -1289,6 +1289,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/compactdecimalformat.h b/contrib/libs/icu/include/unicode/compactdecimalformat.h index 9c1e200996..199031e8b9 100644 --- a/contrib/libs/icu/include/unicode/compactdecimalformat.h +++ b/contrib/libs/icu/include/unicode/compactdecimalformat.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -14,12 +14,12 @@ #define __COMPACT_DECIMAL_FORMAT_H__ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + /** * \file - * \brief C++ API: Compatibility APIs for compact decimal number formatting. + * \brief C++ API: Compatibility APIs for compact decimal number formatting. */ #if !UCONFIG_NO_FORMATTING @@ -33,31 +33,31 @@ U_NAMESPACE_BEGIN class PluralRules; /** - * **IMPORTANT:** New users are strongly encouraged to see if - * numberformatter.h fits their use case. Although not deprecated, this header - * is provided for backwards compatibility only. - * - * ----------------------------------------------------------------------------- - * + * **IMPORTANT:** New users are strongly encouraged to see if + * numberformatter.h fits their use case. Although not deprecated, this header + * is provided for backwards compatibility only. + * + * ----------------------------------------------------------------------------- + * * The CompactDecimalFormat produces abbreviated numbers, suitable for display in * environments will limited real estate. For example, 'Hits: 1.2B' instead of * 'Hits: 1,200,000,000'. The format will be appropriate for the given language, * such as "1,2 Mrd." for German. - * + * * For numbers under 1000 trillion (under 10^15, such as 123,456,789,012,345), * the result will be short for supported languages. However, the result may * sometimes exceed 7 characters, such as when there are combining marks or thin * characters. In such cases, the visual width in fonts should still be short. - * + * * By default, there are 3 significant digits. After creation, if more than * three significant digits are set (with setMaximumSignificantDigits), or if a * fixed number of digits are set (with setMaximumIntegerDigits or * setMaximumFractionDigits), then result may be wider. - * + * * At this time, parsing is not supported, and will produce a U_UNSUPPORTED_ERROR. * Resetting the pattern prefixes or suffixes is not supported; the method calls * are ignored. - * + * * @stable ICU 51 */ class U_I18N_API CompactDecimalFormat : public DecimalFormat { @@ -65,9 +65,9 @@ public: /** * Returns a compact decimal instance for specified locale. - * - * **NOTE:** New users are strongly encouraged to use - * `number::NumberFormatter` instead of NumberFormat. + * + * **NOTE:** New users are strongly encouraged to use + * `number::NumberFormatter` instead of NumberFormat. * @param inLocale the given locale. * @param style whether to use short or long style. * @param status error code returned here. @@ -88,7 +88,7 @@ public: * Destructor. * @stable ICU 51 */ - ~CompactDecimalFormat() U_OVERRIDE; + ~CompactDecimalFormat() U_OVERRIDE; /** * Assignment operator. @@ -105,21 +105,21 @@ public: * @return a polymorphic copy of this CompactDecimalFormat. * @stable ICU 51 */ - CompactDecimalFormat* clone() const U_OVERRIDE; + CompactDecimalFormat* clone() const U_OVERRIDE; using DecimalFormat::format; /** - * CompactDecimalFormat does not support parsing. This implementation - * does nothing. - * @param text Unused. - * @param result Does not change. - * @param parsePosition Does not change. - * @see Formattable + * CompactDecimalFormat does not support parsing. This implementation + * does nothing. + * @param text Unused. + * @param result Does not change. + * @param parsePosition Does not change. + * @see Formattable * @stable ICU 51 */ - void parse(const UnicodeString& text, Formattable& result, - ParsePosition& parsePosition) const U_OVERRIDE; + void parse(const UnicodeString& text, Formattable& result, + ParsePosition& parsePosition) const U_OVERRIDE; /** * CompactDecimalFormat does not support parsing. This implementation @@ -130,9 +130,9 @@ public: * @param status Always set to U_UNSUPPORTED_ERROR. * @stable ICU 51 */ - void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE; + void parse(const UnicodeString& text, Formattable& result, UErrorCode& status) const U_OVERRIDE; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** * Parses text from the given string as a currency amount. Unlike * the parse() method, this method will attempt to parse a generic @@ -153,8 +153,8 @@ public: * the parsed currency; if parse fails, this is NULL. * @internal */ - CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE; -#endif /* U_HIDE_INTERNAL_API */ + CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE; +#endif /* U_HIDE_INTERNAL_API */ /** * Return the class ID for this class. This is useful only for @@ -180,17 +180,17 @@ public: * other classes have different class IDs. * @stable ICU 51 */ - UClassID getDynamicClassID() const U_OVERRIDE; + UClassID getDynamicClassID() const U_OVERRIDE; - private: - CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status); + private: + CompactDecimalFormat(const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status); }; U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __COMPACT_DECIMAL_FORMAT_H__ //eof diff --git a/contrib/libs/icu/include/unicode/curramt.h b/contrib/libs/icu/include/unicode/curramt.h index 5cfe1cf75e..9278007d23 100644 --- a/contrib/libs/icu/include/unicode/curramt.h +++ b/contrib/libs/icu/include/unicode/curramt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -15,8 +15,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/measure.h" @@ -48,7 +48,7 @@ class U_I18N_API CurrencyAmount: public Measure { * is invalid, then this will be set to a failing value. * @stable ICU 3.0 */ - CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, + CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, UErrorCode &ec); /** @@ -61,7 +61,7 @@ class U_I18N_API CurrencyAmount: public Measure { * then this will be set to a failing value. * @stable ICU 3.0 */ - CurrencyAmount(double amount, ConstChar16Ptr isoCode, + CurrencyAmount(double amount, ConstChar16Ptr isoCode, UErrorCode &ec); /** @@ -81,7 +81,7 @@ class U_I18N_API CurrencyAmount: public Measure { * have the same class as returned by getDynamicClassID(). * @stable ICU 3.0 */ - virtual CurrencyAmount* clone() const; + virtual CurrencyAmount* clone() const; /** * Destructor @@ -117,21 +117,21 @@ class U_I18N_API CurrencyAmount: public Measure { * Return the ISO currency code of this object. * @stable ICU 3.0 */ - inline const char16_t* getISOCurrency() const; + inline const char16_t* getISOCurrency() const; }; inline const CurrencyUnit& CurrencyAmount::getCurrency() const { return (const CurrencyUnit&) getUnit(); } -inline const char16_t* CurrencyAmount::getISOCurrency() const { +inline const char16_t* CurrencyAmount::getISOCurrency() const { return getCurrency().getISOCurrency(); } U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __CURRENCYAMOUNT_H__ diff --git a/contrib/libs/icu/include/unicode/currpinf.h b/contrib/libs/icu/include/unicode/currpinf.h index fb0b2a7dbc..91882f5e3a 100644 --- a/contrib/libs/icu/include/unicode/currpinf.h +++ b/contrib/libs/icu/include/unicode/currpinf.h @@ -1,8 +1,8 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* - * Copyright (C) 2009-2015, International Business Machines Corporation and * + * Copyright (C) 2009-2015, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -11,8 +11,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Currency Plural Information used by Decimal Format @@ -242,33 +242,33 @@ private: /* * The plural rule is used to format currency plural name, * for example: "3.00 US Dollars". - * If there are 3 currency signs in the currency pattern, + * If there are 3 currency signs in the currency pattern, * the 3 currency signs will be replaced by currency plural name. */ PluralRules* fPluralRules; // locale Locale* fLocale; - -private: - /** - * An internal status variable used to indicate that the object is in an 'invalid' state. - * Used by copy constructor, the assignment operator and the clone method. - */ - UErrorCode fInternalStatus; + +private: + /** + * An internal status variable used to indicate that the object is in an 'invalid' state. + * Used by copy constructor, the assignment operator and the clone method. + */ + UErrorCode fInternalStatus; }; inline UBool -CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const { - return !operator==(info); -} +CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const { + return !operator==(info); +} U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _CURRPINFO //eof diff --git a/contrib/libs/icu/include/unicode/currunit.h b/contrib/libs/icu/include/unicode/currunit.h index 9b608fdeef..6020a3dc76 100644 --- a/contrib/libs/icu/include/unicode/currunit.h +++ b/contrib/libs/icu/include/unicode/currunit.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -15,8 +15,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/measunit.h" @@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN /** * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese - * yen). This class is a thin wrapper over a char16_t string that + * yen). This class is a thin wrapper over a char16_t string that * subclasses MeasureUnit, for use with Measure and MeasureFormat. * * @author Alan Liu @@ -39,51 +39,51 @@ U_NAMESPACE_BEGIN class U_I18N_API CurrencyUnit: public MeasureUnit { public: /** - * Default constructor. Initializes currency code to "XXX" (no currency). - * @stable ICU 60 - */ - CurrencyUnit(); - - /** + * Default constructor. Initializes currency code to "XXX" (no currency). + * @stable ICU 60 + */ + CurrencyUnit(); + + /** * Construct an object with the given ISO currency code. - * - * @param isoCode the 3-letter ISO 4217 currency code; must have - * length 3 and need not be NUL-terminated. If NULL, the currency - * is initialized to the unknown currency XXX. + * + * @param isoCode the 3-letter ISO 4217 currency code; must have + * length 3 and need not be NUL-terminated. If NULL, the currency + * is initialized to the unknown currency XXX. * @param ec input-output error code. If the isoCode is invalid, * then this will be set to a failing value. * @stable ICU 3.0 */ - CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec); - - /** - * Construct an object with the given ISO currency code. - * - * @param isoCode the 3-letter ISO 4217 currency code; must have - * length 3. If invalid, the currency is initialized to XXX. - * @param ec input-output error code. If the isoCode is invalid, - * then this will be set to a failing value. - * @stable ICU 64 - */ - CurrencyUnit(StringPiece isoCode, UErrorCode &ec); + CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec); /** + * Construct an object with the given ISO currency code. + * + * @param isoCode the 3-letter ISO 4217 currency code; must have + * length 3. If invalid, the currency is initialized to XXX. + * @param ec input-output error code. If the isoCode is invalid, + * then this will be set to a failing value. + * @stable ICU 64 + */ + CurrencyUnit(StringPiece isoCode, UErrorCode &ec); + + /** * Copy constructor * @stable ICU 3.0 */ CurrencyUnit(const CurrencyUnit& other); /** - * Copy constructor from MeasureUnit. This constructor allows you to - * restore a CurrencyUnit that was sliced to MeasureUnit. - * - * @param measureUnit The MeasureUnit to copy from. - * @param ec Set to a failing value if the MeasureUnit is not a currency. - * @stable ICU 60 - */ - CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec); - - /** + * Copy constructor from MeasureUnit. This constructor allows you to + * restore a CurrencyUnit that was sliced to MeasureUnit. + * + * @param measureUnit The MeasureUnit to copy from. + * @param ec Set to a failing value if the MeasureUnit is not a currency. + * @stable ICU 60 + */ + CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec); + + /** * Assignment operator * @stable ICU 3.0 */ @@ -94,7 +94,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit { * have the same class as returned by getDynamicClassID(). * @stable ICU 3.0 */ - virtual CurrencyUnit* clone() const; + virtual CurrencyUnit* clone() const; /** * Destructor @@ -124,23 +124,23 @@ class U_I18N_API CurrencyUnit: public MeasureUnit { * Return the ISO currency code of this object. * @stable ICU 3.0 */ - inline const char16_t* getISOCurrency() const; + inline const char16_t* getISOCurrency() const; private: /** * The ISO 4217 code of this object. */ - char16_t isoCode[4]; + char16_t isoCode[4]; }; -inline const char16_t* CurrencyUnit::getISOCurrency() const { +inline const char16_t* CurrencyUnit::getISOCurrency() const { return isoCode; } U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __CURRENCYUNIT_H__ diff --git a/contrib/libs/icu/include/unicode/datefmt.h b/contrib/libs/icu/include/unicode/datefmt.h index f106e821a7..6905b544b0 100644 --- a/contrib/libs/icu/include/unicode/datefmt.h +++ b/contrib/libs/icu/include/unicode/datefmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -23,8 +23,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/udat.h" @@ -45,17 +45,17 @@ U_NAMESPACE_BEGIN class TimeZone; class DateTimePatternGenerator; -/** - * \cond - * Export an explicit template instantiation. (See digitlst.h, datefmt.h, and others.) - * (When building DLLs for Windows this is required.) - */ -#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN) +/** + * \cond + * Export an explicit template instantiation. (See digitlst.h, datefmt.h, and others.) + * (When building DLLs for Windows this is required.) + */ +#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN) template class U_I18N_API EnumSet<UDateFormatBooleanAttribute, 0, UDAT_BOOLEAN_ATTRIBUTE_COUNT>; #endif -/** \endcond */ +/** \endcond */ /** * DateFormat is an abstract class for a family of classes that convert dates and @@ -224,14 +224,14 @@ public: virtual ~DateFormat(); /** - * Clones this object polymorphically. - * The caller owns the result and should delete it when done. - * @return clone, or nullptr if an error occurred - * @stable ICU 2.0 - */ - virtual DateFormat* clone() const = 0; - - /** + * Clones this object polymorphically. + * The caller owns the result and should delete it when done. + * @return clone, or nullptr if an error occurred + * @stable ICU 2.0 + */ + virtual DateFormat* clone() const = 0; + + /** * Equality operator. Returns true if the two formats have the same behavior. * @stable ICU 2.0 */ @@ -963,7 +963,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _DATEFMT //eof diff --git a/contrib/libs/icu/include/unicode/dbbi.h b/contrib/libs/icu/include/unicode/dbbi.h index 3de9cc3814..03ac003742 100644 --- a/contrib/libs/icu/include/unicode/dbbi.h +++ b/contrib/libs/icu/include/unicode/dbbi.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -13,10 +13,10 @@ #ifndef DBBI_H #define DBBI_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/rbbi.h" #if !UCONFIG_NO_BREAK_ITERATION @@ -43,6 +43,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/dcfmtsym.h b/contrib/libs/icu/include/unicode/dcfmtsym.h index 582e7533a4..56c89fcf95 100644 --- a/contrib/libs/icu/include/unicode/dcfmtsym.h +++ b/contrib/libs/icu/include/unicode/dcfmtsym.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -29,16 +29,16 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING -#include "unicode/uchar.h" +#include "unicode/uchar.h" #include "unicode/uobject.h" #include "unicode/locid.h" -#include "unicode/numsys.h" +#include "unicode/numsys.h" #include "unicode/unum.h" -#include "unicode/unistr.h" +#include "unicode/unistr.h" /** * \file @@ -184,24 +184,24 @@ public: DecimalFormatSymbols(const Locale& locale, UErrorCode& status); /** - * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols - * corresponding to the given NumberingSystem. - * - * This constructor behaves equivalently to the normal constructor called with a locale having a - * "numbers=xxxx" keyword specifying the numbering system by name. - * - * In this constructor, the NumberingSystem argument will be used even if the locale has its own - * "numbers=xxxx" keyword. - * - * @param locale The locale to get symbols for. - * @param ns The numbering system. - * @param status Input/output parameter, set to success or - * failure code upon return. - * @stable ICU 60 - */ - DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status); - - /** + * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols + * corresponding to the given NumberingSystem. + * + * This constructor behaves equivalently to the normal constructor called with a locale having a + * "numbers=xxxx" keyword specifying the numbering system by name. + * + * In this constructor, the NumberingSystem argument will be used even if the locale has its own + * "numbers=xxxx" keyword. + * + * @param locale The locale to get symbols for. + * @param ns The numbering system. + * @param status Input/output parameter, set to success or + * failure code upon return. + * @stable ICU 60 + */ + DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status); + + /** * Create a DecimalFormatSymbols object for the default locale. * This constructor will not fail. If the resource file data is * not available, it will use hard-coded last-resort data and @@ -291,18 +291,18 @@ public: */ void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits); -#ifndef U_HIDE_INTERNAL_API - /** - * Loads symbols for the specified currency into this instance. - * - * This method is internal. If you think it should be public, file a ticket. - * - * @internal - */ - void setCurrency(const UChar* currency, UErrorCode& status); -#endif // U_HIDE_INTERNAL_API - +#ifndef U_HIDE_INTERNAL_API /** + * Loads symbols for the specified currency into this instance. + * + * This method is internal. If you think it should be public, file a ticket. + * + * @internal + */ + void setCurrency(const UChar* currency, UErrorCode& status); +#endif // U_HIDE_INTERNAL_API + + /** * Returns the locale for which this object was constructed. * @stable ICU 2.6 */ @@ -374,11 +374,11 @@ private: * @param success Input/output parameter, set to success or * failure code upon return. * @param useLastResortData determine if use last resort data - * @param ns The NumberingSystem to use; otherwise, fall - * back to the locale. + * @param ns The NumberingSystem to use; otherwise, fall + * back to the locale. */ - void initialize(const Locale& locale, UErrorCode& success, - UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr); + void initialize(const Locale& locale, UErrorCode& success, + UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr); /** * Initialize the symbols with default values. @@ -401,13 +401,13 @@ public: inline UBool isCustomIntlCurrencySymbol() const { return fIsCustomIntlCurrencySymbol; } - - /** - * @internal For ICU use only - */ - inline UChar32 getCodePointZero() const { - return fCodePointZero; - } + + /** + * @internal For ICU use only + */ + inline UChar32 getCodePointZero() const { + return fCodePointZero; + } #endif /* U_HIDE_INTERNAL_API */ /** @@ -415,41 +415,41 @@ public: * returning a const reference to one of the symbol strings. * The returned reference becomes invalid when the symbol is changed * or when the DecimalFormatSymbols are destroyed. - * Note: moved \#ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat - * - * This is not currently stable API, but if you think it should be stable, - * post a comment on the following ticket and the ICU team will take a look: - * http://bugs.icu-project.org/trac/ticket/13580 + * Note: moved \#ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat * + * This is not currently stable API, but if you think it should be stable, + * post a comment on the following ticket and the ICU team will take a look: + * http://bugs.icu-project.org/trac/ticket/13580 + * * @param symbol Constant to indicate a number format symbol. * @return the format symbol by the param 'symbol' * @internal */ - inline const UnicodeString& getConstSymbol(ENumberFormatSymbol symbol) const; + inline const UnicodeString& getConstSymbol(ENumberFormatSymbol symbol) const; #ifndef U_HIDE_INTERNAL_API /** - * Returns the const UnicodeString reference, like getConstSymbol, - * corresponding to the digit with the given value. This is equivalent - * to accessing the symbol from getConstSymbol with the corresponding - * key, such as kZeroDigitSymbol or kOneDigitSymbol. - * - * This is not currently stable API, but if you think it should be stable, - * post a comment on the following ticket and the ICU team will take a look: - * http://bugs.icu-project.org/trac/ticket/13580 - * - * @param digit The digit, an integer between 0 and 9 inclusive. - * If outside the range 0 to 9, the zero digit is returned. - * @return the format symbol for the given digit. - * @internal This API is currently for ICU use only. - */ - inline const UnicodeString& getConstDigitSymbol(int32_t digit) const; - - /** + * Returns the const UnicodeString reference, like getConstSymbol, + * corresponding to the digit with the given value. This is equivalent + * to accessing the symbol from getConstSymbol with the corresponding + * key, such as kZeroDigitSymbol or kOneDigitSymbol. + * + * This is not currently stable API, but if you think it should be stable, + * post a comment on the following ticket and the ICU team will take a look: + * http://bugs.icu-project.org/trac/ticket/13580 + * + * @param digit The digit, an integer between 0 and 9 inclusive. + * If outside the range 0 to 9, the zero digit is returned. + * @return the format symbol for the given digit. + * @internal This API is currently for ICU use only. + */ + inline const UnicodeString& getConstDigitSymbol(int32_t digit) const; + + /** * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API. * @internal */ - inline const char16_t* getCurrencyPattern(void) const; + inline const char16_t* getCurrencyPattern(void) const; #endif /* U_HIDE_INTERNAL_API */ private: @@ -474,27 +474,27 @@ private: */ UnicodeString fNoSymbol; - /** - * Dealing with code points is faster than dealing with strings when formatting. Because of - * this, we maintain a value containing the zero code point that is used whenever digitStrings - * represents a sequence of ten code points in order. - * - * <p>If the value stored here is positive, it means that the code point stored in this value - * corresponds to the digitStrings array, and codePointZero can be used instead of the - * digitStrings array for the purposes of efficient formatting; if -1, then digitStrings does - * *not* contain a sequence of code points, and it must be used directly. - * - * <p>It is assumed that codePointZero always shadows the value in digitStrings. codePointZero - * should never be set directly; rather, it should be updated only when digitStrings mutates. - * That is, the flow of information is digitStrings -> codePointZero, not the other way. - */ - UChar32 fCodePointZero; - + /** + * Dealing with code points is faster than dealing with strings when formatting. Because of + * this, we maintain a value containing the zero code point that is used whenever digitStrings + * represents a sequence of ten code points in order. + * + * <p>If the value stored here is positive, it means that the code point stored in this value + * corresponds to the digitStrings array, and codePointZero can be used instead of the + * digitStrings array for the purposes of efficient formatting; if -1, then digitStrings does + * *not* contain a sequence of code points, and it must be used directly. + * + * <p>It is assumed that codePointZero always shadows the value in digitStrings. codePointZero + * should never be set directly; rather, it should be updated only when digitStrings mutates. + * That is, the flow of information is digitStrings -> codePointZero, not the other way. + */ + UChar32 fCodePointZero; + Locale locale; char actualLocale[ULOC_FULLNAME_CAPACITY]; char validLocale[ULOC_FULLNAME_CAPACITY]; - const char16_t* currPattern; + const char16_t* currPattern; UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT]; UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT]; @@ -515,7 +515,7 @@ DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const { return *strPtr; } -// See comments above for this function. Not hidden with #ifdef U_HIDE_INTERNAL_API +// See comments above for this function. Not hidden with #ifdef U_HIDE_INTERNAL_API inline const UnicodeString & DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { const UnicodeString *strPtr; @@ -527,19 +527,19 @@ DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { return *strPtr; } -#ifndef U_HIDE_INTERNAL_API -inline const UnicodeString& DecimalFormatSymbols::getConstDigitSymbol(int32_t digit) const { - if (digit < 0 || digit > 9) { - digit = 0; - } - if (digit == 0) { - return fSymbols[kZeroDigitSymbol]; - } - ENumberFormatSymbol key = static_cast<ENumberFormatSymbol>(kOneDigitSymbol + digit - 1); - return fSymbols[key]; -} -#endif /* U_HIDE_INTERNAL_API */ - +#ifndef U_HIDE_INTERNAL_API +inline const UnicodeString& DecimalFormatSymbols::getConstDigitSymbol(int32_t digit) const { + if (digit < 0 || digit > 9) { + digit = 0; + } + if (digit == 0) { + return fSymbols[kZeroDigitSymbol]; + } + ENumberFormatSymbol key = static_cast<ENumberFormatSymbol>(kOneDigitSymbol + digit - 1); + return fSymbols[key]; +} +#endif /* U_HIDE_INTERNAL_API */ + // ------------------------------------- inline void @@ -556,20 +556,20 @@ DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString // If the zero digit is being set to a known zero digit according to Unicode, // then we automatically set the corresponding 1-9 digits - // Also record updates to fCodePointZero. Be conservative if in doubt. - if (symbol == kZeroDigitSymbol) { + // Also record updates to fCodePointZero. Be conservative if in doubt. + if (symbol == kZeroDigitSymbol) { UChar32 sym = value.char32At(0); - if ( propogateDigits && u_charDigitValue(sym) == 0 && value.countChar32() == 1 ) { - fCodePointZero = sym; + if ( propogateDigits && u_charDigitValue(sym) == 0 && value.countChar32() == 1 ) { + fCodePointZero = sym; for ( int8_t i = 1 ; i<= 9 ; i++ ) { sym++; fSymbols[(int)kOneDigitSymbol+i-1] = UnicodeString(sym); } - } else { - fCodePointZero = -1; + } else { + fCodePointZero = -1; } - } else if (symbol >= kOneDigitSymbol && symbol <= kNineDigitSymbol) { - fCodePointZero = -1; + } else if (symbol >= kOneDigitSymbol && symbol <= kNineDigitSymbol) { + fCodePointZero = -1; } } @@ -581,7 +581,7 @@ DecimalFormatSymbols::getLocale() const { } #ifndef U_HIDE_INTERNAL_API -inline const char16_t* +inline const char16_t* DecimalFormatSymbols::getCurrencyPattern() const { return currPattern; } @@ -591,7 +591,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _DCFMTSYM //eof diff --git a/contrib/libs/icu/include/unicode/decimfmt.h b/contrib/libs/icu/include/unicode/decimfmt.h index 8dba9b21f3..ffdbb1cc99 100644 --- a/contrib/libs/icu/include/unicode/decimfmt.h +++ b/contrib/libs/icu/include/unicode/decimfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -28,12 +28,12 @@ #define DECIMFMT_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + /** * \file - * \brief C++ API: Compatibility APIs for decimal formatting. + * \brief C++ API: Compatibility APIs for decimal formatting. */ #if !UCONFIG_NO_FORMATTING @@ -49,28 +49,28 @@ U_NAMESPACE_BEGIN class CurrencyPluralInfo; -class CompactDecimalFormat; - -namespace number { -class LocalizedNumberFormatter; -namespace impl { -class DecimalQuantity; -struct DecimalFormatFields; -class UFormattedNumberData; -} -} - -namespace numparse { -namespace impl { -class NumberParserImpl; -} -} - +class CompactDecimalFormat; + +namespace number { +class LocalizedNumberFormatter; +namespace impl { +class DecimalQuantity; +struct DecimalFormatFields; +class UFormattedNumberData; +} +} + +namespace numparse { +namespace impl { +class NumberParserImpl; +} +} + /** - * **IMPORTANT:** New users are strongly encouraged to see if - * numberformatter.h fits their use case. Although not deprecated, this header - * is provided for backwards compatibility only. - * + * **IMPORTANT:** New users are strongly encouraged to see if + * numberformatter.h fits their use case. Although not deprecated, this header + * is provided for backwards compatibility only. + * * DecimalFormat is a concrete subclass of NumberFormat that formats decimal * numbers. It has a variety of features designed to make it possible to parse * and format numbers in any locale, including support for Western, Arabic, or @@ -79,13 +79,13 @@ class NumberParserImpl; * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", * "123 US dollars"). All of these flavors can be easily localized. * - * To obtain a NumberFormat for a specific locale (including the default + * To obtain a NumberFormat for a specific locale (including the default * locale) call one of NumberFormat's factory methods such as * createInstance(). Do not call the DecimalFormat constructors directly, unless * you know what you are doing, since the NumberFormat factory methods may * return subclasses other than DecimalFormat. * - * **Example Usage** + * **Example Usage** * * \code * // Normally we would have a GUI with a menu for this @@ -129,11 +129,11 @@ class NumberParserImpl; * } * } * \endcode - * - * **Another example use createInstance(style)** - * - * \code - * // Print out a number using the localized number, currency, + * + * **Another example use createInstance(style)** + * + * \code + * // Print out a number using the localized number, currency, * // percent, scientific, integer, iso currency, and plural currency * // format for each locale</strong> * Locale* locale = new Locale("en", "US"); @@ -144,13 +144,13 @@ class NumberParserImpl; * for (int j=NumberFormat::kNumberStyle; * j<=NumberFormat::kPluralCurrencyStyle; * ++j) { - * NumberFormat* form = NumberFormat::createInstance(locale, j, success); + * NumberFormat* form = NumberFormat::createInstance(locale, j, success); * str.remove(); * cout << "format result " << form->format(myNumber, str) << endl; * format->parse(form->format(myNumber, str), fmtable, success); - * delete form; - * } - * \endcode + * delete form; + * } + * \endcode * * * <p><strong>Patterns</strong> @@ -279,7 +279,7 @@ class NumberParserImpl; * <td>Pad escape, precedes pad character * </table> * - * <p>A DecimalFormat pattern contains a positive and negative + * <p>A DecimalFormat pattern contains a positive and negative * subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a * prefix, a numeric part, and a suffix. If there is no explicit negative * subpattern, the negative subpattern is the localized minus sign prefixed to the @@ -414,7 +414,7 @@ class NumberParserImpl; * * <li>If the number of actual fraction digits is less than the * <em>minimum fraction digits</em>, then trailing zeros are added. - * For example, 0.125 is formatted as "0.1250" if the minimum fraction + * For example, 0.125 is formatted as "0.1250" if the minimum fraction * digits is set to 4. * * <li>Trailing fractional zeros are not displayed if they occur @@ -579,9 +579,9 @@ class NumberParserImpl; * count of <code>getMaximumSignificantDigits() - 1</code>. For example, the * pattern <code>"@@###E0"</code> is equivalent to <code>"0.0###E0"</code>. * - * <li>If significant digits are in use, then the integer and fraction + * <li>If significant digits are in use, then the integer and fraction * digit counts, as set via the API, are ignored. If significant - * digits are not in use, then the significant digit counts, as set via + * digits are not in use, then the significant digit counts, as set via * the API, are ignored. * * </ul> @@ -603,7 +603,7 @@ class NumberParserImpl; * including prefix and suffix, determines the format width. For example, in * the pattern <code>"* #0 o''clock"</code>, the format width is 10. * - * <li>The width is counted in 16-bit code units (char16_ts). + * <li>The width is counted in 16-bit code units (char16_ts). * * <li>Some parameters which usually do not matter have meaning when padding is * used, because the pattern width is significant with padding. In the pattern @@ -635,7 +635,7 @@ class NumberParserImpl; * increment in the pattern itself. "#,#50" specifies a rounding increment of * 50. "#,##0.05" specifies a rounding increment of 0.05. * - * <p>In the absence of an explicit rounding increment numbers are + * <p>In the absence of an explicit rounding increment numbers are * rounded to their formatted width. * * <ul> @@ -665,14 +665,14 @@ class NumberParserImpl; * subclasses, such code will not necessarily work and will not be * guaranteed to work stably from release to release. */ -class U_I18N_API DecimalFormat : public NumberFormat { - public: +class U_I18N_API DecimalFormat : public NumberFormat { + public: /** * Pad position. * @stable ICU 2.4 */ enum EPadPosition { - kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix + kPadBeforePrefix, kPadAfterPrefix, kPadBeforeSuffix, kPadAfterSuffix }; /** @@ -684,9 +684,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * on NumberFormat such as createInstance. These factories will * return the most appropriate sub-class of NumberFormat for a given * locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * #icu::number::NumberFormatter instead of DecimalFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * #icu::number::NumberFormatter instead of DecimalFormat. * @param status Output param set to success/failure code. If the * pattern is invalid this will be set to a failure code. * @stable ICU 2.0 @@ -702,15 +702,15 @@ class U_I18N_API DecimalFormat : public NumberFormat { * on NumberFormat such as createInstance. These factories will * return the most appropriate sub-class of NumberFormat for a given * locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * #icu::number::NumberFormatter instead of DecimalFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * #icu::number::NumberFormatter instead of DecimalFormat. * @param pattern A non-localized pattern string. * @param status Output param set to success/failure code. If the * pattern is invalid this will be set to a failure code. * @stable ICU 2.0 */ - DecimalFormat(const UnicodeString& pattern, UErrorCode& status); + DecimalFormat(const UnicodeString& pattern, UErrorCode& status); /** * Create a DecimalFormat from the given pattern and symbols. @@ -722,9 +722,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * createInstance or createCurrencyInstance. If you need only minor adjustments * to a standard format, you can modify the format returned by * a NumberFormat factory method. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * #icu::number::NumberFormatter instead of DecimalFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * #icu::number::NumberFormatter instead of DecimalFormat. * * @param pattern a non-localized pattern string * @param symbolsToAdopt the set of symbols to be used. The caller should not @@ -733,10 +733,10 @@ class U_I18N_API DecimalFormat : public NumberFormat { * pattern is invalid this will be set to a failure code. * @stable ICU 2.0 */ - DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status); + DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status); #ifndef U_HIDE_INTERNAL_API - + /** * This API is for ICU use only. * Create a DecimalFormat from the given pattern, symbols, and style. @@ -749,41 +749,41 @@ class U_I18N_API DecimalFormat : public NumberFormat { * pattern is invalid this will be set to a failure code. * @internal */ - DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, - UNumberFormatStyle style, UErrorCode& status); + DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, + UNumberFormatStyle style, UErrorCode& status); #if UCONFIG_HAVE_PARSEALLINPUT - + /** * @internal */ void setParseAllInput(UNumberFormatAttributeValue value); - + #endif #endif /* U_HIDE_INTERNAL_API */ - private: - - /** - * Internal constructor for DecimalFormat; sets up internal fields. All public constructors should - * call this constructor. - */ - DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status); - - public: + private: /** + * Internal constructor for DecimalFormat; sets up internal fields. All public constructors should + * call this constructor. + */ + DecimalFormat(const DecimalFormatSymbols* symbolsToAdopt, UErrorCode& status); + + public: + + /** * Set an integer attribute on this DecimalFormat. * May return U_UNSUPPORTED_ERROR if this instance does not support * the specified attribute. * @param attr the attribute to set - * @param newValue new value + * @param newValue new value * @param status the error type * @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) ) * @stable ICU 51 */ - virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status); + virtual DecimalFormat& setAttribute(UNumberFormatAttribute attr, int32_t newValue, UErrorCode& status); /** * Get an integer @@ -794,7 +794,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return the attribute value. Undefined if there is an error. * @stable ICU 51 */ - virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const; + virtual int32_t getAttribute(UNumberFormatAttribute attr, UErrorCode& status) const; /** @@ -803,7 +803,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see getGroupingUsed * @stable ICU 53 */ - void setGroupingUsed(UBool newValue) U_OVERRIDE; + void setGroupingUsed(UBool newValue) U_OVERRIDE; /** * Sets whether or not numbers should be parsed as integers only. @@ -812,16 +812,16 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see isParseIntegerOnly * @stable ICU 53 */ - void setParseIntegerOnly(UBool value) U_OVERRIDE; + void setParseIntegerOnly(UBool value) U_OVERRIDE; /** - * Sets whether lenient parsing should be enabled (it is off by default). - * - * @param enable \c TRUE if lenient parsing should be used, - * \c FALSE otherwise. - * @stable ICU 4.8 + * Sets whether lenient parsing should be enabled (it is off by default). + * + * @param enable \c TRUE if lenient parsing should be used, + * \c FALSE otherwise. + * @stable ICU 4.8 */ - void setLenient(UBool enable) U_OVERRIDE; + void setLenient(UBool enable) U_OVERRIDE; /** * Create a DecimalFormat from the given pattern and symbols. @@ -833,21 +833,21 @@ class U_I18N_API DecimalFormat : public NumberFormat { * createInstance or createCurrencyInstance. If you need only minor adjustments * to a standard format, you can modify the format returned by * a NumberFormat factory method. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * #icu::number::NumberFormatter instead of DecimalFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * #icu::number::NumberFormatter instead of DecimalFormat. * * @param pattern a non-localized pattern string * @param symbolsToAdopt the set of symbols to be used. The caller should not * delete this object after making this call. - * @param parseError Output param to receive errors occurred during parsing + * @param parseError Output param to receive errors occurred during parsing * @param status Output param set to success/failure code. If the * pattern is invalid this will be set to a failure code. * @stable ICU 2.0 */ - DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, - UParseError& parseError, UErrorCode& status); - + DecimalFormat(const UnicodeString& pattern, DecimalFormatSymbols* symbolsToAdopt, + UParseError& parseError, UErrorCode& status); + /** * Create a DecimalFormat from the given pattern and symbols. * Use this constructor when you need to completely customize the @@ -858,9 +858,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * createInstance or createCurrencyInstance. If you need only minor adjustments * to a standard format, you can modify the format returned by * a NumberFormat factory method. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * #icu::number::NumberFormatter instead of DecimalFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * #icu::number::NumberFormatter instead of DecimalFormat. * * @param pattern a non-localized pattern string * @param symbols the set of symbols to be used @@ -868,7 +868,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * pattern is invalid this will be set to a failure code. * @stable ICU 2.0 */ - DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status); + DecimalFormat(const UnicodeString& pattern, const DecimalFormatSymbols& symbols, UErrorCode& status); /** * Copy constructor. @@ -890,7 +890,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Destructor. * @stable ICU 2.0 */ - ~DecimalFormat() U_OVERRIDE; + ~DecimalFormat() U_OVERRIDE; /** * Clone this Format object polymorphically. The caller owns the @@ -899,7 +899,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return a polymorphic copy of this DecimalFormat. * @stable ICU 2.0 */ - DecimalFormat* clone() const U_OVERRIDE; + DecimalFormat* clone() const U_OVERRIDE; /** * Return true if the given Format objects are semantically equal. @@ -909,7 +909,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return true if the given Format objects are semantically equal. * @stable ICU 2.0 */ - UBool operator==(const Format& other) const U_OVERRIDE; + UBool operator==(const Format& other) const U_OVERRIDE; using NumberFormat::format; @@ -925,9 +925,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ - UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; + UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** * Format a double or long number using base-10 representation. * @@ -940,9 +940,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @internal */ - UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const U_OVERRIDE; -#endif /* U_HIDE_INTERNAL_API */ + UnicodeString& format(double number, UnicodeString& appendTo, FieldPosition& pos, + UErrorCode& status) const U_OVERRIDE; +#endif /* U_HIDE_INTERNAL_API */ /** * Format a double or long number using base-10 representation. @@ -957,8 +957,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 4.4 */ - UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter, - UErrorCode& status) const U_OVERRIDE; + UnicodeString& format(double number, UnicodeString& appendTo, FieldPositionIterator* posIter, + UErrorCode& status) const U_OVERRIDE; /** * Format a long number using base-10 representation. @@ -971,9 +971,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 2.0 */ - UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; + UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** * Format a long number using base-10 representation. * @@ -982,13 +982,13 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. - * @param status Output param filled with success/failure status. + * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @internal */ - UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const U_OVERRIDE; -#endif /* U_HIDE_INTERNAL_API */ + UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPosition& pos, + UErrorCode& status) const U_OVERRIDE; +#endif /* U_HIDE_INTERNAL_API */ /** * Format a long number using base-10 representation. @@ -1003,8 +1003,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 4.4 */ - UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, - UErrorCode& status) const U_OVERRIDE; + UnicodeString& format(int32_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, + UErrorCode& status) const U_OVERRIDE; /** * Format an int64 number using base-10 representation. @@ -1017,9 +1017,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 2.8 */ - UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; + UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const U_OVERRIDE; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** * Format an int64 number using base-10 representation. * @@ -1028,13 +1028,13 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. * On output: the offsets of the alignment field. - * @param status Output param filled with success/failure status. + * @param status Output param filled with success/failure status. * @return Reference to 'appendTo' parameter. * @internal */ - UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const U_OVERRIDE; -#endif /* U_HIDE_INTERNAL_API */ + UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPosition& pos, + UErrorCode& status) const U_OVERRIDE; +#endif /* U_HIDE_INTERNAL_API */ /** * Format an int64 number using base-10 representation. @@ -1049,8 +1049,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 4.4 */ - UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, - UErrorCode& status) const U_OVERRIDE; + UnicodeString& format(int64_t number, UnicodeString& appendTo, FieldPositionIterator* posIter, + UErrorCode& status) const U_OVERRIDE; /** * Format a decimal number. @@ -1068,18 +1068,18 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @stable ICU 4.4 */ - UnicodeString& format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter, - UErrorCode& status) const U_OVERRIDE; + UnicodeString& format(StringPiece number, UnicodeString& appendTo, FieldPositionIterator* posIter, + UErrorCode& status) const U_OVERRIDE; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** * Format a decimal number. - * The number is a DecimalQuantity wrapper onto a floating point decimal number. + * The number is a DecimalQuantity wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. * - * @param number The number, a DecimalQuantity format Decimal Floating Point. + * @param number The number, a DecimalQuantity format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions @@ -1088,16 +1088,16 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @internal */ - UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo, - FieldPositionIterator* posIter, UErrorCode& status) const U_OVERRIDE; + UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo, + FieldPositionIterator* posIter, UErrorCode& status) const U_OVERRIDE; /** * Format a decimal number. - * The number is a DecimalQuantity wrapper onto a floating point decimal number. + * The number is a DecimalQuantity wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. * - * @param number The number, a DecimalQuantity format Decimal Floating Point. + * @param number The number, a DecimalQuantity format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. @@ -1106,36 +1106,36 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @return Reference to 'appendTo' parameter. * @internal */ - UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo, - FieldPosition& pos, UErrorCode& status) const U_OVERRIDE; - -#endif // U_HIDE_INTERNAL_API + UnicodeString& format(const number::impl::DecimalQuantity& number, UnicodeString& appendTo, + FieldPosition& pos, UErrorCode& status) const U_OVERRIDE; - using NumberFormat::parse; +#endif // U_HIDE_INTERNAL_API - /** - * Parse the given string using this object's choices. The method - * does string comparisons to try to find an optimal match. - * If no object can be parsed, index is unchanged, and NULL is - * returned. The result is returned as the most parsimonious - * type of Formattable that will accommodate all of the - * necessary precision. For example, if the result is exactly 12, - * it will be returned as a long. However, if it is 1.5, it will - * be returned as a double. - * - * @param text The text to be parsed. - * @param result Formattable to be set to the parse result. - * If parse fails, return contents are undefined. - * @param parsePosition The position to start parsing at on input. - * On output, moved to after the last successfully - * parse character. On parse failure, does not change. - * @see Formattable - * @stable ICU 2.0 - */ - void parse(const UnicodeString& text, Formattable& result, - ParsePosition& parsePosition) const U_OVERRIDE; + using NumberFormat::parse; /** + * Parse the given string using this object's choices. The method + * does string comparisons to try to find an optimal match. + * If no object can be parsed, index is unchanged, and NULL is + * returned. The result is returned as the most parsimonious + * type of Formattable that will accommodate all of the + * necessary precision. For example, if the result is exactly 12, + * it will be returned as a long. However, if it is 1.5, it will + * be returned as a double. + * + * @param text The text to be parsed. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parsePosition The position to start parsing at on input. + * On output, moved to after the last successfully + * parse character. On parse failure, does not change. + * @see Formattable + * @stable ICU 2.0 + */ + void parse(const UnicodeString& text, Formattable& result, + ParsePosition& parsePosition) const U_OVERRIDE; + + /** * Parses text from the given string as a currency amount. Unlike * the parse() method, this method will attempt to parse a generic * currency name, searching for a match of this object's locale's @@ -1154,7 +1154,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * the parsed currency; if parse fails, this is NULL. * @stable ICU 49 */ - CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE; + CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE; /** * Returns the decimal format symbols, which is generally not changed @@ -1284,33 +1284,33 @@ class U_I18N_API DecimalFormat : public NumberFormat { virtual void setNegativeSuffix(const UnicodeString& newValue); /** - * Whether to show the plus sign on positive (non-negative) numbers; for example, "+12" - * - * For more control over sign display, use NumberFormatter. - * - * @return Whether the sign is shown on positive numbers and zero. - * @stable ICU 64 - */ - UBool isSignAlwaysShown() const; - - /** - * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12". - * - * For more control over sign display, use NumberFormatter. - * - * @param value true to always show a sign; false to hide the sign on positive numbers and zero. - * @stable ICU 64 - */ - void setSignAlwaysShown(UBool value); - - /** + * Whether to show the plus sign on positive (non-negative) numbers; for example, "+12" + * + * For more control over sign display, use NumberFormatter. + * + * @return Whether the sign is shown on positive numbers and zero. + * @stable ICU 64 + */ + UBool isSignAlwaysShown() const; + + /** + * Set whether to show the plus sign on positive (non-negative) numbers; for example, "+12". + * + * For more control over sign display, use NumberFormatter. + * + * @param value true to always show a sign; false to hide the sign on positive numbers and zero. + * @stable ICU 64 + */ + void setSignAlwaysShown(UBool value); + + /** * Get the multiplier for use in percent, permill, etc. * For a percentage, set the suffixes to have "%" and the multiplier to be 100. * (For Arabic, use arabic percent symbol). * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. * - * The number may also be multiplied by a power of ten; see getMultiplierScale(). - * + * The number may also be multiplied by a power of ten; see getMultiplierScale(). + * * @return the multiplier for use in percent, permill, etc. * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 * @stable ICU 2.0 @@ -1323,9 +1323,9 @@ class U_I18N_API DecimalFormat : public NumberFormat { * (For Arabic, use arabic percent symbol). * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. * - * This method only supports integer multipliers. To multiply by a non-integer, pair this - * method with setMultiplierScale(). - * + * This method only supports integer multipliers. To multiply by a non-integer, pair this + * method with setMultiplierScale(). + * * @param newValue the new value of the multiplier for use in percent, permill, etc. * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 * @stable ICU 2.0 @@ -1333,41 +1333,41 @@ class U_I18N_API DecimalFormat : public NumberFormat { virtual void setMultiplier(int32_t newValue); /** - * Gets the power of ten by which number should be multiplied before formatting, which - * can be combined with setMultiplier() to multiply by any arbitrary decimal value. - * - * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale - * of -2 corresponds to multiplication by 0.01. - * - * This method is analogous to UNUM_SCALE in getAttribute. - * - * @return the current value of the power-of-ten multiplier. - * @stable ICU 62 - */ - int32_t getMultiplierScale(void) const; - - /** - * Sets a power of ten by which number should be multiplied before formatting, which - * can be combined with setMultiplier() to multiply by any arbitrary decimal value. - * - * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale - * of -2 corresponds to multiplication by 0.01. - * - * For example, to multiply numbers by 0.5 before formatting, you can do: - * - * <pre> - * df.setMultiplier(5); - * df.setMultiplierScale(-1); - * </pre> - * - * This method is analogous to UNUM_SCALE in setAttribute. - * - * @param newValue the new value of the power-of-ten multiplier. - * @stable ICU 62 - */ - void setMultiplierScale(int32_t newValue); - - /** + * Gets the power of ten by which number should be multiplied before formatting, which + * can be combined with setMultiplier() to multiply by any arbitrary decimal value. + * + * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale + * of -2 corresponds to multiplication by 0.01. + * + * This method is analogous to UNUM_SCALE in getAttribute. + * + * @return the current value of the power-of-ten multiplier. + * @stable ICU 62 + */ + int32_t getMultiplierScale(void) const; + + /** + * Sets a power of ten by which number should be multiplied before formatting, which + * can be combined with setMultiplier() to multiply by any arbitrary decimal value. + * + * A multiplier scale of 2 corresponds to multiplication by 100, and a multiplier scale + * of -2 corresponds to multiplication by 0.01. + * + * For example, to multiply numbers by 0.5 before formatting, you can do: + * + * <pre> + * df.setMultiplier(5); + * df.setMultiplierScale(-1); + * </pre> + * + * This method is analogous to UNUM_SCALE in setAttribute. + * + * @param newValue the new value of the power-of-ten multiplier. + * @stable ICU 62 + */ + void setMultiplierScale(int32_t newValue); + + /** * Get the rounding increment. * @return A positive rounding increment, or 0.0 if a custom rounding * increment is not in effect. @@ -1399,7 +1399,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see #setRoundingMode * @stable ICU 2.0 */ - virtual ERoundingMode getRoundingMode(void) const U_OVERRIDE; + virtual ERoundingMode getRoundingMode(void) const U_OVERRIDE; /** * Set the rounding mode. @@ -1409,7 +1409,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see #getRoundingMode * @stable ICU 2.0 */ - virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE; + virtual void setRoundingMode(ERoundingMode roundingMode) U_OVERRIDE; /** * Get the width to which the output of format() is padded. @@ -1458,8 +1458,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Set the character used to pad to the format width. If padding * is not enabled, then this will take effect if padding is later * enabled. - * @param padChar a string containing the pad character. If the string - * has length 0, then the pad character is set to ' '. Otherwise + * @param padChar a string containing the pad character. If the string + * has length 0, then the pad character is set to ' '. Otherwise * padChar.char32At(0) will be used as the pad character. * @see #setFormatWidth * @see #getFormatWidth @@ -1468,7 +1468,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see #setPadPosition * @stable ICU 2.0 */ - virtual void setPadCharacter(const UnicodeString& padChar); + virtual void setPadCharacter(const UnicodeString& padChar); /** * Get the position at which padding will take place. This is the location @@ -1662,14 +1662,14 @@ class U_I18N_API DecimalFormat : public NumberFormat { * A value of 1, 0, or lower, means that the use of grouping separators * only depends on the grouping size (and on isGroupingUsed()). * - * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat. - * This is for backwards compatibility reasons. - * - * For more control over grouping strategies, use NumberFormatter. - * + * NOTE: The CLDR data is used in NumberFormatter but not in DecimalFormat. + * This is for backwards compatibility reasons. + * + * For more control over grouping strategies, use NumberFormatter. + * * @see setMinimumGroupingDigits * @see getGroupingSize - * @stable ICU 64 + * @stable ICU 64 */ int32_t getMinimumGroupingDigits() const; @@ -1677,13 +1677,13 @@ class U_I18N_API DecimalFormat : public NumberFormat { * Sets the minimum grouping digits. Setting to a value less than or * equal to 1 turns off minimum grouping digits. * - * For more control over grouping strategies, use NumberFormatter. - * + * For more control over grouping strategies, use NumberFormatter. + * * @param newValue the new value of minimum grouping digits. * @see getMinimumGroupingDigits - * @stable ICU 64 + * @stable ICU 64 */ - void setMinimumGroupingDigits(int32_t newValue); + void setMinimumGroupingDigits(int32_t newValue); /** * Allows you to get the behavior of the decimal separator with integers. @@ -1714,7 +1714,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { UBool isDecimalPatternMatchRequired(void) const; /** - * Allows you to set the parse behavior of the pattern decimal mark. + * Allows you to set the parse behavior of the pattern decimal mark. * * if TRUE, the input must have a decimal mark if one was specified in the pattern. When * FALSE the decimal mark may be omitted from the input. @@ -1724,67 +1724,67 @@ class U_I18N_API DecimalFormat : public NumberFormat { */ virtual void setDecimalPatternMatchRequired(UBool newValue); - /** - * Returns whether to ignore exponents when parsing. - * - * @return Whether to ignore exponents when parsing. - * @see #setParseNoExponent - * @stable ICU 64 - */ - UBool isParseNoExponent() const; - - /** - * Specifies whether to stop parsing when an exponent separator is encountered. For - * example, parses "123E4" to 123 (with parse position 3) instead of 1230000 (with parse position - * 5). - * - * @param value true to prevent exponents from being parsed; false to allow them to be parsed. - * @stable ICU 64 - */ - void setParseNoExponent(UBool value); - - /** - * Returns whether parsing is sensitive to case (lowercase/uppercase). - * - * @return Whether parsing is case-sensitive. - * @see #setParseCaseSensitive - * @stable ICU 64 - */ - UBool isParseCaseSensitive() const; - - /** - * Whether to pay attention to case when parsing; default is to ignore case (perform - * case-folding). For example, "A" == "a" in case-insensitive but not case-sensitive mode. - * - * Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive - * mode, even though "US$1.00" parses. - * - * @param value true to enable case-sensitive parsing (the default); false to force - * case-sensitive parsing behavior. - * @stable ICU 64 - */ - void setParseCaseSensitive(UBool value); - - /** - * Returns whether truncation of high-order integer digits should result in an error. - * By default, setMaximumIntegerDigits truncates high-order digits silently. - * - * @return Whether an error code is set if high-order digits are truncated. - * @see setFormatFailIfMoreThanMaxDigits - * @stable ICU 64 - */ - UBool isFormatFailIfMoreThanMaxDigits() const; - - /** - * Sets whether truncation of high-order integer digits should result in an error. - * By default, setMaximumIntegerDigits truncates high-order digits silently. - * - * @param value Whether to set an error code if high-order digits are truncated. - * @stable ICU 64 - */ - void setFormatFailIfMoreThanMaxDigits(UBool value); + /** + * Returns whether to ignore exponents when parsing. + * + * @return Whether to ignore exponents when parsing. + * @see #setParseNoExponent + * @stable ICU 64 + */ + UBool isParseNoExponent() const; /** + * Specifies whether to stop parsing when an exponent separator is encountered. For + * example, parses "123E4" to 123 (with parse position 3) instead of 1230000 (with parse position + * 5). + * + * @param value true to prevent exponents from being parsed; false to allow them to be parsed. + * @stable ICU 64 + */ + void setParseNoExponent(UBool value); + + /** + * Returns whether parsing is sensitive to case (lowercase/uppercase). + * + * @return Whether parsing is case-sensitive. + * @see #setParseCaseSensitive + * @stable ICU 64 + */ + UBool isParseCaseSensitive() const; + + /** + * Whether to pay attention to case when parsing; default is to ignore case (perform + * case-folding). For example, "A" == "a" in case-insensitive but not case-sensitive mode. + * + * Currency symbols are never case-folded. For example, "us$1.00" will not parse in case-insensitive + * mode, even though "US$1.00" parses. + * + * @param value true to enable case-sensitive parsing (the default); false to force + * case-sensitive parsing behavior. + * @stable ICU 64 + */ + void setParseCaseSensitive(UBool value); + + /** + * Returns whether truncation of high-order integer digits should result in an error. + * By default, setMaximumIntegerDigits truncates high-order digits silently. + * + * @return Whether an error code is set if high-order digits are truncated. + * @see setFormatFailIfMoreThanMaxDigits + * @stable ICU 64 + */ + UBool isFormatFailIfMoreThanMaxDigits() const; + + /** + * Sets whether truncation of high-order integer digits should result in an error. + * By default, setMaximumIntegerDigits truncates high-order digits silently. + * + * @param value Whether to set an error code if high-order digits are truncated. + * @stable ICU 64 + */ + void setFormatFailIfMoreThanMaxDigits(UBool value); + + /** * Synthesizes a pattern string that represents the current state * of this Format object. * @@ -1837,8 +1837,8 @@ class U_I18N_API DecimalFormat : public NumberFormat { * set to a failure result. * @stable ICU 2.0 */ - virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status); - + virtual void applyPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status); + /** * Sets the pattern. * @param pattern The pattern to be applied. @@ -1847,7 +1847,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * set to a failure result. * @stable ICU 2.0 */ - virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status); + virtual void applyPattern(const UnicodeString& pattern, UErrorCode& status); /** * Apply the given pattern to this Format object. The pattern @@ -1879,7 +1879,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * set to a failure result. * @stable ICU 2.0 */ - virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError, + virtual void applyLocalizedPattern(const UnicodeString& pattern, UParseError& parseError, UErrorCode& status); /** @@ -1891,7 +1891,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * set to a failure result. * @stable ICU 2.0 */ - virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status); + virtual void applyLocalizedPattern(const UnicodeString& pattern, UErrorCode& status); /** @@ -1903,7 +1903,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see NumberFormat#setMaximumIntegerDigits * @stable ICU 2.0 */ - void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE; + void setMaximumIntegerDigits(int32_t newValue) U_OVERRIDE; /** * Sets the minimum number of digits allowed in the integer portion of a @@ -1914,7 +1914,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see NumberFormat#setMinimumIntegerDigits * @stable ICU 2.0 */ - void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE; + void setMinimumIntegerDigits(int32_t newValue) U_OVERRIDE; /** * Sets the maximum number of digits allowed in the fraction portion of a @@ -1925,7 +1925,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see NumberFormat#setMaximumFractionDigits * @stable ICU 2.0 */ - void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE; + void setMaximumFractionDigits(int32_t newValue) U_OVERRIDE; /** * Sets the minimum number of digits allowed in the fraction portion of a @@ -1936,7 +1936,7 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @see NumberFormat#setMinimumFractionDigits * @stable ICU 2.0 */ - void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE; + void setMinimumFractionDigits(int32_t newValue) U_OVERRIDE; /** * Returns the minimum number of significant digits that will be @@ -2011,100 +2011,100 @@ class U_I18N_API DecimalFormat : public NumberFormat { * @param ec input-output error code * @stable ICU 3.0 */ - void setCurrency(const char16_t* theCurrency, UErrorCode& ec) U_OVERRIDE; + void setCurrency(const char16_t* theCurrency, UErrorCode& ec) U_OVERRIDE; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Sets the currency used to display currency amounts. See - * setCurrency(const char16_t*, UErrorCode&). - * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&). + * setCurrency(const char16_t*, UErrorCode&). + * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&). */ - virtual void setCurrency(const char16_t* theCurrency); -#endif // U_FORCE_HIDE_DEPRECATED_API + virtual void setCurrency(const char16_t* theCurrency); +#endif // U_FORCE_HIDE_DEPRECATED_API /** - * Sets the `Currency Usage` object used to display currency. + * Sets the `Currency Usage` object used to display currency. * This takes effect immediately, if this format is a * currency format. - * @param newUsage new currency usage object to use. - * @param ec input-output error code + * @param newUsage new currency usage object to use. + * @param ec input-output error code * @stable ICU 54 */ void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec); /** - * Returns the `Currency Usage` object used to display currency + * Returns the `Currency Usage` object used to display currency * @stable ICU 54 */ UCurrencyUsage getCurrencyUsage() const; -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** - * Format a number and save it into the given DecimalQuantity. + * Format a number and save it into the given DecimalQuantity. * Internal, not intended for public use. * @internal */ - void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output, - UErrorCode& status) const; + void formatToDecimalQuantity(double number, number::impl::DecimalQuantity& output, + UErrorCode& status) const; /** - * Get a DecimalQuantity corresponding to a formattable as it would be + * Get a DecimalQuantity corresponding to a formattable as it would be * formatted by this DecimalFormat. * Internal, not intended for public use. * @internal */ - void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output, - UErrorCode& status) const; + void formatToDecimalQuantity(const Formattable& number, number::impl::DecimalQuantity& output, + UErrorCode& status) const; -#endif /* U_HIDE_INTERNAL_API */ +#endif /* U_HIDE_INTERNAL_API */ /** - * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting - * in ICU 60, NumberFormatter is the recommended way to format numbers. - * You can use the returned LocalizedNumberFormatter to format numbers and - * get a FormattedNumber, which contains a string as well as additional - * annotations about the formatted value. + * Converts this DecimalFormat to a (Localized)NumberFormatter. Starting + * in ICU 60, NumberFormatter is the recommended way to format numbers. + * You can use the returned LocalizedNumberFormatter to format numbers and + * get a FormattedNumber, which contains a string as well as additional + * annotations about the formatted value. + * + * If a memory allocation failure occurs, the return value of this method + * might be null. If you are concerned about correct recovery from + * out-of-memory situations, use this pattern: * - * If a memory allocation failure occurs, the return value of this method - * might be null. If you are concerned about correct recovery from - * out-of-memory situations, use this pattern: - * - * <pre> - * FormattedNumber result; - * if (auto* ptr = df->toNumberFormatter(status)) { - * result = ptr->formatDouble(123, status); - * } - * </pre> - * - * If you are not concerned about out-of-memory situations, or if your - * environment throws exceptions when memory allocation failure occurs, - * you can chain the methods, like this: - * - * <pre> - * FormattedNumber result = df - * ->toNumberFormatter(status) - * ->formatDouble(123, status); - * </pre> - * - * NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat. - * If a non-const method is called on the DecimalFormat, or if the DecimalFormat - * is deleted, the object becomes invalid. If you plan to keep the return value - * beyond the lifetime of the DecimalFormat, copy it to a local variable: - * - * <pre> - * LocalizedNumberFormatter lnf; - * if (auto* ptr = df->toNumberFormatter(status)) { - * lnf = *ptr; - * } - * </pre> - * - * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR. - * @return A pointer to an internal object, or nullptr on failure. - * Do not delete the return value! - * @stable ICU 64 + * <pre> + * FormattedNumber result; + * if (auto* ptr = df->toNumberFormatter(status)) { + * result = ptr->formatDouble(123, status); + * } + * </pre> + * + * If you are not concerned about out-of-memory situations, or if your + * environment throws exceptions when memory allocation failure occurs, + * you can chain the methods, like this: + * + * <pre> + * FormattedNumber result = df + * ->toNumberFormatter(status) + * ->formatDouble(123, status); + * </pre> + * + * NOTE: The returned LocalizedNumberFormatter is owned by this DecimalFormat. + * If a non-const method is called on the DecimalFormat, or if the DecimalFormat + * is deleted, the object becomes invalid. If you plan to keep the return value + * beyond the lifetime of the DecimalFormat, copy it to a local variable: + * + * <pre> + * LocalizedNumberFormatter lnf; + * if (auto* ptr = df->toNumberFormatter(status)) { + * lnf = *ptr; + * } + * </pre> + * + * @param status Set on failure, like U_MEMORY_ALLOCATION_ERROR. + * @return A pointer to an internal object, or nullptr on failure. + * Do not delete the return value! + * @stable ICU 64 */ - const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const; + const number::LocalizedNumberFormatter* toNumberFormatter(UErrorCode& status) const; /** * Return the class ID for this class. This is useful only for @@ -2130,68 +2130,68 @@ class U_I18N_API DecimalFormat : public NumberFormat { * other classes have different class IDs. * @stable ICU 2.0 */ - UClassID getDynamicClassID(void) const U_OVERRIDE; + UClassID getDynamicClassID(void) const U_OVERRIDE; - private: + private: - /** Rebuilds the formatter object from the property bag. */ - void touch(UErrorCode& status); + /** Rebuilds the formatter object from the property bag. */ + void touch(UErrorCode& status); - /** Rebuilds the formatter object, ignoring any error code. */ - void touchNoError(); + /** Rebuilds the formatter object, ignoring any error code. */ + void touchNoError(); /** - * Updates the property bag with settings from the given pattern. - * - * @param pattern The pattern string to parse. - * @param ignoreRounding Whether to leave out rounding information (minFrac, maxFrac, and rounding - * increment) when parsing the pattern. This may be desirable if a custom rounding mode, such - * as CurrencyUsage, is to be used instead. One of {@link - * PatternStringParser#IGNORE_ROUNDING_ALWAYS}, {@link PatternStringParser#IGNORE_ROUNDING_IF_CURRENCY}, - * or {@link PatternStringParser#IGNORE_ROUNDING_NEVER}. - * @see PatternAndPropertyUtils#parseToExistingProperties + * Updates the property bag with settings from the given pattern. + * + * @param pattern The pattern string to parse. + * @param ignoreRounding Whether to leave out rounding information (minFrac, maxFrac, and rounding + * increment) when parsing the pattern. This may be desirable if a custom rounding mode, such + * as CurrencyUsage, is to be used instead. One of {@link + * PatternStringParser#IGNORE_ROUNDING_ALWAYS}, {@link PatternStringParser#IGNORE_ROUNDING_IF_CURRENCY}, + * or {@link PatternStringParser#IGNORE_ROUNDING_NEVER}. + * @see PatternAndPropertyUtils#parseToExistingProperties */ - void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding, - UErrorCode& status); + void setPropertiesFromPattern(const UnicodeString& pattern, int32_t ignoreRounding, + UErrorCode& status); - const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const; + const numparse::impl::NumberParserImpl* getParser(UErrorCode& status) const; - const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const; + const numparse::impl::NumberParserImpl* getCurrencyParser(UErrorCode& status) const; - static void fieldPositionHelper( - const number::impl::UFormattedNumberData& formatted, - FieldPosition& fieldPosition, - int32_t offset, - UErrorCode& status); + static void fieldPositionHelper( + const number::impl::UFormattedNumberData& formatted, + FieldPosition& fieldPosition, + int32_t offset, + UErrorCode& status); - static void fieldPositionIteratorHelper( - const number::impl::UFormattedNumberData& formatted, - FieldPositionIterator* fpi, - int32_t offset, - UErrorCode& status); + static void fieldPositionIteratorHelper( + const number::impl::UFormattedNumberData& formatted, + FieldPositionIterator* fpi, + int32_t offset, + UErrorCode& status); - void setupFastFormat(); + void setupFastFormat(); - bool fastFormatDouble(double input, UnicodeString& output) const; + bool fastFormatDouble(double input, UnicodeString& output) const; - bool fastFormatInt64(int64_t input, UnicodeString& output) const; + bool fastFormatInt64(int64_t input, UnicodeString& output) const; - void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const; + void doFastFormatInt32(int32_t input, bool isNegative, UnicodeString& output) const; - //=====================================================================================// - // INSTANCE FIELDS // - //=====================================================================================// + //=====================================================================================// + // INSTANCE FIELDS // + //=====================================================================================// - // One instance field for the implementation, keep all fields inside of an implementation - // class defined in number_mapper.h - number::impl::DecimalFormatFields* fields = nullptr; + // One instance field for the implementation, keep all fields inside of an implementation + // class defined in number_mapper.h + number::impl::DecimalFormatFields* fields = nullptr; - // Allow child class CompactDecimalFormat to access fProperties: - friend class CompactDecimalFormat; + // Allow child class CompactDecimalFormat to access fProperties: + friend class CompactDecimalFormat; - // Allow MeasureFormat to use fieldPositionHelper: - friend class MeasureFormat; + // Allow MeasureFormat to use fieldPositionHelper: + friend class MeasureFormat; }; @@ -2199,7 +2199,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _DECIMFMT //eof diff --git a/contrib/libs/icu/include/unicode/docmain.h b/contrib/libs/icu/include/unicode/docmain.h index 704139a85e..63764e52e4 100644 --- a/contrib/libs/icu/include/unicode/docmain.h +++ b/contrib/libs/icu/include/unicode/docmain.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: @@ -33,7 +33,7 @@ * then detailed member descriptions.</p> * * <h3>C Programmers:</h3> - * <p>Use <a href="#Module">Module List</a> or <a href="globals_u.html">File Members</a> + * <p>Use <a href="#Module">Module List</a> or <a href="globals_u.html">File Members</a> * to find a list of all the functions and constants. * For example, to find BreakIterator functions you would click on * <a href="files.html"> File List</a>, @@ -88,26 +88,26 @@ * <td>icu::UnicodeSet</td> * </tr> * <tr> - * <td>Maps from Unicode Code Points to Integer Values</td> - * <td>ucptrie.h, umutablecptrie.h</td> - * <td>C API</td> - * </tr> - * <tr> + * <td>Maps from Unicode Code Points to Integer Values</td> + * <td>ucptrie.h, umutablecptrie.h</td> + * <td>C API</td> + * </tr> + * <tr> * <td>Maps from Strings to Integer Values</td> * <td>(no C API)</td> * <td>icu::BytesTrie, icu::UCharsTrie</td> * </tr> * <tr> * <td>Codepage Conversion</td> - * <td>ucnv.h, ucnvsel.h</td> - * <td>C API</td> - * </tr> - * <tr> - * <td>Codepage Detection</td> - * <td>ucsdet.h</td> + * <td>ucnv.h, ucnvsel.h</td> * <td>C API</td> * </tr> * <tr> + * <td>Codepage Detection</td> + * <td>ucsdet.h</td> + * <td>C API</td> + * </tr> + * <tr> * <td>Unicode Text Compression</td> * <td>ucnv.h<br/>(encoding name "SCSU" or "BOCU-1")</td> * <td>C API</td> @@ -115,7 +115,7 @@ * <tr> * <td>Locales </td> * <td>uloc.h</a></td> - * <td>icu::Locale, icu::LocaleBuilder, icu::LocaleMatcher</td> + * <td>icu::Locale, icu::LocaleBuilder, icu::LocaleMatcher</td> * </tr> * <tr> * <td>Resource Bundles</td> @@ -143,16 +143,16 @@ * <td>icu::MessageFormat</td> * </tr> * <tr> - * <td>Number Formatting<br/>(includes currency and unit formatting)</td> - * <td>unumberformatter.h, unum.h</td> - * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td> - * </tr> - * <tr> - * <td>Number Range Formatting<br />(includes currency and unit ranges)</td> - * <td>(no C API)</td> - * <td>icu::number::NumberRangeFormatter</td> + * <td>Number Formatting<br/>(includes currency and unit formatting)</td> + * <td>unumberformatter.h, unum.h</td> + * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td> * </tr> * <tr> + * <td>Number Range Formatting<br />(includes currency and unit ranges)</td> + * <td>(no C API)</td> + * <td>icu::number::NumberRangeFormatter</td> + * </tr> + * <tr> * <td>Number Spellout<br/>(Rule Based Number Formatting)</td> * <td>unum.h<br/>(use UNUM_SPELLOUT)</td> * <td>icu::RuleBasedNumberFormat</td> @@ -218,9 +218,9 @@ * <td>C API</td> * </tr> * <tr> - * <td>Paragraph Layout / Complex Text Layout</td> - * <td>playout.h</td> - * <td>icu::ParagraphLayout</td> + * <td>Paragraph Layout / Complex Text Layout</td> + * <td>playout.h</td> + * <td>icu::ParagraphLayout</td> * </tr> * <tr> * <td>ICU I/O</td> diff --git a/contrib/libs/icu/include/unicode/dtfmtsym.h b/contrib/libs/icu/include/unicode/dtfmtsym.h index c6d76fe98e..a6f52a7514 100644 --- a/contrib/libs/icu/include/unicode/dtfmtsym.h +++ b/contrib/libs/icu/include/unicode/dtfmtsym.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -22,12 +22,12 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/calendar.h" -#include "unicode/strenum.h" +#include "unicode/strenum.h" #include "unicode/uobject.h" #include "unicode/locid.h" #include "unicode/udat.h" @@ -429,13 +429,13 @@ public: * doesn't specify any time separator, and always recognized when parsing. * @internal */ - static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':' + static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':' /** * This alternate time separator is always recognized when parsing. * @internal */ - static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.' + static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.' /** * Gets the time separator string. For example: ":". @@ -569,7 +569,7 @@ public: * @return the non-localized date-time pattern characters * @stable ICU 2.0 */ - static const char16_t * U_EXPORT2 getPatternUChars(void); + static const char16_t * U_EXPORT2 getPatternUChars(void); /** * Gets localized date-time pattern characters. For example: 'u', 't', etc. @@ -980,7 +980,7 @@ private: * Returns the date format field index of the pattern character c, * or UDAT_FIELD_COUNT if c is not a pattern character. */ - static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c); + static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c); /** * Returns TRUE if f (with its pattern character repeated count times) is a numeric field. @@ -990,7 +990,7 @@ private: /** * Returns TRUE if c (repeated count times) is the pattern character for a numeric field. */ - static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count); + static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count); public: #ifndef U_HIDE_INTERNAL_API /** @@ -1013,7 +1013,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _DTFMTSYM //eof diff --git a/contrib/libs/icu/include/unicode/dtintrv.h b/contrib/libs/icu/include/unicode/dtintrv.h index 15e15c9d40..edc6ef272d 100644 --- a/contrib/libs/icu/include/unicode/dtintrv.h +++ b/contrib/libs/icu/include/unicode/dtintrv.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -15,9 +15,9 @@ #define __DTINTRV_H__ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -55,14 +55,14 @@ public: * @return the from date in dateInterval. * @stable ICU 4.0 */ - inline UDate getFromDate() const; + inline UDate getFromDate() const; /** * Get the to date. * @return the to date in dateInterval. * @stable ICU 4.0 */ - inline UDate getToDate() const; + inline UDate getToDate() const; /** @@ -71,7 +71,7 @@ public: * <pre> * . Base* polymorphic_pointer = createPolymorphicObject(); * . if (polymorphic_pointer->getDynamicClassID() == - * . derived::getStaticClassID()) ... + * . derived::getStaticClassID()) ... * </pre> * @return The class ID for all objects of this class. * @stable ICU 4.0 @@ -116,7 +116,7 @@ public: * @return TRUE if the two DateIntervals are not the same * @stable ICU 4.0 */ - inline UBool operator!=(const DateInterval& other) const; + inline UBool operator!=(const DateInterval& other) const; /** @@ -159,6 +159,6 @@ DateInterval::operator!=(const DateInterval& other) const { U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/dtitvfmt.h b/contrib/libs/icu/include/unicode/dtitvfmt.h index 4e4d712b4f..40d6591688 100644 --- a/contrib/libs/icu/include/unicode/dtitvfmt.h +++ b/contrib/libs/icu/include/unicode/dtitvfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************************** * Copyright (C) 2008-2016, International Business Machines Corporation and @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Format and parse date interval in a language-independent manner. @@ -30,87 +30,87 @@ #include "unicode/dtintrv.h" #include "unicode/dtitvinf.h" #include "unicode/dtptngen.h" -#include "unicode/formattedvalue.h" +#include "unicode/formattedvalue.h" U_NAMESPACE_BEGIN -class FormattedDateIntervalData; -class DateIntervalFormat; - -/** - * An immutable class containing the result of a date interval formatting operation. - * - * Instances of this class are immutable and thread-safe. - * - * When calling nextPosition(): - * The fields are returned from left to right. The special field category - * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime - * primitives came from which arguments: 0 means fromCalendar, and 1 means - * toCalendar. The span category will always occur before the - * corresponding fields in UFIELD_CATEGORY_DATE - * in the nextPosition() iterator. - * - * Not intended for public subclassing. - * - * @stable ICU 64 - */ -class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue { - public: - /** - * Default constructor; makes an empty FormattedDateInterval. - * @stable ICU 64 - */ - FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} - - /** - * Move constructor: Leaves the source FormattedDateInterval in an undefined state. - * @stable ICU 64 - */ - FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT; - - /** - * Destruct an instance of FormattedDateInterval. - * @stable ICU 64 - */ - virtual ~FormattedDateInterval() U_OVERRIDE; - - /** Copying not supported; use move constructor instead. */ - FormattedDateInterval(const FormattedDateInterval&) = delete; - - /** Copying not supported; use move assignment instead. */ - FormattedDateInterval& operator=(const FormattedDateInterval&) = delete; - - /** - * Move assignment: Leaves the source FormattedDateInterval in an undefined state. - * @stable ICU 64 - */ - FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT; - - /** @copydoc FormattedValue::toString() */ - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::toTempString() */ - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::appendTo() */ - Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::nextPosition() */ - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; - - private: - FormattedDateIntervalData *fData; - UErrorCode fErrorCode; - explicit FormattedDateInterval(FormattedDateIntervalData *results) - : fData(results), fErrorCode(U_ZERO_ERROR) {} - explicit FormattedDateInterval(UErrorCode errorCode) - : fData(nullptr), fErrorCode(errorCode) {} - friend class DateIntervalFormat; -}; - +class FormattedDateIntervalData; +class DateIntervalFormat; /** + * An immutable class containing the result of a date interval formatting operation. + * + * Instances of this class are immutable and thread-safe. + * + * When calling nextPosition(): + * The fields are returned from left to right. The special field category + * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime + * primitives came from which arguments: 0 means fromCalendar, and 1 means + * toCalendar. The span category will always occur before the + * corresponding fields in UFIELD_CATEGORY_DATE + * in the nextPosition() iterator. + * + * Not intended for public subclassing. + * + * @stable ICU 64 + */ +class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue { + public: + /** + * Default constructor; makes an empty FormattedDateInterval. + * @stable ICU 64 + */ + FormattedDateInterval() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} + + /** + * Move constructor: Leaves the source FormattedDateInterval in an undefined state. + * @stable ICU 64 + */ + FormattedDateInterval(FormattedDateInterval&& src) U_NOEXCEPT; + + /** + * Destruct an instance of FormattedDateInterval. + * @stable ICU 64 + */ + virtual ~FormattedDateInterval() U_OVERRIDE; + + /** Copying not supported; use move constructor instead. */ + FormattedDateInterval(const FormattedDateInterval&) = delete; + + /** Copying not supported; use move assignment instead. */ + FormattedDateInterval& operator=(const FormattedDateInterval&) = delete; + + /** + * Move assignment: Leaves the source FormattedDateInterval in an undefined state. + * @stable ICU 64 + */ + FormattedDateInterval& operator=(FormattedDateInterval&& src) U_NOEXCEPT; + + /** @copydoc FormattedValue::toString() */ + UnicodeString toString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::toTempString() */ + UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::appendTo() */ + Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::nextPosition() */ + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + + private: + FormattedDateIntervalData *fData; + UErrorCode fErrorCode; + explicit FormattedDateInterval(FormattedDateIntervalData *results) + : fData(results), fErrorCode(U_ZERO_ERROR) {} + explicit FormattedDateInterval(UErrorCode errorCode) + : fData(nullptr), fErrorCode(errorCode) {} + friend class DateIntervalFormat; +}; + + +/** * DateIntervalFormat is a class for formatting and parsing date * intervals in a language-independent manner. * Only formatting is supported, parsing is not supported. @@ -172,12 +172,12 @@ class U_I18N_API FormattedDateInterval : public UMemory, public FormattedValue { * * <P> * The calendar fields we support for interval formatting are: - * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, second, - * and millisecond. + * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, second, + * and millisecond. * (though we do not currently have specific intervalFormat date for skeletons - * with seconds and millisecond). + * with seconds and millisecond). * Those calendar fields can be defined in the following order: - * year > month > date > hour (in day) > minute > second > millisecond + * year > month > date > hour (in day) > minute > second > millisecond * * The largest different calendar fields between 2 calendars is the * first different calendar field in above order. @@ -433,7 +433,7 @@ public: * @return A copy of the object. * @stable ICU 4.0 */ - virtual DateIntervalFormat* clone() const; + virtual DateIntervalFormat* clone() const; /** * Return true if the given Format objects are semantically equal. Objects @@ -502,19 +502,19 @@ public: FieldPosition& fieldPosition, UErrorCode& status) const ; - /** - * Format a DateInterval to produce a FormattedDateInterval. - * - * The FormattedDateInterval exposes field information about the formatted string. - * - * @param dtInterval DateInterval to be formatted. - * @param status Set if an error occurs. - * @return A FormattedDateInterval containing the format result. - * @stable ICU 64 - */ - FormattedDateInterval formatToValue( - const DateInterval& dtInterval, - UErrorCode& status) const; + /** + * Format a DateInterval to produce a FormattedDateInterval. + * + * The FormattedDateInterval exposes field information about the formatted string. + * + * @param dtInterval DateInterval to be formatted. + * @param status Set if an error occurs. + * @return A FormattedDateInterval containing the format result. + * @stable ICU 64 + */ + FormattedDateInterval formatToValue( + const DateInterval& dtInterval, + UErrorCode& status) const; /** * Format 2 Calendars to produce a string. @@ -546,27 +546,27 @@ public: UErrorCode& status) const ; /** - * Format 2 Calendars to produce a FormattedDateInterval. - * - * The FormattedDateInterval exposes field information about the formatted string. - * - * Note: "fromCalendar" and "toCalendar" are not const, - * since calendar is not const in SimpleDateFormat::format(Calendar&), - * - * @param fromCalendar calendar set to the from date in date interval - * to be formatted into date interval string - * @param toCalendar calendar set to the to date in date interval - * to be formatted into date interval string - * @param status Set if an error occurs. - * @return A FormattedDateInterval containing the format result. - * @stable ICU 64 - */ - FormattedDateInterval formatToValue( - Calendar& fromCalendar, - Calendar& toCalendar, - UErrorCode& status) const; - - /** + * Format 2 Calendars to produce a FormattedDateInterval. + * + * The FormattedDateInterval exposes field information about the formatted string. + * + * Note: "fromCalendar" and "toCalendar" are not const, + * since calendar is not const in SimpleDateFormat::format(Calendar&), + * + * @param fromCalendar calendar set to the from date in date interval + * to be formatted into date interval string + * @param toCalendar calendar set to the to date in date interval + * to be formatted into date interval string + * @param status Set if an error occurs. + * @return A FormattedDateInterval containing the format result. + * @stable ICU 64 + */ + FormattedDateInterval formatToValue( + Calendar& fromCalendar, + Calendar& toCalendar, + UErrorCode& status) const; + + /** * Date interval parsing is not supported. Please do not use. * <P> * This method should handle parsing of @@ -775,14 +775,14 @@ private: * Below are for generating interval patterns local to the formatter */ - /** Like fallbackFormat, but only formats the range part of the fallback. */ - void fallbackFormatRange( - Calendar& fromCalendar, - Calendar& toCalendar, - UnicodeString& appendTo, - int8_t& firstIndex, - FieldPositionHandler& fphandler, - UErrorCode& status) const; + /** Like fallbackFormat, but only formats the range part of the fallback. */ + void fallbackFormatRange( + Calendar& fromCalendar, + Calendar& toCalendar, + UnicodeString& appendTo, + int8_t& firstIndex, + FieldPositionHandler& fphandler, + UErrorCode& status) const; /** * Format 2 Calendars using fall-back interval pattern @@ -800,8 +800,8 @@ private: * (any difference is in ampm/hours or below) * @param appendTo Output parameter to receive result. * Result is appended to existing contents. - * @param firstIndex See formatImpl for more information. - * @param fphandler See formatImpl for more information. + * @param firstIndex See formatImpl for more information. + * @param fphandler See formatImpl for more information. * @param status output param set to success/failure code on exit * @return Reference to 'appendTo' parameter. * @internal (private) @@ -810,8 +810,8 @@ private: Calendar& toCalendar, UBool fromToOnSameDay, UnicodeString& appendTo, - int8_t& firstIndex, - FieldPositionHandler& fphandler, + int8_t& firstIndex, + FieldPositionHandler& fphandler, UErrorCode& status) const; @@ -1075,11 +1075,11 @@ private: * to be formatted into date interval string * @param appendTo Output parameter to receive result. * Result is appended to existing contents. - * @param firstIndex 0 if the first output date is fromCalendar; - * 1 if it corresponds to toCalendar; - * -1 if there is only one date printed. - * @param fphandler Handler for field position information. - * The fields will be from the UDateFormatField enum. + * @param firstIndex 0 if the first output date is fromCalendar; + * 1 if it corresponds to toCalendar; + * -1 if there is only one date printed. + * @param fphandler Handler for field position information. + * The fields will be from the UDateFormatField enum. * @param status Output param filled with success/failure status. * Caller needs to make sure it is SUCCESS * at the function entrance @@ -1089,20 +1089,20 @@ private: UnicodeString& formatImpl(Calendar& fromCalendar, Calendar& toCalendar, UnicodeString& appendTo, - int8_t& firstIndex, - FieldPositionHandler& fphandler, + int8_t& firstIndex, + FieldPositionHandler& fphandler, UErrorCode& status) const ; - /** Version of formatImpl for DateInterval. */ - UnicodeString& formatIntervalImpl(const DateInterval& dtInterval, - UnicodeString& appendTo, - int8_t& firstIndex, - FieldPositionHandler& fphandler, - UErrorCode& status) const; - + /** Version of formatImpl for DateInterval. */ + UnicodeString& formatIntervalImpl(const DateInterval& dtInterval, + UnicodeString& appendTo, + int8_t& firstIndex, + FieldPositionHandler& fphandler, + UErrorCode& status) const; + // from calendar field to pattern letter - static const char16_t fgCalendarFieldToPatternLetter[]; + static const char16_t fgCalendarFieldToPatternLetter[]; /** @@ -1148,7 +1148,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _DTITVFMT_H__ //eof diff --git a/contrib/libs/icu/include/unicode/dtitvinf.h b/contrib/libs/icu/include/unicode/dtitvinf.h index 68bfa4352a..6fc159d420 100644 --- a/contrib/libs/icu/include/unicode/dtitvinf.h +++ b/contrib/libs/icu/include/unicode/dtitvinf.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Date/Time interval patterns for formatting date/time interval @@ -137,8 +137,8 @@ U_NAMESPACE_BEGIN * After a DateIntervalInfo object is created, clients may modify * the interval patterns using setIntervalPattern function as so desired. * Currently, users can only set interval patterns when the following - * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, - * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND. + * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, + * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND. * Interval patterns when other calendar fields are different is not supported. * <P> * DateIntervalInfo objects are cloneable. @@ -197,7 +197,7 @@ public: * @return a copy of the object * @stable ICU 4.0 */ - virtual DateIntervalInfo* clone() const; + virtual DateIntervalInfo* clone() const; /** * Destructor. @@ -245,7 +245,7 @@ public: * Restriction: * Currently, users can only set interval patterns when the following * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, - * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND. + * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND and MILLISECOND. * Interval patterns when other calendar fields are different are * not supported. * @@ -348,7 +348,7 @@ private: /** * Following is for saving the interval patterns. * We only support interval patterns on - * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, MINUTE, SECOND and MILLISECOND. + * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, MINUTE, SECOND and MILLISECOND. */ enum IntervalPatternIndex { @@ -360,7 +360,7 @@ private: kIPI_HOUR, kIPI_MINUTE, kIPI_SECOND, - kIPI_MILLISECOND, + kIPI_MILLISECOND, kIPI_MAX_INDEX }; public: @@ -454,8 +454,8 @@ private: * hash table. * * Since we only support the following calendar fields: - * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK, - * AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND. + * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK, + * AM_PM, HOUR, HOUR_OF_DAY, MINUTE, SECOND, and MILLISECOND. * We reserve only 4 interval patterns for a skeleton. * * @param field calendar field @@ -518,7 +518,7 @@ U_NAMESPACE_END #endif -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/dtptngen.h b/contrib/libs/icu/include/unicode/dtptngen.h index dd99d58e65..d836b2d765 100644 --- a/contrib/libs/icu/include/unicode/dtptngen.h +++ b/contrib/libs/icu/include/unicode/dtptngen.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -14,15 +14,15 @@ #ifndef __DTPTNGEN_H__ #define __DTPTNGEN_H__ -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/datefmt.h" #include "unicode/locid.h" #include "unicode/udat.h" #include "unicode/udatpg.h" -#include "unicode/unistr.h" +#include "unicode/unistr.h" U_NAMESPACE_BEGIN @@ -32,7 +32,7 @@ U_NAMESPACE_BEGIN */ -class CharString; +class CharString; class Hashtable; class FormatParser; class DateTimeMatcher; @@ -211,11 +211,11 @@ public: * @return conflicting status. The value could be UDATPG_NO_CONFLICT, * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT. * @stable ICU 3.8 - * <p> - * <h4>Sample code</h4> - * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 - * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample - * <p> + * <p> + * <h4>Sample code</h4> + * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample + * <p> */ UDateTimePatternConflict addPattern(const UnicodeString& pattern, UBool override, @@ -267,28 +267,28 @@ public: /** * Getter corresponding to setAppendItemNames. Values below 0 or at or above - * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general method - * for getting date/time field display names is getFieldDisplayName. + * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general method + * for getting date/time field display names is getFieldDisplayName. * * @param field such as UDATPG_ERA_FIELD. * @return name for field - * @see getFieldDisplayName + * @see getFieldDisplayName * @stable ICU 3.8 */ const UnicodeString& getAppendItemName(UDateTimePatternField field) const; /** - * The general interface to get a display name for a particular date/time field, - * in one of several possible display widths. - * - * @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD. - * @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED. - * @return The display name for field - * @stable ICU 61 - */ - UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const; - - /** + * The general interface to get a display name for a particular date/time field, + * in one of several possible display widths. + * + * @param field The desired UDateTimePatternField, such as UDATPG_ERA_FIELD. + * @param width The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED. + * @return The display name for field + * @stable ICU 61 + */ + UnicodeString getFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width) const; + + /** * The DateTimeFormat is a message format pattern used to compose date and * time patterns. The default pattern in the root locale is "{1} {0}", where * {1} will be replaced by the date pattern and {0} will be replaced by the @@ -330,11 +330,11 @@ public: * @return bestPattern * The best pattern found from the given skeleton. * @stable ICU 3.8 - * <p> - * <h4>Sample code</h4> - * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 - * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample - * <p> + * <p> + * <h4>Sample code</h4> + * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample + * <p> */ UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status); @@ -378,11 +378,11 @@ public: * which must not indicate a failure before the function call. * @return pattern adjusted to match the skeleton fields widths and subtypes. * @stable ICU 3.8 - * <p> - * <h4>Sample code</h4> - * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 - * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample - * <p> + * <p> + * <h4>Sample code</h4> + * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample + * <p> */ UnicodeString replaceFieldTypes(const UnicodeString& pattern, const UnicodeString& skeleton, @@ -483,27 +483,27 @@ public: */ const UnicodeString& getDecimal() const; -#if !UCONFIG_NO_FORMATTING - -#ifndef U_HIDE_DRAFT_API - /** - * Get the default hour cycle for a locale. Uses the locale that the - * DateTimePatternGenerator was initially created with. - * - * Cannot be used on an empty DateTimePatternGenerator instance. - * - * @param status Output param set to success/failure code on exit, which - * which must not indicate a failure before the function call. - * Set to U_UNSUPPORTED_ERROR if used on an empty instance. - * @return the default hour cycle. - * @draft ICU 67 - */ - UDateFormatHourCycle getDefaultHourCycle(UErrorCode& status) const; -#endif /* U_HIDE_DRAFT_API */ - -#endif /* #if !UCONFIG_NO_FORMATTING */ - - /** +#if !UCONFIG_NO_FORMATTING + +#ifndef U_HIDE_DRAFT_API + /** + * Get the default hour cycle for a locale. Uses the locale that the + * DateTimePatternGenerator was initially created with. + * + * Cannot be used on an empty DateTimePatternGenerator instance. + * + * @param status Output param set to success/failure code on exit, which + * which must not indicate a failure before the function call. + * Set to U_UNSUPPORTED_ERROR if used on an empty instance. + * @return the default hour cycle. + * @draft ICU 67 + */ + UDateFormatHourCycle getDefaultHourCycle(UErrorCode& status) const; +#endif /* U_HIDE_DRAFT_API */ + +#endif /* #if !UCONFIG_NO_FORMATTING */ + + /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 3.8 @@ -540,37 +540,37 @@ private: */ DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other); - // TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode. - // static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; - + // TODO(ticket:13619): re-enable when UDATPG_NARROW no longer in draft mode. + // static const int32_t UDATPG_WIDTH_COUNT = UDATPG_NARROW + 1; + Locale pLocale; // pattern locale FormatParser *fp; DateTimeMatcher* dtMatcher; DistanceInfo *distanceInfo; PatternMap *patternMap; UnicodeString appendItemFormats[UDATPG_FIELD_COUNT]; - // TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT - UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3]; + // TODO(ticket:13619): [3] -> UDATPG_WIDTH_COUNT + UnicodeString fieldDisplayNames[UDATPG_FIELD_COUNT][3]; UnicodeString dateTimeFormat; UnicodeString decimal; DateTimeMatcher *skipMatcher; Hashtable *fAvailableFormatKeyHash; UnicodeString emptyString; - char16_t fDefaultHourFormatChar; + char16_t fDefaultHourFormatChar; int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN. - // Internal error code used for recording/reporting errors that occur during methods that do not - // have a UErrorCode parameter. For example: the Copy Constructor, or the ::clone() method. - // When this is set to an error the object is in an invalid state. - UErrorCode internalErrorCode; - + // Internal error code used for recording/reporting errors that occur during methods that do not + // have a UErrorCode parameter. For example: the Copy Constructor, or the ::clone() method. + // When this is set to an error the object is in an invalid state. + UErrorCode internalErrorCode; + /* internal flags masks for adjustFieldTypes etc. */ enum { kDTPGNoFlags = 0, kDTPGFixFractionalSeconds = 1, - kDTPGSkeletonUsesCapJ = 2 - // with #13183, no longer need flags for b, B + kDTPGSkeletonUsesCapJ = 2 + // with #13183, no longer need flags for b, B }; void initData(const Locale &locale, UErrorCode &status); @@ -585,16 +585,16 @@ private: void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status); void setDecimalSymbols(const Locale& locale, UErrorCode& status); UDateTimePatternField getAppendFormatNumber(const char* field) const; - // Note for the next 3: UDateTimePGDisplayWidth is now stable ICU 61 - UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const; - void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value); - UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width); + // Note for the next 3: UDateTimePGDisplayWidth is now stable ICU 61 + UDateTimePatternField getFieldAndWidthIndices(const char* key, UDateTimePGDisplayWidth* widthP) const; + void setFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width, const UnicodeString& value); + UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width); void getAppendName(UDateTimePatternField field, UnicodeString& value); - UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status); - const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0); + UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status); + const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0); UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); - UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); - int32_t getTopBitNumber(int32_t foundMask) const; + UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); + int32_t getTopBitNumber(int32_t foundMask) const; void setAvailableFormat(const UnicodeString &key, UErrorCode& status); UBool isAvailableFormatSet(const UnicodeString &key) const; void copyHashtable(Hashtable *other, UErrorCode &status); @@ -609,6 +609,6 @@ private: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/dtrule.h b/contrib/libs/icu/include/unicode/dtrule.h index adab8967f6..4fae05f09e 100644 --- a/contrib/libs/icu/include/unicode/dtrule.h +++ b/contrib/libs/icu/include/unicode/dtrule.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -11,8 +11,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Rule for specifying date and time in an year @@ -128,7 +128,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - DateTimeRule* clone() const; + DateTimeRule* clone() const; /** * Assignment operator. @@ -250,7 +250,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // DTRULE_H //eof diff --git a/contrib/libs/icu/include/unicode/edits.h b/contrib/libs/icu/include/unicode/edits.h index c3ceaccb3b..28f8f9753d 100644 --- a/contrib/libs/icu/include/unicode/edits.h +++ b/contrib/libs/icu/include/unicode/edits.h @@ -1,531 +1,531 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// edits.h -// created: 2016dec30 Markus W. Scherer - -#ifndef __EDITS_H__ -#define __EDITS_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/uobject.h" - -/** - * \file - * \brief C++ API: C++ class Edits for low-level string transformations on styled text. - */ - -U_NAMESPACE_BEGIN - -class UnicodeString; - -/** - * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions - * in linear progression. Does not support moving/reordering of text. - * - * There are two types of edits: <em>change edits</em> and <em>no-change edits</em>. Add edits to - * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and - * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity, - * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one - * mapping between code points in the source and destination strings. - * - * After all edits have been added, instances of this class should be considered immutable, and an - * {@link Edits::Iterator} can be used for queries. - * - * There are four flavors of Edits::Iterator: - * - * <ul> - * <li>{@link #getFineIterator()} retains full granularity of change edits. - * <li>{@link #getFineChangesIterator()} retains full granularity of change edits, and when calling - * next() on the iterator, skips over no-change edits (unchanged regions). - * <li>{@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change - * edits are automatically merged during the construction phase.) - * <li>{@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when - * calling next() on the iterator, skips over no-change edits (unchanged regions). - * </ul> - * - * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the - * following fine edits: - * <ul> - * <li>abc ⇨ abc (no-change) - * <li>ß ⇨ ss (change) - * <li>D ⇨ d (change) - * <li>e ⇨ e (no-change) - * <li>F ⇨ f (change) - * </ul> - * and the following coarse edits (note how adjacent change edits get merged together): - * <ul> - * <li>abc ⇨ abc (no-change) - * <li>ßD ⇨ ssd (change) - * <li>e ⇨ e (no-change) - * <li>F ⇨ f (change) - * </ul> - * - * The "fine changes" and "coarse changes" iterators will step through only the change edits when their - * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when - * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()` - * methods are used to walk through the string. - * - * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in - * UCharacterCaseTest.java. - * - * An Edits object tracks a separate UErrorCode, but ICU string transformation functions - * (e.g., case mapping functions) merge any such errors into their API's UErrorCode. - * - * @stable ICU 59 - */ -class U_COMMON_API Edits U_FINAL : public UMemory { -public: - /** - * Constructs an empty object. - * @stable ICU 59 - */ - Edits() : - array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0), - errorCode_(U_ZERO_ERROR) {} - /** - * Copy constructor. - * @param other source edits - * @stable ICU 60 - */ - Edits(const Edits &other) : - array(stackArray), capacity(STACK_CAPACITY), length(other.length), - delta(other.delta), numChanges(other.numChanges), - errorCode_(other.errorCode_) { - copyArray(other); - } - /** - * Move constructor, might leave src empty. - * This object will have the same contents that the source object had. - * @param src source edits - * @stable ICU 60 - */ - Edits(Edits &&src) U_NOEXCEPT : - array(stackArray), capacity(STACK_CAPACITY), length(src.length), - delta(src.delta), numChanges(src.numChanges), - errorCode_(src.errorCode_) { - moveArray(src); - } - - /** - * Destructor. - * @stable ICU 59 - */ - ~Edits(); - - /** - * Assignment operator. - * @param other source edits - * @return *this - * @stable ICU 60 - */ - Edits &operator=(const Edits &other); - - /** - * Move assignment operator, might leave src empty. - * This object will have the same contents that the source object had. - * The behavior is undefined if *this and src are the same object. - * @param src source edits - * @return *this - * @stable ICU 60 - */ - Edits &operator=(Edits &&src) U_NOEXCEPT; - - /** - * Resets the data but may not release memory. - * @stable ICU 59 - */ - void reset() U_NOEXCEPT; - - /** - * Adds a no-change edit: a record for an unchanged segment of text. - * Normally called from inside ICU string transformation functions, not user code. - * @stable ICU 59 - */ - void addUnchanged(int32_t unchangedLength); - /** - * Adds a change edit: a record for a text replacement/insertion/deletion. - * Normally called from inside ICU string transformation functions, not user code. - * @stable ICU 59 - */ - void addReplace(int32_t oldLength, int32_t newLength); - /** - * Sets the UErrorCode if an error occurred while recording edits. - * Preserves older error codes in the outErrorCode. - * Normally called from inside ICU string transformation functions, not user code. - * @param outErrorCode Set to an error code if it does not contain one already - * and an error occurred while recording edits. - * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) - * @stable ICU 59 - */ - UBool copyErrorTo(UErrorCode &outErrorCode) const; - - /** - * How much longer is the new text compared with the old text? - * @return new length minus old length - * @stable ICU 59 - */ - int32_t lengthDelta() const { return delta; } - /** - * @return TRUE if there are any change edits - * @stable ICU 59 - */ - UBool hasChanges() const { return numChanges != 0; } - - /** - * @return the number of change edits - * @stable ICU 60 - */ - int32_t numberOfChanges() const { return numChanges; } - - /** - * Access to the list of edits. - * - * At any moment in time, an instance of this class points to a single edit: a "window" into a span - * of the source string and the corresponding span of the destination string. The source string span - * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string - * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars. - * - * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`, - * and `findDestinationIndex(int32_t, UErrorCode &)` methods. - * Calling any of these methods mutates the iterator to make it point to the corresponding edit. - * - * For more information, see the documentation for {@link Edits}. - * - * @see getCoarseIterator - * @see getFineIterator - * @stable ICU 59 - */ - struct U_COMMON_API Iterator U_FINAL : public UMemory { - /** - * Default constructor, empty iterator. - * @stable ICU 60 - */ - Iterator() : - array(nullptr), index(0), length(0), - remaining(0), onlyChanges_(FALSE), coarse(FALSE), - dir(0), changed(FALSE), oldLength_(0), newLength_(0), - srcIndex(0), replIndex(0), destIndex(0) {} - /** - * Copy constructor. - * @stable ICU 59 - */ - Iterator(const Iterator &other) = default; - /** - * Assignment operator. - * @stable ICU 59 - */ - Iterator &operator=(const Iterator &other) = default; - - /** - * Advances the iterator to the next edit. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if there is another edit - * @stable ICU 59 - */ - UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } - - /** - * Moves the iterator to the edit that contains the source index. - * The source index may be found in a no-change edit - * even if normal iteration would skip no-change edits. - * Normal iteration can continue from a found edit. - * - * The iterator state before this search logically does not matter. - * (It may affect the performance of the search.) - * - * The iterator state after this search is undefined - * if the source index is out of bounds for the source string. - * - * @param i source index - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the source index was found - * @stable ICU 59 - */ - UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, TRUE, errorCode) == 0; - } - - /** - * Moves the iterator to the edit that contains the destination index. - * The destination index may be found in a no-change edit - * even if normal iteration would skip no-change edits. - * Normal iteration can continue from a found edit. - * - * The iterator state before this search logically does not matter. - * (It may affect the performance of the search.) - * - * The iterator state after this search is undefined - * if the source index is out of bounds for the source string. - * - * @param i destination index - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return TRUE if the edit for the destination index was found - * @stable ICU 60 - */ - UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { - return findIndex(i, FALSE, errorCode) == 0; - } - - /** - * Computes the destination index corresponding to the given source index. - * If the source index is inside a change edit (not at its start), - * then the destination index at the end of that edit is returned, - * since there is no information about index mapping inside a change edit. - * - * (This means that indexes to the start and middle of an edit, - * for example around a grapheme cluster, are mapped to indexes - * encompassing the entire edit. - * The alternative, mapping an interior index to the start, - * would map such an interval to an empty one.) - * - * This operation will usually but not always modify this object. - * The iterator state after this search is undefined. - * - * @param i source index - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return destination index; undefined if i is not 0..string length - * @stable ICU 60 - */ - int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode); - - /** - * Computes the source index corresponding to the given destination index. - * If the destination index is inside a change edit (not at its start), - * then the source index at the end of that edit is returned, - * since there is no information about index mapping inside a change edit. - * - * (This means that indexes to the start and middle of an edit, - * for example around a grapheme cluster, are mapped to indexes - * encompassing the entire edit. - * The alternative, mapping an interior index to the start, - * would map such an interval to an empty one.) - * - * This operation will usually but not always modify this object. - * The iterator state after this search is undefined. - * - * @param i destination index - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return source index; undefined if i is not 0..string length - * @stable ICU 60 - */ - int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode); - - /** - * Returns whether the edit currently represented by the iterator is a change edit. - * - * @return TRUE if this edit replaces oldLength() units with newLength() different ones. - * FALSE if oldLength units remain unchanged. - * @stable ICU 59 - */ - UBool hasChange() const { return changed; } - - /** - * The length of the current span in the source string, which starts at {@link #sourceIndex}. - * - * @return the number of units in the original string which are replaced or remain unchanged. - * @stable ICU 59 - */ - int32_t oldLength() const { return oldLength_; } - - /** - * The length of the current span in the destination string, which starts at - * {@link #destinationIndex}, or in the replacement string, which starts at - * {@link #replacementIndex}. - * - * @return the number of units in the modified string, if hasChange() is TRUE. - * Same as oldLength if hasChange() is FALSE. - * @stable ICU 59 - */ - int32_t newLength() const { return newLength_; } - - /** - * The start index of the current span in the source string; the span has length - * {@link #oldLength}. - * - * @return the current index into the source string - * @stable ICU 59 - */ - int32_t sourceIndex() const { return srcIndex; } - - /** - * The start index of the current span in the replacement string; the span has length - * {@link #newLength}. Well-defined only if the current edit is a change edit. - * - * The *replacement string* is the concatenation of all substrings of the destination - * string corresponding to change edits. - * - * This method is intended to be used together with operations that write only replacement - * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option). - * The source string can then be modified in-place. - * - * @return the current index into the replacement-characters-only string, - * not counting unchanged spans - * @stable ICU 59 - */ - int32_t replacementIndex() const { - // TODO: Throw an exception if we aren't in a change edit? - return replIndex; - } - - /** - * The start index of the current span in the destination string; the span has length - * {@link #newLength}. - * - * @return the current index into the full destination string - * @stable ICU 59 - */ - int32_t destinationIndex() const { return destIndex; } - -#ifndef U_HIDE_INTERNAL_API - /** - * A string representation of the current edit represented by the iterator for debugging. You - * should not depend on the contents of the return string. - * @internal - */ - UnicodeString& toString(UnicodeString& appendTo) const; -#endif // U_HIDE_INTERNAL_API - - private: - friend class Edits; - - Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs); - - int32_t readLength(int32_t head); - void updateNextIndexes(); - void updatePreviousIndexes(); - UBool noNext(); - UBool next(UBool onlyChanges, UErrorCode &errorCode); - UBool previous(UErrorCode &errorCode); - /** @return -1: error or i<0; 0: found; 1: i>=string length */ - int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode); - - const uint16_t *array; - int32_t index, length; - // 0 if we are not within compressed equal-length changes. - // Otherwise the number of remaining changes, including the current one. - int32_t remaining; - UBool onlyChanges_, coarse; - - int8_t dir; // iteration direction: back(<0), initial(0), forward(>0) - UBool changed; - int32_t oldLength_, newLength_; - int32_t srcIndex, replIndex, destIndex; - }; - - /** - * Returns an Iterator for coarse-grained change edits - * (adjacent change edits are treated as one). - * Can be used to perform simple string updates. - * Skips no-change edits. - * @return an Iterator that merges adjacent changes. - * @stable ICU 59 - */ - Iterator getCoarseChangesIterator() const { - return Iterator(array, length, TRUE, TRUE); - } - - /** - * Returns an Iterator for coarse-grained change and no-change edits - * (adjacent change edits are treated as one). - * Can be used to perform simple string updates. - * Adjacent change edits are treated as one edit. - * @return an Iterator that merges adjacent changes. - * @stable ICU 59 - */ - Iterator getCoarseIterator() const { - return Iterator(array, length, FALSE, TRUE); - } - - /** - * Returns an Iterator for fine-grained change edits - * (full granularity of change edits is retained). - * Can be used for modifying styled text. - * Skips no-change edits. - * @return an Iterator that separates adjacent changes. - * @stable ICU 59 - */ - Iterator getFineChangesIterator() const { - return Iterator(array, length, TRUE, FALSE); - } - - /** - * Returns an Iterator for fine-grained change and no-change edits - * (full granularity of change edits is retained). - * Can be used for modifying styled text. - * @return an Iterator that separates adjacent changes. - * @stable ICU 59 - */ - Iterator getFineIterator() const { - return Iterator(array, length, FALSE, FALSE); - } - - /** - * Merges the two input Edits and appends the result to this object. - * - * Consider two string transformations (for example, normalization and case mapping) - * where each records Edits in addition to writing an output string.<br> - * Edits ab reflect how substrings of input string a - * map to substrings of intermediate string b.<br> - * Edits bc reflect how substrings of intermediate string b - * map to substrings of output string c.<br> - * This function merges ab and bc such that the additional edits - * recorded in this object reflect how substrings of input string a - * map to substrings of output string c. - * - * If unrelated Edits are passed in where the output string of the first - * has a different length than the input string of the second, - * then a U_ILLEGAL_ARGUMENT_ERROR is reported. - * - * @param ab reflects how substrings of input string a - * map to substrings of intermediate string b. - * @param bc reflects how substrings of intermediate string b - * map to substrings of output string c. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return *this, with the merged edits appended - * @stable ICU 60 - */ - Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); - -private: - void releaseArray() U_NOEXCEPT; - Edits ©Array(const Edits &other); - Edits &moveArray(Edits &src) U_NOEXCEPT; - - void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } - int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } - - void append(int32_t r); - UBool growArray(); - - static const int32_t STACK_CAPACITY = 100; - uint16_t *array; - int32_t capacity; - int32_t length; - int32_t delta; - int32_t numChanges; - UErrorCode errorCode_; - uint16_t stackArray[STACK_CAPACITY]; -}; - -U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __EDITS_H__ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// edits.h +// created: 2016dec30 Markus W. Scherer + +#ifndef __EDITS_H__ +#define __EDITS_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: C++ class Edits for low-level string transformations on styled text. + */ + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Records lengths of string edits but not replacement text. Supports replacements, insertions, deletions + * in linear progression. Does not support moving/reordering of text. + * + * There are two types of edits: <em>change edits</em> and <em>no-change edits</em>. Add edits to + * instances of this class using {@link #addReplace(int32_t, int32_t)} (for change edits) and + * {@link #addUnchanged(int32_t)} (for no-change edits). Change edits are retained with full granularity, + * whereas adjacent no-change edits are always merged together. In no-change edits, there is a one-to-one + * mapping between code points in the source and destination strings. + * + * After all edits have been added, instances of this class should be considered immutable, and an + * {@link Edits::Iterator} can be used for queries. + * + * There are four flavors of Edits::Iterator: + * + * <ul> + * <li>{@link #getFineIterator()} retains full granularity of change edits. + * <li>{@link #getFineChangesIterator()} retains full granularity of change edits, and when calling + * next() on the iterator, skips over no-change edits (unchanged regions). + * <li>{@link #getCoarseIterator()} treats adjacent change edits as a single edit. (Adjacent no-change + * edits are automatically merged during the construction phase.) + * <li>{@link #getCoarseChangesIterator()} treats adjacent change edits as a single edit, and when + * calling next() on the iterator, skips over no-change edits (unchanged regions). + * </ul> + * + * For example, consider the string "abcßDeF", which case-folds to "abcssdef". This string has the + * following fine edits: + * <ul> + * <li>abc ⇨ abc (no-change) + * <li>ß ⇨ ss (change) + * <li>D ⇨ d (change) + * <li>e ⇨ e (no-change) + * <li>F ⇨ f (change) + * </ul> + * and the following coarse edits (note how adjacent change edits get merged together): + * <ul> + * <li>abc ⇨ abc (no-change) + * <li>ßD ⇨ ssd (change) + * <li>e ⇨ e (no-change) + * <li>F ⇨ f (change) + * </ul> + * + * The "fine changes" and "coarse changes" iterators will step through only the change edits when their + * `Edits::Iterator::next()` methods are called. They are identical to the non-change iterators when + * their `Edits::Iterator::findSourceIndex()` or `Edits::Iterator::findDestinationIndex()` + * methods are used to walk through the string. + * + * For examples of how to use this class, see the test `TestCaseMapEditsIteratorDocs` in + * UCharacterCaseTest.java. + * + * An Edits object tracks a separate UErrorCode, but ICU string transformation functions + * (e.g., case mapping functions) merge any such errors into their API's UErrorCode. + * + * @stable ICU 59 + */ +class U_COMMON_API Edits U_FINAL : public UMemory { +public: + /** + * Constructs an empty object. + * @stable ICU 59 + */ + Edits() : + array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0), + errorCode_(U_ZERO_ERROR) {} + /** + * Copy constructor. + * @param other source edits + * @stable ICU 60 + */ + Edits(const Edits &other) : + array(stackArray), capacity(STACK_CAPACITY), length(other.length), + delta(other.delta), numChanges(other.numChanges), + errorCode_(other.errorCode_) { + copyArray(other); + } + /** + * Move constructor, might leave src empty. + * This object will have the same contents that the source object had. + * @param src source edits + * @stable ICU 60 + */ + Edits(Edits &&src) U_NOEXCEPT : + array(stackArray), capacity(STACK_CAPACITY), length(src.length), + delta(src.delta), numChanges(src.numChanges), + errorCode_(src.errorCode_) { + moveArray(src); + } + + /** + * Destructor. + * @stable ICU 59 + */ + ~Edits(); + + /** + * Assignment operator. + * @param other source edits + * @return *this + * @stable ICU 60 + */ + Edits &operator=(const Edits &other); + + /** + * Move assignment operator, might leave src empty. + * This object will have the same contents that the source object had. + * The behavior is undefined if *this and src are the same object. + * @param src source edits + * @return *this + * @stable ICU 60 + */ + Edits &operator=(Edits &&src) U_NOEXCEPT; + + /** + * Resets the data but may not release memory. + * @stable ICU 59 + */ + void reset() U_NOEXCEPT; + + /** + * Adds a no-change edit: a record for an unchanged segment of text. + * Normally called from inside ICU string transformation functions, not user code. + * @stable ICU 59 + */ + void addUnchanged(int32_t unchangedLength); + /** + * Adds a change edit: a record for a text replacement/insertion/deletion. + * Normally called from inside ICU string transformation functions, not user code. + * @stable ICU 59 + */ + void addReplace(int32_t oldLength, int32_t newLength); + /** + * Sets the UErrorCode if an error occurred while recording edits. + * Preserves older error codes in the outErrorCode. + * Normally called from inside ICU string transformation functions, not user code. + * @param outErrorCode Set to an error code if it does not contain one already + * and an error occurred while recording edits. + * Otherwise unchanged. + * @return TRUE if U_FAILURE(outErrorCode) + * @stable ICU 59 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; + + /** + * How much longer is the new text compared with the old text? + * @return new length minus old length + * @stable ICU 59 + */ + int32_t lengthDelta() const { return delta; } + /** + * @return TRUE if there are any change edits + * @stable ICU 59 + */ + UBool hasChanges() const { return numChanges != 0; } + + /** + * @return the number of change edits + * @stable ICU 60 + */ + int32_t numberOfChanges() const { return numChanges; } + + /** + * Access to the list of edits. + * + * At any moment in time, an instance of this class points to a single edit: a "window" into a span + * of the source string and the corresponding span of the destination string. The source string span + * starts at {@link #sourceIndex()} and runs for {@link #oldLength()} chars; the destination string + * span starts at {@link #destinationIndex()} and runs for {@link #newLength()} chars. + * + * The iterator can be moved between edits using the `next()`, `findSourceIndex(int32_t, UErrorCode &)`, + * and `findDestinationIndex(int32_t, UErrorCode &)` methods. + * Calling any of these methods mutates the iterator to make it point to the corresponding edit. + * + * For more information, see the documentation for {@link Edits}. + * + * @see getCoarseIterator + * @see getFineIterator + * @stable ICU 59 + */ + struct U_COMMON_API Iterator U_FINAL : public UMemory { + /** + * Default constructor, empty iterator. + * @stable ICU 60 + */ + Iterator() : + array(nullptr), index(0), length(0), + remaining(0), onlyChanges_(FALSE), coarse(FALSE), + dir(0), changed(FALSE), oldLength_(0), newLength_(0), + srcIndex(0), replIndex(0), destIndex(0) {} + /** + * Copy constructor. + * @stable ICU 59 + */ + Iterator(const Iterator &other) = default; + /** + * Assignment operator. + * @stable ICU 59 + */ + Iterator &operator=(const Iterator &other) = default; + + /** + * Advances the iterator to the next edit. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if there is another edit + * @stable ICU 59 + */ + UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } + + /** + * Moves the iterator to the edit that contains the source index. + * The source index may be found in a no-change edit + * even if normal iteration would skip no-change edits. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if the edit for the source index was found + * @stable ICU 59 + */ + UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, TRUE, errorCode) == 0; + } + + /** + * Moves the iterator to the edit that contains the destination index. + * The destination index may be found in a no-change edit + * even if normal iteration would skip no-change edits. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if the edit for the destination index was found + * @stable ICU 60 + */ + UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, FALSE, errorCode) == 0; + } + + /** + * Computes the destination index corresponding to the given source index. + * If the source index is inside a change edit (not at its start), + * then the destination index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return destination index; undefined if i is not 0..string length + * @stable ICU 60 + */ + int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode); + + /** + * Computes the source index corresponding to the given destination index. + * If the destination index is inside a change edit (not at its start), + * then the source index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return source index; undefined if i is not 0..string length + * @stable ICU 60 + */ + int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode); + + /** + * Returns whether the edit currently represented by the iterator is a change edit. + * + * @return TRUE if this edit replaces oldLength() units with newLength() different ones. + * FALSE if oldLength units remain unchanged. + * @stable ICU 59 + */ + UBool hasChange() const { return changed; } + + /** + * The length of the current span in the source string, which starts at {@link #sourceIndex}. + * + * @return the number of units in the original string which are replaced or remain unchanged. + * @stable ICU 59 + */ + int32_t oldLength() const { return oldLength_; } + + /** + * The length of the current span in the destination string, which starts at + * {@link #destinationIndex}, or in the replacement string, which starts at + * {@link #replacementIndex}. + * + * @return the number of units in the modified string, if hasChange() is TRUE. + * Same as oldLength if hasChange() is FALSE. + * @stable ICU 59 + */ + int32_t newLength() const { return newLength_; } + + /** + * The start index of the current span in the source string; the span has length + * {@link #oldLength}. + * + * @return the current index into the source string + * @stable ICU 59 + */ + int32_t sourceIndex() const { return srcIndex; } + + /** + * The start index of the current span in the replacement string; the span has length + * {@link #newLength}. Well-defined only if the current edit is a change edit. + * + * The *replacement string* is the concatenation of all substrings of the destination + * string corresponding to change edits. + * + * This method is intended to be used together with operations that write only replacement + * characters (e.g. operations specifying the \ref U_OMIT_UNCHANGED_TEXT option). + * The source string can then be modified in-place. + * + * @return the current index into the replacement-characters-only string, + * not counting unchanged spans + * @stable ICU 59 + */ + int32_t replacementIndex() const { + // TODO: Throw an exception if we aren't in a change edit? + return replIndex; + } + + /** + * The start index of the current span in the destination string; the span has length + * {@link #newLength}. + * + * @return the current index into the full destination string + * @stable ICU 59 + */ + int32_t destinationIndex() const { return destIndex; } + +#ifndef U_HIDE_INTERNAL_API + /** + * A string representation of the current edit represented by the iterator for debugging. You + * should not depend on the contents of the return string. + * @internal + */ + UnicodeString& toString(UnicodeString& appendTo) const; +#endif // U_HIDE_INTERNAL_API + + private: + friend class Edits; + + Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs); + + int32_t readLength(int32_t head); + void updateNextIndexes(); + void updatePreviousIndexes(); + UBool noNext(); + UBool next(UBool onlyChanges, UErrorCode &errorCode); + UBool previous(UErrorCode &errorCode); + /** @return -1: error or i<0; 0: found; 1: i>=string length */ + int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode); + + const uint16_t *array; + int32_t index, length; + // 0 if we are not within compressed equal-length changes. + // Otherwise the number of remaining changes, including the current one. + int32_t remaining; + UBool onlyChanges_, coarse; + + int8_t dir; // iteration direction: back(<0), initial(0), forward(>0) + UBool changed; + int32_t oldLength_, newLength_; + int32_t srcIndex, replIndex, destIndex; + }; + + /** + * Returns an Iterator for coarse-grained change edits + * (adjacent change edits are treated as one). + * Can be used to perform simple string updates. + * Skips no-change edits. + * @return an Iterator that merges adjacent changes. + * @stable ICU 59 + */ + Iterator getCoarseChangesIterator() const { + return Iterator(array, length, TRUE, TRUE); + } + + /** + * Returns an Iterator for coarse-grained change and no-change edits + * (adjacent change edits are treated as one). + * Can be used to perform simple string updates. + * Adjacent change edits are treated as one edit. + * @return an Iterator that merges adjacent changes. + * @stable ICU 59 + */ + Iterator getCoarseIterator() const { + return Iterator(array, length, FALSE, TRUE); + } + + /** + * Returns an Iterator for fine-grained change edits + * (full granularity of change edits is retained). + * Can be used for modifying styled text. + * Skips no-change edits. + * @return an Iterator that separates adjacent changes. + * @stable ICU 59 + */ + Iterator getFineChangesIterator() const { + return Iterator(array, length, TRUE, FALSE); + } + + /** + * Returns an Iterator for fine-grained change and no-change edits + * (full granularity of change edits is retained). + * Can be used for modifying styled text. + * @return an Iterator that separates adjacent changes. + * @stable ICU 59 + */ + Iterator getFineIterator() const { + return Iterator(array, length, FALSE, FALSE); + } + + /** + * Merges the two input Edits and appends the result to this object. + * + * Consider two string transformations (for example, normalization and case mapping) + * where each records Edits in addition to writing an output string.<br> + * Edits ab reflect how substrings of input string a + * map to substrings of intermediate string b.<br> + * Edits bc reflect how substrings of intermediate string b + * map to substrings of output string c.<br> + * This function merges ab and bc such that the additional edits + * recorded in this object reflect how substrings of input string a + * map to substrings of output string c. + * + * If unrelated Edits are passed in where the output string of the first + * has a different length than the input string of the second, + * then a U_ILLEGAL_ARGUMENT_ERROR is reported. + * + * @param ab reflects how substrings of input string a + * map to substrings of intermediate string b. + * @param bc reflects how substrings of intermediate string b + * map to substrings of output string c. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return *this, with the merged edits appended + * @stable ICU 60 + */ + Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); + +private: + void releaseArray() U_NOEXCEPT; + Edits ©Array(const Edits &other); + Edits &moveArray(Edits &src) U_NOEXCEPT; + + void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } + int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } + + void append(int32_t r); + UBool growArray(); + + static const int32_t STACK_CAPACITY = 100; + uint16_t *array; + int32_t capacity; + int32_t length; + int32_t delta; + int32_t numChanges; + UErrorCode errorCode_; + uint16_t stackArray[STACK_CAPACITY]; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __EDITS_H__ diff --git a/contrib/libs/icu/include/unicode/enumset.h b/contrib/libs/icu/include/unicode/enumset.h index bde8c455c0..6bee8114d4 100644 --- a/contrib/libs/icu/include/unicode/enumset.h +++ b/contrib/libs/icu/include/unicode/enumset.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -28,7 +28,7 @@ U_NAMESPACE_BEGIN * enum bitset for boolean fields. Similar to Java EnumSet<>. * Needs to range check. Used for private instance variables. * @internal - * \cond + * \cond */ template<typename T, uint32_t minValue, uint32_t limitValue> class EnumSet { @@ -61,8 +61,8 @@ private: uint32_t fBools; }; -/** \endcond */ - +/** \endcond */ + U_NAMESPACE_END #endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/contrib/libs/icu/include/unicode/errorcode.h b/contrib/libs/icu/include/unicode/errorcode.h index fe7b518323..1d3c09f38d 100644 --- a/contrib/libs/icu/include/unicode/errorcode.h +++ b/contrib/libs/icu/include/unicode/errorcode.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: errorcode.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -26,9 +26,9 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" U_NAMESPACE_BEGIN @@ -139,6 +139,6 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __ERRORCODE_H__ diff --git a/contrib/libs/icu/include/unicode/fieldpos.h b/contrib/libs/icu/include/unicode/fieldpos.h index 23ee38624b..e689b30557 100644 --- a/contrib/libs/icu/include/unicode/fieldpos.h +++ b/contrib/libs/icu/include/unicode/fieldpos.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -26,8 +26,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: FieldPosition identifies the fields in a formatted output. @@ -292,7 +292,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _FIELDPOS //eof diff --git a/contrib/libs/icu/include/unicode/filteredbrk.h b/contrib/libs/icu/include/unicode/filteredbrk.h index 4293676325..a0fe605ee3 100644 --- a/contrib/libs/icu/include/unicode/filteredbrk.h +++ b/contrib/libs/icu/include/unicode/filteredbrk.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -11,9 +11,9 @@ #define FILTEREDBRK_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/brkiter.h" #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION @@ -58,26 +58,26 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { */ static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); -#ifndef U_HIDE_DEPRECATED_API - /** - * This function has been deprecated in favor of createEmptyInstance, which has - * identical behavior. - * @param status The error code. - * @return the new builder - * @deprecated ICU 60 use createEmptyInstance instead - * @see createEmptyInstance() - */ - static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); -#endif /* U_HIDE_DEPRECATED_API */ - +#ifndef U_HIDE_DEPRECATED_API /** + * This function has been deprecated in favor of createEmptyInstance, which has + * identical behavior. + * @param status The error code. + * @return the new builder + * @deprecated ICU 60 use createEmptyInstance instead + * @see createEmptyInstance() + */ + static FilteredBreakIteratorBuilder *createInstance(UErrorCode &status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** * Construct an empty FilteredBreakIteratorBuilder. * In this state, it will not suppress any segment boundaries. * @param status The error code. * @return the new builder - * @stable ICU 60 + * @stable ICU 60 */ - static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); + static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); /** * Suppress a certain string from being the end of a segment. @@ -96,7 +96,7 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { * This function does not create any new segment boundaries, but only serves to un-do * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of * locale data which may be suppressing certain strings. - * @param string the exception to remove + * @param string the exception to remove * @param status error code * @return returns TRUE if the string was present and now removed, * FALSE if the call was a no-op because the string was not being suppressed. @@ -104,35 +104,35 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { */ virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; -#ifndef U_FORCE_HIDE_DEPRECATED_API - /** - * This function has been deprecated in favor of wrapIteratorWithFilter() - * The behavior is identical. - * @param adoptBreakIterator the break iterator to adopt - * @param status error code - * @return the new BreakIterator, owned by the caller. - * @deprecated ICU 60 use wrapIteratorWithFilter() instead - * @see wrapBreakIteratorWithFilter() - */ - virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; -#endif // U_FORCE_HIDE_DEPRECATED_API - +#ifndef U_FORCE_HIDE_DEPRECATED_API /** + * This function has been deprecated in favor of wrapIteratorWithFilter() + * The behavior is identical. + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @deprecated ICU 60 use wrapIteratorWithFilter() instead + * @see wrapBreakIteratorWithFilter() + */ + virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; +#endif // U_FORCE_HIDE_DEPRECATED_API + + /** * Wrap (adopt) an existing break iterator in a new filtered instance. * The resulting BreakIterator is owned by the caller. * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. * Note that the adoptBreakIterator is adopted by the new BreakIterator * and should no longer be used by the caller. * The FilteredBreakIteratorBuilder may be reused. - * This function is an alias for build() + * This function is an alias for build() * @param adoptBreakIterator the break iterator to adopt * @param status error code * @return the new BreakIterator, owned by the caller. - * @stable ICU 60 + * @stable ICU 60 */ - inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { - return build(adoptBreakIterator, status); - } + inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { + return build(adoptBreakIterator, status); + } protected: /** @@ -147,6 +147,6 @@ U_NAMESPACE_END #endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // #ifndef FILTEREDBRK_H diff --git a/contrib/libs/icu/include/unicode/fmtable.h b/contrib/libs/icu/include/unicode/fmtable.h index 7bec4f6906..9496c8b334 100644 --- a/contrib/libs/icu/include/unicode/fmtable.h +++ b/contrib/libs/icu/include/unicode/fmtable.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -19,8 +19,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing @@ -35,11 +35,11 @@ U_NAMESPACE_BEGIN class CharString; -namespace number { -namespace impl { -class DecimalQuantity; -} -} +namespace number { +namespace impl { +class DecimalQuantity; +} +} /** * Formattable objects can be passed to the Format class or @@ -645,25 +645,25 @@ public: * Internal function, do not use. * TODO: figure out how to make this be non-public. * NumberFormat::format(Formattable, ... - * needs to get at the DecimalQuantity, if it exists, for + * needs to get at the DecimalQuantity, if it exists, for * big decimal formatting. * @internal */ - number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;} + number::impl::DecimalQuantity *getDecimalQuantity() const { return fDecimalQuantity;} /** - * Export the value of this Formattable to a DecimalQuantity. - * @internal + * Export the value of this Formattable to a DecimalQuantity. + * @internal */ - void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const; + void populateDecimalQuantity(number::impl::DecimalQuantity& output, UErrorCode& status) const; /** - * Adopt, and set value from, a DecimalQuantity + * Adopt, and set value from, a DecimalQuantity * Internal Function, do not use. - * @param dq the DecimalQuantity to be adopted + * @param dq the DecimalQuantity to be adopted * @internal */ - void adoptDecimalQuantity(number::impl::DecimalQuantity *dq); + void adoptDecimalQuantity(number::impl::DecimalQuantity *dq); /** * Internal function to return the CharString pointer. @@ -703,7 +703,7 @@ private: CharString *fDecimalStr; - number::impl::DecimalQuantity *fDecimalQuantity; + number::impl::DecimalQuantity *fDecimalQuantity; Type fType; UnicodeString fBogus; // Bogus string when it's needed. @@ -753,7 +753,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif //_FMTABLE //eof diff --git a/contrib/libs/icu/include/unicode/format.h b/contrib/libs/icu/include/unicode/format.h index 96883a81a2..8f4a2ae78a 100644 --- a/contrib/libs/icu/include/unicode/format.h +++ b/contrib/libs/icu/include/unicode/format.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -26,8 +26,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Base class for all formats. @@ -305,7 +305,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _FORMAT //eof diff --git a/contrib/libs/icu/include/unicode/formattedvalue.h b/contrib/libs/icu/include/unicode/formattedvalue.h index e7ba4ec245..a58a43dca4 100644 --- a/contrib/libs/icu/include/unicode/formattedvalue.h +++ b/contrib/libs/icu/include/unicode/formattedvalue.h @@ -1,318 +1,318 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#ifndef __FORMATTEDVALUE_H__ -#define __FORMATTEDVALUE_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/appendable.h" -#include "unicode/fpositer.h" -#include "unicode/unistr.h" -#include "unicode/uformattedvalue.h" - -U_NAMESPACE_BEGIN - -/** - * \file - * \brief C++ API: Abstract operations for localized strings. +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __FORMATTEDVALUE_H__ +#define __FORMATTEDVALUE_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/appendable.h" +#include "unicode/fpositer.h" +#include "unicode/unistr.h" +#include "unicode/uformattedvalue.h" + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: Abstract operations for localized strings. + * + * This file contains declarations for classes that deal with formatted strings. A number + * of APIs throughout ICU use these classes for expressing their localized output. + */ + +/** + * Represents a span of a string containing a given field. * - * This file contains declarations for classes that deal with formatted strings. A number - * of APIs throughout ICU use these classes for expressing their localized output. - */ - -/** - * Represents a span of a string containing a given field. - * - * This class differs from FieldPosition in the following ways: - * - * 1. It has information on the field category. - * 2. It allows you to set constraints to use when iterating over field positions. - * 3. It is used for the newer FormattedValue APIs. - * - * This class is not intended for public subclassing. - * - * @stable ICU 64 - */ -class U_I18N_API ConstrainedFieldPosition : public UMemory { - public: - - /** - * Initializes a ConstrainedFieldPosition. - * - * By default, the ConstrainedFieldPosition has no iteration constraints. - * - * @stable ICU 64 - */ - ConstrainedFieldPosition(); - - /** @stable ICU 64 */ - ~ConstrainedFieldPosition(); - - /** - * Resets this ConstrainedFieldPosition to its initial state, as if it were newly created: - * - * - Removes any constraints that may have been set on the instance. - * - Resets the iteration position. - * - * @stable ICU 64 - */ - void reset(); - - /** - * Sets a constraint on the field category. - * - * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition, - * positions are skipped unless they have the given category. - * - * Any previously set constraints are cleared. - * - * For example, to loop over only the number-related fields: - * - * ConstrainedFieldPosition cfpos; - * cfpos.constrainCategory(UFIELDCATEGORY_NUMBER_FORMAT); - * while (fmtval.nextPosition(cfpos, status)) { - * // handle the number-related field position - * } - * - * Changing the constraint while in the middle of iterating over a FormattedValue - * does not generally have well-defined behavior. - * - * @param category The field category to fix when iterating. - * @stable ICU 64 - */ - void constrainCategory(int32_t category); - - /** - * Sets a constraint on the category and field. - * - * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition, - * positions are skipped unless they have the given category and field. - * - * Any previously set constraints are cleared. - * - * For example, to loop over all grouping separators: - * - * ConstrainedFieldPosition cfpos; - * cfpos.constrainField(UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD); - * while (fmtval.nextPosition(cfpos, status)) { - * // handle the grouping separator position - * } - * - * Changing the constraint while in the middle of iterating over a FormattedValue - * does not generally have well-defined behavior. - * - * @param category The field category to fix when iterating. - * @param field The field to fix when iterating. - * @stable ICU 64 - */ - void constrainField(int32_t category, int32_t field); - - /** - * Gets the field category for the current position. - * - * The return value is well-defined only after - * FormattedValue#nextPosition returns TRUE. - * - * @return The field category saved in the instance. - * @stable ICU 64 - */ - inline int32_t getCategory() const { - return fCategory; - } - - /** - * Gets the field for the current position. - * - * The return value is well-defined only after - * FormattedValue#nextPosition returns TRUE. - * - * @return The field saved in the instance. - * @stable ICU 64 - */ - inline int32_t getField() const { - return fField; - } - - /** - * Gets the INCLUSIVE start index for the current position. - * - * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. - * - * @return The start index saved in the instance. - * @stable ICU 64 - */ - inline int32_t getStart() const { - return fStart; - } - - /** - * Gets the EXCLUSIVE end index stored for the current position. - * - * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. - * - * @return The end index saved in the instance. - * @stable ICU 64 - */ - inline int32_t getLimit() const { - return fLimit; - } - - //////////////////////////////////////////////////////////////////// - //// The following methods are for FormattedValue implementers; //// - //// most users can ignore them. //// - //////////////////////////////////////////////////////////////////// - - /** - * Gets an int64 that FormattedValue implementations may use for storage. - * - * The initial value is zero. - * - * Users of FormattedValue should not need to call this method. - * - * @return The current iteration context from {@link #setInt64IterationContext}. - * @stable ICU 64 - */ - inline int64_t getInt64IterationContext() const { - return fContext; - } - - /** - * Sets an int64 that FormattedValue implementations may use for storage. - * - * Intended to be used by FormattedValue implementations. - * - * @param context The new iteration context. - * @stable ICU 64 - */ - void setInt64IterationContext(int64_t context); - - /** - * Determines whether a given field should be included given the - * constraints. - * - * Intended to be used by FormattedValue implementations. - * - * @param category The category to test. - * @param field The field to test. - * @stable ICU 64 - */ - UBool matchesField(int32_t category, int32_t field) const; - - /** - * Sets new values for the primary public getters. - * - * Intended to be used by FormattedValue implementations. - * - * It is up to the implementation to ensure that the user-requested - * constraints are satisfied. This method does not check! - * - * @param category The new field category. - * @param field The new field. - * @param start The new inclusive start index. - * @param limit The new exclusive end index. - * @stable ICU 64 - */ - void setState( - int32_t category, - int32_t field, - int32_t start, - int32_t limit); - - private: - int64_t fContext = 0LL; - int32_t fField = 0; - int32_t fStart = 0; - int32_t fLimit = 0; - int32_t fCategory = UFIELD_CATEGORY_UNDEFINED; - int8_t fConstraint = 0; -}; - -/** - * An abstract formatted value: a string with associated field attributes. - * Many formatters format to classes implementing FormattedValue. - * - * @stable ICU 64 - */ -class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ { - public: - /** @stable ICU 64 */ - virtual ~FormattedValue(); - - /** - * Returns the formatted string as a self-contained UnicodeString. - * - * If you need the string within the current scope only, consider #toTempString. - * - * @param status Set if an error occurs. - * @return a UnicodeString containing the formatted string. - * - * @stable ICU 64 - */ - virtual UnicodeString toString(UErrorCode& status) const = 0; - - /** - * Returns the formatted string as a read-only alias to memory owned by the FormattedValue. - * - * The return value is valid only as long as this FormattedValue is present and unchanged in - * memory. If you need the string outside the current scope, consider #toString. - * - * The buffer returned by calling UnicodeString#getBuffer() on the return value is - * guaranteed to be NUL-terminated. - * - * @param status Set if an error occurs. - * @return a temporary UnicodeString containing the formatted string. - * - * @stable ICU 64 - */ - virtual UnicodeString toTempString(UErrorCode& status) const = 0; - - /** - * Appends the formatted string to an Appendable. - * - * @param appendable - * The Appendable to which to append the string output. - * @param status Set if an error occurs. - * @return The same Appendable, for chaining. - * - * @stable ICU 64 - * @see Appendable - */ - virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0; - - /** - * Iterates over field positions in the FormattedValue. This lets you determine the position - * of specific types of substrings, like a month or a decimal separator. - * - * To loop over all field positions: - * - * ConstrainedFieldPosition cfpos; - * while (fmtval.nextPosition(cfpos, status)) { - * // handle the field position; get information from cfpos - * } - * - * @param cfpos - * The object used for iteration state. This can provide constraints to iterate over - * only one specific category or field; - * see ConstrainedFieldPosition#constrainCategory - * and ConstrainedFieldPosition#constrainField. - * @param status Set if an error occurs. - * @return TRUE if a new occurrence of the field was found; - * FALSE otherwise or if an error was set. - * - * @stable ICU 64 - */ - virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0; -}; - -U_NAMESPACE_END - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __FORMATTEDVALUE_H__ + * This class differs from FieldPosition in the following ways: + * + * 1. It has information on the field category. + * 2. It allows you to set constraints to use when iterating over field positions. + * 3. It is used for the newer FormattedValue APIs. + * + * This class is not intended for public subclassing. + * + * @stable ICU 64 + */ +class U_I18N_API ConstrainedFieldPosition : public UMemory { + public: + + /** + * Initializes a ConstrainedFieldPosition. + * + * By default, the ConstrainedFieldPosition has no iteration constraints. + * + * @stable ICU 64 + */ + ConstrainedFieldPosition(); + + /** @stable ICU 64 */ + ~ConstrainedFieldPosition(); + + /** + * Resets this ConstrainedFieldPosition to its initial state, as if it were newly created: + * + * - Removes any constraints that may have been set on the instance. + * - Resets the iteration position. + * + * @stable ICU 64 + */ + void reset(); + + /** + * Sets a constraint on the field category. + * + * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition, + * positions are skipped unless they have the given category. + * + * Any previously set constraints are cleared. + * + * For example, to loop over only the number-related fields: + * + * ConstrainedFieldPosition cfpos; + * cfpos.constrainCategory(UFIELDCATEGORY_NUMBER_FORMAT); + * while (fmtval.nextPosition(cfpos, status)) { + * // handle the number-related field position + * } + * + * Changing the constraint while in the middle of iterating over a FormattedValue + * does not generally have well-defined behavior. + * + * @param category The field category to fix when iterating. + * @stable ICU 64 + */ + void constrainCategory(int32_t category); + + /** + * Sets a constraint on the category and field. + * + * When this instance of ConstrainedFieldPosition is passed to FormattedValue#nextPosition, + * positions are skipped unless they have the given category and field. + * + * Any previously set constraints are cleared. + * + * For example, to loop over all grouping separators: + * + * ConstrainedFieldPosition cfpos; + * cfpos.constrainField(UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD); + * while (fmtval.nextPosition(cfpos, status)) { + * // handle the grouping separator position + * } + * + * Changing the constraint while in the middle of iterating over a FormattedValue + * does not generally have well-defined behavior. + * + * @param category The field category to fix when iterating. + * @param field The field to fix when iterating. + * @stable ICU 64 + */ + void constrainField(int32_t category, int32_t field); + + /** + * Gets the field category for the current position. + * + * The return value is well-defined only after + * FormattedValue#nextPosition returns TRUE. + * + * @return The field category saved in the instance. + * @stable ICU 64 + */ + inline int32_t getCategory() const { + return fCategory; + } + + /** + * Gets the field for the current position. + * + * The return value is well-defined only after + * FormattedValue#nextPosition returns TRUE. + * + * @return The field saved in the instance. + * @stable ICU 64 + */ + inline int32_t getField() const { + return fField; + } + + /** + * Gets the INCLUSIVE start index for the current position. + * + * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. + * + * @return The start index saved in the instance. + * @stable ICU 64 + */ + inline int32_t getStart() const { + return fStart; + } + + /** + * Gets the EXCLUSIVE end index stored for the current position. + * + * The return value is well-defined only after FormattedValue#nextPosition returns TRUE. + * + * @return The end index saved in the instance. + * @stable ICU 64 + */ + inline int32_t getLimit() const { + return fLimit; + } + + //////////////////////////////////////////////////////////////////// + //// The following methods are for FormattedValue implementers; //// + //// most users can ignore them. //// + //////////////////////////////////////////////////////////////////// + + /** + * Gets an int64 that FormattedValue implementations may use for storage. + * + * The initial value is zero. + * + * Users of FormattedValue should not need to call this method. + * + * @return The current iteration context from {@link #setInt64IterationContext}. + * @stable ICU 64 + */ + inline int64_t getInt64IterationContext() const { + return fContext; + } + + /** + * Sets an int64 that FormattedValue implementations may use for storage. + * + * Intended to be used by FormattedValue implementations. + * + * @param context The new iteration context. + * @stable ICU 64 + */ + void setInt64IterationContext(int64_t context); + + /** + * Determines whether a given field should be included given the + * constraints. + * + * Intended to be used by FormattedValue implementations. + * + * @param category The category to test. + * @param field The field to test. + * @stable ICU 64 + */ + UBool matchesField(int32_t category, int32_t field) const; + + /** + * Sets new values for the primary public getters. + * + * Intended to be used by FormattedValue implementations. + * + * It is up to the implementation to ensure that the user-requested + * constraints are satisfied. This method does not check! + * + * @param category The new field category. + * @param field The new field. + * @param start The new inclusive start index. + * @param limit The new exclusive end index. + * @stable ICU 64 + */ + void setState( + int32_t category, + int32_t field, + int32_t start, + int32_t limit); + + private: + int64_t fContext = 0LL; + int32_t fField = 0; + int32_t fStart = 0; + int32_t fLimit = 0; + int32_t fCategory = UFIELD_CATEGORY_UNDEFINED; + int8_t fConstraint = 0; +}; + +/** + * An abstract formatted value: a string with associated field attributes. + * Many formatters format to classes implementing FormattedValue. + * + * @stable ICU 64 + */ +class U_I18N_API FormattedValue /* not : public UObject because this is an interface/mixin class */ { + public: + /** @stable ICU 64 */ + virtual ~FormattedValue(); + + /** + * Returns the formatted string as a self-contained UnicodeString. + * + * If you need the string within the current scope only, consider #toTempString. + * + * @param status Set if an error occurs. + * @return a UnicodeString containing the formatted string. + * + * @stable ICU 64 + */ + virtual UnicodeString toString(UErrorCode& status) const = 0; + + /** + * Returns the formatted string as a read-only alias to memory owned by the FormattedValue. + * + * The return value is valid only as long as this FormattedValue is present and unchanged in + * memory. If you need the string outside the current scope, consider #toString. + * + * The buffer returned by calling UnicodeString#getBuffer() on the return value is + * guaranteed to be NUL-terminated. + * + * @param status Set if an error occurs. + * @return a temporary UnicodeString containing the formatted string. + * + * @stable ICU 64 + */ + virtual UnicodeString toTempString(UErrorCode& status) const = 0; + + /** + * Appends the formatted string to an Appendable. + * + * @param appendable + * The Appendable to which to append the string output. + * @param status Set if an error occurs. + * @return The same Appendable, for chaining. + * + * @stable ICU 64 + * @see Appendable + */ + virtual Appendable& appendTo(Appendable& appendable, UErrorCode& status) const = 0; + + /** + * Iterates over field positions in the FormattedValue. This lets you determine the position + * of specific types of substrings, like a month or a decimal separator. + * + * To loop over all field positions: + * + * ConstrainedFieldPosition cfpos; + * while (fmtval.nextPosition(cfpos, status)) { + * // handle the field position; get information from cfpos + * } + * + * @param cfpos + * The object used for iteration state. This can provide constraints to iterate over + * only one specific category or field; + * see ConstrainedFieldPosition#constrainCategory + * and ConstrainedFieldPosition#constrainField. + * @param status Set if an error occurs. + * @return TRUE if a new occurrence of the field was found; + * FALSE otherwise or if an error was set. + * + * @stable ICU 64 + */ + virtual UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const = 0; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __FORMATTEDVALUE_H__ diff --git a/contrib/libs/icu/include/unicode/fpositer.h b/contrib/libs/icu/include/unicode/fpositer.h index 3e8a0108f1..c314e79b14 100644 --- a/contrib/libs/icu/include/unicode/fpositer.h +++ b/contrib/libs/icu/include/unicode/fpositer.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -19,9 +19,9 @@ #define FPOSITER_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -109,8 +109,8 @@ private: */ void setData(UVector32 *adopt, UErrorCode& status); - friend class FieldPositionIteratorHandler; - + friend class FieldPositionIteratorHandler; + UVector32 *data; int32_t pos; }; @@ -119,6 +119,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // FPOSITER_H diff --git a/contrib/libs/icu/include/unicode/gender.h b/contrib/libs/icu/include/unicode/gender.h index cf7fee963e..9587e1ecb3 100644 --- a/contrib/libs/icu/include/unicode/gender.h +++ b/contrib/libs/icu/include/unicode/gender.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -18,15 +18,15 @@ #ifndef _GENDER #define _GENDER -/** - * \file - * \brief C++ API: GenderInfo computes the gender of a list. - */ - +/** + * \file + * \brief C++ API: GenderInfo computes the gender of a list. + */ + #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/locid.h" @@ -37,7 +37,7 @@ class GenderInfoTest; U_NAMESPACE_BEGIN -/** \internal Forward Declaration */ +/** \internal Forward Declaration */ void U_CALLCONV GenderInfo_initCache(UErrorCode &status); /** @@ -116,7 +116,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _GENDER //eof diff --git a/contrib/libs/icu/include/unicode/gregocal.h b/contrib/libs/icu/include/unicode/gregocal.h index 4ce40daf3a..1e68d4372b 100644 --- a/contrib/libs/icu/include/unicode/gregocal.h +++ b/contrib/libs/icu/include/unicode/gregocal.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 1997-2013, International Business Machines Corporation and others. @@ -28,8 +28,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/calendar.h" @@ -303,7 +303,7 @@ public: * @return return a polymorphic copy of this calendar. * @stable ICU 2.0 */ - virtual GregorianCalendar* clone() const; + virtual GregorianCalendar* clone() const; /** * Sets the GregorianCalendar change date. This is the point when the switch from @@ -352,7 +352,7 @@ public: */ virtual UBool isEquivalentTo(const Calendar& other) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * (Overrides Calendar) Rolls up or down by the given amount in the specified field. * For more information, see the documentation for Calendar::roll(). @@ -365,7 +365,7 @@ public: * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. */ virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * (Overrides Calendar) Rolls up or down by the given amount in the specified field. @@ -778,8 +778,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _GREGOCAL //eof diff --git a/contrib/libs/icu/include/unicode/icudataver.h b/contrib/libs/icu/include/unicode/icudataver.h index 1cb202e3d4..21ab501819 100644 --- a/contrib/libs/icu/include/unicode/icudataver.h +++ b/contrib/libs/icu/include/unicode/icudataver.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** diff --git a/contrib/libs/icu/include/unicode/icuplug.h b/contrib/libs/icu/include/unicode/icuplug.h index 2e57b149e1..e67541cd65 100644 --- a/contrib/libs/icu/include/unicode/icuplug.h +++ b/contrib/libs/icu/include/unicode/icuplug.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -110,7 +110,7 @@ #include "unicode/utypes.h" -#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN) +#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN) diff --git a/contrib/libs/icu/include/unicode/idna.h b/contrib/libs/icu/include/unicode/idna.h index 6dfcfe48db..e04050a30e 100644 --- a/contrib/libs/icu/include/unicode/idna.h +++ b/contrib/libs/icu/include/unicode/idna.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: idna.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -24,8 +24,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_IDNA #include "unicode/bytestream.h" @@ -324,7 +324,7 @@ private: U_NAMESPACE_END #endif // UCONFIG_NO_IDNA - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __IDNA_H__ diff --git a/contrib/libs/icu/include/unicode/listformatter.h b/contrib/libs/icu/include/unicode/listformatter.h index 211055d9d1..af97798271 100644 --- a/contrib/libs/icu/include/unicode/listformatter.h +++ b/contrib/libs/icu/include/unicode/listformatter.h @@ -1,301 +1,301 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -******************************************************************************* -* -* Copyright (C) 2012-2016, International Business Machines -* Corporation and others. All Rights Reserved. -* -******************************************************************************* -* file name: listformatter.h -* encoding: UTF-8 -* tab size: 8 (not used) -* indentation:4 -* -* created on: 20120426 -* created by: Umesh P. Nair -*/ - -#ifndef __LISTFORMATTER_H__ -#define __LISTFORMATTER_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/unistr.h" -#include "unicode/locid.h" -#include "unicode/formattedvalue.h" -#include "unicode/ulistformatter.h" - -U_NAMESPACE_BEGIN - -class FieldPositionHandler; -class FormattedListData; -class ListFormatter; - -/** @internal */ -class Hashtable; - -/** @internal */ -struct ListFormatInternal; - -/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */ -/** - * @internal - * \cond - */ -struct ListFormatData : public UMemory { - UnicodeString twoPattern; - UnicodeString startPattern; - UnicodeString middlePattern; - UnicodeString endPattern; - Locale locale; - - ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end, - const Locale& loc) : - twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end), locale(loc) {} -}; -/** \endcond */ - - -/** - * \file - * \brief C++ API: API for formatting a list. - */ - - -#if !UCONFIG_NO_FORMATTING -/** - * An immutable class containing the result of a list formatting operation. - * - * Instances of this class are immutable and thread-safe. - * - * When calling nextPosition(): - * The fields are returned from start to end. The special field category - * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument - * was inserted at the given position. The span category will - * always occur before the corresponding instance of UFIELD_CATEGORY_LIST - * in the nextPosition() iterator. - * - * Not intended for public subclassing. - * - * @stable ICU 64 - */ -class U_I18N_API FormattedList : public UMemory, public FormattedValue { - public: - /** - * Default constructor; makes an empty FormattedList. - * @stable ICU 64 - */ - FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} - - /** - * Move constructor: Leaves the source FormattedList in an undefined state. - * @stable ICU 64 - */ - FormattedList(FormattedList&& src) U_NOEXCEPT; - - /** - * Destruct an instance of FormattedList. - * @stable ICU 64 - */ - virtual ~FormattedList() U_OVERRIDE; - - /** Copying not supported; use move constructor instead. */ - FormattedList(const FormattedList&) = delete; - - /** Copying not supported; use move assignment instead. */ - FormattedList& operator=(const FormattedList&) = delete; - - /** - * Move assignment: Leaves the source FormattedList in an undefined state. - * @stable ICU 64 - */ - FormattedList& operator=(FormattedList&& src) U_NOEXCEPT; - - /** @copydoc FormattedValue::toString() */ - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::toTempString() */ - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::appendTo() */ - Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::nextPosition() */ - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; - - private: - FormattedListData *fData; - UErrorCode fErrorCode; - explicit FormattedList(FormattedListData *results) - : fData(results), fErrorCode(U_ZERO_ERROR) {} - explicit FormattedList(UErrorCode errorCode) - : fData(nullptr), fErrorCode(errorCode) {} - friend class ListFormatter; -}; -#endif // !UCONFIG_NO_FORMATTING - - -/** - * An immutable class for formatting a list, using data from CLDR (or supplied - * separately). - * - * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted - * as "Alice, Bob, Charlie and Delta" in English. - * - * The ListFormatter class is not intended for public subclassing. - * @stable ICU 50 - */ -class U_I18N_API ListFormatter : public UObject{ - - public: - - /** - * Copy constructor. - * @stable ICU 52 - */ - ListFormatter(const ListFormatter&); - - /** - * Assignment operator. - * @stable ICU 52 - */ - ListFormatter& operator=(const ListFormatter& other); - - /** - * Creates a ListFormatter appropriate for the default locale. - * - * @param errorCode ICU error code, set if no data available for default locale. - * @return Pointer to a ListFormatter object for the default locale, - * created from internal data derived from CLDR data. - * @stable ICU 50 - */ - static ListFormatter* createInstance(UErrorCode& errorCode); - - /** - * Creates a ListFormatter appropriate for a locale. - * - * @param locale The locale. - * @param errorCode ICU error code, set if no data available for the given locale. - * @return A ListFormatter object created from internal data derived from - * CLDR data. - * @stable ICU 50 - */ - static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode); - -#ifndef U_HIDE_DRAFT_API -#if !UCONFIG_NO_FORMATTING - /** - * Creates a ListFormatter for the given locale, list type, and style. - * - * @param locale The locale. - * @param type The type of list formatting to use. - * @param width The width of formatting to use. - * @param errorCode ICU error code, set if no data available for the given locale. - * @return A ListFormatter object created from internal data derived from CLDR data. - * @draft ICU 67 - */ - static ListFormatter* createInstance( - const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode); -#endif /* !UCONFIG_NO_FORMATTING */ -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_INTERNAL_API - /** - * Creates a ListFormatter appropriate for a locale and style. - * - * TODO(ICU-20888): Remove this in ICU 68. - * - * @param locale The locale. - * @param style the style, either "standard", "or", "unit", "unit-narrow", or "unit-short" - * @param errorCode ICU error code, set if no data available for the given locale. - * @return A ListFormatter object created from internal data derived from - * CLDR data. - * @internal - */ - static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode); -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Destructor. - * - * @stable ICU 50 - */ - virtual ~ListFormatter(); - - - /** - * Formats a list of strings. - * - * @param items An array of strings to be combined and formatted. - * @param n_items Length of the array items. - * @param appendTo The string to which the result should be appended to. - * @param errorCode ICU error code, set if there is an error. - * @return Formatted string combining the elements of items, appended to appendTo. - * @stable ICU 50 - */ - UnicodeString& format(const UnicodeString items[], int32_t n_items, - UnicodeString& appendTo, UErrorCode& errorCode) const; - -#if !UCONFIG_NO_FORMATTING - /** - * Formats a list of strings to a FormattedList, which exposes field - * position information. The FormattedList contains more information than - * a FieldPositionIterator. - * - * @param items An array of strings to be combined and formatted. - * @param n_items Length of the array items. - * @param errorCode ICU error code returned here. - * @return A FormattedList containing field information. - * @stable ICU 64 - */ - FormattedList formatStringsToValue( - const UnicodeString items[], - int32_t n_items, - UErrorCode& errorCode) const; -#endif // !UCONFIG_NO_FORMATTING - -#ifndef U_HIDE_INTERNAL_API - /** - @internal for MeasureFormat - */ - UnicodeString& format( - const UnicodeString items[], - int32_t n_items, - UnicodeString& appendTo, - int32_t index, - int32_t &offset, - UErrorCode& errorCode) const; - /** - * @internal constructor made public for testing. - */ - ListFormatter(const ListFormatData &data, UErrorCode &errorCode); - /** - * @internal constructor made public for testing. - */ - ListFormatter(const ListFormatInternal* listFormatterInternal); -#endif /* U_HIDE_INTERNAL_API */ - - private: - static void initializeHash(UErrorCode& errorCode); - static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); - struct ListPatternsSink; - static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode); - - UnicodeString& format_( - const UnicodeString items[], int32_t n_items, UnicodeString& appendTo, - int32_t index, int32_t &offset, FieldPositionHandler* handler, UErrorCode& errorCode) const; - - ListFormatter(); - - ListFormatInternal* owned; - const ListFormatInternal* data; -}; - -U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __LISTFORMATTER_H__ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2012-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: listformatter.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 20120426 +* created by: Umesh P. Nair +*/ + +#ifndef __LISTFORMATTER_H__ +#define __LISTFORMATTER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/unistr.h" +#include "unicode/locid.h" +#include "unicode/formattedvalue.h" +#include "unicode/ulistformatter.h" + +U_NAMESPACE_BEGIN + +class FieldPositionHandler; +class FormattedListData; +class ListFormatter; + +/** @internal */ +class Hashtable; + +/** @internal */ +struct ListFormatInternal; + +/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */ +/** + * @internal + * \cond + */ +struct ListFormatData : public UMemory { + UnicodeString twoPattern; + UnicodeString startPattern; + UnicodeString middlePattern; + UnicodeString endPattern; + Locale locale; + + ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end, + const Locale& loc) : + twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end), locale(loc) {} +}; +/** \endcond */ + + +/** + * \file + * \brief C++ API: API for formatting a list. + */ + + +#if !UCONFIG_NO_FORMATTING +/** + * An immutable class containing the result of a list formatting operation. + * + * Instances of this class are immutable and thread-safe. + * + * When calling nextPosition(): + * The fields are returned from start to end. The special field category + * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument + * was inserted at the given position. The span category will + * always occur before the corresponding instance of UFIELD_CATEGORY_LIST + * in the nextPosition() iterator. + * + * Not intended for public subclassing. + * + * @stable ICU 64 + */ +class U_I18N_API FormattedList : public UMemory, public FormattedValue { + public: + /** + * Default constructor; makes an empty FormattedList. + * @stable ICU 64 + */ + FormattedList() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} + + /** + * Move constructor: Leaves the source FormattedList in an undefined state. + * @stable ICU 64 + */ + FormattedList(FormattedList&& src) U_NOEXCEPT; + + /** + * Destruct an instance of FormattedList. + * @stable ICU 64 + */ + virtual ~FormattedList() U_OVERRIDE; + + /** Copying not supported; use move constructor instead. */ + FormattedList(const FormattedList&) = delete; + + /** Copying not supported; use move assignment instead. */ + FormattedList& operator=(const FormattedList&) = delete; + + /** + * Move assignment: Leaves the source FormattedList in an undefined state. + * @stable ICU 64 + */ + FormattedList& operator=(FormattedList&& src) U_NOEXCEPT; + + /** @copydoc FormattedValue::toString() */ + UnicodeString toString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::toTempString() */ + UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::appendTo() */ + Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::nextPosition() */ + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + + private: + FormattedListData *fData; + UErrorCode fErrorCode; + explicit FormattedList(FormattedListData *results) + : fData(results), fErrorCode(U_ZERO_ERROR) {} + explicit FormattedList(UErrorCode errorCode) + : fData(nullptr), fErrorCode(errorCode) {} + friend class ListFormatter; +}; +#endif // !UCONFIG_NO_FORMATTING + + +/** + * An immutable class for formatting a list, using data from CLDR (or supplied + * separately). + * + * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted + * as "Alice, Bob, Charlie and Delta" in English. + * + * The ListFormatter class is not intended for public subclassing. + * @stable ICU 50 + */ +class U_I18N_API ListFormatter : public UObject{ + + public: + + /** + * Copy constructor. + * @stable ICU 52 + */ + ListFormatter(const ListFormatter&); + + /** + * Assignment operator. + * @stable ICU 52 + */ + ListFormatter& operator=(const ListFormatter& other); + + /** + * Creates a ListFormatter appropriate for the default locale. + * + * @param errorCode ICU error code, set if no data available for default locale. + * @return Pointer to a ListFormatter object for the default locale, + * created from internal data derived from CLDR data. + * @stable ICU 50 + */ + static ListFormatter* createInstance(UErrorCode& errorCode); + + /** + * Creates a ListFormatter appropriate for a locale. + * + * @param locale The locale. + * @param errorCode ICU error code, set if no data available for the given locale. + * @return A ListFormatter object created from internal data derived from + * CLDR data. + * @stable ICU 50 + */ + static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode); + +#ifndef U_HIDE_DRAFT_API +#if !UCONFIG_NO_FORMATTING + /** + * Creates a ListFormatter for the given locale, list type, and style. + * + * @param locale The locale. + * @param type The type of list formatting to use. + * @param width The width of formatting to use. + * @param errorCode ICU error code, set if no data available for the given locale. + * @return A ListFormatter object created from internal data derived from CLDR data. + * @draft ICU 67 + */ + static ListFormatter* createInstance( + const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode); +#endif /* !UCONFIG_NO_FORMATTING */ +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_INTERNAL_API + /** + * Creates a ListFormatter appropriate for a locale and style. + * + * TODO(ICU-20888): Remove this in ICU 68. + * + * @param locale The locale. + * @param style the style, either "standard", "or", "unit", "unit-narrow", or "unit-short" + * @param errorCode ICU error code, set if no data available for the given locale. + * @return A ListFormatter object created from internal data derived from + * CLDR data. + * @internal + */ + static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Destructor. + * + * @stable ICU 50 + */ + virtual ~ListFormatter(); + + + /** + * Formats a list of strings. + * + * @param items An array of strings to be combined and formatted. + * @param n_items Length of the array items. + * @param appendTo The string to which the result should be appended to. + * @param errorCode ICU error code, set if there is an error. + * @return Formatted string combining the elements of items, appended to appendTo. + * @stable ICU 50 + */ + UnicodeString& format(const UnicodeString items[], int32_t n_items, + UnicodeString& appendTo, UErrorCode& errorCode) const; + +#if !UCONFIG_NO_FORMATTING + /** + * Formats a list of strings to a FormattedList, which exposes field + * position information. The FormattedList contains more information than + * a FieldPositionIterator. + * + * @param items An array of strings to be combined and formatted. + * @param n_items Length of the array items. + * @param errorCode ICU error code returned here. + * @return A FormattedList containing field information. + * @stable ICU 64 + */ + FormattedList formatStringsToValue( + const UnicodeString items[], + int32_t n_items, + UErrorCode& errorCode) const; +#endif // !UCONFIG_NO_FORMATTING + +#ifndef U_HIDE_INTERNAL_API + /** + @internal for MeasureFormat + */ + UnicodeString& format( + const UnicodeString items[], + int32_t n_items, + UnicodeString& appendTo, + int32_t index, + int32_t &offset, + UErrorCode& errorCode) const; + /** + * @internal constructor made public for testing. + */ + ListFormatter(const ListFormatData &data, UErrorCode &errorCode); + /** + * @internal constructor made public for testing. + */ + ListFormatter(const ListFormatInternal* listFormatterInternal); +#endif /* U_HIDE_INTERNAL_API */ + + private: + static void initializeHash(UErrorCode& errorCode); + static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); + struct ListPatternsSink; + static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode); + + UnicodeString& format_( + const UnicodeString items[], int32_t n_items, UnicodeString& appendTo, + int32_t index, int32_t &offset, FieldPositionHandler* handler, UErrorCode& errorCode) const; + + ListFormatter(); + + ListFormatInternal* owned; + const ListFormatInternal* data; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __LISTFORMATTER_H__ diff --git a/contrib/libs/icu/include/unicode/localebuilder.h b/contrib/libs/icu/include/unicode/localebuilder.h index c5836fe270..b623da8f97 100644 --- a/contrib/libs/icu/include/unicode/localebuilder.h +++ b/contrib/libs/icu/include/unicode/localebuilder.h @@ -1,312 +1,312 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License -#ifndef __LOCALEBUILDER_H__ -#define __LOCALEBUILDER_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/locid.h" -#include "unicode/localematcher.h" -#include "unicode/stringpiece.h" -#include "unicode/uobject.h" - -/** - * \file - * \brief C++ API: Builder API for Locale - */ - -U_NAMESPACE_BEGIN -class CharString; - -/** - * <code>LocaleBuilder</code> is used to build instances of <code>Locale</code> - * from values configured by the setters. Unlike the <code>Locale</code> - * constructors, the <code>LocaleBuilder</code> checks if a value configured by a - * setter satisfies the syntax requirements defined by the <code>Locale</code> - * class. A <code>Locale</code> object created by a <code>LocaleBuilder</code> is - * well-formed and can be transformed to a well-formed IETF BCP 47 language tag - * without losing information. - * - * <p>The following example shows how to create a <code>Locale</code> object - * with the <code>LocaleBuilder</code>. - * <blockquote> - * <pre> - * UErrorCode status = U_ZERO_ERROR; - * Locale aLocale = LocaleBuilder() - * .setLanguage("sr") - * .setScript("Latn") - * .setRegion("RS") - * .build(status); - * if (U_SUCCESS(status)) { - * // ... - * } - * </pre> - * </blockquote> - * - * <p>LocaleBuilders can be reused; <code>clear()</code> resets all - * fields to their default values. - * - * <p>LocaleBuilder tracks errors in an internal UErrorCode. For all setters, - * except setLanguageTag and setLocale, LocaleBuilder will return immediately - * if the internal UErrorCode is in error state. - * To reset internal state and error code, call clear method. - * The setLanguageTag and setLocale method will first clear the internal - * UErrorCode, then track the error of the validation of the input parameter - * into the internal UErrorCode. - * - * @stable ICU 64 - */ -class U_COMMON_API LocaleBuilder : public UObject { -public: - /** - * Constructs an empty LocaleBuilder. The default value of all - * fields, extensions, and private use information is the - * empty string. - * - * @stable ICU 64 - */ - LocaleBuilder(); - - /** - * Destructor - * @stable ICU 64 - */ - virtual ~LocaleBuilder(); - - /** - * Resets the <code>LocaleBuilder</code> to match the provided - * <code>locale</code>. Existing state is discarded. - * - * <p>All fields of the locale must be well-formed. - * <p>This method clears the internal UErrorCode. - * - * @param locale the locale - * @return This builder. - * - * @stable ICU 64 - */ - LocaleBuilder& setLocale(const Locale& locale); - - /** - * Resets the LocaleBuilder to match the provided - * [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) . - * Discards the existing state. the empty string cause the builder to be - * reset, like {@link #clear}. Grandfathered tags are converted to their - * canonical form before being processed. Otherwise, the <code>language - * tag</code> must be well-formed, or else the build() method will later - * report an U_ILLEGAL_ARGUMENT_ERROR. - * - * <p>This method clears the internal UErrorCode. - * - * @param tag the language tag, defined as - * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id). - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setLanguageTag(StringPiece tag); - - /** - * Sets the language. If <code>language</code> is the empty string, the - * language in this <code>LocaleBuilder</code> is removed. Otherwise, the - * <code>language</code> must be well-formed, or else the build() method will - * later report an U_ILLEGAL_ARGUMENT_ERROR. - * - * <p>The syntax of language value is defined as - * [unicode_language_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_language_subtag). - * - * @param language the language - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setLanguage(StringPiece language); - - /** - * Sets the script. If <code>script</code> is the empty string, the script in - * this <code>LocaleBuilder</code> is removed. - * Otherwise, the <code>script</code> must be well-formed, or else the build() - * method will later report an U_ILLEGAL_ARGUMENT_ERROR. - * - * <p>The script value is a four-letter script code as - * [unicode_script_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_script_subtag) - * defined by ISO 15924 - * - * @param script the script - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setScript(StringPiece script); - - /** - * Sets the region. If region is the empty string, the region in this - * <code>LocaleBuilder</code> is removed. Otherwise, the <code>region</code> - * must be well-formed, or else the build() method will later report an - * U_ILLEGAL_ARGUMENT_ERROR. - * - * <p>The region value is defined by - * [unicode_region_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_region_subtag) - * as a two-letter ISO 3166 code or a three-digit UN M.49 area code. - * - * <p>The region value in the <code>Locale</code> created by the - * <code>LocaleBuilder</code> is always normalized to upper case. - * - * @param region the region - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setRegion(StringPiece region); - - /** - * Sets the variant. If variant is the empty string, the variant in this - * <code>LocaleBuilder</code> is removed. Otherwise, the <code>variant</code> - * must be well-formed, or else the build() method will later report an - * U_ILLEGAL_ARGUMENT_ERROR. - * - * <p><b>Note:</b> This method checks if <code>variant</code> - * satisfies the - * [unicode_variant_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_variant_subtag) - * syntax requirements, and normalizes the value to lowercase letters. However, - * the <code>Locale</code> class does not impose any syntactic - * restriction on variant. To set an ill-formed variant, use a Locale constructor. - * If there are multiple unicode_variant_subtag, the caller must concatenate - * them with '-' as separator (ex: "foobar-fibar"). - * - * @param variant the variant - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setVariant(StringPiece variant); - - /** - * Sets the extension for the given key. If the value is the empty string, - * the extension is removed. Otherwise, the <code>key</code> and - * <code>value</code> must be well-formed, or else the build() method will - * later report an U_ILLEGAL_ARGUMENT_ERROR. - * - * <p><b>Note:</b> The key ('u') is used for the Unicode locale extension. - * Setting a value for this key replaces any existing Unicode locale key/type - * pairs with those defined in the extension. - * - * <p><b>Note:</b> The key ('x') is used for the private use code. To be - * well-formed, the value for this key needs only to have subtags of one to - * eight alphanumeric characters, not two to eight as in the general case. - * - * @param key the extension key - * @param value the extension value - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setExtension(char key, StringPiece value); - - /** - * Sets the Unicode locale keyword type for the given key. If the type - * StringPiece is constructed with a nullptr, the keyword is removed. - * If the type is the empty string, the keyword is set without type subtags. - * Otherwise, the key and type must be well-formed, or else the build() - * method will later report an U_ILLEGAL_ARGUMENT_ERROR. - * - * <p>Keys and types are converted to lower case. - * - * <p><b>Note</b>:Setting the 'u' extension via {@link #setExtension} - * replaces all Unicode locale keywords with those defined in the - * extension. - * - * @param key the Unicode locale key - * @param type the Unicode locale type - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& setUnicodeLocaleKeyword( - StringPiece key, StringPiece type); - - /** - * Adds a unicode locale attribute, if not already present, otherwise - * has no effect. The attribute must not be empty string and must be - * well-formed or U_ILLEGAL_ARGUMENT_ERROR will be set to status - * during the build() call. - * - * @param attribute the attribute - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute); - - /** - * Removes a unicode locale attribute, if present, otherwise has no - * effect. The attribute must not be empty string and must be well-formed - * or U_ILLEGAL_ARGUMENT_ERROR will be set to status during the build() call. - * - * <p>Attribute comparison for removal is case-insensitive. - * - * @param attribute the attribute - * @return This builder. - * @stable ICU 64 - */ - LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute); - - /** - * Resets the builder to its initial, empty state. - * <p>This method clears the internal UErrorCode. - * - * @return this builder - * @stable ICU 64 - */ - LocaleBuilder& clear(); - - /** - * Resets the extensions to their initial, empty state. - * Language, script, region and variant are unchanged. - * - * @return this builder - * @stable ICU 64 - */ - LocaleBuilder& clearExtensions(); - - /** - * Returns an instance of <code>Locale</code> created from the fields set - * on this builder. - * If any set methods or during the build() call require memory allocation - * but fail U_MEMORY_ALLOCATION_ERROR will be set to status. - * If any of the fields set by the setters are not well-formed, the status - * will be set to U_ILLEGAL_ARGUMENT_ERROR. The state of the builder will - * not change after the build() call and the caller is free to keep using - * the same builder to build more locales. - * - * @return a new Locale - * @stable ICU 64 - */ - Locale build(UErrorCode& status); - -#ifndef U_HIDE_DRAFT_API - /** - * Sets the UErrorCode if an error occurred while recording sets. - * Preserves older error codes in the outErrorCode. - * @param outErrorCode Set to an error code that occurred while setting subtags. - * Unchanged if there is no such error or if outErrorCode - * already contained an error. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 - */ - UBool copyErrorTo(UErrorCode &outErrorCode) const; -#endif /* U_HIDE_DRAFT_API */ - -private: - friend class LocaleMatcher::Result; - - void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode); - - UErrorCode status_; - char language_[9]; - char script_[5]; - char region_[4]; - CharString *variant_; // Pointer not object so we need not #include internal charstr.h. - icu::Locale *extensions_; // Pointer not object. Storage for all other fields. - -}; - -U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __LOCALEBUILDER_H__ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html#License +#ifndef __LOCALEBUILDER_H__ +#define __LOCALEBUILDER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/locid.h" +#include "unicode/localematcher.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Builder API for Locale + */ + +U_NAMESPACE_BEGIN +class CharString; + +/** + * <code>LocaleBuilder</code> is used to build instances of <code>Locale</code> + * from values configured by the setters. Unlike the <code>Locale</code> + * constructors, the <code>LocaleBuilder</code> checks if a value configured by a + * setter satisfies the syntax requirements defined by the <code>Locale</code> + * class. A <code>Locale</code> object created by a <code>LocaleBuilder</code> is + * well-formed and can be transformed to a well-formed IETF BCP 47 language tag + * without losing information. + * + * <p>The following example shows how to create a <code>Locale</code> object + * with the <code>LocaleBuilder</code>. + * <blockquote> + * <pre> + * UErrorCode status = U_ZERO_ERROR; + * Locale aLocale = LocaleBuilder() + * .setLanguage("sr") + * .setScript("Latn") + * .setRegion("RS") + * .build(status); + * if (U_SUCCESS(status)) { + * // ... + * } + * </pre> + * </blockquote> + * + * <p>LocaleBuilders can be reused; <code>clear()</code> resets all + * fields to their default values. + * + * <p>LocaleBuilder tracks errors in an internal UErrorCode. For all setters, + * except setLanguageTag and setLocale, LocaleBuilder will return immediately + * if the internal UErrorCode is in error state. + * To reset internal state and error code, call clear method. + * The setLanguageTag and setLocale method will first clear the internal + * UErrorCode, then track the error of the validation of the input parameter + * into the internal UErrorCode. + * + * @stable ICU 64 + */ +class U_COMMON_API LocaleBuilder : public UObject { +public: + /** + * Constructs an empty LocaleBuilder. The default value of all + * fields, extensions, and private use information is the + * empty string. + * + * @stable ICU 64 + */ + LocaleBuilder(); + + /** + * Destructor + * @stable ICU 64 + */ + virtual ~LocaleBuilder(); + + /** + * Resets the <code>LocaleBuilder</code> to match the provided + * <code>locale</code>. Existing state is discarded. + * + * <p>All fields of the locale must be well-formed. + * <p>This method clears the internal UErrorCode. + * + * @param locale the locale + * @return This builder. + * + * @stable ICU 64 + */ + LocaleBuilder& setLocale(const Locale& locale); + + /** + * Resets the LocaleBuilder to match the provided + * [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) . + * Discards the existing state. the empty string cause the builder to be + * reset, like {@link #clear}. Grandfathered tags are converted to their + * canonical form before being processed. Otherwise, the <code>language + * tag</code> must be well-formed, or else the build() method will later + * report an U_ILLEGAL_ARGUMENT_ERROR. + * + * <p>This method clears the internal UErrorCode. + * + * @param tag the language tag, defined as + * [unicode_locale_id](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id). + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setLanguageTag(StringPiece tag); + + /** + * Sets the language. If <code>language</code> is the empty string, the + * language in this <code>LocaleBuilder</code> is removed. Otherwise, the + * <code>language</code> must be well-formed, or else the build() method will + * later report an U_ILLEGAL_ARGUMENT_ERROR. + * + * <p>The syntax of language value is defined as + * [unicode_language_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_language_subtag). + * + * @param language the language + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setLanguage(StringPiece language); + + /** + * Sets the script. If <code>script</code> is the empty string, the script in + * this <code>LocaleBuilder</code> is removed. + * Otherwise, the <code>script</code> must be well-formed, or else the build() + * method will later report an U_ILLEGAL_ARGUMENT_ERROR. + * + * <p>The script value is a four-letter script code as + * [unicode_script_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_script_subtag) + * defined by ISO 15924 + * + * @param script the script + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setScript(StringPiece script); + + /** + * Sets the region. If region is the empty string, the region in this + * <code>LocaleBuilder</code> is removed. Otherwise, the <code>region</code> + * must be well-formed, or else the build() method will later report an + * U_ILLEGAL_ARGUMENT_ERROR. + * + * <p>The region value is defined by + * [unicode_region_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_region_subtag) + * as a two-letter ISO 3166 code or a three-digit UN M.49 area code. + * + * <p>The region value in the <code>Locale</code> created by the + * <code>LocaleBuilder</code> is always normalized to upper case. + * + * @param region the region + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setRegion(StringPiece region); + + /** + * Sets the variant. If variant is the empty string, the variant in this + * <code>LocaleBuilder</code> is removed. Otherwise, the <code>variant</code> + * must be well-formed, or else the build() method will later report an + * U_ILLEGAL_ARGUMENT_ERROR. + * + * <p><b>Note:</b> This method checks if <code>variant</code> + * satisfies the + * [unicode_variant_subtag](http://www.unicode.org/reports/tr35/tr35.html#unicode_variant_subtag) + * syntax requirements, and normalizes the value to lowercase letters. However, + * the <code>Locale</code> class does not impose any syntactic + * restriction on variant. To set an ill-formed variant, use a Locale constructor. + * If there are multiple unicode_variant_subtag, the caller must concatenate + * them with '-' as separator (ex: "foobar-fibar"). + * + * @param variant the variant + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setVariant(StringPiece variant); + + /** + * Sets the extension for the given key. If the value is the empty string, + * the extension is removed. Otherwise, the <code>key</code> and + * <code>value</code> must be well-formed, or else the build() method will + * later report an U_ILLEGAL_ARGUMENT_ERROR. + * + * <p><b>Note:</b> The key ('u') is used for the Unicode locale extension. + * Setting a value for this key replaces any existing Unicode locale key/type + * pairs with those defined in the extension. + * + * <p><b>Note:</b> The key ('x') is used for the private use code. To be + * well-formed, the value for this key needs only to have subtags of one to + * eight alphanumeric characters, not two to eight as in the general case. + * + * @param key the extension key + * @param value the extension value + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setExtension(char key, StringPiece value); + + /** + * Sets the Unicode locale keyword type for the given key. If the type + * StringPiece is constructed with a nullptr, the keyword is removed. + * If the type is the empty string, the keyword is set without type subtags. + * Otherwise, the key and type must be well-formed, or else the build() + * method will later report an U_ILLEGAL_ARGUMENT_ERROR. + * + * <p>Keys and types are converted to lower case. + * + * <p><b>Note</b>:Setting the 'u' extension via {@link #setExtension} + * replaces all Unicode locale keywords with those defined in the + * extension. + * + * @param key the Unicode locale key + * @param type the Unicode locale type + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& setUnicodeLocaleKeyword( + StringPiece key, StringPiece type); + + /** + * Adds a unicode locale attribute, if not already present, otherwise + * has no effect. The attribute must not be empty string and must be + * well-formed or U_ILLEGAL_ARGUMENT_ERROR will be set to status + * during the build() call. + * + * @param attribute the attribute + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& addUnicodeLocaleAttribute(StringPiece attribute); + + /** + * Removes a unicode locale attribute, if present, otherwise has no + * effect. The attribute must not be empty string and must be well-formed + * or U_ILLEGAL_ARGUMENT_ERROR will be set to status during the build() call. + * + * <p>Attribute comparison for removal is case-insensitive. + * + * @param attribute the attribute + * @return This builder. + * @stable ICU 64 + */ + LocaleBuilder& removeUnicodeLocaleAttribute(StringPiece attribute); + + /** + * Resets the builder to its initial, empty state. + * <p>This method clears the internal UErrorCode. + * + * @return this builder + * @stable ICU 64 + */ + LocaleBuilder& clear(); + + /** + * Resets the extensions to their initial, empty state. + * Language, script, region and variant are unchanged. + * + * @return this builder + * @stable ICU 64 + */ + LocaleBuilder& clearExtensions(); + + /** + * Returns an instance of <code>Locale</code> created from the fields set + * on this builder. + * If any set methods or during the build() call require memory allocation + * but fail U_MEMORY_ALLOCATION_ERROR will be set to status. + * If any of the fields set by the setters are not well-formed, the status + * will be set to U_ILLEGAL_ARGUMENT_ERROR. The state of the builder will + * not change after the build() call and the caller is free to keep using + * the same builder to build more locales. + * + * @return a new Locale + * @stable ICU 64 + */ + Locale build(UErrorCode& status); + +#ifndef U_HIDE_DRAFT_API + /** + * Sets the UErrorCode if an error occurred while recording sets. + * Preserves older error codes in the outErrorCode. + * @param outErrorCode Set to an error code that occurred while setting subtags. + * Unchanged if there is no such error or if outErrorCode + * already contained an error. + * @return TRUE if U_FAILURE(outErrorCode) + * @draft ICU 65 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; +#endif /* U_HIDE_DRAFT_API */ + +private: + friend class LocaleMatcher::Result; + + void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode); + + UErrorCode status_; + char language_[9]; + char script_[5]; + char region_[4]; + CharString *variant_; // Pointer not object so we need not #include internal charstr.h. + icu::Locale *extensions_; // Pointer not object. Storage for all other fields. + +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __LOCALEBUILDER_H__ diff --git a/contrib/libs/icu/include/unicode/localematcher.h b/contrib/libs/icu/include/unicode/localematcher.h index 2e1a7a349f..fa97014fb7 100644 --- a/contrib/libs/icu/include/unicode/localematcher.h +++ b/contrib/libs/icu/include/unicode/localematcher.h @@ -1,665 +1,665 @@ -// © 2019 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html#License - -// localematcher.h -// created: 2019may08 Markus W. Scherer - -#ifndef __LOCALEMATCHER_H__ -#define __LOCALEMATCHER_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/locid.h" -#include "unicode/stringpiece.h" -#include "unicode/uobject.h" - -/** - * \file - * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales. - */ - -#ifndef U_FORCE_HIDE_DRAFT_API - -/** - * Builder option for whether the language subtag or the script subtag is most important. - * - * @see Builder#setFavorSubtag(ULocMatchFavorSubtag) - * @draft ICU 65 - */ -enum ULocMatchFavorSubtag { - /** - * Language differences are most important, then script differences, then region differences. - * (This is the default behavior.) - * - * @draft ICU 65 - */ - ULOCMATCH_FAVOR_LANGUAGE, - /** - * Makes script differences matter relatively more than language differences. - * - * @draft ICU 65 - */ - ULOCMATCH_FAVOR_SCRIPT -}; -#ifndef U_IN_DOXYGEN -typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag; -#endif - -/** - * Builder option for whether all desired locales are treated equally or - * earlier ones are preferred. - * - * @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) - * @draft ICU 65 - */ -enum ULocMatchDemotion { - /** - * All desired locales are treated equally. - * - * @draft ICU 65 - */ - ULOCMATCH_DEMOTION_NONE, - /** - * Earlier desired locales are preferred. - * - * <p>From each desired locale to the next, - * the distance to any supported locale is increased by an additional amount - * which is at least as large as most region mismatches. - * A later desired locale has to have a better match with some supported locale - * due to more than merely having the same region subtag. - * - * <p>For example: <code>Supported={en, sv} desired=[en-GB, sv]</code> - * yields <code>Result(en-GB, en)</code> because - * with the demotion of sv its perfect match is no better than - * the region distance between the earlier desired locale en-GB and en=en-US. - * - * <p>Notes: - * <ul> - * <li>In some cases, language and/or script differences can be as small as - * the typical region difference. (Example: sr-Latn vs. sr-Cyrl) - * <li>It is possible for certain region differences to be larger than usual, - * and larger than the demotion. - * (As of CLDR 35 there is no such case, but - * this is possible in future versions of the data.) - * </ul> - * - * @draft ICU 65 - */ - ULOCMATCH_DEMOTION_REGION -}; -#ifndef U_IN_DOXYGEN -typedef enum ULocMatchDemotion ULocMatchDemotion; -#endif - -/** - * Builder option for whether to include or ignore one-way (fallback) match data. - * The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. - * Sometimes it is desirable to ignore those. - * - * <p>For example, consider a web application with the UI in a given language, - * with a link to another, related web app. - * The link should include the UI language, and the target server may also use - * the client’s Accept-Language header data. - * The target server has its own list of supported languages. - * One may want to favor UI language consistency, that is, - * if there is a decent match for the original UI language, we want to use it, - * but not if it is merely a fallback. - * - * @see Builder#setDirection(ULocMatchDirection) - * @draft ICU 67 - */ -enum ULocMatchDirection { - /** - * Locale matching includes one-way matches such as Breton→French. (default) - * - * @draft ICU 67 - */ - ULOCMATCH_DIRECTION_WITH_ONE_WAY, - /** - * Locale matching limited to two-way matches including e.g. Danish↔Norwegian - * but ignoring one-way matches. - * - * @draft ICU 67 - */ - ULOCMATCH_DIRECTION_ONLY_TWO_WAY -}; -#ifndef U_IN_DOXYGEN -typedef enum ULocMatchDirection ULocMatchDirection; -#endif - -struct UHashtable; - -U_NAMESPACE_BEGIN - -struct LSR; - -class LocaleDistance; -class LocaleLsrIterator; -class UVector; -class XLikelySubtags; - -/** - * Immutable class that picks the best match between a user's desired locales and - * an application's supported locales. - * Movable but not copyable. - * - * <p>Example: - * <pre> - * UErrorCode errorCode = U_ZERO_ERROR; - * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode); - * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode); // "en" - * </pre> - * - * <p>A matcher takes into account when languages are close to one another, - * such as Danish and Norwegian, - * and when regional variants are close, like en-GB and en-AU as opposed to en-US. - * - * <p>If there are multiple supported locales with the same (language, script, region) - * likely subtags, then the current implementation returns the first of those locales. - * It ignores variant subtags (except for pseudolocale variants) and extensions. - * This may change in future versions. - * - * <p>For example, the current implementation does not distinguish between - * de, de-DE, de-Latn, de-1901, de-u-co-phonebk. - * - * <p>If you prefer one equivalent locale over another, then provide only the preferred one, - * or place it earlier in the list of supported locales. - * - * <p>Otherwise, the order of supported locales may have no effect on the best-match results. - * The current implementation compares each desired locale with supported locales - * in the following order: - * 1. Default locale, if supported; - * 2. CLDR "paradigm locales" like en-GB and es-419; - * 3. other supported locales. - * This may change in future versions. - * - * <p>Often a product will just need one matcher instance, built with the languages - * that it supports. However, it may want multiple instances with different - * default languages based on additional information, such as the domain. - * - * <p>This class is not intended for public subclassing. - * - * @draft ICU 65 - */ -class U_COMMON_API LocaleMatcher : public UMemory { -public: - /** - * Data for the best-matching pair of a desired and a supported locale. - * Movable but not copyable. - * - * @draft ICU 65 - */ - class U_COMMON_API Result : public UMemory { - public: - /** - * Move constructor; might modify the source. - * This object will have the same contents that the source object had. - * - * @param src Result to move contents from. - * @draft ICU 65 - */ - Result(Result &&src) U_NOEXCEPT; - - /** - * Destructor. - * - * @draft ICU 65 - */ - ~Result(); - - /** - * Move assignment; might modify the source. - * This object will have the same contents that the source object had. - * - * @param src Result to move contents from. - * @draft ICU 65 - */ - Result &operator=(Result &&src) U_NOEXCEPT; - -#ifndef U_HIDE_DRAFT_API - /** - * Returns the best-matching desired locale. - * nullptr if the list of desired locales is empty or if none matched well enough. - * - * @return the best-matching desired locale, or nullptr. - * @draft ICU 65 - */ - inline const Locale *getDesiredLocale() const { return desiredLocale; } - - /** - * Returns the best-matching supported locale. - * If none matched well enough, this is the default locale. - * The default locale is nullptr if the list of supported locales is empty and - * no explicit default locale is set. - * - * @return the best-matching supported locale, or nullptr. - * @draft ICU 65 - */ - inline const Locale *getSupportedLocale() const { return supportedLocale; } - - /** - * Returns the index of the best-matching desired locale in the input Iterable order. - * -1 if the list of desired locales is empty or if none matched well enough. - * - * @return the index of the best-matching desired locale, or -1. - * @draft ICU 65 - */ - inline int32_t getDesiredIndex() const { return desiredIndex; } - - /** - * Returns the index of the best-matching supported locale in the - * constructor’s or builder’s input order (“set” Collection plus “added” locales). - * If the matcher was built from a locale list string, then the iteration order is that - * of a LocalePriorityList built from the same string. - * -1 if the list of supported locales is empty or if none matched well enough. - * - * @return the index of the best-matching supported locale, or -1. - * @draft ICU 65 - */ - inline int32_t getSupportedIndex() const { return supportedIndex; } - - /** - * Takes the best-matching supported locale and adds relevant fields of the - * best-matching desired locale, such as the -t- and -u- extensions. - * May replace some fields of the supported locale. - * The result is the locale that should be used for date and number formatting, collation, etc. - * Returns the root locale if getSupportedLocale() returns nullptr. - * - * <p>Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn - * - * @return a locale combining the best-matching desired and supported locales. - * @draft ICU 65 - */ - Locale makeResolvedLocale(UErrorCode &errorCode) const; -#endif // U_HIDE_DRAFT_API - - private: - Result(const Locale *desired, const Locale *supported, - int32_t desIndex, int32_t suppIndex, UBool owned) : - desiredLocale(desired), supportedLocale(supported), - desiredIndex(desIndex), supportedIndex(suppIndex), - desiredIsOwned(owned) {} - - Result(const Result &other) = delete; - Result &operator=(const Result &other) = delete; - - const Locale *desiredLocale; - const Locale *supportedLocale; - int32_t desiredIndex; - int32_t supportedIndex; - UBool desiredIsOwned; - - friend class LocaleMatcher; - }; - - /** - * LocaleMatcher builder. - * Movable but not copyable. - * - * @see LocaleMatcher#builder() - * @draft ICU 65 - */ - class U_COMMON_API Builder : public UMemory { - public: - /** - * Constructs a builder used in chaining parameters for building a LocaleMatcher. - * - * @return a new Builder object - * @draft ICU 65 - */ - Builder() {} - - /** - * Move constructor; might modify the source. - * This builder will have the same contents that the source builder had. - * - * @param src Builder to move contents from. - * @draft ICU 65 - */ - Builder(Builder &&src) U_NOEXCEPT; - - /** - * Destructor. - * - * @draft ICU 65 - */ - ~Builder(); - - /** - * Move assignment; might modify the source. - * This builder will have the same contents that the source builder had. - * - * @param src Builder to move contents from. - * @draft ICU 65 - */ - Builder &operator=(Builder &&src) U_NOEXCEPT; - -#ifndef U_HIDE_DRAFT_API - /** - * Parses an Accept-Language string - * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>), - * such as "af, en, fr;q=0.9", and sets the supported locales accordingly. - * Allows whitespace in more places but does not allow "*". - * Clears any previously set/added supported locales first. - * - * @param locales the Accept-Language string of locales to set - * @return this Builder object - * @draft ICU 65 - */ - Builder &setSupportedLocalesFromListString(StringPiece locales); - - /** - * Copies the supported locales, preserving iteration order. - * Clears any previously set/added supported locales first. - * Duplicates are allowed, and are not removed. - * - * @param locales the list of locale - * @return this Builder object - * @draft ICU 65 - */ - Builder &setSupportedLocales(Locale::Iterator &locales); - - /** - * Copies the supported locales from the begin/end range, preserving iteration order. - * Clears any previously set/added supported locales first. - * Duplicates are allowed, and are not removed. - * - * Each of the iterator parameter values must be an - * input iterator whose value is convertible to const Locale &. - * - * @param begin Start of range. - * @param end Exclusive end of range. - * @return this Builder object - * @draft ICU 65 - */ - template<typename Iter> - Builder &setSupportedLocales(Iter begin, Iter end) { - if (U_FAILURE(errorCode_)) { return *this; } - clearSupportedLocales(); - while (begin != end) { - addSupportedLocale(*begin++); - } - return *this; - } - - /** - * Copies the supported locales from the begin/end range, preserving iteration order. - * Calls the converter to convert each *begin to a Locale or const Locale &. - * Clears any previously set/added supported locales first. - * Duplicates are allowed, and are not removed. - * - * Each of the iterator parameter values must be an - * input iterator whose value is convertible to const Locale &. - * - * @param begin Start of range. - * @param end Exclusive end of range. - * @param converter Converter from *begin to const Locale & or compatible. - * @return this Builder object - * @draft ICU 65 - */ - template<typename Iter, typename Conv> - Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) { - if (U_FAILURE(errorCode_)) { return *this; } - clearSupportedLocales(); - while (begin != end) { - addSupportedLocale(converter(*begin++)); - } - return *this; - } - - /** - * Adds another supported locale. - * Duplicates are allowed, and are not removed. - * - * @param locale another locale - * @return this Builder object - * @draft ICU 65 - */ - Builder &addSupportedLocale(const Locale &locale); - - /** - * Sets the default locale; if nullptr, or if it is not set explicitly, - * then the first supported locale is used as the default locale. - * - * @param defaultLocale the default locale (will be copied) - * @return this Builder object - * @draft ICU 65 - */ - Builder &setDefaultLocale(const Locale *defaultLocale); - - /** - * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script - * differences. - * This is used in situations (such as maps) where - * it is better to fall back to the same script than a similar language. - * - * @param subtag the subtag to favor - * @return this Builder object - * @draft ICU 65 - */ - Builder &setFavorSubtag(ULocMatchFavorSubtag subtag); - - /** - * Option for whether all desired locales are treated equally or - * earlier ones are preferred (this is the default). - * - * @param demotion the demotion per desired locale to set. - * @return this Builder object - * @draft ICU 65 - */ - Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion); - - /** - * Option for whether to include or ignore one-way (fallback) match data. - * By default, they are included. - * - * @param direction the match direction to set. - * @return this Builder object - * @draft ICU 67 - */ - Builder &setDirection(ULocMatchDirection direction) { - if (U_SUCCESS(errorCode_)) { - direction_ = direction; - } - return *this; - } - - /** - * Sets the UErrorCode if an error occurred while setting parameters. - * Preserves older error codes in the outErrorCode. - * - * @param outErrorCode Set to an error code if it does not contain one already - * and an error occurred while setting parameters. - * Otherwise unchanged. - * @return TRUE if U_FAILURE(outErrorCode) - * @draft ICU 65 - */ - UBool copyErrorTo(UErrorCode &outErrorCode) const; - - /** - * Builds and returns a new locale matcher. - * This builder can continue to be used. - * - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return new LocaleMatcher. - * @draft ICU 65 - */ - LocaleMatcher build(UErrorCode &errorCode) const; -#endif // U_HIDE_DRAFT_API - - private: - friend class LocaleMatcher; - - Builder(const Builder &other) = delete; - Builder &operator=(const Builder &other) = delete; - - void clearSupportedLocales(); - bool ensureSupportedLocaleVector(); - - UErrorCode errorCode_ = U_ZERO_ERROR; - UVector *supportedLocales_ = nullptr; - int32_t thresholdDistance_ = -1; - ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION; - Locale *defaultLocale_ = nullptr; - ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE; - ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY; - }; - - // FYI No public LocaleMatcher constructors in C++; use the Builder. - - /** - * Move copy constructor; might modify the source. - * This matcher will have the same settings that the source matcher had. - * @param src source matcher - * @draft ICU 65 - */ - LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT; - - /** - * Destructor. - * @draft ICU 65 - */ - ~LocaleMatcher(); - - /** - * Move assignment operator; might modify the source. - * This matcher will have the same settings that the source matcher had. - * The behavior is undefined if *this and src are the same object. - * @param src source matcher - * @return *this - * @draft ICU 65 - */ - LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT; - -#ifndef U_HIDE_DRAFT_API - /** - * Returns the supported locale which best matches the desired locale. - * - * @param desiredLocale Typically a user's language. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return the best-matching supported locale. - * @draft ICU 65 - */ - const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const; - - /** - * Returns the supported locale which best matches one of the desired locales. - * - * @param desiredLocales Typically a user's languages, in order of preference (descending). - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return the best-matching supported locale. - * @draft ICU 65 - */ - const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; - - /** - * Parses an Accept-Language string - * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>), - * such as "af, en, fr;q=0.9", - * and returns the supported locale which best matches one of the desired locales. - * Allows whitespace in more places but does not allow "*". - * - * @param desiredLocaleList Typically a user's languages, as an Accept-Language string. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return the best-matching supported locale. - * @draft ICU 65 - */ - const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const; - - /** - * Returns the best match between the desired locale and the supported locales. - * If the result's desired locale is not nullptr, then it is the address of the input locale. - * It has not been cloned. - * - * @param desiredLocale Typically a user's language. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return the best-matching pair of the desired and a supported locale. - * @draft ICU 65 - */ - Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const; - - /** - * Returns the best match between the desired and supported locales. - * If the result's desired locale is not nullptr, then it is a clone of - * the best-matching desired locale. The Result object owns the clone. - * - * @param desiredLocales Typically a user's languages, in order of preference (descending). - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return the best-matching pair of a desired and a supported locale. - * @draft ICU 65 - */ - Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_INTERNAL_API - /** - * Returns a fraction between 0 and 1, where 1 means that the languages are a - * perfect match, and 0 means that they are completely different. - * - * <p>This is mostly an implementation detail, and the precise values may change over time. - * The implementation may use either the maximized forms or the others ones, or both. - * The implementation may or may not rely on the forms to be consistent with each other. - * - * <p>Callers should construct and use a matcher rather than match pairs of locales directly. - * - * @param desired Desired locale. - * @param supported Supported locale. - * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) - * @return value between 0 and 1, inclusive. - * @internal (has a known user) - */ - double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; -#endif // U_HIDE_INTERNAL_API - -private: - LocaleMatcher(const Builder &builder, UErrorCode &errorCode); - LocaleMatcher(const LocaleMatcher &other) = delete; - LocaleMatcher &operator=(const LocaleMatcher &other) = delete; - - int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode); - - int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const; - - const XLikelySubtags &likelySubtags; - const LocaleDistance &localeDistance; - int32_t thresholdDistance; - int32_t demotionPerDesiredLocale; - ULocMatchFavorSubtag favorSubtag; - ULocMatchDirection direction; - - // These are in input order. - const Locale ** supportedLocales; - LSR *lsrs; - int32_t supportedLocalesLength; - // These are in preference order: 1. Default locale 2. paradigm locales 3. others. - UHashtable *supportedLsrToIndex; // Map<LSR, Integer> stores index+1 because 0 is "not found" - // Array versions of the supportedLsrToIndex keys and values. - // The distance lookup loops over the supportedLSRs and returns the index of the best match. - const LSR **supportedLSRs; - int32_t *supportedIndexes; - int32_t supportedLSRsLength; - Locale *ownedDefaultLocale; - const Locale *defaultLocale; -}; - -U_NAMESPACE_END - -#endif // U_FORCE_HIDE_DRAFT_API -#endif // U_SHOW_CPLUSPLUS_API -#endif // __LOCALEMATCHER_H__ +// © 2019 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html#License + +// localematcher.h +// created: 2019may08 Markus W. Scherer + +#ifndef __LOCALEMATCHER_H__ +#define __LOCALEMATCHER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/locid.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales. + */ + +#ifndef U_FORCE_HIDE_DRAFT_API + +/** + * Builder option for whether the language subtag or the script subtag is most important. + * + * @see Builder#setFavorSubtag(ULocMatchFavorSubtag) + * @draft ICU 65 + */ +enum ULocMatchFavorSubtag { + /** + * Language differences are most important, then script differences, then region differences. + * (This is the default behavior.) + * + * @draft ICU 65 + */ + ULOCMATCH_FAVOR_LANGUAGE, + /** + * Makes script differences matter relatively more than language differences. + * + * @draft ICU 65 + */ + ULOCMATCH_FAVOR_SCRIPT +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag; +#endif + +/** + * Builder option for whether all desired locales are treated equally or + * earlier ones are preferred. + * + * @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion) + * @draft ICU 65 + */ +enum ULocMatchDemotion { + /** + * All desired locales are treated equally. + * + * @draft ICU 65 + */ + ULOCMATCH_DEMOTION_NONE, + /** + * Earlier desired locales are preferred. + * + * <p>From each desired locale to the next, + * the distance to any supported locale is increased by an additional amount + * which is at least as large as most region mismatches. + * A later desired locale has to have a better match with some supported locale + * due to more than merely having the same region subtag. + * + * <p>For example: <code>Supported={en, sv} desired=[en-GB, sv]</code> + * yields <code>Result(en-GB, en)</code> because + * with the demotion of sv its perfect match is no better than + * the region distance between the earlier desired locale en-GB and en=en-US. + * + * <p>Notes: + * <ul> + * <li>In some cases, language and/or script differences can be as small as + * the typical region difference. (Example: sr-Latn vs. sr-Cyrl) + * <li>It is possible for certain region differences to be larger than usual, + * and larger than the demotion. + * (As of CLDR 35 there is no such case, but + * this is possible in future versions of the data.) + * </ul> + * + * @draft ICU 65 + */ + ULOCMATCH_DEMOTION_REGION +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchDemotion ULocMatchDemotion; +#endif + +/** + * Builder option for whether to include or ignore one-way (fallback) match data. + * The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. + * Sometimes it is desirable to ignore those. + * + * <p>For example, consider a web application with the UI in a given language, + * with a link to another, related web app. + * The link should include the UI language, and the target server may also use + * the client’s Accept-Language header data. + * The target server has its own list of supported languages. + * One may want to favor UI language consistency, that is, + * if there is a decent match for the original UI language, we want to use it, + * but not if it is merely a fallback. + * + * @see Builder#setDirection(ULocMatchDirection) + * @draft ICU 67 + */ +enum ULocMatchDirection { + /** + * Locale matching includes one-way matches such as Breton→French. (default) + * + * @draft ICU 67 + */ + ULOCMATCH_DIRECTION_WITH_ONE_WAY, + /** + * Locale matching limited to two-way matches including e.g. Danish↔Norwegian + * but ignoring one-way matches. + * + * @draft ICU 67 + */ + ULOCMATCH_DIRECTION_ONLY_TWO_WAY +}; +#ifndef U_IN_DOXYGEN +typedef enum ULocMatchDirection ULocMatchDirection; +#endif + +struct UHashtable; + +U_NAMESPACE_BEGIN + +struct LSR; + +class LocaleDistance; +class LocaleLsrIterator; +class UVector; +class XLikelySubtags; + +/** + * Immutable class that picks the best match between a user's desired locales and + * an application's supported locales. + * Movable but not copyable. + * + * <p>Example: + * <pre> + * UErrorCode errorCode = U_ZERO_ERROR; + * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode); + * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode); // "en" + * </pre> + * + * <p>A matcher takes into account when languages are close to one another, + * such as Danish and Norwegian, + * and when regional variants are close, like en-GB and en-AU as opposed to en-US. + * + * <p>If there are multiple supported locales with the same (language, script, region) + * likely subtags, then the current implementation returns the first of those locales. + * It ignores variant subtags (except for pseudolocale variants) and extensions. + * This may change in future versions. + * + * <p>For example, the current implementation does not distinguish between + * de, de-DE, de-Latn, de-1901, de-u-co-phonebk. + * + * <p>If you prefer one equivalent locale over another, then provide only the preferred one, + * or place it earlier in the list of supported locales. + * + * <p>Otherwise, the order of supported locales may have no effect on the best-match results. + * The current implementation compares each desired locale with supported locales + * in the following order: + * 1. Default locale, if supported; + * 2. CLDR "paradigm locales" like en-GB and es-419; + * 3. other supported locales. + * This may change in future versions. + * + * <p>Often a product will just need one matcher instance, built with the languages + * that it supports. However, it may want multiple instances with different + * default languages based on additional information, such as the domain. + * + * <p>This class is not intended for public subclassing. + * + * @draft ICU 65 + */ +class U_COMMON_API LocaleMatcher : public UMemory { +public: + /** + * Data for the best-matching pair of a desired and a supported locale. + * Movable but not copyable. + * + * @draft ICU 65 + */ + class U_COMMON_API Result : public UMemory { + public: + /** + * Move constructor; might modify the source. + * This object will have the same contents that the source object had. + * + * @param src Result to move contents from. + * @draft ICU 65 + */ + Result(Result &&src) U_NOEXCEPT; + + /** + * Destructor. + * + * @draft ICU 65 + */ + ~Result(); + + /** + * Move assignment; might modify the source. + * This object will have the same contents that the source object had. + * + * @param src Result to move contents from. + * @draft ICU 65 + */ + Result &operator=(Result &&src) U_NOEXCEPT; + +#ifndef U_HIDE_DRAFT_API + /** + * Returns the best-matching desired locale. + * nullptr if the list of desired locales is empty or if none matched well enough. + * + * @return the best-matching desired locale, or nullptr. + * @draft ICU 65 + */ + inline const Locale *getDesiredLocale() const { return desiredLocale; } + + /** + * Returns the best-matching supported locale. + * If none matched well enough, this is the default locale. + * The default locale is nullptr if the list of supported locales is empty and + * no explicit default locale is set. + * + * @return the best-matching supported locale, or nullptr. + * @draft ICU 65 + */ + inline const Locale *getSupportedLocale() const { return supportedLocale; } + + /** + * Returns the index of the best-matching desired locale in the input Iterable order. + * -1 if the list of desired locales is empty or if none matched well enough. + * + * @return the index of the best-matching desired locale, or -1. + * @draft ICU 65 + */ + inline int32_t getDesiredIndex() const { return desiredIndex; } + + /** + * Returns the index of the best-matching supported locale in the + * constructor’s or builder’s input order (“set” Collection plus “added” locales). + * If the matcher was built from a locale list string, then the iteration order is that + * of a LocalePriorityList built from the same string. + * -1 if the list of supported locales is empty or if none matched well enough. + * + * @return the index of the best-matching supported locale, or -1. + * @draft ICU 65 + */ + inline int32_t getSupportedIndex() const { return supportedIndex; } + + /** + * Takes the best-matching supported locale and adds relevant fields of the + * best-matching desired locale, such as the -t- and -u- extensions. + * May replace some fields of the supported locale. + * The result is the locale that should be used for date and number formatting, collation, etc. + * Returns the root locale if getSupportedLocale() returns nullptr. + * + * <p>Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn + * + * @return a locale combining the best-matching desired and supported locales. + * @draft ICU 65 + */ + Locale makeResolvedLocale(UErrorCode &errorCode) const; +#endif // U_HIDE_DRAFT_API + + private: + Result(const Locale *desired, const Locale *supported, + int32_t desIndex, int32_t suppIndex, UBool owned) : + desiredLocale(desired), supportedLocale(supported), + desiredIndex(desIndex), supportedIndex(suppIndex), + desiredIsOwned(owned) {} + + Result(const Result &other) = delete; + Result &operator=(const Result &other) = delete; + + const Locale *desiredLocale; + const Locale *supportedLocale; + int32_t desiredIndex; + int32_t supportedIndex; + UBool desiredIsOwned; + + friend class LocaleMatcher; + }; + + /** + * LocaleMatcher builder. + * Movable but not copyable. + * + * @see LocaleMatcher#builder() + * @draft ICU 65 + */ + class U_COMMON_API Builder : public UMemory { + public: + /** + * Constructs a builder used in chaining parameters for building a LocaleMatcher. + * + * @return a new Builder object + * @draft ICU 65 + */ + Builder() {} + + /** + * Move constructor; might modify the source. + * This builder will have the same contents that the source builder had. + * + * @param src Builder to move contents from. + * @draft ICU 65 + */ + Builder(Builder &&src) U_NOEXCEPT; + + /** + * Destructor. + * + * @draft ICU 65 + */ + ~Builder(); + + /** + * Move assignment; might modify the source. + * This builder will have the same contents that the source builder had. + * + * @param src Builder to move contents from. + * @draft ICU 65 + */ + Builder &operator=(Builder &&src) U_NOEXCEPT; + +#ifndef U_HIDE_DRAFT_API + /** + * Parses an Accept-Language string + * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>), + * such as "af, en, fr;q=0.9", and sets the supported locales accordingly. + * Allows whitespace in more places but does not allow "*". + * Clears any previously set/added supported locales first. + * + * @param locales the Accept-Language string of locales to set + * @return this Builder object + * @draft ICU 65 + */ + Builder &setSupportedLocalesFromListString(StringPiece locales); + + /** + * Copies the supported locales, preserving iteration order. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * @param locales the list of locale + * @return this Builder object + * @draft ICU 65 + */ + Builder &setSupportedLocales(Locale::Iterator &locales); + + /** + * Copies the supported locales from the begin/end range, preserving iteration order. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @return this Builder object + * @draft ICU 65 + */ + template<typename Iter> + Builder &setSupportedLocales(Iter begin, Iter end) { + if (U_FAILURE(errorCode_)) { return *this; } + clearSupportedLocales(); + while (begin != end) { + addSupportedLocale(*begin++); + } + return *this; + } + + /** + * Copies the supported locales from the begin/end range, preserving iteration order. + * Calls the converter to convert each *begin to a Locale or const Locale &. + * Clears any previously set/added supported locales first. + * Duplicates are allowed, and are not removed. + * + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @param converter Converter from *begin to const Locale & or compatible. + * @return this Builder object + * @draft ICU 65 + */ + template<typename Iter, typename Conv> + Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) { + if (U_FAILURE(errorCode_)) { return *this; } + clearSupportedLocales(); + while (begin != end) { + addSupportedLocale(converter(*begin++)); + } + return *this; + } + + /** + * Adds another supported locale. + * Duplicates are allowed, and are not removed. + * + * @param locale another locale + * @return this Builder object + * @draft ICU 65 + */ + Builder &addSupportedLocale(const Locale &locale); + + /** + * Sets the default locale; if nullptr, or if it is not set explicitly, + * then the first supported locale is used as the default locale. + * + * @param defaultLocale the default locale (will be copied) + * @return this Builder object + * @draft ICU 65 + */ + Builder &setDefaultLocale(const Locale *defaultLocale); + + /** + * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script + * differences. + * This is used in situations (such as maps) where + * it is better to fall back to the same script than a similar language. + * + * @param subtag the subtag to favor + * @return this Builder object + * @draft ICU 65 + */ + Builder &setFavorSubtag(ULocMatchFavorSubtag subtag); + + /** + * Option for whether all desired locales are treated equally or + * earlier ones are preferred (this is the default). + * + * @param demotion the demotion per desired locale to set. + * @return this Builder object + * @draft ICU 65 + */ + Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion); + + /** + * Option for whether to include or ignore one-way (fallback) match data. + * By default, they are included. + * + * @param direction the match direction to set. + * @return this Builder object + * @draft ICU 67 + */ + Builder &setDirection(ULocMatchDirection direction) { + if (U_SUCCESS(errorCode_)) { + direction_ = direction; + } + return *this; + } + + /** + * Sets the UErrorCode if an error occurred while setting parameters. + * Preserves older error codes in the outErrorCode. + * + * @param outErrorCode Set to an error code if it does not contain one already + * and an error occurred while setting parameters. + * Otherwise unchanged. + * @return TRUE if U_FAILURE(outErrorCode) + * @draft ICU 65 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const; + + /** + * Builds and returns a new locale matcher. + * This builder can continue to be used. + * + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return new LocaleMatcher. + * @draft ICU 65 + */ + LocaleMatcher build(UErrorCode &errorCode) const; +#endif // U_HIDE_DRAFT_API + + private: + friend class LocaleMatcher; + + Builder(const Builder &other) = delete; + Builder &operator=(const Builder &other) = delete; + + void clearSupportedLocales(); + bool ensureSupportedLocaleVector(); + + UErrorCode errorCode_ = U_ZERO_ERROR; + UVector *supportedLocales_ = nullptr; + int32_t thresholdDistance_ = -1; + ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION; + Locale *defaultLocale_ = nullptr; + ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE; + ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY; + }; + + // FYI No public LocaleMatcher constructors in C++; use the Builder. + + /** + * Move copy constructor; might modify the source. + * This matcher will have the same settings that the source matcher had. + * @param src source matcher + * @draft ICU 65 + */ + LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT; + + /** + * Destructor. + * @draft ICU 65 + */ + ~LocaleMatcher(); + + /** + * Move assignment operator; might modify the source. + * This matcher will have the same settings that the source matcher had. + * The behavior is undefined if *this and src are the same object. + * @param src source matcher + * @return *this + * @draft ICU 65 + */ + LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT; + +#ifndef U_HIDE_DRAFT_API + /** + * Returns the supported locale which best matches the desired locale. + * + * @param desiredLocale Typically a user's language. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @draft ICU 65 + */ + const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const; + + /** + * Returns the supported locale which best matches one of the desired locales. + * + * @param desiredLocales Typically a user's languages, in order of preference (descending). + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @draft ICU 65 + */ + const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; + + /** + * Parses an Accept-Language string + * (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>), + * such as "af, en, fr;q=0.9", + * and returns the supported locale which best matches one of the desired locales. + * Allows whitespace in more places but does not allow "*". + * + * @param desiredLocaleList Typically a user's languages, as an Accept-Language string. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching supported locale. + * @draft ICU 65 + */ + const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const; + + /** + * Returns the best match between the desired locale and the supported locales. + * If the result's desired locale is not nullptr, then it is the address of the input locale. + * It has not been cloned. + * + * @param desiredLocale Typically a user's language. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching pair of the desired and a supported locale. + * @draft ICU 65 + */ + Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const; + + /** + * Returns the best match between the desired and supported locales. + * If the result's desired locale is not nullptr, then it is a clone of + * the best-matching desired locale. The Result object owns the clone. + * + * @param desiredLocales Typically a user's languages, in order of preference (descending). + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return the best-matching pair of a desired and a supported locale. + * @draft ICU 65 + */ + Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const; +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + /** + * Returns a fraction between 0 and 1, where 1 means that the languages are a + * perfect match, and 0 means that they are completely different. + * + * <p>This is mostly an implementation detail, and the precise values may change over time. + * The implementation may use either the maximized forms or the others ones, or both. + * The implementation may or may not rely on the forms to be consistent with each other. + * + * <p>Callers should construct and use a matcher rather than match pairs of locales directly. + * + * @param desired Desired locale. + * @param supported Supported locale. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return value between 0 and 1, inclusive. + * @internal (has a known user) + */ + double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const; +#endif // U_HIDE_INTERNAL_API + +private: + LocaleMatcher(const Builder &builder, UErrorCode &errorCode); + LocaleMatcher(const LocaleMatcher &other) = delete; + LocaleMatcher &operator=(const LocaleMatcher &other) = delete; + + int32_t putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength, UErrorCode &errorCode); + + int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const; + + const XLikelySubtags &likelySubtags; + const LocaleDistance &localeDistance; + int32_t thresholdDistance; + int32_t demotionPerDesiredLocale; + ULocMatchFavorSubtag favorSubtag; + ULocMatchDirection direction; + + // These are in input order. + const Locale ** supportedLocales; + LSR *lsrs; + int32_t supportedLocalesLength; + // These are in preference order: 1. Default locale 2. paradigm locales 3. others. + UHashtable *supportedLsrToIndex; // Map<LSR, Integer> stores index+1 because 0 is "not found" + // Array versions of the supportedLsrToIndex keys and values. + // The distance lookup loops over the supportedLSRs and returns the index of the best match. + const LSR **supportedLSRs; + int32_t *supportedIndexes; + int32_t supportedLSRsLength; + Locale *ownedDefaultLocale; + const Locale *defaultLocale; +}; + +U_NAMESPACE_END + +#endif // U_FORCE_HIDE_DRAFT_API +#endif // U_SHOW_CPLUSPLUS_API +#endif // __LOCALEMATCHER_H__ diff --git a/contrib/libs/icu/include/unicode/localpointer.h b/contrib/libs/icu/include/unicode/localpointer.h index 61c3020918..7985a56ba2 100644 --- a/contrib/libs/icu/include/unicode/localpointer.h +++ b/contrib/libs/icu/include/unicode/localpointer.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: localpointer.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -42,8 +42,8 @@ #if U_SHOW_CPLUSPLUS_API -#include <memory> - +#include <memory> + U_NAMESPACE_BEGIN /** @@ -67,13 +67,13 @@ U_NAMESPACE_BEGIN template<typename T> class LocalPointerBase { public: - // No heap allocation. Use only on the stack. - static void* U_EXPORT2 operator new(size_t) = delete; - static void* U_EXPORT2 operator new[](size_t) = delete; -#if U_HAVE_PLACEMENT_NEW - static void* U_EXPORT2 operator new(size_t, void*) = delete; -#endif - + // No heap allocation. Use only on the stack. + static void* U_EXPORT2 operator new(size_t) = delete; + static void* U_EXPORT2 operator new[](size_t) = delete; +#if U_HAVE_PLACEMENT_NEW + static void* U_EXPORT2 operator new(size_t, void*) = delete; +#endif + /** * Constructor takes ownership. * @param p simple pointer to an object that is adopted @@ -177,9 +177,9 @@ private: * \code * LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005)); * int32_t length=s->length(); // 2 - * char16_t lead=s->charAt(0); // 0xd900 + * char16_t lead=s->charAt(0); // 0xd900 * if(some condition) { return; } // no need to explicitly delete the pointer - * s.adoptInstead(new UnicodeString((char16_t)0xfffc)); + * s.adoptInstead(new UnicodeString((char16_t)0xfffc)); * length=s->length(); // 1 * // no need to explicitly delete the pointer * \endcode @@ -224,21 +224,21 @@ public: LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) { src.ptr=NULL; } - - /** - * Constructs a LocalPointer from a C++11 std::unique_ptr. - * The LocalPointer steals the object owned by the std::unique_ptr. - * - * This constructor works via move semantics. If your std::unique_ptr is - * in a local variable, you must use std::move. - * - * @param p The std::unique_ptr from which the pointer will be stolen. - * @stable ICU 64 - */ - explicit LocalPointer(std::unique_ptr<T> &&p) - : LocalPointerBase<T>(p.release()) {} - - /** + + /** + * Constructs a LocalPointer from a C++11 std::unique_ptr. + * The LocalPointer steals the object owned by the std::unique_ptr. + * + * This constructor works via move semantics. If your std::unique_ptr is + * in a local variable, you must use std::move. + * + * @param p The std::unique_ptr from which the pointer will be stolen. + * @stable ICU 64 + */ + explicit LocalPointer(std::unique_ptr<T> &&p) + : LocalPointerBase<T>(p.release()) {} + + /** * Destructor deletes the object it owns. * @stable ICU 4.4 */ @@ -253,25 +253,25 @@ public: * @stable ICU 56 */ LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT { - delete LocalPointerBase<T>::ptr; - LocalPointerBase<T>::ptr=src.ptr; - src.ptr=NULL; - return *this; + delete LocalPointerBase<T>::ptr; + LocalPointerBase<T>::ptr=src.ptr; + src.ptr=NULL; + return *this; } - + /** - * Move-assign from an std::unique_ptr to this LocalPointer. - * Steals the pointer from the std::unique_ptr. + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the pointer from the std::unique_ptr. * - * @param p The std::unique_ptr from which the pointer will be stolen. + * @param p The std::unique_ptr from which the pointer will be stolen. * @return *this - * @stable ICU 64 + * @stable ICU 64 */ - LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT { - adoptInstead(p.release()); + LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT { + adoptInstead(p.release()); return *this; } - + /** * Swap pointers. * @param other other smart pointer @@ -327,21 +327,21 @@ public: delete p; } } - - /** - * Conversion operator to a C++11 std::unique_ptr. - * Disowns the object and gives it to the returned std::unique_ptr. - * - * This operator works via move semantics. If your LocalPointer is - * in a local variable, you must use std::move. - * - * @return An std::unique_ptr owning the pointer previously owned by this - * icu::LocalPointer. - * @stable ICU 64 - */ - operator std::unique_ptr<T> () && { - return std::unique_ptr<T>(LocalPointerBase<T>::orphan()); - } + + /** + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. + * + * This operator works via move semantics. If your LocalPointer is + * in a local variable, you must use std::move. + * + * @return An std::unique_ptr owning the pointer previously owned by this + * icu::LocalPointer. + * @stable ICU 64 + */ + operator std::unique_ptr<T> () && { + return std::unique_ptr<T>(LocalPointerBase<T>::orphan()); + } }; /** @@ -352,10 +352,10 @@ public: * Usage example: * \code * LocalArray<UnicodeString> a(new UnicodeString[2]); - * a[0].append((char16_t)0x61); + * a[0].append((char16_t)0x61); * if(some condition) { return; } // no need to explicitly delete the array * a.adoptInstead(new UnicodeString[4]); - * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse(); + * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse(); * // no need to explicitly delete the array * \endcode * @@ -399,21 +399,21 @@ public: LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) { src.ptr=NULL; } - - /** - * Constructs a LocalArray from a C++11 std::unique_ptr of an array type. - * The LocalPointer steals the array owned by the std::unique_ptr. - * - * This constructor works via move semantics. If your std::unique_ptr is - * in a local variable, you must use std::move. - * - * @param p The std::unique_ptr from which the array will be stolen. - * @stable ICU 64 - */ - explicit LocalArray(std::unique_ptr<T[]> &&p) - : LocalPointerBase<T>(p.release()) {} - - /** + + /** + * Constructs a LocalArray from a C++11 std::unique_ptr of an array type. + * The LocalPointer steals the array owned by the std::unique_ptr. + * + * This constructor works via move semantics. If your std::unique_ptr is + * in a local variable, you must use std::move. + * + * @param p The std::unique_ptr from which the array will be stolen. + * @stable ICU 64 + */ + explicit LocalArray(std::unique_ptr<T[]> &&p) + : LocalPointerBase<T>(p.release()) {} + + /** * Destructor deletes the array it owns. * @stable ICU 4.4 */ @@ -428,25 +428,25 @@ public: * @stable ICU 56 */ LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT { - delete[] LocalPointerBase<T>::ptr; - LocalPointerBase<T>::ptr=src.ptr; - src.ptr=NULL; - return *this; + delete[] LocalPointerBase<T>::ptr; + LocalPointerBase<T>::ptr=src.ptr; + src.ptr=NULL; + return *this; } - + /** - * Move-assign from an std::unique_ptr to this LocalPointer. - * Steals the array from the std::unique_ptr. + * Move-assign from an std::unique_ptr to this LocalPointer. + * Steals the array from the std::unique_ptr. * - * @param p The std::unique_ptr from which the array will be stolen. + * @param p The std::unique_ptr from which the array will be stolen. * @return *this - * @stable ICU 64 + * @stable ICU 64 */ - LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT { - adoptInstead(p.release()); + LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT { + adoptInstead(p.release()); return *this; } - + /** * Swap pointers. * @param other other smart pointer @@ -510,21 +510,21 @@ public: * @stable ICU 4.4 */ T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; } - - /** - * Conversion operator to a C++11 std::unique_ptr. - * Disowns the object and gives it to the returned std::unique_ptr. - * - * This operator works via move semantics. If your LocalPointer is - * in a local variable, you must use std::move. - * - * @return An std::unique_ptr owning the pointer previously owned by this - * icu::LocalPointer. - * @stable ICU 64 - */ - operator std::unique_ptr<T[]> () && { - return std::unique_ptr<T[]>(LocalPointerBase<T>::orphan()); - } + + /** + * Conversion operator to a C++11 std::unique_ptr. + * Disowns the object and gives it to the returned std::unique_ptr. + * + * This operator works via move semantics. If your LocalPointer is + * in a local variable, you must use std::move. + * + * @return An std::unique_ptr owning the pointer previously owned by this + * icu::LocalPointer. + * @stable ICU 64 + */ + operator std::unique_ptr<T[]> () && { + return std::unique_ptr<T[]>(LocalPointerBase<T>::orphan()); + } }; /** @@ -557,9 +557,9 @@ public: : LocalPointerBase<Type>(src.ptr) { \ src.ptr=NULL; \ } \ - /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ - explicit LocalPointerClassName(std::unique_ptr<Type, decltype(&closeFunction)> &&p) \ - : LocalPointerBase<Type>(p.release()) {} \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ + explicit LocalPointerClassName(std::unique_ptr<Type, decltype(&closeFunction)> &&p) \ + : LocalPointerBase<Type>(p.release()) {} \ ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \ LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \ if (ptr != NULL) { closeFunction(ptr); } \ @@ -567,9 +567,9 @@ public: src.ptr=NULL; \ return *this; \ } \ - /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ - LocalPointerClassName &operator=(std::unique_ptr<Type, decltype(&closeFunction)> &&p) { \ - adoptInstead(p.release()); \ + /* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \ + LocalPointerClassName &operator=(std::unique_ptr<Type, decltype(&closeFunction)> &&p) { \ + adoptInstead(p.release()); \ return *this; \ } \ void swap(LocalPointerClassName &other) U_NOEXCEPT { \ @@ -584,9 +584,9 @@ public: if (ptr != NULL) { closeFunction(ptr); } \ ptr=p; \ } \ - operator std::unique_ptr<Type, decltype(&closeFunction)> () && { \ - return std::unique_ptr<Type, decltype(&closeFunction)>(LocalPointerBase<Type>::orphan(), closeFunction); \ - } \ + operator std::unique_ptr<Type, decltype(&closeFunction)> () && { \ + return std::unique_ptr<Type, decltype(&closeFunction)>(LocalPointerBase<Type>::orphan(), closeFunction); \ + } \ } U_NAMESPACE_END diff --git a/contrib/libs/icu/include/unicode/locdspnm.h b/contrib/libs/icu/include/unicode/locdspnm.h index 4f06f85704..f3e1143d5c 100644 --- a/contrib/libs/icu/include/unicode/locdspnm.h +++ b/contrib/libs/icu/include/unicode/locdspnm.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -12,8 +12,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Provides display names of Locale and its components. @@ -22,7 +22,7 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/locid.h" -#include "unicode/strenum.h" +#include "unicode/strenum.h" #include "unicode/uscript.h" #include "unicode/uldnames.h" #include "unicode/udisplaycontext.h" @@ -51,7 +51,7 @@ public: * @return a LocaleDisplayNames instance * @stable ICU 4.4 */ - inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale); + inline static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale); /** * Returns an instance of LocaleDisplayNames that returns names @@ -206,6 +206,6 @@ U_NAMESPACE_END #endif -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/locid.h b/contrib/libs/icu/include/unicode/locid.h index 1d031daabc..82e3342e80 100644 --- a/contrib/libs/icu/include/unicode/locid.h +++ b/contrib/libs/icu/include/unicode/locid.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -32,13 +32,13 @@ #define LOCID_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/bytestream.h" -#include "unicode/localpointer.h" -#include "unicode/strenum.h" -#include "unicode/stringpiece.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/bytestream.h" +#include "unicode/localpointer.h" +#include "unicode/strenum.h" +#include "unicode/stringpiece.h" #include "unicode/uobject.h" #include "unicode/putil.h" #include "unicode/uloc.h" @@ -53,9 +53,9 @@ U_NAMESPACE_BEGIN // Forward Declarations void U_CALLCONV locale_available_init(); /**< @internal */ -class StringEnumeration; -class UnicodeString; - +class StringEnumeration; +class UnicodeString; + /** * A <code>Locale</code> object represents a specific geographical, political, * or cultural region. An operation that requires a <code>Locale</code> to perform @@ -95,7 +95,7 @@ class UnicodeString; * <P> * The third constructor requires a third argument--the <STRONG>Variant.</STRONG> * The Variant codes are vendor and browser-specific. - * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX. + * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX. * Where there are two variants, separate them with an underscore, and * put the most important one first. For * example, a Traditional Spanish collation might be referenced, with @@ -287,14 +287,14 @@ public: */ Locale(const Locale& other); - /** - * Move constructor; might leave source in bogus state. - * This locale will have the same contents that the source locale had. - * - * @param other The Locale object being moved in. - * @stable ICU 63 - */ - Locale(Locale&& other) U_NOEXCEPT; + /** + * Move constructor; might leave source in bogus state. + * This locale will have the same contents that the source locale had. + * + * @param other The Locale object being moved in. + * @stable ICU 63 + */ + Locale(Locale&& other) U_NOEXCEPT; /** * Destructor @@ -312,17 +312,17 @@ public: Locale& operator=(const Locale& other); /** - * Move assignment operator; might leave source in bogus state. - * This locale will have the same contents that the source locale had. - * The behavior is undefined if *this and the source are the same object. - * - * @param other The Locale object being moved in. - * @return *this - * @stable ICU 63 - */ - Locale& operator=(Locale&& other) U_NOEXCEPT; - - /** + * Move assignment operator; might leave source in bogus state. + * This locale will have the same contents that the source locale had. + * The behavior is undefined if *this and the source are the same object. + * + * @param other The Locale object being moved in. + * @return *this + * @stable ICU 63 + */ + Locale& operator=(Locale&& other) U_NOEXCEPT; + + /** * Checks if two locale keys are the same. * * @param other The locale key object to be compared with this. @@ -339,7 +339,7 @@ public: * otherwise. * @stable ICU 2.0 */ - inline UBool operator!=(const Locale& other) const; + inline UBool operator!=(const Locale& other) const; /** * Clone this object. @@ -379,7 +379,7 @@ public: * the default locale ID of the runtime environment. * * @param newLocale Locale to set to. If NULL, set to the value obtained - * from the runtime environment. + * from the runtime environment. * @param success The error code. * @system * @stable ICU 2.0 @@ -389,53 +389,53 @@ public: #endif /* U_HIDE_SYSTEM_API */ /** - * Returns a Locale for the specified BCP47 language tag string. - * If the specified language tag contains any ill-formed subtags, - * the first such subtag and all following subtags are ignored. - * <p> - * This implements the 'Language-Tag' production of BCP47, and so - * supports grandfathered (regular and irregular) as well as private - * use language tags. Private use tags are represented as 'x-whatever', - * and grandfathered tags are converted to their canonical replacements - * where they exist. Note that a few grandfathered tags have no modern - * replacement, these will be converted using the fallback described in - * the first paragraph, so some information might be lost. - * @param tag the input BCP47 language tag. - * @param status error information if creating the Locale failed. - * @return the Locale for the specified BCP47 language tag. - * @stable ICU 63 - */ - static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status); - - /** - * Returns a well-formed language tag for this Locale. - * <p> - * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax - * requirement will be silently omitted from the result. - * - * If this function fails, partial output may have been written to the sink. - * - * @param sink the output sink receiving the BCP47 language - * tag for this Locale. - * @param status error information if creating the language tag failed. - * @stable ICU 63 - */ - void toLanguageTag(ByteSink& sink, UErrorCode& status) const; - - /** - * Returns a well-formed language tag for this Locale. - * <p> - * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax - * requirement will be silently omitted from the result. - * - * @param status error information if creating the language tag failed. - * @return the BCP47 language tag for this Locale. - * @stable ICU 63 - */ - template<typename StringClass> - inline StringClass toLanguageTag(UErrorCode& status) const; - - /** + * Returns a Locale for the specified BCP47 language tag string. + * If the specified language tag contains any ill-formed subtags, + * the first such subtag and all following subtags are ignored. + * <p> + * This implements the 'Language-Tag' production of BCP47, and so + * supports grandfathered (regular and irregular) as well as private + * use language tags. Private use tags are represented as 'x-whatever', + * and grandfathered tags are converted to their canonical replacements + * where they exist. Note that a few grandfathered tags have no modern + * replacement, these will be converted using the fallback described in + * the first paragraph, so some information might be lost. + * @param tag the input BCP47 language tag. + * @param status error information if creating the Locale failed. + * @return the Locale for the specified BCP47 language tag. + * @stable ICU 63 + */ + static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status); + + /** + * Returns a well-formed language tag for this Locale. + * <p> + * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax + * requirement will be silently omitted from the result. + * + * If this function fails, partial output may have been written to the sink. + * + * @param sink the output sink receiving the BCP47 language + * tag for this Locale. + * @param status error information if creating the language tag failed. + * @stable ICU 63 + */ + void toLanguageTag(ByteSink& sink, UErrorCode& status) const; + + /** + * Returns a well-formed language tag for this Locale. + * <p> + * <b>Note</b>: Any locale fields which do not satisfy the BCP47 syntax + * requirement will be silently omitted from the result. + * + * @param status error information if creating the language tag failed. + * @return the BCP47 language tag for this Locale. + * @stable ICU 63 + */ + template<typename StringClass> + inline StringClass toLanguageTag(UErrorCode& status) const; + + /** * Creates a locale which has had minimal canonicalization * as per uloc_getName(). * @param name The name to create from. If name is null, @@ -448,7 +448,7 @@ public: /** * Creates a locale from the given string after canonicalizing - * the string according to CLDR by calling uloc_canonicalize(). + * the string according to CLDR by calling uloc_canonicalize(). * @param name the locale ID to create from. Must not be NULL. * @return a new locale object corresponding to the given name * @stable ICU 3.0 @@ -505,136 +505,136 @@ public: */ const char * getBaseName() const; - /** - * Add the likely subtags for this Locale, per the algorithm described - * in the following CLDR technical report: - * - * http://www.unicode.org/reports/tr35/#Likely_Subtags - * - * If this Locale is already in the maximal form, or not valid, or there is - * no data available for maximization, the Locale will be unchanged. - * - * For example, "und-Zzzz" cannot be maximized, since there is no - * reasonable maximization. - * - * Examples: - * - * "en" maximizes to "en_Latn_US" - * - * "de" maximizes to "de_Latn_US" - * - * "sr" maximizes to "sr_Cyrl_RS" - * - * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) - * - * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) - * - * @param status error information if maximizing this Locale failed. - * If this Locale is not well-formed, the error code is - * U_ILLEGAL_ARGUMENT_ERROR. - * @stable ICU 63 - */ - void addLikelySubtags(UErrorCode& status); - - /** - * Minimize the subtags for this Locale, per the algorithm described - * in the following CLDR technical report: - * - * http://www.unicode.org/reports/tr35/#Likely_Subtags - * - * If this Locale is already in the minimal form, or not valid, or there is - * no data available for minimization, the Locale will be unchanged. - * - * Since the minimization algorithm relies on proper maximization, see the - * comments for addLikelySubtags for reasons why there might not be any - * data. - * - * Examples: - * - * "en_Latn_US" minimizes to "en" - * - * "de_Latn_US" minimizes to "de" - * - * "sr_Cyrl_RS" minimizes to "sr" - * - * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the - * script, and minimizing to "zh" would imply "zh_Hans_CN".) - * - * @param status error information if maximizing this Locale failed. - * If this Locale is not well-formed, the error code is - * U_ILLEGAL_ARGUMENT_ERROR. - * @stable ICU 63 - */ - void minimizeSubtags(UErrorCode& status); - -#ifndef U_HIDE_DRAFT_API - /** - * Canonicalize the locale ID of this object according to CLDR. - * @param status the status code - * @draft ICU 67 - * @see createCanonical - */ - void canonicalize(UErrorCode& status); -#endif // U_HIDE_DRAFT_API - - /** + /** + * Add the likely subtags for this Locale, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If this Locale is already in the maximal form, or not valid, or there is + * no data available for maximization, the Locale will be unchanged. + * + * For example, "und-Zzzz" cannot be maximized, since there is no + * reasonable maximization. + * + * Examples: + * + * "en" maximizes to "en_Latn_US" + * + * "de" maximizes to "de_Latn_US" + * + * "sr" maximizes to "sr_Cyrl_RS" + * + * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) + * + * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) + * + * @param status error information if maximizing this Locale failed. + * If this Locale is not well-formed, the error code is + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 63 + */ + void addLikelySubtags(UErrorCode& status); + + /** + * Minimize the subtags for this Locale, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If this Locale is already in the minimal form, or not valid, or there is + * no data available for minimization, the Locale will be unchanged. + * + * Since the minimization algorithm relies on proper maximization, see the + * comments for addLikelySubtags for reasons why there might not be any + * data. + * + * Examples: + * + * "en_Latn_US" minimizes to "en" + * + * "de_Latn_US" minimizes to "de" + * + * "sr_Cyrl_RS" minimizes to "sr" + * + * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the + * script, and minimizing to "zh" would imply "zh_Hans_CN".) + * + * @param status error information if maximizing this Locale failed. + * If this Locale is not well-formed, the error code is + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 63 + */ + void minimizeSubtags(UErrorCode& status); + +#ifndef U_HIDE_DRAFT_API + /** + * Canonicalize the locale ID of this object according to CLDR. + * @param status the status code + * @draft ICU 67 + * @see createCanonical + */ + void canonicalize(UErrorCode& status); +#endif // U_HIDE_DRAFT_API + + /** * Gets the list of keywords for the specified locale. * * @param status the status code * @return pointer to StringEnumeration class, or NULL if there are no keywords. * Client must dispose of it by calling delete. - * @see getKeywords + * @see getKeywords * @stable ICU 2.8 */ StringEnumeration * createKeywords(UErrorCode &status) const; /** - * Gets the list of Unicode keywords for the specified locale. - * - * @param status the status code - * @return pointer to StringEnumeration class, or NULL if there are no keywords. - * Client must dispose of it by calling delete. - * @see getUnicodeKeywords - * @stable ICU 63 - */ - StringEnumeration * createUnicodeKeywords(UErrorCode &status) const; - - /** - * Gets the set of keywords for this Locale. - * - * A wrapper to call createKeywords() and write the resulting - * keywords as standard strings (or compatible objects) into any kind of - * container that can be written to by an STL style output iterator. - * - * @param iterator an STL style output iterator to write the keywords to. - * @param status error information if creating set of keywords failed. - * @stable ICU 63 - */ - template<typename StringClass, typename OutputIterator> - inline void getKeywords(OutputIterator iterator, UErrorCode& status) const; - - /** - * Gets the set of Unicode keywords for this Locale. - * - * A wrapper to call createUnicodeKeywords() and write the resulting - * keywords as standard strings (or compatible objects) into any kind of - * container that can be written to by an STL style output iterator. - * - * @param iterator an STL style output iterator to write the keywords to. - * @param status error information if creating set of keywords failed. - * @stable ICU 63 - */ - template<typename StringClass, typename OutputIterator> - inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const; - - /** + * Gets the list of Unicode keywords for the specified locale. + * + * @param status the status code + * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * Client must dispose of it by calling delete. + * @see getUnicodeKeywords + * @stable ICU 63 + */ + StringEnumeration * createUnicodeKeywords(UErrorCode &status) const; + + /** + * Gets the set of keywords for this Locale. + * + * A wrapper to call createKeywords() and write the resulting + * keywords as standard strings (or compatible objects) into any kind of + * container that can be written to by an STL style output iterator. + * + * @param iterator an STL style output iterator to write the keywords to. + * @param status error information if creating set of keywords failed. + * @stable ICU 63 + */ + template<typename StringClass, typename OutputIterator> + inline void getKeywords(OutputIterator iterator, UErrorCode& status) const; + + /** + * Gets the set of Unicode keywords for this Locale. + * + * A wrapper to call createUnicodeKeywords() and write the resulting + * keywords as standard strings (or compatible objects) into any kind of + * container that can be written to by an STL style output iterator. + * + * @param iterator an STL style output iterator to write the keywords to. + * @param status error information if creating set of keywords failed. + * @stable ICU 63 + */ + template<typename StringClass, typename OutputIterator> + inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const; + + /** * Gets the value for a keyword. * - * This uses legacy keyword=value pairs, like "collation=phonebook". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * * @param keywordName name of the keyword for which we want the value. Case insensitive. * @param buffer The buffer to receive the keyword value. * @param bufferCapacity The capacity of receiving buffer @@ -646,78 +646,78 @@ public: int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const; /** - * Gets the value for a keyword. - * - * This uses legacy keyword=value pairs, like "collation=phonebook". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword for which we want the value. - * @param sink the sink to receive the keyword value. - * @param status error information if getting the value failed. - * @stable ICU 63 - */ - void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; - - /** - * Gets the value for a keyword. - * - * This uses legacy keyword=value pairs, like "collation=phonebook". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword for which we want the value. - * @param status error information if getting the value failed. - * @return the keyword value. - * @stable ICU 63 - */ - template<typename StringClass> - inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const; - - /** - * Gets the Unicode value for a Unicode keyword. - * - * This uses Unicode key-value pairs, like "co-phonebk". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword for which we want the value. - * @param sink the sink to receive the keyword value. - * @param status error information if getting the value failed. - * @stable ICU 63 - */ - void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; - - /** - * Gets the Unicode value for a Unicode keyword. - * - * This uses Unicode key-value pairs, like "co-phonebk". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword for which we want the value. - * @param status error information if getting the value failed. - * @return the keyword value. - * @stable ICU 63 - */ - template<typename StringClass> - inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const; - - /** + * Gets the value for a keyword. + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param sink the sink to receive the keyword value. + * @param status error information if getting the value failed. + * @stable ICU 63 + */ + void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; + + /** + * Gets the value for a keyword. + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param status error information if getting the value failed. + * @return the keyword value. + * @stable ICU 63 + */ + template<typename StringClass> + inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const; + + /** + * Gets the Unicode value for a Unicode keyword. + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param sink the sink to receive the keyword value. + * @param status error information if getting the value failed. + * @stable ICU 63 + */ + void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const; + + /** + * Gets the Unicode value for a Unicode keyword. + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword for which we want the value. + * @param status error information if getting the value failed. + * @return the keyword value. + * @stable ICU 63 + */ + template<typename StringClass> + inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const; + + /** * Sets or removes the value for a keyword. * * For removing all keywords, use getBaseName(), * and construct a new Locale if it differs from getName(). * - * This uses legacy keyword=value pairs, like "collation=phonebook". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * * @param keywordName name of the keyword to be set. Case insensitive. * @param keywordValue value of the keyword to be set. If 0-length or * NULL, will result in the keyword being removed. No error is given if @@ -729,46 +729,46 @@ public: void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status); /** - * Sets or removes the value for a keyword. - * - * For removing all keywords, use getBaseName(), - * and construct a new Locale if it differs from getName(). - * - * This uses legacy keyword=value pairs, like "collation=phonebook". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword to be set. - * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed. No error is given if - * that keyword does not exist. - * @param status Returns any error information while performing this operation. - * @stable ICU 63 - */ - void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); - - /** - * Sets or removes the Unicode value for a Unicode keyword. - * - * For removing all keywords, use getBaseName(), - * and construct a new Locale if it differs from getName(). - * - * This uses Unicode key-value pairs, like "co-phonebk". - * - * ICU4C doesn't do automatic conversion between legacy and Unicode - * keywords and values in getters and setters (as opposed to ICU4J). - * - * @param keywordName name of the keyword to be set. - * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed. No error is given if - * that keyword does not exist. - * @param status Returns any error information while performing this operation. - * @stable ICU 63 - */ - void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); - - /** + * Sets or removes the value for a keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * This uses legacy keyword=value pairs, like "collation=phonebook". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword to be set. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * @stable ICU 63 + */ + void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); + + /** + * Sets or removes the Unicode value for a Unicode keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * This uses Unicode key-value pairs, like "co-phonebk". + * + * ICU4C doesn't do automatic conversion between legacy and Unicode + * keywords and values in getters and setters (as opposed to ICU4J). + * + * @param keywordName name of the keyword to be set. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * @stable ICU 63 + */ + void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status); + + /** * returns the locale's three-letter language code, as specified * in ISO draft standard ISO-639-2. * @return An alias to the code, or an empty string @@ -925,7 +925,7 @@ public: /** * Fills in "name" with the name of this locale in a format suitable for user display - * in the locale specified by "displayLocale". This function uses getDisplayLanguage(), + * in the locale specified by "displayLocale". This function uses getDisplayLanguage(), * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display * name in the format "language (country[,variant])". For example, if displayLocale is * fr_FR, then en_US's display name would be "Anglais (États-Unis)", and no_NO_NY's @@ -959,7 +959,7 @@ public: * @return FALSE if it is a real locale, TRUE if it is a bogus locale * @stable ICU 2.1 */ - inline UBool isBogus(void) const; + inline UBool isBogus(void) const; /** * Returns a list of all installed locales. @@ -1005,104 +1005,104 @@ public: */ virtual UClassID getDynamicClassID() const; -#ifndef U_HIDE_DRAFT_API - /** - * A Locale iterator interface similar to a Java Iterator<Locale>. - * @draft ICU 65 - */ - class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ { - public: - /** @draft ICU 65 */ - virtual ~Iterator(); - - /** - * @return TRUE if next() can be called again. - * @draft ICU 65 - */ - virtual UBool hasNext() const = 0; - - /** - * @return the next locale. - * @draft ICU 65 - */ - virtual const Locale &next() = 0; - }; - - /** - * A generic Locale iterator implementation over Locale input iterators. - * @draft ICU 65 - */ - template<typename Iter> - class RangeIterator : public Iterator, public UMemory { - public: - /** - * Constructs an iterator from a begin/end range. - * Each of the iterator parameter values must be an - * input iterator whose value is convertible to const Locale &. - * - * @param begin Start of range. - * @param end Exclusive end of range. - * @draft ICU 65 - */ - RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {} - - /** - * @return TRUE if next() can be called again. - * @draft ICU 65 - */ - UBool hasNext() const override { return it_ != end_; } - - /** - * @return the next locale. - * @draft ICU 65 - */ - const Locale &next() override { return *it_++; } - - private: - Iter it_; - const Iter end_; - }; - - /** - * A generic Locale iterator implementation over Locale input iterators. - * Calls the converter to convert each *begin to a const Locale &. - * @draft ICU 65 - */ - template<typename Iter, typename Conv> - class ConvertingIterator : public Iterator, public UMemory { - public: - /** - * Constructs an iterator from a begin/end range. - * Each of the iterator parameter values must be an - * input iterator whose value the converter converts to const Locale &. - * - * @param begin Start of range. - * @param end Exclusive end of range. - * @param converter Converter from *begin to const Locale & or compatible. - * @draft ICU 65 - */ - ConvertingIterator(Iter begin, Iter end, Conv converter) : - it_(begin), end_(end), converter_(converter) {} - - /** - * @return TRUE if next() can be called again. - * @draft ICU 65 - */ - UBool hasNext() const override { return it_ != end_; } - - /** - * @return the next locale. - * @draft ICU 65 - */ - const Locale &next() override { return converter_(*it_++); } - - private: - Iter it_; - const Iter end_; - Conv converter_; - }; -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API + /** + * A Locale iterator interface similar to a Java Iterator<Locale>. + * @draft ICU 65 + */ + class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ { + public: + /** @draft ICU 65 */ + virtual ~Iterator(); + + /** + * @return TRUE if next() can be called again. + * @draft ICU 65 + */ + virtual UBool hasNext() const = 0; + + /** + * @return the next locale. + * @draft ICU 65 + */ + virtual const Locale &next() = 0; + }; + + /** + * A generic Locale iterator implementation over Locale input iterators. + * @draft ICU 65 + */ + template<typename Iter> + class RangeIterator : public Iterator, public UMemory { + public: + /** + * Constructs an iterator from a begin/end range. + * Each of the iterator parameter values must be an + * input iterator whose value is convertible to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @draft ICU 65 + */ + RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {} + + /** + * @return TRUE if next() can be called again. + * @draft ICU 65 + */ + UBool hasNext() const override { return it_ != end_; } + + /** + * @return the next locale. + * @draft ICU 65 + */ + const Locale &next() override { return *it_++; } + + private: + Iter it_; + const Iter end_; + }; + + /** + * A generic Locale iterator implementation over Locale input iterators. + * Calls the converter to convert each *begin to a const Locale &. + * @draft ICU 65 + */ + template<typename Iter, typename Conv> + class ConvertingIterator : public Iterator, public UMemory { + public: + /** + * Constructs an iterator from a begin/end range. + * Each of the iterator parameter values must be an + * input iterator whose value the converter converts to const Locale &. + * + * @param begin Start of range. + * @param end Exclusive end of range. + * @param converter Converter from *begin to const Locale & or compatible. + * @draft ICU 65 + */ + ConvertingIterator(Iter begin, Iter end, Conv converter) : + it_(begin), end_(end), converter_(converter) {} + + /** + * @return TRUE if next() can be called again. + * @draft ICU 65 + */ + UBool hasNext() const override { return it_ != end_; } + + /** + * @return the next locale. + * @draft ICU 65 + */ + const Locale &next() override { return converter_(*it_++); } + + private: + Iter it_; + const Iter end_; + Conv converter_; + }; +#endif // U_HIDE_DRAFT_API + protected: /* only protected for testing purposes. DO NOT USE. */ #ifndef U_HIDE_INTERNAL_API /** @@ -1153,12 +1153,12 @@ private: /** * A friend to allow the default locale to be set by either the C or C++ API. - * @internal (private) + * @internal (private) */ friend Locale *locale_set_default_internal(const char *, UErrorCode& status); /** - * @internal (private) + * @internal (private) */ friend void U_CALLCONV locale_available_init(); }; @@ -1169,15 +1169,15 @@ Locale::operator!=(const Locale& other) const return !operator==(other); } -template<typename StringClass> inline StringClass -Locale::toLanguageTag(UErrorCode& status) const -{ - StringClass result; - StringByteSink<StringClass> sink(&result); - toLanguageTag(sink, status); - return result; -} - +template<typename StringClass> inline StringClass +Locale::toLanguageTag(UErrorCode& status) const +{ + StringClass result; + StringByteSink<StringClass> sink(&result); + toLanguageTag(sink, status); + return result; +} + inline const char * Locale::getCountry() const { @@ -1208,58 +1208,58 @@ Locale::getName() const return fullName; } -template<typename StringClass, typename OutputIterator> inline void -Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const -{ - LocalPointer<StringEnumeration> keys(createKeywords(status)); - if (U_FAILURE(status) || keys.isNull()) { - return; - } - for (;;) { - int32_t resultLength; - const char* buffer = keys->next(&resultLength, status); - if (U_FAILURE(status) || buffer == nullptr) { - return; - } - *iterator++ = StringClass(buffer, resultLength); - } -} - -template<typename StringClass, typename OutputIterator> inline void -Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const -{ - LocalPointer<StringEnumeration> keys(createUnicodeKeywords(status)); - if (U_FAILURE(status) || keys.isNull()) { - return; - } - for (;;) { - int32_t resultLength; - const char* buffer = keys->next(&resultLength, status); - if (U_FAILURE(status) || buffer == nullptr) { - return; - } - *iterator++ = StringClass(buffer, resultLength); - } -} - -template<typename StringClass> inline StringClass -Locale::getKeywordValue(StringPiece keywordName, UErrorCode& status) const -{ - StringClass result; - StringByteSink<StringClass> sink(&result); - getKeywordValue(keywordName, sink, status); - return result; -} - -template<typename StringClass> inline StringClass -Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const -{ - StringClass result; - StringByteSink<StringClass> sink(&result); - getUnicodeKeywordValue(keywordName, sink, status); - return result; -} - +template<typename StringClass, typename OutputIterator> inline void +Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const +{ + LocalPointer<StringEnumeration> keys(createKeywords(status)); + if (U_FAILURE(status) || keys.isNull()) { + return; + } + for (;;) { + int32_t resultLength; + const char* buffer = keys->next(&resultLength, status); + if (U_FAILURE(status) || buffer == nullptr) { + return; + } + *iterator++ = StringClass(buffer, resultLength); + } +} + +template<typename StringClass, typename OutputIterator> inline void +Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const +{ + LocalPointer<StringEnumeration> keys(createUnicodeKeywords(status)); + if (U_FAILURE(status) || keys.isNull()) { + return; + } + for (;;) { + int32_t resultLength; + const char* buffer = keys->next(&resultLength, status); + if (U_FAILURE(status) || buffer == nullptr) { + return; + } + *iterator++ = StringClass(buffer, resultLength); + } +} + +template<typename StringClass> inline StringClass +Locale::getKeywordValue(StringPiece keywordName, UErrorCode& status) const +{ + StringClass result; + StringByteSink<StringClass> sink(&result); + getKeywordValue(keywordName, sink, status); + return result; +} + +template<typename StringClass> inline StringClass +Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const +{ + StringClass result; + StringByteSink<StringClass> sink(&result); + getUnicodeKeywordValue(keywordName, sink, status); + return result; +} + inline UBool Locale::isBogus(void) const { return fIsBogus; @@ -1267,6 +1267,6 @@ Locale::isBogus(void) const { U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/measfmt.h b/contrib/libs/icu/include/unicode/measfmt.h index b4f9048629..6775982bca 100644 --- a/contrib/libs/icu/include/unicode/measfmt.h +++ b/contrib/libs/icu/include/unicode/measfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -15,8 +15,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/format.h" @@ -24,7 +24,7 @@ /** * \file - * \brief C++ API: Compatibility APIs for measure formatting. + * \brief C++ API: Compatibility APIs for measure formatting. */ /** @@ -89,9 +89,9 @@ class ListFormatter; class DateFormat; /** - * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if - * numberformatter.h fits their use case. Although not deprecated, this header - * is provided for backwards compatibility only. + * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if + * numberformatter.h fits their use case. Although not deprecated, this header + * is provided for backwards compatibility only. * * @see Format * @author Alan Liu @@ -104,9 +104,9 @@ class U_I18N_API MeasureFormat : public Format { /** * Constructor. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 53 */ MeasureFormat( @@ -114,9 +114,9 @@ class U_I18N_API MeasureFormat : public Format { /** * Constructor. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 53 */ MeasureFormat( @@ -153,7 +153,7 @@ class U_I18N_API MeasureFormat : public Format { * Clones this object polymorphically. * @stable ICU 53 */ - virtual MeasureFormat *clone() const; + virtual MeasureFormat *clone() const; /** * Formats object to produce a string. @@ -165,7 +165,7 @@ class U_I18N_API MeasureFormat : public Format { FieldPosition &pos, UErrorCode &status) const; -#ifndef U_FORCE_HIDE_DRAFT_API +#ifndef U_FORCE_HIDE_DRAFT_API /** * Parse a string to produce an object. This implementation sets * status to U_UNSUPPORTED_ERROR. @@ -176,7 +176,7 @@ class U_I18N_API MeasureFormat : public Format { const UnicodeString &source, Formattable &reslt, ParsePosition &pos) const; -#endif // U_FORCE_HIDE_DRAFT_API +#endif // U_FORCE_HIDE_DRAFT_API /** * Formats measure objects to produce a string. An example of such a @@ -206,7 +206,7 @@ class U_I18N_API MeasureFormat : public Format { * formatted string is 3.5 meters per second. * @param measure The measure object. In above example, 3.5 meters. * @param perUnit The per unit. In above example, it is - * `*%MeasureUnit::createSecond(status)`. + * `*%MeasureUnit::createSecond(status)`. * @param appendTo formatted string appended here. * @param pos the field position. * @param status the error. @@ -227,10 +227,10 @@ class U_I18N_API MeasureFormat : public Format { * @param unit The unit for which to get a display name. * @param status the error. * @return The display name in the locale and width specified in - * the MeasureFormat constructor, or null if there is no display name available + * the MeasureFormat constructor, or null if there is no display name available * for the specified unit. * - * @stable ICU 58 + * @stable ICU 58 */ UnicodeString getUnitDisplayName(const MeasureUnit& unit, UErrorCode &status) const; @@ -238,9 +238,9 @@ class U_I18N_API MeasureFormat : public Format { /** * Return a formatter for CurrencyAmount objects in the given * locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param locale desired locale * @param ec input-output error code * @return a formatter object, or NULL upon error @@ -252,9 +252,9 @@ class U_I18N_API MeasureFormat : public Format { /** * Return a formatter for CurrencyAmount objects in the default * locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param ec input-output error code * @return a formatter object, or NULL upon error * @stable ICU 3.0 @@ -326,19 +326,19 @@ class U_I18N_API MeasureFormat : public Format { * ICU use only. * @internal. */ - const NumberFormat &getNumberFormatInternal() const; - - /** - * ICU use only. - * Always returns the short form currency formatter. - * @internal. - */ - const NumberFormat& getCurrencyFormatInternal() const; + const NumberFormat &getNumberFormatInternal() const; /** * ICU use only. + * Always returns the short form currency formatter. * @internal. */ + const NumberFormat& getCurrencyFormatInternal() const; + + /** + * ICU use only. + * @internal. + */ const PluralRules &getPluralRules() const; /** @@ -359,7 +359,7 @@ class U_I18N_API MeasureFormat : public Format { const MeasureFormatCacheData *cache; const SharedNumberFormat *numberFormat; const SharedPluralRules *pluralRules; - UMeasureFormatWidth fWidth; + UMeasureFormatWidth fWidth; // Declared outside of MeasureFormatSharedData because ListFormatter // objects are relatively cheap to copy; therefore, they don't need to be @@ -391,7 +391,7 @@ class U_I18N_API MeasureFormat : public Format { U_NAMESPACE_END #endif // #if !UCONFIG_NO_FORMATTING - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // #ifndef MEASUREFORMAT_H diff --git a/contrib/libs/icu/include/unicode/measunit.h b/contrib/libs/icu/include/unicode/measunit.h index e240092e30..5c3e168b25 100644 --- a/contrib/libs/icu/include/unicode/measunit.h +++ b/contrib/libs/icu/include/unicode/measunit.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -15,12 +15,12 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" -#include "unicode/localpointer.h" +#include "unicode/localpointer.h" /** * \file @@ -30,204 +30,204 @@ U_NAMESPACE_BEGIN class StringEnumeration; -struct MeasureUnitImpl; +struct MeasureUnitImpl; -#ifndef U_HIDE_DRAFT_API +#ifndef U_HIDE_DRAFT_API /** - * Enumeration for unit complexity. There are three levels: + * Enumeration for unit complexity. There are three levels: + * + * - SINGLE: A single unit, optionally with a power and/or SI prefix. Examples: hectare, + * square-kilometer, kilojoule, per-second. + * - COMPOUND: A unit composed of the product of multiple single units. Examples: + * meter-per-second, kilowatt-hour, kilogram-meter-per-square-second. + * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch, + * hour+minute+second, degree+arcminute+arcsecond. * - * - SINGLE: A single unit, optionally with a power and/or SI prefix. Examples: hectare, - * square-kilometer, kilojoule, per-second. - * - COMPOUND: A unit composed of the product of multiple single units. Examples: - * meter-per-second, kilowatt-hour, kilogram-meter-per-square-second. - * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch, - * hour+minute+second, degree+arcminute+arcsecond. - * - * The complexity determines which operations are available. For example, you cannot set the power - * or SI prefix of a compound unit. - * - * @draft ICU 67 - */ -enum UMeasureUnitComplexity { - /** - * A single unit, like kilojoule. - * - * @draft ICU 67 - */ - UMEASURE_UNIT_SINGLE, - - /** - * A compound unit, like meter-per-second. + * The complexity determines which operations are available. For example, you cannot set the power + * or SI prefix of a compound unit. + * + * @draft ICU 67 + */ +enum UMeasureUnitComplexity { + /** + * A single unit, like kilojoule. * - * @draft ICU 67 - */ - UMEASURE_UNIT_COMPOUND, - - /** - * A mixed unit, like hour+minute. - * - * @draft ICU 67 - */ - UMEASURE_UNIT_MIXED -}; - -/** - * Enumeration for SI prefixes, such as "kilo". - * - * @draft ICU 67 - */ -typedef enum UMeasureSIPrefix { - - /** - * SI prefix: yotta, 10^24. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_YOTTA = 24, - - /** - * SI prefix: zetta, 10^21. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_ZETTA = 21, - - /** - * SI prefix: exa, 10^18. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_EXA = 18, - - /** - * SI prefix: peta, 10^15. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_PETA = 15, - - /** - * SI prefix: tera, 10^12. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_TERA = 12, - - /** - * SI prefix: giga, 10^9. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_GIGA = 9, - - /** - * SI prefix: mega, 10^6. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_MEGA = 6, - - /** - * SI prefix: kilo, 10^3. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_KILO = 3, - - /** - * SI prefix: hecto, 10^2. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_HECTO = 2, - - /** - * SI prefix: deka, 10^1. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_DEKA = 1, - - /** - * The absence of an SI prefix. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_ONE = 0, - - /** - * SI prefix: deci, 10^-1. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_DECI = -1, - - /** - * SI prefix: centi, 10^-2. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_CENTI = -2, - - /** - * SI prefix: milli, 10^-3. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_MILLI = -3, - - /** - * SI prefix: micro, 10^-6. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_MICRO = -6, - - /** - * SI prefix: nano, 10^-9. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_NANO = -9, - - /** - * SI prefix: pico, 10^-12. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_PICO = -12, - - /** - * SI prefix: femto, 10^-15. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_FEMTO = -15, - - /** - * SI prefix: atto, 10^-18. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_ATTO = -18, - - /** - * SI prefix: zepto, 10^-21. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_ZEPTO = -21, - - /** - * SI prefix: yocto, 10^-24. - * - * @draft ICU 67 - */ - UMEASURE_SI_PREFIX_YOCTO = -24 -} UMeasureSIPrefix; -#endif // U_HIDE_DRAFT_API - -/** + * @draft ICU 67 + */ + UMEASURE_UNIT_SINGLE, + + /** + * A compound unit, like meter-per-second. + * + * @draft ICU 67 + */ + UMEASURE_UNIT_COMPOUND, + + /** + * A mixed unit, like hour+minute. + * + * @draft ICU 67 + */ + UMEASURE_UNIT_MIXED +}; + +/** + * Enumeration for SI prefixes, such as "kilo". + * + * @draft ICU 67 + */ +typedef enum UMeasureSIPrefix { + + /** + * SI prefix: yotta, 10^24. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_YOTTA = 24, + + /** + * SI prefix: zetta, 10^21. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_ZETTA = 21, + + /** + * SI prefix: exa, 10^18. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_EXA = 18, + + /** + * SI prefix: peta, 10^15. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_PETA = 15, + + /** + * SI prefix: tera, 10^12. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_TERA = 12, + + /** + * SI prefix: giga, 10^9. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_GIGA = 9, + + /** + * SI prefix: mega, 10^6. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_MEGA = 6, + + /** + * SI prefix: kilo, 10^3. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_KILO = 3, + + /** + * SI prefix: hecto, 10^2. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_HECTO = 2, + + /** + * SI prefix: deka, 10^1. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_DEKA = 1, + + /** + * The absence of an SI prefix. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_ONE = 0, + + /** + * SI prefix: deci, 10^-1. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_DECI = -1, + + /** + * SI prefix: centi, 10^-2. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_CENTI = -2, + + /** + * SI prefix: milli, 10^-3. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_MILLI = -3, + + /** + * SI prefix: micro, 10^-6. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_MICRO = -6, + + /** + * SI prefix: nano, 10^-9. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_NANO = -9, + + /** + * SI prefix: pico, 10^-12. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_PICO = -12, + + /** + * SI prefix: femto, 10^-15. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_FEMTO = -15, + + /** + * SI prefix: atto, 10^-18. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_ATTO = -18, + + /** + * SI prefix: zepto, 10^-21. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_ZEPTO = -21, + + /** + * SI prefix: yocto, 10^-24. + * + * @draft ICU 67 + */ + UMEASURE_SI_PREFIX_YOCTO = -24 +} UMeasureSIPrefix; +#endif // U_HIDE_DRAFT_API + +/** * A unit such as length, mass, volume, currency, etc. A unit is * coupled with a numeric amount to produce a Measure. * @@ -239,59 +239,59 @@ class U_I18N_API MeasureUnit: public UObject { /** * Default constructor. - * Populates the instance with the base dimensionless unit. + * Populates the instance with the base dimensionless unit. * @stable ICU 3.0 */ - MeasureUnit(); + MeasureUnit(); /** * Copy constructor. * @stable ICU 3.0 */ MeasureUnit(const MeasureUnit &other); - -#ifndef U_HIDE_DRAFT_API - /** - * Move constructor. - * @draft ICU 67 - */ - MeasureUnit(MeasureUnit &&other) noexcept; - - /** - * Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35. - * Validates and canonicalizes the identifier. - * - * <pre> - * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond") - * </pre> - * - * @param identifier The CLDR Unit Identifier - * @param status Set if the identifier is invalid. - * @draft ICU 67 - */ - static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status); -#endif // U_HIDE_DRAFT_API - + +#ifndef U_HIDE_DRAFT_API /** - * Copy assignment operator. + * Move constructor. + * @draft ICU 67 + */ + MeasureUnit(MeasureUnit &&other) noexcept; + + /** + * Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35. + * Validates and canonicalizes the identifier. + * + * <pre> + * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond") + * </pre> + * + * @param identifier The CLDR Unit Identifier + * @param status Set if the identifier is invalid. + * @draft ICU 67 + */ + static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status); +#endif // U_HIDE_DRAFT_API + + /** + * Copy assignment operator. * @stable ICU 3.0 */ MeasureUnit &operator=(const MeasureUnit &other); -#ifndef U_HIDE_DRAFT_API - /** - * Move assignment operator. - * @draft ICU 67 - */ - MeasureUnit &operator=(MeasureUnit &&other) noexcept; -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API /** + * Move assignment operator. + * @draft ICU 67 + */ + MeasureUnit &operator=(MeasureUnit &&other) noexcept; +#endif // U_HIDE_DRAFT_API + + /** * Returns a polymorphic clone of this object. The result will * have the same class as returned by getDynamicClassID(). * @stable ICU 3.0 */ - virtual MeasureUnit* clone() const; + virtual MeasureUnit* clone() const; /** * Destructor @@ -317,157 +317,157 @@ class U_I18N_API MeasureUnit: public UObject { /** * Get the type. - * - * If the unit does not have a type, the empty string is returned. - * + * + * If the unit does not have a type, the empty string is returned. + * * @stable ICU 53 */ const char *getType() const; /** * Get the sub type. - * - * If the unit does not have a subtype, the empty string is returned. - * + * + * If the unit does not have a subtype, the empty string is returned. + * * @stable ICU 53 */ const char *getSubtype() const; -#ifndef U_HIDE_DRAFT_API - /** - * Get the CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35. - * - * @return The string form of this unit, owned by this MeasureUnit. - * @draft ICU 67 - */ - const char* getIdentifier() const; - - /** - * Compute the complexity of the unit. See UMeasureUnitComplexity for more information. - * - * @param status Set if an error occurs. - * @return The unit complexity. - * @draft ICU 67 - */ - UMeasureUnitComplexity getComplexity(UErrorCode& status) const; - - /** - * Creates a MeasureUnit which is this SINGLE unit augmented with the specified SI prefix. - * For example, UMEASURE_SI_PREFIX_KILO for "kilo". - * - * There is sufficient locale data to format all standard SI prefixes. - * - * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will - * occur. For more information, see UMeasureUnitComplexity. - * - * @param prefix The SI prefix, from UMeasureSIPrefix. - * @param status Set if this is not a SINGLE unit or if another error occurs. - * @return A new SINGLE unit. - * @draft ICU 67 - */ - MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const; - - /** - * Gets the current SI prefix of this SINGLE unit. For example, if the unit has the SI prefix - * "kilo", then UMEASURE_SI_PREFIX_KILO is returned. - * - * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will - * occur. For more information, see UMeasureUnitComplexity. - * - * @param status Set if this is not a SINGLE unit or if another error occurs. - * @return The SI prefix of this SINGLE unit, from UMeasureSIPrefix. - * @draft ICU 67 - */ - UMeasureSIPrefix getSIPrefix(UErrorCode& status) const; - - /** - * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality - * (power). For example, if dimensionality is 2, the unit will be squared. - * - * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will - * occur. For more information, see UMeasureUnitComplexity. - * - * For the base dimensionless unit, withDimensionality does nothing. - * - * @param dimensionality The dimensionality (power). - * @param status Set if this is not a SINGLE unit or if another error occurs. - * @return A new SINGLE unit. - * @draft ICU 67 - */ - MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const; - - /** - * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square, - * then 2 is returned. - * - * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will - * occur. For more information, see UMeasureUnitComplexity. - * - * For the base dimensionless unit, getDimensionality returns 0. - * - * @param status Set if this is not a SINGLE unit or if another error occurs. - * @return The dimensionality (power) of this simple unit. - * @draft ICU 67 - */ - int32_t getDimensionality(UErrorCode& status) const; - - /** - * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped. - * - * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned. - * - * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will - * occur. For more information, see UMeasureUnitComplexity. - * - * @param status Set if this is a MIXED unit or if another error occurs. - * @return The reciprocal of the target unit. - * @draft ICU 67 - */ - MeasureUnit reciprocal(UErrorCode& status) const; - - /** - * Gets the product of this unit with another unit. This is a way to build units from - * constituent parts. - * - * The numerator and denominator are preserved through this operation. - * - * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the - * unit "kilowatt-hour-per-day" is returned. - * - * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a - * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity. - * - * @param other The MeasureUnit to multiply with the target. - * @param status Set if this or other is a MIXED unit or if another error occurs. - * @return The product of the target unit with the provided unit. - * @draft ICU 67 - */ - MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const; -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_INTERNAL_API - /** - * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit. - * - * Examples: - * - Given "meter-kilogram-per-second", three units will be returned: "meter", - * "kilogram", and "per-second". - * - Given "hour+minute+second", three units will be returned: "hour", "minute", - * and "second". - * - * If this is a SINGLE unit, an array of length 1 will be returned. - * - * TODO(ICU-21021): Finalize this API and propose it as draft. - * - * @param outCount The number of elements in the return array. - * @param status Set if an error occurs. - * @return An array of single units, owned by the caller. - * @internal ICU 67 Technical Preview - */ - LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const; -#endif // U_HIDE_INTERNAL_API - +#ifndef U_HIDE_DRAFT_API /** + * Get the CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35. + * + * @return The string form of this unit, owned by this MeasureUnit. + * @draft ICU 67 + */ + const char* getIdentifier() const; + + /** + * Compute the complexity of the unit. See UMeasureUnitComplexity for more information. + * + * @param status Set if an error occurs. + * @return The unit complexity. + * @draft ICU 67 + */ + UMeasureUnitComplexity getComplexity(UErrorCode& status) const; + + /** + * Creates a MeasureUnit which is this SINGLE unit augmented with the specified SI prefix. + * For example, UMEASURE_SI_PREFIX_KILO for "kilo". + * + * There is sufficient locale data to format all standard SI prefixes. + * + * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will + * occur. For more information, see UMeasureUnitComplexity. + * + * @param prefix The SI prefix, from UMeasureSIPrefix. + * @param status Set if this is not a SINGLE unit or if another error occurs. + * @return A new SINGLE unit. + * @draft ICU 67 + */ + MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const; + + /** + * Gets the current SI prefix of this SINGLE unit. For example, if the unit has the SI prefix + * "kilo", then UMEASURE_SI_PREFIX_KILO is returned. + * + * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will + * occur. For more information, see UMeasureUnitComplexity. + * + * @param status Set if this is not a SINGLE unit or if another error occurs. + * @return The SI prefix of this SINGLE unit, from UMeasureSIPrefix. + * @draft ICU 67 + */ + UMeasureSIPrefix getSIPrefix(UErrorCode& status) const; + + /** + * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality + * (power). For example, if dimensionality is 2, the unit will be squared. + * + * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will + * occur. For more information, see UMeasureUnitComplexity. + * + * For the base dimensionless unit, withDimensionality does nothing. + * + * @param dimensionality The dimensionality (power). + * @param status Set if this is not a SINGLE unit or if another error occurs. + * @return A new SINGLE unit. + * @draft ICU 67 + */ + MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const; + + /** + * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square, + * then 2 is returned. + * + * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will + * occur. For more information, see UMeasureUnitComplexity. + * + * For the base dimensionless unit, getDimensionality returns 0. + * + * @param status Set if this is not a SINGLE unit or if another error occurs. + * @return The dimensionality (power) of this simple unit. + * @draft ICU 67 + */ + int32_t getDimensionality(UErrorCode& status) const; + + /** + * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped. + * + * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned. + * + * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will + * occur. For more information, see UMeasureUnitComplexity. + * + * @param status Set if this is a MIXED unit or if another error occurs. + * @return The reciprocal of the target unit. + * @draft ICU 67 + */ + MeasureUnit reciprocal(UErrorCode& status) const; + + /** + * Gets the product of this unit with another unit. This is a way to build units from + * constituent parts. + * + * The numerator and denominator are preserved through this operation. + * + * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the + * unit "kilowatt-hour-per-day" is returned. + * + * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a + * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity. + * + * @param other The MeasureUnit to multiply with the target. + * @param status Set if this or other is a MIXED unit or if another error occurs. + * @return The product of the target unit with the provided unit. + * @draft ICU 67 + */ + MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const; +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + /** + * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit. + * + * Examples: + * - Given "meter-kilogram-per-second", three units will be returned: "meter", + * "kilogram", and "per-second". + * - Given "hour+minute+second", three units will be returned: "hour", "minute", + * and "second". + * + * If this is a SINGLE unit, an array of length 1 will be returned. + * + * TODO(ICU-21021): Finalize this API and propose it as draft. + * + * @param outCount The number of elements in the return array. + * @param status Set if an error occurs. + * @return An array of single units, owned by the caller. + * @internal ICU 67 Technical Preview + */ + LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const; +#endif // U_HIDE_INTERNAL_API + + /** * getAvailable gets all of the available units. * If there are too many units to fit into destCapacity then the * error code is set to U_BUFFER_OVERFLOW_ERROR. @@ -517,7 +517,7 @@ class U_I18N_API MeasureUnit: public UObject { * <pre> * . Base* polymorphic_pointer = createPolymorphicObject(); * . if (polymorphic_pointer->getDynamicClassID() == - * . Derived::getStaticClassID()) ... + * . Derived::getStaticClassID()) ... * </pre> * @return The class ID for all objects of this class. * @stable ICU 53 @@ -565,8 +565,8 @@ class U_I18N_API MeasureUnit: public UObject { * ICU use only. * @internal */ - static MeasureUnit resolveUnitPerUnit( - const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved); + static MeasureUnit resolveUnitPerUnit( + const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved); #endif /* U_HIDE_INTERNAL_API */ // All code between the "Start generated createXXX methods" comment and @@ -578,2780 +578,2780 @@ class U_I18N_API MeasureUnit: public UObject { // Start generated createXXX methods /** - * Returns by pointer, unit of acceleration: g-force. + * Returns by pointer, unit of acceleration: g-force. * Caller owns returned value and must free it. - * Also see {@link #getGForce()}. + * Also see {@link #getGForce()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createGForce(UErrorCode &status); /** - * Returns by value, unit of acceleration: g-force. - * Also see {@link #createGForce()}. - * @stable ICU 64 - */ - static MeasureUnit getGForce(); - - /** - * Returns by pointer, unit of acceleration: meter-per-square-second. + * Returns by value, unit of acceleration: g-force. + * Also see {@link #createGForce()}. + * @stable ICU 64 + */ + static MeasureUnit getGForce(); + + /** + * Returns by pointer, unit of acceleration: meter-per-square-second. * Caller owns returned value and must free it. - * Also see {@link #getMeterPerSecondSquared()}. + * Also see {@link #getMeterPerSecondSquared()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status); /** - * Returns by value, unit of acceleration: meter-per-square-second. - * Also see {@link #createMeterPerSecondSquared()}. - * @stable ICU 64 - */ - static MeasureUnit getMeterPerSecondSquared(); - - /** - * Returns by pointer, unit of angle: arc-minute. + * Returns by value, unit of acceleration: meter-per-square-second. + * Also see {@link #createMeterPerSecondSquared()}. + * @stable ICU 64 + */ + static MeasureUnit getMeterPerSecondSquared(); + + /** + * Returns by pointer, unit of angle: arc-minute. * Caller owns returned value and must free it. - * Also see {@link #getArcMinute()}. + * Also see {@link #getArcMinute()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createArcMinute(UErrorCode &status); /** - * Returns by value, unit of angle: arc-minute. - * Also see {@link #createArcMinute()}. - * @stable ICU 64 - */ - static MeasureUnit getArcMinute(); - - /** - * Returns by pointer, unit of angle: arc-second. + * Returns by value, unit of angle: arc-minute. + * Also see {@link #createArcMinute()}. + * @stable ICU 64 + */ + static MeasureUnit getArcMinute(); + + /** + * Returns by pointer, unit of angle: arc-second. * Caller owns returned value and must free it. - * Also see {@link #getArcSecond()}. + * Also see {@link #getArcSecond()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createArcSecond(UErrorCode &status); /** - * Returns by value, unit of angle: arc-second. - * Also see {@link #createArcSecond()}. - * @stable ICU 64 - */ - static MeasureUnit getArcSecond(); - - /** - * Returns by pointer, unit of angle: degree. + * Returns by value, unit of angle: arc-second. + * Also see {@link #createArcSecond()}. + * @stable ICU 64 + */ + static MeasureUnit getArcSecond(); + + /** + * Returns by pointer, unit of angle: degree. * Caller owns returned value and must free it. - * Also see {@link #getDegree()}. + * Also see {@link #getDegree()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createDegree(UErrorCode &status); /** - * Returns by value, unit of angle: degree. - * Also see {@link #createDegree()}. - * @stable ICU 64 - */ - static MeasureUnit getDegree(); - - /** - * Returns by pointer, unit of angle: radian. + * Returns by value, unit of angle: degree. + * Also see {@link #createDegree()}. + * @stable ICU 64 + */ + static MeasureUnit getDegree(); + + /** + * Returns by pointer, unit of angle: radian. * Caller owns returned value and must free it. - * Also see {@link #getRadian()}. + * Also see {@link #getRadian()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createRadian(UErrorCode &status); /** - * Returns by value, unit of angle: radian. - * Also see {@link #createRadian()}. - * @stable ICU 64 - */ - static MeasureUnit getRadian(); - - /** - * Returns by pointer, unit of angle: revolution. + * Returns by value, unit of angle: radian. + * Also see {@link #createRadian()}. + * @stable ICU 64 + */ + static MeasureUnit getRadian(); + + /** + * Returns by pointer, unit of angle: revolution. * Caller owns returned value and must free it. - * Also see {@link #getRevolutionAngle()}. + * Also see {@link #getRevolutionAngle()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createRevolutionAngle(UErrorCode &status); /** - * Returns by value, unit of angle: revolution. - * Also see {@link #createRevolutionAngle()}. - * @stable ICU 64 - */ - static MeasureUnit getRevolutionAngle(); - - /** - * Returns by pointer, unit of area: acre. + * Returns by value, unit of angle: revolution. + * Also see {@link #createRevolutionAngle()}. + * @stable ICU 64 + */ + static MeasureUnit getRevolutionAngle(); + + /** + * Returns by pointer, unit of area: acre. * Caller owns returned value and must free it. - * Also see {@link #getAcre()}. + * Also see {@link #getAcre()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createAcre(UErrorCode &status); /** - * Returns by value, unit of area: acre. - * Also see {@link #createAcre()}. - * @stable ICU 64 - */ - static MeasureUnit getAcre(); - - /** - * Returns by pointer, unit of area: dunam. - * Caller owns returned value and must free it. - * Also see {@link #getDunam()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createDunam(UErrorCode &status); - - /** - * Returns by value, unit of area: dunam. - * Also see {@link #createDunam()}. - * @stable ICU 64 - */ - static MeasureUnit getDunam(); - - /** - * Returns by pointer, unit of area: hectare. + * Returns by value, unit of area: acre. + * Also see {@link #createAcre()}. + * @stable ICU 64 + */ + static MeasureUnit getAcre(); + + /** + * Returns by pointer, unit of area: dunam. * Caller owns returned value and must free it. - * Also see {@link #getHectare()}. + * Also see {@link #getDunam()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createDunam(UErrorCode &status); + + /** + * Returns by value, unit of area: dunam. + * Also see {@link #createDunam()}. + * @stable ICU 64 + */ + static MeasureUnit getDunam(); + + /** + * Returns by pointer, unit of area: hectare. + * Caller owns returned value and must free it. + * Also see {@link #getHectare()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createHectare(UErrorCode &status); /** - * Returns by value, unit of area: hectare. - * Also see {@link #createHectare()}. - * @stable ICU 64 - */ - static MeasureUnit getHectare(); - - /** - * Returns by pointer, unit of area: square-centimeter. + * Returns by value, unit of area: hectare. + * Also see {@link #createHectare()}. + * @stable ICU 64 + */ + static MeasureUnit getHectare(); + + /** + * Returns by pointer, unit of area: square-centimeter. * Caller owns returned value and must free it. - * Also see {@link #getSquareCentimeter()}. + * Also see {@link #getSquareCentimeter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createSquareCentimeter(UErrorCode &status); /** - * Returns by value, unit of area: square-centimeter. - * Also see {@link #createSquareCentimeter()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareCentimeter(); - - /** - * Returns by pointer, unit of area: square-foot. + * Returns by value, unit of area: square-centimeter. + * Also see {@link #createSquareCentimeter()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareCentimeter(); + + /** + * Returns by pointer, unit of area: square-foot. * Caller owns returned value and must free it. - * Also see {@link #getSquareFoot()}. + * Also see {@link #getSquareFoot()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createSquareFoot(UErrorCode &status); /** - * Returns by value, unit of area: square-foot. - * Also see {@link #createSquareFoot()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareFoot(); - - /** - * Returns by pointer, unit of area: square-inch. + * Returns by value, unit of area: square-foot. + * Also see {@link #createSquareFoot()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareFoot(); + + /** + * Returns by pointer, unit of area: square-inch. * Caller owns returned value and must free it. - * Also see {@link #getSquareInch()}. + * Also see {@link #getSquareInch()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createSquareInch(UErrorCode &status); /** - * Returns by value, unit of area: square-inch. - * Also see {@link #createSquareInch()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareInch(); - - /** - * Returns by pointer, unit of area: square-kilometer. + * Returns by value, unit of area: square-inch. + * Also see {@link #createSquareInch()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareInch(); + + /** + * Returns by pointer, unit of area: square-kilometer. * Caller owns returned value and must free it. - * Also see {@link #getSquareKilometer()}. + * Also see {@link #getSquareKilometer()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createSquareKilometer(UErrorCode &status); /** - * Returns by value, unit of area: square-kilometer. - * Also see {@link #createSquareKilometer()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareKilometer(); - - /** - * Returns by pointer, unit of area: square-meter. + * Returns by value, unit of area: square-kilometer. + * Also see {@link #createSquareKilometer()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareKilometer(); + + /** + * Returns by pointer, unit of area: square-meter. * Caller owns returned value and must free it. - * Also see {@link #getSquareMeter()}. + * Also see {@link #getSquareMeter()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createSquareMeter(UErrorCode &status); /** - * Returns by value, unit of area: square-meter. - * Also see {@link #createSquareMeter()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareMeter(); - - /** - * Returns by pointer, unit of area: square-mile. + * Returns by value, unit of area: square-meter. + * Also see {@link #createSquareMeter()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareMeter(); + + /** + * Returns by pointer, unit of area: square-mile. * Caller owns returned value and must free it. - * Also see {@link #getSquareMile()}. + * Also see {@link #getSquareMile()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createSquareMile(UErrorCode &status); /** - * Returns by value, unit of area: square-mile. - * Also see {@link #createSquareMile()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareMile(); - - /** - * Returns by pointer, unit of area: square-yard. + * Returns by value, unit of area: square-mile. + * Also see {@link #createSquareMile()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareMile(); + + /** + * Returns by pointer, unit of area: square-yard. * Caller owns returned value and must free it. - * Also see {@link #getSquareYard()}. + * Also see {@link #getSquareYard()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createSquareYard(UErrorCode &status); /** - * Returns by value, unit of area: square-yard. - * Also see {@link #createSquareYard()}. - * @stable ICU 64 - */ - static MeasureUnit getSquareYard(); - - /** - * Returns by pointer, unit of concentr: karat. + * Returns by value, unit of area: square-yard. + * Also see {@link #createSquareYard()}. + * @stable ICU 64 + */ + static MeasureUnit getSquareYard(); + + /** + * Returns by pointer, unit of concentr: karat. * Caller owns returned value and must free it. - * Also see {@link #getKarat()}. + * Also see {@link #getKarat()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKarat(UErrorCode &status); /** - * Returns by value, unit of concentr: karat. - * Also see {@link #createKarat()}. - * @stable ICU 64 - */ - static MeasureUnit getKarat(); - - /** - * Returns by pointer, unit of concentr: milligram-per-deciliter. + * Returns by value, unit of concentr: karat. + * Also see {@link #createKarat()}. + * @stable ICU 64 + */ + static MeasureUnit getKarat(); + + /** + * Returns by pointer, unit of concentr: milligram-per-deciliter. * Caller owns returned value and must free it. - * Also see {@link #getMilligramPerDeciliter()}. + * Also see {@link #getMilligramPerDeciliter()}. * @param status ICU error code. - * @stable ICU 57 + * @stable ICU 57 */ static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status); /** - * Returns by value, unit of concentr: milligram-per-deciliter. - * Also see {@link #createMilligramPerDeciliter()}. - * @stable ICU 64 - */ - static MeasureUnit getMilligramPerDeciliter(); - - /** - * Returns by pointer, unit of concentr: millimole-per-liter. + * Returns by value, unit of concentr: milligram-per-deciliter. + * Also see {@link #createMilligramPerDeciliter()}. + * @stable ICU 64 + */ + static MeasureUnit getMilligramPerDeciliter(); + + /** + * Returns by pointer, unit of concentr: millimole-per-liter. * Caller owns returned value and must free it. - * Also see {@link #getMillimolePerLiter()}. + * Also see {@link #getMillimolePerLiter()}. * @param status ICU error code. - * @stable ICU 57 + * @stable ICU 57 */ static MeasureUnit *createMillimolePerLiter(UErrorCode &status); /** - * Returns by value, unit of concentr: millimole-per-liter. - * Also see {@link #createMillimolePerLiter()}. - * @stable ICU 64 - */ - static MeasureUnit getMillimolePerLiter(); - - /** - * Returns by pointer, unit of concentr: mole. + * Returns by value, unit of concentr: millimole-per-liter. + * Also see {@link #createMillimolePerLiter()}. + * @stable ICU 64 + */ + static MeasureUnit getMillimolePerLiter(); + + /** + * Returns by pointer, unit of concentr: mole. * Caller owns returned value and must free it. - * Also see {@link #getMole()}. + * Also see {@link #getMole()}. * @param status ICU error code. - * @stable ICU 64 + * @stable ICU 64 */ - static MeasureUnit *createMole(UErrorCode &status); + static MeasureUnit *createMole(UErrorCode &status); /** - * Returns by value, unit of concentr: mole. - * Also see {@link #createMole()}. - * @stable ICU 64 - */ - static MeasureUnit getMole(); - - /** - * Returns by pointer, unit of concentr: permillion. + * Returns by value, unit of concentr: mole. + * Also see {@link #createMole()}. + * @stable ICU 64 + */ + static MeasureUnit getMole(); + + /** + * Returns by pointer, unit of concentr: permillion. * Caller owns returned value and must free it. - * Also see {@link #getPartPerMillion()}. + * Also see {@link #getPartPerMillion()}. * @param status ICU error code. - * @stable ICU 57 + * @stable ICU 57 */ - static MeasureUnit *createPartPerMillion(UErrorCode &status); + static MeasureUnit *createPartPerMillion(UErrorCode &status); /** - * Returns by value, unit of concentr: permillion. - * Also see {@link #createPartPerMillion()}. - * @stable ICU 64 - */ - static MeasureUnit getPartPerMillion(); - - /** - * Returns by pointer, unit of concentr: percent. + * Returns by value, unit of concentr: permillion. + * Also see {@link #createPartPerMillion()}. + * @stable ICU 64 + */ + static MeasureUnit getPartPerMillion(); + + /** + * Returns by pointer, unit of concentr: percent. * Caller owns returned value and must free it. - * Also see {@link #getPercent()}. + * Also see {@link #getPercent()}. * @param status ICU error code. - * @stable ICU 63 + * @stable ICU 63 */ - static MeasureUnit *createPercent(UErrorCode &status); + static MeasureUnit *createPercent(UErrorCode &status); /** - * Returns by value, unit of concentr: percent. - * Also see {@link #createPercent()}. - * @stable ICU 64 - */ - static MeasureUnit getPercent(); - - /** - * Returns by pointer, unit of concentr: permille. + * Returns by value, unit of concentr: percent. + * Also see {@link #createPercent()}. + * @stable ICU 64 + */ + static MeasureUnit getPercent(); + + /** + * Returns by pointer, unit of concentr: permille. * Caller owns returned value and must free it. - * Also see {@link #getPermille()}. + * Also see {@link #getPermille()}. * @param status ICU error code. - * @stable ICU 63 + * @stable ICU 63 */ - static MeasureUnit *createPermille(UErrorCode &status); + static MeasureUnit *createPermille(UErrorCode &status); /** - * Returns by value, unit of concentr: permille. - * Also see {@link #createPermille()}. - * @stable ICU 64 - */ - static MeasureUnit getPermille(); - - /** - * Returns by pointer, unit of concentr: permyriad. + * Returns by value, unit of concentr: permille. + * Also see {@link #createPermille()}. + * @stable ICU 64 + */ + static MeasureUnit getPermille(); + + /** + * Returns by pointer, unit of concentr: permyriad. * Caller owns returned value and must free it. - * Also see {@link #getPermyriad()}. + * Also see {@link #getPermyriad()}. * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createPermyriad(UErrorCode &status); - - /** - * Returns by value, unit of concentr: permyriad. - * Also see {@link #createPermyriad()}. - * @stable ICU 64 + * @stable ICU 64 */ - static MeasureUnit getPermyriad(); + static MeasureUnit *createPermyriad(UErrorCode &status); /** - * Returns by pointer, unit of consumption: liter-per-100-kilometer. + * Returns by value, unit of concentr: permyriad. + * Also see {@link #createPermyriad()}. + * @stable ICU 64 + */ + static MeasureUnit getPermyriad(); + + /** + * Returns by pointer, unit of consumption: liter-per-100-kilometer. * Caller owns returned value and must free it. - * Also see {@link #getLiterPer100Kilometers()}. + * Also see {@link #getLiterPer100Kilometers()}. * @param status ICU error code. - * @stable ICU 56 - */ - static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); - - /** - * Returns by value, unit of consumption: liter-per-100-kilometer. - * Also see {@link #createLiterPer100Kilometers()}. - * @stable ICU 64 + * @stable ICU 56 */ - static MeasureUnit getLiterPer100Kilometers(); + static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); /** - * Returns by pointer, unit of consumption: liter-per-kilometer. + * Returns by value, unit of consumption: liter-per-100-kilometer. + * Also see {@link #createLiterPer100Kilometers()}. + * @stable ICU 64 + */ + static MeasureUnit getLiterPer100Kilometers(); + + /** + * Returns by pointer, unit of consumption: liter-per-kilometer. * Caller owns returned value and must free it. - * Also see {@link #getLiterPerKilometer()}. + * Also see {@link #getLiterPerKilometer()}. * @param status ICU error code. - * @stable ICU 54 + * @stable ICU 54 */ - static MeasureUnit *createLiterPerKilometer(UErrorCode &status); + static MeasureUnit *createLiterPerKilometer(UErrorCode &status); /** - * Returns by value, unit of consumption: liter-per-kilometer. - * Also see {@link #createLiterPerKilometer()}. - * @stable ICU 64 - */ - static MeasureUnit getLiterPerKilometer(); - - /** - * Returns by pointer, unit of consumption: mile-per-gallon. + * Returns by value, unit of consumption: liter-per-kilometer. + * Also see {@link #createLiterPerKilometer()}. + * @stable ICU 64 + */ + static MeasureUnit getLiterPerKilometer(); + + /** + * Returns by pointer, unit of consumption: mile-per-gallon. * Caller owns returned value and must free it. - * Also see {@link #getMilePerGallon()}. + * Also see {@link #getMilePerGallon()}. * @param status ICU error code. - * @stable ICU 54 + * @stable ICU 54 */ - static MeasureUnit *createMilePerGallon(UErrorCode &status); + static MeasureUnit *createMilePerGallon(UErrorCode &status); /** - * Returns by value, unit of consumption: mile-per-gallon. - * Also see {@link #createMilePerGallon()}. - * @stable ICU 64 - */ - static MeasureUnit getMilePerGallon(); - - /** - * Returns by pointer, unit of consumption: mile-per-gallon-imperial. + * Returns by value, unit of consumption: mile-per-gallon. + * Also see {@link #createMilePerGallon()}. + * @stable ICU 64 + */ + static MeasureUnit getMilePerGallon(); + + /** + * Returns by pointer, unit of consumption: mile-per-gallon-imperial. * Caller owns returned value and must free it. - * Also see {@link #getMilePerGallonImperial()}. + * Also see {@link #getMilePerGallonImperial()}. * @param status ICU error code. - * @stable ICU 57 + * @stable ICU 57 */ - static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); + static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); /** - * Returns by value, unit of consumption: mile-per-gallon-imperial. - * Also see {@link #createMilePerGallonImperial()}. - * @stable ICU 64 - */ - static MeasureUnit getMilePerGallonImperial(); - - /** - * Returns by pointer, unit of digital: bit. + * Returns by value, unit of consumption: mile-per-gallon-imperial. + * Also see {@link #createMilePerGallonImperial()}. + * @stable ICU 64 + */ + static MeasureUnit getMilePerGallonImperial(); + + /** + * Returns by pointer, unit of digital: bit. * Caller owns returned value and must free it. - * Also see {@link #getBit()}. + * Also see {@link #getBit()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createBit(UErrorCode &status); /** - * Returns by value, unit of digital: bit. - * Also see {@link #createBit()}. - * @stable ICU 64 - */ - static MeasureUnit getBit(); - - /** - * Returns by pointer, unit of digital: byte. + * Returns by value, unit of digital: bit. + * Also see {@link #createBit()}. + * @stable ICU 64 + */ + static MeasureUnit getBit(); + + /** + * Returns by pointer, unit of digital: byte. * Caller owns returned value and must free it. - * Also see {@link #getByte()}. + * Also see {@link #getByte()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createByte(UErrorCode &status); /** - * Returns by value, unit of digital: byte. - * Also see {@link #createByte()}. - * @stable ICU 64 - */ - static MeasureUnit getByte(); - - /** - * Returns by pointer, unit of digital: gigabit. + * Returns by value, unit of digital: byte. + * Also see {@link #createByte()}. + * @stable ICU 64 + */ + static MeasureUnit getByte(); + + /** + * Returns by pointer, unit of digital: gigabit. * Caller owns returned value and must free it. - * Also see {@link #getGigabit()}. + * Also see {@link #getGigabit()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createGigabit(UErrorCode &status); /** - * Returns by value, unit of digital: gigabit. - * Also see {@link #createGigabit()}. - * @stable ICU 64 - */ - static MeasureUnit getGigabit(); - - /** - * Returns by pointer, unit of digital: gigabyte. + * Returns by value, unit of digital: gigabit. + * Also see {@link #createGigabit()}. + * @stable ICU 64 + */ + static MeasureUnit getGigabit(); + + /** + * Returns by pointer, unit of digital: gigabyte. * Caller owns returned value and must free it. - * Also see {@link #getGigabyte()}. + * Also see {@link #getGigabyte()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createGigabyte(UErrorCode &status); /** - * Returns by value, unit of digital: gigabyte. - * Also see {@link #createGigabyte()}. - * @stable ICU 64 - */ - static MeasureUnit getGigabyte(); - - /** - * Returns by pointer, unit of digital: kilobit. + * Returns by value, unit of digital: gigabyte. + * Also see {@link #createGigabyte()}. + * @stable ICU 64 + */ + static MeasureUnit getGigabyte(); + + /** + * Returns by pointer, unit of digital: kilobit. * Caller owns returned value and must free it. - * Also see {@link #getKilobit()}. + * Also see {@link #getKilobit()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilobit(UErrorCode &status); /** - * Returns by value, unit of digital: kilobit. - * Also see {@link #createKilobit()}. - * @stable ICU 64 - */ - static MeasureUnit getKilobit(); - - /** - * Returns by pointer, unit of digital: kilobyte. + * Returns by value, unit of digital: kilobit. + * Also see {@link #createKilobit()}. + * @stable ICU 64 + */ + static MeasureUnit getKilobit(); + + /** + * Returns by pointer, unit of digital: kilobyte. * Caller owns returned value and must free it. - * Also see {@link #getKilobyte()}. + * Also see {@link #getKilobyte()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilobyte(UErrorCode &status); /** - * Returns by value, unit of digital: kilobyte. - * Also see {@link #createKilobyte()}. - * @stable ICU 64 - */ - static MeasureUnit getKilobyte(); - - /** - * Returns by pointer, unit of digital: megabit. + * Returns by value, unit of digital: kilobyte. + * Also see {@link #createKilobyte()}. + * @stable ICU 64 + */ + static MeasureUnit getKilobyte(); + + /** + * Returns by pointer, unit of digital: megabit. * Caller owns returned value and must free it. - * Also see {@link #getMegabit()}. + * Also see {@link #getMegabit()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMegabit(UErrorCode &status); /** - * Returns by value, unit of digital: megabit. - * Also see {@link #createMegabit()}. - * @stable ICU 64 - */ - static MeasureUnit getMegabit(); - - /** - * Returns by pointer, unit of digital: megabyte. + * Returns by value, unit of digital: megabit. + * Also see {@link #createMegabit()}. + * @stable ICU 64 + */ + static MeasureUnit getMegabit(); + + /** + * Returns by pointer, unit of digital: megabyte. * Caller owns returned value and must free it. - * Also see {@link #getMegabyte()}. + * Also see {@link #getMegabyte()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMegabyte(UErrorCode &status); /** - * Returns by value, unit of digital: megabyte. - * Also see {@link #createMegabyte()}. - * @stable ICU 64 - */ - static MeasureUnit getMegabyte(); - - /** - * Returns by pointer, unit of digital: petabyte. - * Caller owns returned value and must free it. - * Also see {@link #getPetabyte()}. - * @param status ICU error code. - * @stable ICU 63 - */ - static MeasureUnit *createPetabyte(UErrorCode &status); - - /** - * Returns by value, unit of digital: petabyte. - * Also see {@link #createPetabyte()}. - * @stable ICU 64 - */ - static MeasureUnit getPetabyte(); - - /** - * Returns by pointer, unit of digital: terabit. + * Returns by value, unit of digital: megabyte. + * Also see {@link #createMegabyte()}. + * @stable ICU 64 + */ + static MeasureUnit getMegabyte(); + + /** + * Returns by pointer, unit of digital: petabyte. * Caller owns returned value and must free it. - * Also see {@link #getTerabit()}. + * Also see {@link #getPetabyte()}. * @param status ICU error code. + * @stable ICU 63 + */ + static MeasureUnit *createPetabyte(UErrorCode &status); + + /** + * Returns by value, unit of digital: petabyte. + * Also see {@link #createPetabyte()}. + * @stable ICU 64 + */ + static MeasureUnit getPetabyte(); + + /** + * Returns by pointer, unit of digital: terabit. + * Caller owns returned value and must free it. + * Also see {@link #getTerabit()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createTerabit(UErrorCode &status); /** - * Returns by value, unit of digital: terabit. - * Also see {@link #createTerabit()}. - * @stable ICU 64 - */ - static MeasureUnit getTerabit(); - - /** - * Returns by pointer, unit of digital: terabyte. + * Returns by value, unit of digital: terabit. + * Also see {@link #createTerabit()}. + * @stable ICU 64 + */ + static MeasureUnit getTerabit(); + + /** + * Returns by pointer, unit of digital: terabyte. * Caller owns returned value and must free it. - * Also see {@link #getTerabyte()}. + * Also see {@link #getTerabyte()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createTerabyte(UErrorCode &status); /** - * Returns by value, unit of digital: terabyte. - * Also see {@link #createTerabyte()}. - * @stable ICU 64 - */ - static MeasureUnit getTerabyte(); - - /** - * Returns by pointer, unit of duration: century. + * Returns by value, unit of digital: terabyte. + * Also see {@link #createTerabyte()}. + * @stable ICU 64 + */ + static MeasureUnit getTerabyte(); + + /** + * Returns by pointer, unit of duration: century. * Caller owns returned value and must free it. - * Also see {@link #getCentury()}. + * Also see {@link #getCentury()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createCentury(UErrorCode &status); /** - * Returns by value, unit of duration: century. - * Also see {@link #createCentury()}. - * @stable ICU 64 - */ - static MeasureUnit getCentury(); - - /** - * Returns by pointer, unit of duration: day. + * Returns by value, unit of duration: century. + * Also see {@link #createCentury()}. + * @stable ICU 64 + */ + static MeasureUnit getCentury(); + + /** + * Returns by pointer, unit of duration: day. * Caller owns returned value and must free it. - * Also see {@link #getDay()}. + * Also see {@link #getDay()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createDay(UErrorCode &status); /** - * Returns by value, unit of duration: day. - * Also see {@link #createDay()}. - * @stable ICU 64 - */ - static MeasureUnit getDay(); - - /** - * Returns by pointer, unit of duration: day-person. - * Caller owns returned value and must free it. - * Also see {@link #getDayPerson()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createDayPerson(UErrorCode &status); - - /** - * Returns by value, unit of duration: day-person. - * Also see {@link #createDayPerson()}. - * @stable ICU 64 - */ - static MeasureUnit getDayPerson(); - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of duration: decade. - * Caller owns returned value and must free it. - * Also see {@link #getDecade()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createDecade(UErrorCode &status); - - /** - * Returns by value, unit of duration: decade. - * Also see {@link #createDecade()}. - * @draft ICU 65 - */ - static MeasureUnit getDecade(); -#endif /* U_HIDE_DRAFT_API */ - - /** - * Returns by pointer, unit of duration: hour. + * Returns by value, unit of duration: day. + * Also see {@link #createDay()}. + * @stable ICU 64 + */ + static MeasureUnit getDay(); + + /** + * Returns by pointer, unit of duration: day-person. * Caller owns returned value and must free it. - * Also see {@link #getHour()}. + * Also see {@link #getDayPerson()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createDayPerson(UErrorCode &status); + + /** + * Returns by value, unit of duration: day-person. + * Also see {@link #createDayPerson()}. + * @stable ICU 64 + */ + static MeasureUnit getDayPerson(); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of duration: decade. + * Caller owns returned value and must free it. + * Also see {@link #getDecade()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createDecade(UErrorCode &status); + + /** + * Returns by value, unit of duration: decade. + * Also see {@link #createDecade()}. + * @draft ICU 65 + */ + static MeasureUnit getDecade(); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns by pointer, unit of duration: hour. + * Caller owns returned value and must free it. + * Also see {@link #getHour()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createHour(UErrorCode &status); /** - * Returns by value, unit of duration: hour. - * Also see {@link #createHour()}. - * @stable ICU 64 - */ - static MeasureUnit getHour(); - - /** - * Returns by pointer, unit of duration: microsecond. + * Returns by value, unit of duration: hour. + * Also see {@link #createHour()}. + * @stable ICU 64 + */ + static MeasureUnit getHour(); + + /** + * Returns by pointer, unit of duration: microsecond. * Caller owns returned value and must free it. - * Also see {@link #getMicrosecond()}. + * Also see {@link #getMicrosecond()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMicrosecond(UErrorCode &status); /** - * Returns by value, unit of duration: microsecond. - * Also see {@link #createMicrosecond()}. - * @stable ICU 64 - */ - static MeasureUnit getMicrosecond(); - - /** - * Returns by pointer, unit of duration: millisecond. + * Returns by value, unit of duration: microsecond. + * Also see {@link #createMicrosecond()}. + * @stable ICU 64 + */ + static MeasureUnit getMicrosecond(); + + /** + * Returns by pointer, unit of duration: millisecond. * Caller owns returned value and must free it. - * Also see {@link #getMillisecond()}. + * Also see {@link #getMillisecond()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMillisecond(UErrorCode &status); /** - * Returns by value, unit of duration: millisecond. - * Also see {@link #createMillisecond()}. - * @stable ICU 64 - */ - static MeasureUnit getMillisecond(); - - /** - * Returns by pointer, unit of duration: minute. + * Returns by value, unit of duration: millisecond. + * Also see {@link #createMillisecond()}. + * @stable ICU 64 + */ + static MeasureUnit getMillisecond(); + + /** + * Returns by pointer, unit of duration: minute. * Caller owns returned value and must free it. - * Also see {@link #getMinute()}. + * Also see {@link #getMinute()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMinute(UErrorCode &status); /** - * Returns by value, unit of duration: minute. - * Also see {@link #createMinute()}. - * @stable ICU 64 - */ - static MeasureUnit getMinute(); - - /** - * Returns by pointer, unit of duration: month. + * Returns by value, unit of duration: minute. + * Also see {@link #createMinute()}. + * @stable ICU 64 + */ + static MeasureUnit getMinute(); + + /** + * Returns by pointer, unit of duration: month. * Caller owns returned value and must free it. - * Also see {@link #getMonth()}. + * Also see {@link #getMonth()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMonth(UErrorCode &status); /** - * Returns by value, unit of duration: month. - * Also see {@link #createMonth()}. - * @stable ICU 64 - */ - static MeasureUnit getMonth(); - - /** - * Returns by pointer, unit of duration: month-person. - * Caller owns returned value and must free it. - * Also see {@link #getMonthPerson()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createMonthPerson(UErrorCode &status); - - /** - * Returns by value, unit of duration: month-person. - * Also see {@link #createMonthPerson()}. - * @stable ICU 64 - */ - static MeasureUnit getMonthPerson(); - - /** - * Returns by pointer, unit of duration: nanosecond. + * Returns by value, unit of duration: month. + * Also see {@link #createMonth()}. + * @stable ICU 64 + */ + static MeasureUnit getMonth(); + + /** + * Returns by pointer, unit of duration: month-person. * Caller owns returned value and must free it. - * Also see {@link #getNanosecond()}. + * Also see {@link #getMonthPerson()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createMonthPerson(UErrorCode &status); + + /** + * Returns by value, unit of duration: month-person. + * Also see {@link #createMonthPerson()}. + * @stable ICU 64 + */ + static MeasureUnit getMonthPerson(); + + /** + * Returns by pointer, unit of duration: nanosecond. + * Caller owns returned value and must free it. + * Also see {@link #getNanosecond()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createNanosecond(UErrorCode &status); /** - * Returns by value, unit of duration: nanosecond. - * Also see {@link #createNanosecond()}. - * @stable ICU 64 - */ - static MeasureUnit getNanosecond(); - - /** - * Returns by pointer, unit of duration: second. + * Returns by value, unit of duration: nanosecond. + * Also see {@link #createNanosecond()}. + * @stable ICU 64 + */ + static MeasureUnit getNanosecond(); + + /** + * Returns by pointer, unit of duration: second. * Caller owns returned value and must free it. - * Also see {@link #getSecond()}. + * Also see {@link #getSecond()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createSecond(UErrorCode &status); /** - * Returns by value, unit of duration: second. - * Also see {@link #createSecond()}. - * @stable ICU 64 - */ - static MeasureUnit getSecond(); - - /** - * Returns by pointer, unit of duration: week. + * Returns by value, unit of duration: second. + * Also see {@link #createSecond()}. + * @stable ICU 64 + */ + static MeasureUnit getSecond(); + + /** + * Returns by pointer, unit of duration: week. * Caller owns returned value and must free it. - * Also see {@link #getWeek()}. + * Also see {@link #getWeek()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createWeek(UErrorCode &status); /** - * Returns by value, unit of duration: week. - * Also see {@link #createWeek()}. - * @stable ICU 64 - */ - static MeasureUnit getWeek(); - - /** - * Returns by pointer, unit of duration: week-person. - * Caller owns returned value and must free it. - * Also see {@link #getWeekPerson()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createWeekPerson(UErrorCode &status); - - /** - * Returns by value, unit of duration: week-person. - * Also see {@link #createWeekPerson()}. - * @stable ICU 64 - */ - static MeasureUnit getWeekPerson(); - - /** - * Returns by pointer, unit of duration: year. + * Returns by value, unit of duration: week. + * Also see {@link #createWeek()}. + * @stable ICU 64 + */ + static MeasureUnit getWeek(); + + /** + * Returns by pointer, unit of duration: week-person. * Caller owns returned value and must free it. - * Also see {@link #getYear()}. + * Also see {@link #getWeekPerson()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createWeekPerson(UErrorCode &status); + + /** + * Returns by value, unit of duration: week-person. + * Also see {@link #createWeekPerson()}. + * @stable ICU 64 + */ + static MeasureUnit getWeekPerson(); + + /** + * Returns by pointer, unit of duration: year. + * Caller owns returned value and must free it. + * Also see {@link #getYear()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createYear(UErrorCode &status); /** - * Returns by value, unit of duration: year. - * Also see {@link #createYear()}. - * @stable ICU 64 - */ - static MeasureUnit getYear(); - - /** - * Returns by pointer, unit of duration: year-person. - * Caller owns returned value and must free it. - * Also see {@link #getYearPerson()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createYearPerson(UErrorCode &status); - - /** - * Returns by value, unit of duration: year-person. - * Also see {@link #createYearPerson()}. - * @stable ICU 64 - */ - static MeasureUnit getYearPerson(); - - /** - * Returns by pointer, unit of electric: ampere. + * Returns by value, unit of duration: year. + * Also see {@link #createYear()}. + * @stable ICU 64 + */ + static MeasureUnit getYear(); + + /** + * Returns by pointer, unit of duration: year-person. * Caller owns returned value and must free it. - * Also see {@link #getAmpere()}. + * Also see {@link #getYearPerson()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createYearPerson(UErrorCode &status); + + /** + * Returns by value, unit of duration: year-person. + * Also see {@link #createYearPerson()}. + * @stable ICU 64 + */ + static MeasureUnit getYearPerson(); + + /** + * Returns by pointer, unit of electric: ampere. + * Caller owns returned value and must free it. + * Also see {@link #getAmpere()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createAmpere(UErrorCode &status); /** - * Returns by value, unit of electric: ampere. - * Also see {@link #createAmpere()}. - * @stable ICU 64 - */ - static MeasureUnit getAmpere(); - - /** - * Returns by pointer, unit of electric: milliampere. + * Returns by value, unit of electric: ampere. + * Also see {@link #createAmpere()}. + * @stable ICU 64 + */ + static MeasureUnit getAmpere(); + + /** + * Returns by pointer, unit of electric: milliampere. * Caller owns returned value and must free it. - * Also see {@link #getMilliampere()}. + * Also see {@link #getMilliampere()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMilliampere(UErrorCode &status); /** - * Returns by value, unit of electric: milliampere. - * Also see {@link #createMilliampere()}. - * @stable ICU 64 - */ - static MeasureUnit getMilliampere(); - - /** - * Returns by pointer, unit of electric: ohm. + * Returns by value, unit of electric: milliampere. + * Also see {@link #createMilliampere()}. + * @stable ICU 64 + */ + static MeasureUnit getMilliampere(); + + /** + * Returns by pointer, unit of electric: ohm. * Caller owns returned value and must free it. - * Also see {@link #getOhm()}. + * Also see {@link #getOhm()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createOhm(UErrorCode &status); /** - * Returns by value, unit of electric: ohm. - * Also see {@link #createOhm()}. - * @stable ICU 64 - */ - static MeasureUnit getOhm(); - - /** - * Returns by pointer, unit of electric: volt. + * Returns by value, unit of electric: ohm. + * Also see {@link #createOhm()}. + * @stable ICU 64 + */ + static MeasureUnit getOhm(); + + /** + * Returns by pointer, unit of electric: volt. * Caller owns returned value and must free it. - * Also see {@link #getVolt()}. + * Also see {@link #getVolt()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createVolt(UErrorCode &status); /** - * Returns by value, unit of electric: volt. - * Also see {@link #createVolt()}. - * @stable ICU 64 - */ - static MeasureUnit getVolt(); - - /** - * Returns by pointer, unit of energy: british-thermal-unit. - * Caller owns returned value and must free it. - * Also see {@link #getBritishThermalUnit()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createBritishThermalUnit(UErrorCode &status); - - /** - * Returns by value, unit of energy: british-thermal-unit. - * Also see {@link #createBritishThermalUnit()}. - * @stable ICU 64 - */ - static MeasureUnit getBritishThermalUnit(); - - /** - * Returns by pointer, unit of energy: calorie. + * Returns by value, unit of electric: volt. + * Also see {@link #createVolt()}. + * @stable ICU 64 + */ + static MeasureUnit getVolt(); + + /** + * Returns by pointer, unit of energy: british-thermal-unit. * Caller owns returned value and must free it. - * Also see {@link #getCalorie()}. + * Also see {@link #getBritishThermalUnit()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createBritishThermalUnit(UErrorCode &status); + + /** + * Returns by value, unit of energy: british-thermal-unit. + * Also see {@link #createBritishThermalUnit()}. + * @stable ICU 64 + */ + static MeasureUnit getBritishThermalUnit(); + + /** + * Returns by pointer, unit of energy: calorie. + * Caller owns returned value and must free it. + * Also see {@link #getCalorie()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCalorie(UErrorCode &status); /** - * Returns by value, unit of energy: calorie. - * Also see {@link #createCalorie()}. - * @stable ICU 64 - */ - static MeasureUnit getCalorie(); - - /** - * Returns by pointer, unit of energy: electronvolt. - * Caller owns returned value and must free it. - * Also see {@link #getElectronvolt()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createElectronvolt(UErrorCode &status); - - /** - * Returns by value, unit of energy: electronvolt. - * Also see {@link #createElectronvolt()}. - * @stable ICU 64 - */ - static MeasureUnit getElectronvolt(); - - /** - * Returns by pointer, unit of energy: foodcalorie. + * Returns by value, unit of energy: calorie. + * Also see {@link #createCalorie()}. + * @stable ICU 64 + */ + static MeasureUnit getCalorie(); + + /** + * Returns by pointer, unit of energy: electronvolt. * Caller owns returned value and must free it. - * Also see {@link #getFoodcalorie()}. + * Also see {@link #getElectronvolt()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createElectronvolt(UErrorCode &status); + + /** + * Returns by value, unit of energy: electronvolt. + * Also see {@link #createElectronvolt()}. + * @stable ICU 64 + */ + static MeasureUnit getElectronvolt(); + + /** + * Returns by pointer, unit of energy: foodcalorie. + * Caller owns returned value and must free it. + * Also see {@link #getFoodcalorie()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createFoodcalorie(UErrorCode &status); /** - * Returns by value, unit of energy: foodcalorie. - * Also see {@link #createFoodcalorie()}. - * @stable ICU 64 - */ - static MeasureUnit getFoodcalorie(); - - /** - * Returns by pointer, unit of energy: joule. + * Returns by value, unit of energy: foodcalorie. + * Also see {@link #createFoodcalorie()}. + * @stable ICU 64 + */ + static MeasureUnit getFoodcalorie(); + + /** + * Returns by pointer, unit of energy: joule. * Caller owns returned value and must free it. - * Also see {@link #getJoule()}. + * Also see {@link #getJoule()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createJoule(UErrorCode &status); /** - * Returns by value, unit of energy: joule. - * Also see {@link #createJoule()}. - * @stable ICU 64 - */ - static MeasureUnit getJoule(); - - /** - * Returns by pointer, unit of energy: kilocalorie. + * Returns by value, unit of energy: joule. + * Also see {@link #createJoule()}. + * @stable ICU 64 + */ + static MeasureUnit getJoule(); + + /** + * Returns by pointer, unit of energy: kilocalorie. * Caller owns returned value and must free it. - * Also see {@link #getKilocalorie()}. + * Also see {@link #getKilocalorie()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilocalorie(UErrorCode &status); /** - * Returns by value, unit of energy: kilocalorie. - * Also see {@link #createKilocalorie()}. - * @stable ICU 64 - */ - static MeasureUnit getKilocalorie(); - - /** - * Returns by pointer, unit of energy: kilojoule. + * Returns by value, unit of energy: kilocalorie. + * Also see {@link #createKilocalorie()}. + * @stable ICU 64 + */ + static MeasureUnit getKilocalorie(); + + /** + * Returns by pointer, unit of energy: kilojoule. * Caller owns returned value and must free it. - * Also see {@link #getKilojoule()}. + * Also see {@link #getKilojoule()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilojoule(UErrorCode &status); /** - * Returns by value, unit of energy: kilojoule. - * Also see {@link #createKilojoule()}. - * @stable ICU 64 - */ - static MeasureUnit getKilojoule(); - - /** - * Returns by pointer, unit of energy: kilowatt-hour. + * Returns by value, unit of energy: kilojoule. + * Also see {@link #createKilojoule()}. + * @stable ICU 64 + */ + static MeasureUnit getKilojoule(); + + /** + * Returns by pointer, unit of energy: kilowatt-hour. * Caller owns returned value and must free it. - * Also see {@link #getKilowattHour()}. + * Also see {@link #getKilowattHour()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilowattHour(UErrorCode &status); /** - * Returns by value, unit of energy: kilowatt-hour. - * Also see {@link #createKilowattHour()}. - * @stable ICU 64 - */ - static MeasureUnit getKilowattHour(); - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of energy: therm-us. - * Caller owns returned value and must free it. - * Also see {@link #getThermUs()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createThermUs(UErrorCode &status); - - /** - * Returns by value, unit of energy: therm-us. - * Also see {@link #createThermUs()}. - * @draft ICU 65 - */ - static MeasureUnit getThermUs(); -#endif /* U_HIDE_DRAFT_API */ - - /** - * Returns by pointer, unit of force: newton. - * Caller owns returned value and must free it. - * Also see {@link #getNewton()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createNewton(UErrorCode &status); - - /** - * Returns by value, unit of force: newton. - * Also see {@link #createNewton()}. - * @stable ICU 64 - */ - static MeasureUnit getNewton(); - - /** - * Returns by pointer, unit of force: pound-force. - * Caller owns returned value and must free it. - * Also see {@link #getPoundForce()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createPoundForce(UErrorCode &status); - - /** - * Returns by value, unit of force: pound-force. - * Also see {@link #createPoundForce()}. - * @stable ICU 64 - */ - static MeasureUnit getPoundForce(); - - /** - * Returns by pointer, unit of frequency: gigahertz. + * Returns by value, unit of energy: kilowatt-hour. + * Also see {@link #createKilowattHour()}. + * @stable ICU 64 + */ + static MeasureUnit getKilowattHour(); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of energy: therm-us. * Caller owns returned value and must free it. - * Also see {@link #getGigahertz()}. + * Also see {@link #getThermUs()}. * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createThermUs(UErrorCode &status); + + /** + * Returns by value, unit of energy: therm-us. + * Also see {@link #createThermUs()}. + * @draft ICU 65 + */ + static MeasureUnit getThermUs(); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns by pointer, unit of force: newton. + * Caller owns returned value and must free it. + * Also see {@link #getNewton()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createNewton(UErrorCode &status); + + /** + * Returns by value, unit of force: newton. + * Also see {@link #createNewton()}. + * @stable ICU 64 + */ + static MeasureUnit getNewton(); + + /** + * Returns by pointer, unit of force: pound-force. + * Caller owns returned value and must free it. + * Also see {@link #getPoundForce()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createPoundForce(UErrorCode &status); + + /** + * Returns by value, unit of force: pound-force. + * Also see {@link #createPoundForce()}. + * @stable ICU 64 + */ + static MeasureUnit getPoundForce(); + + /** + * Returns by pointer, unit of frequency: gigahertz. + * Caller owns returned value and must free it. + * Also see {@link #getGigahertz()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createGigahertz(UErrorCode &status); /** - * Returns by value, unit of frequency: gigahertz. - * Also see {@link #createGigahertz()}. - * @stable ICU 64 - */ - static MeasureUnit getGigahertz(); - - /** - * Returns by pointer, unit of frequency: hertz. + * Returns by value, unit of frequency: gigahertz. + * Also see {@link #createGigahertz()}. + * @stable ICU 64 + */ + static MeasureUnit getGigahertz(); + + /** + * Returns by pointer, unit of frequency: hertz. * Caller owns returned value and must free it. - * Also see {@link #getHertz()}. + * Also see {@link #getHertz()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createHertz(UErrorCode &status); /** - * Returns by value, unit of frequency: hertz. - * Also see {@link #createHertz()}. - * @stable ICU 64 - */ - static MeasureUnit getHertz(); - - /** - * Returns by pointer, unit of frequency: kilohertz. + * Returns by value, unit of frequency: hertz. + * Also see {@link #createHertz()}. + * @stable ICU 64 + */ + static MeasureUnit getHertz(); + + /** + * Returns by pointer, unit of frequency: kilohertz. * Caller owns returned value and must free it. - * Also see {@link #getKilohertz()}. + * Also see {@link #getKilohertz()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKilohertz(UErrorCode &status); /** - * Returns by value, unit of frequency: kilohertz. - * Also see {@link #createKilohertz()}. - * @stable ICU 64 - */ - static MeasureUnit getKilohertz(); - - /** - * Returns by pointer, unit of frequency: megahertz. + * Returns by value, unit of frequency: kilohertz. + * Also see {@link #createKilohertz()}. + * @stable ICU 64 + */ + static MeasureUnit getKilohertz(); + + /** + * Returns by pointer, unit of frequency: megahertz. * Caller owns returned value and must free it. - * Also see {@link #getMegahertz()}. + * Also see {@link #getMegahertz()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMegahertz(UErrorCode &status); /** - * Returns by value, unit of frequency: megahertz. - * Also see {@link #createMegahertz()}. - * @stable ICU 64 - */ - static MeasureUnit getMegahertz(); - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: dot-per-centimeter. - * Caller owns returned value and must free it. - * Also see {@link #getDotPerCentimeter()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createDotPerCentimeter(UErrorCode &status); - - /** - * Returns by value, unit of graphics: dot-per-centimeter. - * Also see {@link #createDotPerCentimeter()}. - * @draft ICU 65 - */ - static MeasureUnit getDotPerCentimeter(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: dot-per-inch. - * Caller owns returned value and must free it. - * Also see {@link #getDotPerInch()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createDotPerInch(UErrorCode &status); - - /** - * Returns by value, unit of graphics: dot-per-inch. - * Also see {@link #createDotPerInch()}. - * @draft ICU 65 - */ - static MeasureUnit getDotPerInch(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: em. - * Caller owns returned value and must free it. - * Also see {@link #getEm()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createEm(UErrorCode &status); - - /** - * Returns by value, unit of graphics: em. - * Also see {@link #createEm()}. - * @draft ICU 65 - */ - static MeasureUnit getEm(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: megapixel. - * Caller owns returned value and must free it. - * Also see {@link #getMegapixel()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createMegapixel(UErrorCode &status); - - /** - * Returns by value, unit of graphics: megapixel. - * Also see {@link #createMegapixel()}. - * @draft ICU 65 - */ - static MeasureUnit getMegapixel(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: pixel. - * Caller owns returned value and must free it. - * Also see {@link #getPixel()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createPixel(UErrorCode &status); - - /** - * Returns by value, unit of graphics: pixel. - * Also see {@link #createPixel()}. - * @draft ICU 65 - */ - static MeasureUnit getPixel(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: pixel-per-centimeter. - * Caller owns returned value and must free it. - * Also see {@link #getPixelPerCentimeter()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createPixelPerCentimeter(UErrorCode &status); - - /** - * Returns by value, unit of graphics: pixel-per-centimeter. - * Also see {@link #createPixelPerCentimeter()}. - * @draft ICU 65 - */ - static MeasureUnit getPixelPerCentimeter(); -#endif /* U_HIDE_DRAFT_API */ - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of graphics: pixel-per-inch. - * Caller owns returned value and must free it. - * Also see {@link #getPixelPerInch()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createPixelPerInch(UErrorCode &status); - - /** - * Returns by value, unit of graphics: pixel-per-inch. - * Also see {@link #createPixelPerInch()}. - * @draft ICU 65 - */ - static MeasureUnit getPixelPerInch(); -#endif /* U_HIDE_DRAFT_API */ - - /** - * Returns by pointer, unit of length: astronomical-unit. + * Returns by value, unit of frequency: megahertz. + * Also see {@link #createMegahertz()}. + * @stable ICU 64 + */ + static MeasureUnit getMegahertz(); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: dot-per-centimeter. * Caller owns returned value and must free it. - * Also see {@link #getAstronomicalUnit()}. + * Also see {@link #getDotPerCentimeter()}. * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createDotPerCentimeter(UErrorCode &status); + + /** + * Returns by value, unit of graphics: dot-per-centimeter. + * Also see {@link #createDotPerCentimeter()}. + * @draft ICU 65 + */ + static MeasureUnit getDotPerCentimeter(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: dot-per-inch. + * Caller owns returned value and must free it. + * Also see {@link #getDotPerInch()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createDotPerInch(UErrorCode &status); + + /** + * Returns by value, unit of graphics: dot-per-inch. + * Also see {@link #createDotPerInch()}. + * @draft ICU 65 + */ + static MeasureUnit getDotPerInch(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: em. + * Caller owns returned value and must free it. + * Also see {@link #getEm()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createEm(UErrorCode &status); + + /** + * Returns by value, unit of graphics: em. + * Also see {@link #createEm()}. + * @draft ICU 65 + */ + static MeasureUnit getEm(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: megapixel. + * Caller owns returned value and must free it. + * Also see {@link #getMegapixel()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createMegapixel(UErrorCode &status); + + /** + * Returns by value, unit of graphics: megapixel. + * Also see {@link #createMegapixel()}. + * @draft ICU 65 + */ + static MeasureUnit getMegapixel(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: pixel. + * Caller owns returned value and must free it. + * Also see {@link #getPixel()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createPixel(UErrorCode &status); + + /** + * Returns by value, unit of graphics: pixel. + * Also see {@link #createPixel()}. + * @draft ICU 65 + */ + static MeasureUnit getPixel(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: pixel-per-centimeter. + * Caller owns returned value and must free it. + * Also see {@link #getPixelPerCentimeter()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createPixelPerCentimeter(UErrorCode &status); + + /** + * Returns by value, unit of graphics: pixel-per-centimeter. + * Also see {@link #createPixelPerCentimeter()}. + * @draft ICU 65 + */ + static MeasureUnit getPixelPerCentimeter(); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of graphics: pixel-per-inch. + * Caller owns returned value and must free it. + * Also see {@link #getPixelPerInch()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createPixelPerInch(UErrorCode &status); + + /** + * Returns by value, unit of graphics: pixel-per-inch. + * Also see {@link #createPixelPerInch()}. + * @draft ICU 65 + */ + static MeasureUnit getPixelPerInch(); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns by pointer, unit of length: astronomical-unit. + * Caller owns returned value and must free it. + * Also see {@link #getAstronomicalUnit()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createAstronomicalUnit(UErrorCode &status); /** - * Returns by value, unit of length: astronomical-unit. - * Also see {@link #createAstronomicalUnit()}. - * @stable ICU 64 - */ - static MeasureUnit getAstronomicalUnit(); - - /** - * Returns by pointer, unit of length: centimeter. + * Returns by value, unit of length: astronomical-unit. + * Also see {@link #createAstronomicalUnit()}. + * @stable ICU 64 + */ + static MeasureUnit getAstronomicalUnit(); + + /** + * Returns by pointer, unit of length: centimeter. * Caller owns returned value and must free it. - * Also see {@link #getCentimeter()}. + * Also see {@link #getCentimeter()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createCentimeter(UErrorCode &status); /** - * Returns by value, unit of length: centimeter. - * Also see {@link #createCentimeter()}. - * @stable ICU 64 - */ - static MeasureUnit getCentimeter(); - - /** - * Returns by pointer, unit of length: decimeter. + * Returns by value, unit of length: centimeter. + * Also see {@link #createCentimeter()}. + * @stable ICU 64 + */ + static MeasureUnit getCentimeter(); + + /** + * Returns by pointer, unit of length: decimeter. * Caller owns returned value and must free it. - * Also see {@link #getDecimeter()}. + * Also see {@link #getDecimeter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createDecimeter(UErrorCode &status); /** - * Returns by value, unit of length: decimeter. - * Also see {@link #createDecimeter()}. - * @stable ICU 64 - */ - static MeasureUnit getDecimeter(); - - /** - * Returns by pointer, unit of length: fathom. + * Returns by value, unit of length: decimeter. + * Also see {@link #createDecimeter()}. + * @stable ICU 64 + */ + static MeasureUnit getDecimeter(); + + /** + * Returns by pointer, unit of length: fathom. * Caller owns returned value and must free it. - * Also see {@link #getFathom()}. + * Also see {@link #getFathom()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createFathom(UErrorCode &status); /** - * Returns by value, unit of length: fathom. - * Also see {@link #createFathom()}. - * @stable ICU 64 - */ - static MeasureUnit getFathom(); - - /** - * Returns by pointer, unit of length: foot. + * Returns by value, unit of length: fathom. + * Also see {@link #createFathom()}. + * @stable ICU 64 + */ + static MeasureUnit getFathom(); + + /** + * Returns by pointer, unit of length: foot. * Caller owns returned value and must free it. - * Also see {@link #getFoot()}. + * Also see {@link #getFoot()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createFoot(UErrorCode &status); /** - * Returns by value, unit of length: foot. - * Also see {@link #createFoot()}. - * @stable ICU 64 - */ - static MeasureUnit getFoot(); - - /** - * Returns by pointer, unit of length: furlong. + * Returns by value, unit of length: foot. + * Also see {@link #createFoot()}. + * @stable ICU 64 + */ + static MeasureUnit getFoot(); + + /** + * Returns by pointer, unit of length: furlong. * Caller owns returned value and must free it. - * Also see {@link #getFurlong()}. + * Also see {@link #getFurlong()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createFurlong(UErrorCode &status); /** - * Returns by value, unit of length: furlong. - * Also see {@link #createFurlong()}. - * @stable ICU 64 - */ - static MeasureUnit getFurlong(); - - /** - * Returns by pointer, unit of length: inch. + * Returns by value, unit of length: furlong. + * Also see {@link #createFurlong()}. + * @stable ICU 64 + */ + static MeasureUnit getFurlong(); + + /** + * Returns by pointer, unit of length: inch. * Caller owns returned value and must free it. - * Also see {@link #getInch()}. + * Also see {@link #getInch()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createInch(UErrorCode &status); /** - * Returns by value, unit of length: inch. - * Also see {@link #createInch()}. - * @stable ICU 64 - */ - static MeasureUnit getInch(); - - /** - * Returns by pointer, unit of length: kilometer. + * Returns by value, unit of length: inch. + * Also see {@link #createInch()}. + * @stable ICU 64 + */ + static MeasureUnit getInch(); + + /** + * Returns by pointer, unit of length: kilometer. * Caller owns returned value and must free it. - * Also see {@link #getKilometer()}. + * Also see {@link #getKilometer()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createKilometer(UErrorCode &status); /** - * Returns by value, unit of length: kilometer. - * Also see {@link #createKilometer()}. - * @stable ICU 64 - */ - static MeasureUnit getKilometer(); - - /** - * Returns by pointer, unit of length: light-year. + * Returns by value, unit of length: kilometer. + * Also see {@link #createKilometer()}. + * @stable ICU 64 + */ + static MeasureUnit getKilometer(); + + /** + * Returns by pointer, unit of length: light-year. * Caller owns returned value and must free it. - * Also see {@link #getLightYear()}. + * Also see {@link #getLightYear()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createLightYear(UErrorCode &status); /** - * Returns by value, unit of length: light-year. - * Also see {@link #createLightYear()}. - * @stable ICU 64 - */ - static MeasureUnit getLightYear(); - - /** - * Returns by pointer, unit of length: meter. + * Returns by value, unit of length: light-year. + * Also see {@link #createLightYear()}. + * @stable ICU 64 + */ + static MeasureUnit getLightYear(); + + /** + * Returns by pointer, unit of length: meter. * Caller owns returned value and must free it. - * Also see {@link #getMeter()}. + * Also see {@link #getMeter()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMeter(UErrorCode &status); /** - * Returns by value, unit of length: meter. - * Also see {@link #createMeter()}. - * @stable ICU 64 - */ - static MeasureUnit getMeter(); - - /** - * Returns by pointer, unit of length: micrometer. + * Returns by value, unit of length: meter. + * Also see {@link #createMeter()}. + * @stable ICU 64 + */ + static MeasureUnit getMeter(); + + /** + * Returns by pointer, unit of length: micrometer. * Caller owns returned value and must free it. - * Also see {@link #getMicrometer()}. + * Also see {@link #getMicrometer()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMicrometer(UErrorCode &status); /** - * Returns by value, unit of length: micrometer. - * Also see {@link #createMicrometer()}. - * @stable ICU 64 - */ - static MeasureUnit getMicrometer(); - - /** - * Returns by pointer, unit of length: mile. + * Returns by value, unit of length: micrometer. + * Also see {@link #createMicrometer()}. + * @stable ICU 64 + */ + static MeasureUnit getMicrometer(); + + /** + * Returns by pointer, unit of length: mile. * Caller owns returned value and must free it. - * Also see {@link #getMile()}. + * Also see {@link #getMile()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMile(UErrorCode &status); /** - * Returns by value, unit of length: mile. - * Also see {@link #createMile()}. - * @stable ICU 64 - */ - static MeasureUnit getMile(); - - /** - * Returns by pointer, unit of length: mile-scandinavian. + * Returns by value, unit of length: mile. + * Also see {@link #createMile()}. + * @stable ICU 64 + */ + static MeasureUnit getMile(); + + /** + * Returns by pointer, unit of length: mile-scandinavian. * Caller owns returned value and must free it. - * Also see {@link #getMileScandinavian()}. + * Also see {@link #getMileScandinavian()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createMileScandinavian(UErrorCode &status); /** - * Returns by value, unit of length: mile-scandinavian. - * Also see {@link #createMileScandinavian()}. - * @stable ICU 64 - */ - static MeasureUnit getMileScandinavian(); - - /** - * Returns by pointer, unit of length: millimeter. + * Returns by value, unit of length: mile-scandinavian. + * Also see {@link #createMileScandinavian()}. + * @stable ICU 64 + */ + static MeasureUnit getMileScandinavian(); + + /** + * Returns by pointer, unit of length: millimeter. * Caller owns returned value and must free it. - * Also see {@link #getMillimeter()}. + * Also see {@link #getMillimeter()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMillimeter(UErrorCode &status); /** - * Returns by value, unit of length: millimeter. - * Also see {@link #createMillimeter()}. - * @stable ICU 64 - */ - static MeasureUnit getMillimeter(); - - /** - * Returns by pointer, unit of length: nanometer. + * Returns by value, unit of length: millimeter. + * Also see {@link #createMillimeter()}. + * @stable ICU 64 + */ + static MeasureUnit getMillimeter(); + + /** + * Returns by pointer, unit of length: nanometer. * Caller owns returned value and must free it. - * Also see {@link #getNanometer()}. + * Also see {@link #getNanometer()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createNanometer(UErrorCode &status); /** - * Returns by value, unit of length: nanometer. - * Also see {@link #createNanometer()}. - * @stable ICU 64 - */ - static MeasureUnit getNanometer(); - - /** - * Returns by pointer, unit of length: nautical-mile. + * Returns by value, unit of length: nanometer. + * Also see {@link #createNanometer()}. + * @stable ICU 64 + */ + static MeasureUnit getNanometer(); + + /** + * Returns by pointer, unit of length: nautical-mile. * Caller owns returned value and must free it. - * Also see {@link #getNauticalMile()}. + * Also see {@link #getNauticalMile()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createNauticalMile(UErrorCode &status); /** - * Returns by value, unit of length: nautical-mile. - * Also see {@link #createNauticalMile()}. - * @stable ICU 64 - */ - static MeasureUnit getNauticalMile(); - - /** - * Returns by pointer, unit of length: parsec. + * Returns by value, unit of length: nautical-mile. + * Also see {@link #createNauticalMile()}. + * @stable ICU 64 + */ + static MeasureUnit getNauticalMile(); + + /** + * Returns by pointer, unit of length: parsec. * Caller owns returned value and must free it. - * Also see {@link #getParsec()}. + * Also see {@link #getParsec()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createParsec(UErrorCode &status); /** - * Returns by value, unit of length: parsec. - * Also see {@link #createParsec()}. - * @stable ICU 64 - */ - static MeasureUnit getParsec(); - - /** - * Returns by pointer, unit of length: picometer. + * Returns by value, unit of length: parsec. + * Also see {@link #createParsec()}. + * @stable ICU 64 + */ + static MeasureUnit getParsec(); + + /** + * Returns by pointer, unit of length: picometer. * Caller owns returned value and must free it. - * Also see {@link #getPicometer()}. + * Also see {@link #getPicometer()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createPicometer(UErrorCode &status); /** - * Returns by value, unit of length: picometer. - * Also see {@link #createPicometer()}. - * @stable ICU 64 - */ - static MeasureUnit getPicometer(); - - /** - * Returns by pointer, unit of length: point. - * Caller owns returned value and must free it. - * Also see {@link #getPoint()}. - * @param status ICU error code. - * @stable ICU 59 - */ - static MeasureUnit *createPoint(UErrorCode &status); - - /** - * Returns by value, unit of length: point. - * Also see {@link #createPoint()}. - * @stable ICU 64 - */ - static MeasureUnit getPoint(); - - /** - * Returns by pointer, unit of length: solar-radius. - * Caller owns returned value and must free it. - * Also see {@link #getSolarRadius()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createSolarRadius(UErrorCode &status); - - /** - * Returns by value, unit of length: solar-radius. - * Also see {@link #createSolarRadius()}. - * @stable ICU 64 - */ - static MeasureUnit getSolarRadius(); - - /** - * Returns by pointer, unit of length: yard. + * Returns by value, unit of length: picometer. + * Also see {@link #createPicometer()}. + * @stable ICU 64 + */ + static MeasureUnit getPicometer(); + + /** + * Returns by pointer, unit of length: point. * Caller owns returned value and must free it. - * Also see {@link #getYard()}. + * Also see {@link #getPoint()}. * @param status ICU error code. + * @stable ICU 59 + */ + static MeasureUnit *createPoint(UErrorCode &status); + + /** + * Returns by value, unit of length: point. + * Also see {@link #createPoint()}. + * @stable ICU 64 + */ + static MeasureUnit getPoint(); + + /** + * Returns by pointer, unit of length: solar-radius. + * Caller owns returned value and must free it. + * Also see {@link #getSolarRadius()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createSolarRadius(UErrorCode &status); + + /** + * Returns by value, unit of length: solar-radius. + * Also see {@link #createSolarRadius()}. + * @stable ICU 64 + */ + static MeasureUnit getSolarRadius(); + + /** + * Returns by pointer, unit of length: yard. + * Caller owns returned value and must free it. + * Also see {@link #getYard()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createYard(UErrorCode &status); /** - * Returns by value, unit of length: yard. - * Also see {@link #createYard()}. - * @stable ICU 64 - */ - static MeasureUnit getYard(); - - /** - * Returns by pointer, unit of light: lux. + * Returns by value, unit of length: yard. + * Also see {@link #createYard()}. + * @stable ICU 64 + */ + static MeasureUnit getYard(); + + /** + * Returns by pointer, unit of light: lux. * Caller owns returned value and must free it. - * Also see {@link #getLux()}. + * Also see {@link #getLux()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createLux(UErrorCode &status); /** - * Returns by value, unit of light: lux. - * Also see {@link #createLux()}. - * @stable ICU 64 - */ - static MeasureUnit getLux(); - - /** - * Returns by pointer, unit of light: solar-luminosity. - * Caller owns returned value and must free it. - * Also see {@link #getSolarLuminosity()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createSolarLuminosity(UErrorCode &status); - - /** - * Returns by value, unit of light: solar-luminosity. - * Also see {@link #createSolarLuminosity()}. - * @stable ICU 64 - */ - static MeasureUnit getSolarLuminosity(); - - /** - * Returns by pointer, unit of mass: carat. + * Returns by value, unit of light: lux. + * Also see {@link #createLux()}. + * @stable ICU 64 + */ + static MeasureUnit getLux(); + + /** + * Returns by pointer, unit of light: solar-luminosity. * Caller owns returned value and must free it. - * Also see {@link #getCarat()}. + * Also see {@link #getSolarLuminosity()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createSolarLuminosity(UErrorCode &status); + + /** + * Returns by value, unit of light: solar-luminosity. + * Also see {@link #createSolarLuminosity()}. + * @stable ICU 64 + */ + static MeasureUnit getSolarLuminosity(); + + /** + * Returns by pointer, unit of mass: carat. + * Caller owns returned value and must free it. + * Also see {@link #getCarat()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCarat(UErrorCode &status); /** - * Returns by value, unit of mass: carat. - * Also see {@link #createCarat()}. - * @stable ICU 64 - */ - static MeasureUnit getCarat(); - - /** - * Returns by pointer, unit of mass: dalton. - * Caller owns returned value and must free it. - * Also see {@link #getDalton()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createDalton(UErrorCode &status); - - /** - * Returns by value, unit of mass: dalton. - * Also see {@link #createDalton()}. - * @stable ICU 64 - */ - static MeasureUnit getDalton(); - - /** - * Returns by pointer, unit of mass: earth-mass. - * Caller owns returned value and must free it. - * Also see {@link #getEarthMass()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createEarthMass(UErrorCode &status); - - /** - * Returns by value, unit of mass: earth-mass. - * Also see {@link #createEarthMass()}. - * @stable ICU 64 - */ - static MeasureUnit getEarthMass(); - - /** - * Returns by pointer, unit of mass: gram. + * Returns by value, unit of mass: carat. + * Also see {@link #createCarat()}. + * @stable ICU 64 + */ + static MeasureUnit getCarat(); + + /** + * Returns by pointer, unit of mass: dalton. * Caller owns returned value and must free it. - * Also see {@link #getGram()}. + * Also see {@link #getDalton()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createDalton(UErrorCode &status); + + /** + * Returns by value, unit of mass: dalton. + * Also see {@link #createDalton()}. + * @stable ICU 64 + */ + static MeasureUnit getDalton(); + + /** + * Returns by pointer, unit of mass: earth-mass. + * Caller owns returned value and must free it. + * Also see {@link #getEarthMass()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createEarthMass(UErrorCode &status); + + /** + * Returns by value, unit of mass: earth-mass. + * Also see {@link #createEarthMass()}. + * @stable ICU 64 + */ + static MeasureUnit getEarthMass(); + + /** + * Returns by pointer, unit of mass: gram. + * Caller owns returned value and must free it. + * Also see {@link #getGram()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createGram(UErrorCode &status); /** - * Returns by value, unit of mass: gram. - * Also see {@link #createGram()}. - * @stable ICU 64 - */ - static MeasureUnit getGram(); - - /** - * Returns by pointer, unit of mass: kilogram. + * Returns by value, unit of mass: gram. + * Also see {@link #createGram()}. + * @stable ICU 64 + */ + static MeasureUnit getGram(); + + /** + * Returns by pointer, unit of mass: kilogram. * Caller owns returned value and must free it. - * Also see {@link #getKilogram()}. + * Also see {@link #getKilogram()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createKilogram(UErrorCode &status); /** - * Returns by value, unit of mass: kilogram. - * Also see {@link #createKilogram()}. - * @stable ICU 64 - */ - static MeasureUnit getKilogram(); - - /** - * Returns by pointer, unit of mass: metric-ton. + * Returns by value, unit of mass: kilogram. + * Also see {@link #createKilogram()}. + * @stable ICU 64 + */ + static MeasureUnit getKilogram(); + + /** + * Returns by pointer, unit of mass: metric-ton. * Caller owns returned value and must free it. - * Also see {@link #getMetricTon()}. + * Also see {@link #getMetricTon()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMetricTon(UErrorCode &status); /** - * Returns by value, unit of mass: metric-ton. - * Also see {@link #createMetricTon()}. - * @stable ICU 64 - */ - static MeasureUnit getMetricTon(); - - /** - * Returns by pointer, unit of mass: microgram. + * Returns by value, unit of mass: metric-ton. + * Also see {@link #createMetricTon()}. + * @stable ICU 64 + */ + static MeasureUnit getMetricTon(); + + /** + * Returns by pointer, unit of mass: microgram. * Caller owns returned value and must free it. - * Also see {@link #getMicrogram()}. + * Also see {@link #getMicrogram()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMicrogram(UErrorCode &status); /** - * Returns by value, unit of mass: microgram. - * Also see {@link #createMicrogram()}. - * @stable ICU 64 - */ - static MeasureUnit getMicrogram(); - - /** - * Returns by pointer, unit of mass: milligram. + * Returns by value, unit of mass: microgram. + * Also see {@link #createMicrogram()}. + * @stable ICU 64 + */ + static MeasureUnit getMicrogram(); + + /** + * Returns by pointer, unit of mass: milligram. * Caller owns returned value and must free it. - * Also see {@link #getMilligram()}. + * Also see {@link #getMilligram()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMilligram(UErrorCode &status); /** - * Returns by value, unit of mass: milligram. - * Also see {@link #createMilligram()}. - * @stable ICU 64 - */ - static MeasureUnit getMilligram(); - - /** - * Returns by pointer, unit of mass: ounce. + * Returns by value, unit of mass: milligram. + * Also see {@link #createMilligram()}. + * @stable ICU 64 + */ + static MeasureUnit getMilligram(); + + /** + * Returns by pointer, unit of mass: ounce. * Caller owns returned value and must free it. - * Also see {@link #getOunce()}. + * Also see {@link #getOunce()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createOunce(UErrorCode &status); /** - * Returns by value, unit of mass: ounce. - * Also see {@link #createOunce()}. - * @stable ICU 64 - */ - static MeasureUnit getOunce(); - - /** - * Returns by pointer, unit of mass: ounce-troy. + * Returns by value, unit of mass: ounce. + * Also see {@link #createOunce()}. + * @stable ICU 64 + */ + static MeasureUnit getOunce(); + + /** + * Returns by pointer, unit of mass: ounce-troy. * Caller owns returned value and must free it. - * Also see {@link #getOunceTroy()}. + * Also see {@link #getOunceTroy()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createOunceTroy(UErrorCode &status); /** - * Returns by value, unit of mass: ounce-troy. - * Also see {@link #createOunceTroy()}. - * @stable ICU 64 - */ - static MeasureUnit getOunceTroy(); - - /** - * Returns by pointer, unit of mass: pound. + * Returns by value, unit of mass: ounce-troy. + * Also see {@link #createOunceTroy()}. + * @stable ICU 64 + */ + static MeasureUnit getOunceTroy(); + + /** + * Returns by pointer, unit of mass: pound. * Caller owns returned value and must free it. - * Also see {@link #getPound()}. + * Also see {@link #getPound()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createPound(UErrorCode &status); /** - * Returns by value, unit of mass: pound. - * Also see {@link #createPound()}. - * @stable ICU 64 - */ - static MeasureUnit getPound(); - - /** - * Returns by pointer, unit of mass: solar-mass. - * Caller owns returned value and must free it. - * Also see {@link #getSolarMass()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createSolarMass(UErrorCode &status); - - /** - * Returns by value, unit of mass: solar-mass. - * Also see {@link #createSolarMass()}. - * @stable ICU 64 - */ - static MeasureUnit getSolarMass(); - - /** - * Returns by pointer, unit of mass: stone. + * Returns by value, unit of mass: pound. + * Also see {@link #createPound()}. + * @stable ICU 64 + */ + static MeasureUnit getPound(); + + /** + * Returns by pointer, unit of mass: solar-mass. * Caller owns returned value and must free it. - * Also see {@link #getStone()}. + * Also see {@link #getSolarMass()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createSolarMass(UErrorCode &status); + + /** + * Returns by value, unit of mass: solar-mass. + * Also see {@link #createSolarMass()}. + * @stable ICU 64 + */ + static MeasureUnit getSolarMass(); + + /** + * Returns by pointer, unit of mass: stone. + * Caller owns returned value and must free it. + * Also see {@link #getStone()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createStone(UErrorCode &status); /** - * Returns by value, unit of mass: stone. - * Also see {@link #createStone()}. - * @stable ICU 64 - */ - static MeasureUnit getStone(); - - /** - * Returns by pointer, unit of mass: ton. + * Returns by value, unit of mass: stone. + * Also see {@link #createStone()}. + * @stable ICU 64 + */ + static MeasureUnit getStone(); + + /** + * Returns by pointer, unit of mass: ton. * Caller owns returned value and must free it. - * Also see {@link #getTon()}. + * Also see {@link #getTon()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createTon(UErrorCode &status); /** - * Returns by value, unit of mass: ton. - * Also see {@link #createTon()}. - * @stable ICU 64 - */ - static MeasureUnit getTon(); - - /** - * Returns by pointer, unit of power: gigawatt. + * Returns by value, unit of mass: ton. + * Also see {@link #createTon()}. + * @stable ICU 64 + */ + static MeasureUnit getTon(); + + /** + * Returns by pointer, unit of power: gigawatt. * Caller owns returned value and must free it. - * Also see {@link #getGigawatt()}. + * Also see {@link #getGigawatt()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createGigawatt(UErrorCode &status); /** - * Returns by value, unit of power: gigawatt. - * Also see {@link #createGigawatt()}. - * @stable ICU 64 - */ - static MeasureUnit getGigawatt(); - - /** - * Returns by pointer, unit of power: horsepower. + * Returns by value, unit of power: gigawatt. + * Also see {@link #createGigawatt()}. + * @stable ICU 64 + */ + static MeasureUnit getGigawatt(); + + /** + * Returns by pointer, unit of power: horsepower. * Caller owns returned value and must free it. - * Also see {@link #getHorsepower()}. + * Also see {@link #getHorsepower()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createHorsepower(UErrorCode &status); /** - * Returns by value, unit of power: horsepower. - * Also see {@link #createHorsepower()}. - * @stable ICU 64 - */ - static MeasureUnit getHorsepower(); - - /** - * Returns by pointer, unit of power: kilowatt. + * Returns by value, unit of power: horsepower. + * Also see {@link #createHorsepower()}. + * @stable ICU 64 + */ + static MeasureUnit getHorsepower(); + + /** + * Returns by pointer, unit of power: kilowatt. * Caller owns returned value and must free it. - * Also see {@link #getKilowatt()}. + * Also see {@link #getKilowatt()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createKilowatt(UErrorCode &status); /** - * Returns by value, unit of power: kilowatt. - * Also see {@link #createKilowatt()}. - * @stable ICU 64 - */ - static MeasureUnit getKilowatt(); - - /** - * Returns by pointer, unit of power: megawatt. + * Returns by value, unit of power: kilowatt. + * Also see {@link #createKilowatt()}. + * @stable ICU 64 + */ + static MeasureUnit getKilowatt(); + + /** + * Returns by pointer, unit of power: megawatt. * Caller owns returned value and must free it. - * Also see {@link #getMegawatt()}. + * Also see {@link #getMegawatt()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMegawatt(UErrorCode &status); /** - * Returns by value, unit of power: megawatt. - * Also see {@link #createMegawatt()}. - * @stable ICU 64 - */ - static MeasureUnit getMegawatt(); - - /** - * Returns by pointer, unit of power: milliwatt. + * Returns by value, unit of power: megawatt. + * Also see {@link #createMegawatt()}. + * @stable ICU 64 + */ + static MeasureUnit getMegawatt(); + + /** + * Returns by pointer, unit of power: milliwatt. * Caller owns returned value and must free it. - * Also see {@link #getMilliwatt()}. + * Also see {@link #getMilliwatt()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMilliwatt(UErrorCode &status); /** - * Returns by value, unit of power: milliwatt. - * Also see {@link #createMilliwatt()}. - * @stable ICU 64 - */ - static MeasureUnit getMilliwatt(); - - /** - * Returns by pointer, unit of power: watt. + * Returns by value, unit of power: milliwatt. + * Also see {@link #createMilliwatt()}. + * @stable ICU 64 + */ + static MeasureUnit getMilliwatt(); + + /** + * Returns by pointer, unit of power: watt. * Caller owns returned value and must free it. - * Also see {@link #getWatt()}. + * Also see {@link #getWatt()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createWatt(UErrorCode &status); /** - * Returns by value, unit of power: watt. - * Also see {@link #createWatt()}. - * @stable ICU 64 - */ - static MeasureUnit getWatt(); - - /** - * Returns by pointer, unit of pressure: atmosphere. - * Caller owns returned value and must free it. - * Also see {@link #getAtmosphere()}. - * @param status ICU error code. - * @stable ICU 63 - */ - static MeasureUnit *createAtmosphere(UErrorCode &status); - - /** - * Returns by value, unit of pressure: atmosphere. - * Also see {@link #createAtmosphere()}. - * @stable ICU 64 - */ - static MeasureUnit getAtmosphere(); - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of pressure: bar. - * Caller owns returned value and must free it. - * Also see {@link #getBar()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createBar(UErrorCode &status); - - /** - * Returns by value, unit of pressure: bar. - * Also see {@link #createBar()}. - * @draft ICU 65 - */ - static MeasureUnit getBar(); -#endif /* U_HIDE_DRAFT_API */ - - /** - * Returns by pointer, unit of pressure: hectopascal. + * Returns by value, unit of power: watt. + * Also see {@link #createWatt()}. + * @stable ICU 64 + */ + static MeasureUnit getWatt(); + + /** + * Returns by pointer, unit of pressure: atmosphere. * Caller owns returned value and must free it. - * Also see {@link #getHectopascal()}. + * Also see {@link #getAtmosphere()}. * @param status ICU error code. + * @stable ICU 63 + */ + static MeasureUnit *createAtmosphere(UErrorCode &status); + + /** + * Returns by value, unit of pressure: atmosphere. + * Also see {@link #createAtmosphere()}. + * @stable ICU 64 + */ + static MeasureUnit getAtmosphere(); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of pressure: bar. + * Caller owns returned value and must free it. + * Also see {@link #getBar()}. + * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createBar(UErrorCode &status); + + /** + * Returns by value, unit of pressure: bar. + * Also see {@link #createBar()}. + * @draft ICU 65 + */ + static MeasureUnit getBar(); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns by pointer, unit of pressure: hectopascal. + * Caller owns returned value and must free it. + * Also see {@link #getHectopascal()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createHectopascal(UErrorCode &status); /** - * Returns by value, unit of pressure: hectopascal. - * Also see {@link #createHectopascal()}. - * @stable ICU 64 - */ - static MeasureUnit getHectopascal(); - - /** - * Returns by pointer, unit of pressure: inch-ofhg. + * Returns by value, unit of pressure: hectopascal. + * Also see {@link #createHectopascal()}. + * @stable ICU 64 + */ + static MeasureUnit getHectopascal(); + + /** + * Returns by pointer, unit of pressure: inch-ofhg. * Caller owns returned value and must free it. - * Also see {@link #getInchHg()}. + * Also see {@link #getInchHg()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createInchHg(UErrorCode &status); /** - * Returns by value, unit of pressure: inch-ofhg. - * Also see {@link #createInchHg()}. - * @stable ICU 64 - */ - static MeasureUnit getInchHg(); - - /** - * Returns by pointer, unit of pressure: kilopascal. - * Caller owns returned value and must free it. - * Also see {@link #getKilopascal()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createKilopascal(UErrorCode &status); - - /** - * Returns by value, unit of pressure: kilopascal. - * Also see {@link #createKilopascal()}. - * @stable ICU 64 - */ - static MeasureUnit getKilopascal(); - - /** - * Returns by pointer, unit of pressure: megapascal. - * Caller owns returned value and must free it. - * Also see {@link #getMegapascal()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createMegapascal(UErrorCode &status); - - /** - * Returns by value, unit of pressure: megapascal. - * Also see {@link #createMegapascal()}. - * @stable ICU 64 - */ - static MeasureUnit getMegapascal(); - - /** - * Returns by pointer, unit of pressure: millibar. + * Returns by value, unit of pressure: inch-ofhg. + * Also see {@link #createInchHg()}. + * @stable ICU 64 + */ + static MeasureUnit getInchHg(); + + /** + * Returns by pointer, unit of pressure: kilopascal. * Caller owns returned value and must free it. - * Also see {@link #getMillibar()}. + * Also see {@link #getKilopascal()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createKilopascal(UErrorCode &status); + + /** + * Returns by value, unit of pressure: kilopascal. + * Also see {@link #createKilopascal()}. + * @stable ICU 64 + */ + static MeasureUnit getKilopascal(); + + /** + * Returns by pointer, unit of pressure: megapascal. + * Caller owns returned value and must free it. + * Also see {@link #getMegapascal()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createMegapascal(UErrorCode &status); + + /** + * Returns by value, unit of pressure: megapascal. + * Also see {@link #createMegapascal()}. + * @stable ICU 64 + */ + static MeasureUnit getMegapascal(); + + /** + * Returns by pointer, unit of pressure: millibar. + * Caller owns returned value and must free it. + * Also see {@link #getMillibar()}. + * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMillibar(UErrorCode &status); /** - * Returns by value, unit of pressure: millibar. - * Also see {@link #createMillibar()}. - * @stable ICU 64 - */ - static MeasureUnit getMillibar(); - - /** - * Returns by pointer, unit of pressure: millimeter-ofhg. + * Returns by value, unit of pressure: millibar. + * Also see {@link #createMillibar()}. + * @stable ICU 64 + */ + static MeasureUnit getMillibar(); + + /** + * Returns by pointer, unit of pressure: millimeter-ofhg. * Caller owns returned value and must free it. - * Also see {@link #getMillimeterOfMercury()}. + * Also see {@link #getMillimeterOfMercury()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMillimeterOfMercury(UErrorCode &status); /** - * Returns by value, unit of pressure: millimeter-ofhg. - * Also see {@link #createMillimeterOfMercury()}. - * @stable ICU 64 - */ - static MeasureUnit getMillimeterOfMercury(); - -#ifndef U_HIDE_DRAFT_API - /** - * Returns by pointer, unit of pressure: pascal. - * Caller owns returned value and must free it. - * Also see {@link #getPascal()}. - * @param status ICU error code. - * @draft ICU 65 - */ - static MeasureUnit *createPascal(UErrorCode &status); - - /** - * Returns by value, unit of pressure: pascal. - * Also see {@link #createPascal()}. - * @draft ICU 65 - */ - static MeasureUnit getPascal(); -#endif /* U_HIDE_DRAFT_API */ - - /** - * Returns by pointer, unit of pressure: pound-force-per-square-inch. + * Returns by value, unit of pressure: millimeter-ofhg. + * Also see {@link #createMillimeterOfMercury()}. + * @stable ICU 64 + */ + static MeasureUnit getMillimeterOfMercury(); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns by pointer, unit of pressure: pascal. * Caller owns returned value and must free it. - * Also see {@link #getPoundPerSquareInch()}. + * Also see {@link #getPascal()}. * @param status ICU error code. + * @draft ICU 65 + */ + static MeasureUnit *createPascal(UErrorCode &status); + + /** + * Returns by value, unit of pressure: pascal. + * Also see {@link #createPascal()}. + * @draft ICU 65 + */ + static MeasureUnit getPascal(); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns by pointer, unit of pressure: pound-force-per-square-inch. + * Caller owns returned value and must free it. + * Also see {@link #getPoundPerSquareInch()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createPoundPerSquareInch(UErrorCode &status); /** - * Returns by value, unit of pressure: pound-force-per-square-inch. - * Also see {@link #createPoundPerSquareInch()}. - * @stable ICU 64 - */ - static MeasureUnit getPoundPerSquareInch(); - - /** - * Returns by pointer, unit of speed: kilometer-per-hour. + * Returns by value, unit of pressure: pound-force-per-square-inch. + * Also see {@link #createPoundPerSquareInch()}. + * @stable ICU 64 + */ + static MeasureUnit getPoundPerSquareInch(); + + /** + * Returns by pointer, unit of speed: kilometer-per-hour. * Caller owns returned value and must free it. - * Also see {@link #getKilometerPerHour()}. + * Also see {@link #getKilometerPerHour()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createKilometerPerHour(UErrorCode &status); /** - * Returns by value, unit of speed: kilometer-per-hour. - * Also see {@link #createKilometerPerHour()}. - * @stable ICU 64 - */ - static MeasureUnit getKilometerPerHour(); - - /** - * Returns by pointer, unit of speed: knot. + * Returns by value, unit of speed: kilometer-per-hour. + * Also see {@link #createKilometerPerHour()}. + * @stable ICU 64 + */ + static MeasureUnit getKilometerPerHour(); + + /** + * Returns by pointer, unit of speed: knot. * Caller owns returned value and must free it. - * Also see {@link #getKnot()}. + * Also see {@link #getKnot()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createKnot(UErrorCode &status); /** - * Returns by value, unit of speed: knot. - * Also see {@link #createKnot()}. - * @stable ICU 64 - */ - static MeasureUnit getKnot(); - - /** - * Returns by pointer, unit of speed: meter-per-second. + * Returns by value, unit of speed: knot. + * Also see {@link #createKnot()}. + * @stable ICU 64 + */ + static MeasureUnit getKnot(); + + /** + * Returns by pointer, unit of speed: meter-per-second. * Caller owns returned value and must free it. - * Also see {@link #getMeterPerSecond()}. + * Also see {@link #getMeterPerSecond()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMeterPerSecond(UErrorCode &status); /** - * Returns by value, unit of speed: meter-per-second. - * Also see {@link #createMeterPerSecond()}. - * @stable ICU 64 - */ - static MeasureUnit getMeterPerSecond(); - - /** - * Returns by pointer, unit of speed: mile-per-hour. + * Returns by value, unit of speed: meter-per-second. + * Also see {@link #createMeterPerSecond()}. + * @stable ICU 64 + */ + static MeasureUnit getMeterPerSecond(); + + /** + * Returns by pointer, unit of speed: mile-per-hour. * Caller owns returned value and must free it. - * Also see {@link #getMilePerHour()}. + * Also see {@link #getMilePerHour()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createMilePerHour(UErrorCode &status); /** - * Returns by value, unit of speed: mile-per-hour. - * Also see {@link #createMilePerHour()}. - * @stable ICU 64 - */ - static MeasureUnit getMilePerHour(); - - /** - * Returns by pointer, unit of temperature: celsius. + * Returns by value, unit of speed: mile-per-hour. + * Also see {@link #createMilePerHour()}. + * @stable ICU 64 + */ + static MeasureUnit getMilePerHour(); + + /** + * Returns by pointer, unit of temperature: celsius. * Caller owns returned value and must free it. - * Also see {@link #getCelsius()}. + * Also see {@link #getCelsius()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createCelsius(UErrorCode &status); /** - * Returns by value, unit of temperature: celsius. - * Also see {@link #createCelsius()}. - * @stable ICU 64 - */ - static MeasureUnit getCelsius(); - - /** - * Returns by pointer, unit of temperature: fahrenheit. + * Returns by value, unit of temperature: celsius. + * Also see {@link #createCelsius()}. + * @stable ICU 64 + */ + static MeasureUnit getCelsius(); + + /** + * Returns by pointer, unit of temperature: fahrenheit. * Caller owns returned value and must free it. - * Also see {@link #getFahrenheit()}. + * Also see {@link #getFahrenheit()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createFahrenheit(UErrorCode &status); /** - * Returns by value, unit of temperature: fahrenheit. - * Also see {@link #createFahrenheit()}. - * @stable ICU 64 - */ - static MeasureUnit getFahrenheit(); - - /** - * Returns by pointer, unit of temperature: generic. + * Returns by value, unit of temperature: fahrenheit. + * Also see {@link #createFahrenheit()}. + * @stable ICU 64 + */ + static MeasureUnit getFahrenheit(); + + /** + * Returns by pointer, unit of temperature: generic. * Caller owns returned value and must free it. - * Also see {@link #getGenericTemperature()}. + * Also see {@link #getGenericTemperature()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createGenericTemperature(UErrorCode &status); /** - * Returns by value, unit of temperature: generic. - * Also see {@link #createGenericTemperature()}. - * @stable ICU 64 - */ - static MeasureUnit getGenericTemperature(); - - /** - * Returns by pointer, unit of temperature: kelvin. + * Returns by value, unit of temperature: generic. + * Also see {@link #createGenericTemperature()}. + * @stable ICU 64 + */ + static MeasureUnit getGenericTemperature(); + + /** + * Returns by pointer, unit of temperature: kelvin. * Caller owns returned value and must free it. - * Also see {@link #getKelvin()}. + * Also see {@link #getKelvin()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createKelvin(UErrorCode &status); /** - * Returns by value, unit of temperature: kelvin. - * Also see {@link #createKelvin()}. - * @stable ICU 64 - */ - static MeasureUnit getKelvin(); - - /** - * Returns by pointer, unit of torque: newton-meter. - * Caller owns returned value and must free it. - * Also see {@link #getNewtonMeter()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createNewtonMeter(UErrorCode &status); - - /** - * Returns by value, unit of torque: newton-meter. - * Also see {@link #createNewtonMeter()}. - * @stable ICU 64 - */ - static MeasureUnit getNewtonMeter(); - - /** - * Returns by pointer, unit of torque: pound-force-foot. - * Caller owns returned value and must free it. - * Also see {@link #getPoundFoot()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createPoundFoot(UErrorCode &status); - - /** - * Returns by value, unit of torque: pound-force-foot. - * Also see {@link #createPoundFoot()}. - * @stable ICU 64 - */ - static MeasureUnit getPoundFoot(); - - /** - * Returns by pointer, unit of volume: acre-foot. + * Returns by value, unit of temperature: kelvin. + * Also see {@link #createKelvin()}. + * @stable ICU 64 + */ + static MeasureUnit getKelvin(); + + /** + * Returns by pointer, unit of torque: newton-meter. * Caller owns returned value and must free it. - * Also see {@link #getAcreFoot()}. + * Also see {@link #getNewtonMeter()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createNewtonMeter(UErrorCode &status); + + /** + * Returns by value, unit of torque: newton-meter. + * Also see {@link #createNewtonMeter()}. + * @stable ICU 64 + */ + static MeasureUnit getNewtonMeter(); + + /** + * Returns by pointer, unit of torque: pound-force-foot. + * Caller owns returned value and must free it. + * Also see {@link #getPoundFoot()}. + * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createPoundFoot(UErrorCode &status); + + /** + * Returns by value, unit of torque: pound-force-foot. + * Also see {@link #createPoundFoot()}. + * @stable ICU 64 + */ + static MeasureUnit getPoundFoot(); + + /** + * Returns by pointer, unit of volume: acre-foot. + * Caller owns returned value and must free it. + * Also see {@link #getAcreFoot()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createAcreFoot(UErrorCode &status); /** - * Returns by value, unit of volume: acre-foot. - * Also see {@link #createAcreFoot()}. - * @stable ICU 64 - */ - static MeasureUnit getAcreFoot(); - - /** - * Returns by pointer, unit of volume: barrel. - * Caller owns returned value and must free it. - * Also see {@link #getBarrel()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createBarrel(UErrorCode &status); - - /** - * Returns by value, unit of volume: barrel. - * Also see {@link #createBarrel()}. - * @stable ICU 64 - */ - static MeasureUnit getBarrel(); - - /** - * Returns by pointer, unit of volume: bushel. + * Returns by value, unit of volume: acre-foot. + * Also see {@link #createAcreFoot()}. + * @stable ICU 64 + */ + static MeasureUnit getAcreFoot(); + + /** + * Returns by pointer, unit of volume: barrel. * Caller owns returned value and must free it. - * Also see {@link #getBushel()}. + * Also see {@link #getBarrel()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createBarrel(UErrorCode &status); + + /** + * Returns by value, unit of volume: barrel. + * Also see {@link #createBarrel()}. + * @stable ICU 64 + */ + static MeasureUnit getBarrel(); + + /** + * Returns by pointer, unit of volume: bushel. + * Caller owns returned value and must free it. + * Also see {@link #getBushel()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createBushel(UErrorCode &status); /** - * Returns by value, unit of volume: bushel. - * Also see {@link #createBushel()}. - * @stable ICU 64 - */ - static MeasureUnit getBushel(); - - /** - * Returns by pointer, unit of volume: centiliter. + * Returns by value, unit of volume: bushel. + * Also see {@link #createBushel()}. + * @stable ICU 64 + */ + static MeasureUnit getBushel(); + + /** + * Returns by pointer, unit of volume: centiliter. * Caller owns returned value and must free it. - * Also see {@link #getCentiliter()}. + * Also see {@link #getCentiliter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCentiliter(UErrorCode &status); /** - * Returns by value, unit of volume: centiliter. - * Also see {@link #createCentiliter()}. - * @stable ICU 64 - */ - static MeasureUnit getCentiliter(); - - /** - * Returns by pointer, unit of volume: cubic-centimeter. + * Returns by value, unit of volume: centiliter. + * Also see {@link #createCentiliter()}. + * @stable ICU 64 + */ + static MeasureUnit getCentiliter(); + + /** + * Returns by pointer, unit of volume: cubic-centimeter. * Caller owns returned value and must free it. - * Also see {@link #getCubicCentimeter()}. + * Also see {@link #getCubicCentimeter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCubicCentimeter(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-centimeter. - * Also see {@link #createCubicCentimeter()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicCentimeter(); - - /** - * Returns by pointer, unit of volume: cubic-foot. + * Returns by value, unit of volume: cubic-centimeter. + * Also see {@link #createCubicCentimeter()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicCentimeter(); + + /** + * Returns by pointer, unit of volume: cubic-foot. * Caller owns returned value and must free it. - * Also see {@link #getCubicFoot()}. + * Also see {@link #getCubicFoot()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCubicFoot(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-foot. - * Also see {@link #createCubicFoot()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicFoot(); - - /** - * Returns by pointer, unit of volume: cubic-inch. + * Returns by value, unit of volume: cubic-foot. + * Also see {@link #createCubicFoot()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicFoot(); + + /** + * Returns by pointer, unit of volume: cubic-inch. * Caller owns returned value and must free it. - * Also see {@link #getCubicInch()}. + * Also see {@link #getCubicInch()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCubicInch(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-inch. - * Also see {@link #createCubicInch()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicInch(); - - /** - * Returns by pointer, unit of volume: cubic-kilometer. + * Returns by value, unit of volume: cubic-inch. + * Also see {@link #createCubicInch()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicInch(); + + /** + * Returns by pointer, unit of volume: cubic-kilometer. * Caller owns returned value and must free it. - * Also see {@link #getCubicKilometer()}. + * Also see {@link #getCubicKilometer()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createCubicKilometer(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-kilometer. - * Also see {@link #createCubicKilometer()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicKilometer(); - - /** - * Returns by pointer, unit of volume: cubic-meter. + * Returns by value, unit of volume: cubic-kilometer. + * Also see {@link #createCubicKilometer()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicKilometer(); + + /** + * Returns by pointer, unit of volume: cubic-meter. * Caller owns returned value and must free it. - * Also see {@link #getCubicMeter()}. + * Also see {@link #getCubicMeter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCubicMeter(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-meter. - * Also see {@link #createCubicMeter()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicMeter(); - - /** - * Returns by pointer, unit of volume: cubic-mile. + * Returns by value, unit of volume: cubic-meter. + * Also see {@link #createCubicMeter()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicMeter(); + + /** + * Returns by pointer, unit of volume: cubic-mile. * Caller owns returned value and must free it. - * Also see {@link #getCubicMile()}. + * Also see {@link #getCubicMile()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createCubicMile(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-mile. - * Also see {@link #createCubicMile()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicMile(); - - /** - * Returns by pointer, unit of volume: cubic-yard. + * Returns by value, unit of volume: cubic-mile. + * Also see {@link #createCubicMile()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicMile(); + + /** + * Returns by pointer, unit of volume: cubic-yard. * Caller owns returned value and must free it. - * Also see {@link #getCubicYard()}. + * Also see {@link #getCubicYard()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCubicYard(UErrorCode &status); /** - * Returns by value, unit of volume: cubic-yard. - * Also see {@link #createCubicYard()}. - * @stable ICU 64 - */ - static MeasureUnit getCubicYard(); - - /** - * Returns by pointer, unit of volume: cup. + * Returns by value, unit of volume: cubic-yard. + * Also see {@link #createCubicYard()}. + * @stable ICU 64 + */ + static MeasureUnit getCubicYard(); + + /** + * Returns by pointer, unit of volume: cup. * Caller owns returned value and must free it. - * Also see {@link #getCup()}. + * Also see {@link #getCup()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createCup(UErrorCode &status); /** - * Returns by value, unit of volume: cup. - * Also see {@link #createCup()}. - * @stable ICU 64 - */ - static MeasureUnit getCup(); - - /** - * Returns by pointer, unit of volume: cup-metric. + * Returns by value, unit of volume: cup. + * Also see {@link #createCup()}. + * @stable ICU 64 + */ + static MeasureUnit getCup(); + + /** + * Returns by pointer, unit of volume: cup-metric. * Caller owns returned value and must free it. - * Also see {@link #getCupMetric()}. + * Also see {@link #getCupMetric()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createCupMetric(UErrorCode &status); /** - * Returns by value, unit of volume: cup-metric. - * Also see {@link #createCupMetric()}. - * @stable ICU 64 - */ - static MeasureUnit getCupMetric(); - - /** - * Returns by pointer, unit of volume: deciliter. + * Returns by value, unit of volume: cup-metric. + * Also see {@link #createCupMetric()}. + * @stable ICU 64 + */ + static MeasureUnit getCupMetric(); + + /** + * Returns by pointer, unit of volume: deciliter. * Caller owns returned value and must free it. - * Also see {@link #getDeciliter()}. + * Also see {@link #getDeciliter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createDeciliter(UErrorCode &status); /** - * Returns by value, unit of volume: deciliter. - * Also see {@link #createDeciliter()}. - * @stable ICU 64 - */ - static MeasureUnit getDeciliter(); - - /** - * Returns by pointer, unit of volume: fluid-ounce. + * Returns by value, unit of volume: deciliter. + * Also see {@link #createDeciliter()}. + * @stable ICU 64 + */ + static MeasureUnit getDeciliter(); + + /** + * Returns by pointer, unit of volume: fluid-ounce. * Caller owns returned value and must free it. - * Also see {@link #getFluidOunce()}. + * Also see {@link #getFluidOunce()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createFluidOunce(UErrorCode &status); /** - * Returns by value, unit of volume: fluid-ounce. - * Also see {@link #createFluidOunce()}. - * @stable ICU 64 - */ - static MeasureUnit getFluidOunce(); - - /** - * Returns by pointer, unit of volume: fluid-ounce-imperial. - * Caller owns returned value and must free it. - * Also see {@link #getFluidOunceImperial()}. - * @param status ICU error code. - * @stable ICU 64 - */ - static MeasureUnit *createFluidOunceImperial(UErrorCode &status); - - /** - * Returns by value, unit of volume: fluid-ounce-imperial. - * Also see {@link #createFluidOunceImperial()}. - * @stable ICU 64 - */ - static MeasureUnit getFluidOunceImperial(); - - /** - * Returns by pointer, unit of volume: gallon. + * Returns by value, unit of volume: fluid-ounce. + * Also see {@link #createFluidOunce()}. + * @stable ICU 64 + */ + static MeasureUnit getFluidOunce(); + + /** + * Returns by pointer, unit of volume: fluid-ounce-imperial. * Caller owns returned value and must free it. - * Also see {@link #getGallon()}. + * Also see {@link #getFluidOunceImperial()}. * @param status ICU error code. + * @stable ICU 64 + */ + static MeasureUnit *createFluidOunceImperial(UErrorCode &status); + + /** + * Returns by value, unit of volume: fluid-ounce-imperial. + * Also see {@link #createFluidOunceImperial()}. + * @stable ICU 64 + */ + static MeasureUnit getFluidOunceImperial(); + + /** + * Returns by pointer, unit of volume: gallon. + * Caller owns returned value and must free it. + * Also see {@link #getGallon()}. + * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createGallon(UErrorCode &status); /** - * Returns by value, unit of volume: gallon. - * Also see {@link #createGallon()}. - * @stable ICU 64 - */ - static MeasureUnit getGallon(); - - /** - * Returns by pointer, unit of volume: gallon-imperial. + * Returns by value, unit of volume: gallon. + * Also see {@link #createGallon()}. + * @stable ICU 64 + */ + static MeasureUnit getGallon(); + + /** + * Returns by pointer, unit of volume: gallon-imperial. * Caller owns returned value and must free it. - * Also see {@link #getGallonImperial()}. + * Also see {@link #getGallonImperial()}. * @param status ICU error code. - * @stable ICU 57 + * @stable ICU 57 */ static MeasureUnit *createGallonImperial(UErrorCode &status); /** - * Returns by value, unit of volume: gallon-imperial. - * Also see {@link #createGallonImperial()}. - * @stable ICU 64 - */ - static MeasureUnit getGallonImperial(); - - /** - * Returns by pointer, unit of volume: hectoliter. + * Returns by value, unit of volume: gallon-imperial. + * Also see {@link #createGallonImperial()}. + * @stable ICU 64 + */ + static MeasureUnit getGallonImperial(); + + /** + * Returns by pointer, unit of volume: hectoliter. * Caller owns returned value and must free it. - * Also see {@link #getHectoliter()}. + * Also see {@link #getHectoliter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createHectoliter(UErrorCode &status); /** - * Returns by value, unit of volume: hectoliter. - * Also see {@link #createHectoliter()}. - * @stable ICU 64 - */ - static MeasureUnit getHectoliter(); - - /** - * Returns by pointer, unit of volume: liter. + * Returns by value, unit of volume: hectoliter. + * Also see {@link #createHectoliter()}. + * @stable ICU 64 + */ + static MeasureUnit getHectoliter(); + + /** + * Returns by pointer, unit of volume: liter. * Caller owns returned value and must free it. - * Also see {@link #getLiter()}. + * Also see {@link #getLiter()}. * @param status ICU error code. * @stable ICU 53 */ static MeasureUnit *createLiter(UErrorCode &status); /** - * Returns by value, unit of volume: liter. - * Also see {@link #createLiter()}. - * @stable ICU 64 - */ - static MeasureUnit getLiter(); - - /** - * Returns by pointer, unit of volume: megaliter. + * Returns by value, unit of volume: liter. + * Also see {@link #createLiter()}. + * @stable ICU 64 + */ + static MeasureUnit getLiter(); + + /** + * Returns by pointer, unit of volume: megaliter. * Caller owns returned value and must free it. - * Also see {@link #getMegaliter()}. + * Also see {@link #getMegaliter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMegaliter(UErrorCode &status); /** - * Returns by value, unit of volume: megaliter. - * Also see {@link #createMegaliter()}. - * @stable ICU 64 - */ - static MeasureUnit getMegaliter(); - - /** - * Returns by pointer, unit of volume: milliliter. + * Returns by value, unit of volume: megaliter. + * Also see {@link #createMegaliter()}. + * @stable ICU 64 + */ + static MeasureUnit getMegaliter(); + + /** + * Returns by pointer, unit of volume: milliliter. * Caller owns returned value and must free it. - * Also see {@link #getMilliliter()}. + * Also see {@link #getMilliliter()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createMilliliter(UErrorCode &status); /** - * Returns by value, unit of volume: milliliter. - * Also see {@link #createMilliliter()}. - * @stable ICU 64 - */ - static MeasureUnit getMilliliter(); - - /** - * Returns by pointer, unit of volume: pint. + * Returns by value, unit of volume: milliliter. + * Also see {@link #createMilliliter()}. + * @stable ICU 64 + */ + static MeasureUnit getMilliliter(); + + /** + * Returns by pointer, unit of volume: pint. * Caller owns returned value and must free it. - * Also see {@link #getPint()}. + * Also see {@link #getPint()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createPint(UErrorCode &status); /** - * Returns by value, unit of volume: pint. - * Also see {@link #createPint()}. - * @stable ICU 64 - */ - static MeasureUnit getPint(); - - /** - * Returns by pointer, unit of volume: pint-metric. + * Returns by value, unit of volume: pint. + * Also see {@link #createPint()}. + * @stable ICU 64 + */ + static MeasureUnit getPint(); + + /** + * Returns by pointer, unit of volume: pint-metric. * Caller owns returned value and must free it. - * Also see {@link #getPintMetric()}. + * Also see {@link #getPintMetric()}. * @param status ICU error code. * @stable ICU 56 */ static MeasureUnit *createPintMetric(UErrorCode &status); /** - * Returns by value, unit of volume: pint-metric. - * Also see {@link #createPintMetric()}. - * @stable ICU 64 - */ - static MeasureUnit getPintMetric(); - - /** - * Returns by pointer, unit of volume: quart. + * Returns by value, unit of volume: pint-metric. + * Also see {@link #createPintMetric()}. + * @stable ICU 64 + */ + static MeasureUnit getPintMetric(); + + /** + * Returns by pointer, unit of volume: quart. * Caller owns returned value and must free it. - * Also see {@link #getQuart()}. + * Also see {@link #getQuart()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createQuart(UErrorCode &status); /** - * Returns by value, unit of volume: quart. - * Also see {@link #createQuart()}. - * @stable ICU 64 - */ - static MeasureUnit getQuart(); - - /** - * Returns by pointer, unit of volume: tablespoon. + * Returns by value, unit of volume: quart. + * Also see {@link #createQuart()}. + * @stable ICU 64 + */ + static MeasureUnit getQuart(); + + /** + * Returns by pointer, unit of volume: tablespoon. * Caller owns returned value and must free it. - * Also see {@link #getTablespoon()}. + * Also see {@link #getTablespoon()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createTablespoon(UErrorCode &status); /** - * Returns by value, unit of volume: tablespoon. - * Also see {@link #createTablespoon()}. - * @stable ICU 64 - */ - static MeasureUnit getTablespoon(); - - /** - * Returns by pointer, unit of volume: teaspoon. + * Returns by value, unit of volume: tablespoon. + * Also see {@link #createTablespoon()}. + * @stable ICU 64 + */ + static MeasureUnit getTablespoon(); + + /** + * Returns by pointer, unit of volume: teaspoon. * Caller owns returned value and must free it. - * Also see {@link #getTeaspoon()}. + * Also see {@link #getTeaspoon()}. * @param status ICU error code. * @stable ICU 54 */ static MeasureUnit *createTeaspoon(UErrorCode &status); - /** - * Returns by value, unit of volume: teaspoon. - * Also see {@link #createTeaspoon()}. - * @stable ICU 64 - */ - static MeasureUnit getTeaspoon(); - + /** + * Returns by value, unit of volume: teaspoon. + * Also see {@link #createTeaspoon()}. + * @stable ICU 64 + */ + static MeasureUnit getTeaspoon(); + // End generated createXXX methods protected: @@ -3367,51 +3367,51 @@ class U_I18N_API MeasureUnit: public UObject { * For ICU use only. * @internal */ - void initCurrency(StringPiece isoCurrency); - - /** - * For ICU use only. - * @internal - */ - void initNoUnit(const char *subtype); + void initCurrency(StringPiece isoCurrency); + /** + * For ICU use only. + * @internal + */ + void initNoUnit(const char *subtype); + #endif /* U_HIDE_INTERNAL_API */ private: - // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the - // MeasureUnit. - MeasureUnitImpl* fImpl; - - // An index into a static string list in measunit.cpp. If set to -1, fImpl - // is in use instead of fTypeId and fSubTypeId. - int16_t fSubTypeId; - // An index into a static string list in measunit.cpp. If set to -1, fImpl - // is in use instead of fTypeId and fSubTypeId. - int8_t fTypeId; - - MeasureUnit(int32_t typeId, int32_t subTypeId); - MeasureUnit(MeasureUnitImpl&& impl); + // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the + // MeasureUnit. + MeasureUnitImpl* fImpl; + + // An index into a static string list in measunit.cpp. If set to -1, fImpl + // is in use instead of fTypeId and fSubTypeId. + int16_t fSubTypeId; + // An index into a static string list in measunit.cpp. If set to -1, fImpl + // is in use instead of fTypeId and fSubTypeId. + int8_t fTypeId; + + MeasureUnit(int32_t typeId, int32_t subTypeId); + MeasureUnit(MeasureUnitImpl&& impl); void setTo(int32_t typeId, int32_t subTypeId); int32_t getOffset() const; static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status); - - /** - * Sets output's typeId and subTypeId according to subType, if subType is a - * valid/known identifier. - * - * @return Whether subType is known to ICU. If false, output was not - * modified. - */ - static bool findBySubType(StringPiece subType, MeasureUnit* output); - - friend struct MeasureUnitImpl; + + /** + * Sets output's typeId and subTypeId according to subType, if subType is a + * valid/known identifier. + * + * @return Whether subType is known to ICU. If false, output was not + * modified. + */ + static bool findBySubType(StringPiece subType, MeasureUnit* output); + + friend struct MeasureUnitImpl; }; U_NAMESPACE_END #endif // !UNCONFIG_NO_FORMATTING - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __MEASUREUNIT_H__ diff --git a/contrib/libs/icu/include/unicode/measure.h b/contrib/libs/icu/include/unicode/measure.h index fa9c29351e..f146767fbc 100644 --- a/contrib/libs/icu/include/unicode/measure.h +++ b/contrib/libs/icu/include/unicode/measure.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -15,8 +15,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: MeasureUnit object. @@ -74,7 +74,7 @@ class U_I18N_API Measure: public UObject { * have the same class as returned by getDynamicClassID(). * @stable ICU 3.0 */ - virtual Measure* clone() const; + virtual Measure* clone() const; /** * Destructor @@ -160,7 +160,7 @@ inline const MeasureUnit& Measure::getUnit() const { U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __MEASURE_H__ diff --git a/contrib/libs/icu/include/unicode/messagepattern.h b/contrib/libs/icu/include/unicode/messagepattern.h index 04f00a8757..564e7a8865 100644 --- a/contrib/libs/icu/include/unicode/messagepattern.h +++ b/contrib/libs/icu/include/unicode/messagepattern.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: messagepattern.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -24,8 +24,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/parseerr.h" @@ -773,8 +773,8 @@ public: * @stable ICU 4.8 */ UMessagePatternArgType getArgType() const { - UMessagePatternPartType msgType=getType(); - if(msgType ==UMSGPAT_PART_TYPE_ARG_START || msgType ==UMSGPAT_PART_TYPE_ARG_LIMIT) { + UMessagePatternPartType msgType=getType(); + if(msgType ==UMSGPAT_PART_TYPE_ARG_START || msgType ==UMSGPAT_PART_TYPE_ARG_LIMIT) { return (UMessagePatternArgType)value; } else { return UMSGPAT_ARG_TYPE_NONE; @@ -944,6 +944,6 @@ U_NAMESPACE_END #endif // !UCONFIG_NO_FORMATTING -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __MESSAGEPATTERN_H__ diff --git a/contrib/libs/icu/include/unicode/msgfmt.h b/contrib/libs/icu/include/unicode/msgfmt.h index 99b0eaeec1..9e3c21ec19 100644 --- a/contrib/libs/icu/include/unicode/msgfmt.h +++ b/contrib/libs/icu/include/unicode/msgfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 2007-2013, International Business Machines Corporation and @@ -21,8 +21,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Formats messages in a language-neutral way. @@ -71,8 +71,8 @@ class NumberFormat; * if the pattern has named arguments (see {@link #usesNamedArguments()}). * * <p>An argument might not specify any format type. In this case, - * a numeric value is formatted with a default (for the locale) NumberFormat, - * and a date/time value is formatted with a default (for the locale) DateFormat. + * a numeric value is formatted with a default (for the locale) NumberFormat, + * and a date/time value is formatted with a default (for the locale) DateFormat. * * <p>An argument might specify a "simple" type for which the specified * Format object is created, cached and used. @@ -125,7 +125,7 @@ class NumberFormat; * argNumber = '0' | ('1'..'9' ('0'..'9')*) * * argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration" - * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText + * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText * </pre> * * <ul> @@ -167,7 +167,7 @@ class NumberFormat; * <td colspan=2><i>(none)</i> * <td><code>null</code> * <tr> - * <td rowspan=6><code>number</code> + * <td rowspan=6><code>number</code> * <td><i>(none)</i> * <td><code>NumberFormat.createInstance(getLocale(), status)</code> * <tr> @@ -183,10 +183,10 @@ class NumberFormat; * <td><i>argStyleText</i> * <td><code>new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), status)</code> * <tr> - * <td><i>argSkeletonText</i> - * <td><code>NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)</code> - * <tr> - * <td rowspan=7><code>date</code> + * <td><i>argSkeletonText</i> + * <td><code>NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)</code> + * <tr> + * <td rowspan=7><code>date</code> * <td><i>(none)</i> * <td><code>DateFormat.createDateInstance(kDefault, getLocale(), status)</code> * <tr> @@ -203,11 +203,11 @@ class NumberFormat; * <td><code>DateFormat.createDateInstance(kFull, getLocale(), status)</code> * <tr> * <td><i>argStyleText</i> - * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code> - * <tr> - * <td><i>argSkeletonText</i> - * <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</code> + * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code> * <tr> + * <td><i>argSkeletonText</i> + * <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</code> + * <tr> * <td rowspan=6><code>time</code> * <td><i>(none)</i> * <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), status)</code> @@ -225,7 +225,7 @@ class NumberFormat; * <td><code>DateFormat.createTimeInstance(kFull, getLocale(), status)</code> * <tr> * <td><i>argStyleText</i> - * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code> + * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code> * <tr> * <td><code>spellout</code> * <td><i>argStyleText (optional)</i> @@ -244,19 +244,19 @@ class NumberFormat; * </table> * <p> * - * <h4>Argument formatting</h4> - * - * <p>Arguments are formatted according to their type, using the default - * ICU formatters for those types, unless otherwise specified.</p> - * - * <p>There are also several ways to control the formatting.</p> - * - * <p>We recommend you use default styles, predefined style values, skeletons, - * or preformatted values, but not pattern strings or custom format objects.</p> - * - * <p>For more details, see the - * <a href="http://userguide.icu-project.org/formatparse/messages">ICU User Guide</a>.</p> - * + * <h4>Argument formatting</h4> + * + * <p>Arguments are formatted according to their type, using the default + * ICU formatters for those types, unless otherwise specified.</p> + * + * <p>There are also several ways to control the formatting.</p> + * + * <p>We recommend you use default styles, predefined style values, skeletons, + * or preformatted values, but not pattern strings or custom format objects.</p> + * + * <p>For more details, see the + * <a href="http://userguide.icu-project.org/formatparse/messages">ICU User Guide</a>.</p> + * * <h4>Usage Information</h4> * * <p>Here are some examples of usage: @@ -274,11 +274,11 @@ class NumberFormat; * * UnicodeString result; * MessageFormat::format( - * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.", + * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.", * arguments, 3, result, success ); * * cout << "result: " << result << endl; - * //<output>: At 4:34 PM on March 23, there was a disturbance + * //<output>: At 4:34 PM on March 23, there was a disturbance * // in the Force on planet 7. * \endcode * </pre> @@ -420,7 +420,7 @@ public: * result and should delete it when done. * @stable ICU 2.0 */ - virtual MessageFormat* clone() const; + virtual MessageFormat* clone() const; /** * Returns true if the given Format objects are semantically equal. @@ -959,7 +959,7 @@ private: * @return the index of the list which matches the keyword s. */ static int32_t findKeyword( const UnicodeString& s, - const char16_t * const *list); + const char16_t * const *list); /** * Thin wrapper around the format(... AppendableWrapper ...) variant. @@ -1011,8 +1011,8 @@ private: void cacheExplicitFormats(UErrorCode& status); - int32_t skipLeadingSpaces(UnicodeString& style); - + int32_t skipLeadingSpaces(UnicodeString& style); + Format* createAppropriateFormat(UnicodeString& type, UnicodeString& style, Formattable::Type& formattableType, @@ -1089,7 +1089,7 @@ private: class U_I18N_API DummyFormat : public Format { public: virtual UBool operator==(const Format&) const; - virtual DummyFormat* clone() const; + virtual DummyFormat* clone() const; virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, UErrorCode& status) const; @@ -1113,7 +1113,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _MSGFMT //eof diff --git a/contrib/libs/icu/include/unicode/normalizer2.h b/contrib/libs/icu/include/unicode/normalizer2.h index 4aeb3bb3d8..c7fbdf87b1 100644 --- a/contrib/libs/icu/include/unicode/normalizer2.h +++ b/contrib/libs/icu/include/unicode/normalizer2.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: normalizer2.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -26,19 +26,19 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_NORMALIZATION -#include "unicode/stringpiece.h" +#include "unicode/stringpiece.h" #include "unicode/uniset.h" #include "unicode/unistr.h" #include "unicode/unorm2.h" U_NAMESPACE_BEGIN -class ByteSink; - +class ByteSink; + /** * Unicode normalization functionality for standard Unicode normalization or * for using custom mapping tables. @@ -220,36 +220,36 @@ public: normalize(const UnicodeString &src, UnicodeString &dest, UErrorCode &errorCode) const = 0; - - /** - * Normalizes a UTF-8 string and optionally records how source substrings - * relate to changed and unchanged result substrings. - * - * Currently implemented completely only for "compose" modes, - * such as for NFC, NFKC, and NFKC_Casefold - * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). - * Otherwise currently converts to & from UTF-16 and does not support edits. - * - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src Source UTF-8 string. - * @param sink A ByteSink to which the normalized UTF-8 result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be nullptr. - * @param errorCode Standard ICU error code. Its input value must - * pass the U_SUCCESS() test, or else the function returns - * immediately. Check for U_FAILURE() on output or use with - * function chaining. (See User Guide for details.) - * @stable ICU 60 - */ - virtual void - normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, - Edits *edits, UErrorCode &errorCode) const; - - /** + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Currently implemented completely only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * Otherwise currently converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const; + + /** * Appends the normalized form of the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if the first string was normalized. @@ -316,7 +316,7 @@ public: * * When used on a standard NFC Normalizer2 instance, * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); - * in this case, the result contains either one or two code points (=1..4 char16_ts). + * in this case, the result contains either one or two code points (=1..4 char16_ts). * * This function is independent of the mode of the Normalizer2. * The default implementation returns FALSE. @@ -374,31 +374,31 @@ public: */ virtual UBool isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0; - /** - * Tests if the UTF-8 string is normalized. - * Internally, in cases where the quickCheck() method would return "maybe" - * (which is only possible for the two COMPOSE modes) this method - * resolves to "yes" or "no" to provide a definitive result, - * at the cost of doing more work in those cases. - * - * This works for all normalization modes, - * but it is currently optimized for UTF-8 only for "compose" modes, - * such as for NFC, NFKC, and NFKC_Casefold - * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). - * For other modes it currently converts to UTF-16 and calls isNormalized(). - * - * @param s UTF-8 input string - * @param errorCode Standard ICU error code. Its input value must - * pass the U_SUCCESS() test, or else the function returns - * immediately. Check for U_FAILURE() on output or use with - * function chaining. (See User Guide for details.) - * @return TRUE if s is normalized - * @stable ICU 60 - */ - virtual UBool - isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const; - - + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes, + * but it is currently optimized for UTF-8 only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * For other modes it currently converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @stable ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const; + + /** * Tests if the string is normalized. * For the two COMPOSE modes, the result could be "maybe" in cases that @@ -537,37 +537,37 @@ public: virtual UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, - UErrorCode &errorCode) const U_OVERRIDE; - - /** - * Normalizes a UTF-8 string and optionally records how source substrings - * relate to changed and unchanged result substrings. - * - * Currently implemented completely only for "compose" modes, - * such as for NFC, NFKC, and NFKC_Casefold - * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). - * Otherwise currently converts to & from UTF-16 and does not support edits. - * - * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. - * @param src Source UTF-8 string. - * @param sink A ByteSink to which the normalized UTF-8 result string is written. - * sink.Flush() is called at the end. - * @param edits Records edits for index mapping, working with styled text, - * and getting only changes (if any). - * The Edits contents is undefined if any error occurs. - * This function calls edits->reset() first unless - * options includes U_EDITS_NO_RESET. edits can be nullptr. - * @param errorCode Standard ICU error code. Its input value must - * pass the U_SUCCESS() test, or else the function returns - * immediately. Check for U_FAILURE() on output or use with - * function chaining. (See User Guide for details.) - * @stable ICU 60 - */ - virtual void - normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, - Edits *edits, UErrorCode &errorCode) const U_OVERRIDE; - - /** + UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Currently implemented completely only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * Otherwise currently converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const U_OVERRIDE; + + /** * Appends the normalized form of the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if the first string was normalized. @@ -584,7 +584,7 @@ public: virtual UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const U_OVERRIDE; + UErrorCode &errorCode) const U_OVERRIDE; /** * Appends the second string to the first string * (merging them at the boundary) and returns the first string. @@ -602,7 +602,7 @@ public: virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, - UErrorCode &errorCode) const U_OVERRIDE; + UErrorCode &errorCode) const U_OVERRIDE; /** * Gets the decomposition mapping of c. @@ -616,7 +616,7 @@ public: * @stable ICU 4.6 */ virtual UBool - getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; /** * Gets the raw decomposition mapping of c. @@ -630,7 +630,7 @@ public: * @stable ICU 49 */ virtual UBool - getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; /** * Performs pairwise composition of a & b and returns the composite if there is one. @@ -643,7 +643,7 @@ public: * @stable ICU 49 */ virtual UChar32 - composePair(UChar32 a, UChar32 b) const U_OVERRIDE; + composePair(UChar32 a, UChar32 b) const U_OVERRIDE; /** * Gets the combining class of c. @@ -654,7 +654,7 @@ public: * @stable ICU 49 */ virtual uint8_t - getCombiningClass(UChar32 c) const U_OVERRIDE; + getCombiningClass(UChar32 c) const U_OVERRIDE; /** * Tests if the string is normalized. @@ -668,31 +668,31 @@ public: * @stable ICU 4.4 */ virtual UBool - isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; - /** - * Tests if the UTF-8 string is normalized. - * Internally, in cases where the quickCheck() method would return "maybe" - * (which is only possible for the two COMPOSE modes) this method - * resolves to "yes" or "no" to provide a definitive result, - * at the cost of doing more work in those cases. - * - * This works for all normalization modes, - * but it is currently optimized for UTF-8 only for "compose" modes, - * such as for NFC, NFKC, and NFKC_Casefold - * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). - * For other modes it currently converts to UTF-16 and calls isNormalized(). - * - * @param s UTF-8 input string - * @param errorCode Standard ICU error code. Its input value must - * pass the U_SUCCESS() test, or else the function returns - * immediately. Check for U_FAILURE() on output or use with - * function chaining. (See User Guide for details.) - * @return TRUE if s is normalized - * @stable ICU 60 - */ - virtual UBool - isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE; - /** + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes, + * but it is currently optimized for UTF-8 only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * For other modes it currently converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @stable ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE; + /** * Tests if the string is normalized. * For details see the Normalizer2 base class documentation. * @param s input string @@ -704,7 +704,7 @@ public: * @stable ICU 4.4 */ virtual UNormalizationCheckResult - quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; /** * Returns the end of the normalized substring of the input string. * For details see the Normalizer2 base class documentation. @@ -717,7 +717,7 @@ public: * @stable ICU 4.4 */ virtual int32_t - spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; /** * Tests if the character always has a normalization boundary before it, @@ -727,7 +727,7 @@ public: * @return TRUE if c has a normalization boundary before it * @stable ICU 4.4 */ - virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE; + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE; /** * Tests if the character always has a normalization boundary after it, @@ -737,7 +737,7 @@ public: * @return TRUE if c has a normalization boundary after it * @stable ICU 4.4 */ - virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE; + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE; /** * Tests if the character is normalization-inert. @@ -746,7 +746,7 @@ public: * @return TRUE if c is normalization-inert * @stable ICU 4.4 */ - virtual UBool isInert(UChar32 c) const U_OVERRIDE; + virtual UBool isInert(UChar32 c) const U_OVERRIDE; private: UnicodeString & normalize(const UnicodeString &src, @@ -754,12 +754,12 @@ private: USetSpanCondition spanCondition, UErrorCode &errorCode) const; - void - normalizeUTF8(uint32_t options, const char *src, int32_t length, - ByteSink &sink, Edits *edits, - USetSpanCondition spanCondition, - UErrorCode &errorCode) const; - + void + normalizeUTF8(uint32_t options, const char *src, int32_t length, + ByteSink &sink, Edits *edits, + USetSpanCondition spanCondition, + UErrorCode &errorCode) const; + UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, @@ -773,7 +773,7 @@ private: U_NAMESPACE_END #endif // !UCONFIG_NO_NORMALIZATION - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __NORMALIZER2_H__ diff --git a/contrib/libs/icu/include/unicode/normlzr.h b/contrib/libs/icu/include/unicode/normlzr.h index 07a596bd11..4921786ee5 100644 --- a/contrib/libs/icu/include/unicode/normlzr.h +++ b/contrib/libs/icu/include/unicode/normlzr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************** @@ -13,8 +13,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Unicode Normalization @@ -170,7 +170,7 @@ public: * @param mode The normalization mode. * @deprecated ICU 56 Use Normalizer2 instead. */ - Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode); + Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode); /** * Creates a new <code>Normalizer</code> object for iterating over the @@ -185,7 +185,7 @@ public: Normalizer(const CharacterIterator& iter, UNormalizationMode mode); #endif /* U_HIDE_DEPRECATED_API */ -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Copy constructor. * @param copy The object to be copied. @@ -198,7 +198,7 @@ public: * @deprecated ICU 56 Use Normalizer2 instead. */ virtual ~Normalizer(); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API //------------------------------------------------------------------------- // Static utility methods @@ -602,7 +602,7 @@ public: * @return a pointer to a new Normalizer * @deprecated ICU 56 Use Normalizer2 instead. */ - Normalizer* clone() const; + Normalizer* clone() const; /** * Generates a hash code for this iterator. @@ -707,7 +707,7 @@ public: * @param status a UErrorCode * @deprecated ICU 56 Use Normalizer2 instead. */ - void setText(ConstChar16Ptr newText, + void setText(ConstChar16Ptr newText, int32_t length, UErrorCode &status); /** @@ -726,14 +726,14 @@ public: static UClassID U_EXPORT2 getStaticClassID(); #endif /* U_HIDE_DEPRECATED_API */ -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * @return a UClassID for the actual class. * @deprecated ICU 56 Use Normalizer2 instead. */ virtual UClassID getDynamicClassID() const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API private: //------------------------------------------------------------------------- @@ -801,8 +801,8 @@ Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, uint32_t options, UErrorCode &errorCode) { // all argument checking is done in unorm_compare - return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(), - toUCharPtr(s2.getBuffer()), s2.length(), + return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(), + toUCharPtr(s2.getBuffer()), s2.length(), options, &errorCode); } @@ -812,5 +812,5 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_NORMALIZATION */ #endif // NORMLZR_H - -#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif /* U_SHOW_CPLUSPLUS_API */ diff --git a/contrib/libs/icu/include/unicode/nounit.h b/contrib/libs/icu/include/unicode/nounit.h index 61b5c16ee3..ad9bb68276 100644 --- a/contrib/libs/icu/include/unicode/nounit.h +++ b/contrib/libs/icu/include/unicode/nounit.h @@ -1,116 +1,116 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* - ******************************************************************************* - * Copyright (C) 2009-2017, International Business Machines Corporation, * - * Google, and others. All Rights Reserved. * - ******************************************************************************* - */ - -#ifndef __NOUNIT_H__ -#define __NOUNIT_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/measunit.h" - -#ifndef U_HIDE_DRAFT_API - -/** - * \file - * \brief C++ API: units for percent and permille - */ - -U_NAMESPACE_BEGIN - -/** - * Dimensionless unit for percent and permille. - * @see NumberFormatter - * @draft ICU 60 - */ -class U_I18N_API NoUnit: public MeasureUnit { -public: - /** - * Returns an instance for the base unit (dimensionless and no scaling). - * - * @return a NoUnit instance - * @draft ICU 60 - */ - static NoUnit U_EXPORT2 base(); - - /** - * Returns an instance for percent, or 1/100 of a base unit. - * - * @return a NoUnit instance - * @draft ICU 60 - */ - static NoUnit U_EXPORT2 percent(); - - /** - * Returns an instance for permille, or 1/1000 of a base unit. - * - * @return a NoUnit instance - * @draft ICU 60 - */ - static NoUnit U_EXPORT2 permille(); - - /** - * Copy operator. - * @draft ICU 60 - */ - NoUnit(const NoUnit& other); - - /** - * Destructor. - * @draft ICU 60 - */ - virtual ~NoUnit(); - - /** - * Return a polymorphic clone of this object. The result will - * have the same class as returned by getDynamicClassID(). - * @draft ICU 60 - */ - virtual NoUnit* clone() const; - - /** - * Returns a unique class ID for this object POLYMORPHICALLY. - * This method implements a simple form of RTTI used by ICU. - * @return The class ID for this object. All objects of a given - * class have the same class ID. Objects of other classes have - * different class IDs. - * @draft ICU 60 - */ - virtual UClassID getDynamicClassID() const; - - /** - * Returns the class ID for this class. This is used to compare to - * the return value of getDynamicClassID(). - * @return The class ID for all objects of this class. - * @draft ICU 60 - */ - static UClassID U_EXPORT2 getStaticClassID(); - -private: - /** - * Constructor - * @internal (private) - */ - NoUnit(const char* subtype); - -}; - -U_NAMESPACE_END - -#endif /* U_HIDE_DRAFT_API */ -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __NOUNIT_H__ -//eof -// +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2009-2017, International Business Machines Corporation, * + * Google, and others. All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef __NOUNIT_H__ +#define __NOUNIT_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/measunit.h" + +#ifndef U_HIDE_DRAFT_API + +/** + * \file + * \brief C++ API: units for percent and permille + */ + +U_NAMESPACE_BEGIN + +/** + * Dimensionless unit for percent and permille. + * @see NumberFormatter + * @draft ICU 60 + */ +class U_I18N_API NoUnit: public MeasureUnit { +public: + /** + * Returns an instance for the base unit (dimensionless and no scaling). + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 base(); + + /** + * Returns an instance for percent, or 1/100 of a base unit. + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 percent(); + + /** + * Returns an instance for permille, or 1/1000 of a base unit. + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 permille(); + + /** + * Copy operator. + * @draft ICU 60 + */ + NoUnit(const NoUnit& other); + + /** + * Destructor. + * @draft ICU 60 + */ + virtual ~NoUnit(); + + /** + * Return a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @draft ICU 60 + */ + virtual NoUnit* clone() const; + + /** + * Returns a unique class ID for this object POLYMORPHICALLY. + * This method implements a simple form of RTTI used by ICU. + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @draft ICU 60 + */ + virtual UClassID getDynamicClassID() const; + + /** + * Returns the class ID for this class. This is used to compare to + * the return value of getDynamicClassID(). + * @return The class ID for all objects of this class. + * @draft ICU 60 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + /** + * Constructor + * @internal (private) + */ + NoUnit(const char* subtype); + +}; + +U_NAMESPACE_END + +#endif /* U_HIDE_DRAFT_API */ +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __NOUNIT_H__ +//eof +// diff --git a/contrib/libs/icu/include/unicode/numberformatter.h b/contrib/libs/icu/include/unicode/numberformatter.h index 615cf49f7b..0f128ed7ab 100644 --- a/contrib/libs/icu/include/unicode/numberformatter.h +++ b/contrib/libs/icu/include/unicode/numberformatter.h @@ -1,2642 +1,2642 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#ifndef __NUMBERFORMATTER_H__ -#define __NUMBERFORMATTER_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/appendable.h" -#include "unicode/bytestream.h" -#include "unicode/currunit.h" -#include "unicode/dcfmtsym.h" -#include "unicode/fieldpos.h" -#include "unicode/formattedvalue.h" -#include "unicode/fpositer.h" -#include "unicode/measunit.h" -#include "unicode/nounit.h" -#include "unicode/parseerr.h" -#include "unicode/plurrule.h" -#include "unicode/ucurr.h" -#include "unicode/unum.h" -#include "unicode/unumberformatter.h" -#include "unicode/uobject.h" - -/** - * \file - * \brief C++ API: Library for localized number formatting introduced in ICU 60. - * - * This library was introduced in ICU 60 to simplify the process of formatting localized number strings. - * Basic usage examples: - * - * <pre> - * // Most basic usage: - * NumberFormatter::withLocale(...).format(123).toString(); // 1,234 in en-US - * - * // Custom notation, unit, and rounding precision: - * NumberFormatter::with() - * .notation(Notation::compactShort()) - * .unit(CurrencyUnit("EUR", status)) - * .precision(Precision::maxDigits(2)) - * .locale(...) - * .format(1234) - * .toString(); // €1.2K in en-US - * - * // Create a formatter in a singleton by value for use later: - * static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...) - * .unit(NoUnit::percent()) - * .precision(Precision::fixedFraction(3)); - * formatter.format(5.9831).toString(); // 5.983% in en-US - * - * // Create a "template" in a singleton unique_ptr but without setting a locale until the call site: - * std::unique_ptr<UnlocalizedNumberFormatter> template = NumberFormatter::with() - * .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS) - * .unit(MeasureUnit::getMeter()) - * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME) - * .clone(); - * template->locale(...).format(1234).toString(); // +1,234 meters in en-US - * </pre> - * - * <p> - * This API offers more features than DecimalFormat and is geared toward new users of ICU. - * - * <p> - * NumberFormatter instances (i.e., LocalizedNumberFormatter and UnlocalizedNumberFormatter) - * are immutable and thread safe. This means that invoking a configuration method has no - * effect on the receiving instance; you must store and use the new number formatter instance it returns instead. - * - * <pre> - * UnlocalizedNumberFormatter formatter = UnlocalizedNumberFormatter::with().notation(Notation::scientific()); - * formatter.precision(Precision.maxFraction(2)); // does nothing! - * formatter.locale(Locale.getEnglish()).format(9.8765).toString(); // prints "9.8765E0", not "9.88E0" - * </pre> - * - * <p> - * This API is based on the <em>fluent</em> design pattern popularized by libraries such as Google's Guava. For - * extensive details on the design of this API, read <a href="https://goo.gl/szi5VB">the design doc</a>. - * - * @author Shane Carr - */ - -U_NAMESPACE_BEGIN - -// Forward declarations: -class IFixedDecimal; -class FieldPositionIteratorHandler; -class FormattedStringBuilder; - -namespace numparse { -namespace impl { - -// Forward declarations: -class NumberParserImpl; -class MultiplierParseHandler; - -} -} - -namespace number { // icu::number - -// Forward declarations: -class UnlocalizedNumberFormatter; -class LocalizedNumberFormatter; -class FormattedNumber; -class Notation; -class ScientificNotation; -class Precision; -class FractionPrecision; -class CurrencyPrecision; -class IncrementPrecision; -class IntegerWidth; - -namespace impl { - -// can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes -/** - * Datatype for minimum/maximum fraction digits. Must be able to hold kMaxIntFracSig. - * - * @internal - */ -typedef int16_t digits_t; - -// can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization -/** - * Use a default threshold of 3. This means that the third time .format() is called, the data structures get built - * using the "safe" code path. The first two calls to .format() will trigger the unsafe code path. - * - * @internal - */ -static constexpr int32_t kInternalDefaultThreshold = 3; - -// Forward declarations: -class Padder; -struct MacroProps; -struct MicroProps; -class DecimalQuantity; -class UFormattedNumberData; -class NumberFormatterImpl; -struct ParsedPatternInfo; -class ScientificModifier; -class MultiplierProducer; -class RoundingImpl; -class ScientificHandler; -class Modifier; -class AffixPatternProvider; -class NumberPropertyMapper; -struct DecimalFormatProperties; -class MultiplierFormatHandler; -class CurrencySymbols; -class GeneratorHelpers; -class DecNum; -class NumberRangeFormatterImpl; -struct RangeMacroProps; -struct UFormattedNumberImpl; -class MutablePatternModifier; -class ImmutablePatternModifier; - -/** - * Used for NumberRangeFormatter and implemented in numrange_fluent.cpp. - * Declared here so it can be friended. - * - * @internal - */ -void touchRangeLocales(impl::RangeMacroProps& macros); - -} // namespace impl - -/** - * Extra name reserved in case it is needed in the future. - * - * @stable ICU 63 - */ -typedef Notation CompactNotation; - -/** - * Extra name reserved in case it is needed in the future. - * - * @stable ICU 63 - */ -typedef Notation SimpleNotation; - -/** - * A class that defines the notation style to be used when formatting numbers in NumberFormatter. - * - * @stable ICU 60 - */ -class U_I18N_API Notation : public UMemory { - public: - /** - * Print the number using scientific notation (also known as scientific form, standard index form, or standard form - * in the UK). The format for scientific notation varies by locale; for example, many Western locales display the - * number in the form "#E0", where the number is displayed with one digit before the decimal separator, zero or more - * digits after the decimal separator, and the corresponding power of 10 displayed after the "E". - * - * <p> - * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3: - * - * <pre> - * 8.765E4 - * 8.765E3 - * 8.765E2 - * 8.765E1 - * 8.765E0 - * 8.765E-1 - * 8.765E-2 - * 8.765E-3 - * 0E0 - * </pre> - * - * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. - * @stable ICU 60 - */ - static ScientificNotation scientific(); - - /** - * Print the number using engineering notation, a variant of scientific notation in which the exponent must be - * divisible by 3. - * - * <p> - * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3: - * - * <pre> - * 87.65E3 - * 8.765E3 - * 876.5E0 - * 87.65E0 - * 8.765E0 - * 876.5E-3 - * 87.65E-3 - * 8.765E-3 - * 0E0 - * </pre> - * - * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. - * @stable ICU 60 - */ - static ScientificNotation engineering(); - - /** - * Print the number using short-form compact notation. - * - * <p> - * <em>Compact notation</em>, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with - * localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to - * engineering notation in how it scales numbers. - * - * <p> - * Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing - * screen real estate. - * - * <p> - * In short form, the powers of ten are abbreviated. In <em>en-US</em>, the abbreviations are "K" for thousands, "M" - * for millions, "B" for billions, and "T" for trillions. Example outputs in <em>en-US</em> when printing 8.765E7 - * through 8.765E0: - * - * <pre> - * 88M - * 8.8M - * 876K - * 88K - * 8.8K - * 876 - * 88 - * 8.8 - * </pre> - * - * <p> - * When compact notation is specified without an explicit rounding precision, numbers are rounded off to the closest - * integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal - * separator if there is only one digit before the decimal separator. The default compact notation rounding precision - * is equivalent to: - * - * <pre> - * Precision::integer().withMinDigits(2) - * </pre> - * - * @return A CompactNotation for passing to the NumberFormatter notation() setter. - * @stable ICU 60 - */ - static CompactNotation compactShort(); - - /** - * Print the number using long-form compact notation. For more information on compact notation, see - * {@link #compactShort}. - * - * <p> - * In long form, the powers of ten are spelled out fully. Example outputs in <em>en-US</em> when printing 8.765E7 - * through 8.765E0: - * - * <pre> - * 88 million - * 8.8 million - * 876 thousand - * 88 thousand - * 8.8 thousand - * 876 - * 88 - * 8.8 - * </pre> - * - * @return A CompactNotation for passing to the NumberFormatter notation() setter. - * @stable ICU 60 - */ - static CompactNotation compactLong(); - - /** - * Print the number using simple notation without any scaling by powers of ten. This is the default behavior. - * - * <p> - * Since this is the default behavior, this method needs to be called only when it is necessary to override a - * previous setting. - * - * <p> - * Example outputs in <em>en-US</em> when printing 8.765E7 through 8.765E0: - * - * <pre> - * 87,650,000 - * 8,765,000 - * 876,500 - * 87,650 - * 8,765 - * 876.5 - * 87.65 - * 8.765 - * </pre> - * - * @return A SimpleNotation for passing to the NumberFormatter notation() setter. - * @stable ICU 60 - */ - static SimpleNotation simple(); - - private: - enum NotationType { - NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR - } fType; - - union NotationUnion { - // For NTN_SCIENTIFIC - /** @internal */ - struct ScientificSettings { - /** @internal */ - int8_t fEngineeringInterval; - /** @internal */ - bool fRequireMinInt; - /** @internal */ - impl::digits_t fMinExponentDigits; - /** @internal */ - UNumberSignDisplay fExponentSignDisplay; - } scientific; - - // For NTN_COMPACT - UNumberCompactStyle compactStyle; - - // For NTN_ERROR - UErrorCode errorCode; - } fUnion; - - typedef NotationUnion::ScientificSettings ScientificSettings; - - Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {} - - Notation(UErrorCode errorCode) : fType(NTN_ERROR) { - fUnion.errorCode = errorCode; - } - - Notation() : fType(NTN_SIMPLE), fUnion() {} - - UBool copyErrorTo(UErrorCode &status) const { - if (fType == NTN_ERROR) { - status = fUnion.errorCode; - return TRUE; - } - return FALSE; - } - - // To allow MacroProps to initialize empty instances: - friend struct impl::MacroProps; - friend class ScientificNotation; - - // To allow implementation to access internal types: - friend class impl::NumberFormatterImpl; - friend class impl::ScientificModifier; - friend class impl::ScientificHandler; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; -}; - -/** - * A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter. - * - * <p> - * To create a ScientificNotation, use one of the factory methods in {@link Notation}. - * - * @stable ICU 60 - */ -class U_I18N_API ScientificNotation : public Notation { - public: - /** - * Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if - * necessary. Useful for fixed-width display. - * - * <p> - * For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in <em>en-US</em> instead of - * the default "1.23E2". - * - * @param minExponentDigits - * The minimum number of digits to show in the exponent. - * @return A ScientificNotation, for chaining. - * @stable ICU 60 - */ - ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const; - - /** - * Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, - * showing the minus sign but not the plus sign. - * - * <p> - * For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in <em>en-US</em> - * instead of the default "1.23E2". - * - * @param exponentSignDisplay - * The strategy for displaying the sign in the exponent. - * @return A ScientificNotation, for chaining. - * @stable ICU 60 - */ - ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const; - - private: - // Inherit constructor - using Notation::Notation; - - // Raw constructor for NumberPropertyMapper - ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits, - UNumberSignDisplay fExponentSignDisplay); - - friend class Notation; - - // So that NumberPropertyMapper can create instances - friend class impl::NumberPropertyMapper; -}; - -/** - * Extra name reserved in case it is needed in the future. - * - * @stable ICU 63 - */ -typedef Precision SignificantDigitsPrecision; - -/** - * A class that defines the rounding precision to be used when formatting numbers in NumberFormatter. - * - * <p> - * To create a Precision, use one of the factory methods. - * - * @stable ICU 60 - */ -class U_I18N_API Precision : public UMemory { - - public: - /** - * Show all available digits to full precision. - * - * <p> - * <strong>NOTE:</strong> When formatting a <em>double</em>, this method, along with {@link #minFraction} and - * {@link #minSignificantDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the - * low-order digits and the number of digits to display based on the value of the double. - * If the number of fraction places or significant digits can be bounded, consider using {@link #maxFraction} - * or {@link #maxSignificantDigits} instead to maximize performance. - * For more information, read the following blog post. - * - * <p> - * http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/ - * - * @return A Precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static Precision unlimited(); - - /** - * Show numbers rounded if necessary to the nearest integer. - * - * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static FractionPrecision integer(); - - /** - * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). - * Additionally, pad with zeros to ensure that this number of places are always shown. - * - * <p> - * Example output with minMaxFractionPlaces = 3: - * - * <p> - * 87,650.000<br> - * 8,765.000<br> - * 876.500<br> - * 87.650<br> - * 8.765<br> - * 0.876<br> - * 0.088<br> - * 0.009<br> - * 0.000 (zero) - * - * <p> - * This method is equivalent to {@link #minMaxFraction} with both arguments equal. - * - * @param minMaxFractionPlaces - * The minimum and maximum number of numerals to display after the decimal separator (rounding if too - * long or padding with zeros if too short). - * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces); - - /** - * Always show at least a certain number of fraction places after the decimal separator, padding with zeros if - * necessary. Do not perform rounding (display numbers to their full precision). - * - * <p> - * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}. - * - * @param minFractionPlaces - * The minimum number of numerals to display after the decimal separator (padding with zeros if - * necessary). - * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static FractionPrecision minFraction(int32_t minFractionPlaces); - - /** - * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). - * Unlike the other fraction rounding strategies, this strategy does <em>not</em> pad zeros to the end of the - * number. - * - * @param maxFractionPlaces - * The maximum number of numerals to display after the decimal mark (rounding if necessary). - * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static FractionPrecision maxFraction(int32_t maxFractionPlaces); - - /** - * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); - * in addition, always show at least a certain number of places after the decimal separator, padding with zeros if - * necessary. - * - * @param minFractionPlaces - * The minimum number of numerals to display after the decimal separator (padding with zeros if - * necessary). - * @param maxFractionPlaces - * The maximum number of numerals to display after the decimal separator (rounding if necessary). - * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces); - - /** - * Show numbers rounded if necessary to a certain number of significant digits or significant figures. Additionally, - * pad with zeros to ensure that this number of significant digits/figures are always shown. - * - * <p> - * This method is equivalent to {@link #minMaxSignificantDigits} with both arguments equal. - * - * @param minMaxSignificantDigits - * The minimum and maximum number of significant digits to display (rounding if too long or padding with - * zeros if too short). - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 62 - */ - static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits); - - /** - * Always show at least a certain number of significant digits/figures, padding with zeros if necessary. Do not - * perform rounding (display numbers to their full precision). - * - * <p> - * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}. - * - * @param minSignificantDigits - * The minimum number of significant digits to display (padding with zeros if too short). - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 62 - */ - static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits); - - /** - * Show numbers rounded if necessary to a certain number of significant digits/figures. - * - * @param maxSignificantDigits - * The maximum number of significant digits to display (rounding if too long). - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 62 - */ - static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits); - - /** - * Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at - * least a certain number of significant digits, padding with zeros if necessary. - * - * @param minSignificantDigits - * The minimum number of significant digits to display (padding with zeros if necessary). - * @param maxSignificantDigits - * The maximum number of significant digits to display (rounding if necessary). - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 62 - */ - static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits, - int32_t maxSignificantDigits); - - /** - * Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the - * rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5. - * - * <p> - * In order to ensure that numbers are padded to the appropriate number of fraction places, call - * withMinFraction() on the return value of this method. - * For example, to round to the nearest 0.5 and always display 2 numerals after the - * decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run: - * - * <pre> - * Precision::increment(0.5).withMinFraction(2) - * </pre> - * - * @param roundingIncrement - * The increment to which to round numbers. - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static IncrementPrecision increment(double roundingIncrement); - - /** - * Show numbers rounded and padded according to the rules for the currency unit. The most common - * rounding precision settings for currencies include <code>Precision::fixedFraction(2)</code>, - * <code>Precision::integer()</code>, and <code>Precision::increment(0.05)</code> for cash transactions - * ("nickel rounding"). - * - * <p> - * The exact rounding details will be resolved at runtime based on the currency unit specified in the - * NumberFormatter chain. To round according to the rules for one currency while displaying the symbol for another - * currency, the withCurrency() method can be called on the return value of this method. - * - * @param currencyUsage - * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding increment may - * be limited by the available denominations of cash or coins). - * @return A CurrencyPrecision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - static CurrencyPrecision currency(UCurrencyUsage currencyUsage); - - private: - enum PrecisionType { - RND_BOGUS, - RND_NONE, - RND_FRACTION, - RND_SIGNIFICANT, - RND_FRACTION_SIGNIFICANT, - - // Used for strange increments like 3.14. - RND_INCREMENT, - - // Used for increments with 1 as the only digit. This is different than fraction - // rounding because it supports having additional trailing zeros. For example, this - // class is used to round with the increment 0.010. - RND_INCREMENT_ONE, - - // Used for increments with 5 as the only digit (nickel rounding). - RND_INCREMENT_FIVE, - - RND_CURRENCY, - RND_ERROR - } fType; - - union PrecisionUnion { - /** @internal */ - struct FractionSignificantSettings { - // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT - /** @internal */ - impl::digits_t fMinFrac; - /** @internal */ - impl::digits_t fMaxFrac; - /** @internal */ - impl::digits_t fMinSig; - /** @internal */ - impl::digits_t fMaxSig; - } fracSig; - /** @internal */ - struct IncrementSettings { - // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE - /** @internal */ - double fIncrement; - /** @internal */ - impl::digits_t fMinFrac; - /** @internal */ - impl::digits_t fMaxFrac; - } increment; - UCurrencyUsage currencyUsage; // For RND_CURRENCY - UErrorCode errorCode; // For RND_ERROR - } fUnion; - - typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings; - typedef PrecisionUnion::IncrementSettings IncrementSettings; - - /** The Precision encapsulates the RoundingMode when used within the implementation. */ - UNumberFormatRoundingMode fRoundingMode; - - Precision(const PrecisionType& type, const PrecisionUnion& union_, - UNumberFormatRoundingMode roundingMode) - : fType(type), fUnion(union_), fRoundingMode(roundingMode) {} - - Precision(UErrorCode errorCode) : fType(RND_ERROR) { - fUnion.errorCode = errorCode; - } - - Precision() : fType(RND_BOGUS) {} - - bool isBogus() const { - return fType == RND_BOGUS; - } - - UBool copyErrorTo(UErrorCode &status) const { - if (fType == RND_ERROR) { - status = fUnion.errorCode; - return TRUE; - } - return FALSE; - } - - // On the parent type so that this method can be called internally on Precision instances. - Precision withCurrency(const CurrencyUnit ¤cy, UErrorCode &status) const; - - static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac); - - static Precision constructSignificant(int32_t minSig, int32_t maxSig); - - static Precision - constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig); - - static IncrementPrecision constructIncrement(double increment, int32_t minFrac); - - static CurrencyPrecision constructCurrency(UCurrencyUsage usage); - - static Precision constructPassThrough(); - - // To allow MacroProps/MicroProps to initialize bogus instances: - friend struct impl::MacroProps; - friend struct impl::MicroProps; - - // To allow NumberFormatterImpl to access isBogus() and other internal methods: - friend class impl::NumberFormatterImpl; - - // To allow NumberPropertyMapper to create instances from DecimalFormatProperties: - friend class impl::NumberPropertyMapper; - - // To allow access to the main implementation class: - friend class impl::RoundingImpl; - - // To allow child classes to call private methods: - friend class FractionPrecision; - friend class CurrencyPrecision; - friend class IncrementPrecision; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; -}; - -/** - * A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be - * used when formatting numbers in NumberFormatter. - * - * <p> - * To create a FractionPrecision, use one of the factory methods on Precision. - * - * @stable ICU 60 - */ -class U_I18N_API FractionPrecision : public Precision { - public: - /** - * Ensure that no less than this number of significant digits are retained when rounding according to fraction - * rules. - * - * <p> - * For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141 - * becomes "3.1" instead. - * - * <p> - * This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0". - * - * @param minSignificantDigits - * The number of significant figures to guarantee. - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - Precision withMinDigits(int32_t minSignificantDigits) const; - - /** - * Ensure that no more than this number of significant digits are retained when rounding according to fraction - * rules. - * - * <p> - * For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 - * becomes "120" instead. - * - * <p> - * This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would - * become "120.00". - * - * @param maxSignificantDigits - * Round the number to no more than this number of significant figures. - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - Precision withMaxDigits(int32_t maxSignificantDigits) const; - - private: - // Inherit constructor - using Precision::Precision; - - // To allow parent class to call this class's constructor: - friend class Precision; -}; - -/** - * A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in - * NumberFormatter. - * - * <p> - * To create a CurrencyPrecision, use one of the factory methods on Precision. - * - * @stable ICU 60 - */ -class U_I18N_API CurrencyPrecision : public Precision { - public: - /** - * Associates a currency with this rounding precision. - * - * <p> - * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit() - * is automatically applied to currency rounding precisions. However, - * this method enables you to override that automatic association. - * - * <p> - * This method also enables numbers to be formatted using currency rounding rules without explicitly using a - * currency format. - * - * @param currency - * The currency to associate with this rounding precision. - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - Precision withCurrency(const CurrencyUnit ¤cy) const; - - private: - // Inherit constructor - using Precision::Precision; - - // To allow parent class to call this class's constructor: - friend class Precision; -}; - -/** - * A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in - * NumberFormatter. - * - * <p> - * To create an IncrementPrecision, use one of the factory methods on Precision. - * - * @stable ICU 60 - */ -class U_I18N_API IncrementPrecision : public Precision { - public: - /** - * Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if - * necessary. By default, no trailing zeros are added. - * - * <p> - * For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00", - * "0.50", "1.00", and "1.50". - * - * <p> - * Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment. - * - * @param minFrac The minimum number of digits after the decimal separator. - * @return A precision for chaining or passing to the NumberFormatter precision() setter. - * @stable ICU 60 - */ - Precision withMinFraction(int32_t minFrac) const; - - private: - // Inherit constructor - using Precision::Precision; - - // To allow parent class to call this class's constructor: - friend class Precision; -}; - -/** - * A class that defines the strategy for padding and truncating integers before the decimal separator. - * - * <p> - * To create an IntegerWidth, use one of the factory methods. - * - * @stable ICU 60 - * @see NumberFormatter - */ -class U_I18N_API IntegerWidth : public UMemory { - public: - /** - * Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator. - * - * <p> - * For example, with minInt=3, the number 55 will get printed as "055". - * - * @param minInt - * The minimum number of places before the decimal separator. - * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter. - * @stable ICU 60 - */ - static IntegerWidth zeroFillTo(int32_t minInt); - - /** - * Truncate numbers exceeding a certain number of numerals before the decimal separator. - * - * For example, with maxInt=3, the number 1234 will get printed as "234". - * - * @param maxInt - * The maximum number of places before the decimal separator. maxInt == -1 means no - * truncation. - * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter. - * @stable ICU 60 - */ - IntegerWidth truncateAt(int32_t maxInt); - - private: - union { - struct { - impl::digits_t fMinInt; - impl::digits_t fMaxInt; - bool fFormatFailIfMoreThanMaxDigits; - } minMaxInt; - UErrorCode errorCode; - } fUnion; - bool fHasError = false; - - IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits); - - IntegerWidth(UErrorCode errorCode) { // NOLINT - fUnion.errorCode = errorCode; - fHasError = true; - } - - IntegerWidth() { // NOLINT - fUnion.minMaxInt.fMinInt = -1; - } - - /** Returns the default instance. */ - static IntegerWidth standard() { - return IntegerWidth::zeroFillTo(1); - } - - bool isBogus() const { - return !fHasError && fUnion.minMaxInt.fMinInt == -1; - } - - UBool copyErrorTo(UErrorCode &status) const { - if (fHasError) { - status = fUnion.errorCode; - return TRUE; - } - return FALSE; - } - - void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const; - - bool operator==(const IntegerWidth& other) const; - - // To allow MacroProps/MicroProps to initialize empty instances: - friend struct impl::MacroProps; - friend struct impl::MicroProps; - - // To allow NumberFormatterImpl to access isBogus(): - friend class impl::NumberFormatterImpl; - - // To allow the use of this class when formatting: - friend class impl::MutablePatternModifier; - friend class impl::ImmutablePatternModifier; - - // So that NumberPropertyMapper can create instances - friend class impl::NumberPropertyMapper; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; -}; - -/** - * A class that defines a quantity by which a number should be multiplied when formatting. - * - * <p> - * To create a Scale, use one of the factory methods. - * - * @stable ICU 62 - */ -class U_I18N_API Scale : public UMemory { - public: - /** - * Do not change the value of numbers when formatting or parsing. - * - * @return A Scale to prevent any multiplication. - * @stable ICU 62 - */ - static Scale none(); - - /** - * Multiply numbers by a power of ten before formatting. Useful for combining with a percent unit: - * - * <pre> - * NumberFormatter::with().unit(NoUnit::percent()).multiplier(Scale::powerOfTen(2)) - * </pre> - * - * @return A Scale for passing to the setter in NumberFormatter. - * @stable ICU 62 - */ - static Scale powerOfTen(int32_t power); - - /** - * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions. - * - * This method takes a string in a decimal number format with syntax - * as defined in the Decimal Arithmetic Specification, available at - * http://speleotrove.com/decimal - * - * Also see the version of this method that takes a double. - * - * @return A Scale for passing to the setter in NumberFormatter. - * @stable ICU 62 - */ - static Scale byDecimal(StringPiece multiplicand); - - /** - * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions. - * - * This method takes a double; also see the version of this method that takes an exact decimal. - * - * @return A Scale for passing to the setter in NumberFormatter. - * @stable ICU 62 - */ - static Scale byDouble(double multiplicand); - - /** - * Multiply a number by both a power of ten and by an arbitrary double value. - * - * @return A Scale for passing to the setter in NumberFormatter. - * @stable ICU 62 - */ - static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power); - - // We need a custom destructor for the DecNum, which means we need to declare - // the copy/move constructor/assignment quartet. - - /** @stable ICU 62 */ - Scale(const Scale& other); - - /** @stable ICU 62 */ - Scale& operator=(const Scale& other); - - /** @stable ICU 62 */ - Scale(Scale&& src) U_NOEXCEPT; - - /** @stable ICU 62 */ - Scale& operator=(Scale&& src) U_NOEXCEPT; - - /** @stable ICU 62 */ - ~Scale(); - -#ifndef U_HIDE_INTERNAL_API - /** @internal */ - Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt); -#endif /* U_HIDE_INTERNAL_API */ - - private: - int32_t fMagnitude; - impl::DecNum* fArbitrary; - UErrorCode fError; - - Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {} - - Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {} - - bool isValid() const { - return fMagnitude != 0 || fArbitrary != nullptr; - } - - UBool copyErrorTo(UErrorCode &status) const { - if (fError != U_ZERO_ERROR) { - status = fError; - return TRUE; - } - return FALSE; - } - - void applyTo(impl::DecimalQuantity& quantity) const; - - void applyReciprocalTo(impl::DecimalQuantity& quantity) const; - - // To allow MacroProps/MicroProps to initialize empty instances: - friend struct impl::MacroProps; - friend struct impl::MicroProps; - - // To allow NumberFormatterImpl to access isBogus() and perform other operations: - friend class impl::NumberFormatterImpl; - - // To allow the helper class MultiplierFormatHandler access to private fields: - friend class impl::MultiplierFormatHandler; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; - - // To allow access to parsing code: - friend class ::icu::numparse::impl::NumberParserImpl; - friend class ::icu::numparse::impl::MultiplierParseHandler; -}; - -namespace impl { - -// Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field -/** @internal */ -class U_I18N_API SymbolsWrapper : public UMemory { - public: - /** @internal */ - SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {} - - /** @internal */ - SymbolsWrapper(const SymbolsWrapper &other); - - /** @internal */ - SymbolsWrapper &operator=(const SymbolsWrapper &other); - - /** @internal */ - SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT; - - /** @internal */ - SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT; - - /** @internal */ - ~SymbolsWrapper(); - -#ifndef U_HIDE_INTERNAL_API - - /** - * The provided object is copied, but we do not adopt it. - * @internal - */ - void setTo(const DecimalFormatSymbols &dfs); - - /** - * Adopt the provided object. - * @internal - */ - void setTo(const NumberingSystem *ns); - - /** - * Whether the object is currently holding a DecimalFormatSymbols. - * @internal - */ - bool isDecimalFormatSymbols() const; - - /** - * Whether the object is currently holding a NumberingSystem. - * @internal - */ - bool isNumberingSystem() const; - - /** - * Get the DecimalFormatSymbols pointer. No ownership change. - * @internal - */ - const DecimalFormatSymbols *getDecimalFormatSymbols() const; - - /** - * Get the NumberingSystem pointer. No ownership change. - * @internal - */ - const NumberingSystem *getNumberingSystem() const; - -#endif // U_HIDE_INTERNAL_API - - /** @internal */ - UBool copyErrorTo(UErrorCode &status) const { - if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return TRUE; - } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) { - status = U_MEMORY_ALLOCATION_ERROR; - return TRUE; - } - return FALSE; - } - - private: - enum SymbolsPointerType { - SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS - } fType; - - union { - const DecimalFormatSymbols *dfs; - const NumberingSystem *ns; - } fPtr; - - void doCopyFrom(const SymbolsWrapper &other); - - void doMoveFrom(SymbolsWrapper&& src); - - void doCleanup(); -}; - -// Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field -/** @internal */ -class U_I18N_API Grouper : public UMemory { - public: -#ifndef U_HIDE_INTERNAL_API - /** @internal */ - static Grouper forStrategy(UNumberGroupingStrategy grouping); - - /** - * Resolve the values in Properties to a Grouper object. - * @internal - */ - static Grouper forProperties(const DecimalFormatProperties& properties); - - // Future: static Grouper forProperties(DecimalFormatProperties& properties); - - /** @internal */ - Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy) - : fGrouping1(grouping1), - fGrouping2(grouping2), - fMinGrouping(minGrouping), - fStrategy(strategy) {} -#endif // U_HIDE_INTERNAL_API - - /** @internal */ - int16_t getPrimary() const; - - /** @internal */ - int16_t getSecondary() const; - - private: - /** - * The grouping sizes, with the following special values: - * <ul> - * <li>-1 = no grouping - * <li>-2 = needs locale data - * <li>-4 = fall back to Western grouping if not in locale - * </ul> - */ - int16_t fGrouping1; - int16_t fGrouping2; - - /** - * The minimum grouping size, with the following special values: - * <ul> - * <li>-2 = needs locale data - * <li>-3 = no less than 2 - * </ul> - */ - int16_t fMinGrouping; - - /** - * The UNumberGroupingStrategy that was used to create this Grouper, or UNUM_GROUPING_COUNT if this - * was not created from a UNumberGroupingStrategy. - */ - UNumberGroupingStrategy fStrategy; - - Grouper() : fGrouping1(-3) {} - - bool isBogus() const { - return fGrouping1 == -3; - } - - /** NON-CONST: mutates the current instance. */ - void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale); - - bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const; - - // To allow MacroProps/MicroProps to initialize empty instances: - friend struct MacroProps; - friend struct MicroProps; - - // To allow NumberFormatterImpl to access isBogus() and perform other operations: - friend class NumberFormatterImpl; - - // To allow NumberParserImpl to perform setLocaleData(): - friend class ::icu::numparse::impl::NumberParserImpl; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; -}; - -// Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field -/** @internal */ -class U_I18N_API Padder : public UMemory { - public: -#ifndef U_HIDE_INTERNAL_API - /** @internal */ - static Padder none(); - - /** @internal */ - static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position); -#endif // U_HIDE_INTERNAL_API - - /** @internal */ - static Padder forProperties(const DecimalFormatProperties& properties); - - private: - UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding - union { - struct { - int32_t fCp; - UNumberFormatPadPosition fPosition; - } padding; - UErrorCode errorCode; - } fUnion; - - Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position); - - Padder(int32_t width); - - Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT - fUnion.errorCode = errorCode; - } - - Padder() : fWidth(-2) {} // NOLINT - - bool isBogus() const { - return fWidth == -2; - } - - UBool copyErrorTo(UErrorCode &status) const { - if (fWidth == -3) { - status = fUnion.errorCode; - return TRUE; - } - return FALSE; - } - - bool isValid() const { - return fWidth > 0; - } - - int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2, - FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex, - UErrorCode &status) const; - - // To allow MacroProps/MicroProps to initialize empty instances: - friend struct MacroProps; - friend struct MicroProps; - - // To allow NumberFormatterImpl to access isBogus() and perform other operations: - friend class impl::NumberFormatterImpl; - - // To allow access to the skeleton generation code: - friend class impl::GeneratorHelpers; -}; - -// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field -/** @internal */ -struct U_I18N_API MacroProps : public UMemory { - /** @internal */ - Notation notation; - - /** @internal */ - MeasureUnit unit; // = NoUnit::base(); - - /** @internal */ - MeasureUnit perUnit; // = NoUnit::base(); - - /** @internal */ - Precision precision; // = Precision(); (bogus) - - /** @internal */ - UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN; - - /** @internal */ - Grouper grouper; // = Grouper(); (bogus) - - /** @internal */ - Padder padder; // = Padder(); (bogus) - - /** @internal */ - IntegerWidth integerWidth; // = IntegerWidth(); (bogus) - - /** @internal */ - SymbolsWrapper symbols; - - // UNUM_XYZ_COUNT denotes null (bogus) values. - - /** @internal */ - UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT; - - /** @internal */ - UNumberSignDisplay sign = UNUM_SIGN_COUNT; - - /** @internal */ - UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT; - - /** @internal */ - Scale scale; // = Scale(); (benign value) - - /** @internal */ - const AffixPatternProvider* affixProvider = nullptr; // no ownership - - /** @internal */ - const PluralRules* rules = nullptr; // no ownership - - /** @internal */ - int32_t threshold = kInternalDefaultThreshold; - - /** @internal */ - Locale locale; - - // NOTE: Uses default copy and move constructors. - - /** - * Check all members for errors. - * @internal - */ - bool copyErrorTo(UErrorCode &status) const { - return notation.copyErrorTo(status) || precision.copyErrorTo(status) || - padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) || - symbols.copyErrorTo(status) || scale.copyErrorTo(status); - } -}; - -} // namespace impl - -#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) -// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method -// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation -// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is -// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes, -// they will all be passed to the linker, and the linker will still find and export all the class members. -#pragma warning(push) -#pragma warning(disable: 4661) -#endif - -/** - * An abstract base class for specifying settings related to number formatting. This class is implemented by - * {@link UnlocalizedNumberFormatter} and {@link LocalizedNumberFormatter}. This class is not intended for - * public subclassing. - */ -template<typename Derived> -class U_I18N_API NumberFormatterSettings { - public: - /** - * Specifies the notation style (simple, scientific, or compact) for rendering numbers. - * - * <ul> - * <li>Simple notation: "12,300" - * <li>Scientific notation: "1.23E4" - * <li>Compact notation: "12K" - * </ul> - * - * <p> - * All notation styles will be properly localized with locale data, and all notation styles are compatible with - * units, rounding precisions, and other number formatter settings. - * - * <p> - * Pass this method the return value of a {@link Notation} factory method. For example: - * - * <pre> - * NumberFormatter::with().notation(Notation::compactShort()) - * </pre> - * - * The default is to use simple notation. - * - * @param notation - * The notation strategy to use. - * @return The fluent chain. - * @see Notation - * @stable ICU 60 - */ - Derived notation(const Notation ¬ation) const &; - - /** - * Overload of notation() for use on an rvalue reference. - * - * @param notation - * The notation strategy to use. - * @return The fluent chain. - * @see #notation - * @stable ICU 62 - */ - Derived notation(const Notation ¬ation) &&; - - /** - * Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers. - * - * <ul> - * <li>Unit of measure: "12.3 meters" - * <li>Currency: "$12.30" - * <li>Percent: "12.3%" - * </ul> - * - * All units will be properly localized with locale data, and all units are compatible with notation styles, - * rounding precisions, and other number formatter settings. - * - * Pass this method any instance of {@link MeasureUnit}. For units of measure: - * - * <pre> - * NumberFormatter::with().unit(MeasureUnit::getMeter()) - * </pre> - * - * Currency: - * - * <pre> - * NumberFormatter::with().unit(CurrencyUnit(u"USD", status)) - * </pre> - * - * Percent: - * - * <pre> - * NumberFormatter::with().unit(NoUnit.percent()) - * </pre> - * - * See {@link #perUnit} for information on how to format strings like "5 meters per second". - * - * The default is to render without units (equivalent to NoUnit.base()). - * - * @param unit - * The unit to render. - * @return The fluent chain. - * @see MeasureUnit - * @see Currency - * @see NoUnit - * @see #perUnit - * @stable ICU 60 - */ - Derived unit(const icu::MeasureUnit &unit) const &; - - /** - * Overload of unit() for use on an rvalue reference. - * - * @param unit - * The unit to render. - * @return The fluent chain. - * @see #unit - * @stable ICU 62 - */ - Derived unit(const icu::MeasureUnit &unit) &&; - - /** - * Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory - * methods that return pointers that need ownership. - * - * Note: consider using the MeasureFormat factory methods that return by value. - * - * @param unit - * The unit to render. - * @return The fluent chain. - * @see #unit - * @see MeasureUnit - * @stable ICU 60 - */ - Derived adoptUnit(icu::MeasureUnit *unit) const &; - - /** - * Overload of adoptUnit() for use on an rvalue reference. - * - * @param unit - * The unit to render. - * @return The fluent chain. - * @see #adoptUnit - * @stable ICU 62 - */ - Derived adoptUnit(icu::MeasureUnit *unit) &&; - - /** - * Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to - * the perUnit. - * - * Pass this method any instance of {@link MeasureUnit}. Example: - * - * <pre> - * NumberFormatter::with() - * .unit(MeasureUnit::getMeter()) - * .perUnit(MeasureUnit::getSecond()) - * </pre> - * - * The default is not to display any unit in the denominator. - * - * If a per-unit is specified without a primary unit via {@link #unit}, the behavior is undefined. - * - * @param perUnit - * The unit to render in the denominator. - * @return The fluent chain - * @see #unit - * @stable ICU 61 - */ - Derived perUnit(const icu::MeasureUnit &perUnit) const &; - - /** - * Overload of perUnit() for use on an rvalue reference. - * - * @param perUnit - * The unit to render in the denominator. - * @return The fluent chain. - * @see #perUnit - * @stable ICU 62 - */ - Derived perUnit(const icu::MeasureUnit &perUnit) &&; - - /** - * Like perUnit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory - * methods that return pointers that need ownership. - * - * Note: consider using the MeasureFormat factory methods that return by value. - * - * @param perUnit - * The unit to render in the denominator. - * @return The fluent chain. - * @see #perUnit - * @see MeasureUnit - * @stable ICU 61 - */ - Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &; - - /** - * Overload of adoptPerUnit() for use on an rvalue reference. - * - * @param perUnit - * The unit to render in the denominator. - * @return The fluent chain. - * @see #adoptPerUnit - * @stable ICU 62 - */ - Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&; - - /** - * Specifies the rounding precision to use when formatting numbers. - * - * <ul> - * <li>Round to 3 decimal places: "3.142" - * <li>Round to 3 significant figures: "3.14" - * <li>Round to the closest nickel: "3.15" - * <li>Do not perform rounding: "3.1415926..." - * </ul> - * - * <p> - * Pass this method the return value of one of the factory methods on {@link Precision}. For example: - * - * <pre> - * NumberFormatter::with().precision(Precision::fixedFraction(2)) - * </pre> - * - * <p> - * In most cases, the default rounding strategy is to round to 6 fraction places; i.e., - * <code>Precision.maxFraction(6)</code>. The exceptions are if compact notation is being used, then the compact - * notation rounding strategy is used (see {@link Notation#compactShort} for details), or if the unit is a currency, - * then standard currency rounding is used, which varies from currency to currency (see {@link Precision#currency} for - * details). - * - * @param precision - * The rounding precision to use. - * @return The fluent chain. - * @see Precision - * @stable ICU 62 - */ - Derived precision(const Precision& precision) const &; - - /** - * Overload of precision() for use on an rvalue reference. - * - * @param precision - * The rounding precision to use. - * @return The fluent chain. - * @see #precision - * @stable ICU 62 - */ - Derived precision(const Precision& precision) &&; - - /** - * Specifies how to determine the direction to round a number when it has more digits than fit in the - * desired precision. When formatting 1.235: - * - * <ul> - * <li>Ceiling rounding mode with integer precision: "2" - * <li>Half-down rounding mode with 2 fixed fraction digits: "1.23" - * <li>Half-up rounding mode with 2 fixed fraction digits: "1.24" - * </ul> - * - * The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here: - * - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes - * - * @param roundingMode The rounding mode to use. - * @return The fluent chain. - * @stable ICU 62 - */ - Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &; - - /** - * Overload of roundingMode() for use on an rvalue reference. - * - * @param roundingMode The rounding mode to use. - * @return The fluent chain. - * @see #roundingMode - * @stable ICU 62 - */ - Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&; - - /** - * Specifies the grouping strategy to use when formatting numbers. - * - * <ul> - * <li>Default grouping: "12,300" and "1,230" - * <li>Grouping with at least 2 digits: "12,300" and "1230" - * <li>No grouping: "12300" and "1230" - * </ul> - * - * <p> - * The exact grouping widths will be chosen based on the locale. - * - * <p> - * Pass this method an element from the {@link UNumberGroupingStrategy} enum. For example: - * - * <pre> - * NumberFormatter::with().grouping(UNUM_GROUPING_MIN2) - * </pre> - * - * The default is to perform grouping according to locale data; most locales, but not all locales, - * enable it by default. - * - * @param strategy - * The grouping strategy to use. - * @return The fluent chain. - * @stable ICU 61 - */ - Derived grouping(UNumberGroupingStrategy strategy) const &; - - /** - * Overload of grouping() for use on an rvalue reference. - * - * @param strategy - * The grouping strategy to use. - * @return The fluent chain. - * @see #grouping - * @stable ICU 62 - */ - Derived grouping(UNumberGroupingStrategy strategy) &&; - - /** - * Specifies the minimum and maximum number of digits to render before the decimal mark. - * - * <ul> - * <li>Zero minimum integer digits: ".08" - * <li>One minimum integer digit: "0.08" - * <li>Two minimum integer digits: "00.08" - * </ul> - * - * <p> - * Pass this method the return value of {@link IntegerWidth#zeroFillTo}. For example: - * - * <pre> - * NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(2)) - * </pre> - * - * The default is to have one minimum integer digit. - * - * @param style - * The integer width to use. - * @return The fluent chain. - * @see IntegerWidth - * @stable ICU 60 - */ - Derived integerWidth(const IntegerWidth &style) const &; - - /** - * Overload of integerWidth() for use on an rvalue reference. - * - * @param style - * The integer width to use. - * @return The fluent chain. - * @see #integerWidth - * @stable ICU 62 - */ - Derived integerWidth(const IntegerWidth &style) &&; - - /** - * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering - * numbers. - * - * <ul> - * <li><em>en_US</em> symbols: "12,345.67" - * <li><em>fr_FR</em> symbols: "12 345,67" - * <li><em>de_CH</em> symbols: "12’345.67" - * <li><em>my_MY</em> symbols: "၁၂,၃၄၅.၆၇" - * </ul> - * - * <p> - * Pass this method an instance of {@link DecimalFormatSymbols}. For example: - * - * <pre> - * NumberFormatter::with().symbols(DecimalFormatSymbols(Locale("de_CH"), status)) - * </pre> - * - * <p> - * <strong>Note:</strong> DecimalFormatSymbols automatically chooses the best numbering system based on the locale. - * In the examples above, the first three are using the Latin numbering system, and the fourth is using the Myanmar - * numbering system. - * - * <p> - * <strong>Note:</strong> The instance of DecimalFormatSymbols will be copied: changes made to the symbols object - * after passing it into the fluent chain will not be seen. - * - * <p> - * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols - * or NumberingSystem. - * - * <p> - * The default is to choose the symbols based on the locale specified in the fluent chain. - * - * @param symbols - * The DecimalFormatSymbols to use. - * @return The fluent chain. - * @see DecimalFormatSymbols - * @stable ICU 60 - */ - Derived symbols(const DecimalFormatSymbols &symbols) const &; - - /** - * Overload of symbols() for use on an rvalue reference. - * - * @param symbols - * The DecimalFormatSymbols to use. - * @return The fluent chain. - * @see #symbols - * @stable ICU 62 - */ - Derived symbols(const DecimalFormatSymbols &symbols) &&; - - /** - * Specifies that the given numbering system should be used when fetching symbols. - * - * <ul> - * <li>Latin numbering system: "12,345" - * <li>Myanmar numbering system: "၁၂,၃၄၅" - * <li>Math Sans Bold numbering system: "𝟭𝟮,𝟯𝟰𝟱" - * </ul> - * - * <p> - * Pass this method an instance of {@link NumberingSystem}. For example, to force the locale to always use the Latin - * alphabet numbering system (ASCII digits): - * - * <pre> - * NumberFormatter::with().adoptSymbols(NumberingSystem::createInstanceByName("latn", status)) - * </pre> - * - * <p> - * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols - * or NumberingSystem. - * - * <p> - * The default is to choose the best numbering system for the locale. - * - * <p> - * This method takes ownership of a pointer in order to work nicely with the NumberingSystem factory methods. - * - * @param symbols - * The NumberingSystem to use. - * @return The fluent chain. - * @see NumberingSystem - * @stable ICU 60 - */ - Derived adoptSymbols(NumberingSystem *symbols) const &; - - /** - * Overload of adoptSymbols() for use on an rvalue reference. - * - * @param symbols - * The NumberingSystem to use. - * @return The fluent chain. - * @see #adoptSymbols - * @stable ICU 62 - */ - Derived adoptSymbols(NumberingSystem *symbols) &&; - - /** - * Sets the width of the unit (measure unit or currency). Most common values: - * - * <ul> - * <li>Short: "$12.00", "12 m" - * <li>ISO Code: "USD 12.00" - * <li>Full name: "12.00 US dollars", "12 meters" - * </ul> - * - * <p> - * Pass an element from the {@link UNumberUnitWidth} enum to this setter. For example: - * - * <pre> - * NumberFormatter::with().unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME) - * </pre> - * - * <p> - * The default is the SHORT width. - * - * @param width - * The width to use when rendering numbers. - * @return The fluent chain - * @see UNumberUnitWidth - * @stable ICU 60 - */ - Derived unitWidth(UNumberUnitWidth width) const &; - - /** - * Overload of unitWidth() for use on an rvalue reference. - * - * @param width - * The width to use when rendering numbers. - * @return The fluent chain. - * @see #unitWidth - * @stable ICU 62 - */ - Derived unitWidth(UNumberUnitWidth width) &&; - - /** - * Sets the plus/minus sign display strategy. Most common values: - * - * <ul> - * <li>Auto: "123", "-123" - * <li>Always: "+123", "-123" - * <li>Accounting: "$123", "($123)" - * </ul> - * - * <p> - * Pass an element from the {@link UNumberSignDisplay} enum to this setter. For example: - * - * <pre> - * NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS) - * </pre> - * - * <p> - * The default is AUTO sign display. - * - * @param style - * The sign display strategy to use when rendering numbers. - * @return The fluent chain - * @see UNumberSignDisplay - * @stable ICU 60 - */ - Derived sign(UNumberSignDisplay style) const &; - - /** - * Overload of sign() for use on an rvalue reference. - * - * @param style - * The sign display strategy to use when rendering numbers. - * @return The fluent chain. - * @see #sign - * @stable ICU 62 - */ - Derived sign(UNumberSignDisplay style) &&; - - /** - * Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common - * values: - * - * <ul> - * <li>Auto: "1" - * <li>Always: "1." - * </ul> - * - * <p> - * Pass an element from the {@link UNumberDecimalSeparatorDisplay} enum to this setter. For example: - * - * <pre> - * NumberFormatter::with().decimal(UNumberDecimalSeparatorDisplay::UNUM_DECIMAL_SEPARATOR_ALWAYS) - * </pre> - * - * <p> - * The default is AUTO decimal separator display. - * - * @param style - * The decimal separator display strategy to use when rendering numbers. - * @return The fluent chain - * @see UNumberDecimalSeparatorDisplay - * @stable ICU 60 - */ - Derived decimal(UNumberDecimalSeparatorDisplay style) const &; - - /** - * Overload of decimal() for use on an rvalue reference. - * - * @param style - * The decimal separator display strategy to use when rendering numbers. - * @return The fluent chain. - * @see #decimal - * @stable ICU 62 - */ - Derived decimal(UNumberDecimalSeparatorDisplay style) &&; - - /** - * Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting. - * Most common values: - * - * <ul> - * <li>Multiply by 100: useful for percentages. - * <li>Multiply by an arbitrary value: useful for unit conversions. - * </ul> - * - * <p> - * Pass an element from a {@link Scale} factory method to this setter. For example: - * - * <pre> - * NumberFormatter::with().scale(Scale::powerOfTen(2)) - * </pre> - * - * <p> - * The default is to not apply any multiplier. - * - * @param scale - * The scale to apply when rendering numbers. - * @return The fluent chain - * @stable ICU 62 - */ - Derived scale(const Scale &scale) const &; - - /** - * Overload of scale() for use on an rvalue reference. - * - * @param scale - * The scale to apply when rendering numbers. - * @return The fluent chain. - * @see #scale - * @stable ICU 62 - */ - Derived scale(const Scale &scale) &&; - -#ifndef U_HIDE_INTERNAL_API - - /** - * Set the padding strategy. May be added in the future; see #13338. - * - * @internal ICU 60: This API is ICU internal only. - */ - Derived padding(const impl::Padder &padder) const &; - - /** @internal */ - Derived padding(const impl::Padder &padder) &&; - - /** - * Internal fluent setter to support a custom regulation threshold. A threshold of 1 causes the data structures to - * be built right away. A threshold of 0 prevents the data structures from being built. - * - * @internal ICU 60: This API is ICU internal only. - */ - Derived threshold(int32_t threshold) const &; - - /** @internal */ - Derived threshold(int32_t threshold) &&; - - /** - * Internal fluent setter to overwrite the entire macros object. - * - * @internal ICU 60: This API is ICU internal only. - */ - Derived macros(const impl::MacroProps& macros) const &; - - /** @internal */ - Derived macros(const impl::MacroProps& macros) &&; - - /** @internal */ - Derived macros(impl::MacroProps&& macros) const &; - - /** @internal */ - Derived macros(impl::MacroProps&& macros) &&; - -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Creates a skeleton string representation of this number formatter. A skeleton string is a - * locale-agnostic serialized form of a number formatter. - * - * Not all options are capable of being represented in the skeleton string; for example, a - * DecimalFormatSymbols object. If any such option is encountered, the error code is set to - * U_UNSUPPORTED_ERROR. - * - * The returned skeleton is in normalized form, such that two number formatters with equivalent - * behavior should produce the same skeleton. - * - * @return A number skeleton string with behavior corresponding to this number formatter. - * @stable ICU 62 - */ - UnicodeString toSkeleton(UErrorCode& status) const; - - /** - * Returns the current (Un)LocalizedNumberFormatter as a LocalPointer - * wrapping a heap-allocated copy of the current object. - * - * This is equivalent to new-ing the move constructor with a value object - * as the argument. - * - * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped - * nullptr on failure. - * @stable ICU 64 - */ - LocalPointer<Derived> clone() const &; - - /** - * Overload of clone for use on an rvalue reference. - * - * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped - * nullptr on failure. - * @stable ICU 64 - */ - LocalPointer<Derived> clone() &&; - - /** - * Sets the UErrorCode if an error occurred in the fluent chain. - * Preserves older error codes in the outErrorCode. - * @return TRUE if U_FAILURE(outErrorCode) - * @stable ICU 60 - */ - UBool copyErrorTo(UErrorCode &outErrorCode) const { - if (U_FAILURE(outErrorCode)) { - // Do not overwrite the older error code - return TRUE; - } - fMacros.copyErrorTo(outErrorCode); - return U_FAILURE(outErrorCode); - } - - // NOTE: Uses default copy and move constructors. - - private: - impl::MacroProps fMacros; - - // Don't construct me directly! Use (Un)LocalizedNumberFormatter. - NumberFormatterSettings() = default; - - friend class LocalizedNumberFormatter; - friend class UnlocalizedNumberFormatter; - - // Give NumberRangeFormatter access to the MacroProps - friend void impl::touchRangeLocales(impl::RangeMacroProps& macros); - friend class impl::NumberRangeFormatterImpl; -}; - -/** - * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified. - * - * Instances of this class are immutable and thread-safe. - * - * @see NumberFormatter - * @stable ICU 60 - */ -class U_I18N_API UnlocalizedNumberFormatter - : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory { - - public: - /** - * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols, - * formats, and other data for number display. - * - * @param locale - * The locale to use when loading data for number formatting. - * @return The fluent chain. - * @stable ICU 60 - */ - LocalizedNumberFormatter locale(const icu::Locale &locale) const &; - - /** - * Overload of locale() for use on an rvalue reference. - * - * @param locale - * The locale to use when loading data for number formatting. - * @return The fluent chain. - * @see #locale - * @stable ICU 62 - */ - LocalizedNumberFormatter locale(const icu::Locale &locale) &&; - - /** - * Default constructor: puts the formatter into a valid but undefined state. - * - * @stable ICU 62 - */ - UnlocalizedNumberFormatter() = default; - - /** - * Returns a copy of this UnlocalizedNumberFormatter. - * @stable ICU 60 - */ - UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other); - - /** - * Move constructor: - * The source UnlocalizedNumberFormatter will be left in a valid but undefined state. - * @stable ICU 62 - */ - UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT; - - /** - * Copy assignment operator. - * @stable ICU 62 - */ - UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other); - - /** - * Move assignment operator: - * The source UnlocalizedNumberFormatter will be left in a valid but undefined state. - * @stable ICU 62 - */ - UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT; - - private: - explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other); - - explicit UnlocalizedNumberFormatter( - NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT; - - // To give the fluent setters access to this class's constructor: - friend class NumberFormatterSettings<UnlocalizedNumberFormatter>; - - // To give NumberFormatter::with() access to this class's constructor: - friend class NumberFormatter; -}; - -/** - * A NumberFormatter that has a locale associated with it; this means .format() methods are available. - * - * Instances of this class are immutable and thread-safe. - * - * @see NumberFormatter - * @stable ICU 60 - */ -class U_I18N_API LocalizedNumberFormatter - : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory { - public: - /** - * Format the given integer number to a string using the settings specified in the NumberFormatter fluent - * setting chain. - * - * @param value - * The number to format. - * @param status - * Set to an ErrorCode if one occurred in the setter chain or during formatting. - * @return A FormattedNumber object; call .toString() to get the string. - * @stable ICU 60 - */ - FormattedNumber formatInt(int64_t value, UErrorCode &status) const; - - /** - * Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting - * chain. - * - * @param value - * The number to format. - * @param status - * Set to an ErrorCode if one occurred in the setter chain or during formatting. - * @return A FormattedNumber object; call .toString() to get the string. - * @stable ICU 60 - */ - FormattedNumber formatDouble(double value, UErrorCode &status) const; - - /** - * Format the given decimal number to a string using the settings - * specified in the NumberFormatter fluent setting chain. - * The syntax of the unformatted number is a "numeric string" - * as defined in the Decimal Arithmetic Specification, available at - * http://speleotrove.com/decimal - * - * @param value - * The number to format. - * @param status - * Set to an ErrorCode if one occurred in the setter chain or during formatting. - * @return A FormattedNumber object; call .toString() to get the string. - * @stable ICU 60 - */ - FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const; - -#ifndef U_HIDE_INTERNAL_API - - /** Internal method. - * @internal - */ - FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const; - - /** Internal method for DecimalFormat compatibility. - * @internal - */ - void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const; - - /** - * Internal method for testing. - * @internal - */ - const impl::NumberFormatterImpl* getCompiled() const; - - /** - * Internal method for testing. - * @internal - */ - int32_t getCallCount() const; - -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use - * of this number formatter with APIs that need an object of that type, such as MessageFormat. - * - * This API is not intended to be used other than for enabling API compatibility. The formatDouble, - * formatInt, and formatDecimal methods should normally be used when formatting numbers, not the Format - * object returned by this method. - * - * The caller owns the returned object and must delete it when finished. - * - * @return A Format wrapping this LocalizedNumberFormatter. - * @stable ICU 62 - */ - Format* toFormat(UErrorCode& status) const; - - /** - * Default constructor: puts the formatter into a valid but undefined state. - * - * @stable ICU 62 - */ - LocalizedNumberFormatter() = default; - - /** - * Returns a copy of this LocalizedNumberFormatter. - * @stable ICU 60 - */ - LocalizedNumberFormatter(const LocalizedNumberFormatter &other); - - /** - * Move constructor: - * The source LocalizedNumberFormatter will be left in a valid but undefined state. - * @stable ICU 62 - */ - LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT; - - /** - * Copy assignment operator. - * @stable ICU 62 - */ - LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other); - - /** - * Move assignment operator: - * The source LocalizedNumberFormatter will be left in a valid but undefined state. - * @stable ICU 62 - */ - LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT; - -#ifndef U_HIDE_INTERNAL_API - - /** - * This is the core entrypoint to the number formatting pipeline. It performs self-regulation: a static code path - * for the first few calls, and compiling a more efficient data structure if called repeatedly. - * - * <p> - * This function is very hot, being called in every call to the number formatting pipeline. - * - * @param results - * The results object. This method will mutate it to save the results. - * @param status - * @internal - */ - void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const; - -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Destruct this LocalizedNumberFormatter, cleaning up any memory it might own. - * @stable ICU 60 - */ - ~LocalizedNumberFormatter(); - - private: - // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal - // header, and LocalPointer needs the full class definition in order to delete the instance. - const impl::NumberFormatterImpl* fCompiled {nullptr}; - char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t - - explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other); - - explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT; - - LocalizedNumberFormatter(const impl::MacroProps ¯os, const Locale &locale); - - LocalizedNumberFormatter(impl::MacroProps &¯os, const Locale &locale); - - void clear(); - - void lnfMoveHelper(LocalizedNumberFormatter&& src); - - /** - * @return true if the compiled formatter is available. - */ - bool computeCompiled(UErrorCode& status) const; - - // To give the fluent setters access to this class's constructor: - friend class NumberFormatterSettings<UnlocalizedNumberFormatter>; - friend class NumberFormatterSettings<LocalizedNumberFormatter>; - - // To give UnlocalizedNumberFormatter::locale() access to this class's constructor: - friend class UnlocalizedNumberFormatter; -}; - -#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) -// Warning 4661. -#pragma warning(pop) -#endif - -/** - * The result of a number formatting operation. This class allows the result to be exported in several data types, - * including a UnicodeString and a FieldPositionIterator. - * - * Instances of this class are immutable and thread-safe. - * - * @stable ICU 60 - */ -class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { - public: - - /** - * Default constructor; makes an empty FormattedNumber. - * @stable ICU 64 - */ - FormattedNumber() - : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} - - /** - * Move constructor: Leaves the source FormattedNumber in an undefined state. - * @stable ICU 62 - */ - FormattedNumber(FormattedNumber&& src) U_NOEXCEPT; - - /** - * Destruct an instance of FormattedNumber. - * @stable ICU 60 - */ - virtual ~FormattedNumber() U_OVERRIDE; - - /** Copying not supported; use move constructor instead. */ - FormattedNumber(const FormattedNumber&) = delete; - - /** Copying not supported; use move assignment instead. */ - FormattedNumber& operator=(const FormattedNumber&) = delete; - - /** - * Move assignment: Leaves the source FormattedNumber in an undefined state. - * @stable ICU 62 - */ - FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT; - - // Copybrief: this method is older than the parent method - /** - * @copybrief FormattedValue::toString() - * - * For more information, see FormattedValue::toString() - * - * @stable ICU 62 - */ - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - - // Copydoc: this method is new in ICU 64 - /** @copydoc FormattedValue::toTempString() */ - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - - // Copybrief: this method is older than the parent method - /** - * @copybrief FormattedValue::appendTo() - * - * For more information, see FormattedValue::appendTo() - * - * @stable ICU 62 - */ - Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - - // Copydoc: this method is new in ICU 64 - /** @copydoc FormattedValue::nextPosition() */ - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; - -#ifndef U_HIDE_DRAFT_API - /** - * Export the formatted number as a "numeric string" conforming to the - * syntax defined in the Decimal Arithmetic Specification, available at - * http://speleotrove.com/decimal - * - * This endpoint is useful for obtaining the exact number being printed - * after scaling and rounding have been applied by the number formatter. - * - * Example call site: - * - * auto decimalNumber = fn.toDecimalNumber<std::string>(status); - * - * @tparam StringClass A string class compatible with StringByteSink; - * for example, std::string. - * @param status Set if an error occurs. - * @return A StringClass containing the numeric string. - * @draft ICU 65 - */ - template<typename StringClass> - inline StringClass toDecimalNumber(UErrorCode& status) const; -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_INTERNAL_API - - /** - * Gets the raw DecimalQuantity for plural rule selection. - * @internal - */ - void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const; - - /** - * Populates the mutable builder type FieldPositionIteratorHandler. - * @internal - */ - void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; - -#endif /* U_HIDE_INTERNAL_API */ - - private: - // Can't use LocalPointer because UFormattedNumberData is forward-declared - const impl::UFormattedNumberData *fData; - - // Error code for the terminal methods - UErrorCode fErrorCode; - - /** - * Internal constructor from data type. Adopts the data pointer. - * @internal - */ - explicit FormattedNumber(impl::UFormattedNumberData *results) - : fData(results), fErrorCode(U_ZERO_ERROR) {} - - explicit FormattedNumber(UErrorCode errorCode) - : fData(nullptr), fErrorCode(errorCode) {} - - // TODO(ICU-20775): Propose this as API. - void toDecimalNumber(ByteSink& sink, UErrorCode& status) const; - - // To give LocalizedNumberFormatter format methods access to this class's constructor: - friend class LocalizedNumberFormatter; - - // To give C API access to internals - friend struct impl::UFormattedNumberImpl; -}; - -#ifndef U_HIDE_DRAFT_API -// Note: This is draft ICU 65 -template<typename StringClass> -StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const { - StringClass result; - StringByteSink<StringClass> sink(&result); - toDecimalNumber(sink, status); - return result; -} -#endif // U_HIDE_DRAFT_API - -/** - * See the main description in numberformatter.h for documentation and examples. - * - * @stable ICU 60 - */ -class U_I18N_API NumberFormatter final { - public: - /** - * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not currently known at - * the call site. - * - * @return An {@link UnlocalizedNumberFormatter}, to be used for chaining. - * @stable ICU 60 - */ - static UnlocalizedNumberFormatter with(); - - /** - * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at the call - * site. - * - * @param locale - * The locale from which to load formats and symbols for number formatting. - * @return A {@link LocalizedNumberFormatter}, to be used for chaining. - * @stable ICU 60 - */ - static LocalizedNumberFormatter withLocale(const Locale &locale); - - /** - * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based - * on a given number skeleton string. - * - * It is possible for an error to occur while parsing. See the overload of this method if you are - * interested in the location of a possible parse error. - * - * @param skeleton - * The skeleton string off of which to base this NumberFormatter. - * @param status - * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid. - * @return An UnlocalizedNumberFormatter, to be used for chaining. - * @stable ICU 62 - */ - static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status); - - /** - * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based - * on a given number skeleton string. - * - * If an error occurs while parsing the skeleton string, the offset into the skeleton string at - * which the error occurred will be saved into the UParseError, if provided. - * - * @param skeleton - * The skeleton string off of which to base this NumberFormatter. - * @param perror - * A parse error struct populated if an error occurs when parsing. - * If no error occurs, perror.offset will be set to -1. - * @param status - * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid. - * @return An UnlocalizedNumberFormatter, to be used for chaining. - * @stable ICU 64 - */ - static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, - UParseError& perror, UErrorCode& status); - - /** - * Use factory methods instead of the constructor to create a NumberFormatter. - */ - NumberFormatter() = delete; -}; - -} // namespace number -U_NAMESPACE_END - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __NUMBERFORMATTER_H__ - +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __NUMBERFORMATTER_H__ +#define __NUMBERFORMATTER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/appendable.h" +#include "unicode/bytestream.h" +#include "unicode/currunit.h" +#include "unicode/dcfmtsym.h" +#include "unicode/fieldpos.h" +#include "unicode/formattedvalue.h" +#include "unicode/fpositer.h" +#include "unicode/measunit.h" +#include "unicode/nounit.h" +#include "unicode/parseerr.h" +#include "unicode/plurrule.h" +#include "unicode/ucurr.h" +#include "unicode/unum.h" +#include "unicode/unumberformatter.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Library for localized number formatting introduced in ICU 60. + * + * This library was introduced in ICU 60 to simplify the process of formatting localized number strings. + * Basic usage examples: + * + * <pre> + * // Most basic usage: + * NumberFormatter::withLocale(...).format(123).toString(); // 1,234 in en-US + * + * // Custom notation, unit, and rounding precision: + * NumberFormatter::with() + * .notation(Notation::compactShort()) + * .unit(CurrencyUnit("EUR", status)) + * .precision(Precision::maxDigits(2)) + * .locale(...) + * .format(1234) + * .toString(); // €1.2K in en-US + * + * // Create a formatter in a singleton by value for use later: + * static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...) + * .unit(NoUnit::percent()) + * .precision(Precision::fixedFraction(3)); + * formatter.format(5.9831).toString(); // 5.983% in en-US + * + * // Create a "template" in a singleton unique_ptr but without setting a locale until the call site: + * std::unique_ptr<UnlocalizedNumberFormatter> template = NumberFormatter::with() + * .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS) + * .unit(MeasureUnit::getMeter()) + * .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME) + * .clone(); + * template->locale(...).format(1234).toString(); // +1,234 meters in en-US + * </pre> + * + * <p> + * This API offers more features than DecimalFormat and is geared toward new users of ICU. + * + * <p> + * NumberFormatter instances (i.e., LocalizedNumberFormatter and UnlocalizedNumberFormatter) + * are immutable and thread safe. This means that invoking a configuration method has no + * effect on the receiving instance; you must store and use the new number formatter instance it returns instead. + * + * <pre> + * UnlocalizedNumberFormatter formatter = UnlocalizedNumberFormatter::with().notation(Notation::scientific()); + * formatter.precision(Precision.maxFraction(2)); // does nothing! + * formatter.locale(Locale.getEnglish()).format(9.8765).toString(); // prints "9.8765E0", not "9.88E0" + * </pre> + * + * <p> + * This API is based on the <em>fluent</em> design pattern popularized by libraries such as Google's Guava. For + * extensive details on the design of this API, read <a href="https://goo.gl/szi5VB">the design doc</a>. + * + * @author Shane Carr + */ + +U_NAMESPACE_BEGIN + +// Forward declarations: +class IFixedDecimal; +class FieldPositionIteratorHandler; +class FormattedStringBuilder; + +namespace numparse { +namespace impl { + +// Forward declarations: +class NumberParserImpl; +class MultiplierParseHandler; + +} +} + +namespace number { // icu::number + +// Forward declarations: +class UnlocalizedNumberFormatter; +class LocalizedNumberFormatter; +class FormattedNumber; +class Notation; +class ScientificNotation; +class Precision; +class FractionPrecision; +class CurrencyPrecision; +class IncrementPrecision; +class IntegerWidth; + +namespace impl { + +// can't be #ifndef U_HIDE_INTERNAL_API; referenced throughout this file in public classes +/** + * Datatype for minimum/maximum fraction digits. Must be able to hold kMaxIntFracSig. + * + * @internal + */ +typedef int16_t digits_t; + +// can't be #ifndef U_HIDE_INTERNAL_API; needed for struct initialization +/** + * Use a default threshold of 3. This means that the third time .format() is called, the data structures get built + * using the "safe" code path. The first two calls to .format() will trigger the unsafe code path. + * + * @internal + */ +static constexpr int32_t kInternalDefaultThreshold = 3; + +// Forward declarations: +class Padder; +struct MacroProps; +struct MicroProps; +class DecimalQuantity; +class UFormattedNumberData; +class NumberFormatterImpl; +struct ParsedPatternInfo; +class ScientificModifier; +class MultiplierProducer; +class RoundingImpl; +class ScientificHandler; +class Modifier; +class AffixPatternProvider; +class NumberPropertyMapper; +struct DecimalFormatProperties; +class MultiplierFormatHandler; +class CurrencySymbols; +class GeneratorHelpers; +class DecNum; +class NumberRangeFormatterImpl; +struct RangeMacroProps; +struct UFormattedNumberImpl; +class MutablePatternModifier; +class ImmutablePatternModifier; + +/** + * Used for NumberRangeFormatter and implemented in numrange_fluent.cpp. + * Declared here so it can be friended. + * + * @internal + */ +void touchRangeLocales(impl::RangeMacroProps& macros); + +} // namespace impl + +/** + * Extra name reserved in case it is needed in the future. + * + * @stable ICU 63 + */ +typedef Notation CompactNotation; + +/** + * Extra name reserved in case it is needed in the future. + * + * @stable ICU 63 + */ +typedef Notation SimpleNotation; + +/** + * A class that defines the notation style to be used when formatting numbers in NumberFormatter. + * + * @stable ICU 60 + */ +class U_I18N_API Notation : public UMemory { + public: + /** + * Print the number using scientific notation (also known as scientific form, standard index form, or standard form + * in the UK). The format for scientific notation varies by locale; for example, many Western locales display the + * number in the form "#E0", where the number is displayed with one digit before the decimal separator, zero or more + * digits after the decimal separator, and the corresponding power of 10 displayed after the "E". + * + * <p> + * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3: + * + * <pre> + * 8.765E4 + * 8.765E3 + * 8.765E2 + * 8.765E1 + * 8.765E0 + * 8.765E-1 + * 8.765E-2 + * 8.765E-3 + * 0E0 + * </pre> + * + * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. + * @stable ICU 60 + */ + static ScientificNotation scientific(); + + /** + * Print the number using engineering notation, a variant of scientific notation in which the exponent must be + * divisible by 3. + * + * <p> + * Example outputs in <em>en-US</em> when printing 8.765E4 through 8.765E-3: + * + * <pre> + * 87.65E3 + * 8.765E3 + * 876.5E0 + * 87.65E0 + * 8.765E0 + * 876.5E-3 + * 87.65E-3 + * 8.765E-3 + * 0E0 + * </pre> + * + * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. + * @stable ICU 60 + */ + static ScientificNotation engineering(); + + /** + * Print the number using short-form compact notation. + * + * <p> + * <em>Compact notation</em>, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with + * localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to + * engineering notation in how it scales numbers. + * + * <p> + * Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing + * screen real estate. + * + * <p> + * In short form, the powers of ten are abbreviated. In <em>en-US</em>, the abbreviations are "K" for thousands, "M" + * for millions, "B" for billions, and "T" for trillions. Example outputs in <em>en-US</em> when printing 8.765E7 + * through 8.765E0: + * + * <pre> + * 88M + * 8.8M + * 876K + * 88K + * 8.8K + * 876 + * 88 + * 8.8 + * </pre> + * + * <p> + * When compact notation is specified without an explicit rounding precision, numbers are rounded off to the closest + * integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal + * separator if there is only one digit before the decimal separator. The default compact notation rounding precision + * is equivalent to: + * + * <pre> + * Precision::integer().withMinDigits(2) + * </pre> + * + * @return A CompactNotation for passing to the NumberFormatter notation() setter. + * @stable ICU 60 + */ + static CompactNotation compactShort(); + + /** + * Print the number using long-form compact notation. For more information on compact notation, see + * {@link #compactShort}. + * + * <p> + * In long form, the powers of ten are spelled out fully. Example outputs in <em>en-US</em> when printing 8.765E7 + * through 8.765E0: + * + * <pre> + * 88 million + * 8.8 million + * 876 thousand + * 88 thousand + * 8.8 thousand + * 876 + * 88 + * 8.8 + * </pre> + * + * @return A CompactNotation for passing to the NumberFormatter notation() setter. + * @stable ICU 60 + */ + static CompactNotation compactLong(); + + /** + * Print the number using simple notation without any scaling by powers of ten. This is the default behavior. + * + * <p> + * Since this is the default behavior, this method needs to be called only when it is necessary to override a + * previous setting. + * + * <p> + * Example outputs in <em>en-US</em> when printing 8.765E7 through 8.765E0: + * + * <pre> + * 87,650,000 + * 8,765,000 + * 876,500 + * 87,650 + * 8,765 + * 876.5 + * 87.65 + * 8.765 + * </pre> + * + * @return A SimpleNotation for passing to the NumberFormatter notation() setter. + * @stable ICU 60 + */ + static SimpleNotation simple(); + + private: + enum NotationType { + NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR + } fType; + + union NotationUnion { + // For NTN_SCIENTIFIC + /** @internal */ + struct ScientificSettings { + /** @internal */ + int8_t fEngineeringInterval; + /** @internal */ + bool fRequireMinInt; + /** @internal */ + impl::digits_t fMinExponentDigits; + /** @internal */ + UNumberSignDisplay fExponentSignDisplay; + } scientific; + + // For NTN_COMPACT + UNumberCompactStyle compactStyle; + + // For NTN_ERROR + UErrorCode errorCode; + } fUnion; + + typedef NotationUnion::ScientificSettings ScientificSettings; + + Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {} + + Notation(UErrorCode errorCode) : fType(NTN_ERROR) { + fUnion.errorCode = errorCode; + } + + Notation() : fType(NTN_SIMPLE), fUnion() {} + + UBool copyErrorTo(UErrorCode &status) const { + if (fType == NTN_ERROR) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + // To allow MacroProps to initialize empty instances: + friend struct impl::MacroProps; + friend class ScientificNotation; + + // To allow implementation to access internal types: + friend class impl::NumberFormatterImpl; + friend class impl::ScientificModifier; + friend class impl::ScientificHandler; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; +}; + +/** + * A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter. + * + * <p> + * To create a ScientificNotation, use one of the factory methods in {@link Notation}. + * + * @stable ICU 60 + */ +class U_I18N_API ScientificNotation : public Notation { + public: + /** + * Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if + * necessary. Useful for fixed-width display. + * + * <p> + * For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in <em>en-US</em> instead of + * the default "1.23E2". + * + * @param minExponentDigits + * The minimum number of digits to show in the exponent. + * @return A ScientificNotation, for chaining. + * @stable ICU 60 + */ + ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const; + + /** + * Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, + * showing the minus sign but not the plus sign. + * + * <p> + * For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in <em>en-US</em> + * instead of the default "1.23E2". + * + * @param exponentSignDisplay + * The strategy for displaying the sign in the exponent. + * @return A ScientificNotation, for chaining. + * @stable ICU 60 + */ + ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const; + + private: + // Inherit constructor + using Notation::Notation; + + // Raw constructor for NumberPropertyMapper + ScientificNotation(int8_t fEngineeringInterval, bool fRequireMinInt, impl::digits_t fMinExponentDigits, + UNumberSignDisplay fExponentSignDisplay); + + friend class Notation; + + // So that NumberPropertyMapper can create instances + friend class impl::NumberPropertyMapper; +}; + +/** + * Extra name reserved in case it is needed in the future. + * + * @stable ICU 63 + */ +typedef Precision SignificantDigitsPrecision; + +/** + * A class that defines the rounding precision to be used when formatting numbers in NumberFormatter. + * + * <p> + * To create a Precision, use one of the factory methods. + * + * @stable ICU 60 + */ +class U_I18N_API Precision : public UMemory { + + public: + /** + * Show all available digits to full precision. + * + * <p> + * <strong>NOTE:</strong> When formatting a <em>double</em>, this method, along with {@link #minFraction} and + * {@link #minSignificantDigits}, will trigger complex algorithm similar to <em>Dragon4</em> to determine the + * low-order digits and the number of digits to display based on the value of the double. + * If the number of fraction places or significant digits can be bounded, consider using {@link #maxFraction} + * or {@link #maxSignificantDigits} instead to maximize performance. + * For more information, read the following blog post. + * + * <p> + * http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/ + * + * @return A Precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static Precision unlimited(); + + /** + * Show numbers rounded if necessary to the nearest integer. + * + * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static FractionPrecision integer(); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). + * Additionally, pad with zeros to ensure that this number of places are always shown. + * + * <p> + * Example output with minMaxFractionPlaces = 3: + * + * <p> + * 87,650.000<br> + * 8,765.000<br> + * 876.500<br> + * 87.650<br> + * 8.765<br> + * 0.876<br> + * 0.088<br> + * 0.009<br> + * 0.000 (zero) + * + * <p> + * This method is equivalent to {@link #minMaxFraction} with both arguments equal. + * + * @param minMaxFractionPlaces + * The minimum and maximum number of numerals to display after the decimal separator (rounding if too + * long or padding with zeros if too short). + * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static FractionPrecision fixedFraction(int32_t minMaxFractionPlaces); + + /** + * Always show at least a certain number of fraction places after the decimal separator, padding with zeros if + * necessary. Do not perform rounding (display numbers to their full precision). + * + * <p> + * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}. + * + * @param minFractionPlaces + * The minimum number of numerals to display after the decimal separator (padding with zeros if + * necessary). + * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static FractionPrecision minFraction(int32_t minFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). + * Unlike the other fraction rounding strategies, this strategy does <em>not</em> pad zeros to the end of the + * number. + * + * @param maxFractionPlaces + * The maximum number of numerals to display after the decimal mark (rounding if necessary). + * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static FractionPrecision maxFraction(int32_t maxFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); + * in addition, always show at least a certain number of places after the decimal separator, padding with zeros if + * necessary. + * + * @param minFractionPlaces + * The minimum number of numerals to display after the decimal separator (padding with zeros if + * necessary). + * @param maxFractionPlaces + * The maximum number of numerals to display after the decimal separator (rounding if necessary). + * @return A FractionPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static FractionPrecision minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of significant digits or significant figures. Additionally, + * pad with zeros to ensure that this number of significant digits/figures are always shown. + * + * <p> + * This method is equivalent to {@link #minMaxSignificantDigits} with both arguments equal. + * + * @param minMaxSignificantDigits + * The minimum and maximum number of significant digits to display (rounding if too long or padding with + * zeros if too short). + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 62 + */ + static SignificantDigitsPrecision fixedSignificantDigits(int32_t minMaxSignificantDigits); + + /** + * Always show at least a certain number of significant digits/figures, padding with zeros if necessary. Do not + * perform rounding (display numbers to their full precision). + * + * <p> + * <strong>NOTE:</strong> If you are formatting <em>doubles</em>, see the performance note in {@link #unlimited}. + * + * @param minSignificantDigits + * The minimum number of significant digits to display (padding with zeros if too short). + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 62 + */ + static SignificantDigitsPrecision minSignificantDigits(int32_t minSignificantDigits); + + /** + * Show numbers rounded if necessary to a certain number of significant digits/figures. + * + * @param maxSignificantDigits + * The maximum number of significant digits to display (rounding if too long). + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 62 + */ + static SignificantDigitsPrecision maxSignificantDigits(int32_t maxSignificantDigits); + + /** + * Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at + * least a certain number of significant digits, padding with zeros if necessary. + * + * @param minSignificantDigits + * The minimum number of significant digits to display (padding with zeros if necessary). + * @param maxSignificantDigits + * The maximum number of significant digits to display (rounding if necessary). + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 62 + */ + static SignificantDigitsPrecision minMaxSignificantDigits(int32_t minSignificantDigits, + int32_t maxSignificantDigits); + + /** + * Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the + * rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5. + * + * <p> + * In order to ensure that numbers are padded to the appropriate number of fraction places, call + * withMinFraction() on the return value of this method. + * For example, to round to the nearest 0.5 and always display 2 numerals after the + * decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run: + * + * <pre> + * Precision::increment(0.5).withMinFraction(2) + * </pre> + * + * @param roundingIncrement + * The increment to which to round numbers. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static IncrementPrecision increment(double roundingIncrement); + + /** + * Show numbers rounded and padded according to the rules for the currency unit. The most common + * rounding precision settings for currencies include <code>Precision::fixedFraction(2)</code>, + * <code>Precision::integer()</code>, and <code>Precision::increment(0.05)</code> for cash transactions + * ("nickel rounding"). + * + * <p> + * The exact rounding details will be resolved at runtime based on the currency unit specified in the + * NumberFormatter chain. To round according to the rules for one currency while displaying the symbol for another + * currency, the withCurrency() method can be called on the return value of this method. + * + * @param currencyUsage + * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding increment may + * be limited by the available denominations of cash or coins). + * @return A CurrencyPrecision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + static CurrencyPrecision currency(UCurrencyUsage currencyUsage); + + private: + enum PrecisionType { + RND_BOGUS, + RND_NONE, + RND_FRACTION, + RND_SIGNIFICANT, + RND_FRACTION_SIGNIFICANT, + + // Used for strange increments like 3.14. + RND_INCREMENT, + + // Used for increments with 1 as the only digit. This is different than fraction + // rounding because it supports having additional trailing zeros. For example, this + // class is used to round with the increment 0.010. + RND_INCREMENT_ONE, + + // Used for increments with 5 as the only digit (nickel rounding). + RND_INCREMENT_FIVE, + + RND_CURRENCY, + RND_ERROR + } fType; + + union PrecisionUnion { + /** @internal */ + struct FractionSignificantSettings { + // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT + /** @internal */ + impl::digits_t fMinFrac; + /** @internal */ + impl::digits_t fMaxFrac; + /** @internal */ + impl::digits_t fMinSig; + /** @internal */ + impl::digits_t fMaxSig; + } fracSig; + /** @internal */ + struct IncrementSettings { + // For RND_INCREMENT, RND_INCREMENT_ONE, and RND_INCREMENT_FIVE + /** @internal */ + double fIncrement; + /** @internal */ + impl::digits_t fMinFrac; + /** @internal */ + impl::digits_t fMaxFrac; + } increment; + UCurrencyUsage currencyUsage; // For RND_CURRENCY + UErrorCode errorCode; // For RND_ERROR + } fUnion; + + typedef PrecisionUnion::FractionSignificantSettings FractionSignificantSettings; + typedef PrecisionUnion::IncrementSettings IncrementSettings; + + /** The Precision encapsulates the RoundingMode when used within the implementation. */ + UNumberFormatRoundingMode fRoundingMode; + + Precision(const PrecisionType& type, const PrecisionUnion& union_, + UNumberFormatRoundingMode roundingMode) + : fType(type), fUnion(union_), fRoundingMode(roundingMode) {} + + Precision(UErrorCode errorCode) : fType(RND_ERROR) { + fUnion.errorCode = errorCode; + } + + Precision() : fType(RND_BOGUS) {} + + bool isBogus() const { + return fType == RND_BOGUS; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fType == RND_ERROR) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + // On the parent type so that this method can be called internally on Precision instances. + Precision withCurrency(const CurrencyUnit ¤cy, UErrorCode &status) const; + + static FractionPrecision constructFraction(int32_t minFrac, int32_t maxFrac); + + static Precision constructSignificant(int32_t minSig, int32_t maxSig); + + static Precision + constructFractionSignificant(const FractionPrecision &base, int32_t minSig, int32_t maxSig); + + static IncrementPrecision constructIncrement(double increment, int32_t minFrac); + + static CurrencyPrecision constructCurrency(UCurrencyUsage usage); + + static Precision constructPassThrough(); + + // To allow MacroProps/MicroProps to initialize bogus instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and other internal methods: + friend class impl::NumberFormatterImpl; + + // To allow NumberPropertyMapper to create instances from DecimalFormatProperties: + friend class impl::NumberPropertyMapper; + + // To allow access to the main implementation class: + friend class impl::RoundingImpl; + + // To allow child classes to call private methods: + friend class FractionPrecision; + friend class CurrencyPrecision; + friend class IncrementPrecision; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; +}; + +/** + * A class that defines a rounding precision based on a number of fraction places and optionally significant digits to be + * used when formatting numbers in NumberFormatter. + * + * <p> + * To create a FractionPrecision, use one of the factory methods on Precision. + * + * @stable ICU 60 + */ +class U_I18N_API FractionPrecision : public Precision { + public: + /** + * Ensure that no less than this number of significant digits are retained when rounding according to fraction + * rules. + * + * <p> + * For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141 + * becomes "3.1" instead. + * + * <p> + * This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0". + * + * @param minSignificantDigits + * The number of significant figures to guarantee. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + Precision withMinDigits(int32_t minSignificantDigits) const; + + /** + * Ensure that no more than this number of significant digits are retained when rounding according to fraction + * rules. + * + * <p> + * For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 + * becomes "120" instead. + * + * <p> + * This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would + * become "120.00". + * + * @param maxSignificantDigits + * Round the number to no more than this number of significant figures. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + Precision withMaxDigits(int32_t maxSignificantDigits) const; + + private: + // Inherit constructor + using Precision::Precision; + + // To allow parent class to call this class's constructor: + friend class Precision; +}; + +/** + * A class that defines a rounding precision parameterized by a currency to be used when formatting numbers in + * NumberFormatter. + * + * <p> + * To create a CurrencyPrecision, use one of the factory methods on Precision. + * + * @stable ICU 60 + */ +class U_I18N_API CurrencyPrecision : public Precision { + public: + /** + * Associates a currency with this rounding precision. + * + * <p> + * <strong>Calling this method is <em>not required</em></strong>, because the currency specified in unit() + * is automatically applied to currency rounding precisions. However, + * this method enables you to override that automatic association. + * + * <p> + * This method also enables numbers to be formatted using currency rounding rules without explicitly using a + * currency format. + * + * @param currency + * The currency to associate with this rounding precision. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + Precision withCurrency(const CurrencyUnit ¤cy) const; + + private: + // Inherit constructor + using Precision::Precision; + + // To allow parent class to call this class's constructor: + friend class Precision; +}; + +/** + * A class that defines a rounding precision parameterized by a rounding increment to be used when formatting numbers in + * NumberFormatter. + * + * <p> + * To create an IncrementPrecision, use one of the factory methods on Precision. + * + * @stable ICU 60 + */ +class U_I18N_API IncrementPrecision : public Precision { + public: + /** + * Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if + * necessary. By default, no trailing zeros are added. + * + * <p> + * For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00", + * "0.50", "1.00", and "1.50". + * + * <p> + * Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment. + * + * @param minFrac The minimum number of digits after the decimal separator. + * @return A precision for chaining or passing to the NumberFormatter precision() setter. + * @stable ICU 60 + */ + Precision withMinFraction(int32_t minFrac) const; + + private: + // Inherit constructor + using Precision::Precision; + + // To allow parent class to call this class's constructor: + friend class Precision; +}; + +/** + * A class that defines the strategy for padding and truncating integers before the decimal separator. + * + * <p> + * To create an IntegerWidth, use one of the factory methods. + * + * @stable ICU 60 + * @see NumberFormatter + */ +class U_I18N_API IntegerWidth : public UMemory { + public: + /** + * Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator. + * + * <p> + * For example, with minInt=3, the number 55 will get printed as "055". + * + * @param minInt + * The minimum number of places before the decimal separator. + * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter. + * @stable ICU 60 + */ + static IntegerWidth zeroFillTo(int32_t minInt); + + /** + * Truncate numbers exceeding a certain number of numerals before the decimal separator. + * + * For example, with maxInt=3, the number 1234 will get printed as "234". + * + * @param maxInt + * The maximum number of places before the decimal separator. maxInt == -1 means no + * truncation. + * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter. + * @stable ICU 60 + */ + IntegerWidth truncateAt(int32_t maxInt); + + private: + union { + struct { + impl::digits_t fMinInt; + impl::digits_t fMaxInt; + bool fFormatFailIfMoreThanMaxDigits; + } minMaxInt; + UErrorCode errorCode; + } fUnion; + bool fHasError = false; + + IntegerWidth(impl::digits_t minInt, impl::digits_t maxInt, bool formatFailIfMoreThanMaxDigits); + + IntegerWidth(UErrorCode errorCode) { // NOLINT + fUnion.errorCode = errorCode; + fHasError = true; + } + + IntegerWidth() { // NOLINT + fUnion.minMaxInt.fMinInt = -1; + } + + /** Returns the default instance. */ + static IntegerWidth standard() { + return IntegerWidth::zeroFillTo(1); + } + + bool isBogus() const { + return !fHasError && fUnion.minMaxInt.fMinInt == -1; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fHasError) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const; + + bool operator==(const IntegerWidth& other) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus(): + friend class impl::NumberFormatterImpl; + + // To allow the use of this class when formatting: + friend class impl::MutablePatternModifier; + friend class impl::ImmutablePatternModifier; + + // So that NumberPropertyMapper can create instances + friend class impl::NumberPropertyMapper; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; +}; + +/** + * A class that defines a quantity by which a number should be multiplied when formatting. + * + * <p> + * To create a Scale, use one of the factory methods. + * + * @stable ICU 62 + */ +class U_I18N_API Scale : public UMemory { + public: + /** + * Do not change the value of numbers when formatting or parsing. + * + * @return A Scale to prevent any multiplication. + * @stable ICU 62 + */ + static Scale none(); + + /** + * Multiply numbers by a power of ten before formatting. Useful for combining with a percent unit: + * + * <pre> + * NumberFormatter::with().unit(NoUnit::percent()).multiplier(Scale::powerOfTen(2)) + * </pre> + * + * @return A Scale for passing to the setter in NumberFormatter. + * @stable ICU 62 + */ + static Scale powerOfTen(int32_t power); + + /** + * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions. + * + * This method takes a string in a decimal number format with syntax + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * Also see the version of this method that takes a double. + * + * @return A Scale for passing to the setter in NumberFormatter. + * @stable ICU 62 + */ + static Scale byDecimal(StringPiece multiplicand); + + /** + * Multiply numbers by an arbitrary value before formatting. Useful for unit conversions. + * + * This method takes a double; also see the version of this method that takes an exact decimal. + * + * @return A Scale for passing to the setter in NumberFormatter. + * @stable ICU 62 + */ + static Scale byDouble(double multiplicand); + + /** + * Multiply a number by both a power of ten and by an arbitrary double value. + * + * @return A Scale for passing to the setter in NumberFormatter. + * @stable ICU 62 + */ + static Scale byDoubleAndPowerOfTen(double multiplicand, int32_t power); + + // We need a custom destructor for the DecNum, which means we need to declare + // the copy/move constructor/assignment quartet. + + /** @stable ICU 62 */ + Scale(const Scale& other); + + /** @stable ICU 62 */ + Scale& operator=(const Scale& other); + + /** @stable ICU 62 */ + Scale(Scale&& src) U_NOEXCEPT; + + /** @stable ICU 62 */ + Scale& operator=(Scale&& src) U_NOEXCEPT; + + /** @stable ICU 62 */ + ~Scale(); + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + Scale(int32_t magnitude, impl::DecNum* arbitraryToAdopt); +#endif /* U_HIDE_INTERNAL_API */ + + private: + int32_t fMagnitude; + impl::DecNum* fArbitrary; + UErrorCode fError; + + Scale(UErrorCode error) : fMagnitude(0), fArbitrary(nullptr), fError(error) {} + + Scale() : fMagnitude(0), fArbitrary(nullptr), fError(U_ZERO_ERROR) {} + + bool isValid() const { + return fMagnitude != 0 || fArbitrary != nullptr; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fError != U_ZERO_ERROR) { + status = fError; + return TRUE; + } + return FALSE; + } + + void applyTo(impl::DecimalQuantity& quantity) const; + + void applyReciprocalTo(impl::DecimalQuantity& quantity) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class impl::NumberFormatterImpl; + + // To allow the helper class MultiplierFormatHandler access to private fields: + friend class impl::MultiplierFormatHandler; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; + + // To allow access to parsing code: + friend class ::icu::numparse::impl::NumberParserImpl; + friend class ::icu::numparse::impl::MultiplierParseHandler; +}; + +namespace impl { + +// Do not enclose entire SymbolsWrapper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** @internal */ +class U_I18N_API SymbolsWrapper : public UMemory { + public: + /** @internal */ + SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {} + + /** @internal */ + SymbolsWrapper(const SymbolsWrapper &other); + + /** @internal */ + SymbolsWrapper &operator=(const SymbolsWrapper &other); + + /** @internal */ + SymbolsWrapper(SymbolsWrapper&& src) U_NOEXCEPT; + + /** @internal */ + SymbolsWrapper &operator=(SymbolsWrapper&& src) U_NOEXCEPT; + + /** @internal */ + ~SymbolsWrapper(); + +#ifndef U_HIDE_INTERNAL_API + + /** + * The provided object is copied, but we do not adopt it. + * @internal + */ + void setTo(const DecimalFormatSymbols &dfs); + + /** + * Adopt the provided object. + * @internal + */ + void setTo(const NumberingSystem *ns); + + /** + * Whether the object is currently holding a DecimalFormatSymbols. + * @internal + */ + bool isDecimalFormatSymbols() const; + + /** + * Whether the object is currently holding a NumberingSystem. + * @internal + */ + bool isNumberingSystem() const; + + /** + * Get the DecimalFormatSymbols pointer. No ownership change. + * @internal + */ + const DecimalFormatSymbols *getDecimalFormatSymbols() const; + + /** + * Get the NumberingSystem pointer. No ownership change. + * @internal + */ + const NumberingSystem *getNumberingSystem() const; + +#endif // U_HIDE_INTERNAL_API + + /** @internal */ + UBool copyErrorTo(UErrorCode &status) const { + if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return TRUE; + } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return TRUE; + } + return FALSE; + } + + private: + enum SymbolsPointerType { + SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS + } fType; + + union { + const DecimalFormatSymbols *dfs; + const NumberingSystem *ns; + } fPtr; + + void doCopyFrom(const SymbolsWrapper &other); + + void doMoveFrom(SymbolsWrapper&& src); + + void doCleanup(); +}; + +// Do not enclose entire Grouper with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** @internal */ +class U_I18N_API Grouper : public UMemory { + public: +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static Grouper forStrategy(UNumberGroupingStrategy grouping); + + /** + * Resolve the values in Properties to a Grouper object. + * @internal + */ + static Grouper forProperties(const DecimalFormatProperties& properties); + + // Future: static Grouper forProperties(DecimalFormatProperties& properties); + + /** @internal */ + Grouper(int16_t grouping1, int16_t grouping2, int16_t minGrouping, UNumberGroupingStrategy strategy) + : fGrouping1(grouping1), + fGrouping2(grouping2), + fMinGrouping(minGrouping), + fStrategy(strategy) {} +#endif // U_HIDE_INTERNAL_API + + /** @internal */ + int16_t getPrimary() const; + + /** @internal */ + int16_t getSecondary() const; + + private: + /** + * The grouping sizes, with the following special values: + * <ul> + * <li>-1 = no grouping + * <li>-2 = needs locale data + * <li>-4 = fall back to Western grouping if not in locale + * </ul> + */ + int16_t fGrouping1; + int16_t fGrouping2; + + /** + * The minimum grouping size, with the following special values: + * <ul> + * <li>-2 = needs locale data + * <li>-3 = no less than 2 + * </ul> + */ + int16_t fMinGrouping; + + /** + * The UNumberGroupingStrategy that was used to create this Grouper, or UNUM_GROUPING_COUNT if this + * was not created from a UNumberGroupingStrategy. + */ + UNumberGroupingStrategy fStrategy; + + Grouper() : fGrouping1(-3) {} + + bool isBogus() const { + return fGrouping1 == -3; + } + + /** NON-CONST: mutates the current instance. */ + void setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Locale& locale); + + bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct MacroProps; + friend struct MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class NumberFormatterImpl; + + // To allow NumberParserImpl to perform setLocaleData(): + friend class ::icu::numparse::impl::NumberParserImpl; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; +}; + +// Do not enclose entire Padder with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** @internal */ +class U_I18N_API Padder : public UMemory { + public: +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static Padder none(); + + /** @internal */ + static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position); +#endif // U_HIDE_INTERNAL_API + + /** @internal */ + static Padder forProperties(const DecimalFormatProperties& properties); + + private: + UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding + union { + struct { + int32_t fCp; + UNumberFormatPadPosition fPosition; + } padding; + UErrorCode errorCode; + } fUnion; + + Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position); + + Padder(int32_t width); + + Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT + fUnion.errorCode = errorCode; + } + + Padder() : fWidth(-2) {} // NOLINT + + bool isBogus() const { + return fWidth == -2; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fWidth == -3) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + bool isValid() const { + return fWidth > 0; + } + + int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2, + FormattedStringBuilder &string, int32_t leftIndex, int32_t rightIndex, + UErrorCode &status) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct MacroProps; + friend struct MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class impl::NumberFormatterImpl; + + // To allow access to the skeleton generation code: + friend class impl::GeneratorHelpers; +}; + +// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** @internal */ +struct U_I18N_API MacroProps : public UMemory { + /** @internal */ + Notation notation; + + /** @internal */ + MeasureUnit unit; // = NoUnit::base(); + + /** @internal */ + MeasureUnit perUnit; // = NoUnit::base(); + + /** @internal */ + Precision precision; // = Precision(); (bogus) + + /** @internal */ + UNumberFormatRoundingMode roundingMode = UNUM_ROUND_HALFEVEN; + + /** @internal */ + Grouper grouper; // = Grouper(); (bogus) + + /** @internal */ + Padder padder; // = Padder(); (bogus) + + /** @internal */ + IntegerWidth integerWidth; // = IntegerWidth(); (bogus) + + /** @internal */ + SymbolsWrapper symbols; + + // UNUM_XYZ_COUNT denotes null (bogus) values. + + /** @internal */ + UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT; + + /** @internal */ + UNumberSignDisplay sign = UNUM_SIGN_COUNT; + + /** @internal */ + UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT; + + /** @internal */ + Scale scale; // = Scale(); (benign value) + + /** @internal */ + const AffixPatternProvider* affixProvider = nullptr; // no ownership + + /** @internal */ + const PluralRules* rules = nullptr; // no ownership + + /** @internal */ + int32_t threshold = kInternalDefaultThreshold; + + /** @internal */ + Locale locale; + + // NOTE: Uses default copy and move constructors. + + /** + * Check all members for errors. + * @internal + */ + bool copyErrorTo(UErrorCode &status) const { + return notation.copyErrorTo(status) || precision.copyErrorTo(status) || + padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) || + symbols.copyErrorTo(status) || scale.copyErrorTo(status); + } +}; + +} // namespace impl + +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Ignore MSVC warning 4661. This is generated for NumberFormatterSettings<>::toSkeleton() as this method +// is defined elsewhere (in number_skeletons.cpp). The compiler is warning that the explicit template instantiation +// inside this single translation unit (CPP file) is incomplete, and thus it isn't sure if the template class is +// fully defined. However, since each translation unit explicitly instantiates all the necessary template classes, +// they will all be passed to the linker, and the linker will still find and export all the class members. +#pragma warning(push) +#pragma warning(disable: 4661) +#endif + +/** + * An abstract base class for specifying settings related to number formatting. This class is implemented by + * {@link UnlocalizedNumberFormatter} and {@link LocalizedNumberFormatter}. This class is not intended for + * public subclassing. + */ +template<typename Derived> +class U_I18N_API NumberFormatterSettings { + public: + /** + * Specifies the notation style (simple, scientific, or compact) for rendering numbers. + * + * <ul> + * <li>Simple notation: "12,300" + * <li>Scientific notation: "1.23E4" + * <li>Compact notation: "12K" + * </ul> + * + * <p> + * All notation styles will be properly localized with locale data, and all notation styles are compatible with + * units, rounding precisions, and other number formatter settings. + * + * <p> + * Pass this method the return value of a {@link Notation} factory method. For example: + * + * <pre> + * NumberFormatter::with().notation(Notation::compactShort()) + * </pre> + * + * The default is to use simple notation. + * + * @param notation + * The notation strategy to use. + * @return The fluent chain. + * @see Notation + * @stable ICU 60 + */ + Derived notation(const Notation ¬ation) const &; + + /** + * Overload of notation() for use on an rvalue reference. + * + * @param notation + * The notation strategy to use. + * @return The fluent chain. + * @see #notation + * @stable ICU 62 + */ + Derived notation(const Notation ¬ation) &&; + + /** + * Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers. + * + * <ul> + * <li>Unit of measure: "12.3 meters" + * <li>Currency: "$12.30" + * <li>Percent: "12.3%" + * </ul> + * + * All units will be properly localized with locale data, and all units are compatible with notation styles, + * rounding precisions, and other number formatter settings. + * + * Pass this method any instance of {@link MeasureUnit}. For units of measure: + * + * <pre> + * NumberFormatter::with().unit(MeasureUnit::getMeter()) + * </pre> + * + * Currency: + * + * <pre> + * NumberFormatter::with().unit(CurrencyUnit(u"USD", status)) + * </pre> + * + * Percent: + * + * <pre> + * NumberFormatter::with().unit(NoUnit.percent()) + * </pre> + * + * See {@link #perUnit} for information on how to format strings like "5 meters per second". + * + * The default is to render without units (equivalent to NoUnit.base()). + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see MeasureUnit + * @see Currency + * @see NoUnit + * @see #perUnit + * @stable ICU 60 + */ + Derived unit(const icu::MeasureUnit &unit) const &; + + /** + * Overload of unit() for use on an rvalue reference. + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see #unit + * @stable ICU 62 + */ + Derived unit(const icu::MeasureUnit &unit) &&; + + /** + * Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory + * methods that return pointers that need ownership. + * + * Note: consider using the MeasureFormat factory methods that return by value. + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see #unit + * @see MeasureUnit + * @stable ICU 60 + */ + Derived adoptUnit(icu::MeasureUnit *unit) const &; + + /** + * Overload of adoptUnit() for use on an rvalue reference. + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see #adoptUnit + * @stable ICU 62 + */ + Derived adoptUnit(icu::MeasureUnit *unit) &&; + + /** + * Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to + * the perUnit. + * + * Pass this method any instance of {@link MeasureUnit}. Example: + * + * <pre> + * NumberFormatter::with() + * .unit(MeasureUnit::getMeter()) + * .perUnit(MeasureUnit::getSecond()) + * </pre> + * + * The default is not to display any unit in the denominator. + * + * If a per-unit is specified without a primary unit via {@link #unit}, the behavior is undefined. + * + * @param perUnit + * The unit to render in the denominator. + * @return The fluent chain + * @see #unit + * @stable ICU 61 + */ + Derived perUnit(const icu::MeasureUnit &perUnit) const &; + + /** + * Overload of perUnit() for use on an rvalue reference. + * + * @param perUnit + * The unit to render in the denominator. + * @return The fluent chain. + * @see #perUnit + * @stable ICU 62 + */ + Derived perUnit(const icu::MeasureUnit &perUnit) &&; + + /** + * Like perUnit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory + * methods that return pointers that need ownership. + * + * Note: consider using the MeasureFormat factory methods that return by value. + * + * @param perUnit + * The unit to render in the denominator. + * @return The fluent chain. + * @see #perUnit + * @see MeasureUnit + * @stable ICU 61 + */ + Derived adoptPerUnit(icu::MeasureUnit *perUnit) const &; + + /** + * Overload of adoptPerUnit() for use on an rvalue reference. + * + * @param perUnit + * The unit to render in the denominator. + * @return The fluent chain. + * @see #adoptPerUnit + * @stable ICU 62 + */ + Derived adoptPerUnit(icu::MeasureUnit *perUnit) &&; + + /** + * Specifies the rounding precision to use when formatting numbers. + * + * <ul> + * <li>Round to 3 decimal places: "3.142" + * <li>Round to 3 significant figures: "3.14" + * <li>Round to the closest nickel: "3.15" + * <li>Do not perform rounding: "3.1415926..." + * </ul> + * + * <p> + * Pass this method the return value of one of the factory methods on {@link Precision}. For example: + * + * <pre> + * NumberFormatter::with().precision(Precision::fixedFraction(2)) + * </pre> + * + * <p> + * In most cases, the default rounding strategy is to round to 6 fraction places; i.e., + * <code>Precision.maxFraction(6)</code>. The exceptions are if compact notation is being used, then the compact + * notation rounding strategy is used (see {@link Notation#compactShort} for details), or if the unit is a currency, + * then standard currency rounding is used, which varies from currency to currency (see {@link Precision#currency} for + * details). + * + * @param precision + * The rounding precision to use. + * @return The fluent chain. + * @see Precision + * @stable ICU 62 + */ + Derived precision(const Precision& precision) const &; + + /** + * Overload of precision() for use on an rvalue reference. + * + * @param precision + * The rounding precision to use. + * @return The fluent chain. + * @see #precision + * @stable ICU 62 + */ + Derived precision(const Precision& precision) &&; + + /** + * Specifies how to determine the direction to round a number when it has more digits than fit in the + * desired precision. When formatting 1.235: + * + * <ul> + * <li>Ceiling rounding mode with integer precision: "2" + * <li>Half-down rounding mode with 2 fixed fraction digits: "1.23" + * <li>Half-up rounding mode with 2 fixed fraction digits: "1.24" + * </ul> + * + * The default is HALF_EVEN. For more information on rounding mode, see the ICU userguide here: + * + * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * + * @param roundingMode The rounding mode to use. + * @return The fluent chain. + * @stable ICU 62 + */ + Derived roundingMode(UNumberFormatRoundingMode roundingMode) const &; + + /** + * Overload of roundingMode() for use on an rvalue reference. + * + * @param roundingMode The rounding mode to use. + * @return The fluent chain. + * @see #roundingMode + * @stable ICU 62 + */ + Derived roundingMode(UNumberFormatRoundingMode roundingMode) &&; + + /** + * Specifies the grouping strategy to use when formatting numbers. + * + * <ul> + * <li>Default grouping: "12,300" and "1,230" + * <li>Grouping with at least 2 digits: "12,300" and "1230" + * <li>No grouping: "12300" and "1230" + * </ul> + * + * <p> + * The exact grouping widths will be chosen based on the locale. + * + * <p> + * Pass this method an element from the {@link UNumberGroupingStrategy} enum. For example: + * + * <pre> + * NumberFormatter::with().grouping(UNUM_GROUPING_MIN2) + * </pre> + * + * The default is to perform grouping according to locale data; most locales, but not all locales, + * enable it by default. + * + * @param strategy + * The grouping strategy to use. + * @return The fluent chain. + * @stable ICU 61 + */ + Derived grouping(UNumberGroupingStrategy strategy) const &; + + /** + * Overload of grouping() for use on an rvalue reference. + * + * @param strategy + * The grouping strategy to use. + * @return The fluent chain. + * @see #grouping + * @stable ICU 62 + */ + Derived grouping(UNumberGroupingStrategy strategy) &&; + + /** + * Specifies the minimum and maximum number of digits to render before the decimal mark. + * + * <ul> + * <li>Zero minimum integer digits: ".08" + * <li>One minimum integer digit: "0.08" + * <li>Two minimum integer digits: "00.08" + * </ul> + * + * <p> + * Pass this method the return value of {@link IntegerWidth#zeroFillTo}. For example: + * + * <pre> + * NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(2)) + * </pre> + * + * The default is to have one minimum integer digit. + * + * @param style + * The integer width to use. + * @return The fluent chain. + * @see IntegerWidth + * @stable ICU 60 + */ + Derived integerWidth(const IntegerWidth &style) const &; + + /** + * Overload of integerWidth() for use on an rvalue reference. + * + * @param style + * The integer width to use. + * @return The fluent chain. + * @see #integerWidth + * @stable ICU 62 + */ + Derived integerWidth(const IntegerWidth &style) &&; + + /** + * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering + * numbers. + * + * <ul> + * <li><em>en_US</em> symbols: "12,345.67" + * <li><em>fr_FR</em> symbols: "12 345,67" + * <li><em>de_CH</em> symbols: "12’345.67" + * <li><em>my_MY</em> symbols: "၁၂,၃၄၅.၆၇" + * </ul> + * + * <p> + * Pass this method an instance of {@link DecimalFormatSymbols}. For example: + * + * <pre> + * NumberFormatter::with().symbols(DecimalFormatSymbols(Locale("de_CH"), status)) + * </pre> + * + * <p> + * <strong>Note:</strong> DecimalFormatSymbols automatically chooses the best numbering system based on the locale. + * In the examples above, the first three are using the Latin numbering system, and the fourth is using the Myanmar + * numbering system. + * + * <p> + * <strong>Note:</strong> The instance of DecimalFormatSymbols will be copied: changes made to the symbols object + * after passing it into the fluent chain will not be seen. + * + * <p> + * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols + * or NumberingSystem. + * + * <p> + * The default is to choose the symbols based on the locale specified in the fluent chain. + * + * @param symbols + * The DecimalFormatSymbols to use. + * @return The fluent chain. + * @see DecimalFormatSymbols + * @stable ICU 60 + */ + Derived symbols(const DecimalFormatSymbols &symbols) const &; + + /** + * Overload of symbols() for use on an rvalue reference. + * + * @param symbols + * The DecimalFormatSymbols to use. + * @return The fluent chain. + * @see #symbols + * @stable ICU 62 + */ + Derived symbols(const DecimalFormatSymbols &symbols) &&; + + /** + * Specifies that the given numbering system should be used when fetching symbols. + * + * <ul> + * <li>Latin numbering system: "12,345" + * <li>Myanmar numbering system: "၁၂,၃၄၅" + * <li>Math Sans Bold numbering system: "𝟭𝟮,𝟯𝟰𝟱" + * </ul> + * + * <p> + * Pass this method an instance of {@link NumberingSystem}. For example, to force the locale to always use the Latin + * alphabet numbering system (ASCII digits): + * + * <pre> + * NumberFormatter::with().adoptSymbols(NumberingSystem::createInstanceByName("latn", status)) + * </pre> + * + * <p> + * <strong>Note:</strong> Calling this method will override any previously specified DecimalFormatSymbols + * or NumberingSystem. + * + * <p> + * The default is to choose the best numbering system for the locale. + * + * <p> + * This method takes ownership of a pointer in order to work nicely with the NumberingSystem factory methods. + * + * @param symbols + * The NumberingSystem to use. + * @return The fluent chain. + * @see NumberingSystem + * @stable ICU 60 + */ + Derived adoptSymbols(NumberingSystem *symbols) const &; + + /** + * Overload of adoptSymbols() for use on an rvalue reference. + * + * @param symbols + * The NumberingSystem to use. + * @return The fluent chain. + * @see #adoptSymbols + * @stable ICU 62 + */ + Derived adoptSymbols(NumberingSystem *symbols) &&; + + /** + * Sets the width of the unit (measure unit or currency). Most common values: + * + * <ul> + * <li>Short: "$12.00", "12 m" + * <li>ISO Code: "USD 12.00" + * <li>Full name: "12.00 US dollars", "12 meters" + * </ul> + * + * <p> + * Pass an element from the {@link UNumberUnitWidth} enum to this setter. For example: + * + * <pre> + * NumberFormatter::with().unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME) + * </pre> + * + * <p> + * The default is the SHORT width. + * + * @param width + * The width to use when rendering numbers. + * @return The fluent chain + * @see UNumberUnitWidth + * @stable ICU 60 + */ + Derived unitWidth(UNumberUnitWidth width) const &; + + /** + * Overload of unitWidth() for use on an rvalue reference. + * + * @param width + * The width to use when rendering numbers. + * @return The fluent chain. + * @see #unitWidth + * @stable ICU 62 + */ + Derived unitWidth(UNumberUnitWidth width) &&; + + /** + * Sets the plus/minus sign display strategy. Most common values: + * + * <ul> + * <li>Auto: "123", "-123" + * <li>Always: "+123", "-123" + * <li>Accounting: "$123", "($123)" + * </ul> + * + * <p> + * Pass an element from the {@link UNumberSignDisplay} enum to this setter. For example: + * + * <pre> + * NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS) + * </pre> + * + * <p> + * The default is AUTO sign display. + * + * @param style + * The sign display strategy to use when rendering numbers. + * @return The fluent chain + * @see UNumberSignDisplay + * @stable ICU 60 + */ + Derived sign(UNumberSignDisplay style) const &; + + /** + * Overload of sign() for use on an rvalue reference. + * + * @param style + * The sign display strategy to use when rendering numbers. + * @return The fluent chain. + * @see #sign + * @stable ICU 62 + */ + Derived sign(UNumberSignDisplay style) &&; + + /** + * Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common + * values: + * + * <ul> + * <li>Auto: "1" + * <li>Always: "1." + * </ul> + * + * <p> + * Pass an element from the {@link UNumberDecimalSeparatorDisplay} enum to this setter. For example: + * + * <pre> + * NumberFormatter::with().decimal(UNumberDecimalSeparatorDisplay::UNUM_DECIMAL_SEPARATOR_ALWAYS) + * </pre> + * + * <p> + * The default is AUTO decimal separator display. + * + * @param style + * The decimal separator display strategy to use when rendering numbers. + * @return The fluent chain + * @see UNumberDecimalSeparatorDisplay + * @stable ICU 60 + */ + Derived decimal(UNumberDecimalSeparatorDisplay style) const &; + + /** + * Overload of decimal() for use on an rvalue reference. + * + * @param style + * The decimal separator display strategy to use when rendering numbers. + * @return The fluent chain. + * @see #decimal + * @stable ICU 62 + */ + Derived decimal(UNumberDecimalSeparatorDisplay style) &&; + + /** + * Sets a scale (multiplier) to be used to scale the number by an arbitrary amount before formatting. + * Most common values: + * + * <ul> + * <li>Multiply by 100: useful for percentages. + * <li>Multiply by an arbitrary value: useful for unit conversions. + * </ul> + * + * <p> + * Pass an element from a {@link Scale} factory method to this setter. For example: + * + * <pre> + * NumberFormatter::with().scale(Scale::powerOfTen(2)) + * </pre> + * + * <p> + * The default is to not apply any multiplier. + * + * @param scale + * The scale to apply when rendering numbers. + * @return The fluent chain + * @stable ICU 62 + */ + Derived scale(const Scale &scale) const &; + + /** + * Overload of scale() for use on an rvalue reference. + * + * @param scale + * The scale to apply when rendering numbers. + * @return The fluent chain. + * @see #scale + * @stable ICU 62 + */ + Derived scale(const Scale &scale) &&; + +#ifndef U_HIDE_INTERNAL_API + + /** + * Set the padding strategy. May be added in the future; see #13338. + * + * @internal ICU 60: This API is ICU internal only. + */ + Derived padding(const impl::Padder &padder) const &; + + /** @internal */ + Derived padding(const impl::Padder &padder) &&; + + /** + * Internal fluent setter to support a custom regulation threshold. A threshold of 1 causes the data structures to + * be built right away. A threshold of 0 prevents the data structures from being built. + * + * @internal ICU 60: This API is ICU internal only. + */ + Derived threshold(int32_t threshold) const &; + + /** @internal */ + Derived threshold(int32_t threshold) &&; + + /** + * Internal fluent setter to overwrite the entire macros object. + * + * @internal ICU 60: This API is ICU internal only. + */ + Derived macros(const impl::MacroProps& macros) const &; + + /** @internal */ + Derived macros(const impl::MacroProps& macros) &&; + + /** @internal */ + Derived macros(impl::MacroProps&& macros) const &; + + /** @internal */ + Derived macros(impl::MacroProps&& macros) &&; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Creates a skeleton string representation of this number formatter. A skeleton string is a + * locale-agnostic serialized form of a number formatter. + * + * Not all options are capable of being represented in the skeleton string; for example, a + * DecimalFormatSymbols object. If any such option is encountered, the error code is set to + * U_UNSUPPORTED_ERROR. + * + * The returned skeleton is in normalized form, such that two number formatters with equivalent + * behavior should produce the same skeleton. + * + * @return A number skeleton string with behavior corresponding to this number formatter. + * @stable ICU 62 + */ + UnicodeString toSkeleton(UErrorCode& status) const; + + /** + * Returns the current (Un)LocalizedNumberFormatter as a LocalPointer + * wrapping a heap-allocated copy of the current object. + * + * This is equivalent to new-ing the move constructor with a value object + * as the argument. + * + * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped + * nullptr on failure. + * @stable ICU 64 + */ + LocalPointer<Derived> clone() const &; + + /** + * Overload of clone for use on an rvalue reference. + * + * @return A wrapped (Un)LocalizedNumberFormatter pointer, or a wrapped + * nullptr on failure. + * @stable ICU 64 + */ + LocalPointer<Derived> clone() &&; + + /** + * Sets the UErrorCode if an error occurred in the fluent chain. + * Preserves older error codes in the outErrorCode. + * @return TRUE if U_FAILURE(outErrorCode) + * @stable ICU 60 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const { + if (U_FAILURE(outErrorCode)) { + // Do not overwrite the older error code + return TRUE; + } + fMacros.copyErrorTo(outErrorCode); + return U_FAILURE(outErrorCode); + } + + // NOTE: Uses default copy and move constructors. + + private: + impl::MacroProps fMacros; + + // Don't construct me directly! Use (Un)LocalizedNumberFormatter. + NumberFormatterSettings() = default; + + friend class LocalizedNumberFormatter; + friend class UnlocalizedNumberFormatter; + + // Give NumberRangeFormatter access to the MacroProps + friend void impl::touchRangeLocales(impl::RangeMacroProps& macros); + friend class impl::NumberRangeFormatterImpl; +}; + +/** + * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified. + * + * Instances of this class are immutable and thread-safe. + * + * @see NumberFormatter + * @stable ICU 60 + */ +class U_I18N_API UnlocalizedNumberFormatter + : public NumberFormatterSettings<UnlocalizedNumberFormatter>, public UMemory { + + public: + /** + * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols, + * formats, and other data for number display. + * + * @param locale + * The locale to use when loading data for number formatting. + * @return The fluent chain. + * @stable ICU 60 + */ + LocalizedNumberFormatter locale(const icu::Locale &locale) const &; + + /** + * Overload of locale() for use on an rvalue reference. + * + * @param locale + * The locale to use when loading data for number formatting. + * @return The fluent chain. + * @see #locale + * @stable ICU 62 + */ + LocalizedNumberFormatter locale(const icu::Locale &locale) &&; + + /** + * Default constructor: puts the formatter into a valid but undefined state. + * + * @stable ICU 62 + */ + UnlocalizedNumberFormatter() = default; + + /** + * Returns a copy of this UnlocalizedNumberFormatter. + * @stable ICU 60 + */ + UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other); + + /** + * Move constructor: + * The source UnlocalizedNumberFormatter will be left in a valid but undefined state. + * @stable ICU 62 + */ + UnlocalizedNumberFormatter(UnlocalizedNumberFormatter&& src) U_NOEXCEPT; + + /** + * Copy assignment operator. + * @stable ICU 62 + */ + UnlocalizedNumberFormatter& operator=(const UnlocalizedNumberFormatter& other); + + /** + * Move assignment operator: + * The source UnlocalizedNumberFormatter will be left in a valid but undefined state. + * @stable ICU 62 + */ + UnlocalizedNumberFormatter& operator=(UnlocalizedNumberFormatter&& src) U_NOEXCEPT; + + private: + explicit UnlocalizedNumberFormatter(const NumberFormatterSettings<UnlocalizedNumberFormatter>& other); + + explicit UnlocalizedNumberFormatter( + NumberFormatterSettings<UnlocalizedNumberFormatter>&& src) U_NOEXCEPT; + + // To give the fluent setters access to this class's constructor: + friend class NumberFormatterSettings<UnlocalizedNumberFormatter>; + + // To give NumberFormatter::with() access to this class's constructor: + friend class NumberFormatter; +}; + +/** + * A NumberFormatter that has a locale associated with it; this means .format() methods are available. + * + * Instances of this class are immutable and thread-safe. + * + * @see NumberFormatter + * @stable ICU 60 + */ +class U_I18N_API LocalizedNumberFormatter + : public NumberFormatterSettings<LocalizedNumberFormatter>, public UMemory { + public: + /** + * Format the given integer number to a string using the settings specified in the NumberFormatter fluent + * setting chain. + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @stable ICU 60 + */ + FormattedNumber formatInt(int64_t value, UErrorCode &status) const; + + /** + * Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting + * chain. + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @stable ICU 60 + */ + FormattedNumber formatDouble(double value, UErrorCode &status) const; + + /** + * Format the given decimal number to a string using the settings + * specified in the NumberFormatter fluent setting chain. + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @stable ICU 60 + */ + FormattedNumber formatDecimal(StringPiece value, UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + + /** Internal method. + * @internal + */ + FormattedNumber formatDecimalQuantity(const impl::DecimalQuantity& dq, UErrorCode& status) const; + + /** Internal method for DecimalFormat compatibility. + * @internal + */ + void getAffixImpl(bool isPrefix, bool isNegative, UnicodeString& result, UErrorCode& status) const; + + /** + * Internal method for testing. + * @internal + */ + const impl::NumberFormatterImpl* getCompiled() const; + + /** + * Internal method for testing. + * @internal + */ + int32_t getCallCount() const; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Creates a representation of this LocalizedNumberFormat as an icu::Format, enabling the use + * of this number formatter with APIs that need an object of that type, such as MessageFormat. + * + * This API is not intended to be used other than for enabling API compatibility. The formatDouble, + * formatInt, and formatDecimal methods should normally be used when formatting numbers, not the Format + * object returned by this method. + * + * The caller owns the returned object and must delete it when finished. + * + * @return A Format wrapping this LocalizedNumberFormatter. + * @stable ICU 62 + */ + Format* toFormat(UErrorCode& status) const; + + /** + * Default constructor: puts the formatter into a valid but undefined state. + * + * @stable ICU 62 + */ + LocalizedNumberFormatter() = default; + + /** + * Returns a copy of this LocalizedNumberFormatter. + * @stable ICU 60 + */ + LocalizedNumberFormatter(const LocalizedNumberFormatter &other); + + /** + * Move constructor: + * The source LocalizedNumberFormatter will be left in a valid but undefined state. + * @stable ICU 62 + */ + LocalizedNumberFormatter(LocalizedNumberFormatter&& src) U_NOEXCEPT; + + /** + * Copy assignment operator. + * @stable ICU 62 + */ + LocalizedNumberFormatter& operator=(const LocalizedNumberFormatter& other); + + /** + * Move assignment operator: + * The source LocalizedNumberFormatter will be left in a valid but undefined state. + * @stable ICU 62 + */ + LocalizedNumberFormatter& operator=(LocalizedNumberFormatter&& src) U_NOEXCEPT; + +#ifndef U_HIDE_INTERNAL_API + + /** + * This is the core entrypoint to the number formatting pipeline. It performs self-regulation: a static code path + * for the first few calls, and compiling a more efficient data structure if called repeatedly. + * + * <p> + * This function is very hot, being called in every call to the number formatting pipeline. + * + * @param results + * The results object. This method will mutate it to save the results. + * @param status + * @internal + */ + void formatImpl(impl::UFormattedNumberData *results, UErrorCode &status) const; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Destruct this LocalizedNumberFormatter, cleaning up any memory it might own. + * @stable ICU 60 + */ + ~LocalizedNumberFormatter(); + + private: + // Note: fCompiled can't be a LocalPointer because impl::NumberFormatterImpl is defined in an internal + // header, and LocalPointer needs the full class definition in order to delete the instance. + const impl::NumberFormatterImpl* fCompiled {nullptr}; + char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t + + explicit LocalizedNumberFormatter(const NumberFormatterSettings<LocalizedNumberFormatter>& other); + + explicit LocalizedNumberFormatter(NumberFormatterSettings<LocalizedNumberFormatter>&& src) U_NOEXCEPT; + + LocalizedNumberFormatter(const impl::MacroProps ¯os, const Locale &locale); + + LocalizedNumberFormatter(impl::MacroProps &¯os, const Locale &locale); + + void clear(); + + void lnfMoveHelper(LocalizedNumberFormatter&& src); + + /** + * @return true if the compiled formatter is available. + */ + bool computeCompiled(UErrorCode& status) const; + + // To give the fluent setters access to this class's constructor: + friend class NumberFormatterSettings<UnlocalizedNumberFormatter>; + friend class NumberFormatterSettings<LocalizedNumberFormatter>; + + // To give UnlocalizedNumberFormatter::locale() access to this class's constructor: + friend class UnlocalizedNumberFormatter; +}; + +#if (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(_MSC_VER) +// Warning 4661. +#pragma warning(pop) +#endif + +/** + * The result of a number formatting operation. This class allows the result to be exported in several data types, + * including a UnicodeString and a FieldPositionIterator. + * + * Instances of this class are immutable and thread-safe. + * + * @stable ICU 60 + */ +class U_I18N_API FormattedNumber : public UMemory, public FormattedValue { + public: + + /** + * Default constructor; makes an empty FormattedNumber. + * @stable ICU 64 + */ + FormattedNumber() + : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} + + /** + * Move constructor: Leaves the source FormattedNumber in an undefined state. + * @stable ICU 62 + */ + FormattedNumber(FormattedNumber&& src) U_NOEXCEPT; + + /** + * Destruct an instance of FormattedNumber. + * @stable ICU 60 + */ + virtual ~FormattedNumber() U_OVERRIDE; + + /** Copying not supported; use move constructor instead. */ + FormattedNumber(const FormattedNumber&) = delete; + + /** Copying not supported; use move assignment instead. */ + FormattedNumber& operator=(const FormattedNumber&) = delete; + + /** + * Move assignment: Leaves the source FormattedNumber in an undefined state. + * @stable ICU 62 + */ + FormattedNumber& operator=(FormattedNumber&& src) U_NOEXCEPT; + + // Copybrief: this method is older than the parent method + /** + * @copybrief FormattedValue::toString() + * + * For more information, see FormattedValue::toString() + * + * @stable ICU 62 + */ + UnicodeString toString(UErrorCode& status) const U_OVERRIDE; + + // Copydoc: this method is new in ICU 64 + /** @copydoc FormattedValue::toTempString() */ + UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; + + // Copybrief: this method is older than the parent method + /** + * @copybrief FormattedValue::appendTo() + * + * For more information, see FormattedValue::appendTo() + * + * @stable ICU 62 + */ + Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; + + // Copydoc: this method is new in ICU 64 + /** @copydoc FormattedValue::nextPosition() */ + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + +#ifndef U_HIDE_DRAFT_API + /** + * Export the formatted number as a "numeric string" conforming to the + * syntax defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * This endpoint is useful for obtaining the exact number being printed + * after scaling and rounding have been applied by the number formatter. + * + * Example call site: + * + * auto decimalNumber = fn.toDecimalNumber<std::string>(status); + * + * @tparam StringClass A string class compatible with StringByteSink; + * for example, std::string. + * @param status Set if an error occurs. + * @return A StringClass containing the numeric string. + * @draft ICU 65 + */ + template<typename StringClass> + inline StringClass toDecimalNumber(UErrorCode& status) const; +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + + /** + * Gets the raw DecimalQuantity for plural rule selection. + * @internal + */ + void getDecimalQuantity(impl::DecimalQuantity& output, UErrorCode& status) const; + + /** + * Populates the mutable builder type FieldPositionIteratorHandler. + * @internal + */ + void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; + +#endif /* U_HIDE_INTERNAL_API */ + + private: + // Can't use LocalPointer because UFormattedNumberData is forward-declared + const impl::UFormattedNumberData *fData; + + // Error code for the terminal methods + UErrorCode fErrorCode; + + /** + * Internal constructor from data type. Adopts the data pointer. + * @internal + */ + explicit FormattedNumber(impl::UFormattedNumberData *results) + : fData(results), fErrorCode(U_ZERO_ERROR) {} + + explicit FormattedNumber(UErrorCode errorCode) + : fData(nullptr), fErrorCode(errorCode) {} + + // TODO(ICU-20775): Propose this as API. + void toDecimalNumber(ByteSink& sink, UErrorCode& status) const; + + // To give LocalizedNumberFormatter format methods access to this class's constructor: + friend class LocalizedNumberFormatter; + + // To give C API access to internals + friend struct impl::UFormattedNumberImpl; +}; + +#ifndef U_HIDE_DRAFT_API +// Note: This is draft ICU 65 +template<typename StringClass> +StringClass FormattedNumber::toDecimalNumber(UErrorCode& status) const { + StringClass result; + StringByteSink<StringClass> sink(&result); + toDecimalNumber(sink, status); + return result; +} +#endif // U_HIDE_DRAFT_API + +/** + * See the main description in numberformatter.h for documentation and examples. + * + * @stable ICU 60 + */ +class U_I18N_API NumberFormatter final { + public: + /** + * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not currently known at + * the call site. + * + * @return An {@link UnlocalizedNumberFormatter}, to be used for chaining. + * @stable ICU 60 + */ + static UnlocalizedNumberFormatter with(); + + /** + * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at the call + * site. + * + * @param locale + * The locale from which to load formats and symbols for number formatting. + * @return A {@link LocalizedNumberFormatter}, to be used for chaining. + * @stable ICU 60 + */ + static LocalizedNumberFormatter withLocale(const Locale &locale); + + /** + * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based + * on a given number skeleton string. + * + * It is possible for an error to occur while parsing. See the overload of this method if you are + * interested in the location of a possible parse error. + * + * @param skeleton + * The skeleton string off of which to base this NumberFormatter. + * @param status + * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid. + * @return An UnlocalizedNumberFormatter, to be used for chaining. + * @stable ICU 62 + */ + static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status); + + /** + * Call this method at the beginning of a NumberFormatter fluent chain to create an instance based + * on a given number skeleton string. + * + * If an error occurs while parsing the skeleton string, the offset into the skeleton string at + * which the error occurred will be saved into the UParseError, if provided. + * + * @param skeleton + * The skeleton string off of which to base this NumberFormatter. + * @param perror + * A parse error struct populated if an error occurs when parsing. + * If no error occurs, perror.offset will be set to -1. + * @param status + * Set to U_NUMBER_SKELETON_SYNTAX_ERROR if the skeleton was invalid. + * @return An UnlocalizedNumberFormatter, to be used for chaining. + * @stable ICU 64 + */ + static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, + UParseError& perror, UErrorCode& status); + + /** + * Use factory methods instead of the constructor to create a NumberFormatter. + */ + NumberFormatter() = delete; +}; + +} // namespace number +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __NUMBERFORMATTER_H__ + diff --git a/contrib/libs/icu/include/unicode/numberrangeformatter.h b/contrib/libs/icu/include/unicode/numberrangeformatter.h index 4d436a7694..e72ad60ebd 100644 --- a/contrib/libs/icu/include/unicode/numberrangeformatter.h +++ b/contrib/libs/icu/include/unicode/numberrangeformatter.h @@ -1,866 +1,866 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#ifndef __NUMBERRANGEFORMATTER_H__ -#define __NUMBERRANGEFORMATTER_H__ - -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#if !UCONFIG_NO_FORMATTING - -#include <atomic> -#include "unicode/appendable.h" -#include "unicode/fieldpos.h" -#include "unicode/formattedvalue.h" -#include "unicode/fpositer.h" -#include "unicode/numberformatter.h" - -/** - * \file - * \brief C++ API: Library for localized formatting of number, currency, and unit ranges. - * - * The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement. - * <p> - * Usage example: - * <p> - * <pre> - * NumberRangeFormatter::with() - * .identityFallback(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE) - * .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter())) - * .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer())) - * .locale("en-GB") - * .formatRange(750, 1.2, status) - * .toString(status); - * // => "750 m - 1.2 km" - * </pre> - * <p> - * Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter - * and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on the - * <em>fluent</em> design pattern popularized by libraries such as Google's Guava. - * - * @author Shane Carr - */ - - -/** - * Defines how to merge fields that are identical across the range sign. - * - * @stable ICU 63 - */ -typedef enum UNumberRangeCollapse { - /** - * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none, - * some, or all repeated pieces in a locale-sensitive way. - * - * The heuristics used for this option are subject to change over time. - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_AUTO, - - /** - * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_NONE, - - /** - * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand - * kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_UNIT, - - /** - * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the - * number. Example: "3.2 – 5.3 thousand kilograms" - * - * @stable ICU 63 - */ - UNUM_RANGE_COLLAPSE_ALL -} UNumberRangeCollapse; - -/** - * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect - * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ -typedef enum UNumberRangeIdentityFallback { - /** - * Show the number as a single value rather than a range. Example: "$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_SINGLE_VALUE, - - /** - * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding, - * show the single value. Example: "~$5" or "$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, - - /** - * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the - * inputs are the same. Example: "~$5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_APPROXIMATELY, - - /** - * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the - * same. Example (with RangeCollapse.NONE): "$5 – $5" - * - * @stable ICU 63 - */ - UNUM_IDENTITY_FALLBACK_RANGE -} UNumberRangeIdentityFallback; - -/** - * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range - * were equal or not, and whether or not the identity fallback was applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ -typedef enum UNumberRangeIdentityResult { - /** - * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING, - - /** - * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING, - - /** - * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied. - * - * @stable ICU 63 - * @see NumberRangeFormatter - */ - UNUM_IDENTITY_RESULT_NOT_EQUAL, - -#ifndef U_HIDE_INTERNAL_API - /** - * The number of entries in this enum. - * @internal - */ - UNUM_IDENTITY_RESULT_COUNT -#endif - -} UNumberRangeIdentityResult; - -U_NAMESPACE_BEGIN - -namespace number { // icu::number - -// Forward declarations: -class UnlocalizedNumberRangeFormatter; -class LocalizedNumberRangeFormatter; -class FormattedNumberRange; - -namespace impl { - -// Forward declarations: -struct RangeMacroProps; -class DecimalQuantity; -class UFormattedNumberRangeData; -class NumberRangeFormatterImpl; - -} // namespace impl - -/** - * \cond - * Export an explicit template instantiation. See datefmt.h - * (When building DLLs for Windows this is required.) - */ -#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN) -} // namespace icu::number -U_NAMESPACE_END - -template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>; - -U_NAMESPACE_BEGIN -namespace number { // icu::number -#endif -/** \endcond */ - -// Other helper classes would go here, but there are none. - -namespace impl { // icu::number::impl - -// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field -/** @internal */ -struct U_I18N_API RangeMacroProps : public UMemory { - /** @internal */ - UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with(); - - /** @internal */ - UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with(); - - /** @internal */ - bool singleFormatter = true; - - /** @internal */ - UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO; - - /** @internal */ - UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY; - - /** @internal */ - Locale locale; - - // NOTE: Uses default copy and move constructors. - - /** - * Check all members for errors. - * @internal - */ - bool copyErrorTo(UErrorCode &status) const { - return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status); - } -}; - -} // namespace impl - -/** - * An abstract base class for specifying settings related to number formatting. This class is implemented by - * {@link UnlocalizedNumberRangeFormatter} and {@link LocalizedNumberRangeFormatter}. This class is not intended for - * public subclassing. - */ -template<typename Derived> -class U_I18N_API NumberRangeFormatterSettings { - public: - /** - * Sets the NumberFormatter instance to use for the numbers in the range. The same formatter is applied to both - * sides of the range. - * <p> - * The NumberFormatter instances must not have a locale applied yet; the locale specified on the - * NumberRangeFormatter will be used. - * - * @param formatter - * The formatter to use for both numbers in the range. - * @return The fluent chain. - * @stable ICU 63 - */ - Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &; - - /** - * Overload of numberFormatterBoth() for use on an rvalue reference. - * - * @param formatter - * The formatter to use for both numbers in the range. - * @return The fluent chain. - * @see #numberFormatterBoth - * @stable ICU 63 - */ - Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&; - - /** - * Overload of numberFormatterBoth() for use on an rvalue reference. - * - * @param formatter - * The formatter to use for both numbers in the range. - * @return The fluent chain. - * @see #numberFormatterBoth - * @stable ICU 63 - */ - Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &; - - /** - * Overload of numberFormatterBoth() for use on an rvalue reference. - * - * @param formatter - * The formatter to use for both numbers in the range. - * @return The fluent chain. - * @see #numberFormatterBoth - * @stable ICU 63 - */ - Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&; - - /** - * Sets the NumberFormatter instance to use for the first number in the range. - * <p> - * The NumberFormatter instances must not have a locale applied yet; the locale specified on the - * NumberRangeFormatter will be used. - * - * @param formatterFirst - * The formatter to use for the first number in the range. - * @return The fluent chain. - * @stable ICU 63 - */ - Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &; - - /** - * Overload of numberFormatterFirst() for use on an rvalue reference. - * - * @param formatterFirst - * The formatter to use for the first number in the range. - * @return The fluent chain. - * @see #numberFormatterFirst - * @stable ICU 63 - */ - Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&; - - /** - * Overload of numberFormatterFirst() for use on an rvalue reference. - * - * @param formatterFirst - * The formatter to use for the first number in the range. - * @return The fluent chain. - * @see #numberFormatterFirst - * @stable ICU 63 - */ - Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &; - - /** - * Overload of numberFormatterFirst() for use on an rvalue reference. - * - * @param formatterFirst - * The formatter to use for the first number in the range. - * @return The fluent chain. - * @see #numberFormatterFirst - * @stable ICU 63 - */ - Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&; - - /** - * Sets the NumberFormatter instance to use for the second number in the range. - * <p> - * The NumberFormatter instances must not have a locale applied yet; the locale specified on the - * NumberRangeFormatter will be used. - * - * @param formatterSecond - * The formatter to use for the second number in the range. - * @return The fluent chain. - * @stable ICU 63 - */ - Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &; - - /** - * Overload of numberFormatterSecond() for use on an rvalue reference. - * - * @param formatterSecond - * The formatter to use for the second number in the range. - * @return The fluent chain. - * @see #numberFormatterSecond - * @stable ICU 63 - */ - Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&; - - /** - * Overload of numberFormatterSecond() for use on an rvalue reference. - * - * @param formatterSecond - * The formatter to use for the second number in the range. - * @return The fluent chain. - * @see #numberFormatterSecond - * @stable ICU 63 - */ - Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &; - - /** - * Overload of numberFormatterSecond() for use on an rvalue reference. - * - * @param formatterSecond - * The formatter to use for the second number in the range. - * @return The fluent chain. - * @see #numberFormatterSecond - * @stable ICU 63 - */ - Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&; - - /** - * Sets the aggressiveness of "collapsing" fields across the range separator. Possible values: - * <p> - * <ul> - * <li>ALL: "3-5K miles"</li> - * <li>UNIT: "3K - 5K miles"</li> - * <li>NONE: "3K miles - 5K miles"</li> - * <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li> - * </ul> - * <p> - * The default value is AUTO. - * - * @param collapse - * The collapsing strategy to use for this range. - * @return The fluent chain. - * @stable ICU 63 - */ - Derived collapse(UNumberRangeCollapse collapse) const &; - - /** - * Overload of collapse() for use on an rvalue reference. - * - * @param collapse - * The collapsing strategy to use for this range. - * @return The fluent chain. - * @see #collapse - * @stable ICU 63 - */ - Derived collapse(UNumberRangeCollapse collapse) &&; - - /** - * Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are - * passed to the formatRange function, or if different numbers are passed to the function but they become the same - * after rounding rules are applied. Possible values: - * <p> - * <ul> - * <li>SINGLE_VALUE: "5 miles"</li> - * <li>APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before - * rounding was applied</li> - * <li>APPROXIMATELY: "~5 miles"</li> - * <li>RANGE: "5-5 miles" (with collapse=UNIT)</li> - * </ul> - * <p> - * The default value is APPROXIMATELY. - * - * @param identityFallback - * The strategy to use when formatting two numbers that end up being the same. - * @return The fluent chain. - * @stable ICU 63 - */ - Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &; - - /** - * Overload of identityFallback() for use on an rvalue reference. - * - * @param identityFallback - * The strategy to use when formatting two numbers that end up being the same. - * @return The fluent chain. - * @see #identityFallback - * @stable ICU 63 - */ - Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&; - - /** - * Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer - * wrapping a heap-allocated copy of the current object. - * - * This is equivalent to new-ing the move constructor with a value object - * as the argument. - * - * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped - * nullptr on failure. - * @stable ICU 64 - */ - LocalPointer<Derived> clone() const &; - - /** - * Overload of clone for use on an rvalue reference. - * - * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped - * nullptr on failure. - * @stable ICU 64 - */ - LocalPointer<Derived> clone() &&; - - /** - * Sets the UErrorCode if an error occurred in the fluent chain. - * Preserves older error codes in the outErrorCode. - * @return TRUE if U_FAILURE(outErrorCode) - * @stable ICU 63 - */ - UBool copyErrorTo(UErrorCode &outErrorCode) const { - if (U_FAILURE(outErrorCode)) { - // Do not overwrite the older error code - return TRUE; - } - fMacros.copyErrorTo(outErrorCode); - return U_FAILURE(outErrorCode); - } - - // NOTE: Uses default copy and move constructors. - - private: - impl::RangeMacroProps fMacros; - - // Don't construct me directly! Use (Un)LocalizedNumberFormatter. - NumberRangeFormatterSettings() = default; - - friend class LocalizedNumberRangeFormatter; - friend class UnlocalizedNumberRangeFormatter; -}; - -/** - * A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified. - * - * Instances of this class are immutable and thread-safe. - * - * @see NumberRangeFormatter - * @stable ICU 63 - */ -class U_I18N_API UnlocalizedNumberRangeFormatter - : public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory { - - public: - /** - * Associate the given locale with the number range formatter. The locale is used for picking the - * appropriate symbols, formats, and other data for number display. - * - * @param locale - * The locale to use when loading data for number formatting. - * @return The fluent chain. - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &; - - /** - * Overload of locale() for use on an rvalue reference. - * - * @param locale - * The locale to use when loading data for number formatting. - * @return The fluent chain. - * @see #locale - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&; - - /** - * Default constructor: puts the formatter into a valid but undefined state. - * - * @stable ICU 63 - */ - UnlocalizedNumberRangeFormatter() = default; - - /** - * Returns a copy of this UnlocalizedNumberRangeFormatter. - * @stable ICU 63 - */ - UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other); - - /** - * Move constructor: - * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state. - * @stable ICU 63 - */ - UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT; - - /** - * Copy assignment operator. - * @stable ICU 63 - */ - UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other); - - /** - * Move assignment operator: - * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state. - * @stable ICU 63 - */ - UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT; - - private: - explicit UnlocalizedNumberRangeFormatter( - const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other); - - explicit UnlocalizedNumberRangeFormatter( - NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) U_NOEXCEPT; - - // To give the fluent setters access to this class's constructor: - friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>; - - // To give NumberRangeFormatter::with() access to this class's constructor: - friend class NumberRangeFormatter; -}; - -/** - * A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available. - * - * Instances of this class are immutable and thread-safe. - * - * @see NumberFormatter - * @stable ICU 63 - */ -class U_I18N_API LocalizedNumberRangeFormatter - : public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory { - public: - /** - * Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting - * chain. - * - * @param first - * The first number in the range, usually to the left in LTR locales. - * @param second - * The second number in the range, usually to the right in LTR locales. - * @param status - * Set if an error occurs while formatting. - * @return A FormattedNumberRange object; call .toString() to get the string. - * @stable ICU 63 - */ - FormattedNumberRange formatFormattableRange( - const Formattable& first, const Formattable& second, UErrorCode& status) const; - - /** - * Default constructor: puts the formatter into a valid but undefined state. - * - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter() = default; - - /** - * Returns a copy of this LocalizedNumberRangeFormatter. - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other); - - /** - * Move constructor: - * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state. - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT; - - /** - * Copy assignment operator. - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other); - - /** - * Move assignment operator: - * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state. - * @stable ICU 63 - */ - LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT; - -#ifndef U_HIDE_INTERNAL_API - - /** - * @param results - * The results object. This method will mutate it to save the results. - * @param equalBeforeRounding - * Whether the number was equal before copying it into a DecimalQuantity. - * Used for determining the identity fallback behavior. - * @param status - * Set if an error occurs while formatting. - * @internal - */ - void formatImpl(impl::UFormattedNumberRangeData& results, bool equalBeforeRounding, - UErrorCode& status) const; - -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own. - * @stable ICU 63 - */ - ~LocalizedNumberRangeFormatter(); - - private: - std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {}; - - const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const; - - explicit LocalizedNumberRangeFormatter( - const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other); - - explicit LocalizedNumberRangeFormatter( - NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) U_NOEXCEPT; - - LocalizedNumberRangeFormatter(const impl::RangeMacroProps ¯os, const Locale &locale); - - LocalizedNumberRangeFormatter(impl::RangeMacroProps &¯os, const Locale &locale); - - void clear(); - - // To give the fluent setters access to this class's constructor: - friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>; - friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>; - - // To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor: - friend class UnlocalizedNumberRangeFormatter; -}; - -/** - * The result of a number range formatting operation. This class allows the result to be exported in several data types, - * including a UnicodeString and a FieldPositionIterator. - * - * Instances of this class are immutable and thread-safe. - * - * @stable ICU 63 - */ -class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { - public: - // Copybrief: this method is older than the parent method - /** - * @copybrief FormattedValue::toString() - * - * For more information, see FormattedValue::toString() - * - * @stable ICU 63 - */ - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - - // Copydoc: this method is new in ICU 64 - /** @copydoc FormattedValue::toTempString() */ - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - - // Copybrief: this method is older than the parent method - /** - * @copybrief FormattedValue::appendTo() - * - * For more information, see FormattedValue::appendTo() - * - * @stable ICU 63 - */ - Appendable &appendTo(Appendable &appendable, UErrorCode& status) const U_OVERRIDE; - - // Copydoc: this method is new in ICU 64 - /** @copydoc FormattedValue::nextPosition() */ - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; - -#ifndef U_HIDE_DRAFT_API - /** - * Export the first formatted number as a decimal number. This endpoint - * is useful for obtaining the exact number being printed after scaling - * and rounding have been applied by the number range formatting pipeline. - * - * The syntax of the unformatted number is a "numeric string" - * as defined in the Decimal Arithmetic Specification, available at - * http://speleotrove.com/decimal - * - * @return A decimal representation of the first formatted number. - * @draft ICU 63 - * @see NumberRangeFormatter - * @see #getSecondDecimal - */ - UnicodeString getFirstDecimal(UErrorCode& status) const; - - /** - * Export the second formatted number as a decimal number. This endpoint - * is useful for obtaining the exact number being printed after scaling - * and rounding have been applied by the number range formatting pipeline. - * - * The syntax of the unformatted number is a "numeric string" - * as defined in the Decimal Arithmetic Specification, available at - * http://speleotrove.com/decimal - * - * @return A decimal representation of the second formatted number. - * @draft ICU 63 - * @see NumberRangeFormatter - * @see #getFirstDecimal - */ - UnicodeString getSecondDecimal(UErrorCode& status) const; -#endif // U_HIDE_DRAFT_API - - /** - * Returns whether the pair of numbers was successfully formatted as a range or whether an identity fallback was - * used. For example, if the first and second number were the same either before or after rounding occurred, an - * identity fallback was used. - * - * @return An indication the resulting identity situation in the formatted number range. - * @stable ICU 63 - * @see UNumberRangeIdentityFallback - */ - UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const; - - /** - * Copying not supported; use move constructor instead. - */ - FormattedNumberRange(const FormattedNumberRange&) = delete; - - /** - * Copying not supported; use move assignment instead. - */ - FormattedNumberRange& operator=(const FormattedNumberRange&) = delete; - - /** - * Move constructor: - * Leaves the source FormattedNumberRange in an undefined state. - * @stable ICU 63 - */ - FormattedNumberRange(FormattedNumberRange&& src) U_NOEXCEPT; - - /** - * Move assignment: - * Leaves the source FormattedNumberRange in an undefined state. - * @stable ICU 63 - */ - FormattedNumberRange& operator=(FormattedNumberRange&& src) U_NOEXCEPT; - - /** - * Destruct an instance of FormattedNumberRange, cleaning up any memory it might own. - * @stable ICU 63 - */ - ~FormattedNumberRange(); - - private: - // Can't use LocalPointer because UFormattedNumberRangeData is forward-declared - const impl::UFormattedNumberRangeData *fData; - - // Error code for the terminal methods - UErrorCode fErrorCode; - - /** - * Internal constructor from data type. Adopts the data pointer. - */ - explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results) - : fData(results), fErrorCode(U_ZERO_ERROR) {} - - explicit FormattedNumberRange(UErrorCode errorCode) - : fData(nullptr), fErrorCode(errorCode) {} - - void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; - - // To give LocalizedNumberRangeFormatter format methods access to this class's constructor: - friend class LocalizedNumberRangeFormatter; -}; - -/** - * See the main description in numberrangeformatter.h for documentation and examples. - * - * @stable ICU 63 - */ -class U_I18N_API NumberRangeFormatter final { - public: - /** - * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is not currently - * known at the call site. - * - * @return An {@link UnlocalizedNumberRangeFormatter}, to be used for chaining. - * @stable ICU 63 - */ - static UnlocalizedNumberRangeFormatter with(); - - /** - * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known at the call - * site. - * - * @param locale - * The locale from which to load formats and symbols for number range formatting. - * @return A {@link LocalizedNumberRangeFormatter}, to be used for chaining. - * @stable ICU 63 - */ - static LocalizedNumberRangeFormatter withLocale(const Locale &locale); - - /** - * Use factory methods instead of the constructor to create a NumberFormatter. - */ - NumberRangeFormatter() = delete; -}; - -} // namespace number -U_NAMESPACE_END - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - -#endif // __NUMBERRANGEFORMATTER_H__ - +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __NUMBERRANGEFORMATTER_H__ +#define __NUMBERRANGEFORMATTER_H__ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + +#include <atomic> +#include "unicode/appendable.h" +#include "unicode/fieldpos.h" +#include "unicode/formattedvalue.h" +#include "unicode/fpositer.h" +#include "unicode/numberformatter.h" + +/** + * \file + * \brief C++ API: Library for localized formatting of number, currency, and unit ranges. + * + * The main entrypoint to the formatting of ranges of numbers, including currencies and other units of measurement. + * <p> + * Usage example: + * <p> + * <pre> + * NumberRangeFormatter::with() + * .identityFallback(UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE) + * .numberFormatterFirst(NumberFormatter::with().adoptUnit(MeasureUnit::createMeter())) + * .numberFormatterSecond(NumberFormatter::with().adoptUnit(MeasureUnit::createKilometer())) + * .locale("en-GB") + * .formatRange(750, 1.2, status) + * .toString(status); + * // => "750 m - 1.2 km" + * </pre> + * <p> + * Like NumberFormatter, NumberRangeFormatter instances (i.e., LocalizedNumberRangeFormatter + * and UnlocalizedNumberRangeFormatter) are immutable and thread-safe. This API is based on the + * <em>fluent</em> design pattern popularized by libraries such as Google's Guava. + * + * @author Shane Carr + */ + + +/** + * Defines how to merge fields that are identical across the range sign. + * + * @stable ICU 63 + */ +typedef enum UNumberRangeCollapse { + /** + * Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none, + * some, or all repeated pieces in a locale-sensitive way. + * + * The heuristics used for this option are subject to change over time. + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_AUTO, + + /** + * Do not collapse any part of the number. Example: "3.2 thousand kilograms – 5.3 thousand kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_NONE, + + /** + * Collapse the unit part of the number, but not the notation, if present. Example: "3.2 thousand – 5.3 thousand + * kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_UNIT, + + /** + * Collapse any field that is equal across the range sign. May introduce ambiguity on the magnitude of the + * number. Example: "3.2 – 5.3 thousand kilograms" + * + * @stable ICU 63 + */ + UNUM_RANGE_COLLAPSE_ALL +} UNumberRangeCollapse; + +/** + * Defines the behavior when the two numbers in the range are identical after rounding. To programmatically detect + * when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ +typedef enum UNumberRangeIdentityFallback { + /** + * Show the number as a single value rather than a range. Example: "$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_SINGLE_VALUE, + + /** + * Show the number using a locale-sensitive approximation pattern. If the numbers were the same before rounding, + * show the single value. Example: "~$5" or "$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, + + /** + * Show the number using a locale-sensitive approximation pattern. Use the range pattern always, even if the + * inputs are the same. Example: "~$5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_APPROXIMATELY, + + /** + * Show the number as the range of two equal values. Use the range pattern always, even if the inputs are the + * same. Example (with RangeCollapse.NONE): "$5 – $5" + * + * @stable ICU 63 + */ + UNUM_IDENTITY_FALLBACK_RANGE +} UNumberRangeIdentityFallback; + +/** + * Used in the result class FormattedNumberRange to indicate to the user whether the numbers formatted in the range + * were equal or not, and whether or not the identity fallback was applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ +typedef enum UNumberRangeIdentityResult { + /** + * Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING, + + /** + * Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING, + + /** + * Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied. + * + * @stable ICU 63 + * @see NumberRangeFormatter + */ + UNUM_IDENTITY_RESULT_NOT_EQUAL, + +#ifndef U_HIDE_INTERNAL_API + /** + * The number of entries in this enum. + * @internal + */ + UNUM_IDENTITY_RESULT_COUNT +#endif + +} UNumberRangeIdentityResult; + +U_NAMESPACE_BEGIN + +namespace number { // icu::number + +// Forward declarations: +class UnlocalizedNumberRangeFormatter; +class LocalizedNumberRangeFormatter; +class FormattedNumberRange; + +namespace impl { + +// Forward declarations: +struct RangeMacroProps; +class DecimalQuantity; +class UFormattedNumberRangeData; +class NumberRangeFormatterImpl; + +} // namespace impl + +/** + * \cond + * Export an explicit template instantiation. See datefmt.h + * (When building DLLs for Windows this is required.) + */ +#if U_PLATFORM == U_PF_WINDOWS && !defined(U_IN_DOXYGEN) +} // namespace icu::number +U_NAMESPACE_END + +template struct U_I18N_API std::atomic< U_NAMESPACE_QUALIFIER number::impl::NumberRangeFormatterImpl*>; + +U_NAMESPACE_BEGIN +namespace number { // icu::number +#endif +/** \endcond */ + +// Other helper classes would go here, but there are none. + +namespace impl { // icu::number::impl + +// Do not enclose entire MacroProps with #ifndef U_HIDE_INTERNAL_API, needed for a protected field +/** @internal */ +struct U_I18N_API RangeMacroProps : public UMemory { + /** @internal */ + UnlocalizedNumberFormatter formatter1; // = NumberFormatter::with(); + + /** @internal */ + UnlocalizedNumberFormatter formatter2; // = NumberFormatter::with(); + + /** @internal */ + bool singleFormatter = true; + + /** @internal */ + UNumberRangeCollapse collapse = UNUM_RANGE_COLLAPSE_AUTO; + + /** @internal */ + UNumberRangeIdentityFallback identityFallback = UNUM_IDENTITY_FALLBACK_APPROXIMATELY; + + /** @internal */ + Locale locale; + + // NOTE: Uses default copy and move constructors. + + /** + * Check all members for errors. + * @internal + */ + bool copyErrorTo(UErrorCode &status) const { + return formatter1.copyErrorTo(status) || formatter2.copyErrorTo(status); + } +}; + +} // namespace impl + +/** + * An abstract base class for specifying settings related to number formatting. This class is implemented by + * {@link UnlocalizedNumberRangeFormatter} and {@link LocalizedNumberRangeFormatter}. This class is not intended for + * public subclassing. + */ +template<typename Derived> +class U_I18N_API NumberRangeFormatterSettings { + public: + /** + * Sets the NumberFormatter instance to use for the numbers in the range. The same formatter is applied to both + * sides of the range. + * <p> + * The NumberFormatter instances must not have a locale applied yet; the locale specified on the + * NumberRangeFormatter will be used. + * + * @param formatter + * The formatter to use for both numbers in the range. + * @return The fluent chain. + * @stable ICU 63 + */ + Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) const &; + + /** + * Overload of numberFormatterBoth() for use on an rvalue reference. + * + * @param formatter + * The formatter to use for both numbers in the range. + * @return The fluent chain. + * @see #numberFormatterBoth + * @stable ICU 63 + */ + Derived numberFormatterBoth(const UnlocalizedNumberFormatter &formatter) &&; + + /** + * Overload of numberFormatterBoth() for use on an rvalue reference. + * + * @param formatter + * The formatter to use for both numbers in the range. + * @return The fluent chain. + * @see #numberFormatterBoth + * @stable ICU 63 + */ + Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) const &; + + /** + * Overload of numberFormatterBoth() for use on an rvalue reference. + * + * @param formatter + * The formatter to use for both numbers in the range. + * @return The fluent chain. + * @see #numberFormatterBoth + * @stable ICU 63 + */ + Derived numberFormatterBoth(UnlocalizedNumberFormatter &&formatter) &&; + + /** + * Sets the NumberFormatter instance to use for the first number in the range. + * <p> + * The NumberFormatter instances must not have a locale applied yet; the locale specified on the + * NumberRangeFormatter will be used. + * + * @param formatterFirst + * The formatter to use for the first number in the range. + * @return The fluent chain. + * @stable ICU 63 + */ + Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) const &; + + /** + * Overload of numberFormatterFirst() for use on an rvalue reference. + * + * @param formatterFirst + * The formatter to use for the first number in the range. + * @return The fluent chain. + * @see #numberFormatterFirst + * @stable ICU 63 + */ + Derived numberFormatterFirst(const UnlocalizedNumberFormatter &formatterFirst) &&; + + /** + * Overload of numberFormatterFirst() for use on an rvalue reference. + * + * @param formatterFirst + * The formatter to use for the first number in the range. + * @return The fluent chain. + * @see #numberFormatterFirst + * @stable ICU 63 + */ + Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) const &; + + /** + * Overload of numberFormatterFirst() for use on an rvalue reference. + * + * @param formatterFirst + * The formatter to use for the first number in the range. + * @return The fluent chain. + * @see #numberFormatterFirst + * @stable ICU 63 + */ + Derived numberFormatterFirst(UnlocalizedNumberFormatter &&formatterFirst) &&; + + /** + * Sets the NumberFormatter instance to use for the second number in the range. + * <p> + * The NumberFormatter instances must not have a locale applied yet; the locale specified on the + * NumberRangeFormatter will be used. + * + * @param formatterSecond + * The formatter to use for the second number in the range. + * @return The fluent chain. + * @stable ICU 63 + */ + Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) const &; + + /** + * Overload of numberFormatterSecond() for use on an rvalue reference. + * + * @param formatterSecond + * The formatter to use for the second number in the range. + * @return The fluent chain. + * @see #numberFormatterSecond + * @stable ICU 63 + */ + Derived numberFormatterSecond(const UnlocalizedNumberFormatter &formatterSecond) &&; + + /** + * Overload of numberFormatterSecond() for use on an rvalue reference. + * + * @param formatterSecond + * The formatter to use for the second number in the range. + * @return The fluent chain. + * @see #numberFormatterSecond + * @stable ICU 63 + */ + Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) const &; + + /** + * Overload of numberFormatterSecond() for use on an rvalue reference. + * + * @param formatterSecond + * The formatter to use for the second number in the range. + * @return The fluent chain. + * @see #numberFormatterSecond + * @stable ICU 63 + */ + Derived numberFormatterSecond(UnlocalizedNumberFormatter &&formatterSecond) &&; + + /** + * Sets the aggressiveness of "collapsing" fields across the range separator. Possible values: + * <p> + * <ul> + * <li>ALL: "3-5K miles"</li> + * <li>UNIT: "3K - 5K miles"</li> + * <li>NONE: "3K miles - 5K miles"</li> + * <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li> + * </ul> + * <p> + * The default value is AUTO. + * + * @param collapse + * The collapsing strategy to use for this range. + * @return The fluent chain. + * @stable ICU 63 + */ + Derived collapse(UNumberRangeCollapse collapse) const &; + + /** + * Overload of collapse() for use on an rvalue reference. + * + * @param collapse + * The collapsing strategy to use for this range. + * @return The fluent chain. + * @see #collapse + * @stable ICU 63 + */ + Derived collapse(UNumberRangeCollapse collapse) &&; + + /** + * Sets the behavior when the two sides of the range are the same. This could happen if the same two numbers are + * passed to the formatRange function, or if different numbers are passed to the function but they become the same + * after rounding rules are applied. Possible values: + * <p> + * <ul> + * <li>SINGLE_VALUE: "5 miles"</li> + * <li>APPROXIMATELY_OR_SINGLE_VALUE: "~5 miles" or "5 miles", depending on whether the number was the same before + * rounding was applied</li> + * <li>APPROXIMATELY: "~5 miles"</li> + * <li>RANGE: "5-5 miles" (with collapse=UNIT)</li> + * </ul> + * <p> + * The default value is APPROXIMATELY. + * + * @param identityFallback + * The strategy to use when formatting two numbers that end up being the same. + * @return The fluent chain. + * @stable ICU 63 + */ + Derived identityFallback(UNumberRangeIdentityFallback identityFallback) const &; + + /** + * Overload of identityFallback() for use on an rvalue reference. + * + * @param identityFallback + * The strategy to use when formatting two numbers that end up being the same. + * @return The fluent chain. + * @see #identityFallback + * @stable ICU 63 + */ + Derived identityFallback(UNumberRangeIdentityFallback identityFallback) &&; + + /** + * Returns the current (Un)LocalizedNumberRangeFormatter as a LocalPointer + * wrapping a heap-allocated copy of the current object. + * + * This is equivalent to new-ing the move constructor with a value object + * as the argument. + * + * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped + * nullptr on failure. + * @stable ICU 64 + */ + LocalPointer<Derived> clone() const &; + + /** + * Overload of clone for use on an rvalue reference. + * + * @return A wrapped (Un)LocalizedNumberRangeFormatter pointer, or a wrapped + * nullptr on failure. + * @stable ICU 64 + */ + LocalPointer<Derived> clone() &&; + + /** + * Sets the UErrorCode if an error occurred in the fluent chain. + * Preserves older error codes in the outErrorCode. + * @return TRUE if U_FAILURE(outErrorCode) + * @stable ICU 63 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const { + if (U_FAILURE(outErrorCode)) { + // Do not overwrite the older error code + return TRUE; + } + fMacros.copyErrorTo(outErrorCode); + return U_FAILURE(outErrorCode); + } + + // NOTE: Uses default copy and move constructors. + + private: + impl::RangeMacroProps fMacros; + + // Don't construct me directly! Use (Un)LocalizedNumberFormatter. + NumberRangeFormatterSettings() = default; + + friend class LocalizedNumberRangeFormatter; + friend class UnlocalizedNumberRangeFormatter; +}; + +/** + * A NumberRangeFormatter that does not yet have a locale. In order to format, a locale must be specified. + * + * Instances of this class are immutable and thread-safe. + * + * @see NumberRangeFormatter + * @stable ICU 63 + */ +class U_I18N_API UnlocalizedNumberRangeFormatter + : public NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>, public UMemory { + + public: + /** + * Associate the given locale with the number range formatter. The locale is used for picking the + * appropriate symbols, formats, and other data for number display. + * + * @param locale + * The locale to use when loading data for number formatting. + * @return The fluent chain. + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter locale(const icu::Locale &locale) const &; + + /** + * Overload of locale() for use on an rvalue reference. + * + * @param locale + * The locale to use when loading data for number formatting. + * @return The fluent chain. + * @see #locale + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter locale(const icu::Locale &locale) &&; + + /** + * Default constructor: puts the formatter into a valid but undefined state. + * + * @stable ICU 63 + */ + UnlocalizedNumberRangeFormatter() = default; + + /** + * Returns a copy of this UnlocalizedNumberRangeFormatter. + * @stable ICU 63 + */ + UnlocalizedNumberRangeFormatter(const UnlocalizedNumberRangeFormatter &other); + + /** + * Move constructor: + * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state. + * @stable ICU 63 + */ + UnlocalizedNumberRangeFormatter(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT; + + /** + * Copy assignment operator. + * @stable ICU 63 + */ + UnlocalizedNumberRangeFormatter& operator=(const UnlocalizedNumberRangeFormatter& other); + + /** + * Move assignment operator: + * The source UnlocalizedNumberRangeFormatter will be left in a valid but undefined state. + * @stable ICU 63 + */ + UnlocalizedNumberRangeFormatter& operator=(UnlocalizedNumberRangeFormatter&& src) U_NOEXCEPT; + + private: + explicit UnlocalizedNumberRangeFormatter( + const NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>& other); + + explicit UnlocalizedNumberRangeFormatter( + NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>&& src) U_NOEXCEPT; + + // To give the fluent setters access to this class's constructor: + friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>; + + // To give NumberRangeFormatter::with() access to this class's constructor: + friend class NumberRangeFormatter; +}; + +/** + * A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available. + * + * Instances of this class are immutable and thread-safe. + * + * @see NumberFormatter + * @stable ICU 63 + */ +class U_I18N_API LocalizedNumberRangeFormatter + : public NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>, public UMemory { + public: + /** + * Format the given Formattables to a string using the settings specified in the NumberRangeFormatter fluent setting + * chain. + * + * @param first + * The first number in the range, usually to the left in LTR locales. + * @param second + * The second number in the range, usually to the right in LTR locales. + * @param status + * Set if an error occurs while formatting. + * @return A FormattedNumberRange object; call .toString() to get the string. + * @stable ICU 63 + */ + FormattedNumberRange formatFormattableRange( + const Formattable& first, const Formattable& second, UErrorCode& status) const; + + /** + * Default constructor: puts the formatter into a valid but undefined state. + * + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter() = default; + + /** + * Returns a copy of this LocalizedNumberRangeFormatter. + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter(const LocalizedNumberRangeFormatter &other); + + /** + * Move constructor: + * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state. + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT; + + /** + * Copy assignment operator. + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter& operator=(const LocalizedNumberRangeFormatter& other); + + /** + * Move assignment operator: + * The source LocalizedNumberRangeFormatter will be left in a valid but undefined state. + * @stable ICU 63 + */ + LocalizedNumberRangeFormatter& operator=(LocalizedNumberRangeFormatter&& src) U_NOEXCEPT; + +#ifndef U_HIDE_INTERNAL_API + + /** + * @param results + * The results object. This method will mutate it to save the results. + * @param equalBeforeRounding + * Whether the number was equal before copying it into a DecimalQuantity. + * Used for determining the identity fallback behavior. + * @param status + * Set if an error occurs while formatting. + * @internal + */ + void formatImpl(impl::UFormattedNumberRangeData& results, bool equalBeforeRounding, + UErrorCode& status) const; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Destruct this LocalizedNumberRangeFormatter, cleaning up any memory it might own. + * @stable ICU 63 + */ + ~LocalizedNumberRangeFormatter(); + + private: + std::atomic<impl::NumberRangeFormatterImpl*> fAtomicFormatter = {}; + + const impl::NumberRangeFormatterImpl* getFormatter(UErrorCode& stauts) const; + + explicit LocalizedNumberRangeFormatter( + const NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>& other); + + explicit LocalizedNumberRangeFormatter( + NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>&& src) U_NOEXCEPT; + + LocalizedNumberRangeFormatter(const impl::RangeMacroProps ¯os, const Locale &locale); + + LocalizedNumberRangeFormatter(impl::RangeMacroProps &¯os, const Locale &locale); + + void clear(); + + // To give the fluent setters access to this class's constructor: + friend class NumberRangeFormatterSettings<UnlocalizedNumberRangeFormatter>; + friend class NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>; + + // To give UnlocalizedNumberRangeFormatter::locale() access to this class's constructor: + friend class UnlocalizedNumberRangeFormatter; +}; + +/** + * The result of a number range formatting operation. This class allows the result to be exported in several data types, + * including a UnicodeString and a FieldPositionIterator. + * + * Instances of this class are immutable and thread-safe. + * + * @stable ICU 63 + */ +class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue { + public: + // Copybrief: this method is older than the parent method + /** + * @copybrief FormattedValue::toString() + * + * For more information, see FormattedValue::toString() + * + * @stable ICU 63 + */ + UnicodeString toString(UErrorCode& status) const U_OVERRIDE; + + // Copydoc: this method is new in ICU 64 + /** @copydoc FormattedValue::toTempString() */ + UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; + + // Copybrief: this method is older than the parent method + /** + * @copybrief FormattedValue::appendTo() + * + * For more information, see FormattedValue::appendTo() + * + * @stable ICU 63 + */ + Appendable &appendTo(Appendable &appendable, UErrorCode& status) const U_OVERRIDE; + + // Copydoc: this method is new in ICU 64 + /** @copydoc FormattedValue::nextPosition() */ + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + +#ifndef U_HIDE_DRAFT_API + /** + * Export the first formatted number as a decimal number. This endpoint + * is useful for obtaining the exact number being printed after scaling + * and rounding have been applied by the number range formatting pipeline. + * + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @return A decimal representation of the first formatted number. + * @draft ICU 63 + * @see NumberRangeFormatter + * @see #getSecondDecimal + */ + UnicodeString getFirstDecimal(UErrorCode& status) const; + + /** + * Export the second formatted number as a decimal number. This endpoint + * is useful for obtaining the exact number being printed after scaling + * and rounding have been applied by the number range formatting pipeline. + * + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @return A decimal representation of the second formatted number. + * @draft ICU 63 + * @see NumberRangeFormatter + * @see #getFirstDecimal + */ + UnicodeString getSecondDecimal(UErrorCode& status) const; +#endif // U_HIDE_DRAFT_API + + /** + * Returns whether the pair of numbers was successfully formatted as a range or whether an identity fallback was + * used. For example, if the first and second number were the same either before or after rounding occurred, an + * identity fallback was used. + * + * @return An indication the resulting identity situation in the formatted number range. + * @stable ICU 63 + * @see UNumberRangeIdentityFallback + */ + UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const; + + /** + * Copying not supported; use move constructor instead. + */ + FormattedNumberRange(const FormattedNumberRange&) = delete; + + /** + * Copying not supported; use move assignment instead. + */ + FormattedNumberRange& operator=(const FormattedNumberRange&) = delete; + + /** + * Move constructor: + * Leaves the source FormattedNumberRange in an undefined state. + * @stable ICU 63 + */ + FormattedNumberRange(FormattedNumberRange&& src) U_NOEXCEPT; + + /** + * Move assignment: + * Leaves the source FormattedNumberRange in an undefined state. + * @stable ICU 63 + */ + FormattedNumberRange& operator=(FormattedNumberRange&& src) U_NOEXCEPT; + + /** + * Destruct an instance of FormattedNumberRange, cleaning up any memory it might own. + * @stable ICU 63 + */ + ~FormattedNumberRange(); + + private: + // Can't use LocalPointer because UFormattedNumberRangeData is forward-declared + const impl::UFormattedNumberRangeData *fData; + + // Error code for the terminal methods + UErrorCode fErrorCode; + + /** + * Internal constructor from data type. Adopts the data pointer. + */ + explicit FormattedNumberRange(impl::UFormattedNumberRangeData *results) + : fData(results), fErrorCode(U_ZERO_ERROR) {} + + explicit FormattedNumberRange(UErrorCode errorCode) + : fData(nullptr), fErrorCode(errorCode) {} + + void getAllFieldPositionsImpl(FieldPositionIteratorHandler& fpih, UErrorCode& status) const; + + // To give LocalizedNumberRangeFormatter format methods access to this class's constructor: + friend class LocalizedNumberRangeFormatter; +}; + +/** + * See the main description in numberrangeformatter.h for documentation and examples. + * + * @stable ICU 63 + */ +class U_I18N_API NumberRangeFormatter final { + public: + /** + * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is not currently + * known at the call site. + * + * @return An {@link UnlocalizedNumberRangeFormatter}, to be used for chaining. + * @stable ICU 63 + */ + static UnlocalizedNumberRangeFormatter with(); + + /** + * Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known at the call + * site. + * + * @param locale + * The locale from which to load formats and symbols for number range formatting. + * @return A {@link LocalizedNumberRangeFormatter}, to be used for chaining. + * @stable ICU 63 + */ + static LocalizedNumberRangeFormatter withLocale(const Locale &locale); + + /** + * Use factory methods instead of the constructor to create a NumberFormatter. + */ + NumberRangeFormatter() = delete; +}; + +} // namespace number +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif /* U_SHOW_CPLUSPLUS_API */ + +#endif // __NUMBERRANGEFORMATTER_H__ + diff --git a/contrib/libs/icu/include/unicode/numfmt.h b/contrib/libs/icu/include/unicode/numfmt.h index 48a69de7e7..89e878a94d 100644 --- a/contrib/libs/icu/include/unicode/numfmt.h +++ b/contrib/libs/icu/include/unicode/numfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -26,11 +26,11 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file - * \brief C++ API: Compatibility APIs for number formatting. + * \brief C++ API: Compatibility APIs for number formatting. */ #if !UCONFIG_NO_FORMATTING @@ -55,15 +55,15 @@ class StringEnumeration; #endif /** - * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if - * numberformatter.h fits their use case. Although not deprecated, this header - * is provided for backwards compatibility only. + * <p><strong>IMPORTANT:</strong> New users are strongly encouraged to see if + * numberformatter.h fits their use case. Although not deprecated, this header + * is provided for backwards compatibility only. * * Abstract base class for all number formats. Provides interface for * formatting and parsing a number. Also provides methods for * determining which locales have number formats, and what their names * are. - * + * * \headerfile unicode/numfmt.h "unicode/numfmt.h" * <P> * NumberFormat helps you to format and parse numbers for any locale. @@ -175,33 +175,33 @@ class StringEnumeration; class U_I18N_API NumberFormat : public Format { public: /** - * Rounding mode. - * - * <p> - * For more detail on rounding modes, see: - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes - * - * @stable ICU 2.4 - */ - enum ERoundingMode { - kRoundCeiling, /**< Round towards positive infinity */ - kRoundFloor, /**< Round towards negative infinity */ - kRoundDown, /**< Round towards zero */ - kRoundUp, /**< Round away from zero */ - kRoundHalfEven, /**< Round towards the nearest integer, or - towards the nearest even integer if equidistant */ - kRoundHalfDown, /**< Round towards the nearest integer, or - towards zero if equidistant */ - kRoundHalfUp, /**< Round towards the nearest integer, or - away from zero if equidistant */ - /** - * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. - * @stable ICU 4.8 - */ - kRoundUnnecessary - }; - - /** + * Rounding mode. + * + * <p> + * For more detail on rounding modes, see: + * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * + * @stable ICU 2.4 + */ + enum ERoundingMode { + kRoundCeiling, /**< Round towards positive infinity */ + kRoundFloor, /**< Round towards negative infinity */ + kRoundDown, /**< Round towards zero */ + kRoundUp, /**< Round away from zero */ + kRoundHalfEven, /**< Round towards the nearest integer, or + towards the nearest even integer if equidistant */ + kRoundHalfDown, /**< Round towards the nearest integer, or + towards zero if equidistant */ + kRoundHalfUp, /**< Round towards the nearest integer, or + away from zero if equidistant */ + /** + * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. + * @stable ICU 4.8 + */ + kRoundUnnecessary + }; + + /** * Alignment Field constants used to construct a FieldPosition object. * Signifies that the position of the integer part or fraction part of * a formatted number should be returned. @@ -239,10 +239,10 @@ public: kPermillField = UNUM_PERMILL_FIELD, /** @stable ICU 2.0 */ kSignField = UNUM_SIGN_FIELD, - /** @stable ICU 64 */ - kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD, - /** @stable ICU 64 */ - kCompactField = UNUM_COMPACT_FIELD, + /** @stable ICU 64 */ + kMeasureUnitField = UNUM_MEASURE_UNIT_FIELD, + /** @stable ICU 64 */ + kCompactField = UNUM_COMPACT_FIELD, /** * These constants are provided for backwards compatibility only. @@ -261,14 +261,14 @@ public: virtual ~NumberFormat(); /** - * Clones this object polymorphically. - * The caller owns the result and should delete it when done. - * @return clone, or nullptr if an error occurred - * @stable ICU 2.0 - */ - virtual NumberFormat* clone() const = 0; - - /** + * Clones this object polymorphically. + * The caller owns the result and should delete it when done. + * @return clone, or nullptr if an error occurred + * @stable ICU 2.0 + */ + virtual NumberFormat* clone() const = 0; + + /** * Return true if the given Format objects are semantically equal. * Objects of different subclasses are considered unequal. * @return true if the given Format objects are semantically equal. @@ -568,18 +568,18 @@ public: UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; - -// Can't use #ifndef U_HIDE_INTERNAL_API because these are virtual methods - + +// Can't use #ifndef U_HIDE_INTERNAL_API because these are virtual methods + /** * Format a decimal number. - * The number is a DecimalQuantity wrapper onto a floating point decimal number. + * The number is a DecimalQuantity wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. Subclasses of NumberFormat that want * to specifically handle big decimal numbers must override this method. * class DecimalFormat does so. * - * @param number The number, a DecimalQuantity format Decimal Floating Point. + * @param number The number, a DecimalQuantity format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param posIter On return, can be used to iterate over positions @@ -588,20 +588,20 @@ public: * @return Reference to 'appendTo' parameter. * @internal */ - virtual UnicodeString& format(const number::impl::DecimalQuantity &number, + virtual UnicodeString& format(const number::impl::DecimalQuantity &number, UnicodeString& appendTo, FieldPositionIterator* posIter, UErrorCode& status) const; /** * Format a decimal number. - * The number is a DecimalQuantity wrapper onto a floating point decimal number. + * The number is a DecimalQuantity wrapper onto a floating point decimal number. * The default implementation in NumberFormat converts the decimal number * to a double and formats that. Subclasses of NumberFormat that want * to specifically handle big decimal numbers must override this method. * class DecimalFormat does so. * - * @param number The number, a DecimalQuantity format Decimal Floating Point. + * @param number The number, a DecimalQuantity format Decimal Floating Point. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param pos On input: an alignment field, if desired. @@ -610,7 +610,7 @@ public: * @return Reference to 'appendTo' parameter. * @internal */ - virtual UnicodeString& format(const number::impl::DecimalQuantity &number, + virtual UnicodeString& format(const number::impl::DecimalQuantity &number, UnicodeString& appendTo, FieldPosition& pos, UErrorCode& status) const; @@ -647,9 +647,9 @@ public: * @param result Formattable to be set to the parse result. * If parse fails, return contents are undefined. * @param status Output parameter set to a failure error code - * when a failure occurs. The error code when the - * string fails to parse is U_INVALID_FORMAT_ERROR, - * unless overridden by a subclass. + * when a failure occurs. The error code when the + * string fails to parse is U_INVALID_FORMAT_ERROR, + * unless overridden by a subclass. * @see NumberFormat::isParseIntegerOnly * @stable ICU 2.0 */ @@ -723,9 +723,9 @@ public: /** * Create a default style NumberFormat for the current default locale. * The default formatting style is locale dependent. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); @@ -734,9 +734,9 @@ public: * Create a default style NumberFormat for the specified locale. * The default formatting style is locale dependent. * @param inLocale the given locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale, @@ -744,9 +744,9 @@ public: /** * Create a specific style NumberFormat for the specified locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param desiredLocale the given locale. * @param style the given style. * @param errorCode Output param filled with success/failure status. @@ -783,18 +783,18 @@ public: /** * Returns a currency format for the current default locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&); /** * Returns a currency format for the specified locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param inLocale the given locale. * @stable ICU 2.0 */ @@ -803,18 +803,18 @@ public: /** * Returns a percentage format for the current default locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createPercentInstance(UErrorCode&); /** * Returns a percentage format for the specified locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param inLocale the given locale. * @stable ICU 2.0 */ @@ -823,18 +823,18 @@ public: /** * Returns a scientific format for the current default locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @stable ICU 2.0 */ static NumberFormat* U_EXPORT2 createScientificInstance(UErrorCode&); /** * Returns a scientific format for the specified locale. - * <p> - * <strong>NOTE:</strong> New users are strongly encouraged to use - * {@link icu::number::NumberFormatter} instead of NumberFormat. + * <p> + * <strong>NOTE:</strong> New users are strongly encouraged to use + * {@link icu::number::NumberFormatter} instead of NumberFormat. * @param inLocale the given locale. * @stable ICU 2.0 */ @@ -888,7 +888,7 @@ public: * Returns true if grouping is used in this format. For example, * in the English locale, with grouping on, the number 1234567 * might be formatted as "1,234,567". The grouping separator as - * well as the size of each group is locale dependent and is + * well as the size of each group is locale dependent and is * determined by sub-classes of NumberFormat. * @see setGroupingUsed * @stable ICU 2.0 @@ -1005,7 +1005,7 @@ public: * @param ec input-output error code * @stable ICU 3.0 */ - virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); + virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); /** * Gets the currency used to display currency @@ -1014,8 +1014,8 @@ public: * the currency in use, or a pointer to the empty string. * @stable ICU 2.6 */ - const char16_t* getCurrency() const; - + const char16_t* getCurrency() const; + /** * Set a particular UDisplayContext value in the formatter, such as * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. @@ -1039,21 +1039,21 @@ public: */ virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; - /** - * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary - * if the subclass does not support rounding. - * @return A rounding mode - * @stable ICU 60 - */ - virtual ERoundingMode getRoundingMode(void) const; - - /** - * Set the rounding mode. If a subclass does not support rounding, this will do nothing. - * @param roundingMode A rounding mode - * @stable ICU 60 - */ - virtual void setRoundingMode(ERoundingMode roundingMode); - + /** + * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary + * if the subclass does not support rounding. + * @return A rounding mode + * @stable ICU 60 + */ + virtual ERoundingMode getRoundingMode(void) const; + + /** + * Set the rounding mode. If a subclass does not support rounding, this will do nothing. + * @param roundingMode A rounding mode + * @stable ICU 60 + */ + virtual void setRoundingMode(ERoundingMode roundingMode); + public: /** @@ -1107,7 +1107,7 @@ protected: * have a capacity of at least 4 * @internal */ - virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; + virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; #ifndef U_HIDE_INTERNAL_API /** @@ -1154,7 +1154,7 @@ private: UBool fLenient; // TRUE => lenient parse is enabled // ISO currency code - char16_t fCurrency[4]; + char16_t fCurrency[4]; UDisplayContext fCapitalizationContext; @@ -1265,7 +1265,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _NUMFMT //eof diff --git a/contrib/libs/icu/include/unicode/numsys.h b/contrib/libs/icu/include/unicode/numsys.h index 7def7032e1..1eaf7a1429 100644 --- a/contrib/libs/icu/include/unicode/numsys.h +++ b/contrib/libs/icu/include/unicode/numsys.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -20,7 +20,7 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API +#if U_SHOW_CPLUSPLUS_API /** * \file @@ -34,14 +34,14 @@ U_NAMESPACE_BEGIN -// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size -/** - * Size of a numbering system name. - * @internal - */ -constexpr const size_t kInternalNumSysNameCapacity = 8; - +// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size /** + * Size of a numbering system name. + * @internal + */ +constexpr const size_t kInternalNumSysNameCapacity = 8; + +/** * Defines numbering systems. A numbering system describes the scheme by which * numbers are to be presented to the end user. In its simplest form, a numbering * system describes the set of digit characters that are to be used to display @@ -74,12 +74,12 @@ public: NumberingSystem(const NumberingSystem& other); /** - * Copy assignment. - * @stable ICU 4.2 - */ - NumberingSystem& operator=(const NumberingSystem& other) = default; - - /** + * Copy assignment. + * @stable ICU 4.2 + */ + NumberingSystem& operator=(const NumberingSystem& other) = default; + + /** * Destructor. * @stable ICU 4.2 */ @@ -112,11 +112,11 @@ public: /** * Return a StringEnumeration over all the names of numbering systems known to ICU. - * The numbering system names will be in alphabetical (invariant) order. - * - * The returned StringEnumeration is owned by the caller, who must delete it when - * finished with it. - * + * The numbering system names will be in alphabetical (invariant) order. + * + * The returned StringEnumeration is owned by the caller, who must delete it when + * finished with it. + * * @stable ICU 4.2 */ static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status); @@ -129,10 +129,10 @@ public: * default, native, traditional, finance - do not identify specific numbering systems, * but rather key values that may only be used as part of a locale, which in turn * defines how they are mapped to a specific numbering system such as "latn" or "hant". - * + * * @param name The name of the numbering system. - * @param status ICU status; set to U_UNSUPPORTED_ERROR if numbering system not found. - * @return The NumberingSystem instance, or nullptr if not found. + * @param status ICU status; set to U_UNSUPPORTED_ERROR if numbering system not found. + * @return The NumberingSystem instance, or nullptr if not found. * @stable ICU 4.2 */ static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status); @@ -199,13 +199,13 @@ private: UnicodeString desc; int32_t radix; UBool algorithmic; - char name[kInternalNumSysNameCapacity+1]; + char name[kInternalNumSysNameCapacity+1]; void setRadix(int32_t radix); void setAlgorithmic(UBool algorithmic); - void setDesc(const UnicodeString &desc); + void setDesc(const UnicodeString &desc); void setName(const char* name); @@ -218,7 +218,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _NUMSYS //eof diff --git a/contrib/libs/icu/include/unicode/parseerr.h b/contrib/libs/icu/include/unicode/parseerr.h index c23cc273b8..cca8872da6 100644 --- a/contrib/libs/icu/include/unicode/parseerr.h +++ b/contrib/libs/icu/include/unicode/parseerr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -58,9 +58,9 @@ enum { U_PARSE_CONTEXT_LEN = 16 }; typedef struct UParseError { /** - * The line on which the error occurred. If the parser uses this + * The line on which the error occurred. If the parser uses this * field, it sets it to the line number of the source text line on - * which the error appears, which will be a value >= 1. If the + * which the error appears, which will be a value >= 1. If the * parse does not support line numbers, the value will be <= 0. * @stable ICU 2.0 */ diff --git a/contrib/libs/icu/include/unicode/parsepos.h b/contrib/libs/icu/include/unicode/parsepos.h index 909d288d48..cbb9a9a3f4 100644 --- a/contrib/libs/icu/include/unicode/parsepos.h +++ b/contrib/libs/icu/include/unicode/parsepos.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. @@ -19,9 +19,9 @@ #define PARSEPOS_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" @@ -93,21 +93,21 @@ public: * Assignment operator * @stable ICU 2.0 */ - inline ParsePosition& operator=(const ParsePosition& copy); + inline ParsePosition& operator=(const ParsePosition& copy); /** * Equality operator. * @return TRUE if the two parse positions are equal, FALSE otherwise. * @stable ICU 2.0 */ - inline UBool operator==(const ParsePosition& that) const; + inline UBool operator==(const ParsePosition& that) const; /** * Equality operator. * @return TRUE if the two parse positions are not equal, FALSE otherwise. * @stable ICU 2.0 */ - inline UBool operator!=(const ParsePosition& that) const; + inline UBool operator!=(const ParsePosition& that) const; /** * Clone this object. @@ -129,14 +129,14 @@ public: * @return the current index. * @stable ICU 2.0 */ - inline int32_t getIndex(void) const; + inline int32_t getIndex(void) const; /** * Set the current parse position. * @param index the new index. * @stable ICU 2.0 */ - inline void setIndex(int32_t index); + inline void setIndex(int32_t index); /** * Set the index at which a parse error occurred. Formatters @@ -145,14 +145,14 @@ public: * set. * @stable ICU 2.0 */ - inline void setErrorIndex(int32_t ei); + inline void setErrorIndex(int32_t ei); /** * Retrieve the index at which an error occurred, or -1 if the * error index has not been set. * @stable ICU 2.0 */ - inline int32_t getErrorIndex(void) const; + inline int32_t getErrorIndex(void) const; /** * ICU "poor man's RTTI", returns a UClassID for this class. @@ -232,6 +232,6 @@ ParsePosition::setErrorIndex(int32_t ei) } U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/platform.h b/contrib/libs/icu/include/unicode/platform.h index 2bb2f8b318..2bc9706707 100644 --- a/contrib/libs/icu/include/unicode/platform.h +++ b/contrib/libs/icu/include/unicode/platform.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -38,7 +38,7 @@ * and/or from other macros that are predefined by the compiler * or defined in standard (POSIX or platform or compiler) headers. * - * As a temporary workaround, you can add an explicit \#define for some macros + * As a temporary workaround, you can add an explicit \#define for some macros * before it is first tested, or add an equivalent -D macro definition * to the compiler's command line. * @@ -132,17 +132,17 @@ #define U_PF_BROWSER_NATIVE_CLIENT 4020 /** Android is based on Linux. @internal */ #define U_PF_ANDROID 4050 -/** Fuchsia is a POSIX-ish platform. @internal */ -#define U_PF_FUCHSIA 4100 +/** Fuchsia is a POSIX-ish platform. @internal */ +#define U_PF_FUCHSIA 4100 /* Maximum value for Linux-based platform is 4499 */ -/** - * Emscripten is a C++ transpiler for the Web that can target asm.js or - * WebAssembly. It provides some POSIX-compatible wrappers and stubs and - * some Linux-like functionality, but is not fully compatible with - * either. - * @internal - */ -#define U_PF_EMSCRIPTEN 5010 +/** + * Emscripten is a C++ transpiler for the Web that can target asm.js or + * WebAssembly. It provides some POSIX-compatible wrappers and stubs and + * some Linux-like functionality, but is not fully compatible with + * either. + * @internal + */ +#define U_PF_EMSCRIPTEN 5010 /** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ #define U_PF_OS390 9000 /** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */ @@ -160,10 +160,10 @@ # define U_PLATFORM U_PF_ANDROID /* Android wchar_t support depends on the API level. */ # include <android/api-level.h> -#elif defined(__pnacl__) || defined(__native_client__) +#elif defined(__pnacl__) || defined(__native_client__) # define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT -#elif defined(__Fuchsia__) -# define U_PLATFORM U_PF_FUCHSIA +#elif defined(__Fuchsia__) +# define U_PLATFORM U_PF_FUCHSIA #elif defined(linux) || defined(__linux__) || defined(__linux) # define U_PLATFORM U_PF_LINUX #elif defined(__APPLE__) && defined(__MACH__) @@ -200,8 +200,8 @@ # define U_PLATFORM U_PF_OS390 #elif defined(__OS400__) || defined(__TOS_OS400__) # define U_PLATFORM U_PF_OS400 -#elif defined(__EMSCRIPTEN__) -# define U_PLATFORM U_PF_EMSCRIPTEN +#elif defined(__EMSCRIPTEN__) +# define U_PLATFORM U_PF_EMSCRIPTEN #else # define U_PLATFORM U_PF_UNKNOWN #endif @@ -217,9 +217,9 @@ # define CYGWINMSVC #endif */ -#ifdef U_IN_DOXYGEN -# define CYGWINMSVC -#endif +#ifdef U_IN_DOXYGEN +# define CYGWINMSVC +#endif /** * \def U_PLATFORM_USES_ONLY_WIN32_API @@ -251,18 +251,18 @@ #endif /** - * \def U_PLATFORM_HAS_WINUWP_API - * Defines whether target is intended for Universal Windows Platform API - * Set to 1 for Windows10 Release Solution Configuration - * @internal - */ -#ifdef U_PLATFORM_HAS_WINUWP_API - /* Use the predefined value. */ -#else -# define U_PLATFORM_HAS_WINUWP_API 0 -#endif - -/** + * \def U_PLATFORM_HAS_WINUWP_API + * Defines whether target is intended for Universal Windows Platform API + * Set to 1 for Windows10 Release Solution Configuration + * @internal + */ +#ifdef U_PLATFORM_HAS_WINUWP_API + /* Use the predefined value. */ +#else +# define U_PLATFORM_HAS_WINUWP_API 0 +#endif + +/** * \def U_PLATFORM_IMPLEMENTS_POSIX * Defines whether the platform implements (most of) the POSIX API. * Set to 1 for Cygwin and most other platforms. @@ -423,42 +423,42 @@ # define U_HAVE_DEBUG_LOCATION_NEW 0 #endif -/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */ -#ifdef __has_attribute -# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x) -#else -# define UPRV_HAS_ATTRIBUTE(x) 0 +/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */ +#ifdef __has_attribute +# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define UPRV_HAS_ATTRIBUTE(x) 0 #endif -#ifdef __has_cpp_attribute -# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define UPRV_HAS_CPP_ATTRIBUTE(x) 0 +#ifdef __has_cpp_attribute +# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define UPRV_HAS_CPP_ATTRIBUTE(x) 0 #endif -#ifdef __has_declspec_attribute -# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x) -#else -# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0 +#ifdef __has_declspec_attribute +# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x) +#else +# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0 #endif -#ifdef __has_builtin -# define UPRV_HAS_BUILTIN(x) __has_builtin(x) -#else -# define UPRV_HAS_BUILTIN(x) 0 -#endif -#ifdef __has_feature -# define UPRV_HAS_FEATURE(x) __has_feature(x) -#else -# define UPRV_HAS_FEATURE(x) 0 +#ifdef __has_builtin +# define UPRV_HAS_BUILTIN(x) __has_builtin(x) +#else +# define UPRV_HAS_BUILTIN(x) 0 #endif -#ifdef __has_extension -# define UPRV_HAS_EXTENSION(x) __has_extension(x) -#else -# define UPRV_HAS_EXTENSION(x) 0 +#ifdef __has_feature +# define UPRV_HAS_FEATURE(x) __has_feature(x) +#else +# define UPRV_HAS_FEATURE(x) 0 #endif -#ifdef __has_warning -# define UPRV_HAS_WARNING(x) __has_warning(x) -#else -# define UPRV_HAS_WARNING(x) 0 +#ifdef __has_extension +# define UPRV_HAS_EXTENSION(x) __has_extension(x) +#else +# define UPRV_HAS_EXTENSION(x) 0 #endif +#ifdef __has_warning +# define UPRV_HAS_WARNING(x) __has_warning(x) +#else +# define UPRV_HAS_WARNING(x) 0 +#endif /** * \def U_MALLOC_ATTR @@ -476,9 +476,9 @@ * Attribute to specify the size of the allocated buffer for malloc-like functions * @internal */ -#if (defined(__GNUC__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ - UPRV_HAS_ATTRIBUTE(alloc_size) +#if (defined(__GNUC__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \ + UPRV_HAS_ATTRIBUTE(alloc_size) # define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X))) # define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y))) #else @@ -500,20 +500,20 @@ /* Otherwise use the predefined value. */ #elif !defined(__cplusplus) # define U_CPLUSPLUS_VERSION 0 -#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) # define U_CPLUSPLUS_VERSION 14 -#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) +#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) # define U_CPLUSPLUS_VERSION 11 #else // C++98 or C++03 # define U_CPLUSPLUS_VERSION 1 #endif -#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) -// add in std::nullptr_t -namespace std { - typedef decltype(nullptr) nullptr_t; -}; +#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// add in std::nullptr_t +namespace std { + typedef decltype(nullptr) nullptr_t; +}; #endif /** @@ -525,7 +525,7 @@ namespace std { */ #ifdef U_NOEXCEPT /* Use the predefined value. */ -#else +#else # define U_NOEXCEPT noexcept #endif @@ -535,23 +535,23 @@ namespace std { * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough * @internal */ -#ifndef __cplusplus - // Not for C. -#elif defined(U_FALLTHROUGH) - // Use the predefined value. -#elif defined(__clang__) - // Test for compiler vs. feature separately. - // Other compilers might choke on the feature test. -# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \ - (UPRV_HAS_FEATURE(cxx_attributes) && \ - UPRV_HAS_WARNING("-Wimplicit-fallthrough")) +#ifndef __cplusplus + // Not for C. +#elif defined(U_FALLTHROUGH) + // Use the predefined value. +#elif defined(__clang__) + // Test for compiler vs. feature separately. + // Other compilers might choke on the feature test. +# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \ + (UPRV_HAS_FEATURE(cxx_attributes) && \ + UPRV_HAS_WARNING("-Wimplicit-fallthrough")) # define U_FALLTHROUGH [[clang::fallthrough]] # endif -#elif defined(__GNUC__) && (__GNUC__ >= 7) -# define U_FALLTHROUGH __attribute__((fallthrough)) -#endif - -#ifndef U_FALLTHROUGH +#elif defined(__GNUC__) && (__GNUC__ >= 7) +# define U_FALLTHROUGH __attribute__((fallthrough)) +#endif + +#ifndef U_FALLTHROUGH # define U_FALLTHROUGH #endif @@ -647,8 +647,8 @@ namespace std { */ #ifdef U_CHARSET_IS_UTF8 /* Use the predefined value. */ -#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \ - U_PLATFORM == U_PF_EMSCRIPTEN +#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \ + U_PLATFORM == U_PF_EMSCRIPTEN # define U_CHARSET_IS_UTF8 1 #else # define U_CHARSET_IS_UTF8 0 @@ -735,7 +735,7 @@ namespace std { * narrow-character strings are in EBCDIC. */ # define U_SIZEOF_WCHAR_T 2 -# else +# else /* * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified. * Wide-character strings are in 16-bit EBCDIC, @@ -766,14 +766,14 @@ namespace std { #else /* * Notes: - * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef - * and does not support u"abc" string literals. - * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for - * both char16_t and u"abc" string literals. + * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef + * and does not support u"abc" string literals. + * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for + * both char16_t and u"abc" string literals. * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but * does not support u"abc" string literals. * C++11 and C11 require support for UTF-16 literals - * TODO: Fix for plain C. Doesn't work on Mac. + * TODO: Fix for plain C. Doesn't work on Mac. */ # if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) # define U_HAVE_CHAR16_T 1 @@ -794,8 +794,8 @@ namespace std { #elif U_HAVE_CHAR16_T \ || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ || (defined(__HP_aCC) && __HP_aCC >= 035000) \ - || (defined(__HP_cc) && __HP_cc >= 111106) \ - || (defined(U_IN_DOXYGEN)) + || (defined(__HP_cc) && __HP_cc >= 111106) \ + || (defined(U_IN_DOXYGEN)) # define U_DECLARE_UTF16(string) u ## string #elif U_SIZEOF_WCHAR_T == 2 \ && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) @@ -814,9 +814,9 @@ namespace std { /* Use the predefined value. */ #elif defined(U_STATIC_IMPLEMENTATION) # define U_EXPORT -#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ - UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) -# define U_EXPORT __declspec(dllexport) +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) +# define U_EXPORT __declspec(dllexport) #elif defined(__GNUC__) # define U_EXPORT __attribute__((visibility("default"))) #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ @@ -828,7 +828,7 @@ namespace std { # define U_EXPORT #endif -/* U_CALLCONV is related to U_EXPORT2 */ +/* U_CALLCONV is related to U_EXPORT2 */ #ifdef U_EXPORT2 /* Use the predefined value. */ #elif defined(_MSC_VER) @@ -839,8 +839,8 @@ namespace std { #ifdef U_IMPORT /* Use the predefined value. */ -#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ - UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) +#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \ + UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) /* Windows needs to export/import data. */ # define U_IMPORT __declspec(dllimport) #else @@ -870,16 +870,16 @@ namespace std { # define U_CALLCONV U_EXPORT2 #endif -/** - * \def U_CALLCONV_FPTR - * Similar to U_CALLCONV, but only used on function pointers. - * @internal - */ -#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) -# define U_CALLCONV_FPTR U_CALLCONV -#else -# define U_CALLCONV_FPTR -#endif +/** + * \def U_CALLCONV_FPTR + * Similar to U_CALLCONV, but only used on function pointers. + * @internal + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV_FPTR U_CALLCONV +#else +# define U_CALLCONV_FPTR +#endif /* @} */ -#endif // _PLATFORM_H +#endif // _PLATFORM_H diff --git a/contrib/libs/icu/include/unicode/plurfmt.h b/contrib/libs/icu/include/unicode/plurfmt.h index 2c2116586f..b1cf49a67f 100644 --- a/contrib/libs/icu/include/unicode/plurfmt.h +++ b/contrib/libs/icu/include/unicode/plurfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: PluralFormat object @@ -450,7 +450,7 @@ public: * result and should delete it when done. * @stable ICU 4.0 */ - virtual PluralFormat* clone() const; + virtual PluralFormat* clone() const; /** * Formats a plural message for a number taken from a Formattable object. @@ -524,7 +524,7 @@ public: private: /** - * @internal (private) + * @internal (private) */ class U_I18N_API PluralSelector : public UMemory { public: @@ -536,7 +536,7 @@ private: * @param number The number to be plural-formatted. * @param ec Error code. * @return The selected PluralFormat keyword. - * @internal (private) + * @internal (private) */ virtual UnicodeString select(void *context, double number, UErrorCode& ec) const = 0; }; @@ -548,7 +548,7 @@ private: virtual ~PluralSelectorAdapter(); - virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const; + virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const; void reset(); @@ -572,7 +572,7 @@ private: UnicodeString& format(const Formattable& numberObject, double number, UnicodeString& appendTo, FieldPosition& pos, - UErrorCode& status) const; + UErrorCode& status) const; /** * Finds the PluralFormat sub-message for the given number, or the "other" sub-message. @@ -600,7 +600,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _PLURFMT //eof diff --git a/contrib/libs/icu/include/unicode/plurrule.h b/contrib/libs/icu/include/unicode/plurrule.h index 408efbcc4a..6b1f74a112 100644 --- a/contrib/libs/icu/include/unicode/plurrule.h +++ b/contrib/libs/icu/include/unicode/plurrule.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -20,8 +20,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: PluralRules object @@ -31,9 +31,9 @@ #include "unicode/format.h" #include "unicode/upluralrules.h" -#ifndef U_HIDE_INTERNAL_API -#include "unicode/numfmt.h" -#endif /* U_HIDE_INTERNAL_API */ +#ifndef U_HIDE_INTERNAL_API +#include "unicode/numfmt.h" +#endif /* U_HIDE_INTERNAL_API */ /** * Value returned by PluralRules::getUniqueKeywordValue() when there is no @@ -45,17 +45,17 @@ U_NAMESPACE_BEGIN class Hashtable; -class IFixedDecimal; +class IFixedDecimal; class RuleChain; class PluralRuleParser; class PluralKeywordEnumeration; class AndConstraint; class SharedPluralRules; -namespace number { -class FormattedNumber; -} - +namespace number { +class FormattedNumber; +} + /** * Defines rules for mapping non-negative numeric values onto a small set of * keywords. Rules are constructed from a text description, consisting @@ -329,9 +329,9 @@ public: #endif /* U_HIDE_INTERNAL_API */ /** - * Given an integer, returns the keyword of the first rule - * that applies to the number. This function can be used with - * isKeyword* functions to determine the keyword for default plural rules. + * Given an integer, returns the keyword of the first rule + * that applies to the number. This function can be used with + * isKeyword* functions to determine the keyword for default plural rules. * * @param number The number for which the rule has to be determined. * @return The keyword of the selected rule. @@ -340,9 +340,9 @@ public: UnicodeString select(int32_t number) const; /** - * Given a floating-point number, returns the keyword of the first rule - * that applies to the number. This function can be used with - * isKeyword* functions to determine the keyword for default plural rules. + * Given a floating-point number, returns the keyword of the first rule + * that applies to the number. This function can be used with + * isKeyword* functions to determine the keyword for default plural rules. * * @param number The number for which the rule has to be determined. * @return The keyword of the selected rule. @@ -350,28 +350,28 @@ public: */ UnicodeString select(double number) const; - /** - * Given a formatted number, returns the keyword of the first rule - * that applies to the number. This function can be used with - * isKeyword* functions to determine the keyword for default plural rules. - * - * A FormattedNumber allows you to specify an exponent or trailing zeros, - * which can affect the plural category. To get a FormattedNumber, see - * NumberFormatter. - * - * @param number The number for which the rule has to be determined. - * @param status Set if an error occurs while selecting plural keyword. - * This could happen if the FormattedNumber is invalid. - * @return The keyword of the selected rule. - * @stable ICU 64 - */ - UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const; - + /** + * Given a formatted number, returns the keyword of the first rule + * that applies to the number. This function can be used with + * isKeyword* functions to determine the keyword for default plural rules. + * + * A FormattedNumber allows you to specify an exponent or trailing zeros, + * which can affect the plural category. To get a FormattedNumber, see + * NumberFormatter. + * + * @param number The number for which the rule has to be determined. + * @param status Set if an error occurs while selecting plural keyword. + * This could happen if the FormattedNumber is invalid. + * @return The keyword of the selected rule. + * @stable ICU 64 + */ + UnicodeString select(const number::FormattedNumber& number, UErrorCode& status) const; + #ifndef U_HIDE_INTERNAL_API /** * @internal */ - UnicodeString select(const IFixedDecimal &number) const; + UnicodeString select(const IFixedDecimal &number) const; #endif /* U_HIDE_INTERNAL_API */ /** @@ -402,7 +402,7 @@ public: /** * Deprecated Function, does not produce useful results. * - * Originally intended to return all the values for which select() would return the keyword. + * Originally intended to return all the values for which select() would return the keyword. * If the keyword is unknown, returns no values, but this is not an error. If * the number of values is unlimited, returns no values and -1 as the * count. @@ -520,12 +520,12 @@ private: UnicodeString getRuleFromResource(const Locale& locale, UPluralType type, UErrorCode& status); RuleChain *rulesForKeyword(const UnicodeString &keyword) const; - /** - * An internal status variable used to indicate that the object is in an 'invalid' state. - * Used by copy constructor, the assignment operator and the clone method. - */ - UErrorCode mInternalStatus; - + /** + * An internal status variable used to indicate that the object is in an 'invalid' state. + * Used by copy constructor, the assignment operator and the clone method. + */ + UErrorCode mInternalStatus; + friend class PluralRuleParser; }; @@ -533,7 +533,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _PLURRULE //eof diff --git a/contrib/libs/icu/include/unicode/ptypes.h b/contrib/libs/icu/include/unicode/ptypes.h index 70324ffee3..2c5e9351ec 100644 --- a/contrib/libs/icu/include/unicode/ptypes.h +++ b/contrib/libs/icu/include/unicode/ptypes.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -83,7 +83,7 @@ typedef unsigned char uint8_t; #else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ -/// \cond +/// \cond #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif @@ -123,7 +123,7 @@ typedef unsigned int uint32_t; typedef unsigned long long uint64_t; #endif #endif -/// \endcond +/// \endcond #endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ diff --git a/contrib/libs/icu/include/unicode/putil.h b/contrib/libs/icu/include/unicode/putil.h index 759b136c13..10416ecdcb 100644 --- a/contrib/libs/icu/include/unicode/putil.h +++ b/contrib/libs/icu/include/unicode/putil.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -38,7 +38,7 @@ /** * Platform utilities isolates the platform dependencies of the - * library. For each platform which this code is ported to, these + * library. For each platform which this code is ported to, these * functions may have to be re-implemented. */ @@ -53,7 +53,7 @@ * The data directory is determined as follows: * If u_setDataDirectory() has been called, that is it, otherwise * if the ICU_DATA environment variable is set, use that, otherwise - * If a data directory was specified at ICU build time + * If a data directory was specified at ICU build time * <code> * \code * #define ICU_DATA_DIR "path" @@ -93,7 +93,7 @@ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); #ifndef U_HIDE_INTERNAL_API /** * Return the time zone files override directory, or an empty string if - * no directory was specified. Certain time zone resources will be preferentially + * no directory was specified. Certain time zone resources will be preferentially * loaded from individual files in this directory. * * @return the time zone data override directory. diff --git a/contrib/libs/icu/include/unicode/rbbi.h b/contrib/libs/icu/include/unicode/rbbi.h index 7825f603a5..e35b98f9a0 100644 --- a/contrib/libs/icu/include/unicode/rbbi.h +++ b/contrib/libs/icu/include/unicode/rbbi.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* *************************************************************************** @@ -18,8 +18,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Rule Based Break Iterator @@ -35,10 +35,10 @@ U_NAMESPACE_BEGIN /** @internal */ -class LanguageBreakEngine; +class LanguageBreakEngine; struct RBBIDataHeader; class RBBIDataWrapper; -class UnhandledEngine; +class UnhandledEngine; class UStack; /** @@ -57,51 +57,51 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { private: /** * The UText through which this BreakIterator accesses the text - * @internal (private) + * @internal (private) */ - UText fText; + UText fText; -#ifndef U_HIDE_INTERNAL_API -public: -#endif /* U_HIDE_INTERNAL_API */ +#ifndef U_HIDE_INTERNAL_API +public: +#endif /* U_HIDE_INTERNAL_API */ /** - * The rule data for this BreakIterator instance. - * Not for general use; Public only for testing purposes. + * The rule data for this BreakIterator instance. + * Not for general use; Public only for testing purposes. * @internal */ RBBIDataWrapper *fData; -private: +private: /** - * The current position of the iterator. Pinned, 0 < fPosition <= text.length. - * Never has the value UBRK_DONE (-1). - */ - int32_t fPosition; + * The current position of the iterator. Pinned, 0 < fPosition <= text.length. + * Never has the value UBRK_DONE (-1). + */ + int32_t fPosition; /** - * TODO: - */ - int32_t fRuleStatusIndex; + * TODO: + */ + int32_t fRuleStatusIndex; /** - * Cache of previously determined boundary positions. + * Cache of previously determined boundary positions. */ - class BreakCache; - BreakCache *fBreakCache; + class BreakCache; + BreakCache *fBreakCache; /** - * Cache of boundary positions within a region of text that has been - * sub-divided by dictionary based breaking. + * Cache of boundary positions within a region of text that has been + * sub-divided by dictionary based breaking. */ - class DictionaryCache; - DictionaryCache *fDictionaryCache; + class DictionaryCache; + DictionaryCache *fDictionaryCache; /** * * If present, UStack of LanguageBreakEngine objects that might handle * dictionary characters. Searched from top to bottom to find an object to * handle a given character. - * @internal (private) + * @internal (private) */ UStack *fLanguageBreakEngines; @@ -109,37 +109,37 @@ private: * * If present, the special LanguageBreakEngine used for handling * characters that are in the dictionary set, but not handled by any - * LanguageBreakEngine. - * @internal (private) + * LanguageBreakEngine. + * @internal (private) */ UnhandledEngine *fUnhandledBreakEngine; /** - * Counter for the number of characters encountered with the "dictionary" - * flag set. - * @internal (private) - */ - uint32_t fDictionaryCharCount; - - /** - * A character iterator that refers to the same text as the UText, above. - * Only included for compatibility with old API, which was based on CharacterIterators. - * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. - */ - CharacterIterator *fCharIter; - - /** - * When the input text is provided by a UnicodeString, this will point to - * a characterIterator that wraps that data. Needed only for the - * implementation of getText(), a backwards compatibility issue. - */ - StringCharacterIterator fSCharIter; - - /** - * True when iteration has run off the end, and iterator functions should return UBRK_DONE. - */ - UBool fDone; - + * Counter for the number of characters encountered with the "dictionary" + * flag set. + * @internal (private) + */ + uint32_t fDictionaryCharCount; + + /** + * A character iterator that refers to the same text as the UText, above. + * Only included for compatibility with old API, which was based on CharacterIterators. + * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. + */ + CharacterIterator *fCharIter; + + /** + * When the input text is provided by a UnicodeString, this will point to + * a characterIterator that wraps that data. Needed only for the + * implementation of getText(), a backwards compatibility issue. + */ + StringCharacterIterator fSCharIter; + + /** + * True when iteration has run off the end, and iterator functions should return UBRK_DONE. + */ + UBool fDone; + //======================================================================= // constructors //======================================================================= @@ -152,11 +152,11 @@ private: * * The break iterator adopts the memory, and will * free it when done. - * @internal (private) + * @internal (private) */ RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); - /** @internal */ + /** @internal */ friend class RBBIRuleBuilder; /** @internal */ friend class BreakIterator; @@ -190,17 +190,17 @@ public: UErrorCode &status); /** - * Construct a RuleBasedBreakIterator from a set of precompiled binary rules. + * Construct a RuleBasedBreakIterator from a set of precompiled binary rules. * Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules(). * Construction of a break iterator in this way is substantially faster than - * construction from source rules. + * construction from source rules. * * Ownership of the storage containing the compiled rules remains with the * caller of this function. The compiled rules must not be modified or * deleted during the life of the break iterator. * * The compiled rules are not compatible across different major versions of ICU. - * The compiled rules are compatible only between machines with the same + * The compiled rules are compatible only between machines with the same * byte ordering (little or big endian) and the same base character set family * (ASCII or EBCDIC). * @@ -262,19 +262,19 @@ public: * @return TRUE if both BreakIterators are not same. * @stable ICU 2.0 */ - inline UBool operator!=(const BreakIterator& that) const; + inline UBool operator!=(const BreakIterator& that) const; /** * Returns a newly-constructed RuleBasedBreakIterator with the same * behavior, and iterating over the same text, as this one. * Differs from the copy constructor in that it is polymorphic, and * will correctly clone (copy) a derived class. - * clone() is thread safe. Multiple threads may simultaneously + * clone() is thread safe. Multiple threads may simultaneously * clone the same source break iterator. * @return a newly-constructed RuleBasedBreakIterator * @stable ICU 2.0 */ - virtual RuleBasedBreakIterator* clone() const; + virtual RuleBasedBreakIterator* clone() const; /** * Compute a hash code for this BreakIterator @@ -434,7 +434,7 @@ public: virtual int32_t preceding(int32_t offset); /** - * Returns true if the specified position is a boundary position. As a side + * Returns true if the specified position is a boundary position. As a side * effect, leaves the iterator pointing to the first boundary position at * or after "offset". * @param offset the offset to check. @@ -444,10 +444,10 @@ public: virtual UBool isBoundary(int32_t offset); /** - * Returns the current iteration position. Note that UBRK_DONE is never - * returned from this function; if iteration has run to the end of a - * string, current() will return the length of the string while - * next() will return UBRK_DONE). + * Returns the current iteration position. Note that UBRK_DONE is never + * returned from this function; if iteration has run to the end of a + * string, current() will return the length of the string while + * next() will return UBRK_DONE). * @return The current iteration position. * @stable ICU 2.0 */ @@ -455,8 +455,8 @@ public: /** - * Return the status tag from the break rule that determined the boundary at - * the current iteration position. For break rules that do not specify a + * Return the status tag from the break rule that determined the boundary at + * the current iteration position. For break rules that do not specify a * status, a default value of 0 is returned. If more than one break rule * would cause a boundary to be located at some position in the text, * the numerically largest of the applicable status values is returned. @@ -473,14 +473,14 @@ public: * position from <code>next()</code>, <code>previous()</code>, or * any other break iterator functions that returns a boundary position. * <p> - * Note that <code>getRuleStatus()</code> returns the value corresponding to - * <code>current()</code> index even after <code>next()</code> has returned DONE. - * <p> + * Note that <code>getRuleStatus()</code> returns the value corresponding to + * <code>current()</code> index even after <code>next()</code> has returned DONE. + * <p> * When creating custom break rules, one is free to define whatever * status values may be convenient for the application. * <p> - * @return the status from the break rule that determined the boundary - * at the current iteration position. + * @return the status from the break rule that determined the boundary + * at the current iteration position. * * @see UWordBreak * @stable ICU 2.2 @@ -488,8 +488,8 @@ public: virtual int32_t getRuleStatus() const; /** - * Get the status (tag) values from the break rule(s) that determined the boundary - * at the current iteration position. + * Get the status (tag) values from the break rule(s) that determined the boundary + * at the current iteration position. * <p> * The returned status value(s) are stored into an array provided by the caller. * The values are stored in sorted (ascending) order. @@ -500,10 +500,10 @@ public: * @param fillInVec an array to be filled in with the status values. * @param capacity the length of the supplied vector. A length of zero causes * the function to return the number of status values, in the - * normal way, without attempting to store any values. + * normal way, without attempting to store any values. * @param status receives error codes. - * @return The number of rule status values from the rules that determined - * the boundary at the current iteration position. + * @return The number of rule status values from the rules that determined + * the boundary at the current iteration position. * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value * is the total number of status values that were available, * not the reduced number that were actually returned. @@ -538,13 +538,13 @@ public: */ static UClassID U_EXPORT2 getStaticClassID(void); -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Deprecated functionality. Use clone() instead. * * Create a clone (copy) of this break iterator in memory provided * by the caller. The idea is to increase performance by avoiding - * a storage allocation. Use of this function is NOT RECOMMENDED. + * a storage allocation. Use of this function is NOT RECOMMENDED. * Performance gains are minimal, and correct buffer management is * tricky. Use clone() instead. * @@ -557,7 +557,7 @@ public: * storage for the cloned object. * * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be - * returned if the provided buffer was too small, and + * returned if the provided buffer was too small, and * the clone was therefore put on the heap. * * @return Pointer to the clone object. This may differ from the stackBuffer @@ -565,10 +565,10 @@ public: * or if the stackBuffer was too small to hold the clone. * @deprecated ICU 52. Use clone() instead. */ - virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer, - int32_t &BufferSize, - UErrorCode &status); -#endif // U_FORCE_HIDE_DEPRECATED_API + virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status); +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Return the binary form of compiled break rules, @@ -580,7 +580,7 @@ public: * The binary data can only be used with the same version of ICU * and on the same platform type (processor endian-ness) * - * @param length Returns the length of the binary data. (Out parameter.) + * @param length Returns the length of the binary data. (Out parameter.) * * @return A pointer to the binary (compiled) rule data. The storage * belongs to the RulesBasedBreakIterator object, not the @@ -624,65 +624,65 @@ private: /** * Dumps caches and performs other actions associated with a complete change * in text or iteration position. - * @internal (private) + * @internal (private) */ void reset(void); /** * Common initialization function, used by constructors and bufferClone. - * @internal (private) + * @internal (private) */ - void init(UErrorCode &status); + void init(UErrorCode &status); /** - * Iterate backwards from an arbitrary position in the input text using the - * synthesized Safe Reverse rules. - * This locates a "Safe Position" from which the forward break rules - * will operate correctly. A Safe Position is not necessarily a boundary itself. - * - * @param fromPosition the position in the input text to begin the iteration. - * @internal (private) + * Iterate backwards from an arbitrary position in the input text using the + * synthesized Safe Reverse rules. + * This locates a "Safe Position" from which the forward break rules + * will operate correctly. A Safe Position is not necessarily a boundary itself. + * + * @param fromPosition the position in the input text to begin the iteration. + * @internal (private) */ - int32_t handleSafePrevious(int32_t fromPosition); + int32_t handleSafePrevious(int32_t fromPosition); /** - * Find a rule-based boundary by running the state machine. - * Input - * fPosition, the position in the text to begin from. - * Output - * fPosition: the boundary following the starting position. - * fDictionaryCharCount the number of dictionary characters encountered. - * If > 0, the segment will be further subdivided - * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. - * - * @internal (private) + * Find a rule-based boundary by running the state machine. + * Input + * fPosition, the position in the text to begin from. + * Output + * fPosition: the boundary following the starting position. + * fDictionaryCharCount the number of dictionary characters encountered. + * If > 0, the segment will be further subdivided + * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. + * + * @internal (private) */ - int32_t handleNext(); + int32_t handleNext(); /** * This function returns the appropriate LanguageBreakEngine for a * given character c. * @param c A character in the dictionary set - * @internal (private) + * @internal (private) */ const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); - public: -#ifndef U_HIDE_INTERNAL_API - /** - * Debugging function only. - * @internal - */ - void dumpCache(); - + public: +#ifndef U_HIDE_INTERNAL_API /** - * Debugging function only. - * @internal + * Debugging function only. + * @internal */ - void dumpTables(); + void dumpCache(); -#endif /* U_HIDE_INTERNAL_API */ + /** + * Debugging function only. + * @internal + */ + void dumpTables(); + +#endif /* U_HIDE_INTERNAL_API */ }; //------------------------------------------------------------------------------ @@ -699,6 +699,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/rbnf.h b/contrib/libs/icu/include/unicode/rbnf.h index 62b02324b1..089d6f3eed 100644 --- a/contrib/libs/icu/include/unicode/rbnf.h +++ b/contrib/libs/icu/include/unicode/rbnf.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -12,8 +12,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Rule Based Number Format @@ -698,7 +698,7 @@ public: * @return A copy of the object. * @stable ICU 2.6 */ - virtual RuleBasedNumberFormat* clone() const; + virtual RuleBasedNumberFormat* clone() const; /** * Return true if the given Format objects are semantically equal. @@ -867,30 +867,30 @@ public: FieldPosition& pos, UErrorCode& status) const; -protected: - /** - * Format a decimal number. - * The number is a DigitList wrapper onto a floating point decimal number. - * The default implementation in NumberFormat converts the decimal number - * to a double and formats that. Subclasses of NumberFormat that want - * to specifically handle big decimal numbers must override this method. - * class DecimalFormat does so. - * - * @param number The number, a DigitList format Decimal Floating Point. - * @param appendTo Output parameter to receive result. - * Result is appended to existing contents. - * @param pos On input: an alignment field, if desired. - * On output: the offsets of the alignment field. - * @param status Output param filled with success/failure status. - * @return Reference to 'appendTo' parameter. - * @internal - */ - virtual UnicodeString& format(const number::impl::DecimalQuantity &number, - UnicodeString& appendTo, - FieldPosition& pos, - UErrorCode& status) const; -public: - +protected: + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. Subclasses of NumberFormat that want + * to specifically handle big decimal numbers must override this method. + * class DecimalFormat does so. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const number::impl::DecimalQuantity &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; +public: + using NumberFormat::parse; /** @@ -989,20 +989,20 @@ public: */ virtual void setContext(UDisplayContext value, UErrorCode& status); - /** - * Get the rounding mode. - * @return A rounding mode - * @stable ICU 60 - */ - virtual ERoundingMode getRoundingMode(void) const; - - /** - * Set the rounding mode. - * @param roundingMode A rounding mode - * @stable ICU 60 - */ - virtual void setRoundingMode(ERoundingMode roundingMode); - + /** + * Get the rounding mode. + * @return A rounding mode + * @stable ICU 60 + */ + virtual ERoundingMode getRoundingMode(void) const; + + /** + * Set the rounding mode. + * @param roundingMode A rounding mode + * @stable ICU 60 + */ + virtual void setRoundingMode(ERoundingMode roundingMode); + public: /** * ICU "poor man's RTTI", returns a UClassID for this class. @@ -1069,12 +1069,12 @@ private: NFRule * initializeDefaultNaNRule(UErrorCode &status); const NFRule * getDefaultNaNRule() const; PluralFormat *createPluralFormat(UPluralType pluralType, const UnicodeString &pattern, UErrorCode& status) const; - UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const; - UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const; - void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const; + UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const; + UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const; + void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const; private: - NFRuleSet **fRuleSets; + NFRuleSet **fRuleSets; UnicodeString* ruleSetDescriptions; int32_t numRuleSets; NFRuleSet *defaultRuleSet; @@ -1083,7 +1083,7 @@ private: DecimalFormatSymbols* decimalFormatSymbols; NFRule *defaultInfinityRule; NFRule *defaultNaNRule; - ERoundingMode fRoundingMode; + ERoundingMode fRoundingMode; UBool lenient; UnicodeString* lenientParseRules; LocalizationInfo* localizations; @@ -1115,7 +1115,7 @@ U_NAMESPACE_END /* U_HAVE_RBNF */ #endif -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + /* RBNF_H */ #endif diff --git a/contrib/libs/icu/include/unicode/rbtz.h b/contrib/libs/icu/include/unicode/rbtz.h index d66e1f08ec..105499d8d3 100644 --- a/contrib/libs/icu/include/unicode/rbtz.h +++ b/contrib/libs/icu/include/unicode/rbtz.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -11,8 +11,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Rule based customizable time zone @@ -123,7 +123,7 @@ public: * @return A new copy of this TimeZone object. * @stable ICU 3.8 */ - virtual RuleBasedTimeZone* clone() const; + virtual RuleBasedTimeZone* clone() const; /** * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add @@ -226,7 +226,7 @@ public: */ virtual UBool useDaylightTime(void) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Queries if the given date is in daylight savings time in * this time zone. @@ -241,7 +241,7 @@ public: * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. */ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Returns true if this zone has the same rule and offset as another zone. @@ -363,8 +363,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // RBTZ_H //eof diff --git a/contrib/libs/icu/include/unicode/regex.h b/contrib/libs/icu/include/unicode/regex.h index 7f7d152280..a1d16b0480 100644 --- a/contrib/libs/icu/include/unicode/regex.h +++ b/contrib/libs/icu/include/unicode/regex.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ********************************************************************** * file name: regex.h -* encoding: UTF-8 +* encoding: UTF-8 * indentation:4 * * created on: 2002oct22 @@ -24,28 +24,28 @@ * \file * \brief C++ API: Regular Expressions * - * The ICU API for processing regular expressions consists of two classes, - * `RegexPattern` and `RegexMatcher`. - * `RegexPattern` objects represent a pre-processed, or compiled + * The ICU API for processing regular expressions consists of two classes, + * `RegexPattern` and `RegexMatcher`. + * `RegexPattern` objects represent a pre-processed, or compiled * regular expression. They are created from a regular expression pattern string, - * and can be used to create `RegexMatcher` objects for the pattern. + * and can be used to create `RegexMatcher` objects for the pattern. * - * Class `RegexMatcher` bundles together a regular expression + * Class `RegexMatcher` bundles together a regular expression * pattern and a target string to which the search pattern will be applied. - * `RegexMatcher` includes API for doing plain find or search + * `RegexMatcher` includes API for doing plain find or search * operations, for search and replace operations, and for obtaining detailed - * information about bounds of a match. + * information about bounds of a match. * - * Note that by constructing `RegexMatcher` objects directly from regular + * Note that by constructing `RegexMatcher` objects directly from regular * expression pattern strings application code can be simplified and the explicit - * need for `RegexPattern` objects can usually be eliminated. - * + * need for `RegexPattern` objects can usually be eliminated. + * */ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_REGULAR_EXPRESSIONS #include "unicode/uobject.h" @@ -66,7 +66,7 @@ class RegexCImpl; class RegexMatcher; class RegexPattern; struct REStackFrame; -class BreakIterator; +class BreakIterator; class UnicodeSet; class UVector; class UVector32; @@ -74,13 +74,13 @@ class UVector64; /** - * Class `RegexPattern` represents a compiled regular expression. It includes + * Class `RegexPattern` represents a compiled regular expression. It includes * factory methods for creating a RegexPattern object from the source (string) form * of a regular expression, methods for creating RegexMatchers that allow the pattern * to be applied to input text, and a few convenience methods for simple common * uses of regular expressions. * - * Class RegexPattern is not intended to be subclassed. + * Class RegexPattern is not intended to be subclassed. * * @stable ICU 2.4 */ @@ -90,7 +90,7 @@ public: /** * default constructor. Create a RegexPattern object that refers to no actual * pattern. Not normally needed; RegexPattern objects are usually - * created using the factory method `compile()`. + * created using the factory method `compile()`. * * @stable ICU 2.4 */ @@ -113,7 +113,7 @@ public: /** * Comparison operator. Two RegexPattern objects are considered equal if they - * were constructed from identical source patterns using the same #URegexpFlag + * were constructed from identical source patterns using the same #URegexpFlag * settings. * @param that a RegexPattern object to compare with "this". * @return TRUE if the objects are equivalent. @@ -123,7 +123,7 @@ public: /** * Comparison operator. Two RegexPattern objects are considered equal if they - * were constructed from identical source patterns using the same #URegexpFlag + * were constructed from identical source patterns using the same #URegexpFlag * settings. * @param that a RegexPattern object to compare with "this". * @return TRUE if the objects are different. @@ -153,16 +153,16 @@ public: * object. These compile methods, rather than the constructors, are the usual * way that RegexPattern objects are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * All #URegexpFlag pattern match mode flags are set to their default values. + * All #URegexpFlag pattern match mode flags are set to their default values. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string rather than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. * @param pe Receives the position (line and column nubers) of any error @@ -181,16 +181,16 @@ public: * object. These compile methods, rather than the constructors, are the usual * way that RegexPattern objects are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * All #URegexpFlag pattern match mode flags are set to their default values. + * All #URegexpFlag pattern match mode flags are set to their default values. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string rather than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. Note, the text referred * to by this UText must not be deleted during the lifetime of the @@ -208,21 +208,21 @@ public: /** * Compiles the regular expression in string form into a RegexPattern - * object using the specified #URegexpFlag match mode flags. These compile methods, + * object using the specified #URegexpFlag match mode flags. These compile methods, * rather than the constructors, are the usual way that RegexPattern objects * are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string instead of than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. - * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. + * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. * @param pe Receives the position (line and column numbers) of any error * within the regular expression.) * @param status A reference to a UErrorCode to receive any errors. @@ -237,23 +237,23 @@ public: /** * Compiles the regular expression in string form into a RegexPattern - * object using the specified #URegexpFlag match mode flags. These compile methods, + * object using the specified #URegexpFlag match mode flags. These compile methods, * rather than the constructors, are the usual way that RegexPattern objects * are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string instead of than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. Note, the text referred * to by this UText must not be deleted during the lifetime of the * RegexPattern object or any RegexMatcher object created from it. - * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. + * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. * @param pe Receives the position (line and column numbers) of any error * within the regular expression.) * @param status A reference to a UErrorCode to receive any errors. @@ -268,21 +268,21 @@ public: /** * Compiles the regular expression in string form into a RegexPattern - * object using the specified #URegexpFlag match mode flags. These compile methods, + * object using the specified #URegexpFlag match mode flags. These compile methods, * rather than the constructors, are the usual way that RegexPattern objects * are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string instead of than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. - * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. + * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. * @param status A reference to a UErrorCode to receive any errors. * @return A regexPattern object for the compiled pattern. * @@ -294,23 +294,23 @@ public: /** * Compiles the regular expression in string form into a RegexPattern - * object using the specified #URegexpFlag match mode flags. These compile methods, + * object using the specified #URegexpFlag match mode flags. These compile methods, * rather than the constructors, are the usual way that RegexPattern objects * are created. * - * Note that RegexPattern objects must not be deleted while RegexMatcher + * Note that RegexPattern objects must not be deleted while RegexMatcher * objects created from the pattern are active. RegexMatchers keep a pointer * back to their pattern, so premature deletion of the pattern is a - * catastrophic error. + * catastrophic error. * - * Note that it is often more convenient to construct a RegexMatcher directly + * Note that it is often more convenient to construct a RegexMatcher directly * from a pattern string instead of than separately compiling the pattern and - * then creating a RegexMatcher object from the pattern. + * then creating a RegexMatcher object from the pattern. * * @param regex The regular expression to be compiled. Note, the text referred * to by this UText must not be deleted during the lifetime of the * RegexPattern object or any RegexMatcher object created from it. - * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. + * @param flags The #URegexpFlag match mode flags to be used, e.g. #UREGEX_CASE_INSENSITIVE. * @param status A reference to a UErrorCode to receive any errors. * @return A regexPattern object for the compiled pattern. * @@ -321,8 +321,8 @@ public: UErrorCode &status); /** - * Get the #URegexpFlag match mode flags that were used when compiling this pattern. - * @return the #URegexpFlag match mode flags + * Get the #URegexpFlag match mode flags that were used when compiling this pattern. + * @return the #URegexpFlag match mode flags * @stable ICU 2.4 */ virtual uint32_t flags() const; @@ -332,7 +332,7 @@ public: * RegexMatcher can then be used to perform match, find or replace operations * on the input. Note that a RegexPattern object must not be deleted while * RegexMatchers created from it still exist and might possibly be used again. - * + * * The matcher will retain a reference to the supplied input string, and all regexp * pattern matching operations happen directly on this original string. It is * critical that the string not be altered or deleted before use by the regular @@ -350,17 +350,17 @@ public: private: /** * Cause a compilation error if an application accidentally attempts to - * create a matcher with a (char16_t *) string as input rather than + * create a matcher with a (char16_t *) string as input rather than * a UnicodeString. Avoids a dangling reference to a temporary string. - * - * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * + * To efficiently work with char16_t *strings, wrap the data in a UnicodeString * using one of the aliasing constructors, such as - * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` + * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` * or in a UText, using - * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` + * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` * */ - RegexMatcher *matcher(const char16_t *input, + RegexMatcher *matcher(const char16_t *input, UErrorCode &status) const; public: @@ -521,7 +521,7 @@ public: /** - * Split a string into fields. Somewhat like %split() from Perl or Java. + * Split a string into fields. Somewhat like %split() from Perl or Java. * Pattern matches identify delimiters that separate the input * into fields. The input data between the delimiters becomes the * fields themselves. @@ -540,7 +540,7 @@ public: * This behavior differs from Java, which ignores capture groups. * * For the best performance on split() operations, - * `RegexMatcher::split()` is preferable to this function + * `RegexMatcher::split()` is preferable to this function * * @param input The string to be split into fields. The field delimiters * match the pattern (in the "this" object) @@ -629,9 +629,9 @@ private: // // Implementation Methods // - void init(); // Common initialization, for use by constructors. - bool initNamedCaptureMap(); // Lazy init for fNamedCaptureMap. - void zap(); // Common cleanup + void init(); // Common initialization, for use by constructors. + bool initNamedCaptureMap(); // Lazy init for fNamedCaptureMap. + void zap(); // Common cleanup void dumpOp(int32_t index) const; @@ -668,7 +668,7 @@ public: * its matcher() method to create the RegexMatcher objects. * * @param regexp The Regular Expression to be compiled. - * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. + * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. * @param status Any errors are reported by setting this UErrorCode variable. * @stable ICU 2.6 */ @@ -683,7 +683,7 @@ public: * its matcher() method to create the RegexMatcher objects. * * @param regexp The regular expression to be compiled. - * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. + * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. * @param status Any errors are reported by setting this UErrorCode variable. * * @stable ICU 4.6 @@ -697,7 +697,7 @@ public: * created for the same expression, it will be more efficient to * separately create and cache a RegexPattern object, and use * its matcher() method to create the RegexMatcher objects. - * + * * The matcher will retain a reference to the supplied input string, and all regexp * pattern matching operations happen directly on the original string. It is * critical that the string not be altered or deleted before use by the regular @@ -706,7 +706,7 @@ public: * @param regexp The Regular Expression to be compiled. * @param input The string to match. The matcher retains a reference to the * caller's string; mo copy is made. - * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. + * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. * @param status Any errors are reported by setting this UErrorCode variable. * @stable ICU 2.6 */ @@ -720,7 +720,7 @@ public: * created for the same expression, it will be more efficient to * separately create and cache a RegexPattern object, and use * its matcher() method to create the RegexMatcher objects. - * + * * The matcher will make a shallow clone of the supplied input text, and all regexp * pattern matching operations happen on this clone. While read-only operations on * the supplied text are permitted, it is critical that the underlying string not be @@ -728,7 +728,7 @@ public: * * @param regexp The Regular Expression to be compiled. * @param input The string to match. The matcher retains a shallow clone of the text. - * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. + * @param flags #URegexpFlag options, such as #UREGEX_CASE_INSENSITIVE. * @param status Any errors are reported by setting this UErrorCode variable. * * @stable ICU 4.6 @@ -739,16 +739,16 @@ public: private: /** * Cause a compilation error if an application accidentally attempts to - * create a matcher with a (char16_t *) string as input rather than + * create a matcher with a (char16_t *) string as input rather than * a UnicodeString. Avoids a dangling reference to a temporary string. - * - * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * + * To efficiently work with char16_t *strings, wrap the data in a UnicodeString * using one of the aliasing constructors, such as - * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` + * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` * or in a UText, using - * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` + * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` */ - RegexMatcher(const UnicodeString ®exp, const char16_t *input, + RegexMatcher(const UnicodeString ®exp, const char16_t *input, uint32_t flags, UErrorCode &status); public: @@ -789,8 +789,8 @@ public: * always starts at the beginning of the input region; * unlike that function, it does not require that the entire region be matched. * - * If the match succeeds then more information can be obtained via the start(), - * end(), and group() functions. + * If the match succeeds then more information can be obtained via the start(), + * end(), and group() functions. * * @param status A reference to a UErrorCode to receive any errors. * @return TRUE if there is a match at the start of the input string. @@ -804,8 +804,8 @@ public: * The match may be of any length, and is not required to extend to the end * of the input string. Contrast with match(). * - * If the match succeeds then more information can be obtained via the start(), - * end(), and group() functions. + * If the match succeeds then more information can be obtained via the start(), + * end(), and group() functions. * * @param startIndex The input string (native) index at which to begin matching. * @param status A reference to a UErrorCode to receive any errors. @@ -819,11 +819,11 @@ public: * Find the next pattern match in the input string. * The find begins searching the input at the location following the end of * the previous match, or at the start of the string if there is no previous match. - * If a match is found, `start()`, `end()` and `group()` + * If a match is found, `start()`, `end()` and `group()` * will provide more information regarding the match. - * Note that if the input string is changed by the application, + * Note that if the input string is changed by the application, * use find(startPos, status) instead of find(), because the saved starting - * position may not be valid with the altered input string. + * position may not be valid with the altered input string. * @return TRUE if a match is found. * @stable ICU 2.4 */ @@ -834,12 +834,12 @@ public: * Find the next pattern match in the input string. * The find begins searching the input at the location following the end of * the previous match, or at the start of the string if there is no previous match. - * If a match is found, `start()`, `end()` and `group()` + * If a match is found, `start()`, `end()` and `group()` * will provide more information regarding the match. - * - * Note that if the input string is changed by the application, - * use find(startPos, status) instead of find(), because the saved starting - * position may not be valid with the altered input string. + * + * Note that if the input string is changed by the application, + * use find(startPos, status) instead of find(), because the saved starting + * position may not be valid with the altered input string. * @param status A reference to a UErrorCode to receive any errors. * @return TRUE if a match is found. * @stable ICU 55 @@ -1069,10 +1069,10 @@ public: * The effect is to remove any memory of previous matches, * and to cause subsequent find() operations to begin at * the specified (native) position in the input string. - * + * * The matcher's region is reset to its default, which is the entire * input string. - * + * * An alternative to this function is to set a match region * beginning at the desired index. * @@ -1147,17 +1147,17 @@ public: private: /** * Cause a compilation error if an application accidentally attempts to - * reset a matcher with a (char16_t *) string as input rather than + * reset a matcher with a (char16_t *) string as input rather than * a UnicodeString. Avoids a dangling reference to a temporary string. - * - * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * + * To efficiently work with char16_t *strings, wrap the data in a UnicodeString * using one of the aliasing constructors, such as - * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` + * `UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength);` * or in a UText, using - * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` + * `utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status);` * */ - RegexMatcher &reset(const char16_t *input); + RegexMatcher &reset(const char16_t *input); public: /** @@ -1403,15 +1403,15 @@ public: * the pattern with the replacement string. This is a convenience * function that provides a complete find-and-replace operation. * - * This function first resets this RegexMatcher. It then scans the input string + * This function first resets this RegexMatcher. It then scans the input string * looking for a match of the pattern. Input that is not part * of the match is appended directly to the result string; the match is replaced * in the result by the replacement string. The replacement string may contain - * references to captured groups. + * references to captured groups. * - * The state of the matcher (the position at which a subsequent find() + * The state of the matcher (the position at which a subsequent find() * would begin) after completing a replaceFirst() is not specified. The - * RegexMatcher should be reset before doing additional find() operations. + * RegexMatcher should be reset before doing additional find() operations. * * @param replacement a string containing the replacement text. * @param status a reference to a UErrorCode to receive any errors. @@ -1426,15 +1426,15 @@ public: * the pattern with the replacement string. This is a convenience * function that provides a complete find-and-replace operation. * - * This function first resets this RegexMatcher. It then scans the input string + * This function first resets this RegexMatcher. It then scans the input string * looking for a match of the pattern. Input that is not part * of the match is appended directly to the result string; the match is replaced * in the result by the replacement string. The replacement string may contain - * references to captured groups. + * references to captured groups. * - * The state of the matcher (the position at which a subsequent find() + * The state of the matcher (the position at which a subsequent find() * would begin) after completing a replaceFirst() is not specified. The - * RegexMatcher should be reset before doing additional find() operations. + * RegexMatcher should be reset before doing additional find() operations. * * @param replacement a string containing the replacement text. * @param dest a mutable UText in which the results are placed. @@ -1452,13 +1452,13 @@ public: * Implements a replace operation intended to be used as part of an * incremental find-and-replace. * - * The input string, starting from the end of the previous replacement and ending at + * The input string, starting from the end of the previous replacement and ending at * the start of the current match, is appended to the destination string. Then the * replacement string is appended to the output string, - * including handling any substitutions of captured text. + * including handling any substitutions of captured text. * - * For simple, prepackaged, non-incremental find-and-replace - * operations, see replaceFirst() or replaceAll(). + * For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll(). * * @param dest A UnicodeString to which the results of the find-and-replace are appended. * @param replacement A UnicodeString that provides the text to be substituted for @@ -1483,13 +1483,13 @@ public: * Implements a replace operation intended to be used as part of an * incremental find-and-replace. * - * The input string, starting from the end of the previous replacement and ending at + * The input string, starting from the end of the previous replacement and ending at * the start of the current match, is appended to the destination string. Then the * replacement string is appended to the output string, - * including handling any substitutions of captured text. + * including handling any substitutions of captured text. * - * For simple, prepackaged, non-incremental find-and-replace - * operations, see replaceFirst() or replaceAll(). + * For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll(). * * @param dest A mutable UText to which the results of the find-and-replace are appended. * Must not be NULL. @@ -1513,8 +1513,8 @@ public: /** * As the final step in a find-and-replace operation, append the remainder * of the input string, starting at the position following the last appendReplacement(), - * to the destination string. `appendTail()` is intended to be invoked after one - * or more invocations of the `RegexMatcher::appendReplacement()`. + * to the destination string. `appendTail()` is intended to be invoked after one + * or more invocations of the `RegexMatcher::appendReplacement()`. * * @param dest A UnicodeString to which the results of the find-and-replace are appended. * @return the destination string. @@ -1526,8 +1526,8 @@ public: /** * As the final step in a find-and-replace operation, append the remainder * of the input string, starting at the position following the last appendReplacement(), - * to the destination string. `appendTail()` is intended to be invoked after one - * or more invocations of the `RegexMatcher::appendReplacement()`. + * to the destination string. `appendTail()` is intended to be invoked after one + * or more invocations of the `RegexMatcher::appendReplacement()`. * * @param dest A mutable UText to which the results of the find-and-replace are appended. * Must not be NULL. @@ -1540,7 +1540,7 @@ public: /** - * Split a string into fields. Somewhat like %split() from Perl. + * Split a string into fields. Somewhat like %split() from Perl. * The pattern matches identify delimiters that separate the input * into fields. The input data between the matches becomes the * fields themselves. @@ -1569,7 +1569,7 @@ public: /** - * Split a string into fields. Somewhat like %split() from Perl. + * Split a string into fields. Somewhat like %split() from Perl. * The pattern matches identify delimiters that separate the input * into fields. The input data between the matches becomes the * fields themselves. @@ -1604,15 +1604,15 @@ public: * infinite loop. * When a limit is set a match operation will fail with an error if the * limit is exceeded. - * + * * The units of the limit are steps of the match engine. * Correspondence with actual processor time will depend on the speed * of the processor and the details of the specific pattern, but will * typically be on the order of milliseconds. - * + * * By default, the matching time is not limited. * - * + * * @param limit The limit value, or 0 for no limit. * @param status A reference to a UErrorCode to receive any errors. * @stable ICU 4.0 @@ -1630,16 +1630,16 @@ public: /** * Set the amount of heap storage available for use by the match backtracking stack. * The matcher is also reset, discarding any results from previous matches. - * + * * ICU uses a backtracking regular expression engine, with the backtrack stack * maintained on the heap. This function sets the limit to the amount of memory - * that can be used for this purpose. A backtracking stack overflow will + * that can be used for this purpose. A backtracking stack overflow will * result in an error from the match operation that caused it. - * + * * A limit is desirable because a malicious or poorly designed pattern can use * excessive memory, potentially crashing the process. A limit is enabled * by default. - * + * * @param limit The maximum size, in bytes, of the matching backtrack stack. * A value of zero means no limit. * The limit must be greater or equal to zero. @@ -1774,9 +1774,9 @@ private: void MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status); inline void backTrack(int64_t &inputIdx, int32_t &patIdx); UBool isWordBoundary(int64_t pos); // perform Perl-like \b test - UBool isUWordBoundary(int64_t pos, UErrorCode &status); // perform RBBI based \b test - // Find a grapheme cluster boundary using a break iterator. For handling \X in regexes. - int64_t followingGCBoundary(int64_t pos, UErrorCode &status); + UBool isUWordBoundary(int64_t pos, UErrorCode &status); // perform RBBI based \b test + // Find a grapheme cluster boundary using a break iterator. For handling \X in regexes. + int64_t followingGCBoundary(int64_t pos, UErrorCode &status); REStackFrame *resetStack(); inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status); void IncrementTime(UErrorCode &status); @@ -1870,13 +1870,13 @@ private: UErrorCode fDeferredStatus; // Save error state that cannot be immediately // reported, or that permanently disables this matcher. - BreakIterator *fWordBreakItr; - BreakIterator *fGCBreakItr; + BreakIterator *fWordBreakItr; + BreakIterator *fGCBreakItr; }; U_NAMESPACE_END #endif // UCONFIG_NO_REGULAR_EXPRESSIONS - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/region.h b/contrib/libs/icu/include/unicode/region.h index 9ec8dd4515..2c7322c9e9 100644 --- a/contrib/libs/icu/include/unicode/region.h +++ b/contrib/libs/icu/include/unicode/region.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -17,11 +17,11 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING -#include "unicode/uregion.h" +#include "unicode/uregion.h" #include "unicode/uobject.h" #include "unicode/uniset.h" #include "unicode/unistr.h" @@ -194,7 +194,7 @@ private: char id[4]; UnicodeString idStr; int32_t code; - URegionType fType; + URegionType fType; Region *containingRegion; UVector *containedRegions; UVector *preferredValues; @@ -221,9 +221,9 @@ private: U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // REGION_H //eof diff --git a/contrib/libs/icu/include/unicode/reldatefmt.h b/contrib/libs/icu/include/unicode/reldatefmt.h index d5533bb379..88c870dc9c 100644 --- a/contrib/libs/icu/include/unicode/reldatefmt.h +++ b/contrib/libs/icu/include/unicode/reldatefmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************** @@ -15,14 +15,14 @@ #define __RELDATEFMT_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/udisplaycontext.h" #include "unicode/ureldatefmt.h" #include "unicode/locid.h" -#include "unicode/formattedvalue.h" +#include "unicode/formattedvalue.h" /** * \file @@ -169,32 +169,32 @@ typedef enum UDateAbsoluteUnit { */ UDAT_ABSOLUTE_NOW, - /** - * Quarter - * @stable ICU 63 - */ - UDAT_ABSOLUTE_QUARTER, - -#ifndef U_HIDE_DRAFT_API - /** - * Hour - * @draft ICU 65 - */ - UDAT_ABSOLUTE_HOUR, - - /** - * Minute - * @draft ICU 65 - */ - UDAT_ABSOLUTE_MINUTE, -#endif // U_HIDE_DRAFT_API - + /** + * Quarter + * @stable ICU 63 + */ + UDAT_ABSOLUTE_QUARTER, + +#ifndef U_HIDE_DRAFT_API + /** + * Hour + * @draft ICU 65 + */ + UDAT_ABSOLUTE_HOUR, + + /** + * Minute + * @draft ICU 65 + */ + UDAT_ABSOLUTE_MINUTE, +#endif // U_HIDE_DRAFT_API + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UDateAbsoluteUnit value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UDAT_ABSOLUTE_UNIT_COUNT = UDAT_ABSOLUTE_NOW + 4 + UDAT_ABSOLUTE_UNIT_COUNT = UDAT_ABSOLUTE_NOW + 4 #endif // U_HIDE_DEPRECATED_API } UDateAbsoluteUnit; @@ -254,80 +254,80 @@ typedef enum UDateDirection { U_NAMESPACE_BEGIN -class BreakIterator; +class BreakIterator; class RelativeDateTimeCacheData; class SharedNumberFormat; class SharedPluralRules; class SharedBreakIterator; class NumberFormat; class UnicodeString; -class FormattedRelativeDateTime; -class FormattedRelativeDateTimeData; - -/** - * An immutable class containing the result of a relative datetime formatting operation. - * - * Instances of this class are immutable and thread-safe. - * - * Not intended for public subclassing. - * - * @stable ICU 64 - */ -class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue { - public: - /** - * Default constructor; makes an empty FormattedRelativeDateTime. - * @stable ICU 64 - */ - FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} - - /** - * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state. - * @stable ICU 64 - */ - FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT; - - /** - * Destruct an instance of FormattedRelativeDateTime. - * @stable ICU 64 - */ - virtual ~FormattedRelativeDateTime() U_OVERRIDE; - - /** Copying not supported; use move constructor instead. */ - FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete; - - /** Copying not supported; use move assignment instead. */ - FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete; - - /** - * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state. - * @stable ICU 64 - */ - FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT; - - /** @copydoc FormattedValue::toString() */ - UnicodeString toString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::toTempString() */ - UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::appendTo() */ - Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; - - /** @copydoc FormattedValue::nextPosition() */ - UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; - - private: - FormattedRelativeDateTimeData *fData; - UErrorCode fErrorCode; - explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results) - : fData(results), fErrorCode(U_ZERO_ERROR) {} - explicit FormattedRelativeDateTime(UErrorCode errorCode) - : fData(nullptr), fErrorCode(errorCode) {} - friend class RelativeDateTimeFormatter; -}; +class FormattedRelativeDateTime; +class FormattedRelativeDateTimeData; /** + * An immutable class containing the result of a relative datetime formatting operation. + * + * Instances of this class are immutable and thread-safe. + * + * Not intended for public subclassing. + * + * @stable ICU 64 + */ +class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue { + public: + /** + * Default constructor; makes an empty FormattedRelativeDateTime. + * @stable ICU 64 + */ + FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} + + /** + * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state. + * @stable ICU 64 + */ + FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT; + + /** + * Destruct an instance of FormattedRelativeDateTime. + * @stable ICU 64 + */ + virtual ~FormattedRelativeDateTime() U_OVERRIDE; + + /** Copying not supported; use move constructor instead. */ + FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete; + + /** Copying not supported; use move assignment instead. */ + FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete; + + /** + * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state. + * @stable ICU 64 + */ + FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT; + + /** @copydoc FormattedValue::toString() */ + UnicodeString toString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::toTempString() */ + UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::appendTo() */ + Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; + + /** @copydoc FormattedValue::nextPosition() */ + UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; + + private: + FormattedRelativeDateTimeData *fData; + UErrorCode fErrorCode; + explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results) + : fData(results), fErrorCode(U_ZERO_ERROR) {} + explicit FormattedRelativeDateTime(UErrorCode errorCode) + : fData(nullptr), fErrorCode(errorCode) {} + friend class RelativeDateTimeFormatter; +}; + +/** * Formats simple relative dates. There are two types of relative dates that * it handles: * <ul> @@ -417,7 +417,7 @@ public: * @param nfToAdopt Constructed object takes ownership of this pointer. * It is an error for caller to delete this pointer or change its * contents after calling this constructor. - * @param status Any error is returned here. + * @param status Any error is returned here. * @stable ICU 53 */ RelativeDateTimeFormatter( @@ -435,7 +435,7 @@ public: * @param style the format style. The UDAT_RELATIVE bit field has no effect. * @param capitalizationContext A value from UDisplayContext that pertains to * capitalization. - * @param status Any error is returned here. + * @param status Any error is returned here. * @stable ICU 54 */ RelativeDateTimeFormatter( @@ -467,10 +467,10 @@ public: /** * Formats a relative date with a quantity such as "in 5 days" or * "3 months ago" - * - * This method returns a String. To get more information about the - * formatting result, use formatToValue(). - * + * + * This method returns a String. To get more information about the + * formatting result, use formatToValue(). + * * @param quantity The numerical amount e.g 5. This value is formatted * according to this object's NumberFormat object. * @param direction NEXT means a future relative date; LAST means a past @@ -491,34 +491,34 @@ public: UErrorCode& status) const; /** - * Formats a relative date with a quantity such as "in 5 days" or - * "3 months ago" - * - * This method returns a FormattedRelativeDateTime, which exposes more - * information than the String returned by format(). - * - * @param quantity The numerical amount e.g 5. This value is formatted - * according to this object's NumberFormat object. - * @param direction NEXT means a future relative date; LAST means a past - * relative date. If direction is anything else, this method sets - * status to U_ILLEGAL_ARGUMENT_ERROR. - * @param unit the unit e.g day? month? year? - * @param status ICU error code returned here. - * @return The formatted relative datetime - * @stable ICU 64 - */ - FormattedRelativeDateTime formatToValue( - double quantity, - UDateDirection direction, - UDateRelativeUnit unit, - UErrorCode& status) const; - - /** + * Formats a relative date with a quantity such as "in 5 days" or + * "3 months ago" + * + * This method returns a FormattedRelativeDateTime, which exposes more + * information than the String returned by format(). + * + * @param quantity The numerical amount e.g 5. This value is formatted + * according to this object's NumberFormat object. + * @param direction NEXT means a future relative date; LAST means a past + * relative date. If direction is anything else, this method sets + * status to U_ILLEGAL_ARGUMENT_ERROR. + * @param unit the unit e.g day? month? year? + * @param status ICU error code returned here. + * @return The formatted relative datetime + * @stable ICU 64 + */ + FormattedRelativeDateTime formatToValue( + double quantity, + UDateDirection direction, + UDateRelativeUnit unit, + UErrorCode& status) const; + + /** * Formats a relative date without a quantity. - * - * This method returns a String. To get more information about the - * formatting result, use formatToValue(). - * + * + * This method returns a String. To get more information about the + * formatting result, use formatToValue(). + * * @param direction NEXT, LAST, THIS, etc. * @param unit e.g SATURDAY, DAY, MONTH * @param appendTo The string to which the formatted result will be @@ -536,32 +536,32 @@ public: UErrorCode& status) const; /** - * Formats a relative date without a quantity. - * - * This method returns a FormattedRelativeDateTime, which exposes more - * information than the String returned by format(). - * - * If the string is not available in the requested locale, the return - * value will be empty (calling toString will give an empty string). - * - * @param direction NEXT, LAST, THIS, etc. - * @param unit e.g SATURDAY, DAY, MONTH - * @param status ICU error code returned here. - * @return The formatted relative datetime - * @stable ICU 64 - */ - FormattedRelativeDateTime formatToValue( - UDateDirection direction, - UDateAbsoluteUnit unit, - UErrorCode& status) const; - - /** + * Formats a relative date without a quantity. + * + * This method returns a FormattedRelativeDateTime, which exposes more + * information than the String returned by format(). + * + * If the string is not available in the requested locale, the return + * value will be empty (calling toString will give an empty string). + * + * @param direction NEXT, LAST, THIS, etc. + * @param unit e.g SATURDAY, DAY, MONTH + * @param status ICU error code returned here. + * @return The formatted relative datetime + * @stable ICU 64 + */ + FormattedRelativeDateTime formatToValue( + UDateDirection direction, + UDateAbsoluteUnit unit, + UErrorCode& status) const; + + /** * Format a combination of URelativeDateTimeUnit and numeric offset * using a numeric style, e.g. "1 week ago", "in 1 week", * "5 weeks ago", "in 5 weeks". - * - * This method returns a String. To get more information about the - * formatting result, use formatNumericToValue(). + * + * This method returns a String. To get more information about the + * formatting result, use formatNumericToValue(). * * @param offset The signed offset for the specified unit. This * will be formatted according to this object's @@ -573,7 +573,7 @@ public: * appended. * @param status ICU error code returned here. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString& formatNumeric( double offset, @@ -583,37 +583,37 @@ public: /** * Format a combination of URelativeDateTimeUnit and numeric offset - * using a numeric style, e.g. "1 week ago", "in 1 week", - * "5 weeks ago", "in 5 weeks". - * - * This method returns a FormattedRelativeDateTime, which exposes more - * information than the String returned by formatNumeric(). + * using a numeric style, e.g. "1 week ago", "in 1 week", + * "5 weeks ago", "in 5 weeks". * - * @param offset The signed offset for the specified unit. This - * will be formatted according to this object's - * NumberFormat object. - * @param unit The unit to use when formatting the relative - * date, e.g. UDAT_REL_UNIT_WEEK, - * UDAT_REL_UNIT_FRIDAY. - * @param status ICU error code returned here. - * @return The formatted relative datetime - * @stable ICU 64 - */ - FormattedRelativeDateTime formatNumericToValue( - double offset, - URelativeDateTimeUnit unit, - UErrorCode& status) const; - - /** - * Format a combination of URelativeDateTimeUnit and numeric offset + * This method returns a FormattedRelativeDateTime, which exposes more + * information than the String returned by formatNumeric(). + * + * @param offset The signed offset for the specified unit. This + * will be formatted according to this object's + * NumberFormat object. + * @param unit The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, + * UDAT_REL_UNIT_FRIDAY. + * @param status ICU error code returned here. + * @return The formatted relative datetime + * @stable ICU 64 + */ + FormattedRelativeDateTime formatNumericToValue( + double offset, + URelativeDateTimeUnit unit, + UErrorCode& status) const; + + /** + * Format a combination of URelativeDateTimeUnit and numeric offset * using a text style if possible, e.g. "last week", "this week", * "next week", "yesterday", "tomorrow". Falls back to numeric * style if no appropriate text term is available for the specified * offset in the object's locale. * - * This method returns a String. To get more information about the - * formatting result, use formatToValue(). - * + * This method returns a String. To get more information about the + * formatting result, use formatToValue(). + * * @param offset The signed offset for the specified unit. * @param unit The unit to use when formatting the relative * date, e.g. UDAT_REL_UNIT_WEEK, @@ -622,7 +622,7 @@ public: * appended. * @param status ICU error code returned here. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString& format( double offset, @@ -631,29 +631,29 @@ public: UErrorCode& status) const; /** - * Format a combination of URelativeDateTimeUnit and numeric offset - * using a text style if possible, e.g. "last week", "this week", - * "next week", "yesterday", "tomorrow". Falls back to numeric - * style if no appropriate text term is available for the specified - * offset in the object's locale. - * - * This method returns a FormattedRelativeDateTime, which exposes more - * information than the String returned by format(). - * - * @param offset The signed offset for the specified unit. - * @param unit The unit to use when formatting the relative - * date, e.g. UDAT_REL_UNIT_WEEK, - * UDAT_REL_UNIT_FRIDAY. - * @param status ICU error code returned here. - * @return The formatted relative datetime - * @stable ICU 64 - */ - FormattedRelativeDateTime formatToValue( - double offset, - URelativeDateTimeUnit unit, - UErrorCode& status) const; - - /** + * Format a combination of URelativeDateTimeUnit and numeric offset + * using a text style if possible, e.g. "last week", "this week", + * "next week", "yesterday", "tomorrow". Falls back to numeric + * style if no appropriate text term is available for the specified + * offset in the object's locale. + * + * This method returns a FormattedRelativeDateTime, which exposes more + * information than the String returned by format(). + * + * @param offset The signed offset for the specified unit. + * @param unit The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, + * UDAT_REL_UNIT_FRIDAY. + * @param status ICU error code returned here. + * @return The formatted relative datetime + * @stable ICU 64 + */ + FormattedRelativeDateTime formatToValue( + double offset, + URelativeDateTimeUnit unit, + UErrorCode& status) const; + + /** * Combines a relative date string and a time string in this object's * locale. This is done with the same date-time separator used for the * default calendar in this locale. @@ -704,50 +704,50 @@ private: NumberFormat *nfToAdopt, BreakIterator *brkIter, UErrorCode &status); - UnicodeString& adjustForContext(UnicodeString &) const; - UBool checkNoAdjustForContext(UErrorCode& status) const; - - template<typename F, typename... Args> - UnicodeString& doFormat( - F callback, - UnicodeString& appendTo, - UErrorCode& status, - Args... args) const; - - template<typename F, typename... Args> - FormattedRelativeDateTime doFormatToValue( - F callback, - UErrorCode& status, - Args... args) const; - - void formatImpl( - double quantity, - UDateDirection direction, - UDateRelativeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const; - void formatAbsoluteImpl( - UDateDirection direction, - UDateAbsoluteUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const; - void formatNumericImpl( - double offset, - URelativeDateTimeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const; - void formatRelativeImpl( - double offset, - URelativeDateTimeUnit unit, - FormattedRelativeDateTimeData& output, - UErrorCode& status) const; + UnicodeString& adjustForContext(UnicodeString &) const; + UBool checkNoAdjustForContext(UErrorCode& status) const; + + template<typename F, typename... Args> + UnicodeString& doFormat( + F callback, + UnicodeString& appendTo, + UErrorCode& status, + Args... args) const; + + template<typename F, typename... Args> + FormattedRelativeDateTime doFormatToValue( + F callback, + UErrorCode& status, + Args... args) const; + + void formatImpl( + double quantity, + UDateDirection direction, + UDateRelativeUnit unit, + FormattedRelativeDateTimeData& output, + UErrorCode& status) const; + void formatAbsoluteImpl( + UDateDirection direction, + UDateAbsoluteUnit unit, + FormattedRelativeDateTimeData& output, + UErrorCode& status) const; + void formatNumericImpl( + double offset, + URelativeDateTimeUnit unit, + FormattedRelativeDateTimeData& output, + UErrorCode& status) const; + void formatRelativeImpl( + double offset, + URelativeDateTimeUnit unit, + FormattedRelativeDateTimeData& output, + UErrorCode& status) const; }; U_NAMESPACE_END #endif /* !UCONFIG_NO_BREAK_ITERATION */ #endif /* !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif /* __RELDATEFMT_H */ diff --git a/contrib/libs/icu/include/unicode/rep.h b/contrib/libs/icu/include/unicode/rep.h index 6dd4530647..b79d0a5530 100644 --- a/contrib/libs/icu/include/unicode/rep.h +++ b/contrib/libs/icu/include/unicode/rep.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ************************************************************************** @@ -16,10 +16,10 @@ #ifndef REP_H #define REP_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -97,7 +97,7 @@ public: * @return 16-bit code unit of text at given offset * @stable ICU 1.8 */ - inline char16_t charAt(int32_t offset) const; + inline char16_t charAt(int32_t offset) const; /** * Returns the 32-bit code point at the given 16-bit offset into @@ -231,7 +231,7 @@ protected: * Virtual version of charAt(). * @stable ICU 2.4 */ - virtual char16_t getCharAt(int32_t offset) const = 0; + virtual char16_t getCharAt(int32_t offset) const = 0; /** * Virtual version of char32At(). @@ -247,7 +247,7 @@ Replaceable::length() const { return getLength(); } -inline char16_t +inline char16_t Replaceable::charAt(int32_t offset) const { return getCharAt(offset); } @@ -261,6 +261,6 @@ Replaceable::char32At(int32_t offset) const { U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/resbund.h b/contrib/libs/icu/include/unicode/resbund.h index 2894067528..cd9b784899 100644 --- a/contrib/libs/icu/include/unicode/resbund.h +++ b/contrib/libs/icu/include/unicode/resbund.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -49,9 +49,9 @@ #define RESBUND_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/ures.h" #include "unicode/unistr.h" @@ -135,7 +135,7 @@ public: ResourceBundle(UErrorCode &err); /** - * Standard constructor, constructs a resource bundle for the locale-specific + * Standard constructor, constructs a resource bundle for the locale-specific * bundle in the specified package. * * @param packageName The packageName and locale together point to an ICU udata object, @@ -219,7 +219,7 @@ public: * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found * could be a warning * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> - * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file. + * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ UnicodeString @@ -492,7 +492,7 @@ private: }; U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/schriter.h b/contrib/libs/icu/include/unicode/schriter.h index 1ca5b70fca..541d296820 100644 --- a/contrib/libs/icu/include/unicode/schriter.h +++ b/contrib/libs/icu/include/unicode/schriter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -21,9 +21,9 @@ #define SCHRITER_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/chariter.h" #include "unicode/uchriter.h" @@ -72,7 +72,7 @@ public: * Create an iterator over the UnicodeString referred to by "textStr". * The UnicodeString object is copied. * The iteration range begins with the code unit specified by - * "textBegin" and ends with the code unit BEFORE the code unit specified + * "textBegin" and ends with the code unit BEFORE the code unit specified * by "textEnd". The starting position is specified by "textPos". If * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., * textBegin >= textEnd or either is negative or greater than text.size()), @@ -133,7 +133,7 @@ public: * @return the newly cloned object. * @stable ICU 2.0 */ - virtual StringCharacterIterator* clone() const; + virtual StringCharacterIterator* clone() const; /** * Sets the iterator to iterate over the provided string. @@ -178,7 +178,7 @@ protected: * @param newTextLength The length of the String * @stable ICU 2.0 */ - void setText(const char16_t* newText, int32_t newTextLength); + void setText(const char16_t* newText, int32_t newTextLength); /** * Copy of the iterated string object. @@ -189,7 +189,7 @@ protected: }; U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/scientificnumberformatter.h b/contrib/libs/icu/include/unicode/scientificnumberformatter.h index 7f860d4f59..49f203fa43 100644 --- a/contrib/libs/icu/include/unicode/scientificnumberformatter.h +++ b/contrib/libs/icu/include/unicode/scientificnumberformatter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -11,8 +11,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING @@ -159,7 +159,7 @@ public: class U_I18N_API SuperscriptStyle : public Style { public: - virtual SuperscriptStyle *clone() const; + virtual SuperscriptStyle *clone() const; protected: virtual UnicodeString &format( const UnicodeString &original, @@ -177,7 +177,7 @@ public: : Style(), fBeginMarkup(beginMarkup), fEndMarkup(endMarkup) { } - virtual MarkupStyle *clone() const; + virtual MarkupStyle *clone() const; protected: virtual UnicodeString &format( const UnicodeString &original, @@ -216,7 +216,7 @@ U_NAMESPACE_END #endif /* !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/search.h b/contrib/libs/icu/include/unicode/search.h index 2865366a33..43f811b935 100644 --- a/contrib/libs/icu/include/unicode/search.h +++ b/contrib/libs/icu/include/unicode/search.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -14,8 +14,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: SearchIterator object. @@ -72,7 +72,7 @@ U_NAMESPACE_BEGIN * UErrorCode error = U_ZERO_ERROR; * for (int pos = iter->first(error); pos != USEARCH_DONE; * pos = iter->next(error)) { - * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength()); + * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength()); * } * </code></pre> * @@ -574,7 +574,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/selfmt.h b/contrib/libs/icu/include/unicode/selfmt.h index 9b98f6db7a..3ae0a5717f 100644 --- a/contrib/libs/icu/include/unicode/selfmt.h +++ b/contrib/libs/icu/include/unicode/selfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: @@ -18,10 +18,10 @@ #ifndef SELFMT #define SELFMT -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/messagepattern.h" #include "unicode/numfmt.h" @@ -275,7 +275,7 @@ public: * result and should delete it when done. * @stable ICU 4.4 */ - virtual SelectFormat* clone() const; + virtual SelectFormat* clone() const; /** * Format an object to produce a string. @@ -368,7 +368,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _SELFMT //eof diff --git a/contrib/libs/icu/include/unicode/simpleformatter.h b/contrib/libs/icu/include/unicode/simpleformatter.h index 9414bca308..88a211ce66 100644 --- a/contrib/libs/icu/include/unicode/simpleformatter.h +++ b/contrib/libs/icu/include/unicode/simpleformatter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -17,20 +17,20 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/unistr.h" U_NAMESPACE_BEGIN -// Forward declaration: -namespace number { -namespace impl { -class SimpleModifier; -} -} - +// Forward declaration: +namespace number { +namespace impl { +class SimpleModifier; +} +} + /** * Formats simple patterns like "{1} was born in {0}". * Minimal subset of MessageFormat; fast, simple, minimal dependencies. @@ -57,15 +57,15 @@ class SimpleModifier; * * @see MessageFormat * @see UMessagePatternApostropheMode - * @stable ICU 57 + * @stable ICU 57 */ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { public: /** * Default constructor. - * @stable ICU 57 + * @stable ICU 57 */ - SimpleFormatter() : compiledPattern((char16_t)0) {} + SimpleFormatter() : compiledPattern((char16_t)0) {} /** * Constructs a formatter from the pattern string. @@ -74,7 +74,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. - * @stable ICU 57 + * @stable ICU 57 */ SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) { applyPattern(pattern, errorCode); @@ -92,7 +92,7 @@ public: * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and * too few or too many arguments. - * @stable ICU 57 + * @stable ICU 57 */ SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max, UErrorCode &errorCode) { @@ -101,20 +101,20 @@ public: /** * Copy constructor. - * @stable ICU 57 + * @stable ICU 57 */ SimpleFormatter(const SimpleFormatter& other) : compiledPattern(other.compiledPattern) {} /** * Assignment operator. - * @stable ICU 57 + * @stable ICU 57 */ SimpleFormatter &operator=(const SimpleFormatter& other); /** * Destructor. - * @stable ICU 57 + * @stable ICU 57 */ ~SimpleFormatter(); @@ -126,7 +126,7 @@ public: * Must fulfill U_SUCCESS before the function call. * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. * @return TRUE if U_SUCCESS(errorCode). - * @stable ICU 57 + * @stable ICU 57 */ UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) { return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode); @@ -145,14 +145,14 @@ public: * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and * too few or too many arguments. * @return TRUE if U_SUCCESS(errorCode). - * @stable ICU 57 + * @stable ICU 57 */ UBool applyPatternMinMaxArguments(const UnicodeString &pattern, int32_t min, int32_t max, UErrorCode &errorCode); /** * @return The max argument number + 1. - * @stable ICU 57 + * @stable ICU 57 */ int32_t getArgumentLimit() const { return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length()); @@ -168,7 +168,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString &format( const UnicodeString &value0, @@ -185,7 +185,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString &format( const UnicodeString &value0, @@ -204,7 +204,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString &format( const UnicodeString &value0, @@ -229,7 +229,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return appendTo - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString &formatAndAppend( const UnicodeString *const *values, int32_t valuesLength, @@ -255,7 +255,7 @@ public: * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return result - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString &formatAndReplace( const UnicodeString *const *values, int32_t valuesLength, @@ -265,41 +265,41 @@ public: /** * Returns the pattern text with none of the arguments. * Like formatting with all-empty string values. - * @stable ICU 57 + * @stable ICU 57 */ UnicodeString getTextWithNoArguments() const { - return getTextWithNoArguments( - compiledPattern.getBuffer(), - compiledPattern.length(), - nullptr, - 0); + return getTextWithNoArguments( + compiledPattern.getBuffer(), + compiledPattern.length(), + nullptr, + 0); } -#ifndef U_HIDE_INTERNAL_API - /** - * Returns the pattern text with none of the arguments. - * Like formatting with all-empty string values. - * - * TODO(ICU-20406): Replace this with an Iterator interface. - * - * @param offsets offsets[i] receives the offset of where {i} was located - * before it was replaced by an empty string. - * For example, "a{0}b{1}" produces offset 1 for i=0 and 2 for i=1. - * Can be nullptr if offsetsLength==0. - * If there is no {i} in the pattern, then offsets[i] is set to -1. - * @param offsetsLength The length of the offsets array. - * - * @internal - */ - UnicodeString getTextWithNoArguments(int32_t *offsets, int32_t offsetsLength) const { - return getTextWithNoArguments( - compiledPattern.getBuffer(), - compiledPattern.length(), - offsets, - offsetsLength); - } -#endif // U_HIDE_INTERNAL_API - +#ifndef U_HIDE_INTERNAL_API + /** + * Returns the pattern text with none of the arguments. + * Like formatting with all-empty string values. + * + * TODO(ICU-20406): Replace this with an Iterator interface. + * + * @param offsets offsets[i] receives the offset of where {i} was located + * before it was replaced by an empty string. + * For example, "a{0}b{1}" produces offset 1 for i=0 and 2 for i=1. + * Can be nullptr if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * + * @internal + */ + UnicodeString getTextWithNoArguments(int32_t *offsets, int32_t offsetsLength) const { + return getTextWithNoArguments( + compiledPattern.getBuffer(), + compiledPattern.length(), + offsets, + offsetsLength); + } +#endif // U_HIDE_INTERNAL_API + private: /** * Binary representation of the compiled pattern. @@ -312,30 +312,30 @@ private: */ UnicodeString compiledPattern; - static inline int32_t getArgumentLimit(const char16_t *compiledPattern, + static inline int32_t getArgumentLimit(const char16_t *compiledPattern, int32_t compiledPatternLength) { return compiledPatternLength == 0 ? 0 : compiledPattern[0]; } - static UnicodeString getTextWithNoArguments( - const char16_t *compiledPattern, - int32_t compiledPatternLength, - int32_t *offsets, - int32_t offsetsLength); + static UnicodeString getTextWithNoArguments( + const char16_t *compiledPattern, + int32_t compiledPatternLength, + int32_t *offsets, + int32_t offsetsLength); static UnicodeString &format( - const char16_t *compiledPattern, int32_t compiledPatternLength, + const char16_t *compiledPattern, int32_t compiledPatternLength, const UnicodeString *const *values, UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue, int32_t *offsets, int32_t offsetsLength, UErrorCode &errorCode); - - // Give access to internals to SimpleModifier for number formatting - friend class number::impl::SimpleModifier; + + // Give access to internals to SimpleModifier for number formatting + friend class number::impl::SimpleModifier; }; U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* U_SHOW_CPLUSPLUS_API */ #endif // __SIMPLEFORMATTER_H__ diff --git a/contrib/libs/icu/include/unicode/simpletz.h b/contrib/libs/icu/include/unicode/simpletz.h index 980a1b8c62..b7c06635a8 100644 --- a/contrib/libs/icu/include/unicode/simpletz.h +++ b/contrib/libs/icu/include/unicode/simpletz.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -28,8 +28,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone. @@ -649,8 +649,8 @@ public: * Sets the amount of time in ms that the clock is advanced during DST. * @param millisSavedDuringDST the number of milliseconds the time is * advanced with respect to standard time when the daylight savings rules - * are in effect. Typically one hour (+3600000). The amount could be negative, - * but not 0. + * are in effect. Typically one hour (+3600000). The amount could be negative, + * but not 0. * @param status An UErrorCode to receive the status. * @stable ICU 2.0 */ @@ -660,8 +660,8 @@ public: * Returns the amount of time in ms that the clock is advanced during DST. * @return the number of milliseconds the time is * advanced with respect to standard time when the daylight savings rules - * are in effect. Typically one hour (+3600000). The amount could be negative, - * but not 0. + * are in effect. Typically one hour (+3600000). The amount could be negative, + * but not 0. * @stable ICU 2.0 */ virtual int32_t getDSTSavings(void) const; @@ -674,7 +674,7 @@ public: */ virtual UBool useDaylightTime(void) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Returns true if the given date is within the period when daylight savings time * is in effect; false otherwise. If the TimeZone doesn't observe daylight savings @@ -690,7 +690,7 @@ public: * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. */ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Return true if this zone has the same rules and offset as another zone. @@ -707,7 +707,7 @@ public: * @return A new copy of this TimeZone object. * @stable ICU 2.0 */ - virtual SimpleTimeZone* clone() const; + virtual SimpleTimeZone* clone() const; /** * Gets the first time zone transition after the base time. @@ -933,6 +933,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _SIMPLETZ diff --git a/contrib/libs/icu/include/unicode/smpdtfmt.h b/contrib/libs/icu/include/unicode/smpdtfmt.h index b4b0e5fb39..c0b12d801d 100644 --- a/contrib/libs/icu/include/unicode/smpdtfmt.h +++ b/contrib/libs/icu/include/unicode/smpdtfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 1997-2016, International Business Machines Corporation and @@ -28,8 +28,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Format and parse dates in a language-independent manner. @@ -51,12 +51,12 @@ class FieldPositionHandler; class TimeZoneFormat; class SharedNumberFormat; class SimpleDateFormatMutableNFs; -class DateIntervalFormat; - -namespace number { -class LocalizedNumberFormatter; -} +class DateIntervalFormat; +namespace number { +class LocalizedNumberFormatter; +} + /** * * SimpleDateFormat is a concrete class for formatting and parsing dates in a @@ -867,7 +867,7 @@ public: * @return A copy of the object. * @stable ICU 2.0 */ - virtual SimpleDateFormat* clone() const; + virtual SimpleDateFormat* clone() const; /** * Return true if the given Format objects are semantically equal. Objects @@ -1150,7 +1150,7 @@ public: * Overrides base class method and * This method clears per field NumberFormat instances * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)} - * @param formatToAdopt the NumbeferFormat used + * @param formatToAdopt the NumbeferFormat used * @stable ICU 54 */ void adoptNumberFormat(NumberFormat *formatToAdopt); @@ -1165,7 +1165,7 @@ public: * Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)} * * @param fields the fields to override(like y) - * @param formatToAdopt the NumbeferFormat used + * @param formatToAdopt the NumbeferFormat used * @param status Receives a status code, which will be U_ZERO_ERROR * if the operation succeeds. * @stable ICU 54 @@ -1177,7 +1177,7 @@ public: * @param field The UDateFormatField to get * @stable ICU 54 */ - const NumberFormat * getNumberFormatForField(char16_t field) const; + const NumberFormat * getNumberFormatForField(char16_t field) const; #ifndef U_HIDE_INTERNAL_API /** @@ -1220,7 +1220,7 @@ public: private: friend class DateFormat; - friend class DateIntervalFormat; + friend class DateIntervalFormat; void initializeDefaultCentury(void); @@ -1270,11 +1270,11 @@ private: * succeeds. */ void subFormat(UnicodeString &appendTo, - char16_t ch, + char16_t ch, int32_t count, UDisplayContext capitalizationContext, int32_t fieldNum, - char16_t fieldToOutput, + char16_t fieldToOutput, FieldPositionHandler& handler, Calendar& cal, UErrorCode& status) const; // in case of illegal argument @@ -1292,7 +1292,7 @@ private: * @param minDigits Minimum number of digits the result should have * @param maxDigits Maximum number of digits the result should have */ - void zeroPaddingNumber(const NumberFormat *currentNumberFormat, + void zeroPaddingNumber(const NumberFormat *currentNumberFormat, UnicodeString &appendTo, int32_t value, int32_t minDigits, @@ -1302,7 +1302,7 @@ private: * Return true if the given format character, occuring count * times, represents a numeric field. */ - static UBool isNumeric(char16_t formatChar, int32_t count); + static UBool isNumeric(char16_t formatChar, int32_t count); /** * Returns TRUE if the patternOffset is at the start of a numeric field. @@ -1420,38 +1420,38 @@ private: * @return the new start position if matching succeeded; a negative number * indicating matching failure, otherwise. */ - int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count, + int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count, UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal, - int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, + int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, int32_t *dayPeriod=NULL) const; void parseInt(const UnicodeString& text, Formattable& number, ParsePosition& pos, UBool allowNegative, - const NumberFormat *fmt) const; + const NumberFormat *fmt) const; void parseInt(const UnicodeString& text, Formattable& number, int32_t maxDigits, ParsePosition& pos, UBool allowNegative, - const NumberFormat *fmt) const; + const NumberFormat *fmt) const; int32_t checkIntSuffix(const UnicodeString& text, int32_t start, int32_t patLoc, UBool isNegative) const; /** - * Counts number of digit code points in the specified text. - * - * @param text input text - * @param start start index, inclusive - * @param end end index, exclusive - * @return number of digits found in the text in the specified range. - */ - int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const; - - /** + * Counts number of digit code points in the specified text. + * + * @param text input text + * @param start start index, inclusive + * @param end end index, exclusive + * @return number of digits found in the text in the specified range. + */ + int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const; + + /** * Translate a pattern, mapping each character in the from string to the * corresponding character in the to string. Return an error if the original * pattern contains an unmapped character, or if a quote is unmatched. @@ -1504,16 +1504,16 @@ private: int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const; /** - * Initialize LocalizedNumberFormatter instances used for speedup. - */ - void initFastNumberFormatters(UErrorCode& status); - - /** - * Delete the LocalizedNumberFormatter instances used for speedup. - */ - void freeFastNumberFormatters(); - - /** + * Initialize LocalizedNumberFormatter instances used for speedup. + */ + void initFastNumberFormatters(UErrorCode& status); + + /** + * Delete the LocalizedNumberFormatter instances used for speedup. + */ + void freeFastNumberFormatters(); + + /** * Initialize NumberFormat instances used for numbering system overrides. */ void initNumberFormatters(const Locale &locale,UErrorCode &status); @@ -1536,7 +1536,7 @@ private: /** * Lazy TimeZoneFormat instantiation, semantically const */ - TimeZoneFormat *tzFormat(UErrorCode &status) const; + TimeZoneFormat *tzFormat(UErrorCode &status) const; const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const; @@ -1551,12 +1551,12 @@ private: /** * Map calendar field letter into calendar field level. */ - static int32_t getLevelFromChar(char16_t ch); + static int32_t getLevelFromChar(char16_t ch); /** * Tell if a character can be used to define a field in a format string. */ - static UBool isSyntaxChar(char16_t ch); + static UBool isSyntaxChar(char16_t ch); /** * The formatting pattern for this formatter. @@ -1602,7 +1602,7 @@ private: UBool fHasMinute; UBool fHasSecond; - UBool fHasHanYearChar; // pattern contains the Han year character \u5E74 + UBool fHasHanYearChar; // pattern contains the Han year character \u5E74 /** * Sets fHasMinutes and fHasSeconds. @@ -1630,23 +1630,23 @@ private: */ const SharedNumberFormat **fSharedNumberFormatters; - enum NumberFormatterKey { - SMPDTFMT_NF_1x10, - SMPDTFMT_NF_2x10, - SMPDTFMT_NF_3x10, - SMPDTFMT_NF_4x10, - SMPDTFMT_NF_2x2, - SMPDTFMT_NF_COUNT - }; - - /** - * Number formatters pre-allocated for fast performance on the most common integer lengths. - */ - const number::LocalizedNumberFormatter* fFastNumberFormatters[SMPDTFMT_NF_COUNT] = {}; - + enum NumberFormatterKey { + SMPDTFMT_NF_1x10, + SMPDTFMT_NF_2x10, + SMPDTFMT_NF_3x10, + SMPDTFMT_NF_4x10, + SMPDTFMT_NF_2x2, + SMPDTFMT_NF_COUNT + }; + + /** + * Number formatters pre-allocated for fast performance on the most common integer lengths. + */ + const number::LocalizedNumberFormatter* fFastNumberFormatters[SMPDTFMT_NF_COUNT] = {}; + UBool fHaveDefaultCentury; - const BreakIterator* fCapitalizationBrkIter; + const BreakIterator* fCapitalizationBrkIter; }; inline UDate @@ -1659,7 +1659,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // _SMPDTFMT //eof diff --git a/contrib/libs/icu/include/unicode/sortkey.h b/contrib/libs/icu/include/unicode/sortkey.h index 34ed7ee692..25c59f82f4 100644 --- a/contrib/libs/icu/include/unicode/sortkey.h +++ b/contrib/libs/icu/include/unicode/sortkey.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************** @@ -25,8 +25,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Keys for comparing strings multiple times. @@ -339,6 +339,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/std_string.h b/contrib/libs/icu/include/unicode/std_string.h index bf87230167..d4311cadc1 100644 --- a/contrib/libs/icu/include/unicode/std_string.h +++ b/contrib/libs/icu/include/unicode/std_string.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: std_string.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -27,15 +27,15 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API +#if U_SHOW_CPLUSPLUS_API -// Workaround for a libstdc++ bug before libstdc++4.6 (2011). -// https://bugs.llvm.org/show_bug.cgi?id=13364 -#if defined(__GLIBCXX__) -namespace std { class type_info; } +// Workaround for a libstdc++ bug before libstdc++4.6 (2011). +// https://bugs.llvm.org/show_bug.cgi?id=13364 +#if defined(__GLIBCXX__) +namespace std { class type_info; } #endif #include <string> -#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* U_SHOW_CPLUSPLUS_API */ #endif // __STD_STRING_H__ diff --git a/contrib/libs/icu/include/unicode/strenum.h b/contrib/libs/icu/include/unicode/strenum.h index 8601f1f7c4..b522c099cd 100644 --- a/contrib/libs/icu/include/unicode/strenum.h +++ b/contrib/libs/icu/include/unicode/strenum.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -12,10 +12,10 @@ #ifndef STRENUM_H #define STRENUM_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/unistr.h" @@ -39,7 +39,7 @@ U_NAMESPACE_BEGIN * call, so the returned string still might not be 'valid' on * subsequent use.</p> * - * <p>Strings may take the form of const char*, const char16_t*, or const + * <p>Strings may take the form of const char*, const char16_t*, or const * UnicodeString*. The type you get is determine by the variant of * 'next' that you call. In general the StringEnumeration is * optimized for one of these types, but all StringEnumerations can @@ -113,7 +113,7 @@ public: * <p>If the iterator is out of sync with its service, status is set * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p> * - * <p>If the native service string is a char16_t* string, it is + * <p>If the native service string is a char16_t* string, it is * converted to char* with the invariant converter. If the * conversion fails (because a character cannot be converted) then * status is set to U_INVARIANT_CONVERSION_ERROR and the return @@ -132,7 +132,7 @@ public: virtual const char* next(int32_t *resultLength, UErrorCode& status); /** - * <p>Returns the next element as a NUL-terminated char16_t*. If there + * <p>Returns the next element as a NUL-terminated char16_t*. If there * are no more elements, returns NULL. If the resultLength pointer * is not NULL, the length of the string (not counting the * terminating NUL) is returned at that address. If an error @@ -154,7 +154,7 @@ public: * * @stable ICU 2.4 */ - virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status); + virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status); /** * <p>Returns the next element a UnicodeString*. If there are no @@ -275,7 +275,7 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + /* STRENUM_H */ #endif diff --git a/contrib/libs/icu/include/unicode/stringoptions.h b/contrib/libs/icu/include/unicode/stringoptions.h index 7b9f70944f..ec6b6f65d3 100644 --- a/contrib/libs/icu/include/unicode/stringoptions.h +++ b/contrib/libs/icu/include/unicode/stringoptions.h @@ -1,190 +1,190 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// stringoptions.h -// created: 2017jun08 Markus W. Scherer - -#ifndef __STRINGOPTIONS_H__ -#define __STRINGOPTIONS_H__ - -#include "unicode/utypes.h" - -/** - * \file - * \brief C API: Bit set option bit constants for various string and character processing functions. - */ - -/** - * Option value for case folding: Use default mappings defined in CaseFolding.txt. - * - * @stable ICU 2.0 - */ -#define U_FOLD_CASE_DEFAULT 0 - -/** - * Option value for case folding: - * - * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I - * and dotless i appropriately for Turkic languages (tr, az). - * - * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that - * are to be included for default mappings and - * excluded for the Turkic-specific mappings. - * - * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that - * are to be excluded for default mappings and - * included for the Turkic-specific mappings. - * - * @stable ICU 2.0 - */ -#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 - -/** - * Titlecase the string as a whole rather than each word. - * (Titlecase only the character at index 0, possibly adjusted.) - * Option bits value for titlecasing APIs that take an options bit set. - * - * It is an error to specify multiple titlecasing iterator options together, - * including both an options bit and an explicit BreakIterator. - * - * @see U_TITLECASE_ADJUST_TO_CASED - * @stable ICU 60 - */ -#define U_TITLECASE_WHOLE_STRING 0x20 - -/** - * Titlecase sentences rather than words. - * (Titlecase only the first character of each sentence, possibly adjusted.) - * Option bits value for titlecasing APIs that take an options bit set. - * - * It is an error to specify multiple titlecasing iterator options together, - * including both an options bit and an explicit BreakIterator. - * - * @see U_TITLECASE_ADJUST_TO_CASED - * @stable ICU 60 - */ -#define U_TITLECASE_SENTENCES 0x40 - -/** - * Do not lowercase non-initial parts of words when titlecasing. - * Option bit for titlecasing APIs that take an options bit set. - * - * By default, titlecasing will titlecase the character at each - * (possibly adjusted) BreakIterator index and - * lowercase all other characters up to the next iterator index. - * With this option, the other characters will not be modified. - * - * @see U_TITLECASE_ADJUST_TO_CASED - * @see UnicodeString::toTitle - * @see CaseMap::toTitle - * @see ucasemap_setOptions - * @see ucasemap_toTitle - * @see ucasemap_utf8ToTitle - * @stable ICU 3.8 - */ -#define U_TITLECASE_NO_LOWERCASE 0x100 - -/** - * Do not adjust the titlecasing BreakIterator indexes; - * titlecase exactly the characters at breaks from the iterator. - * Option bit for titlecasing APIs that take an options bit set. - * - * By default, titlecasing will take each break iterator index, - * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED), - * and titlecase that one. - * - * Other characters are lowercased. - * - * It is an error to specify multiple titlecasing adjustment options together. - * - * @see U_TITLECASE_ADJUST_TO_CASED - * @see U_TITLECASE_NO_LOWERCASE - * @see UnicodeString::toTitle - * @see CaseMap::toTitle - * @see ucasemap_setOptions - * @see ucasemap_toTitle - * @see ucasemap_utf8ToTitle - * @stable ICU 3.8 - */ -#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 - -/** - * Adjust each titlecasing BreakIterator index to the next cased character. - * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).) - * Option bit for titlecasing APIs that take an options bit set. - * - * This used to be the default index adjustment in ICU. - * Since ICU 60, the default index adjustment is to the next character that is - * a letter, number, symbol, or private use code point. - * (Uncased modifier letters are skipped.) - * The difference in behavior is small for word titlecasing, - * but the new adjustment is much better for whole-string and sentence titlecasing: - * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»". - * - * It is an error to specify multiple titlecasing adjustment options together. - * - * @see U_TITLECASE_NO_BREAK_ADJUSTMENT - * @stable ICU 60 - */ -#define U_TITLECASE_ADJUST_TO_CASED 0x400 - -/** - * Option for string transformation functions to not first reset the Edits object. - * Used for example in some case-mapping and normalization functions. - * - * @see CaseMap - * @see Edits - * @see Normalizer2 - * @stable ICU 60 - */ -#define U_EDITS_NO_RESET 0x2000 - -/** - * Omit unchanged text when recording how source substrings - * relate to changed and unchanged result substrings. - * Used for example in some case-mapping and normalization functions. - * - * @see CaseMap - * @see Edits - * @see Normalizer2 - * @stable ICU 60 - */ -#define U_OMIT_UNCHANGED_TEXT 0x4000 - -/** - * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: - * Compare strings in code point order instead of code unit order. - * @stable ICU 2.2 - */ -#define U_COMPARE_CODE_POINT_ORDER 0x8000 - -/** - * Option bit for unorm_compare: - * Perform case-insensitive comparison. - * @stable ICU 2.2 - */ -#define U_COMPARE_IGNORE_CASE 0x10000 - -/** - * Option bit for unorm_compare: - * Both input strings are assumed to fulfill FCD conditions. - * @stable ICU 2.2 - */ -#define UNORM_INPUT_IS_FCD 0x20000 - -// Related definitions elsewhere. -// Options that are not meaningful in the same functions -// can share the same bits. -// -// Public: -// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 -// -// Internal: (may change or be removed) -// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff -// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7 -// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0 -// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600 -// ustr_imp.h #define _STRNCMP_STYLE 0x1000 -// unormcmp.cpp #define _COMPARE_EQUIV 0x80000 - -#endif // __STRINGOPTIONS_H__ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// stringoptions.h +// created: 2017jun08 Markus W. Scherer + +#ifndef __STRINGOPTIONS_H__ +#define __STRINGOPTIONS_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Bit set option bit constants for various string and character processing functions. + */ + +/** + * Option value for case folding: Use default mappings defined in CaseFolding.txt. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_DEFAULT 0 + +/** + * Option value for case folding: + * + * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I + * and dotless i appropriately for Turkic languages (tr, az). + * + * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that + * are to be included for default mappings and + * excluded for the Turkic-specific mappings. + * + * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that + * are to be excluded for default mappings and + * included for the Turkic-specific mappings. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 + +/** + * Titlecase the string as a whole rather than each word. + * (Titlecase only the character at index 0, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @stable ICU 60 + */ +#define U_TITLECASE_WHOLE_STRING 0x20 + +/** + * Titlecase sentences rather than words. + * (Titlecase only the first character of each sentence, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @stable ICU 60 + */ +#define U_TITLECASE_SENTENCES 0x40 + +/** + * Do not lowercase non-initial parts of words when titlecasing. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will titlecase the character at each + * (possibly adjusted) BreakIterator index and + * lowercase all other characters up to the next iterator index. + * With this option, the other characters will not be modified. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_LOWERCASE 0x100 + +/** + * Do not adjust the titlecasing BreakIterator indexes; + * titlecase exactly the characters at breaks from the iterator. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will take each break iterator index, + * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED), + * and titlecase that one. + * + * Other characters are lowercased. + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see U_TITLECASE_NO_LOWERCASE + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 + +/** + * Adjust each titlecasing BreakIterator index to the next cased character. + * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).) + * Option bit for titlecasing APIs that take an options bit set. + * + * This used to be the default index adjustment in ICU. + * Since ICU 60, the default index adjustment is to the next character that is + * a letter, number, symbol, or private use code point. + * (Uncased modifier letters are skipped.) + * The difference in behavior is small for word titlecasing, + * but the new adjustment is much better for whole-string and sentence titlecasing: + * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»". + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 60 + */ +#define U_TITLECASE_ADJUST_TO_CASED 0x400 + +/** + * Option for string transformation functions to not first reset the Edits object. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @stable ICU 60 + */ +#define U_EDITS_NO_RESET 0x2000 + +/** + * Omit unchanged text when recording how source substrings + * relate to changed and unchanged result substrings. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @stable ICU 60 + */ +#define U_OMIT_UNCHANGED_TEXT 0x4000 + +/** + * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: + * Compare strings in code point order instead of code unit order. + * @stable ICU 2.2 + */ +#define U_COMPARE_CODE_POINT_ORDER 0x8000 + +/** + * Option bit for unorm_compare: + * Perform case-insensitive comparison. + * @stable ICU 2.2 + */ +#define U_COMPARE_IGNORE_CASE 0x10000 + +/** + * Option bit for unorm_compare: + * Both input strings are assumed to fulfill FCD conditions. + * @stable ICU 2.2 + */ +#define UNORM_INPUT_IS_FCD 0x20000 + +// Related definitions elsewhere. +// Options that are not meaningful in the same functions +// can share the same bits. +// +// Public: +// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 +// +// Internal: (may change or be removed) +// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff +// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7 +// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0 +// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600 +// ustr_imp.h #define _STRNCMP_STYLE 0x1000 +// unormcmp.cpp #define _COMPARE_EQUIV 0x80000 + +#endif // __STRINGOPTIONS_H__ diff --git a/contrib/libs/icu/include/unicode/stringpiece.h b/contrib/libs/icu/include/unicode/stringpiece.h index 52c1e9ebd2..e5a7c56192 100644 --- a/contrib/libs/icu/include/unicode/stringpiece.h +++ b/contrib/libs/icu/include/unicode/stringpiece.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html // Copyright (C) 2009-2013, International Business Machines // Corporation and others. All Rights Reserved. @@ -28,12 +28,12 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include <cstddef> -#include <type_traits> - + +#if U_SHOW_CPLUSPLUS_API + +#include <cstddef> +#include <type_traits> + #include "unicode/uobject.h" #include "unicode/std_string.h" @@ -67,107 +67,107 @@ class U_COMMON_API StringPiece : public UMemory { * Default constructor, creates an empty StringPiece. * @stable ICU 4.2 */ - StringPiece() : ptr_(nullptr), length_(0) { } - + StringPiece() : ptr_(nullptr), length_(0) { } + /** * Constructs from a NUL-terminated const char * pointer. * @param str a NUL-terminated const char * pointer * @stable ICU 4.2 */ StringPiece(const char* str); -#ifndef U_HIDE_DRAFT_API -#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) - /** - * Constructs from a NUL-terminated const char8_t * pointer. - * @param str a NUL-terminated const char8_t * pointer - * @draft ICU 67 - */ - StringPiece(const char8_t* str) : StringPiece(reinterpret_cast<const char*>(str)) {} -#endif - /** - * Constructs an empty StringPiece. - * Needed for type disambiguation from multiple other overloads. - * @param p nullptr - * @draft ICU 67 - */ - StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {} -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) /** + * Constructs from a NUL-terminated const char8_t * pointer. + * @param str a NUL-terminated const char8_t * pointer + * @draft ICU 67 + */ + StringPiece(const char8_t* str) : StringPiece(reinterpret_cast<const char*>(str)) {} +#endif + /** + * Constructs an empty StringPiece. + * Needed for type disambiguation from multiple other overloads. + * @param p nullptr + * @draft ICU 67 + */ + StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {} +#endif // U_HIDE_DRAFT_API + + /** * Constructs from a std::string. * @stable ICU 4.2 */ StringPiece(const std::string& str) : ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { } -#ifndef U_HIDE_DRAFT_API -#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN) - /** - * Constructs from a std::u8string. - * @draft ICU 67 - */ - StringPiece(const std::u8string& str) - : ptr_(reinterpret_cast<const char*>(str.data())), - length_(static_cast<int32_t>(str.size())) { } +#ifndef U_HIDE_DRAFT_API +#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN) + /** + * Constructs from a std::u8string. + * @draft ICU 67 + */ + StringPiece(const std::u8string& str) + : ptr_(reinterpret_cast<const char*>(str.data())), + length_(static_cast<int32_t>(str.size())) { } #endif -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_DRAFT_API - /** - * Constructs from some other implementation of a string piece class, from any - * C++ record type that has these two methods: - * - * \code{.cpp} - * - * struct OtherStringPieceClass { - * const char* data(); // or const char8_t* - * size_t size(); - * }; - * - * \endcode - * - * The other string piece class will typically be std::string_view from C++17 - * or absl::string_view from Abseil. - * - * Starting with C++20, data() may also return a const char8_t* pointer, - * as from std::u8string_view. - * - * @param str the other string piece - * @draft ICU 65 - */ - template <typename T, - typename = typename std::enable_if< - (std::is_same<decltype(T().data()), const char*>::value -#if defined(__cpp_char8_t) - || std::is_same<decltype(T().data()), const char8_t*>::value -#endif - ) && - std::is_same<decltype(T().size()), size_t>::value>::type> - StringPiece(T str) - : ptr_(reinterpret_cast<const char*>(str.data())), - length_(static_cast<int32_t>(str.size())) {} -#endif // U_HIDE_DRAFT_API - +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_DRAFT_API /** + * Constructs from some other implementation of a string piece class, from any + * C++ record type that has these two methods: + * + * \code{.cpp} + * + * struct OtherStringPieceClass { + * const char* data(); // or const char8_t* + * size_t size(); + * }; + * + * \endcode + * + * The other string piece class will typically be std::string_view from C++17 + * or absl::string_view from Abseil. + * + * Starting with C++20, data() may also return a const char8_t* pointer, + * as from std::u8string_view. + * + * @param str the other string piece + * @draft ICU 65 + */ + template <typename T, + typename = typename std::enable_if< + (std::is_same<decltype(T().data()), const char*>::value +#if defined(__cpp_char8_t) + || std::is_same<decltype(T().data()), const char8_t*>::value +#endif + ) && + std::is_same<decltype(T().size()), size_t>::value>::type> + StringPiece(T str) + : ptr_(reinterpret_cast<const char*>(str.data())), + length_(static_cast<int32_t>(str.size())) {} +#endif // U_HIDE_DRAFT_API + + /** * Constructs from a const char * pointer and a specified length. * @param offset a const char * pointer (need not be terminated) * @param len the length of the string; must be non-negative * @stable ICU 4.2 */ StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { } -#ifndef U_HIDE_DRAFT_API -#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) - /** - * Constructs from a const char8_t * pointer and a specified length. - * @param str a const char8_t * pointer (need not be terminated) - * @param len the length of the string; must be non-negative - * @draft ICU 67 - */ - StringPiece(const char8_t* str, int32_t len) : - StringPiece(reinterpret_cast<const char*>(str), len) {} -#endif -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) /** + * Constructs from a const char8_t * pointer and a specified length. + * @param str a const char8_t * pointer (need not be terminated) + * @param len the length of the string; must be non-negative + * @draft ICU 67 + */ + StringPiece(const char8_t* str, int32_t len) : + StringPiece(reinterpret_cast<const char*>(str), len) {} +#endif +#endif // U_HIDE_DRAFT_API + + /** * Substring of another StringPiece. * @param x the other StringPiece * @param pos start position in x; must be non-negative and <= x.length(). @@ -185,7 +185,7 @@ class U_COMMON_API StringPiece : public UMemory { StringPiece(const StringPiece& x, int32_t pos, int32_t len); /** - * Returns the string pointer. May be nullptr if it is empty. + * Returns the string pointer. May be nullptr if it is empty. * * 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 @@ -218,7 +218,7 @@ class U_COMMON_API StringPiece : public UMemory { * Sets to an empty string. * @stable ICU 4.2 */ - void clear() { ptr_ = nullptr; length_ = 0; } + void clear() { ptr_ = nullptr; length_ = 0; } /** * Reset the stringpiece to refer to new data. @@ -235,30 +235,30 @@ class U_COMMON_API StringPiece : public UMemory { */ void set(const char* str); -#ifndef U_HIDE_DRAFT_API -#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) - /** - * Resets the stringpiece to refer to new data. - * @param xdata pointer the new string data. Need not be NUL-terminated. - * @param len the length of the new data - * @draft ICU 67 - */ - inline void set(const char8_t* xdata, int32_t len) { - set(reinterpret_cast<const char*>(xdata), len); - } - - /** - * Resets the stringpiece to refer to new data. - * @param str a pointer to a NUL-terminated string. - * @draft ICU 67 - */ - inline void set(const char8_t* str) { - set(reinterpret_cast<const char*>(str)); - } -#endif -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API +#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN) /** + * Resets the stringpiece to refer to new data. + * @param xdata pointer the new string data. Need not be NUL-terminated. + * @param len the length of the new data + * @draft ICU 67 + */ + inline void set(const char8_t* xdata, int32_t len) { + set(reinterpret_cast<const char*>(xdata), len); + } + + /** + * Resets the stringpiece to refer to new data. + * @param str a pointer to a NUL-terminated string. + * @draft ICU 67 + */ + inline void set(const char8_t* str) { + set(reinterpret_cast<const char*>(str)); + } +#endif +#endif // U_HIDE_DRAFT_API + + /** * Removes the first n string units. * @param n prefix length, must be non-negative and <=length() * @stable ICU 4.2 @@ -288,27 +288,27 @@ class U_COMMON_API StringPiece : public UMemory { } } -#ifndef U_HIDE_DRAFT_API - /** - * Searches the StringPiece for the given search string (needle); - * @param needle The string for which to search. - * @param offset Where to start searching within this string (haystack). - * @return The offset of needle in haystack, or -1 if not found. - * @draft ICU 67 - */ - int32_t find(StringPiece needle, int32_t offset); - - /** - * Compares this StringPiece with the other StringPiece, with semantics - * similar to std::string::compare(). - * @param other The string to compare to. - * @return below zero if this < other; above zero if this > other; 0 if this == other. - * @draft ICU 67 - */ - int32_t compare(StringPiece other); -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API /** + * Searches the StringPiece for the given search string (needle); + * @param needle The string for which to search. + * @param offset Where to start searching within this string (haystack). + * @return The offset of needle in haystack, or -1 if not found. + * @draft ICU 67 + */ + int32_t find(StringPiece needle, int32_t offset); + + /** + * Compares this StringPiece with the other StringPiece, with semantics + * similar to std::string::compare(). + * @param other The string to compare to. + * @return below zero if this < other; above zero if this > other; 0 if this == other. + * @draft ICU 67 + */ + int32_t compare(StringPiece other); +#endif // U_HIDE_DRAFT_API + + /** * Maximum integer, used as a default value for substring methods. * @stable ICU 4.2 */ @@ -350,6 +350,6 @@ inline UBool operator!=(const StringPiece& x, const StringPiece& y) { U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __STRINGPIECE_H__ diff --git a/contrib/libs/icu/include/unicode/stringtriebuilder.h b/contrib/libs/icu/include/unicode/stringtriebuilder.h index 2c47dd415b..23bb56122a 100644 --- a/contrib/libs/icu/include/unicode/stringtriebuilder.h +++ b/contrib/libs/icu/include/unicode/stringtriebuilder.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: stringtriebuilder.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -18,9 +18,9 @@ #define __STRINGTRIEBUILDER_H__ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -29,10 +29,10 @@ */ // Forward declaration. -/// \cond +/// \cond struct UHashtable; typedef struct UHashtable UHashtable; -/// \endcond +/// \endcond /** * Build options for BytesTrieBuilder and CharsTrieBuilder. @@ -69,7 +69,7 @@ class U_COMMON_API StringTrieBuilder : public UObject { public: #ifndef U_HIDE_INTERNAL_API /** @internal */ - static int32_t hashNode(const void *node); + static int32_t hashNode(const void *node); /** @internal */ static UBool equalNodes(const void *left, const void *right); #endif /* U_HIDE_INTERNAL_API */ @@ -110,7 +110,7 @@ protected: /** @internal */ virtual int32_t getElementStringLength(int32_t i) const = 0; /** @internal */ - virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0; + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0; /** @internal */ virtual int32_t getElementValue(int32_t i) const = 0; @@ -125,7 +125,7 @@ protected: /** @internal */ virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0; /** @internal */ - virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0; /** @internal */ virtual UBool matchNodesCanHaveValues() const = 0; @@ -142,7 +142,7 @@ protected: /** @internal */ static const int32_t kMaxBranchLinearSubNodeLength=5; - // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units. + // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units. // log2(2^16/kMaxBranchLinearSubNodeLength) rounded up. /** @internal */ static const int32_t kMaxSplitBranchLevels=14; @@ -193,10 +193,10 @@ protected: // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, // it is needed for layout of other objects. - /** - * @internal - * \cond - */ + /** + * @internal + * \cond + */ class Node : public UObject { public: Node(int32_t initialHash) : hash(initialHash), offset(0) {} @@ -264,7 +264,7 @@ protected: /** @internal */ class FinalValueNode : public Node { public: - FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {} + FinalValueNode(int32_t v) : Node(0x111111u*37u+v), value(v) {} virtual UBool operator==(const Node &other) const; virtual void write(StringTrieBuilder &builder); protected: @@ -284,7 +284,7 @@ protected: void setValue(int32_t v) { hasValue=TRUE; value=v; - hash=hash*37u+v; + hash=hash*37u+v; } protected: UBool hasValue; @@ -298,7 +298,7 @@ protected: class IntermediateValueNode : public ValueNode { public: IntermediateValueNode(int32_t v, Node *nextNode) - : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); } + : ValueNode(0x222222u*37u+hashCode(nextNode)), next(nextNode) { setValue(v); } virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); virtual void write(StringTrieBuilder &builder); @@ -315,7 +315,7 @@ protected: class LinearMatchNode : public ValueNode { public: LinearMatchNode(int32_t len, Node *nextNode) - : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)), + : ValueNode((0x333333u*37u+len)*37u+hashCode(nextNode)), length(len), next(nextNode) {} virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); @@ -346,25 +346,25 @@ protected: virtual void write(StringTrieBuilder &builder); // Adds a unit with a final value. void add(int32_t c, int32_t value) { - units[length]=(char16_t)c; + units[length]=(char16_t)c; equal[length]=NULL; values[length]=value; ++length; - hash=(hash*37u+c)*37u+value; + hash=(hash*37u+c)*37u+value; } // Adds a unit which leads to another match node. void add(int32_t c, Node *node) { - units[length]=(char16_t)c; + units[length]=(char16_t)c; equal[length]=node; values[length]=0; ++length; - hash=(hash*37u+c)*37u+hashCode(node); + hash=(hash*37u+c)*37u+hashCode(node); } protected: Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value". int32_t length; int32_t values[kMaxBranchLinearSubNodeLength]; - char16_t units[kMaxBranchLinearSubNodeLength]; + char16_t units[kMaxBranchLinearSubNodeLength]; }; /** @@ -372,15 +372,15 @@ protected: */ class SplitBranchNode : public BranchNode { public: - SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode) - : BranchNode(((0x555555u*37u+middleUnit)*37u+ - hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)), + SplitBranchNode(char16_t middleUnit, Node *lessThanNode, Node *greaterOrEqualNode) + : BranchNode(((0x555555u*37u+middleUnit)*37u+ + hashCode(lessThanNode))*37u+hashCode(greaterOrEqualNode)), unit(middleUnit), lessThan(lessThanNode), greaterOrEqual(greaterOrEqualNode) {} virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); virtual void write(StringTrieBuilder &builder); protected: - char16_t unit; + char16_t unit; Node *lessThan; Node *greaterOrEqual; }; @@ -390,7 +390,7 @@ protected: class BranchHeadNode : public ValueNode { public: BranchHeadNode(int32_t len, Node *subNode) - : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)), + : ValueNode((0x666666u*37u+len)*37u+hashCode(subNode)), length(len), next(subNode) {} virtual UBool operator==(const Node &other) const; virtual int32_t markRightEdgesFirst(int32_t edgeNumber); @@ -399,9 +399,9 @@ protected: int32_t length; Node *next; // A branch sub-node. }; - + #endif /* U_HIDE_INTERNAL_API */ - /// \endcond + /// \endcond /** @internal */ virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, @@ -421,6 +421,6 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __STRINGTRIEBUILDER_H__ diff --git a/contrib/libs/icu/include/unicode/stsearch.h b/contrib/libs/icu/include/unicode/stsearch.h index fcb5dbf200..8274b3328f 100644 --- a/contrib/libs/icu/include/unicode/stsearch.h +++ b/contrib/libs/icu/include/unicode/stsearch.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -14,8 +14,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Service for searching text based on RuleBasedCollator. @@ -121,7 +121,7 @@ U_NAMESPACE_BEGIN * pos != USEARCH_DONE; * pos = iter.next(error)) * { - * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength()); + * printf("Found match at %d pos, length is %d\n", pos, iter.getMatchedLength()); * } * </code></pre> * <p> @@ -413,7 +413,7 @@ public: * @return cloned object * @stable ICU 2.0 */ - virtual StringSearch * safeClone() const; + virtual StringSearch * safeClone() const; /** * ICU "poor man's RTTI", returns a UClassID for the actual class. @@ -503,7 +503,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_COLLATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/symtable.h b/contrib/libs/icu/include/unicode/symtable.h index b64d877f97..e95a259e86 100644 --- a/contrib/libs/icu/include/unicode/symtable.h +++ b/contrib/libs/icu/include/unicode/symtable.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -13,9 +13,9 @@ #define SYMTABLE_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -114,6 +114,6 @@ public: }; U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/tblcoll.h b/contrib/libs/icu/include/unicode/tblcoll.h index f5dc135bc4..a7cfe7d72e 100644 --- a/contrib/libs/icu/include/unicode/tblcoll.h +++ b/contrib/libs/icu/include/unicode/tblcoll.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -64,8 +64,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_COLLATION #include "unicode/coll.h" @@ -230,7 +230,7 @@ public: * @return a copy of this object, owned by the caller * @stable ICU 2.0 */ - virtual RuleBasedCollator* clone() const; + virtual RuleBasedCollator* clone() const; /** * Creates a collation element iterator for the source string. The caller of @@ -310,8 +310,8 @@ public: * than target * @stable ICU 2.6 */ - virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, - const char16_t* target, int32_t targetLength, + virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength, UErrorCode &status) const; /** @@ -379,7 +379,7 @@ public: * @see CollationKey * @stable ICU 2.0 */ - virtual CollationKey& getCollationKey(const char16_t *source, + virtual CollationKey& getCollationKey(const char16_t *source, int32_t sourceLength, CollationKey& key, UErrorCode& status) const; @@ -391,7 +391,7 @@ public: */ virtual int32_t hashCode() const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Gets the locale of the Collator * @param type can be either requested, valid or actual locale. For more @@ -403,7 +403,7 @@ public: * @deprecated ICU 2.8 likely to change in ICU 3.0, based on feedback */ virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the tailoring rules for this collator. @@ -549,7 +549,7 @@ public: */ virtual UColReorderCode getMaxVariable() const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Sets the variable top to the primary weight of the specified string. * @@ -557,7 +557,7 @@ public: * the top of one of the supported reordering groups, * and it must not be beyond the last of those groups. * See setMaxVariable(). - * @param varTop one or more (if contraction) char16_ts to which the variable top should be set + * @param varTop one or more (if contraction) char16_ts to which the variable top should be set * @param len length of variable top string. If -1 it is considered to be zero terminated. * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> @@ -566,7 +566,7 @@ public: * @return variable top primary weight * @deprecated ICU 53 Call setMaxVariable() instead. */ - virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status); + virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status); /** * Sets the variable top to the primary weight of the specified string. @@ -575,7 +575,7 @@ public: * the top of one of the supported reordering groups, * and it must not be beyond the last of those groups. * See setMaxVariable(). - * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set + * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set * @param status error code. If error code is set, the return value is undefined. Errors set by this function are: <br> * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction<br> * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond @@ -597,7 +597,7 @@ public: * @deprecated ICU 53 Call setMaxVariable() instead. */ virtual void setVariableTop(uint32_t varTop, UErrorCode &status); -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Gets the variable top value of a Collator. @@ -637,7 +637,7 @@ public: int32_t resultLength) const; /** - * Get the sort key as an array of bytes from a char16_t buffer. + * Get the sort key as an array of bytes from a char16_t buffer. * * Note that sort keys are often less efficient than simply doing comparison. * For more details, see the ICU User Guide. @@ -652,7 +652,7 @@ public: * @return Number of bytes needed for storing the sort key * @stable ICU 2.2 */ - virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength, + virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength, uint8_t *result, int32_t resultLength) const; /** @@ -827,17 +827,17 @@ private: void adoptTailoring(CollationTailoring *t, UErrorCode &errorCode); // Both lengths must be <0 or else both must be >=0. - UCollationResult doCompare(const char16_t *left, int32_t leftLength, - const char16_t *right, int32_t rightLength, + UCollationResult doCompare(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, UErrorCode &errorCode) const; UCollationResult doCompare(const uint8_t *left, int32_t leftLength, const uint8_t *right, int32_t rightLength, UErrorCode &errorCode) const; - void writeSortKey(const char16_t *s, int32_t length, + void writeSortKey(const char16_t *s, int32_t length, SortKeyByteSink &sink, UErrorCode &errorCode) const; - void writeIdenticalLevel(const char16_t *s, const char16_t *limit, + void writeIdenticalLevel(const char16_t *s, const char16_t *limit, SortKeyByteSink &sink, UErrorCode &errorCode) const; const CollationSettings &getDefaultSettings() const; @@ -880,7 +880,7 @@ private: U_NAMESPACE_END #endif // !UCONFIG_NO_COLLATION - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // TBLCOLL_H diff --git a/contrib/libs/icu/include/unicode/timezone.h b/contrib/libs/icu/include/unicode/timezone.h index 433e3b5c46..0cdc8e196f 100644 --- a/contrib/libs/icu/include/unicode/timezone.h +++ b/contrib/libs/icu/include/unicode/timezone.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /************************************************************************* * Copyright (c) 1997-2016, International Business Machines Corporation @@ -31,8 +31,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: TimeZone object @@ -279,25 +279,25 @@ public: /** * Creates an instance of TimeZone detected from the current host - * system configuration. If the host system detection routines fail, - * or if they specify a TimeZone or TimeZone offset which is not - * recognized, then the special TimeZone "Etc/Unknown" is returned. - * - * Note that ICU4C does not change the default time zone unless - * `TimeZone::adoptDefault(TimeZone*)` or - * `TimeZone::setDefault(const TimeZone&)` is explicitly called by a + * system configuration. If the host system detection routines fail, + * or if they specify a TimeZone or TimeZone offset which is not + * recognized, then the special TimeZone "Etc/Unknown" is returned. + * + * Note that ICU4C does not change the default time zone unless + * `TimeZone::adoptDefault(TimeZone*)` or + * `TimeZone::setDefault(const TimeZone&)` is explicitly called by a * user. This method does not update the current ICU's default, * and may return a different TimeZone from the one returned by - * `TimeZone::createDefault()`. - * - * <p>This function is not thread safe.</p> + * `TimeZone::createDefault()`. * + * <p>This function is not thread safe.</p> + * * @return A new instance of TimeZone detected from the current host system * configuration. - * @see adoptDefault - * @see setDefault - * @see createDefault - * @see getUnknown + * @see adoptDefault + * @see setDefault + * @see createDefault + * @see getUnknown * @stable ICU 55 */ static TimeZone* U_EXPORT2 detectHostTimeZone(); @@ -305,14 +305,14 @@ public: /** * Creates a new copy of the default TimeZone for this host. Unless the default time * zone has already been set using adoptDefault() or setDefault(), the default is - * determined by querying the host system configuration. If the host system detection - * routines fail, or if they specify a TimeZone or TimeZone offset which is not - * recognized, then the special TimeZone "Etc/Unknown" is instantiated and made the - * default. + * determined by querying the host system configuration. If the host system detection + * routines fail, or if they specify a TimeZone or TimeZone offset which is not + * recognized, then the special TimeZone "Etc/Unknown" is instantiated and made the + * default. * * @return A default TimeZone. Clients are responsible for deleting the time zone * object returned. - * @see getUnknown + * @see getUnknown * @stable ICU 2.0 */ static TimeZone* U_EXPORT2 createDefault(void); @@ -662,13 +662,13 @@ public: * If the display name is not available for the locale, * then this method returns a string in the localized GMT offset format * such as <code>GMT[+-]HH:mm</code>. - * @param inDaylight if true, return the daylight savings name. + * @param inDaylight if true, return the daylight savings name. * @param style * @param result the human-readable name of this time zone in the default locale. * @return A reference to 'result'. * @stable ICU 2.0 */ - UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const; + UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, UnicodeString& result) const; /** * Returns a name of this time zone suitable for presentation to the user @@ -676,15 +676,15 @@ public: * If the display name is not available for the locale, * then this method returns a string in the localized GMT offset format * such as <code>GMT[+-]HH:mm</code>. - * @param inDaylight if true, return the daylight savings name. + * @param inDaylight if true, return the daylight savings name. * @param style * @param locale the locale in which to supply the display name. * @param result the human-readable name of this time zone in the given locale * or in the default locale if the given locale is not recognized. - * @return A reference to 'result'. + * @return A reference to 'result'. * @stable ICU 2.0 */ - UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const; + UnicodeString& getDisplayName(UBool inDaylight, EDisplayType style, const Locale& locale, UnicodeString& result) const; /** * Queries if this time zone uses daylight savings time. @@ -722,7 +722,7 @@ public: */ virtual UBool useDaylightTime(void) const = 0; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Queries if the given date is in daylight savings time in * this time zone. @@ -737,7 +737,7 @@ public: * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. */ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Returns true if this zone has the same rule and offset as another zone. @@ -756,7 +756,7 @@ public: * @return A new copy of this TimeZone object. * @stable ICU 2.0 */ - virtual TimeZone* clone() const = 0; + virtual TimeZone* clone() const = 0; /** * Return the class ID for this class. This is useful only for @@ -872,7 +872,7 @@ private: * @param id zone id string * @return the pointer of the ID resource, or NULL. */ - static const char16_t* findID(const UnicodeString& id); + static const char16_t* findID(const UnicodeString& id); /** * Resolve a link in Olson tzdata. When the given id is known and it's not a link, @@ -882,7 +882,7 @@ private: * @param id zone id string * @return the dereferenced zone or NULL */ - static const char16_t* dereferOlsonLink(const UnicodeString& id); + static const char16_t* dereferOlsonLink(const UnicodeString& id); /** * Returns the region code associated with the given zone, @@ -890,7 +890,7 @@ private: * @param id zone id string * @return the region associated with the given zone */ - static const char16_t* getRegion(const UnicodeString& id); + static const char16_t* getRegion(const UnicodeString& id); public: #ifndef U_HIDE_INTERNAL_API @@ -902,7 +902,7 @@ private: * @return the region associated with the given zone * @internal */ - static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status); + static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status); #endif /* U_HIDE_INTERNAL_API */ private: @@ -933,7 +933,7 @@ private: UErrorCode& status); /** - * Returns the normalized custom time zone ID for the given offset fields. + * Returns the normalized custom time zone ID for the given offset fields. * @param hour offset hours * @param min offset minutes * @param sec offset seconds @@ -970,7 +970,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif //_TIMEZONE //eof diff --git a/contrib/libs/icu/include/unicode/tmunit.h b/contrib/libs/icu/include/unicode/tmunit.h index 2e949ddfbd..9aded11aba 100644 --- a/contrib/libs/icu/include/unicode/tmunit.h +++ b/contrib/libs/icu/include/unicode/tmunit.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,10 +16,10 @@ * \brief C++ API: time unit object */ -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API +#include "unicode/utypes.h" +#if U_SHOW_CPLUSPLUS_API + #include "unicode/measunit.h" #if !UCONFIG_NO_FORMATTING @@ -73,7 +73,7 @@ public: * Override clone. * @stable ICU 4.2 */ - virtual TimeUnit* clone() const; + virtual TimeUnit* clone() const; /** * Copy operator. @@ -135,8 +135,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __TMUNIT_H__ //eof // diff --git a/contrib/libs/icu/include/unicode/tmutamt.h b/contrib/libs/icu/include/unicode/tmutamt.h index 8bcc684d3a..c233fabac9 100644 --- a/contrib/libs/icu/include/unicode/tmutamt.h +++ b/contrib/libs/icu/include/unicode/tmutamt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,12 +16,12 @@ * \brief C++ API: time unit amount object. */ -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#if !UCONFIG_NO_FORMATTING - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#if !UCONFIG_NO_FORMATTING + #include "unicode/measure.h" #include "unicode/tmunit.h" @@ -87,7 +87,7 @@ public: * @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID(). * @stable ICU 4.2 */ - virtual TimeUnitAmount* clone() const; + virtual TimeUnitAmount* clone() const; /** @@ -169,8 +169,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __TMUTAMT_H__ //eof // diff --git a/contrib/libs/icu/include/unicode/tmutfmt.h b/contrib/libs/icu/include/unicode/tmutfmt.h index ad871f7c09..e183354105 100644 --- a/contrib/libs/icu/include/unicode/tmutfmt.h +++ b/contrib/libs/icu/include/unicode/tmutfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -18,8 +18,8 @@ */ -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/unistr.h" @@ -29,7 +29,7 @@ #include "unicode/numfmt.h" #include "unicode/plurrule.h" -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * Constants for various styles. @@ -126,7 +126,7 @@ public: * @return A copy of the object. * @deprecated ICU 53 */ - virtual TimeUnitFormat* clone() const; + virtual TimeUnitFormat* clone() const; /** * Assignment operator @@ -246,7 +246,7 @@ U_NAMESPACE_END #endif /* U_HIDE_DEPRECATED_API */ #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __TMUTFMT_H__ //eof diff --git a/contrib/libs/icu/include/unicode/translit.h b/contrib/libs/icu/include/unicode/translit.h index fe2568d50a..8a67643f44 100644 --- a/contrib/libs/icu/include/unicode/translit.h +++ b/contrib/libs/icu/include/unicode/translit.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -14,13 +14,13 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** - * \file + * \file * \brief C++ API: Tranforms text from one format to another. */ - + #if !UCONFIG_NO_TRANSLITERATION #include "unicode/uobject.h" @@ -78,7 +78,7 @@ class TransliteratorIDParser; * transliteration. For example, given a string <code>input</code> * and a transliterator <code>t</code>, the call * - * String result = t.transliterate(input); + * String result = t.transliterate(input); * * will transliterate it and return the result. Other methods allow * the client to specify a substring to be transliterated and to use @@ -98,20 +98,20 @@ class TransliteratorIDParser; * contents of the buffer may show text being modified as each new * character arrives. * - * <p>Consider the simple rule-based Transliterator: - * <pre> - * th>{theta} - * t>{tau} - * </pre> + * <p>Consider the simple rule-based Transliterator: + * <pre> + * th>{theta} + * t>{tau} + * </pre> * * When the user types 't', nothing will happen, since the * transliterator is waiting to see if the next character is 'h'. To * remedy this, we introduce the notion of a cursor, marked by a '|' * in the output string: - * <pre> - * t>|{tau} - * {tau}h>{theta} - * </pre> + * <pre> + * t>|{tau} + * {tau}h>{theta} + * </pre> * * Now when the user types 't', tau appears, and if the next character * is 'h', the tau changes to a theta. This is accomplished by @@ -133,7 +133,7 @@ class TransliteratorIDParser; * which the transliterator last stopped, either because it reached * the end, or because it required more characters to disambiguate * between possible inputs. The <code>CURSOR</code> can also be - * explicitly set by rules in a rule-based Transliterator. + * explicitly set by rules in a rule-based Transliterator. * Any characters before the <code>CURSOR</code> index are frozen; * future keyboard transliteration calls within this input sequence * will not change them. New text is inserted at the @@ -235,255 +235,255 @@ class TransliteratorIDParser; * if the performance of these methods can be improved over the * performance obtained by the default implementations in this class. * - * <p><b>Rule syntax</b> - * - * <p>A set of rules determines how to perform translations. - * Rules within a rule set are separated by semicolons (';'). - * To include a literal semicolon, prefix it with a backslash ('\'). - * Unicode Pattern_White_Space is ignored. - * If the first non-blank character on a line is '#', - * the entire line is ignored as a comment. - * - * <p>Each set of rules consists of two groups, one forward, and one - * reverse. This is a convention that is not enforced; rules for one - * direction may be omitted, with the result that translations in - * that direction will not modify the source text. In addition, - * bidirectional forward-reverse rules may be specified for - * symmetrical transformations. - * - * <p>Note: Another description of the Transliterator rule syntax is available in - * <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Transform_Rules_Syntax">section - * Transform Rules Syntax of UTS #35: Unicode LDML</a>. - * The rules are shown there using arrow symbols ← and → and ↔. - * ICU supports both those and the equivalent ASCII symbols < and > and <>. - * - * <p>Rule statements take one of the following forms: - * - * <dl> - * <dt><code>$alefmadda=\\u0622;</code></dt> - * <dd><strong>Variable definition.</strong> The name on the - * left is assigned the text on the right. In this example, - * after this statement, instances of the left hand name, - * "<code>$alefmadda</code>", will be replaced by - * the Unicode character U+0622. Variable names must begin - * with a letter and consist only of letters, digits, and - * underscores. Case is significant. Duplicate names cause - * an exception to be thrown, that is, variables cannot be - * redefined. The right hand side may contain well-formed - * text of any length, including no text at all ("<code>$empty=;</code>"). - * The right hand side may contain embedded <code>UnicodeSet</code> - * patterns, for example, "<code>$softvowel=[eiyEIY]</code>".</dd> - * <dt><code>ai>$alefmadda;</code></dt> - * <dd><strong>Forward translation rule.</strong> This rule - * states that the string on the left will be changed to the - * string on the right when performing forward - * transliteration.</dd> - * <dt><code>ai<$alefmadda;</code></dt> - * <dd><strong>Reverse translation rule.</strong> This rule - * states that the string on the right will be changed to - * the string on the left when performing reverse - * transliteration.</dd> - * </dl> - * - * <dl> - * <dt><code>ai<>$alefmadda;</code></dt> - * <dd><strong>Bidirectional translation rule.</strong> This - * rule states that the string on the right will be changed - * to the string on the left when performing forward - * transliteration, and vice versa when performing reverse - * transliteration.</dd> - * </dl> - * - * <p>Translation rules consist of a <em>match pattern</em> and an <em>output - * string</em>. The match pattern consists of literal characters, - * optionally preceded by context, and optionally followed by - * context. Context characters, like literal pattern characters, - * must be matched in the text being transliterated. However, unlike - * literal pattern characters, they are not replaced by the output - * text. For example, the pattern "<code>abc{def}</code>" - * indicates the characters "<code>def</code>" must be - * preceded by "<code>abc</code>" for a successful match. - * If there is a successful match, "<code>def</code>" will - * be replaced, but not "<code>abc</code>". The final '<code>}</code>' - * is optional, so "<code>abc{def</code>" is equivalent to - * "<code>abc{def}</code>". Another example is "<code>{123}456</code>" - * (or "<code>123}456</code>") in which the literal - * pattern "<code>123</code>" must be followed by "<code>456</code>". - * - * <p>The output string of a forward or reverse rule consists of - * characters to replace the literal pattern characters. If the - * output string contains the character '<code>|</code>', this is - * taken to indicate the location of the <em>cursor</em> after - * replacement. The cursor is the point in the text at which the - * next replacement, if any, will be applied. The cursor is usually - * placed within the replacement text; however, it can actually be - * placed into the precending or following context by using the - * special character '@'. Examples: - * - * <pre> - * a {foo} z > | @ bar; # foo -> bar, move cursor before a - * {foo} xyz > bar @@|; # foo -> bar, cursor between y and z - * </pre> - * - * <p><b>UnicodeSet</b> - * - * <p><code>UnicodeSet</code> patterns may appear anywhere that - * makes sense. They may appear in variable definitions. - * Contrariwise, <code>UnicodeSet</code> patterns may themselves - * contain variable references, such as "<code>$a=[a-z];$not_a=[^$a]</code>", - * or "<code>$range=a-z;$ll=[$range]</code>". - * - * <p><code>UnicodeSet</code> patterns may also be embedded directly - * into rule strings. Thus, the following two rules are equivalent: - * - * <pre> - * $vowel=[aeiou]; $vowel>'*'; # One way to do this - * [aeiou]>'*'; # Another way - * </pre> - * - * <p>See {@link UnicodeSet} for more documentation and examples. - * - * <p><b>Segments</b> - * - * <p>Segments of the input string can be matched and copied to the - * output string. This makes certain sets of rules simpler and more - * general, and makes reordering possible. For example: - * - * <pre> - * ([a-z]) > $1 $1; # double lowercase letters - * ([:Lu:]) ([:Ll:]) > $2 $1; # reverse order of Lu-Ll pairs - * </pre> - * - * <p>The segment of the input string to be copied is delimited by - * "<code>(</code>" and "<code>)</code>". Up to - * nine segments may be defined. Segments may not overlap. In the - * output string, "<code>$1</code>" through "<code>$9</code>" - * represent the input string segments, in left-to-right order of - * definition. - * - * <p><b>Anchors</b> - * - * <p>Patterns can be anchored to the beginning or the end of the text. This is done with the - * special characters '<code>^</code>' and '<code>$</code>'. For example: - * - * <pre> - * ^ a > 'BEG_A'; # match 'a' at start of text - * a > 'A'; # match other instances of 'a' - * z $ > 'END_Z'; # match 'z' at end of text - * z > 'Z'; # match other instances of 'z' - * </pre> - * - * <p>It is also possible to match the beginning or the end of the text using a <code>UnicodeSet</code>. - * This is done by including a virtual anchor character '<code>$</code>' at the end of the - * set pattern. Although this is usually the match chafacter for the end anchor, the set will - * match either the beginning or the end of the text, depending on its placement. For - * example: - * - * <pre> - * $x = [a-z$]; # match 'a' through 'z' OR anchor - * $x 1 > 2; # match '1' after a-z or at the start - * 3 $x > 4; # match '3' before a-z or at the end - * </pre> - * - * <p><b>Example</b> - * - * <p>The following example rules illustrate many of the features of - * the rule language. - * - * <table border="0" cellpadding="4"> - * <tr> - * <td style="vertical-align: top;">Rule 1.</td> - * <td style="vertical-align: top; write-space: nowrap;"><code>abc{def}>x|y</code></td> - * </tr> - * <tr> - * <td style="vertical-align: top;">Rule 2.</td> - * <td style="vertical-align: top; write-space: nowrap;"><code>xyz>r</code></td> - * </tr> - * <tr> - * <td style="vertical-align: top;">Rule 3.</td> - * <td style="vertical-align: top; write-space: nowrap;"><code>yz>q</code></td> - * </tr> - * </table> - * - * <p>Applying these rules to the string "<code>adefabcdefz</code>" - * yields the following results: - * - * <table border="0" cellpadding="4"> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>|adefabcdefz</code></td> - * <td style="vertical-align: top;">Initial state, no rules match. Advance - * cursor.</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>a|defabcdefz</code></td> - * <td style="vertical-align: top;">Still no match. Rule 1 does not match - * because the preceding context is not present.</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>ad|efabcdefz</code></td> - * <td style="vertical-align: top;">Still no match. Keep advancing until - * there is a match...</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>ade|fabcdefz</code></td> - * <td style="vertical-align: top;">...</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adef|abcdefz</code></td> - * <td style="vertical-align: top;">...</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adefa|bcdefz</code></td> - * <td style="vertical-align: top;">...</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adefab|cdefz</code></td> - * <td style="vertical-align: top;">...</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adefabc|defz</code></td> - * <td style="vertical-align: top;">Rule 1 matches; replace "<code>def</code>" - * with "<code>xy</code>" and back up the cursor - * to before the '<code>y</code>'.</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcx|yz</code></td> - * <td style="vertical-align: top;">Although "<code>xyz</code>" is - * present, rule 2 does not match because the cursor is - * before the '<code>y</code>', not before the '<code>x</code>'. - * Rule 3 does match. Replace "<code>yz</code>" - * with "<code>q</code>".</td> - * </tr> - * <tr> - * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcxq|</code></td> - * <td style="vertical-align: top;">The cursor is at the end; - * transliteration is complete.</td> - * </tr> - * </table> - * - * <p>The order of rules is significant. If multiple rules may match - * at some point, the first matching rule is applied. - * - * <p>Forward and reverse rules may have an empty output string. - * Otherwise, an empty left or right hand side of any statement is a - * syntax error. - * - * <p>Single quotes are used to quote any character other than a - * digit or letter. To specify a single quote itself, inside or - * outside of quotes, use two single quotes in a row. For example, - * the rule "<code>'>'>o''clock</code>" changes the - * string "<code>></code>" to the string "<code>o'clock</code>". - * - * <p><b>Notes</b> - * - * <p>While a Transliterator is being built from rules, it checks that - * the rules are added in proper order. For example, if the rule - * "a>x" is followed by the rule "ab>y", - * then the second rule will throw an exception. The reason is that - * the second rule can never be triggered, since the first rule - * always matches anything it matches. In other words, the first - * rule <em>masks</em> the second rule. - * + * <p><b>Rule syntax</b> + * + * <p>A set of rules determines how to perform translations. + * Rules within a rule set are separated by semicolons (';'). + * To include a literal semicolon, prefix it with a backslash ('\'). + * Unicode Pattern_White_Space is ignored. + * If the first non-blank character on a line is '#', + * the entire line is ignored as a comment. + * + * <p>Each set of rules consists of two groups, one forward, and one + * reverse. This is a convention that is not enforced; rules for one + * direction may be omitted, with the result that translations in + * that direction will not modify the source text. In addition, + * bidirectional forward-reverse rules may be specified for + * symmetrical transformations. + * + * <p>Note: Another description of the Transliterator rule syntax is available in + * <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Transform_Rules_Syntax">section + * Transform Rules Syntax of UTS #35: Unicode LDML</a>. + * The rules are shown there using arrow symbols ← and → and ↔. + * ICU supports both those and the equivalent ASCII symbols < and > and <>. + * + * <p>Rule statements take one of the following forms: + * + * <dl> + * <dt><code>$alefmadda=\\u0622;</code></dt> + * <dd><strong>Variable definition.</strong> The name on the + * left is assigned the text on the right. In this example, + * after this statement, instances of the left hand name, + * "<code>$alefmadda</code>", will be replaced by + * the Unicode character U+0622. Variable names must begin + * with a letter and consist only of letters, digits, and + * underscores. Case is significant. Duplicate names cause + * an exception to be thrown, that is, variables cannot be + * redefined. The right hand side may contain well-formed + * text of any length, including no text at all ("<code>$empty=;</code>"). + * The right hand side may contain embedded <code>UnicodeSet</code> + * patterns, for example, "<code>$softvowel=[eiyEIY]</code>".</dd> + * <dt><code>ai>$alefmadda;</code></dt> + * <dd><strong>Forward translation rule.</strong> This rule + * states that the string on the left will be changed to the + * string on the right when performing forward + * transliteration.</dd> + * <dt><code>ai<$alefmadda;</code></dt> + * <dd><strong>Reverse translation rule.</strong> This rule + * states that the string on the right will be changed to + * the string on the left when performing reverse + * transliteration.</dd> + * </dl> + * + * <dl> + * <dt><code>ai<>$alefmadda;</code></dt> + * <dd><strong>Bidirectional translation rule.</strong> This + * rule states that the string on the right will be changed + * to the string on the left when performing forward + * transliteration, and vice versa when performing reverse + * transliteration.</dd> + * </dl> + * + * <p>Translation rules consist of a <em>match pattern</em> and an <em>output + * string</em>. The match pattern consists of literal characters, + * optionally preceded by context, and optionally followed by + * context. Context characters, like literal pattern characters, + * must be matched in the text being transliterated. However, unlike + * literal pattern characters, they are not replaced by the output + * text. For example, the pattern "<code>abc{def}</code>" + * indicates the characters "<code>def</code>" must be + * preceded by "<code>abc</code>" for a successful match. + * If there is a successful match, "<code>def</code>" will + * be replaced, but not "<code>abc</code>". The final '<code>}</code>' + * is optional, so "<code>abc{def</code>" is equivalent to + * "<code>abc{def}</code>". Another example is "<code>{123}456</code>" + * (or "<code>123}456</code>") in which the literal + * pattern "<code>123</code>" must be followed by "<code>456</code>". + * + * <p>The output string of a forward or reverse rule consists of + * characters to replace the literal pattern characters. If the + * output string contains the character '<code>|</code>', this is + * taken to indicate the location of the <em>cursor</em> after + * replacement. The cursor is the point in the text at which the + * next replacement, if any, will be applied. The cursor is usually + * placed within the replacement text; however, it can actually be + * placed into the precending or following context by using the + * special character '@'. Examples: + * + * <pre> + * a {foo} z > | @ bar; # foo -> bar, move cursor before a + * {foo} xyz > bar @@|; # foo -> bar, cursor between y and z + * </pre> + * + * <p><b>UnicodeSet</b> + * + * <p><code>UnicodeSet</code> patterns may appear anywhere that + * makes sense. They may appear in variable definitions. + * Contrariwise, <code>UnicodeSet</code> patterns may themselves + * contain variable references, such as "<code>$a=[a-z];$not_a=[^$a]</code>", + * or "<code>$range=a-z;$ll=[$range]</code>". + * + * <p><code>UnicodeSet</code> patterns may also be embedded directly + * into rule strings. Thus, the following two rules are equivalent: + * + * <pre> + * $vowel=[aeiou]; $vowel>'*'; # One way to do this + * [aeiou]>'*'; # Another way + * </pre> + * + * <p>See {@link UnicodeSet} for more documentation and examples. + * + * <p><b>Segments</b> + * + * <p>Segments of the input string can be matched and copied to the + * output string. This makes certain sets of rules simpler and more + * general, and makes reordering possible. For example: + * + * <pre> + * ([a-z]) > $1 $1; # double lowercase letters + * ([:Lu:]) ([:Ll:]) > $2 $1; # reverse order of Lu-Ll pairs + * </pre> + * + * <p>The segment of the input string to be copied is delimited by + * "<code>(</code>" and "<code>)</code>". Up to + * nine segments may be defined. Segments may not overlap. In the + * output string, "<code>$1</code>" through "<code>$9</code>" + * represent the input string segments, in left-to-right order of + * definition. + * + * <p><b>Anchors</b> + * + * <p>Patterns can be anchored to the beginning or the end of the text. This is done with the + * special characters '<code>^</code>' and '<code>$</code>'. For example: + * + * <pre> + * ^ a > 'BEG_A'; # match 'a' at start of text + * a > 'A'; # match other instances of 'a' + * z $ > 'END_Z'; # match 'z' at end of text + * z > 'Z'; # match other instances of 'z' + * </pre> + * + * <p>It is also possible to match the beginning or the end of the text using a <code>UnicodeSet</code>. + * This is done by including a virtual anchor character '<code>$</code>' at the end of the + * set pattern. Although this is usually the match chafacter for the end anchor, the set will + * match either the beginning or the end of the text, depending on its placement. For + * example: + * + * <pre> + * $x = [a-z$]; # match 'a' through 'z' OR anchor + * $x 1 > 2; # match '1' after a-z or at the start + * 3 $x > 4; # match '3' before a-z or at the end + * </pre> + * + * <p><b>Example</b> + * + * <p>The following example rules illustrate many of the features of + * the rule language. + * + * <table border="0" cellpadding="4"> + * <tr> + * <td style="vertical-align: top;">Rule 1.</td> + * <td style="vertical-align: top; write-space: nowrap;"><code>abc{def}>x|y</code></td> + * </tr> + * <tr> + * <td style="vertical-align: top;">Rule 2.</td> + * <td style="vertical-align: top; write-space: nowrap;"><code>xyz>r</code></td> + * </tr> + * <tr> + * <td style="vertical-align: top;">Rule 3.</td> + * <td style="vertical-align: top; write-space: nowrap;"><code>yz>q</code></td> + * </tr> + * </table> + * + * <p>Applying these rules to the string "<code>adefabcdefz</code>" + * yields the following results: + * + * <table border="0" cellpadding="4"> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>|adefabcdefz</code></td> + * <td style="vertical-align: top;">Initial state, no rules match. Advance + * cursor.</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>a|defabcdefz</code></td> + * <td style="vertical-align: top;">Still no match. Rule 1 does not match + * because the preceding context is not present.</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>ad|efabcdefz</code></td> + * <td style="vertical-align: top;">Still no match. Keep advancing until + * there is a match...</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>ade|fabcdefz</code></td> + * <td style="vertical-align: top;">...</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adef|abcdefz</code></td> + * <td style="vertical-align: top;">...</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adefa|bcdefz</code></td> + * <td style="vertical-align: top;">...</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adefab|cdefz</code></td> + * <td style="vertical-align: top;">...</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adefabc|defz</code></td> + * <td style="vertical-align: top;">Rule 1 matches; replace "<code>def</code>" + * with "<code>xy</code>" and back up the cursor + * to before the '<code>y</code>'.</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcx|yz</code></td> + * <td style="vertical-align: top;">Although "<code>xyz</code>" is + * present, rule 2 does not match because the cursor is + * before the '<code>y</code>', not before the '<code>x</code>'. + * Rule 3 does match. Replace "<code>yz</code>" + * with "<code>q</code>".</td> + * </tr> + * <tr> + * <td style="vertical-align: top; write-space: nowrap;"><code>adefabcxq|</code></td> + * <td style="vertical-align: top;">The cursor is at the end; + * transliteration is complete.</td> + * </tr> + * </table> + * + * <p>The order of rules is significant. If multiple rules may match + * at some point, the first matching rule is applied. + * + * <p>Forward and reverse rules may have an empty output string. + * Otherwise, an empty left or right hand side of any statement is a + * syntax error. + * + * <p>Single quotes are used to quote any character other than a + * digit or letter. To specify a single quote itself, inside or + * outside of quotes, use two single quotes in a row. For example, + * the rule "<code>'>'>o''clock</code>" changes the + * string "<code>></code>" to the string "<code>o'clock</code>". + * + * <p><b>Notes</b> + * + * <p>While a Transliterator is being built from rules, it checks that + * the rules are added in proper order. For example, if the rule + * "a>x" is followed by the rule "ab>y", + * then the second rule will throw an exception. The reason is that + * the second rule can never be triggered, since the first rule + * always matches anything it matches. In other words, the first + * rule <em>masks</em> the second rule. + * * @author Alan Liu * @stable ICU 2.0 */ @@ -746,9 +746,9 @@ public: * for details. * @param text the buffer holding transliterated and * untransliterated text - * @param index an array of three integers. + * @param index an array of three integers. * @param status Output param to filled in with a success or an error. - * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode &) const + * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode &) const * @stable ICU 2.0 */ virtual void transliterate(Replaceable& text, UTransPosition& index, @@ -879,7 +879,7 @@ public: /** * Transliterate a substring of text, as specified by index, taking filters * into account. This method is for subclasses that need to delegate to - * another transliterator. + * another transliterator. * @param text the text to be transliterated * @param index the position indices * @param incremental if TRUE, then assume more characters may be inserted @@ -1093,19 +1093,19 @@ public: /** * Returns a <code>Transliterator</code> object constructed from - * the given rule string. This will be a rule-based Transliterator, + * the given rule string. This will be a rule-based Transliterator, * if the rule string contains only rules, or a - * compound Transliterator, if it contains ID blocks, or a - * null Transliterator, if it contains ID blocks which parse as + * compound Transliterator, if it contains ID blocks, or a + * null Transliterator, if it contains ID blocks which parse as * empty for the given direction. - * + * * @param ID the id for the transliterator. * @param rules rules, separated by ';' * @param dir either FORWARD or REVERSE. - * @param parseError Struct to receive information on position + * @param parseError Struct to receive information on position * of error if an error is encountered * @param status Output param set to success/failure code. - * @return a newly created Transliterator + * @return a newly created Transliterator * @stable ICU 2.0 */ static Transliterator* U_EXPORT2 createFromRules(const UnicodeString& ID, @@ -1568,7 +1568,7 @@ inline int32_t Transliterator::getMaximumContextLength(void) const { inline void Transliterator::setID(const UnicodeString& id) { ID = id; // NUL-terminate the ID string, which is a non-aliased copy. - ID.append((char16_t)0); + ID.append((char16_t)0); ID.truncate(ID.length()-1); } @@ -1590,6 +1590,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_TRANSLITERATION */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/tzfmt.h b/contrib/libs/icu/include/unicode/tzfmt.h index 6d3863b1e5..3f65b853ed 100644 --- a/contrib/libs/icu/include/unicode/tzfmt.h +++ b/contrib/libs/icu/include/unicode/tzfmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/format.h" @@ -239,10 +239,10 @@ typedef enum UTimeZoneFormatParseOption { */ UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01, /** - * When parsing a time zone display name in \link UTZFMT_STYLE_SPECIFIC_SHORT \endlink, + * When parsing a time zone display name in \link UTZFMT_STYLE_SPECIFIC_SHORT \endlink, * look for the IANA tz database compatible zone abbreviations in addition - * to the localized names coming from the icu::TimeZoneNames currently - * used by the icu::TimeZoneFormat. + * to the localized names coming from the icu::TimeZoneNames currently + * used by the icu::TimeZoneFormat. * @stable ICU 54 */ UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02 @@ -307,7 +307,7 @@ public: * @return A copy of the object * @stable ICU 50 */ - virtual TimeZoneFormat* clone() const; + virtual TimeZoneFormat* clone() const; /** * Creates an instance of <code>TimeZoneFormat</code> for the given locale. @@ -944,7 +944,7 @@ private: * @param parsedLen the parsed length, or 0 on failure. * @return the parsed offset in milliseconds. */ - int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator, + int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator, int32_t& parsedLen) const; /** @@ -984,7 +984,7 @@ private: * @param maxFields The maximum fields * @return The offset string */ - static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep, + static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep, OffsetFields minFields, OffsetFields maxFields, UnicodeString& result); /** @@ -1014,7 +1014,7 @@ private: * @param maxFields The maximum Fields to be parsed * @return Parsed offset, 0 or positive number. */ - static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep, + static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep, OffsetFields minFields, OffsetFields maxFields); /** @@ -1096,7 +1096,7 @@ private: U_NAMESPACE_END #endif /* !UCONFIG_NO_FORMATTING */ - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/tznames.h b/contrib/libs/icu/include/unicode/tznames.h index 860494221d..5c79345077 100644 --- a/contrib/libs/icu/include/unicode/tznames.h +++ b/contrib/libs/icu/include/unicode/tznames.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -15,8 +15,8 @@ */ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/uloc.h" @@ -293,12 +293,12 @@ public: virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const; /** - * @internal ICU internal only, for specific users only until proposed publicly. + * @internal ICU internal only, for specific users only until proposed publicly. */ virtual void loadAllDisplayNames(UErrorCode& status); /** - * @internal ICU internal only, for specific users only until proposed publicly. + * @internal ICU internal only, for specific users only until proposed publicly. */ virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const; @@ -413,7 +413,7 @@ public: U_NAMESPACE_END #endif - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/tzrule.h b/contrib/libs/icu/include/unicode/tzrule.h index 795806d90f..9d767bbf94 100644 --- a/contrib/libs/icu/include/unicode/tzrule.h +++ b/contrib/libs/icu/include/unicode/tzrule.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/uobject.h" @@ -47,7 +47,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - virtual TimeZoneRule* clone() const = 0; + virtual TimeZoneRule* clone() const = 0; /** * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects @@ -231,7 +231,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - virtual InitialTimeZoneRule* clone() const; + virtual InitialTimeZoneRule* clone() const; /** * Assignment operator. @@ -442,7 +442,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - virtual AnnualTimeZoneRule* clone() const; + virtual AnnualTimeZoneRule* clone() const; /** * Assignment operator. @@ -658,7 +658,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - virtual TimeArrayTimeZoneRule* clone() const; + virtual TimeArrayTimeZoneRule* clone() const; /** * Assignment operator. @@ -827,8 +827,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // TZRULE_H //eof diff --git a/contrib/libs/icu/include/unicode/tztrans.h b/contrib/libs/icu/include/unicode/tztrans.h index 217d711eec..78a5152c83 100644 --- a/contrib/libs/icu/include/unicode/tztrans.h +++ b/contrib/libs/icu/include/unicode/tztrans.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -16,8 +16,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + #if !UCONFIG_NO_FORMATTING #include "unicode/uobject.h" @@ -70,7 +70,7 @@ public: * @return A copy of the object. * @stable ICU 3.8 */ - TimeZoneTransition* clone() const; + TimeZoneTransition* clone() const; /** * Assignment operator. @@ -194,8 +194,8 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // TZTRANS_H //eof diff --git a/contrib/libs/icu/include/unicode/ubidi.h b/contrib/libs/icu/include/unicode/ubidi.h index f4875c8801..8dd20a529f 100644 --- a/contrib/libs/icu/include/unicode/ubidi.h +++ b/contrib/libs/icu/include/unicode/ubidi.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * ****************************************************************************** * file name: ubidi.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -323,10 +323,10 @@ * these special values are designed that way. Also, the implementation * assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd. * - * Note: The numeric values of the related constants will not change: - * They are tied to the use of 7-bit byte values (plus the override bit) - * and of the UBiDiLevel=uint8_t data type in this API. - * + * Note: The numeric values of the related constants will not change: + * They are tied to the use of 7-bit byte values (plus the override bit) + * and of the UBiDiLevel=uint8_t data type in this API. + * * @see UBIDI_DEFAULT_LTR * @see UBIDI_DEFAULT_RTL * @see UBIDI_LEVEL_OVERRIDE @@ -390,8 +390,8 @@ typedef uint8_t UBiDiLevel; /** * Maximum explicit embedding level. - * Same as the max_depth value in the - * <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>. + * Same as the max_depth value in the + * <a href="http://www.unicode.org/reports/tr9/#BD2">Unicode Bidirectional Algorithm</a>. * (The maximum resolved level can be up to <code>UBIDI_MAX_EXPLICIT_LEVEL+1</code>). * @stable ICU 2.0 */ @@ -698,7 +698,7 @@ typedef enum UBiDiReorderingMode { * @stable ICU 3.6 */ UBIDI_REORDER_DEFAULT = 0, /** Logical to Visual algorithm which handles numbers in a way which - * mimics the behavior of Windows XP. + * mimics the behavior of Windows XP. * @stable ICU 3.6 */ UBIDI_REORDER_NUMBERS_SPECIAL, /** Logical to Visual algorithm grouping numbers with adjacent R characters @@ -1148,7 +1148,7 @@ ubidi_setContext(UBiDi *pBiDi, /** * Perform the Unicode Bidi algorithm. It is defined in the - * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>, + * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>, * version 13, * also described in The Unicode Standard, Version 4.0 .<p> * @@ -1202,14 +1202,14 @@ ubidi_setContext(UBiDi *pBiDi, * A level overrides the directional property of its corresponding * (same index) character if the level has the * <code>#UBIDI_LEVEL_OVERRIDE</code> bit set.<br><br> - * Aside from that bit, it must be + * Aside from that bit, it must be * <code>paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL</code>, - * except that level 0 is always allowed. - * Level 0 for a paragraph separator prevents reordering of paragraphs; - * this only works reliably if <code>#UBIDI_LEVEL_OVERRIDE</code> - * is also set for paragraph separators. - * Level 0 for other characters is treated as a wildcard - * and is lifted up to the resolved level of the surrounding paragraph.<br><br> + * except that level 0 is always allowed. + * Level 0 for a paragraph separator prevents reordering of paragraphs; + * this only works reliably if <code>#UBIDI_LEVEL_OVERRIDE</code> + * is also set for paragraph separators. + * Level 0 for other characters is treated as a wildcard + * and is lifted up to the resolved level of the surrounding paragraph.<br><br> * <strong>Caution: </strong>A copy of this pointer, not of the levels, * will be stored in the <code>UBiDi</code> object; * the <code>embeddingLevels</code> array must not be @@ -2002,7 +2002,7 @@ U_CDECL_BEGIN * * @return The directional property / Bidi class for the given code point * <code>c</code> if the default class has been overridden, or - * <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code> + * <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code> * if the standard Bidi class value for <code>c</code> is to be used. * @see ubidi_setClassCallback * @see ubidi_getClassCallback @@ -2016,7 +2016,7 @@ U_CDECL_END /** * Retrieve the Bidi class for a given code point. * <p>If a <code>#UBiDiClassCallback</code> callback is defined and returns a - * value other than <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>, + * value other than <code>u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1</code>, * that value is used; otherwise the default class determination mechanism is invoked.</p> * * @param pBiDi is the paragraph <code>UBiDi</code> object. diff --git a/contrib/libs/icu/include/unicode/ubiditransform.h b/contrib/libs/icu/include/unicode/ubiditransform.h index 5c08ed5df0..7b20de33a8 100644 --- a/contrib/libs/icu/include/unicode/ubiditransform.h +++ b/contrib/libs/icu/include/unicode/ubiditransform.h @@ -1,12 +1,12 @@ /* ****************************************************************************** * -* © 2016 and later: Unicode, Inc. and others. +* © 2016 and later: Unicode, Inc. and others. * License & terms of use: http://www.unicode.org/copyright.html * ****************************************************************************** * file name: ubiditransform.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -26,54 +26,54 @@ /** * \file * \brief Bidi Transformations - */ - -/** - * `UBiDiOrder` indicates the order of text. + */ + +/** + * `UBiDiOrder` indicates the order of text. * * This bidi transformation engine supports all possible combinations (4 in * total) of input and output text order: - * - * - <logical input, visual output>: unless the output direction is RTL, this - * corresponds to a normal operation of the Bidi algorithm as described in the - * Unicode Technical Report and implemented by `UBiDi` when the - * reordering mode is set to `UBIDI_REORDER_DEFAULT`. Visual RTL - * mode is not supported by `UBiDi` and is accomplished through - * reversing a visual LTR string, - * - * - <visual input, logical output>: unless the input direction is RTL, this - * corresponds to an "inverse bidi algorithm" in `UBiDi` with the - * reordering mode set to `UBIDI_REORDER_INVERSE_LIKE_DIRECT`. - * Visual RTL mode is not not supported by `UBiDi` and is - * accomplished through reversing a visual LTR string, - * - * - <logical input, logical output>: if the input and output base directions - * mismatch, this corresponds to the `UBiDi` implementation with the - * reordering mode set to `UBIDI_REORDER_RUNS_ONLY`; and if the - * input and output base directions are identical, the transformation engine - * will only handle character mirroring and Arabic shaping operations without - * reordering, - * - * - <visual input, visual output>: this reordering mode is not supported by - * the `UBiDi` engine; it implies character mirroring, Arabic - * shaping, and - if the input/output base directions mismatch - string - * reverse operations. + * + * - <logical input, visual output>: unless the output direction is RTL, this + * corresponds to a normal operation of the Bidi algorithm as described in the + * Unicode Technical Report and implemented by `UBiDi` when the + * reordering mode is set to `UBIDI_REORDER_DEFAULT`. Visual RTL + * mode is not supported by `UBiDi` and is accomplished through + * reversing a visual LTR string, + * + * - <visual input, logical output>: unless the input direction is RTL, this + * corresponds to an "inverse bidi algorithm" in `UBiDi` with the + * reordering mode set to `UBIDI_REORDER_INVERSE_LIKE_DIRECT`. + * Visual RTL mode is not not supported by `UBiDi` and is + * accomplished through reversing a visual LTR string, + * + * - <logical input, logical output>: if the input and output base directions + * mismatch, this corresponds to the `UBiDi` implementation with the + * reordering mode set to `UBIDI_REORDER_RUNS_ONLY`; and if the + * input and output base directions are identical, the transformation engine + * will only handle character mirroring and Arabic shaping operations without + * reordering, + * + * - <visual input, visual output>: this reordering mode is not supported by + * the `UBiDi` engine; it implies character mirroring, Arabic + * shaping, and - if the input/output base directions mismatch - string + * reverse operations. * @see ubidi_setInverse * @see ubidi_setReorderingMode * @see UBIDI_REORDER_DEFAULT * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT * @see UBIDI_REORDER_RUNS_ONLY - * @stable ICU 58 + * @stable ICU 58 */ typedef enum { /** 0: Constant indicating a logical order. * This is the default for input text. - * @stable ICU 58 + * @stable ICU 58 */ UBIDI_LOGICAL = 0, /** 1: Constant indicating a visual order. * This is a default for output text. - * @stable ICU 58 + * @stable ICU 58 */ UBIDI_VISUAL } UBiDiOrder; @@ -86,20 +86,20 @@ typedef enum { * @see ubidi_setReorderingOptions * @see ubidi_writeReordered * @see ubidi_writeReverse - * @stable ICU 58 + * @stable ICU 58 */ typedef enum { /** 0: Constant indicating that character mirroring should not be * performed. * This is the default. - * @stable ICU 58 + * @stable ICU 58 */ UBIDI_MIRRORING_OFF = 0, /** 1: Constant indicating that character mirroring should be performed. * This corresponds to calling <code>ubidi_writeReordered</code> or * <code>ubidi_writeReverse</code> with the * <code>UBIDI_DO_MIRRORING</code> option bit set. - * @stable ICU 58 + * @stable ICU 58 */ UBIDI_MIRRORING_ON } UBiDiMirroring; @@ -107,7 +107,7 @@ typedef enum { /** * Forward declaration of the <code>UBiDiTransform</code> structure that stores * information used by the layout transformation engine. - * @stable ICU 58 + * @stable ICU 58 */ typedef struct UBiDiTransform UBiDiTransform; @@ -243,9 +243,9 @@ typedef struct UBiDiTransform UBiDiTransform; * @see UBiDiMirroring * @see ubidi_setPara * @see u_shapeArabic - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE uint32_t U_EXPORT2 +U_STABLE uint32_t U_EXPORT2 ubiditransform_transform(UBiDiTransform *pBiDiTransform, const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, @@ -289,16 +289,16 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform, * <code>ubiditransform_close()</code>. * * @return An empty <code>UBiDiTransform</code> object. - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE UBiDiTransform* U_EXPORT2 +U_STABLE UBiDiTransform* U_EXPORT2 ubiditransform_open(UErrorCode *pErrorCode); /** * Deallocates the given <code>UBiDiTransform</code> object. - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE void U_EXPORT2 +U_STABLE void U_EXPORT2 ubiditransform_close(UBiDiTransform *pBidiTransform); #if U_SHOW_CPLUSPLUS_API @@ -312,7 +312,7 @@ U_NAMESPACE_BEGIN * * @see LocalPointerBase * @see LocalPointer - * @stable ICU 58 + * @stable ICU 58 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close); diff --git a/contrib/libs/icu/include/unicode/ubrk.h b/contrib/libs/icu/include/unicode/ubrk.h index 73c1553b24..453a15638d 100644 --- a/contrib/libs/icu/include/unicode/ubrk.h +++ b/contrib/libs/icu/include/unicode/ubrk.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -230,8 +230,8 @@ typedef enum USentenceBreakTag { * @param locale The locale specifying the text-breaking conventions. Note that * locale keys such as "lb" and "ss" may be used to modify text break behavior, * see general discussion of BreakIterator C API. - * @param text The text to be iterated over. May be null, in which case ubrk_setText() is - * used to specify the text to be iterated. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. * @param textLength The number of characters in text, or -1 if null-terminated. * @param status A UErrorCode to receive any errors. * @return A UBreakIterator for the specified locale. @@ -269,31 +269,31 @@ ubrk_openRules(const UChar *rules, UErrorCode *status); /** - * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. - * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. - * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not - * compatible across different major versions of ICU, nor across platforms of different - * endianness or different base character set family (ASCII vs EBCDIC). - * @param binaryRules A set of compiled binary rules specifying the text breaking - * conventions. Ownership of the storage containing the compiled - * rules remains with the caller of this function. The compiled - * rules must not be modified or deleted during the life of the - * break iterator. - * @param rulesLength The length of binaryRules in bytes; must be >= 0. - * @param text The text to be iterated over. May be null, in which case - * ubrk_setText() is used to specify the text to be iterated. - * @param textLength The number of characters in text, or -1 if null-terminated. - * @param status Pointer to UErrorCode to receive any errors. - * @return UBreakIterator for the specified rules. - * @see ubrk_getBinaryRules - * @stable ICU 59 - */ -U_STABLE UBreakIterator* U_EXPORT2 -ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, - const UChar * text, int32_t textLength, - UErrorCode * status); - -/** + * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. + * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. + * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not + * compatible across different major versions of ICU, nor across platforms of different + * endianness or different base character set family (ASCII vs EBCDIC). + * @param binaryRules A set of compiled binary rules specifying the text breaking + * conventions. Ownership of the storage containing the compiled + * rules remains with the caller of this function. The compiled + * rules must not be modified or deleted during the life of the + * break iterator. + * @param rulesLength The length of binaryRules in bytes; must be >= 0. + * @param text The text to be iterated over. May be null, in which case + * ubrk_setText() is used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status Pointer to UErrorCode to receive any errors. + * @return UBreakIterator for the specified rules. + * @see ubrk_getBinaryRules + * @stable ICU 59 + */ +U_STABLE UBreakIterator* U_EXPORT2 +ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, + const UChar * text, int32_t textLength, + UErrorCode * status); + +/** * Thread safe cloning operation * @param bi iterator to be cloned * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br> @@ -507,7 +507,7 @@ ubrk_countAvailable(void); /** -* Returns true if the specified position is a boundary position. As a side +* Returns true if the specified position is a boundary position. As a side * effect, leaves the iterator pointing to the first boundary position at * or after "offset". * @param bi The break iterator to use. @@ -541,7 +541,7 @@ ubrk_getRuleStatus(UBreakIterator *bi); * @param fillInVec an array to be filled in with the status values. * @param capacity the length of the supplied vector. A length of zero causes * the function to return the number of status values, in the - * normal way, without attempting to store any values. + * normal way, without attempting to store any values. * @param status receives error codes. * @return The number of rule status values from rules that determined * the most recent boundary returned by the break iterator. @@ -592,37 +592,37 @@ ubrk_refreshUText(UBreakIterator *bi, UText *text, UErrorCode *status); - -/** - * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. - * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator - * more quickly than using ubrk_openRules. The compiled rules are not compatible across - * different major versions of ICU, nor across platforms of different endianness or - * different base character set family (ASCII vs EBCDIC). Supports preflighting (with - * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to - * the binaryRules buffer. However, whether preflighting or not, if the actual length - * is greater than INT32_MAX, then the function returns 0 and sets *status to - * U_INDEX_OUTOFBOUNDS_ERROR. - - * @param bi The break iterator to use. - * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for - * preflighting. - * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for - * preflighting. Must be >= 0. - * @param status Pointer to UErrorCode to receive any errors, such as - * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or - * U_ILLEGAL_ARGUMENT_ERROR. - * @return The actual byte length of the binary rules, if <= INT32_MAX; - * otherwise 0. If not preflighting and this is larger than - * rulesCapacity, *status will be set to an error. - * @see ubrk_openBinaryRules - * @stable ICU 59 - */ -U_STABLE int32_t U_EXPORT2 -ubrk_getBinaryRules(UBreakIterator *bi, - uint8_t * binaryRules, int32_t rulesCapacity, - UErrorCode * status); - + +/** + * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. + * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator + * more quickly than using ubrk_openRules. The compiled rules are not compatible across + * different major versions of ICU, nor across platforms of different endianness or + * different base character set family (ASCII vs EBCDIC). Supports preflighting (with + * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to + * the binaryRules buffer. However, whether preflighting or not, if the actual length + * is greater than INT32_MAX, then the function returns 0 and sets *status to + * U_INDEX_OUTOFBOUNDS_ERROR. + + * @param bi The break iterator to use. + * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for + * preflighting. + * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for + * preflighting. Must be >= 0. + * @param status Pointer to UErrorCode to receive any errors, such as + * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or + * U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual byte length of the binary rules, if <= INT32_MAX; + * otherwise 0. If not preflighting and this is larger than + * rulesCapacity, *status will be set to an error. + * @see ubrk_openBinaryRules + * @stable ICU 59 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_getBinaryRules(UBreakIterator *bi, + uint8_t * binaryRules, int32_t rulesCapacity, + UErrorCode * status); + #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ #endif diff --git a/contrib/libs/icu/include/unicode/ucal.h b/contrib/libs/icu/include/unicode/ucal.h index c198450ba2..64a8d5dfe6 100644 --- a/contrib/libs/icu/include/unicode/ucal.h +++ b/contrib/libs/icu/include/unicode/ucal.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -105,7 +105,7 @@ * <p> * <strong>Note:</strong> for some non-Gregorian calendars, different * fields may be necessary for complete disambiguation. For example, a full - * specification of the historical Arabic astronomical calendar requires year, + * specification of the historical Arabic astronomical calendar requires year, * month, day-of-month <em>and</em> day-of-week in some cases. * * <p> @@ -139,25 +139,25 @@ * For example, subtracting 5 days from the date <code>September 12, 1996</code> * results in <code>September 7, 1996</code>. * - * <p> - * The Japanese calendar uses a combination of era name and year number. - * When an emperor of Japan abdicates and a new emperor ascends the throne, - * a new era is declared and year number is reset to 1. Even if the date of - * abdication is scheduled ahead of time, the new era name might not be - * announced until just before the date. In such case, ICU4C may include - * a start date of future era without actual era name, but not enabled - * by default. ICU4C users who want to test the behavior of the future era - * can enable the tentative era by: - * <ul> - * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li> - * </ul> - * + * <p> + * The Japanese calendar uses a combination of era name and year number. + * When an emperor of Japan abdicates and a new emperor ascends the throne, + * a new era is declared and year number is reset to 1. Even if the date of + * abdication is scheduled ahead of time, the new era name might not be + * announced until just before the date. In such case, ICU4C may include + * a start date of future era without actual era name, but not enabled + * by default. ICU4C users who want to test the behavior of the future era + * can enable the tentative era by: + * <ul> + * <li>Environment variable <code>ICU_ENABLE_TENTATIVE_ERA=true</code>.</li> + * </ul> + * * @stable ICU 2.0 */ /** * The time zone ID reserved for unknown time zone. - * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown". + * It behaves like the GMT/UTC time zone but has the special ID "Etc/Unknown". * @stable ICU 4.8 */ #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown" @@ -439,15 +439,15 @@ enum UCalendarDateFields { */ UCAL_IS_LEAP_MONTH, - /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, - * it is needed for layout of Calendar, DateFormat, and other objects */ -#ifndef U_FORCE_HIDE_DEPRECATED_API + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of Calendar, DateFormat, and other objects */ +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * One more than the highest normal UCalendarDateFields value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UCAL_FIELD_COUNT, -#endif // U_FORCE_HIDE_DEPRECATED_API + UCAL_FIELD_COUNT, +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Field number indicating the @@ -623,13 +623,13 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec); /** * Return the default time zone. The default is determined initially - * by querying the host operating system. If the host system detection - * routines fail, or if they specify a TimeZone or TimeZone offset - * which is not recognized, then the special TimeZone "Etc/Unknown" - * is returned. - * - * The default may be changed with `ucal_setDefaultTimeZone()` or with - * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`. + * by querying the host operating system. If the host system detection + * routines fail, or if they specify a TimeZone or TimeZone offset + * which is not recognized, then the special TimeZone "Etc/Unknown" + * is returned. + * + * The default may be changed with `ucal_setDefaultTimeZone()` or with + * the C++ TimeZone API, `TimeZone::adoptDefault(TimeZone*)`. * * @param result A buffer to receive the result, or NULL * @@ -639,9 +639,9 @@ ucal_openCountryTimeZones(const char* country, UErrorCode* ec); * * @return The result string length, not including the terminating * null - * - * @see #UCAL_UNKNOWN_ZONE_ID - * + * + * @see #UCAL_UNKNOWN_ZONE_ID + * * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 @@ -659,43 +659,43 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); U_STABLE void U_EXPORT2 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); -#ifndef U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API + /** - * Return the current host time zone. The host time zone is detected from - * the current host system configuration by querying the host operating - * system. If the host system detection routines fail, or if they specify - * a TimeZone or TimeZone offset which is not recognized, then the special - * TimeZone "Etc/Unknown" is returned. - * - * Note that host time zone and the ICU default time zone can be different. - * - * The ICU default time zone does not change once initialized unless modified - * by calling `ucal_setDefaultTimeZone()` or with the C++ TimeZone API, - * `TimeZone::adoptDefault(TimeZone*)`. - * - * If the host operating system configuration has changed since ICU has - * initialized then the returned value can be different than the ICU default - * time zone, even if the default has not changed. - * - * <p>This function is not thread safe.</p> - * - * @param result A buffer to receive the result, or NULL - * @param resultCapacity The capacity of the result buffer - * @param ec input/output error code - * @return The result string length, not including the terminating - * null - * - * @see #UCAL_UNKNOWN_ZONE_ID + * Return the current host time zone. The host time zone is detected from + * the current host system configuration by querying the host operating + * system. If the host system detection routines fail, or if they specify + * a TimeZone or TimeZone offset which is not recognized, then the special + * TimeZone "Etc/Unknown" is returned. + * + * Note that host time zone and the ICU default time zone can be different. + * + * The ICU default time zone does not change once initialized unless modified + * by calling `ucal_setDefaultTimeZone()` or with the C++ TimeZone API, + * `TimeZone::adoptDefault(TimeZone*)`. + * + * If the host operating system configuration has changed since ICU has + * initialized then the returned value can be different than the ICU default + * time zone, even if the default has not changed. * - * @draft ICU 65 - */ -U_DRAFT int32_t U_EXPORT2 -ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); - -#endif // U_HIDE_DRAFT_API - -/** + * <p>This function is not thread safe.</p> + * + * @param result A buffer to receive the result, or NULL + * @param resultCapacity The capacity of the result buffer + * @param ec input/output error code + * @return The result string length, not including the terminating + * null + * + * @see #UCAL_UNKNOWN_ZONE_ID + * + * @draft ICU 65 + */ +U_DRAFT int32_t U_EXPORT2 +ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); + +#endif // U_HIDE_DRAFT_API + +/** * Return the amount of time in milliseconds that the clock is * advanced during daylight savings time for the given time zone, or * zero if the time zone does not observe daylight savings time. diff --git a/contrib/libs/icu/include/unicode/ucasemap.h b/contrib/libs/icu/include/unicode/ucasemap.h index 6b253e3d63..61c788d925 100644 --- a/contrib/libs/icu/include/unicode/ucasemap.h +++ b/contrib/libs/icu/include/unicode/ucasemap.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: ucasemap.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -22,8 +22,8 @@ #define __UCASEMAP_H__ #include "unicode/utypes.h" -#include "unicode/localpointer.h" -#include "unicode/stringoptions.h" +#include "unicode/localpointer.h" +#include "unicode/stringoptions.h" #include "unicode/ustring.h" /** @@ -202,7 +202,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * - * This function uses only the setText(), first() and next() methods of the + * This function uses only the setText(), first() and next() methods of the * provided break iterator. * * The result may be longer or shorter than the original. @@ -213,7 +213,7 @@ ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. - * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * @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. * @param src The original string. @@ -232,7 +232,7 @@ ucasemap_toTitle(UCaseMap *csm, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); -#endif // UCONFIG_NO_BREAK_ITERATION +#endif // UCONFIG_NO_BREAK_ITERATION /** * Lowercase the characters in a UTF-8 string. diff --git a/contrib/libs/icu/include/unicode/ucat.h b/contrib/libs/icu/include/unicode/ucat.h index 4d1ff3f6b2..f53ed2291a 100644 --- a/contrib/libs/icu/include/unicode/ucat.h +++ b/contrib/libs/icu/include/unicode/ucat.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** diff --git a/contrib/libs/icu/include/unicode/uchar.h b/contrib/libs/icu/include/unicode/uchar.h index 3b55b2326d..d4e5beaa0f 100644 --- a/contrib/libs/icu/include/unicode/uchar.h +++ b/contrib/libs/icu/include/unicode/uchar.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -26,26 +26,26 @@ #define UCHAR_H #include "unicode/utypes.h" -#include "unicode/stringoptions.h" -#include "unicode/ucpmap.h" - -#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) - -#define USET_DEFINED - -/** - * USet is the C API type corresponding to C++ class UnicodeSet. - * It is forward-declared here to avoid including unicode/uset.h file if related - * APIs are not used. - * - * @see ucnv_getUnicodeSet - * @stable ICU 2.4 - */ -typedef struct USet USet; - -#endif - - +#include "unicode/stringoptions.h" +#include "unicode/ucpmap.h" + +#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) + +#define USET_DEFINED + +/** + * USet is the C API type corresponding to C++ class UnicodeSet. + * It is forward-declared here to avoid including unicode/uset.h file if related + * APIs are not used. + * + * @see ucnv_getUnicodeSet + * @stable ICU 2.4 + */ +typedef struct USet USet; + +#endif + + U_CDECL_BEGIN /*==========================================================================*/ @@ -60,7 +60,7 @@ U_CDECL_BEGIN * @see u_getUnicodeVersion * @stable ICU 2.0 */ -#define U_UNICODE_VERSION "13.0" +#define U_UNICODE_VERSION "13.0" /** * \file @@ -79,18 +79,18 @@ U_CDECL_BEGIN * "About the Unicode Character Database" (http://www.unicode.org/ucd/) * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). * - * Many properties are accessible via generic functions that take a UProperty selector. - * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point. - * - u_getIntPropertyValue() returns an integer value per property and code point. - * For each supported enumerated or catalog property, there is - * an enum type for all of the property's values, and - * u_getIntPropertyValue() returns the numeric values of those constants. - * - u_getBinaryPropertySet() returns a set for each ICU-supported binary property with - * all code points for which the property is true. - * - u_getIntPropertyMap() returns a map for each - * ICU-supported enumerated/catalog/int-valued property which - * maps all Unicode code points to their values for that property. - * + * Many properties are accessible via generic functions that take a UProperty selector. + * - u_hasBinaryProperty() returns a binary value (TRUE/FALSE) per property and code point. + * - u_getIntPropertyValue() returns an integer value per property and code point. + * For each supported enumerated or catalog property, there is + * an enum type for all of the property's values, and + * u_getIntPropertyValue() returns the numeric values of those constants. + * - u_getBinaryPropertySet() returns a set for each ICU-supported binary property with + * all code points for which the property is true. + * - u_getIntPropertyMap() returns a map for each + * ICU-supported enumerated/catalog/int-valued property which + * maps all Unicode code points to their values for that property. + * * Many functions are designed to match java.lang.Character functions. * See the individual function documentation, * and see the JDK 1.4 java.lang.Character documentation @@ -142,11 +142,11 @@ U_CDECL_BEGIN * Comparison: * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property; * most of general categories "Z" (separators) + most whitespace ISO controls - * (including no-break spaces, but excluding IS1..IS4) + * (including no-break spaces, but excluding IS1..IS4) * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces) * - u_isspace: Z + whitespace ISO controls (including no-break spaces) - * - u_isblank: "horizontal spaces" = TAB + Zs + * - u_isblank: "horizontal spaces" = TAB + Zs */ /** @@ -180,9 +180,9 @@ U_CDECL_BEGIN * The properties APIs are intended to reflect Unicode properties as defined * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). * - * For details about the properties see - * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/). - * + * For details about the properties see + * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/). + * * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2, * then properties marked with "new in Unicode 3.2" are not or not fully available. * Check u_getUnicodeVersion to be sure. @@ -435,60 +435,60 @@ typedef enum UProperty { * Binary property Emoji. * See http://www.unicode.org/reports/tr51/#Emoji_Properties * - * @stable ICU 57 + * @stable ICU 57 */ UCHAR_EMOJI=57, /** * Binary property Emoji_Presentation. * See http://www.unicode.org/reports/tr51/#Emoji_Properties * - * @stable ICU 57 + * @stable ICU 57 */ UCHAR_EMOJI_PRESENTATION=58, /** * Binary property Emoji_Modifier. * See http://www.unicode.org/reports/tr51/#Emoji_Properties * - * @stable ICU 57 + * @stable ICU 57 */ UCHAR_EMOJI_MODIFIER=59, /** * Binary property Emoji_Modifier_Base. * See http://www.unicode.org/reports/tr51/#Emoji_Properties * - * @stable ICU 57 + * @stable ICU 57 */ UCHAR_EMOJI_MODIFIER_BASE=60, - /** - * Binary property Emoji_Component. - * See http://www.unicode.org/reports/tr51/#Emoji_Properties - * - * @stable ICU 60 - */ - UCHAR_EMOJI_COMPONENT=61, - /** - * Binary property Regional_Indicator. - * @stable ICU 60 - */ - UCHAR_REGIONAL_INDICATOR=62, - /** - * Binary property Prepended_Concatenation_Mark. - * @stable ICU 60 - */ - UCHAR_PREPENDED_CONCATENATION_MARK=63, - /** - * Binary property Extended_Pictographic. - * See http://www.unicode.org/reports/tr51/#Emoji_Properties - * - * @stable ICU 62 - */ - UCHAR_EXTENDED_PICTOGRAPHIC=64, + /** + * Binary property Emoji_Component. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 60 + */ + UCHAR_EMOJI_COMPONENT=61, + /** + * Binary property Regional_Indicator. + * @stable ICU 60 + */ + UCHAR_REGIONAL_INDICATOR=62, + /** + * Binary property Prepended_Concatenation_Mark. + * @stable ICU 60 + */ + UCHAR_PREPENDED_CONCATENATION_MARK=63, + /** + * Binary property Extended_Pictographic. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 62 + */ + UCHAR_EXTENDED_PICTOGRAPHIC=64, #ifndef U_HIDE_DEPRECATED_API /** * One more than the last constant for binary Unicode properties. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UCHAR_BINARY_LIMIT, + UCHAR_BINARY_LIMIT, #endif // U_HIDE_DEPRECATED_API /** Enumerated property Bidi_Class. @@ -576,34 +576,34 @@ typedef enum UProperty { (http://www.unicode.org/reports/tr9/) Returns UBidiPairedBracketType values. @stable ICU 52 */ UCHAR_BIDI_PAIRED_BRACKET_TYPE=0x1015, - /** - * Enumerated property Indic_Positional_Category. - * New in Unicode 6.0 as provisional property Indic_Matra_Category; - * renamed and changed to informative in Unicode 8.0. - * See http://www.unicode.org/reports/tr44/#IndicPositionalCategory.txt - * @stable ICU 63 - */ - UCHAR_INDIC_POSITIONAL_CATEGORY=0x1016, - /** - * Enumerated property Indic_Syllabic_Category. - * New in Unicode 6.0 as provisional; informative since Unicode 8.0. - * See http://www.unicode.org/reports/tr44/#IndicSyllabicCategory.txt - * @stable ICU 63 - */ - UCHAR_INDIC_SYLLABIC_CATEGORY=0x1017, - /** - * Enumerated property Vertical_Orientation. - * Used for UAX #50 Unicode Vertical Text Layout (https://www.unicode.org/reports/tr50/). - * New as a UCD property in Unicode 10.0. - * @stable ICU 63 - */ - UCHAR_VERTICAL_ORIENTATION=0x1018, + /** + * Enumerated property Indic_Positional_Category. + * New in Unicode 6.0 as provisional property Indic_Matra_Category; + * renamed and changed to informative in Unicode 8.0. + * See http://www.unicode.org/reports/tr44/#IndicPositionalCategory.txt + * @stable ICU 63 + */ + UCHAR_INDIC_POSITIONAL_CATEGORY=0x1016, + /** + * Enumerated property Indic_Syllabic_Category. + * New in Unicode 6.0 as provisional; informative since Unicode 8.0. + * See http://www.unicode.org/reports/tr44/#IndicSyllabicCategory.txt + * @stable ICU 63 + */ + UCHAR_INDIC_SYLLABIC_CATEGORY=0x1017, + /** + * Enumerated property Vertical_Orientation. + * Used for UAX #50 Unicode Vertical Text Layout (https://www.unicode.org/reports/tr50/). + * New as a UCD property in Unicode 10.0. + * @stable ICU 63 + */ + UCHAR_VERTICAL_ORIENTATION=0x1018, #ifndef U_HIDE_DEPRECATED_API /** * One more than the last constant for enumerated/integer Unicode properties. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UCHAR_INT_LIMIT=0x1019, + UCHAR_INT_LIMIT=0x1019, #endif // U_HIDE_DEPRECATED_API /** Bitmask property General_Category_Mask. @@ -1725,88 +1725,88 @@ enum UBlockCode { /** @stable ICU 58 */ UBLOCK_TANGUT_COMPONENTS = 273, /*[18800]*/ - // New blocks in Unicode 10.0 - - /** @stable ICU 60 */ - UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/ - /** @stable ICU 60 */ - UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/ - /** @stable ICU 60 */ - UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/ - /** @stable ICU 60 */ - UBLOCK_NUSHU = 277, /*[1B170]*/ - /** @stable ICU 60 */ - UBLOCK_SOYOMBO = 278, /*[11A50]*/ - /** @stable ICU 60 */ - UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/ - /** @stable ICU 60 */ - UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/ - - // New blocks in Unicode 11.0 - - /** @stable ICU 62 */ - UBLOCK_CHESS_SYMBOLS = 281, /*[1FA00]*/ - /** @stable ICU 62 */ - UBLOCK_DOGRA = 282, /*[11800]*/ - /** @stable ICU 62 */ - UBLOCK_GEORGIAN_EXTENDED = 283, /*[1C90]*/ - /** @stable ICU 62 */ - UBLOCK_GUNJALA_GONDI = 284, /*[11D60]*/ - /** @stable ICU 62 */ - UBLOCK_HANIFI_ROHINGYA = 285, /*[10D00]*/ - /** @stable ICU 62 */ - UBLOCK_INDIC_SIYAQ_NUMBERS = 286, /*[1EC70]*/ - /** @stable ICU 62 */ - UBLOCK_MAKASAR = 287, /*[11EE0]*/ - /** @stable ICU 62 */ - UBLOCK_MAYAN_NUMERALS = 288, /*[1D2E0]*/ - /** @stable ICU 62 */ - UBLOCK_MEDEFAIDRIN = 289, /*[16E40]*/ - /** @stable ICU 62 */ - UBLOCK_OLD_SOGDIAN = 290, /*[10F00]*/ - /** @stable ICU 62 */ - UBLOCK_SOGDIAN = 291, /*[10F30]*/ - - // New blocks in Unicode 12.0 - - /** @stable ICU 64 */ - UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, /*[13430]*/ - /** @stable ICU 64 */ - UBLOCK_ELYMAIC = 293, /*[10FE0]*/ - /** @stable ICU 64 */ - UBLOCK_NANDINAGARI = 294, /*[119A0]*/ - /** @stable ICU 64 */ - UBLOCK_NYIAKENG_PUACHUE_HMONG = 295, /*[1E100]*/ - /** @stable ICU 64 */ - UBLOCK_OTTOMAN_SIYAQ_NUMBERS = 296, /*[1ED00]*/ - /** @stable ICU 64 */ - UBLOCK_SMALL_KANA_EXTENSION = 297, /*[1B130]*/ - /** @stable ICU 64 */ - UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, /*[1FA70]*/ - /** @stable ICU 64 */ - UBLOCK_TAMIL_SUPPLEMENT = 299, /*[11FC0]*/ - /** @stable ICU 64 */ - UBLOCK_WANCHO = 300, /*[1E2C0]*/ - - // New blocks in Unicode 13.0 - - /** @stable ICU 66 */ - UBLOCK_CHORASMIAN = 301, /*[10FB0]*/ - /** @stable ICU 66 */ - UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G = 302, /*[30000]*/ - /** @stable ICU 66 */ - UBLOCK_DIVES_AKURU = 303, /*[11900]*/ - /** @stable ICU 66 */ - UBLOCK_KHITAN_SMALL_SCRIPT = 304, /*[18B00]*/ - /** @stable ICU 66 */ - UBLOCK_LISU_SUPPLEMENT = 305, /*[11FB0]*/ - /** @stable ICU 66 */ - UBLOCK_SYMBOLS_FOR_LEGACY_COMPUTING = 306, /*[1FB00]*/ - /** @stable ICU 66 */ - UBLOCK_TANGUT_SUPPLEMENT = 307, /*[18D00]*/ - /** @stable ICU 66 */ - UBLOCK_YEZIDI = 308, /*[10E80]*/ - + // New blocks in Unicode 10.0 + + /** @stable ICU 60 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/ + /** @stable ICU 60 */ + UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/ + /** @stable ICU 60 */ + UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/ + /** @stable ICU 60 */ + UBLOCK_NUSHU = 277, /*[1B170]*/ + /** @stable ICU 60 */ + UBLOCK_SOYOMBO = 278, /*[11A50]*/ + /** @stable ICU 60 */ + UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/ + /** @stable ICU 60 */ + UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/ + + // New blocks in Unicode 11.0 + + /** @stable ICU 62 */ + UBLOCK_CHESS_SYMBOLS = 281, /*[1FA00]*/ + /** @stable ICU 62 */ + UBLOCK_DOGRA = 282, /*[11800]*/ + /** @stable ICU 62 */ + UBLOCK_GEORGIAN_EXTENDED = 283, /*[1C90]*/ + /** @stable ICU 62 */ + UBLOCK_GUNJALA_GONDI = 284, /*[11D60]*/ + /** @stable ICU 62 */ + UBLOCK_HANIFI_ROHINGYA = 285, /*[10D00]*/ + /** @stable ICU 62 */ + UBLOCK_INDIC_SIYAQ_NUMBERS = 286, /*[1EC70]*/ + /** @stable ICU 62 */ + UBLOCK_MAKASAR = 287, /*[11EE0]*/ + /** @stable ICU 62 */ + UBLOCK_MAYAN_NUMERALS = 288, /*[1D2E0]*/ + /** @stable ICU 62 */ + UBLOCK_MEDEFAIDRIN = 289, /*[16E40]*/ + /** @stable ICU 62 */ + UBLOCK_OLD_SOGDIAN = 290, /*[10F00]*/ + /** @stable ICU 62 */ + UBLOCK_SOGDIAN = 291, /*[10F30]*/ + + // New blocks in Unicode 12.0 + + /** @stable ICU 64 */ + UBLOCK_EGYPTIAN_HIEROGLYPH_FORMAT_CONTROLS = 292, /*[13430]*/ + /** @stable ICU 64 */ + UBLOCK_ELYMAIC = 293, /*[10FE0]*/ + /** @stable ICU 64 */ + UBLOCK_NANDINAGARI = 294, /*[119A0]*/ + /** @stable ICU 64 */ + UBLOCK_NYIAKENG_PUACHUE_HMONG = 295, /*[1E100]*/ + /** @stable ICU 64 */ + UBLOCK_OTTOMAN_SIYAQ_NUMBERS = 296, /*[1ED00]*/ + /** @stable ICU 64 */ + UBLOCK_SMALL_KANA_EXTENSION = 297, /*[1B130]*/ + /** @stable ICU 64 */ + UBLOCK_SYMBOLS_AND_PICTOGRAPHS_EXTENDED_A = 298, /*[1FA70]*/ + /** @stable ICU 64 */ + UBLOCK_TAMIL_SUPPLEMENT = 299, /*[11FC0]*/ + /** @stable ICU 64 */ + UBLOCK_WANCHO = 300, /*[1E2C0]*/ + + // New blocks in Unicode 13.0 + + /** @stable ICU 66 */ + UBLOCK_CHORASMIAN = 301, /*[10FB0]*/ + /** @stable ICU 66 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_G = 302, /*[30000]*/ + /** @stable ICU 66 */ + UBLOCK_DIVES_AKURU = 303, /*[11900]*/ + /** @stable ICU 66 */ + UBLOCK_KHITAN_SMALL_SCRIPT = 304, /*[18B00]*/ + /** @stable ICU 66 */ + UBLOCK_LISU_SUPPLEMENT = 305, /*[11FB0]*/ + /** @stable ICU 66 */ + UBLOCK_SYMBOLS_FOR_LEGACY_COMPUTING = 306, /*[1FB00]*/ + /** @stable ICU 66 */ + UBLOCK_TANGUT_SUPPLEMENT = 307, /*[18D00]*/ + /** @stable ICU 66 */ + UBLOCK_YEZIDI = 308, /*[10E80]*/ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UBlockCode value. @@ -1814,7 +1814,7 @@ enum UBlockCode { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UBLOCK_COUNT = 309, + UBLOCK_COUNT = 309, #endif // U_HIDE_DEPRECATED_API /** @stable ICU 2.0 */ @@ -2090,22 +2090,22 @@ typedef enum UJoiningGroup { U_JG_AFRICAN_FEH, /**< @stable ICU 58 */ U_JG_AFRICAN_NOON, /**< @stable ICU 58 */ U_JG_AFRICAN_QAF, /**< @stable ICU 58 */ - - U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_JA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_RA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */ - U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */ - - U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */ - U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */ - + + U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_JA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_RA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */ + + U_JG_HANIFI_ROHINGYA_KINNA_YA, /**< @stable ICU 62 */ + U_JG_HANIFI_ROHINGYA_PA, /**< @stable ICU 62 */ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UJoiningGroup value. @@ -2156,7 +2156,7 @@ typedef enum UGraphemeClusterBreak { U_GCB_GLUE_AFTER_ZWJ = 16, /*[GAZ]*/ /** @stable ICU 58 */ U_GCB_ZWJ = 17, /*[ZWJ]*/ - + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UGraphemeClusterBreak value. @@ -2218,9 +2218,9 @@ typedef enum UWordBreakValues { U_WB_GLUE_AFTER_ZWJ = 20, /*[GAZ]*/ /** @stable ICU 58 */ U_WB_ZWJ = 21, /*[ZWJ]*/ - /** @stable ICU 62 */ - U_WB_WSEGSPACE = 22, /*[WSEGSPACE]*/ - + /** @stable ICU 62 */ + U_WB_WSEGSPACE = 22, /*[WSEGSPACE]*/ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UWordBreakValues value. @@ -2228,7 +2228,7 @@ typedef enum UWordBreakValues { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - U_WB_COUNT = 23 + U_WB_COUNT = 23 #endif // U_HIDE_DEPRECATED_API } UWordBreakValues; @@ -2413,163 +2413,163 @@ typedef enum UHangulSyllableType { } UHangulSyllableType; /** - * Indic Positional Category constants. - * - * @see UCHAR_INDIC_POSITIONAL_CATEGORY - * @stable ICU 63 - */ -typedef enum UIndicPositionalCategory { - /* - * Note: UIndicPositionalCategory constants are parsed by preparseucd.py. - * It matches lines like - * U_INPC_<Unicode Indic_Positional_Category value name> - */ - - /** @stable ICU 63 */ - U_INPC_NA, - /** @stable ICU 63 */ - U_INPC_BOTTOM, - /** @stable ICU 63 */ - U_INPC_BOTTOM_AND_LEFT, - /** @stable ICU 63 */ - U_INPC_BOTTOM_AND_RIGHT, - /** @stable ICU 63 */ - U_INPC_LEFT, - /** @stable ICU 63 */ - U_INPC_LEFT_AND_RIGHT, - /** @stable ICU 63 */ - U_INPC_OVERSTRUCK, - /** @stable ICU 63 */ - U_INPC_RIGHT, - /** @stable ICU 63 */ - U_INPC_TOP, - /** @stable ICU 63 */ - U_INPC_TOP_AND_BOTTOM, - /** @stable ICU 63 */ - U_INPC_TOP_AND_BOTTOM_AND_RIGHT, - /** @stable ICU 63 */ - U_INPC_TOP_AND_LEFT, - /** @stable ICU 63 */ - U_INPC_TOP_AND_LEFT_AND_RIGHT, - /** @stable ICU 63 */ - U_INPC_TOP_AND_RIGHT, - /** @stable ICU 63 */ - U_INPC_VISUAL_ORDER_LEFT, - /** @stable ICU 66 */ - U_INPC_TOP_AND_BOTTOM_AND_LEFT, -} UIndicPositionalCategory; - -/** - * Indic Syllabic Category constants. - * - * @see UCHAR_INDIC_SYLLABIC_CATEGORY - * @stable ICU 63 - */ -typedef enum UIndicSyllabicCategory { - /* - * Note: UIndicSyllabicCategory constants are parsed by preparseucd.py. - * It matches lines like - * U_INSC_<Unicode Indic_Syllabic_Category value name> - */ - - /** @stable ICU 63 */ - U_INSC_OTHER, - /** @stable ICU 63 */ - U_INSC_AVAGRAHA, - /** @stable ICU 63 */ - U_INSC_BINDU, - /** @stable ICU 63 */ - U_INSC_BRAHMI_JOINING_NUMBER, - /** @stable ICU 63 */ - U_INSC_CANTILLATION_MARK, - /** @stable ICU 63 */ - U_INSC_CONSONANT, - /** @stable ICU 63 */ - U_INSC_CONSONANT_DEAD, - /** @stable ICU 63 */ - U_INSC_CONSONANT_FINAL, - /** @stable ICU 63 */ - U_INSC_CONSONANT_HEAD_LETTER, - /** @stable ICU 63 */ - U_INSC_CONSONANT_INITIAL_POSTFIXED, - /** @stable ICU 63 */ - U_INSC_CONSONANT_KILLER, - /** @stable ICU 63 */ - U_INSC_CONSONANT_MEDIAL, - /** @stable ICU 63 */ - U_INSC_CONSONANT_PLACEHOLDER, - /** @stable ICU 63 */ - U_INSC_CONSONANT_PRECEDING_REPHA, - /** @stable ICU 63 */ - U_INSC_CONSONANT_PREFIXED, - /** @stable ICU 63 */ - U_INSC_CONSONANT_SUBJOINED, - /** @stable ICU 63 */ - U_INSC_CONSONANT_SUCCEEDING_REPHA, - /** @stable ICU 63 */ - U_INSC_CONSONANT_WITH_STACKER, - /** @stable ICU 63 */ - U_INSC_GEMINATION_MARK, - /** @stable ICU 63 */ - U_INSC_INVISIBLE_STACKER, - /** @stable ICU 63 */ - U_INSC_JOINER, - /** @stable ICU 63 */ - U_INSC_MODIFYING_LETTER, - /** @stable ICU 63 */ - U_INSC_NON_JOINER, - /** @stable ICU 63 */ - U_INSC_NUKTA, - /** @stable ICU 63 */ - U_INSC_NUMBER, - /** @stable ICU 63 */ - U_INSC_NUMBER_JOINER, - /** @stable ICU 63 */ - U_INSC_PURE_KILLER, - /** @stable ICU 63 */ - U_INSC_REGISTER_SHIFTER, - /** @stable ICU 63 */ - U_INSC_SYLLABLE_MODIFIER, - /** @stable ICU 63 */ - U_INSC_TONE_LETTER, - /** @stable ICU 63 */ - U_INSC_TONE_MARK, - /** @stable ICU 63 */ - U_INSC_VIRAMA, - /** @stable ICU 63 */ - U_INSC_VISARGA, - /** @stable ICU 63 */ - U_INSC_VOWEL, - /** @stable ICU 63 */ - U_INSC_VOWEL_DEPENDENT, - /** @stable ICU 63 */ - U_INSC_VOWEL_INDEPENDENT, -} UIndicSyllabicCategory; - -/** - * Vertical Orientation constants. - * - * @see UCHAR_VERTICAL_ORIENTATION - * @stable ICU 63 - */ -typedef enum UVerticalOrientation { - /* - * Note: UVerticalOrientation constants are parsed by preparseucd.py. - * It matches lines like - * U_VO_<Unicode Vertical_Orientation value name> - */ - - /** @stable ICU 63 */ - U_VO_ROTATED, - /** @stable ICU 63 */ - U_VO_TRANSFORMED_ROTATED, - /** @stable ICU 63 */ - U_VO_TRANSFORMED_UPRIGHT, - /** @stable ICU 63 */ - U_VO_UPRIGHT, -} UVerticalOrientation; - -/** + * Indic Positional Category constants. + * + * @see UCHAR_INDIC_POSITIONAL_CATEGORY + * @stable ICU 63 + */ +typedef enum UIndicPositionalCategory { + /* + * Note: UIndicPositionalCategory constants are parsed by preparseucd.py. + * It matches lines like + * U_INPC_<Unicode Indic_Positional_Category value name> + */ + + /** @stable ICU 63 */ + U_INPC_NA, + /** @stable ICU 63 */ + U_INPC_BOTTOM, + /** @stable ICU 63 */ + U_INPC_BOTTOM_AND_LEFT, + /** @stable ICU 63 */ + U_INPC_BOTTOM_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_LEFT, + /** @stable ICU 63 */ + U_INPC_LEFT_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_OVERSTRUCK, + /** @stable ICU 63 */ + U_INPC_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP, + /** @stable ICU 63 */ + U_INPC_TOP_AND_BOTTOM, + /** @stable ICU 63 */ + U_INPC_TOP_AND_BOTTOM_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_LEFT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_LEFT_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_TOP_AND_RIGHT, + /** @stable ICU 63 */ + U_INPC_VISUAL_ORDER_LEFT, + /** @stable ICU 66 */ + U_INPC_TOP_AND_BOTTOM_AND_LEFT, +} UIndicPositionalCategory; + +/** + * Indic Syllabic Category constants. + * + * @see UCHAR_INDIC_SYLLABIC_CATEGORY + * @stable ICU 63 + */ +typedef enum UIndicSyllabicCategory { + /* + * Note: UIndicSyllabicCategory constants are parsed by preparseucd.py. + * It matches lines like + * U_INSC_<Unicode Indic_Syllabic_Category value name> + */ + + /** @stable ICU 63 */ + U_INSC_OTHER, + /** @stable ICU 63 */ + U_INSC_AVAGRAHA, + /** @stable ICU 63 */ + U_INSC_BINDU, + /** @stable ICU 63 */ + U_INSC_BRAHMI_JOINING_NUMBER, + /** @stable ICU 63 */ + U_INSC_CANTILLATION_MARK, + /** @stable ICU 63 */ + U_INSC_CONSONANT, + /** @stable ICU 63 */ + U_INSC_CONSONANT_DEAD, + /** @stable ICU 63 */ + U_INSC_CONSONANT_FINAL, + /** @stable ICU 63 */ + U_INSC_CONSONANT_HEAD_LETTER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_INITIAL_POSTFIXED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_KILLER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_MEDIAL, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PLACEHOLDER, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PRECEDING_REPHA, + /** @stable ICU 63 */ + U_INSC_CONSONANT_PREFIXED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_SUBJOINED, + /** @stable ICU 63 */ + U_INSC_CONSONANT_SUCCEEDING_REPHA, + /** @stable ICU 63 */ + U_INSC_CONSONANT_WITH_STACKER, + /** @stable ICU 63 */ + U_INSC_GEMINATION_MARK, + /** @stable ICU 63 */ + U_INSC_INVISIBLE_STACKER, + /** @stable ICU 63 */ + U_INSC_JOINER, + /** @stable ICU 63 */ + U_INSC_MODIFYING_LETTER, + /** @stable ICU 63 */ + U_INSC_NON_JOINER, + /** @stable ICU 63 */ + U_INSC_NUKTA, + /** @stable ICU 63 */ + U_INSC_NUMBER, + /** @stable ICU 63 */ + U_INSC_NUMBER_JOINER, + /** @stable ICU 63 */ + U_INSC_PURE_KILLER, + /** @stable ICU 63 */ + U_INSC_REGISTER_SHIFTER, + /** @stable ICU 63 */ + U_INSC_SYLLABLE_MODIFIER, + /** @stable ICU 63 */ + U_INSC_TONE_LETTER, + /** @stable ICU 63 */ + U_INSC_TONE_MARK, + /** @stable ICU 63 */ + U_INSC_VIRAMA, + /** @stable ICU 63 */ + U_INSC_VISARGA, + /** @stable ICU 63 */ + U_INSC_VOWEL, + /** @stable ICU 63 */ + U_INSC_VOWEL_DEPENDENT, + /** @stable ICU 63 */ + U_INSC_VOWEL_INDEPENDENT, +} UIndicSyllabicCategory; + +/** + * Vertical Orientation constants. + * + * @see UCHAR_VERTICAL_ORIENTATION + * @stable ICU 63 + */ +typedef enum UVerticalOrientation { + /* + * Note: UVerticalOrientation constants are parsed by preparseucd.py. + * It matches lines like + * U_VO_<Unicode Vertical_Orientation value name> + */ + + /** @stable ICU 63 */ + U_VO_ROTATED, + /** @stable ICU 63 */ + U_VO_TRANSFORMED_ROTATED, + /** @stable ICU 63 */ + U_VO_TRANSFORMED_UPRIGHT, + /** @stable ICU 63 */ + U_VO_UPRIGHT, +} UVerticalOrientation; + +/** * Check a binary Unicode property for a code point. * * Unicode, especially in version 3.2, defines many more properties than the @@ -2591,7 +2591,7 @@ typedef enum UVerticalOrientation { * does not have data for the property at all, or not for this code point. * * @see UProperty - * @see u_getBinaryPropertySet + * @see u_getBinaryPropertySet * @see u_getIntPropertyValue * @see u_getUnicodeVersion * @stable ICU 2.1 @@ -2600,24 +2600,24 @@ U_STABLE UBool U_EXPORT2 u_hasBinaryProperty(UChar32 c, UProperty which); /** - * Returns a frozen USet for a binary property. - * The library retains ownership over the returned object. - * Sets an error code if the property number is not one for a binary property. - * - * The returned set contains all code points for which the property is true. - * - * @param property UCHAR_BINARY_START..UCHAR_BINARY_LIMIT-1 - * @param pErrorCode an in/out ICU UErrorCode - * @return the property as a set - * @see UProperty - * @see u_hasBinaryProperty - * @see Unicode::fromUSet - * @stable ICU 63 - */ -U_CAPI const USet * U_EXPORT2 -u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode); - -/** + * Returns a frozen USet for a binary property. + * The library retains ownership over the returned object. + * Sets an error code if the property number is not one for a binary property. + * + * The returned set contains all code points for which the property is true. + * + * @param property UCHAR_BINARY_START..UCHAR_BINARY_LIMIT-1 + * @param pErrorCode an in/out ICU UErrorCode + * @return the property as a set + * @see UProperty + * @see u_hasBinaryProperty + * @see Unicode::fromUSet + * @stable ICU 63 + */ +U_CAPI const USet * U_EXPORT2 +u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode); + +/** * Check if a code point has the Alphabetic Unicode property. * Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC). * This is different from u_isalpha! @@ -2717,7 +2717,7 @@ u_isUWhiteSpace(UChar32 c); * @see u_hasBinaryProperty * @see u_getIntPropertyMinValue * @see u_getIntPropertyMaxValue - * @see u_getIntPropertyMap + * @see u_getIntPropertyMap * @see u_getUnicodeVersion * @stable ICU 2.2 */ @@ -2775,24 +2775,24 @@ U_STABLE int32_t U_EXPORT2 u_getIntPropertyMaxValue(UProperty which); /** - * Returns an immutable UCPMap for an enumerated/catalog/int-valued property. - * The library retains ownership over the returned object. - * Sets an error code if the property number is not one for an "int property". - * - * The returned object maps all Unicode code points to their values for that property. - * For documentation of the integer values see u_getIntPropertyValue(). - * - * @param property UCHAR_INT_START..UCHAR_INT_LIMIT-1 - * @param pErrorCode an in/out ICU UErrorCode - * @return the property as a map - * @see UProperty - * @see u_getIntPropertyValue - * @stable ICU 63 - */ -U_CAPI const UCPMap * U_EXPORT2 -u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode); - -/** + * Returns an immutable UCPMap for an enumerated/catalog/int-valued property. + * The library retains ownership over the returned object. + * Sets an error code if the property number is not one for an "int property". + * + * The returned object maps all Unicode code points to their values for that property. + * For documentation of the integer values see u_getIntPropertyValue(). + * + * @param property UCHAR_INT_START..UCHAR_INT_LIMIT-1 + * @param pErrorCode an in/out ICU UErrorCode + * @return the property as a map + * @see UProperty + * @see u_getIntPropertyValue + * @stable ICU 63 + */ +U_CAPI const UCPMap * U_EXPORT2 +u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode); + +/** * Get the numeric value for a Unicode code point as defined in the * Unicode Character Database. * @@ -3028,7 +3028,7 @@ u_isgraph(UChar32 c); * * same as * - * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators). + * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators). * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. @@ -3210,14 +3210,14 @@ U_STABLE UBool U_EXPORT2 u_isprint(UChar32 c); /** - * Non-standard: Determines whether the specified code point is a base character. + * Non-standard: Determines whether the specified code point is a base character. * True for general categories "L" (letters), "N" (numbers), * "Mc" (spacing combining marks), and "Me" (enclosing marks). * - * Note that this is different from the Unicode Standard definition in - * chapter 3.6, conformance clause D51 “Base character”, - * which defines base characters as the code points with general categories - * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs). + * Note that this is different from the Unicode Standard definition in + * chapter 3.6, conformance clause D51 “Base character”, + * which defines base characters as the code points with general categories + * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs). * * @param c the code point to be tested * @return TRUE if the code point is a base character according to this function diff --git a/contrib/libs/icu/include/unicode/ucharstrie.h b/contrib/libs/icu/include/unicode/ucharstrie.h index d5729d944e..8a45c44917 100644 --- a/contrib/libs/icu/include/unicode/ucharstrie.h +++ b/contrib/libs/icu/include/unicode/ucharstrie.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ucharstrie.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -24,9 +24,9 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/unistr.h" #include "unicode/uobject.h" #include "unicode/ustringtrie.h" @@ -39,7 +39,7 @@ class UVector32; /** * Light-weight, non-const reader class for a UCharsTrie. - * Traverses a char16_t-serialized data structure with minimal state, + * Traverses a char16_t-serialized data structure with minimal state, * for mapping strings (16-bit-unit sequences) to non-negative integer values. * * This class owns the serialized trie data only if it was constructed by @@ -55,18 +55,18 @@ public: /** * Constructs a UCharsTrie reader instance. * - * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder, - * starting with the first char16_t of that sequence. - * The UCharsTrie object will not read more char16_ts than + * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder, + * starting with the first char16_t of that sequence. + * The UCharsTrie object will not read more char16_ts than * the UCharsTrieBuilder generated in the corresponding build() call. * * The array is not copied/cloned and must not be modified while * the UCharsTrie object is in use. * - * @param trieUChars The char16_t array that contains the serialized trie. + * @param trieUChars The char16_t array that contains the serialized trie. * @stable ICU 4.8 */ - UCharsTrie(ConstChar16Ptr trieUChars) + UCharsTrie(ConstChar16Ptr trieUChars) : ownedArray_(NULL), uchars_(trieUChars), pos_(uchars_), remainingMatchLength_(-1) {} @@ -78,7 +78,7 @@ public: /** * Copy constructor, copies the other trie reader object and its state, - * but not the char16_t array which will be shared. (Shallow copy.) + * but not the char16_t array which will be shared. (Shallow copy.) * @param other Another UCharsTrie object. * @stable ICU 4.8 */ @@ -97,42 +97,42 @@ public: return *this; } -#ifndef U_HIDE_DRAFT_API - /** - * Returns the state of this trie as a 64-bit integer. - * The state value is never 0. - * - * @return opaque state value - * @see resetToState64 - * @draft ICU 65 - */ - uint64_t getState64() const { - return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) | - (uint64_t)(pos_ - uchars_); - } - - /** - * Resets this trie to the saved state. - * Unlike resetToState(State), the 64-bit state value - * must be from getState64() from the same trie object or - * from one initialized the exact same way. - * Because of no validation, this method is faster. - * - * @param state The opaque trie state value from getState64(). - * @return *this - * @see getState64 - * @see resetToState - * @see reset - * @draft ICU 65 - */ - UCharsTrie &resetToState64(uint64_t state) { - remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2; - pos_ = uchars_ + (state & kState64PosMask); - return *this; - } -#endif /* U_HIDE_DRAFT_API */ - +#ifndef U_HIDE_DRAFT_API /** + * Returns the state of this trie as a 64-bit integer. + * The state value is never 0. + * + * @return opaque state value + * @see resetToState64 + * @draft ICU 65 + */ + uint64_t getState64() const { + return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) | + (uint64_t)(pos_ - uchars_); + } + + /** + * Resets this trie to the saved state. + * Unlike resetToState(State), the 64-bit state value + * must be from getState64() from the same trie object or + * from one initialized the exact same way. + * Because of no validation, this method is faster. + * + * @param state The opaque trie state value from getState64(). + * @return *this + * @see getState64 + * @see resetToState + * @see reset + * @draft ICU 65 + */ + UCharsTrie &resetToState64(uint64_t state) { + remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2; + pos_ = uchars_ + (state & kState64PosMask); + return *this; + } +#endif /* U_HIDE_DRAFT_API */ + + /** * UCharsTrie state object, for saving a trie's current state * and resetting the trie back to this state later. * @stable ICU 4.8 @@ -147,8 +147,8 @@ public: private: friend class UCharsTrie; - const char16_t *uchars; - const char16_t *pos; + const char16_t *uchars; + const char16_t *pos; int32_t remainingMatchLength; }; @@ -186,14 +186,14 @@ public: /** * Determines whether the string so far matches, whether it has a value, - * and whether another input char16_t can continue a matching string. + * and whether another input char16_t can continue a matching string. * @return The match/value Result. * @stable ICU 4.8 */ UStringTrieResult current() const; /** - * Traverses the trie from the initial state for this input char16_t. + * Traverses the trie from the initial state for this input char16_t. * Equivalent to reset().next(uchar). * @param uchar Input char value. Values below 0 and above 0xffff will never match. * @return The match/value Result. @@ -215,7 +215,7 @@ public: UStringTrieResult firstForCodePoint(UChar32 cp); /** - * Traverses the trie from the current state for this input char16_t. + * Traverses the trie from the current state for this input char16_t. * @param uchar Input char value. Values below 0 and above 0xffff will never match. * @return The match/value Result. * @stable ICU 4.8 @@ -246,7 +246,7 @@ public: * @return The match/value Result. * @stable ICU 4.8 */ - UStringTrieResult next(ConstChar16Ptr s, int32_t length); + UStringTrieResult next(ConstChar16Ptr s, int32_t length); /** * Returns a matching string's value if called immediately after @@ -258,7 +258,7 @@ public: * @stable ICU 4.8 */ inline int32_t getValue() const { - const char16_t *pos=pos_; + const char16_t *pos=pos_; int32_t leadUnit=*pos++; // U_ASSERT(leadUnit>=kMinValueLead); return leadUnit&kValueIsFinal ? @@ -275,16 +275,16 @@ public: * @stable ICU 4.8 */ inline UBool hasUniqueValue(int32_t &uniqueValue) const { - const char16_t *pos=pos_; + const char16_t *pos=pos_; // Skip the rest of a pending linear-match node. return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); } /** - * Finds each char16_t which continues the string from the current state. - * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. - * @param out Each next char16_t is appended to this object. - * @return the number of char16_ts which continue the string from here + * Finds each char16_t which continues the string from the current state. + * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. + * @param out Each next char16_t is appended to this object. + * @return the number of char16_ts which continue the string from here * @stable ICU 4.8 */ int32_t getNextUChars(Appendable &out) const; @@ -296,8 +296,8 @@ public: class U_COMMON_API Iterator : public UMemory { public: /** - * Iterates from the root of a char16_t-serialized UCharsTrie. - * @param trieUChars The trie char16_ts. + * Iterates from the root of a char16_t-serialized UCharsTrie. + * @param trieUChars The trie char16_ts. * @param maxStringLength If 0, the iterator returns full strings. * Otherwise, the iterator returns strings with this maximum length. * @param errorCode Standard ICU error code. Its input value must @@ -306,7 +306,7 @@ public: * function chaining. (See User Guide for details.) * @stable ICU 4.8 */ - Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode); + Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode); /** * Iterates from the current state of the specified UCharsTrie. @@ -374,11 +374,11 @@ public: return TRUE; } - const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); + const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); - const char16_t *uchars_; - const char16_t *pos_; - const char16_t *initialPos_; + const char16_t *uchars_; + const char16_t *pos_; + const char16_t *initialPos_; int32_t remainingMatchLength_; int32_t initialRemainingMatchLength_; UBool skipValue_; // Skip intermediate value which was already delivered. @@ -406,7 +406,7 @@ private: * this constructor adopts the builder's array. * This constructor is only called by the builder. */ - UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars) + UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars) : ownedArray_(adoptUChars), uchars_(trieUChars), pos_(uchars_), remainingMatchLength_(-1) {} @@ -419,7 +419,7 @@ private: // Reads a compact 32-bit integer. // pos is already after the leadUnit, and the lead unit has bit 15 reset. - static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) { + static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) { int32_t value; if(leadUnit<kMinTwoUnitValueLead) { value=leadUnit; @@ -430,7 +430,7 @@ private: } return value; } - static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) { + static inline const char16_t *skipValue(const char16_t *pos, int32_t leadUnit) { if(leadUnit>=kMinTwoUnitValueLead) { if(leadUnit<kThreeUnitValueLead) { ++pos; @@ -440,12 +440,12 @@ private: } return pos; } - static inline const char16_t *skipValue(const char16_t *pos) { + static inline const char16_t *skipValue(const char16_t *pos) { int32_t leadUnit=*pos++; return skipValue(pos, leadUnit&0x7fff); } - static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) { + static inline int32_t readNodeValue(const char16_t *pos, int32_t leadUnit) { // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal); int32_t value; if(leadUnit<kMinTwoUnitNodeValueLead) { @@ -457,7 +457,7 @@ private: } return value; } - static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) { + static inline const char16_t *skipNodeValue(const char16_t *pos, int32_t leadUnit) { // U_ASSERT(kMinValueLead<=leadUnit && leadUnit<kValueIsFinal); if(leadUnit>=kMinTwoUnitNodeValueLead) { if(leadUnit<kThreeUnitNodeValueLead) { @@ -469,7 +469,7 @@ private: return pos; } - static inline const char16_t *jumpByDelta(const char16_t *pos) { + static inline const char16_t *jumpByDelta(const char16_t *pos) { int32_t delta=*pos++; if(delta>=kMinTwoUnitDeltaLead) { if(delta==kThreeUnitDeltaLead) { @@ -482,7 +482,7 @@ private: return pos+delta; } - static const char16_t *skipDelta(const char16_t *pos) { + static const char16_t *skipDelta(const char16_t *pos) { int32_t delta=*pos++; if(delta>=kMinTwoUnitDeltaLead) { if(delta==kThreeUnitDeltaLead) { @@ -499,28 +499,28 @@ private: } // Handles a branch node for both next(uchar) and next(string). - UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar); + UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar); // Requires remainingLength_<0. - UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar); + UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar); // Helper functions for hasUniqueValue(). // Recursively finds a unique value (or whether there is not a unique one) // from a branch. - static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length, + static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length, UBool haveUniqueValue, int32_t &uniqueValue); // Recursively finds a unique value (or whether there is not a unique one) // starting from a position on a node lead unit. - static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue); + static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue); // Helper functions for getNextUChars(). // getNextUChars() when pos is on a branch node. - static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out); + static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out); // UCharsTrie data structure // - // The trie consists of a series of char16_t-serialized nodes for incremental - // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer) + // The trie consists of a series of char16_t-serialized nodes for incremental + // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer) // The root node is at the beginning of the trie data. // // Types of nodes are distinguished by their node lead unit ranges. @@ -529,9 +529,9 @@ private: // // Node types: // - Final-value node: Stores a 32-bit integer in a compact, variable-length format. - // The value is for the string/char16_t sequence so far. + // The value is for the string/char16_t sequence so far. // - Match node, optionally with an intermediate value in a different compact format. - // The value, if present, is for the string/char16_t sequence so far. + // The value, if present, is for the string/char16_t sequence so far. // // Aside from the value, which uses the node lead unit's high bits: // @@ -598,28 +598,28 @@ private: static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff - // For getState64(): - // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 - // so we need at least 5 bits for that. - // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. - static constexpr int32_t kState64RemainingShift = 59; - static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; - - char16_t *ownedArray_; + // For getState64(): + // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2 + // so we need at least 5 bits for that. + // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength. + static constexpr int32_t kState64RemainingShift = 59; + static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1; + char16_t *ownedArray_; + // Fixed value referencing the UCharsTrie words. - const char16_t *uchars_; + const char16_t *uchars_; // Iterator variables. // Pointer to next trie unit to read. NULL if no more matches. - const char16_t *pos_; + const char16_t *pos_; // Remaining length of a linear-match node, minus 1. Negative if not in such a node. int32_t remainingMatchLength_; }; U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __UCHARSTRIE_H__ diff --git a/contrib/libs/icu/include/unicode/ucharstriebuilder.h b/contrib/libs/icu/include/unicode/ucharstriebuilder.h index 540dcc047f..b8c090194a 100644 --- a/contrib/libs/icu/include/unicode/ucharstriebuilder.h +++ b/contrib/libs/icu/include/unicode/ucharstriebuilder.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ucharstriebuilder.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -18,9 +18,9 @@ #define __UCHARSTRIEBUILDER_H__ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/stringtriebuilder.h" #include "unicode/ucharstrie.h" #include "unicode/unistr.h" @@ -92,21 +92,21 @@ public: UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); /** - * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. + * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. * Once built, no further data can be add()ed until clear() is called. * * A UCharsTrie cannot be empty. At least one (string, value) pair * must have been add()ed. * * Multiple calls to buildUnicodeString() set the UnicodeStrings to the - * builder's same char16_t array, without rebuilding. + * builder's same char16_t array, without rebuilding. * If buildUnicodeString() is called after build(), the trie will be * re-serialized into a new array. * If build() is called after buildUnicodeString(), the trie object will become * the owner of the previously returned array. * After clear() has been called, a new array will be used as well. * @param buildOption Build option, see UStringTrieBuildOption. - * @param result A UnicodeString which will be set to the char16_t-serialized + * @param result A UnicodeString which will be set to the char16_t-serialized * UCharsTrie for the add()ed data. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns @@ -138,14 +138,14 @@ private: void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode); virtual int32_t getElementStringLength(int32_t i) const; - virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; virtual int32_t getElementValue(int32_t i) const; virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const; virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const; virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; - virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; virtual UBool matchNodesCanHaveValues() const { return TRUE; } @@ -155,11 +155,11 @@ private: class UCTLinearMatchNode : public LinearMatchNode { public: - UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); + UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); virtual UBool operator==(const Node &other) const; virtual void write(StringTrieBuilder &builder); private: - const char16_t *s; + const char16_t *s; }; virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, @@ -167,7 +167,7 @@ private: UBool ensureCapacity(int32_t length); virtual int32_t write(int32_t unit); - int32_t write(const char16_t *s, int32_t length); + int32_t write(const char16_t *s, int32_t length); virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length); virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); @@ -178,15 +178,15 @@ private: int32_t elementsCapacity; int32_t elementsLength; - // char16_t serialization of the trie. + // char16_t serialization of the trie. // Grows from the back: ucharsLength measures from the end of the buffer! - char16_t *uchars; + char16_t *uchars; int32_t ucharsCapacity; int32_t ucharsLength; }; U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // __UCHARSTRIEBUILDER_H__ diff --git a/contrib/libs/icu/include/unicode/uchriter.h b/contrib/libs/icu/include/unicode/uchriter.h index a485259b80..883eb5f0e1 100644 --- a/contrib/libs/icu/include/unicode/uchriter.h +++ b/contrib/libs/icu/include/unicode/uchriter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -11,25 +11,25 @@ #define UCHRITER_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/chariter.h" /** * \file - * \brief C++ API: char16_t Character Iterator + * \brief C++ API: char16_t Character Iterator */ U_NAMESPACE_BEGIN /** * A concrete subclass of CharacterIterator that iterates over the - * characters (code units or code points) in a char16_t array. + * characters (code units or code points) in a char16_t array. * It's possible not only to create an - * iterator that iterates over an entire char16_t array, but also to - * create one that iterates over only a subrange of a char16_t array - * (iterators over different subranges of the same char16_t array don't + * iterator that iterates over an entire char16_t array, but also to + * create one that iterates over only a subrange of a char16_t array + * (iterators over different subranges of the same char16_t array don't * compare equal). * @see CharacterIterator * @see ForwardCharacterIterator @@ -38,34 +38,34 @@ U_NAMESPACE_BEGIN class U_COMMON_API UCharCharacterIterator : public CharacterIterator { public: /** - * Create an iterator over the char16_t array referred to by "textPtr". + * Create an iterator over the char16_t array referred to by "textPtr". * The iteration range is 0 to <code>length-1</code>. * text is only aliased, not adopted (the * destructor will not delete it). - * @param textPtr The char16_t array to be iterated over - * @param length The length of the char16_t array + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array * @stable ICU 2.0 */ - UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length); + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length); /** - * Create an iterator over the char16_t array referred to by "textPtr". + * Create an iterator over the char16_t array referred to by "textPtr". * The iteration range is 0 to <code>length-1</code>. * text is only aliased, not adopted (the * destructor will not delete it). * The starting * position is specified by "position". If "position" is outside the valid * iteration range, the behavior of this object is undefined. - * @param textPtr The char16_t array to be iteratd over - * @param length The length of the char16_t array + * @param textPtr The char16_t array to be iteratd over + * @param length The length of the char16_t array * @param position The starting position of the iteration * @stable ICU 2.0 */ - UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, int32_t position); /** - * Create an iterator over the char16_t array referred to by "textPtr". + * Create an iterator over the char16_t array referred to by "textPtr". * The iteration range is 0 to <code>end-1</code>. * text is only aliased, not adopted (the * destructor will not delete it). @@ -73,14 +73,14 @@ public: * position is specified by "position". If begin and end do not * form a valid iteration range or "position" is outside the valid * iteration range, the behavior of this object is undefined. - * @param textPtr The char16_t array to be iterated over - * @param length The length of the char16_t array + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array * @param textBegin The begin position of the iteration range * @param textEnd The end position of the iteration range * @param position The starting position of the iteration * @stable ICU 2.0 */ - UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, int32_t textBegin, int32_t textEnd, int32_t position); @@ -135,7 +135,7 @@ public: * @return the CharacterIterator newly created * @stable ICU 2.0 */ - virtual UCharCharacterIterator* clone() const; + virtual UCharCharacterIterator* clone() const; /** * Sets the iterator to refer to the first code unit in its @@ -144,7 +144,7 @@ public: * @return the first code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t first(void); + virtual char16_t first(void); /** * Sets the iterator to refer to the first code unit in its @@ -154,7 +154,7 @@ public: * @return the first code unit in its iteration range * @stable ICU 2.0 */ - virtual char16_t firstPostInc(void); + virtual char16_t firstPostInc(void); /** * Sets the iterator to refer to the first code point in its @@ -184,7 +184,7 @@ public: * @return the last code unit in its iteration range. * @stable ICU 2.0 */ - virtual char16_t last(void); + virtual char16_t last(void); /** * Sets the iterator to refer to the last code point in its @@ -203,7 +203,7 @@ public: * @return the code unit * @stable ICU 2.0 */ - virtual char16_t setIndex(int32_t position); + virtual char16_t setIndex(int32_t position); /** * Sets the iterator to refer to the beginning of the code point @@ -223,7 +223,7 @@ public: * @return the code unit the iterator currently refers to. * @stable ICU 2.0 */ - virtual char16_t current(void) const; + virtual char16_t current(void) const; /** * Returns the code point the iterator currently refers to. @@ -239,7 +239,7 @@ public: * @return the next code unit in the iteration range. * @stable ICU 2.0 */ - virtual char16_t next(void); + virtual char16_t next(void); /** * Gets the current code unit for returning and advances to the next code unit @@ -249,7 +249,7 @@ public: * @return the current code unit. * @stable ICU 2.0 */ - virtual char16_t nextPostInc(void); + virtual char16_t nextPostInc(void); /** * Advances to the next code point in the iteration range (toward @@ -291,7 +291,7 @@ public: * @return the previous code unit in the iteration range. * @stable ICU 2.0 */ - virtual char16_t previous(void); + virtual char16_t previous(void); /** * Advances to the previous code point in the iteration range (toward @@ -337,20 +337,20 @@ public: * @return the new position * @stable ICU 2.0 */ -#ifdef move32 - // One of the system headers right now is sometimes defining a conflicting macro we don't use -#undef move32 -#endif +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif virtual int32_t move32(int32_t delta, EOrigin origin); /** * Sets the iterator to iterate over a new range of text * @stable ICU 2.0 */ - void setText(ConstChar16Ptr newText, int32_t newTextLength); + void setText(ConstChar16Ptr newText, int32_t newTextLength); /** - * Copies the char16_t array under iteration into the UnicodeString + * Copies the char16_t array under iteration into the UnicodeString * referred to by "result". Even if this iterator iterates across * only a part of this string, the whole string is copied. * @param result Receives a copy of the text under iteration. @@ -382,12 +382,12 @@ protected: * Protected member text * @stable ICU 2.0 */ - const char16_t* text; + const char16_t* text; }; U_NAMESPACE_END - -#endif /* U_SHOW_CPLUSPLUS_API */ - + +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/uclean.h b/contrib/libs/icu/include/unicode/uclean.h index 7cef6dba68..322ec9dbd9 100644 --- a/contrib/libs/icu/include/unicode/uclean.h +++ b/contrib/libs/icu/include/unicode/uclean.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ****************************************************************************** * file name: uclean.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -70,7 +70,7 @@ u_init(UErrorCode *status); * This has the effect of restoring ICU to its initial condition, before * any of these override functions were installed. Refer to * u_setMemoryFunctions(), u_setMutexFunctions and - * utrace_setFunctions(). If ICU is to be reinitialized after + * utrace_setFunctions(). If ICU is to be reinitialized after * calling u_cleanup(), these runtime override functions will need to * be set up again if they are still required. * <p> @@ -101,10 +101,10 @@ u_init(UErrorCode *status); U_STABLE void U_EXPORT2 u_cleanup(void); -U_CDECL_BEGIN +U_CDECL_BEGIN /** * Pointer type for a user supplied memory allocation function. - * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param context user supplied value, obtained from u_setMemoryFunctions(). * @param size The number of bytes to be allocated * @return Pointer to the newly allocated memory, or NULL if the allocation failed. * @stable ICU 2.8 @@ -113,7 +113,7 @@ U_CDECL_BEGIN typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); /** * Pointer type for a user supplied memory re-allocation function. - * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param context user supplied value, obtained from u_setMemoryFunctions(). * @param size The number of bytes to be allocated * @return Pointer to the newly allocated memory, or NULL if the allocation failed. * @stable ICU 2.8 @@ -123,7 +123,7 @@ typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t si /** * Pointer type for a user supplied memory free function. Behavior should be * similar the standard C library free(). - * @param context user supplied value, obtained from u_setMemoryFunctions(). + * @param context user supplied value, obtained from u_setMemoryFunctions(). * @param mem Pointer to the memory block to be resized * @param size The new size for the block * @return Pointer to the resized memory block, or NULL if the resizing failed. @@ -149,10 +149,10 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); * @system */ U_STABLE void U_EXPORT2 -u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, +u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, UErrorCode *status); -U_CDECL_END +U_CDECL_END #ifndef U_HIDE_DEPRECATED_API /********************************************************************************* @@ -173,14 +173,14 @@ U_CDECL_END */ typedef void *UMTX; -U_CDECL_BEGIN +U_CDECL_BEGIN /** * Function Pointer type for a user supplied mutex initialization function. * The user-supplied function will be called by ICU whenever ICU needs to create a * new mutex. The function implementation should create a mutex, and store a pointer * to something that uniquely identifies the mutex into the UMTX that is supplied - * as a parameter. - * @param context user supplied value, obtained from u_setMutexFunctions(). + * as a parameter. + * @param context user supplied value, obtained from u_setMutexFunctions(). * @param mutex Receives a pointer that identifies the new mutex. * The mutex init function must set the UMTX to a non-null value. * Subsequent calls by ICU to lock, unlock, or destroy a mutex will @@ -197,13 +197,13 @@ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCod * Function Pointer type for a user supplied mutex functions. * One of the user-supplied functions with this signature will be called by ICU * whenever ICU needs to lock, unlock, or destroy a mutex. - * @param context user supplied value, obtained from u_setMutexFunctions(). + * @param context user supplied value, obtained from u_setMutexFunctions(). * @param mutex specify the mutex on which to operate. * @deprecated ICU 52. This function is no longer supported. * @system */ typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); -U_CDECL_END +U_CDECL_END /** * Set the functions that ICU will use for mutex operations @@ -229,7 +229,7 @@ u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtx /** * Pointer type for a user supplied atomic increment or decrement function. - * @param context user supplied value, obtained from u_setAtomicIncDecFunctions(). + * @param context user supplied value, obtained from u_setAtomicIncDecFunctions(). * @param p Pointer to a 32 bit int to be incremented or decremented * @return The value of the variable after the inc or dec operation. * @deprecated ICU 52. This function is no longer supported. diff --git a/contrib/libs/icu/include/unicode/ucnv.h b/contrib/libs/icu/include/unicode/ucnv.h index ec7c5f350b..4b69f7edcb 100644 --- a/contrib/libs/icu/include/unicode/ucnv.h +++ b/contrib/libs/icu/include/unicode/ucnv.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -29,7 +29,7 @@ * converter, you can get its properties, set options, convert your data and * close the converter.</p> * - * <p>Since many software programs recognize different converter names for + * <p>Since many software programs recognize different converter names for * different types of converters, there are other functions in this API to * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the @@ -53,17 +53,17 @@ #include "unicode/uenum.h" #include "unicode/localpointer.h" -#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) - -#define USET_DEFINED +#if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN) +#define USET_DEFINED + /** - * USet is the C API type corresponding to C++ class UnicodeSet. - * It is forward-declared here to avoid including unicode/uset.h file if related + * USet is the C API type corresponding to C++ class UnicodeSet. + * It is forward-declared here to avoid including unicode/uset.h file if related * conversion APIs are not used. * * @see ucnv_getUnicodeSet - * @stable ICU 2.4 + * @stable ICU 2.4 */ typedef struct USet USet; @@ -183,7 +183,7 @@ typedef enum { /** * Function pointer for error callback in the codepage to unicode direction. - * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason). + * Called when an error has occurred in conversion to unicode, or on open/close of the callback (see reason). * @param context Pointer to the callback's private data * @param args Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence @@ -206,7 +206,7 @@ typedef void (U_EXPORT2 *UConverterToUCallback) ( /** * Function pointer for error callback in the unicode to codepage direction. - * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason). + * Called when an error has occurred in conversion from unicode, or on open/close of the callback (see reason). * @param context Pointer to the callback's private data * @param args Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence @@ -352,7 +352,7 @@ ucnv_compareNames(const char *name1, const char *name2); * ucnv_getAlias for a complete list that is available. * If this parameter is NULL, the default converter will be used. * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT> - * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred + * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred * @see ucnv_openU * @see ucnv_openCCSID * @see ucnv_getAvailableName @@ -385,7 +385,7 @@ ucnv_open(const char *converterName, UErrorCode *err); * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, * U_FILE_ACCESS_ERROR</TT> * @return the created Unicode converter object, or <TT>NULL</TT> if an - * error occurred + * error occurred * @see ucnv_open * @see ucnv_openCCSID * @see ucnv_close @@ -451,7 +451,7 @@ ucnv_openU(const UChar *name, * @param platform the platform in which the codepage number exists * @param err error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT> * @return the created Unicode converter object, or <TT>NULL</TT> if an error - * occurred. + * occurred. * @see ucnv_open * @see ucnv_openU * @see ucnv_close @@ -488,7 +488,7 @@ ucnv_openCCSID(int32_t codepage, * @param packageName name of the package (equivalent to 'path' in udata_open() call) * @param converterName name of the data item to be used, without suffix. * @param err outgoing error status <TT>U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR</TT> - * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred + * @return the created Unicode converter object, or <TT>NULL</TT> if an error occurred * @see udata_open * @see ucnv_open * @see ucnv_safeClone @@ -595,7 +595,7 @@ U_NAMESPACE_END * stateful, then subChars will be an empty string. * * @param converter the Unicode converter - * @param subChars the substitution characters + * @param subChars the substitution characters * @param len on input the capacity of subChars, on output the number * of bytes copied to it * @param err the outgoing error status code. @@ -831,7 +831,7 @@ ucnv_getMinCharSize(const UConverter *converter); * name will be filled in. * * @param converter the Unicode converter. - * @param displayLocale is the specific Locale we want to localized for + * @param displayLocale is the specific Locale we want to localized for * @param displayName user provided buffer to be filled in * @param displayNameCapacity size of displayName Buffer * @param err error status code @@ -876,7 +876,7 @@ ucnv_getName(const UConverter *converter, UErrorCode *err); * * @param converter the Unicode converter * @param err the error status code. - * @return If any error occurs, -1 will be returned otherwise, the codepage number + * @return If any error occurs, -1 will be returned otherwise, the codepage number * will be returned * @see ucnv_openCCSID * @see ucnv_getPlatform diff --git a/contrib/libs/icu/include/unicode/ucnv_cb.h b/contrib/libs/icu/include/unicode/ucnv_cb.h index 14169ed61c..c59963d4be 100644 --- a/contrib/libs/icu/include/unicode/ucnv_cb.h +++ b/contrib/libs/icu/include/unicode/ucnv_cb.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** diff --git a/contrib/libs/icu/include/unicode/ucnv_err.h b/contrib/libs/icu/include/unicode/ucnv_err.h index d234710a8b..55511a6838 100644 --- a/contrib/libs/icu/include/unicode/ucnv_err.h +++ b/contrib/libs/icu/include/unicode/ucnv_err.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -119,19 +119,19 @@ typedef struct UConverter UConverter; #define UCNV_ESCAPE_JAVA "J" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) - * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX) + * TO_U_CALLBACK_ESCAPE option to escape the character value according to C (\\xXXXX) * @stable ICU 2.0 */ #define UCNV_ESCAPE_C "C" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly - * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly * @stable ICU 2.0 */ #define UCNV_ESCAPE_XML_DEC "D" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly - * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly * @stable ICU 2.0 */ #define UCNV_ESCAPE_XML_HEX "X" @@ -171,7 +171,7 @@ typedef enum { code points. The error code U_INVALID_CHAR_FOUND will be set. */ UCNV_RESET = 3, /**< The callback is called with this reason when a - 'reset' has occurred. Callback should reset all + 'reset' has occurred. Callback should reset all state. */ UCNV_CLOSE = 4, /**< Called when the converter is closed. The callback should release any allocated memory.*/ @@ -199,7 +199,7 @@ typedef struct { const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ - int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ } UConverterFromUnicodeArgs; @@ -215,7 +215,7 @@ typedef struct { const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ - int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that receives the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ } UConverterToUnicodeArgs; diff --git a/contrib/libs/icu/include/unicode/ucnvsel.h b/contrib/libs/icu/include/unicode/ucnvsel.h index d423845ceb..dbb56d47f8 100644 --- a/contrib/libs/icu/include/unicode/ucnvsel.h +++ b/contrib/libs/icu/include/unicode/ucnvsel.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/contrib/libs/icu/include/unicode/ucol.h b/contrib/libs/icu/include/unicode/ucol.h index 673af1c55a..1ce75f9b8b 100644 --- a/contrib/libs/icu/include/unicode/ucol.h +++ b/contrib/libs/icu/include/unicode/ucol.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -131,7 +131,7 @@ typedef enum { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UCOL_ATTRIBUTE_VALUE_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UColAttributeValue; /** @@ -204,7 +204,7 @@ typedef enum { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UCOL_REORDER_CODE_LIMIT = 0x1005 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UColReorderCode; /** @@ -342,15 +342,15 @@ typedef enum { */ UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2, - /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, - * it is needed for layout of RuleBasedCollator object. */ -#ifndef U_FORCE_HIDE_DEPRECATED_API + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of RuleBasedCollator object. */ +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * One more than the highest normal UColAttribute value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UCOL_ATTRIBUTE_COUNT -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API } UColAttribute; /** Options for retrieving the rule string @@ -1069,7 +1069,7 @@ typedef enum { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UCOL_BOUND_VALUE_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UColBoundMode; /** @@ -1151,7 +1151,7 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info); * The recommended way to achieve "merged" sorting is by * concatenating strings with U+FFFE between them. * The concatenation has the same sort order as the merged sort keys, - * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\\uFFFE' + str2). + * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\\uFFFE' + str2). * Using strings with U+FFFE may yield shorter sort keys. * * For details about Sort Key Features see @@ -1296,7 +1296,7 @@ U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCod * the top of one of the supported reordering groups, * and it must not be beyond the last of those groups. * See ucol_setMaxVariable(). - * @param coll collator to be set + * @param coll collator to be set * @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop * @param status error code * @see ucol_getVariableTop diff --git a/contrib/libs/icu/include/unicode/ucoleitr.h b/contrib/libs/icu/include/unicode/ucoleitr.h index 85ec8383d7..da92cbd82a 100644 --- a/contrib/libs/icu/include/unicode/ucoleitr.h +++ b/contrib/libs/icu/include/unicode/ucoleitr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -152,7 +152,7 @@ ucol_reset(UCollationElements *elems); * A single character may contain more than one collation element. * @param elems The UCollationElements containing the text. * @param status A pointer to a UErrorCode to receive any errors. - * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER + * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER * if an error has occured or if the end of string has been reached * @stable ICU 2.0 */ @@ -168,7 +168,7 @@ ucol_next(UCollationElements *elems, UErrorCode *status); * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack * buffer has been exhausted. * @return The previous collation elements ordering, otherwise returns - * UCOL_NULLORDER if an error has occured or if the start of string has + * UCOL_NULLORDER if an error has occured or if the start of string has * been reached. * @stable ICU 2.0 */ diff --git a/contrib/libs/icu/include/unicode/uconfig.h b/contrib/libs/icu/include/unicode/uconfig.h index bbc232d1ed..35204c2cd2 100644 --- a/contrib/libs/icu/include/unicode/uconfig.h +++ b/contrib/libs/icu/include/unicode/uconfig.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ********************************************************************** * file name: uconfig.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -76,7 +76,7 @@ #endif /** - * Determines whether to enable auto cleanup of libraries. + * Determines whether to enable auto cleanup of libraries. * @internal */ #ifndef UCLN_NO_AUTO_CLEANUP @@ -183,7 +183,7 @@ */ #ifdef U_HAVE_LIB_SUFFIX /* Use the predefined value. */ -#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN) +#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_IN_DOXYGEN) # define U_HAVE_LIB_SUFFIX 1 #endif @@ -262,8 +262,8 @@ /** * \def UCONFIG_NO_CONVERSION - * ICU will not completely build (compiling the tools fails) with this - * switch turned on. + * ICU will not completely build (compiling the tools fails) with this + * switch turned on. * This switch turns off all converters. * * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1 @@ -321,9 +321,9 @@ */ #ifndef UCONFIG_NO_NORMALIZATION # define UCONFIG_NO_NORMALIZATION 0 -#endif - -#if UCONFIG_NO_NORMALIZATION +#endif + +#if UCONFIG_NO_NORMALIZATION /* common library */ /* ICU 50 CJK dictionary BreakIterator uses normalization */ # define UCONFIG_NO_BREAK_ITERATION 1 @@ -369,18 +369,18 @@ # define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL #endif -/** - * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API - * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines - * if the Windows platform APIs are used for LCID<->Locale Name conversions. - * Otherwise, only the built-in ICU tables are used. - * - * @internal ICU 64 - */ -#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API -# define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1 -#endif - +/** + * \def UCONFIG_USE_WINDOWS_LCID_MAPPING_API + * On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines + * if the Windows platform APIs are used for LCID<->Locale Name conversions. + * Otherwise, only the built-in ICU tables are used. + * + * @internal ICU 64 + */ +#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API +# define UCONFIG_USE_WINDOWS_LCID_MAPPING_API 1 +#endif + /* i18n library switches ---------------------------------------------------- */ /** @@ -453,4 +453,4 @@ # define UCONFIG_NO_FILTERED_BREAK_ITERATION 0 #endif -#endif // __UCONFIG_H__ +#endif // __UCONFIG_H__ diff --git a/contrib/libs/icu/include/unicode/ucpmap.h b/contrib/libs/icu/include/unicode/ucpmap.h index 31e1365cac..32c7ab66cd 100644 --- a/contrib/libs/icu/include/unicode/ucpmap.h +++ b/contrib/libs/icu/include/unicode/ucpmap.h @@ -1,159 +1,159 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// ucpmap.h -// created: 2018sep03 Markus W. Scherer - -#ifndef __UCPMAP_H__ -#define __UCPMAP_H__ - -#include "unicode/utypes.h" - -U_CDECL_BEGIN - -/** - * \file - * - * This file defines an abstract map from Unicode code points to integer values. - * - * @see UCPMap - * @see UCPTrie - * @see UMutableCPTrie - */ - -/** - * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values. - * - * @see UCPTrie - * @see UMutableCPTrie - * @stable ICU 63 - */ -typedef struct UCPMap UCPMap; - -/** - * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates. - * Most users should use UCPMAP_RANGE_NORMAL. - * - * @see ucpmap_getRange - * @see ucptrie_getRange - * @see umutablecptrie_getRange - * @stable ICU 63 - */ -enum UCPMapRangeOption { - /** - * ucpmap_getRange() enumerates all same-value ranges as stored in the map. - * Most users should use this option. - * @stable ICU 63 - */ - UCPMAP_RANGE_NORMAL, - /** - * ucpmap_getRange() enumerates all same-value ranges as stored in the map, - * except that lead surrogates (U+D800..U+DBFF) are treated as having the - * surrogateValue, which is passed to getRange() as a separate parameter. - * The surrogateValue is not transformed via filter(). - * See U_IS_LEAD(c). - * - * Most users should use UCPMAP_RANGE_NORMAL instead. - * - * This option is useful for maps that map surrogate code *units* to - * special values optimized for UTF-16 string processing - * or for special error behavior for unpaired surrogates, - * but those values are not to be associated with the lead surrogate code *points*. - * @stable ICU 63 - */ - UCPMAP_RANGE_FIXED_LEAD_SURROGATES, - /** - * ucpmap_getRange() enumerates all same-value ranges as stored in the map, - * except that all surrogates (U+D800..U+DFFF) are treated as having the - * surrogateValue, which is passed to getRange() as a separate parameter. - * The surrogateValue is not transformed via filter(). - * See U_IS_SURROGATE(c). - * - * Most users should use UCPMAP_RANGE_NORMAL instead. - * - * This option is useful for maps that map surrogate code *units* to - * special values optimized for UTF-16 string processing - * or for special error behavior for unpaired surrogates, - * but those values are not to be associated with the lead surrogate code *points*. - * @stable ICU 63 - */ - UCPMAP_RANGE_FIXED_ALL_SURROGATES -}; -#ifndef U_IN_DOXYGEN -typedef enum UCPMapRangeOption UCPMapRangeOption; -#endif - -/** - * Returns the value for a code point as stored in the map, with range checking. - * Returns an implementation-defined error value if c is not in the range 0..U+10FFFF. - * - * @param map the map - * @param c the code point - * @return the map value, - * or an implementation-defined error value if the code point is not in the range 0..U+10FFFF - * @stable ICU 63 - */ -U_CAPI uint32_t U_EXPORT2 -ucpmap_get(const UCPMap *map, UChar32 c); - -/** - * Callback function type: Modifies a map value. - * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange(). - * The modified value will be returned by the getRange function. - * - * Can be used to ignore some of the value bits, - * make a filter for one of several values, - * return a value index computed from the map value, etc. - * - * @param context an opaque pointer, as passed into the getRange function - * @param value a value from the map - * @return the modified value - * @stable ICU 63 - */ -typedef uint32_t U_CALLCONV -UCPMapValueFilter(const void *context, uint32_t value); - -/** - * Returns the last code point such that all those from start to there have the same value. - * Can be used to efficiently iterate over all same-value ranges in a map. - * (This is normally faster than iterating over code points and get()ting each value, - * but much slower than a data structure that stores ranges directly.) - * - * If the UCPMapValueFilter function pointer is not NULL, then - * the value to be delivered is passed through that function, and the return value is the end - * of the range where all values are modified to the same actual value. - * The value is unchanged if that function pointer is NULL. - * - * Example: - * \code - * UChar32 start = 0, end; - * uint32_t value; - * while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0, - * NULL, NULL, &value)) >= 0) { - * // Work with the range start..end and its value. - * start = end + 1; - * } - * \endcode - * - * @param map the map - * @param start range start - * @param option defines whether surrogates are treated normally, - * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL - * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL - * @param filter a pointer to a function that may modify the map data value, - * or NULL if the values from the map are to be used unmodified - * @param context an opaque pointer that is passed on to the filter function - * @param pValue if not NULL, receives the value that every code point start..end has; - * may have been modified by filter(context, map value) - * if that function pointer is not NULL - * @return the range end code point, or -1 if start is not a valid code point - * @stable ICU 63 - */ -U_CAPI UChar32 U_EXPORT2 -ucpmap_getRange(const UCPMap *map, UChar32 start, - UCPMapRangeOption option, uint32_t surrogateValue, - UCPMapValueFilter *filter, const void *context, uint32_t *pValue); - -U_CDECL_END - -#endif +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ucpmap.h +// created: 2018sep03 Markus W. Scherer + +#ifndef __UCPMAP_H__ +#define __UCPMAP_H__ + +#include "unicode/utypes.h" + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines an abstract map from Unicode code points to integer values. + * + * @see UCPMap + * @see UCPTrie + * @see UMutableCPTrie + */ + +/** + * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values. + * + * @see UCPTrie + * @see UMutableCPTrie + * @stable ICU 63 + */ +typedef struct UCPMap UCPMap; + +/** + * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates. + * Most users should use UCPMAP_RANGE_NORMAL. + * + * @see ucpmap_getRange + * @see ucptrie_getRange + * @see umutablecptrie_getRange + * @stable ICU 63 + */ +enum UCPMapRangeOption { + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map. + * Most users should use this option. + * @stable ICU 63 + */ + UCPMAP_RANGE_NORMAL, + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map, + * except that lead surrogates (U+D800..U+DBFF) are treated as having the + * surrogateValue, which is passed to getRange() as a separate parameter. + * The surrogateValue is not transformed via filter(). + * See U_IS_LEAD(c). + * + * Most users should use UCPMAP_RANGE_NORMAL instead. + * + * This option is useful for maps that map surrogate code *units* to + * special values optimized for UTF-16 string processing + * or for special error behavior for unpaired surrogates, + * but those values are not to be associated with the lead surrogate code *points*. + * @stable ICU 63 + */ + UCPMAP_RANGE_FIXED_LEAD_SURROGATES, + /** + * ucpmap_getRange() enumerates all same-value ranges as stored in the map, + * except that all surrogates (U+D800..U+DFFF) are treated as having the + * surrogateValue, which is passed to getRange() as a separate parameter. + * The surrogateValue is not transformed via filter(). + * See U_IS_SURROGATE(c). + * + * Most users should use UCPMAP_RANGE_NORMAL instead. + * + * This option is useful for maps that map surrogate code *units* to + * special values optimized for UTF-16 string processing + * or for special error behavior for unpaired surrogates, + * but those values are not to be associated with the lead surrogate code *points*. + * @stable ICU 63 + */ + UCPMAP_RANGE_FIXED_ALL_SURROGATES +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPMapRangeOption UCPMapRangeOption; +#endif + +/** + * Returns the value for a code point as stored in the map, with range checking. + * Returns an implementation-defined error value if c is not in the range 0..U+10FFFF. + * + * @param map the map + * @param c the code point + * @return the map value, + * or an implementation-defined error value if the code point is not in the range 0..U+10FFFF + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +ucpmap_get(const UCPMap *map, UChar32 c); + +/** + * Callback function type: Modifies a map value. + * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange(). + * The modified value will be returned by the getRange function. + * + * Can be used to ignore some of the value bits, + * make a filter for one of several values, + * return a value index computed from the map value, etc. + * + * @param context an opaque pointer, as passed into the getRange function + * @param value a value from the map + * @return the modified value + * @stable ICU 63 + */ +typedef uint32_t U_CALLCONV +UCPMapValueFilter(const void *context, uint32_t value); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a map. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * Example: + * \code + * UChar32 start = 0, end; + * uint32_t value; + * while ((end = ucpmap_getRange(map, start, UCPMAP_RANGE_NORMAL, 0, + * NULL, NULL, &value)) >= 0) { + * // Work with the range start..end and its value. + * start = end + 1; + * } + * \endcode + * + * @param map the map + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the map data value, + * or NULL if the values from the map are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, map value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +ucpmap_getRange(const UCPMap *map, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +U_CDECL_END + +#endif diff --git a/contrib/libs/icu/include/unicode/ucptrie.h b/contrib/libs/icu/include/unicode/ucptrie.h index be06a22792..43313bc768 100644 --- a/contrib/libs/icu/include/unicode/ucptrie.h +++ b/contrib/libs/icu/include/unicode/ucptrie.h @@ -1,644 +1,644 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// ucptrie.h (modified from utrie2.h) -// created: 2017dec29 Markus W. Scherer - -#ifndef __UCPTRIE_H__ -#define __UCPTRIE_H__ - -#include "unicode/utypes.h" - -#include "unicode/localpointer.h" -#include "unicode/ucpmap.h" -#include "unicode/utf8.h" - -U_CDECL_BEGIN - -/** - * \file - * - * This file defines an immutable Unicode code point trie. - * - * @see UCPTrie - * @see UMutableCPTrie - */ - -#ifndef U_IN_DOXYGEN -/** @internal */ -typedef union UCPTrieData { - /** @internal */ - const void *ptr0; - /** @internal */ - const uint16_t *ptr16; - /** @internal */ - const uint32_t *ptr32; - /** @internal */ - const uint8_t *ptr8; -} UCPTrieData; -#endif - -/** - * Immutable Unicode code point trie structure. - * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values. - * For details see http://site.icu-project.org/design/struct/utrie - * - * Do not access UCPTrie fields directly; use public functions and macros. - * Functions are easy to use: They support all trie types and value widths. - * - * When performance is really important, macros provide faster access. - * Most macros are specific to either "fast" or "small" tries, see UCPTrieType. - * There are "fast" macros for special optimized use cases. - * - * The macros will return bogus values, or may crash, if used on the wrong type or value width. - * - * @see UMutableCPTrie - * @stable ICU 63 - */ -struct UCPTrie { -#ifndef U_IN_DOXYGEN - /** @internal */ - const uint16_t *index; - /** @internal */ - UCPTrieData data; - - /** @internal */ - int32_t indexLength; - /** @internal */ - int32_t dataLength; - /** Start of the last range which ends at U+10FFFF. @internal */ - UChar32 highStart; - /** highStart>>12 @internal */ - uint16_t shifted12HighStart; - - /** @internal */ - int8_t type; // UCPTrieType - /** @internal */ - int8_t valueWidth; // UCPTrieValueWidth - - /** padding/reserved @internal */ - uint32_t reserved32; - /** padding/reserved @internal */ - uint16_t reserved16; - - /** - * Internal index-3 null block offset. - * Set to an impossibly high value (e.g., 0xffff) if there is no dedicated index-3 null block. - * @internal - */ - uint16_t index3NullOffset; - /** - * Internal data null block offset, not shifted. - * Set to an impossibly high value (e.g., 0xfffff) if there is no dedicated data null block. - * @internal - */ - int32_t dataNullOffset; - /** @internal */ - uint32_t nullValue; - -#ifdef UCPTRIE_DEBUG - /** @internal */ - const char *name; -#endif -#endif -}; -#ifndef U_IN_DOXYGEN -typedef struct UCPTrie UCPTrie; -#endif - -/** - * Selectors for the type of a UCPTrie. - * Different trade-offs for size vs. speed. - * - * @see umutablecptrie_buildImmutable - * @see ucptrie_openFromBinary - * @see ucptrie_getType - * @stable ICU 63 - */ -enum UCPTrieType { - /** - * For ucptrie_openFromBinary() to accept any type. - * ucptrie_getType() will return the actual type. - * @stable ICU 63 - */ - UCPTRIE_TYPE_ANY = -1, - /** - * Fast/simple/larger BMP data structure. Use functions and "fast" macros. - * @stable ICU 63 - */ - UCPTRIE_TYPE_FAST, - /** - * Small/slower BMP data structure. Use functions and "small" macros. - * @stable ICU 63 - */ - UCPTRIE_TYPE_SMALL -}; -#ifndef U_IN_DOXYGEN -typedef enum UCPTrieType UCPTrieType; -#endif - -/** - * Selectors for the number of bits in a UCPTrie data value. - * - * @see umutablecptrie_buildImmutable - * @see ucptrie_openFromBinary - * @see ucptrie_getValueWidth - * @stable ICU 63 - */ -enum UCPTrieValueWidth { - /** - * For ucptrie_openFromBinary() to accept any data value width. - * ucptrie_getValueWidth() will return the actual data value width. - * @stable ICU 63 - */ - UCPTRIE_VALUE_BITS_ANY = -1, - /** - * The trie stores 16 bits per data value. - * It returns them as unsigned values 0..0xffff=65535. - * @stable ICU 63 - */ - UCPTRIE_VALUE_BITS_16, - /** - * The trie stores 32 bits per data value. - * @stable ICU 63 - */ - UCPTRIE_VALUE_BITS_32, - /** - * The trie stores 8 bits per data value. - * It returns them as unsigned values 0..0xff=255. - * @stable ICU 63 - */ - UCPTRIE_VALUE_BITS_8 -}; -#ifndef U_IN_DOXYGEN -typedef enum UCPTrieValueWidth UCPTrieValueWidth; -#endif - -/** - * Opens a trie from its binary form, stored in 32-bit-aligned memory. - * Inverse of ucptrie_toBinary(). - * - * The memory must remain valid and unchanged as long as the trie is used. - * You must ucptrie_close() the trie once you are done using it. - * - * @param type selects the trie type; results in an - * U_INVALID_FORMAT_ERROR if it does not match the binary data; - * use UCPTRIE_TYPE_ANY to accept any type - * @param valueWidth selects the number of bits in a data value; results in an - * U_INVALID_FORMAT_ERROR if it does not match the binary data; - * use UCPTRIE_VALUE_BITS_ANY to accept any data value width - * @param data a pointer to 32-bit-aligned memory containing the binary data of a UCPTrie - * @param length the number of bytes available at data; - * can be more than necessary - * @param pActualLength receives the actual number of bytes at data taken up by the trie data; - * can be NULL - * @param pErrorCode an in/out ICU UErrorCode - * @return the trie - * - * @see umutablecptrie_open - * @see umutablecptrie_buildImmutable - * @see ucptrie_toBinary - * @stable ICU 63 - */ -U_CAPI UCPTrie * U_EXPORT2 -ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth, - const void *data, int32_t length, int32_t *pActualLength, - UErrorCode *pErrorCode); - -/** - * Closes a trie and releases associated memory. - * - * @param trie the trie - * @stable ICU 63 - */ -U_CAPI void U_EXPORT2 -ucptrie_close(UCPTrie *trie); - -/** - * Returns the trie type. - * - * @param trie the trie - * @return the trie type - * @see ucptrie_openFromBinary - * @see UCPTRIE_TYPE_ANY - * @stable ICU 63 - */ -U_CAPI UCPTrieType U_EXPORT2 -ucptrie_getType(const UCPTrie *trie); - -/** - * Returns the number of bits in a trie data value. - * - * @param trie the trie - * @return the number of bits in a trie data value - * @see ucptrie_openFromBinary - * @see UCPTRIE_VALUE_BITS_ANY - * @stable ICU 63 - */ -U_CAPI UCPTrieValueWidth U_EXPORT2 -ucptrie_getValueWidth(const UCPTrie *trie); - -/** - * Returns the value for a code point as stored in the trie, with range checking. - * Returns the trie error value if c is not in the range 0..U+10FFFF. - * - * Easier to use than UCPTRIE_FAST_GET() and similar macros but slower. - * Easier to use because, unlike the macros, this function works on all UCPTrie - * objects, for all types and value widths. - * - * @param trie the trie - * @param c the code point - * @return the trie value, - * or the trie error value if the code point is not in the range 0..U+10FFFF - * @stable ICU 63 - */ -U_CAPI uint32_t U_EXPORT2 -ucptrie_get(const UCPTrie *trie, UChar32 c); - -/** - * Returns the last code point such that all those from start to there have the same value. - * Can be used to efficiently iterate over all same-value ranges in a trie. - * (This is normally faster than iterating over code points and get()ting each value, - * but much slower than a data structure that stores ranges directly.) - * - * If the UCPMapValueFilter function pointer is not NULL, then - * the value to be delivered is passed through that function, and the return value is the end - * of the range where all values are modified to the same actual value. - * The value is unchanged if that function pointer is NULL. - * - * Example: - * \code - * UChar32 start = 0, end; - * uint32_t value; - * while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0, - * NULL, NULL, &value)) >= 0) { - * // Work with the range start..end and its value. - * start = end + 1; - * } - * \endcode - * - * @param trie the trie - * @param start range start - * @param option defines whether surrogates are treated normally, - * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL - * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL - * @param filter a pointer to a function that may modify the trie data value, - * or NULL if the values from the trie are to be used unmodified - * @param context an opaque pointer that is passed on to the filter function - * @param pValue if not NULL, receives the value that every code point start..end has; - * may have been modified by filter(context, trie value) - * if that function pointer is not NULL - * @return the range end code point, or -1 if start is not a valid code point - * @stable ICU 63 - */ -U_CAPI UChar32 U_EXPORT2 -ucptrie_getRange(const UCPTrie *trie, UChar32 start, - UCPMapRangeOption option, uint32_t surrogateValue, - UCPMapValueFilter *filter, const void *context, uint32_t *pValue); - -/** - * Writes a memory-mappable form of the trie into 32-bit aligned memory. - * Inverse of ucptrie_openFromBinary(). - * - * @param trie the trie - * @param data a pointer to 32-bit-aligned memory to be filled with the trie data; - * can be NULL if capacity==0 - * @param capacity the number of bytes available at data, or 0 for pure preflighting - * @param pErrorCode an in/out ICU UErrorCode; - * U_BUFFER_OVERFLOW_ERROR if the capacity is too small - * @return the number of bytes written or (if buffer overflow) needed for the trie - * - * @see ucptrie_openFromBinary() - * @stable ICU 63 - */ -U_CAPI int32_t U_EXPORT2 -ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode); - -/** - * Macro parameter value for a trie with 16-bit data values. - * Use the name of this macro as a "dataAccess" parameter in other macros. - * Do not use this macro in any other way. - * - * @see UCPTRIE_VALUE_BITS_16 - * @stable ICU 63 - */ -#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i]) - -/** - * Macro parameter value for a trie with 32-bit data values. - * Use the name of this macro as a "dataAccess" parameter in other macros. - * Do not use this macro in any other way. - * - * @see UCPTRIE_VALUE_BITS_32 - * @stable ICU 63 - */ -#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i]) - -/** - * Macro parameter value for a trie with 8-bit data values. - * Use the name of this macro as a "dataAccess" parameter in other macros. - * Do not use this macro in any other way. - * - * @see UCPTRIE_VALUE_BITS_8 - * @stable ICU 63 - */ -#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i]) - -/** - * Returns a trie value for a code point, with range checking. - * Returns the trie error value if c is not in the range 0..U+10FFFF. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param c (UChar32, in) the input code point - * @return The code point's trie value. - * @stable ICU 63 - */ -#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c)) - -/** - * Returns a 16-bit trie value for a code point, with range checking. - * Returns the trie error value if c is not in the range U+0000..U+10FFFF. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_SMALL - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param c (UChar32, in) the input code point - * @return The code point's trie value. - * @stable ICU 63 - */ -#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \ - dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c)) - -/** - * UTF-16: Reads the next code point (UChar32 c, out), post-increments src, - * and gets a value from the trie. - * Sets the trie error value if c is an unpaired surrogate. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param src (const UChar *, in/out) the source text pointer - * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated - * @param c (UChar32, out) variable for the code point - * @param result (out) variable for the trie lookup result - * @stable ICU 63 - */ -#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \ - (c) = *(src)++; \ - int32_t __index; \ - if (!U16_IS_SURROGATE(c)) { \ - __index = _UCPTRIE_FAST_INDEX(trie, c); \ - } else { \ - uint16_t __c2; \ - if (U16_IS_SURROGATE_LEAD(c) && (src) != (limit) && U16_IS_TRAIL(__c2 = *(src))) { \ - ++(src); \ - (c) = U16_GET_SUPPLEMENTARY((c), __c2); \ - __index = _UCPTRIE_SMALL_INDEX(trie, c); \ - } else { \ - __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ - } \ - } \ - (result) = dataAccess(trie, __index); \ -} UPRV_BLOCK_MACRO_END - -/** - * UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src, - * and gets a value from the trie. - * Sets the trie error value if c is an unpaired surrogate. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param start (const UChar *, in) the start pointer for the text - * @param src (const UChar *, in/out) the source text pointer - * @param c (UChar32, out) variable for the code point - * @param result (out) variable for the trie lookup result - * @stable ICU 63 - */ -#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \ - (c) = *--(src); \ - int32_t __index; \ - if (!U16_IS_SURROGATE(c)) { \ - __index = _UCPTRIE_FAST_INDEX(trie, c); \ - } else { \ - uint16_t __c2; \ - if (U16_IS_SURROGATE_TRAIL(c) && (src) != (start) && U16_IS_LEAD(__c2 = *((src) - 1))) { \ - --(src); \ - (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \ - __index = _UCPTRIE_SMALL_INDEX(trie, c); \ - } else { \ - __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ - } \ - } \ - (result) = dataAccess(trie, __index); \ -} UPRV_BLOCK_MACRO_END - -/** - * UTF-8: Post-increments src and gets a value from the trie. - * Sets the trie error value for an ill-formed byte sequence. - * - * Unlike UCPTRIE_FAST_U16_NEXT() this UTF-8 macro does not provide the code point - * because it would be more work to do so and is often not needed. - * If the trie value differs from the error value, then the byte sequence is well-formed, - * and the code point can be assembled without revalidation. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param src (const char *, in/out) the source text pointer - * @param limit (const char *, in) the limit pointer for the text (must not be NULL) - * @param result (out) variable for the trie lookup result - * @stable ICU 63 - */ -#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \ - int32_t __lead = (uint8_t)*(src)++; \ - if (!U8_IS_SINGLE(__lead)) { \ - uint8_t __t1, __t2, __t3; \ - if ((src) != (limit) && \ - (__lead >= 0xe0 ? \ - __lead < 0xf0 ? /* U+0800..U+FFFF except surrogates */ \ - U8_LEAD3_T1_BITS[__lead &= 0xf] & (1 << ((__t1 = *(src)) >> 5)) && \ - ++(src) != (limit) && (__t2 = *(src) - 0x80) <= 0x3f && \ - (__lead = ((int32_t)(trie)->index[(__lead << 6) + (__t1 & 0x3f)]) + __t2, 1) \ - : /* U+10000..U+10FFFF */ \ - (__lead -= 0xf0) <= 4 && \ - U8_LEAD4_T1_BITS[(__t1 = *(src)) >> 4] & (1 << __lead) && \ - (__lead = (__lead << 6) | (__t1 & 0x3f), ++(src) != (limit)) && \ - (__t2 = *(src) - 0x80) <= 0x3f && \ - ++(src) != (limit) && (__t3 = *(src) - 0x80) <= 0x3f && \ - (__lead = __lead >= (trie)->shifted12HighStart ? \ - (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ - ucptrie_internalSmallU8Index((trie), __lead, __t2, __t3), 1) \ - : /* U+0080..U+07FF */ \ - __lead >= 0xc2 && (__t1 = *(src) - 0x80) <= 0x3f && \ - (__lead = (int32_t)(trie)->index[__lead & 0x1f] + __t1, 1))) { \ - ++(src); \ - } else { \ - __lead = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; /* ill-formed*/ \ - } \ - } \ - (result) = dataAccess(trie, __lead); \ -} UPRV_BLOCK_MACRO_END - -/** - * UTF-8: Pre-decrements src and gets a value from the trie. - * Sets the trie error value for an ill-formed byte sequence. - * - * Unlike UCPTRIE_FAST_U16_PREV() this UTF-8 macro does not provide the code point - * because it would be more work to do so and is often not needed. - * If the trie value differs from the error value, then the byte sequence is well-formed, - * and the code point can be assembled without revalidation. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param start (const char *, in) the start pointer for the text - * @param src (const char *, in/out) the source text pointer - * @param result (out) variable for the trie lookup result - * @stable ICU 63 - */ -#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \ - int32_t __index = (uint8_t)*--(src); \ - if (!U8_IS_SINGLE(__index)) { \ - __index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \ - (const uint8_t *)(src)); \ - (src) -= __index & 7; \ - __index >>= 3; \ - } \ - (result) = dataAccess(trie, __index); \ -} UPRV_BLOCK_MACRO_END - -/** - * Returns a trie value for an ASCII code point, without range checking. - * - * @param trie (const UCPTrie *, in) the trie (of either fast or small type) - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param c (UChar32, in) the input code point; must be U+0000..U+007F - * @return The ASCII code point's trie value. - * @stable ICU 63 - */ -#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c) - -/** - * Returns a trie value for a BMP code point (U+0000..U+FFFF), without range checking. - * Can be used to look up a value for a UTF-16 code unit if other parts of - * the string processing check for surrogates. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param c (UChar32, in) the input code point, must be U+0000..U+FFFF - * @return The BMP code point's trie value. - * @stable ICU 63 - */ -#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c)) - -/** - * Returns a trie value for a supplementary code point (U+10000..U+10FFFF), - * without range checking. - * - * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST - * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width - * @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF - * @return The supplementary code point's trie value. - * @stable ICU 63 - */ -#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c)) - -/* Internal definitions ----------------------------------------------------- */ - -#ifndef U_IN_DOXYGEN - -/** - * Internal implementation constants. - * These are needed for the API macros, but users should not use these directly. - * @internal - */ -enum { - /** @internal */ - UCPTRIE_FAST_SHIFT = 6, - - /** Number of entries in a data block for code points below the fast limit. 64=0x40 @internal */ - UCPTRIE_FAST_DATA_BLOCK_LENGTH = 1 << UCPTRIE_FAST_SHIFT, - - /** Mask for getting the lower bits for the in-fast-data-block offset. @internal */ - UCPTRIE_FAST_DATA_MASK = UCPTRIE_FAST_DATA_BLOCK_LENGTH - 1, - - /** @internal */ - UCPTRIE_SMALL_MAX = 0xfff, - - /** - * Offset from dataLength (to be subtracted) for fetching the - * value returned for out-of-range code points and ill-formed UTF-8/16. - * @internal - */ - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET = 1, - /** - * Offset from dataLength (to be subtracted) for fetching the - * value returned for code points highStart..U+10FFFF. - * @internal - */ - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET = 2 -}; - -/* Internal functions and macros -------------------------------------------- */ -// Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API - -/** @internal */ -U_INTERNAL int32_t U_EXPORT2 -ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c); - -/** @internal */ -U_INTERNAL int32_t U_EXPORT2 -ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3); - -/** - * Internal function for part of the UCPTRIE_FAST_U8_PREVxx() macro implementations. - * Do not call directly. - * @internal - */ -U_INTERNAL int32_t U_EXPORT2 -ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, - const uint8_t *start, const uint8_t *src); - -/** Internal trie getter for a code point below the fast limit. Returns the data index. @internal */ -#define _UCPTRIE_FAST_INDEX(trie, c) \ - ((int32_t)(trie)->index[(c) >> UCPTRIE_FAST_SHIFT] + ((c) & UCPTRIE_FAST_DATA_MASK)) - -/** Internal trie getter for a code point at or above the fast limit. Returns the data index. @internal */ -#define _UCPTRIE_SMALL_INDEX(trie, c) \ - ((c) >= (trie)->highStart ? \ - (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ - ucptrie_internalSmallIndex(trie, c)) - -/** - * Internal trie getter for a code point, with checking that c is in U+0000..10FFFF. - * Returns the data index. - * @internal - */ -#define _UCPTRIE_CP_INDEX(trie, fastMax, c) \ - ((uint32_t)(c) <= (uint32_t)(fastMax) ? \ - _UCPTRIE_FAST_INDEX(trie, c) : \ - (uint32_t)(c) <= 0x10ffff ? \ - _UCPTRIE_SMALL_INDEX(trie, c) : \ - (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET) - -U_CDECL_END - -#endif // U_IN_DOXYGEN - -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUCPTriePointer - * "Smart pointer" class, closes a UCPTrie via ucptrie_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 63 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close); - -U_NAMESPACE_END - -#endif // U_SHOW_CPLUSPLUS_API - -#endif +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// ucptrie.h (modified from utrie2.h) +// created: 2017dec29 Markus W. Scherer + +#ifndef __UCPTRIE_H__ +#define __UCPTRIE_H__ + +#include "unicode/utypes.h" + +#include "unicode/localpointer.h" +#include "unicode/ucpmap.h" +#include "unicode/utf8.h" + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines an immutable Unicode code point trie. + * + * @see UCPTrie + * @see UMutableCPTrie + */ + +#ifndef U_IN_DOXYGEN +/** @internal */ +typedef union UCPTrieData { + /** @internal */ + const void *ptr0; + /** @internal */ + const uint16_t *ptr16; + /** @internal */ + const uint32_t *ptr32; + /** @internal */ + const uint8_t *ptr8; +} UCPTrieData; +#endif + +/** + * Immutable Unicode code point trie structure. + * Fast, reasonably compact, map from Unicode code points (U+0000..U+10FFFF) to integer values. + * For details see http://site.icu-project.org/design/struct/utrie + * + * Do not access UCPTrie fields directly; use public functions and macros. + * Functions are easy to use: They support all trie types and value widths. + * + * When performance is really important, macros provide faster access. + * Most macros are specific to either "fast" or "small" tries, see UCPTrieType. + * There are "fast" macros for special optimized use cases. + * + * The macros will return bogus values, or may crash, if used on the wrong type or value width. + * + * @see UMutableCPTrie + * @stable ICU 63 + */ +struct UCPTrie { +#ifndef U_IN_DOXYGEN + /** @internal */ + const uint16_t *index; + /** @internal */ + UCPTrieData data; + + /** @internal */ + int32_t indexLength; + /** @internal */ + int32_t dataLength; + /** Start of the last range which ends at U+10FFFF. @internal */ + UChar32 highStart; + /** highStart>>12 @internal */ + uint16_t shifted12HighStart; + + /** @internal */ + int8_t type; // UCPTrieType + /** @internal */ + int8_t valueWidth; // UCPTrieValueWidth + + /** padding/reserved @internal */ + uint32_t reserved32; + /** padding/reserved @internal */ + uint16_t reserved16; + + /** + * Internal index-3 null block offset. + * Set to an impossibly high value (e.g., 0xffff) if there is no dedicated index-3 null block. + * @internal + */ + uint16_t index3NullOffset; + /** + * Internal data null block offset, not shifted. + * Set to an impossibly high value (e.g., 0xfffff) if there is no dedicated data null block. + * @internal + */ + int32_t dataNullOffset; + /** @internal */ + uint32_t nullValue; + +#ifdef UCPTRIE_DEBUG + /** @internal */ + const char *name; +#endif +#endif +}; +#ifndef U_IN_DOXYGEN +typedef struct UCPTrie UCPTrie; +#endif + +/** + * Selectors for the type of a UCPTrie. + * Different trade-offs for size vs. speed. + * + * @see umutablecptrie_buildImmutable + * @see ucptrie_openFromBinary + * @see ucptrie_getType + * @stable ICU 63 + */ +enum UCPTrieType { + /** + * For ucptrie_openFromBinary() to accept any type. + * ucptrie_getType() will return the actual type. + * @stable ICU 63 + */ + UCPTRIE_TYPE_ANY = -1, + /** + * Fast/simple/larger BMP data structure. Use functions and "fast" macros. + * @stable ICU 63 + */ + UCPTRIE_TYPE_FAST, + /** + * Small/slower BMP data structure. Use functions and "small" macros. + * @stable ICU 63 + */ + UCPTRIE_TYPE_SMALL +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPTrieType UCPTrieType; +#endif + +/** + * Selectors for the number of bits in a UCPTrie data value. + * + * @see umutablecptrie_buildImmutable + * @see ucptrie_openFromBinary + * @see ucptrie_getValueWidth + * @stable ICU 63 + */ +enum UCPTrieValueWidth { + /** + * For ucptrie_openFromBinary() to accept any data value width. + * ucptrie_getValueWidth() will return the actual data value width. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_ANY = -1, + /** + * The trie stores 16 bits per data value. + * It returns them as unsigned values 0..0xffff=65535. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_16, + /** + * The trie stores 32 bits per data value. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_32, + /** + * The trie stores 8 bits per data value. + * It returns them as unsigned values 0..0xff=255. + * @stable ICU 63 + */ + UCPTRIE_VALUE_BITS_8 +}; +#ifndef U_IN_DOXYGEN +typedef enum UCPTrieValueWidth UCPTrieValueWidth; +#endif + +/** + * Opens a trie from its binary form, stored in 32-bit-aligned memory. + * Inverse of ucptrie_toBinary(). + * + * The memory must remain valid and unchanged as long as the trie is used. + * You must ucptrie_close() the trie once you are done using it. + * + * @param type selects the trie type; results in an + * U_INVALID_FORMAT_ERROR if it does not match the binary data; + * use UCPTRIE_TYPE_ANY to accept any type + * @param valueWidth selects the number of bits in a data value; results in an + * U_INVALID_FORMAT_ERROR if it does not match the binary data; + * use UCPTRIE_VALUE_BITS_ANY to accept any data value width + * @param data a pointer to 32-bit-aligned memory containing the binary data of a UCPTrie + * @param length the number of bytes available at data; + * can be more than necessary + * @param pActualLength receives the actual number of bytes at data taken up by the trie data; + * can be NULL + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie + * + * @see umutablecptrie_open + * @see umutablecptrie_buildImmutable + * @see ucptrie_toBinary + * @stable ICU 63 + */ +U_CAPI UCPTrie * U_EXPORT2 +ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth, + const void *data, int32_t length, int32_t *pActualLength, + UErrorCode *pErrorCode); + +/** + * Closes a trie and releases associated memory. + * + * @param trie the trie + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +ucptrie_close(UCPTrie *trie); + +/** + * Returns the trie type. + * + * @param trie the trie + * @return the trie type + * @see ucptrie_openFromBinary + * @see UCPTRIE_TYPE_ANY + * @stable ICU 63 + */ +U_CAPI UCPTrieType U_EXPORT2 +ucptrie_getType(const UCPTrie *trie); + +/** + * Returns the number of bits in a trie data value. + * + * @param trie the trie + * @return the number of bits in a trie data value + * @see ucptrie_openFromBinary + * @see UCPTRIE_VALUE_BITS_ANY + * @stable ICU 63 + */ +U_CAPI UCPTrieValueWidth U_EXPORT2 +ucptrie_getValueWidth(const UCPTrie *trie); + +/** + * Returns the value for a code point as stored in the trie, with range checking. + * Returns the trie error value if c is not in the range 0..U+10FFFF. + * + * Easier to use than UCPTRIE_FAST_GET() and similar macros but slower. + * Easier to use because, unlike the macros, this function works on all UCPTrie + * objects, for all types and value widths. + * + * @param trie the trie + * @param c the code point + * @return the trie value, + * or the trie error value if the code point is not in the range 0..U+10FFFF + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +ucptrie_get(const UCPTrie *trie, UChar32 c); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a trie. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * Example: + * \code + * UChar32 start = 0, end; + * uint32_t value; + * while ((end = ucptrie_getRange(trie, start, UCPMAP_RANGE_NORMAL, 0, + * NULL, NULL, &value)) >= 0) { + * // Work with the range start..end and its value. + * start = end + 1; + * } + * \endcode + * + * @param trie the trie + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the trie data value, + * or NULL if the values from the trie are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, trie value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +ucptrie_getRange(const UCPTrie *trie, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +/** + * Writes a memory-mappable form of the trie into 32-bit aligned memory. + * Inverse of ucptrie_openFromBinary(). + * + * @param trie the trie + * @param data a pointer to 32-bit-aligned memory to be filled with the trie data; + * can be NULL if capacity==0 + * @param capacity the number of bytes available at data, or 0 for pure preflighting + * @param pErrorCode an in/out ICU UErrorCode; + * U_BUFFER_OVERFLOW_ERROR if the capacity is too small + * @return the number of bytes written or (if buffer overflow) needed for the trie + * + * @see ucptrie_openFromBinary() + * @stable ICU 63 + */ +U_CAPI int32_t U_EXPORT2 +ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode); + +/** + * Macro parameter value for a trie with 16-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_16 + * @stable ICU 63 + */ +#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i]) + +/** + * Macro parameter value for a trie with 32-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_32 + * @stable ICU 63 + */ +#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i]) + +/** + * Macro parameter value for a trie with 8-bit data values. + * Use the name of this macro as a "dataAccess" parameter in other macros. + * Do not use this macro in any other way. + * + * @see UCPTRIE_VALUE_BITS_8 + * @stable ICU 63 + */ +#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i]) + +/** + * Returns a trie value for a code point, with range checking. + * Returns the trie error value if c is not in the range 0..U+10FFFF. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point + * @return The code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c)) + +/** + * Returns a 16-bit trie value for a code point, with range checking. + * Returns the trie error value if c is not in the range U+0000..U+10FFFF. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_SMALL + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point + * @return The code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \ + dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c)) + +/** + * UTF-16: Reads the next code point (UChar32 c, out), post-increments src, + * and gets a value from the trie. + * Sets the trie error value if c is an unpaired surrogate. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param src (const UChar *, in/out) the source text pointer + * @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated + * @param c (UChar32, out) variable for the code point + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + (c) = *(src)++; \ + int32_t __index; \ + if (!U16_IS_SURROGATE(c)) { \ + __index = _UCPTRIE_FAST_INDEX(trie, c); \ + } else { \ + uint16_t __c2; \ + if (U16_IS_SURROGATE_LEAD(c) && (src) != (limit) && U16_IS_TRAIL(__c2 = *(src))) { \ + ++(src); \ + (c) = U16_GET_SUPPLEMENTARY((c), __c2); \ + __index = _UCPTRIE_SMALL_INDEX(trie, c); \ + } else { \ + __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ + } \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src, + * and gets a value from the trie. + * Sets the trie error value if c is an unpaired surrogate. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param start (const UChar *, in) the start pointer for the text + * @param src (const UChar *, in/out) the source text pointer + * @param c (UChar32, out) variable for the code point + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \ + (c) = *--(src); \ + int32_t __index; \ + if (!U16_IS_SURROGATE(c)) { \ + __index = _UCPTRIE_FAST_INDEX(trie, c); \ + } else { \ + uint16_t __c2; \ + if (U16_IS_SURROGATE_TRAIL(c) && (src) != (start) && U16_IS_LEAD(__c2 = *((src) - 1))) { \ + --(src); \ + (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \ + __index = _UCPTRIE_SMALL_INDEX(trie, c); \ + } else { \ + __index = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; \ + } \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-8: Post-increments src and gets a value from the trie. + * Sets the trie error value for an ill-formed byte sequence. + * + * Unlike UCPTRIE_FAST_U16_NEXT() this UTF-8 macro does not provide the code point + * because it would be more work to do so and is often not needed. + * If the trie value differs from the error value, then the byte sequence is well-formed, + * and the code point can be assembled without revalidation. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param src (const char *, in/out) the source text pointer + * @param limit (const char *, in) the limit pointer for the text (must not be NULL) + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __lead = (uint8_t)*(src)++; \ + if (!U8_IS_SINGLE(__lead)) { \ + uint8_t __t1, __t2, __t3; \ + if ((src) != (limit) && \ + (__lead >= 0xe0 ? \ + __lead < 0xf0 ? /* U+0800..U+FFFF except surrogates */ \ + U8_LEAD3_T1_BITS[__lead &= 0xf] & (1 << ((__t1 = *(src)) >> 5)) && \ + ++(src) != (limit) && (__t2 = *(src) - 0x80) <= 0x3f && \ + (__lead = ((int32_t)(trie)->index[(__lead << 6) + (__t1 & 0x3f)]) + __t2, 1) \ + : /* U+10000..U+10FFFF */ \ + (__lead -= 0xf0) <= 4 && \ + U8_LEAD4_T1_BITS[(__t1 = *(src)) >> 4] & (1 << __lead) && \ + (__lead = (__lead << 6) | (__t1 & 0x3f), ++(src) != (limit)) && \ + (__t2 = *(src) - 0x80) <= 0x3f && \ + ++(src) != (limit) && (__t3 = *(src) - 0x80) <= 0x3f && \ + (__lead = __lead >= (trie)->shifted12HighStart ? \ + (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ + ucptrie_internalSmallU8Index((trie), __lead, __t2, __t3), 1) \ + : /* U+0080..U+07FF */ \ + __lead >= 0xc2 && (__t1 = *(src) - 0x80) <= 0x3f && \ + (__lead = (int32_t)(trie)->index[__lead & 0x1f] + __t1, 1))) { \ + ++(src); \ + } else { \ + __lead = (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET; /* ill-formed*/ \ + } \ + } \ + (result) = dataAccess(trie, __lead); \ +} UPRV_BLOCK_MACRO_END + +/** + * UTF-8: Pre-decrements src and gets a value from the trie. + * Sets the trie error value for an ill-formed byte sequence. + * + * Unlike UCPTRIE_FAST_U16_PREV() this UTF-8 macro does not provide the code point + * because it would be more work to do so and is often not needed. + * If the trie value differs from the error value, then the byte sequence is well-formed, + * and the code point can be assembled without revalidation. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param start (const char *, in) the start pointer for the text + * @param src (const char *, in/out) the source text pointer + * @param result (out) variable for the trie lookup result + * @stable ICU 63 + */ +#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \ + int32_t __index = (uint8_t)*--(src); \ + if (!U8_IS_SINGLE(__index)) { \ + __index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \ + (const uint8_t *)(src)); \ + (src) -= __index & 7; \ + __index >>= 3; \ + } \ + (result) = dataAccess(trie, __index); \ +} UPRV_BLOCK_MACRO_END + +/** + * Returns a trie value for an ASCII code point, without range checking. + * + * @param trie (const UCPTrie *, in) the trie (of either fast or small type) + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point; must be U+0000..U+007F + * @return The ASCII code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c) + +/** + * Returns a trie value for a BMP code point (U+0000..U+FFFF), without range checking. + * Can be used to look up a value for a UTF-16 code unit if other parts of + * the string processing check for surrogates. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point, must be U+0000..U+FFFF + * @return The BMP code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c)) + +/** + * Returns a trie value for a supplementary code point (U+10000..U+10FFFF), + * without range checking. + * + * @param trie (const UCPTrie *, in) the trie; must have type UCPTRIE_TYPE_FAST + * @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width + * @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF + * @return The supplementary code point's trie value. + * @stable ICU 63 + */ +#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c)) + +/* Internal definitions ----------------------------------------------------- */ + +#ifndef U_IN_DOXYGEN + +/** + * Internal implementation constants. + * These are needed for the API macros, but users should not use these directly. + * @internal + */ +enum { + /** @internal */ + UCPTRIE_FAST_SHIFT = 6, + + /** Number of entries in a data block for code points below the fast limit. 64=0x40 @internal */ + UCPTRIE_FAST_DATA_BLOCK_LENGTH = 1 << UCPTRIE_FAST_SHIFT, + + /** Mask for getting the lower bits for the in-fast-data-block offset. @internal */ + UCPTRIE_FAST_DATA_MASK = UCPTRIE_FAST_DATA_BLOCK_LENGTH - 1, + + /** @internal */ + UCPTRIE_SMALL_MAX = 0xfff, + + /** + * Offset from dataLength (to be subtracted) for fetching the + * value returned for out-of-range code points and ill-formed UTF-8/16. + * @internal + */ + UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET = 1, + /** + * Offset from dataLength (to be subtracted) for fetching the + * value returned for code points highStart..U+10FFFF. + * @internal + */ + UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET = 2 +}; + +/* Internal functions and macros -------------------------------------------- */ +// Do not conditionalize with #ifndef U_HIDE_INTERNAL_API, needed for public API + +/** @internal */ +U_INTERNAL int32_t U_EXPORT2 +ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c); + +/** @internal */ +U_INTERNAL int32_t U_EXPORT2 +ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3); + +/** + * Internal function for part of the UCPTRIE_FAST_U8_PREVxx() macro implementations. + * Do not call directly. + * @internal + */ +U_INTERNAL int32_t U_EXPORT2 +ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, + const uint8_t *start, const uint8_t *src); + +/** Internal trie getter for a code point below the fast limit. Returns the data index. @internal */ +#define _UCPTRIE_FAST_INDEX(trie, c) \ + ((int32_t)(trie)->index[(c) >> UCPTRIE_FAST_SHIFT] + ((c) & UCPTRIE_FAST_DATA_MASK)) + +/** Internal trie getter for a code point at or above the fast limit. Returns the data index. @internal */ +#define _UCPTRIE_SMALL_INDEX(trie, c) \ + ((c) >= (trie)->highStart ? \ + (trie)->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET : \ + ucptrie_internalSmallIndex(trie, c)) + +/** + * Internal trie getter for a code point, with checking that c is in U+0000..10FFFF. + * Returns the data index. + * @internal + */ +#define _UCPTRIE_CP_INDEX(trie, fastMax, c) \ + ((uint32_t)(c) <= (uint32_t)(fastMax) ? \ + _UCPTRIE_FAST_INDEX(trie, c) : \ + (uint32_t)(c) <= 0x10ffff ? \ + _UCPTRIE_SMALL_INDEX(trie, c) : \ + (trie)->dataLength - UCPTRIE_ERROR_VALUE_NEG_DATA_OFFSET) + +U_CDECL_END + +#endif // U_IN_DOXYGEN + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCPTriePointer + * "Smart pointer" class, closes a UCPTrie via ucptrie_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 63 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close); + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API + +#endif diff --git a/contrib/libs/icu/include/unicode/ucsdet.h b/contrib/libs/icu/include/unicode/ucsdet.h index 52ed5ad0ee..b9e91daf20 100644 --- a/contrib/libs/icu/include/unicode/ucsdet.h +++ b/contrib/libs/icu/include/unicode/ucsdet.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ********************************************************************** * file name: ucsdet.h - * encoding: UTF-8 + * encoding: UTF-8 * indentation:4 * * created on: 2005Aug04 @@ -45,10 +45,10 @@ * in a single language, and a minimum of a few hundred bytes worth of plain text * in the language are needed. The detection process will attempt to * ignore html or xml style markup that could otherwise obscure the content. - * <p> - * An alternative to the ICU Charset Detector is the - * Compact Encoding Detector, https://github.com/google/compact_enc_det. - * It often gives more accurate results, especially with short input samples. + * <p> + * An alternative to the ICU Charset Detector is the + * Compact Encoding Detector, https://github.com/google/compact_enc_det. + * It often gives more accurate results, especially with short input samples. */ @@ -399,7 +399,7 @@ ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); /** * Enable or disable individual charset encoding. * A name of charset encoding must be included in the names returned by - * {@link #ucsdet_getAllDetectableCharsets()}. + * {@link #ucsdet_getAllDetectableCharsets()}. * * @param ucsd a Charset detector. * @param encoding encoding the name of charset encoding. diff --git a/contrib/libs/icu/include/unicode/ucurr.h b/contrib/libs/icu/include/unicode/ucurr.h index f91cc0df7c..b06407c785 100644 --- a/contrib/libs/icu/include/unicode/ucurr.h +++ b/contrib/libs/icu/include/unicode/ucurr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -60,7 +60,7 @@ enum UCurrencyUsage { UCURR_USAGE_COUNT=2 #endif // U_HIDE_DEPRECATED_API }; -/** Currency Usage used for Decimal Format */ +/** Currency Usage used for Decimal Format */ typedef enum UCurrencyUsage UCurrencyUsage; /** @@ -103,17 +103,17 @@ typedef enum UCurrNameStyle { * currency, such as "US Dollar" for USD. * @stable ICU 2.6 */ - UCURR_LONG_NAME, - - /** - * Selector for getName() indicating the narrow currency symbol. - * The narrow currency symbol is similar to the regular currency - * symbol, but it always takes the shortest form: for example, - * "$" instead of "US$" for USD in en-CA. - * - * @stable ICU 61 - */ - UCURR_NARROW_SYMBOL_NAME + UCURR_LONG_NAME, + + /** + * Selector for getName() indicating the narrow currency symbol. + * The narrow currency symbol is similar to the regular currency + * symbol, but it always takes the shortest form: for example, + * "$" instead of "US$" for USD in en-CA. + * + * @stable ICU 61 + */ + UCURR_NARROW_SYMBOL_NAME } UCurrNameStyle; #if !UCONFIG_NO_SERVICE @@ -159,14 +159,14 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency * @param nameStyle selector for which kind of name to return - * @param isChoiceFormat always set to FALSE, or can be NULL; - * display names are static strings; - * since ICU 4.4, ChoiceFormat patterns are no longer supported + * @param isChoiceFormat always set to FALSE, or can be NULL; + * display names are static strings; + * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param len fill-in parameter to receive length of result * @param ec error code * @return pointer to display string of 'len' UChars. If the resource * data contains no entry for 'currency', then 'currency' itself is - * returned. + * returned. * @stable ICU 2.6 */ U_STABLE const UChar* U_EXPORT2 @@ -183,15 +183,15 @@ ucurr_getName(const UChar* currency, * currency object in the en_US locale is "US dollar" or "US dollars". * @param currency null-terminated 3-letter ISO 4217 code * @param locale locale in which to display currency - * @param isChoiceFormat always set to FALSE, or can be NULL; - * display names are static strings; - * since ICU 4.4, ChoiceFormat patterns are no longer supported + * @param isChoiceFormat always set to FALSE, or can be NULL; + * display names are static strings; + * since ICU 4.4, ChoiceFormat patterns are no longer supported * @param pluralCount plural count * @param len fill-in parameter to receive length of result * @param ec error code * @return pointer to display string of 'len' UChars. If the resource * data contains no entry for 'currency', then 'currency' itself is - * returned. + * returned. * @stable ICU 4.2 */ U_STABLE const UChar* U_EXPORT2 @@ -206,13 +206,13 @@ ucurr_getPluralName(const UChar* currency, * Returns the number of the number of fraction digits that should * be displayed for the given currency. * This is equivalent to ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec); - * - * Important: The number of fraction digits for a given currency is NOT - * guaranteed to be constant across versions of ICU or CLDR. For example, - * do NOT use this value as a mechanism for deciding the magnitude used - * to store currency values in a database. You should use this value for - * display purposes only. - * + * + * Important: The number of fraction digits for a given currency is NOT + * guaranteed to be constant across versions of ICU or CLDR. For example, + * do NOT use this value as a mechanism for deciding the magnitude used + * to store currency values in a database. You should use this value for + * display purposes only. + * * @param currency null-terminated 3-letter ISO 4217 code * @param ec input-output error code * @return a non-negative number of fraction digits to be @@ -226,13 +226,13 @@ ucurr_getDefaultFractionDigits(const UChar* currency, /** * Returns the number of the number of fraction digits that should * be displayed for the given currency with usage. - * - * Important: The number of fraction digits for a given currency is NOT - * guaranteed to be constant across versions of ICU or CLDR. For example, - * do NOT use this value as a mechanism for deciding the magnitude used - * to store currency values in a database. You should use this value for - * display purposes only. - * + * + * Important: The number of fraction digits for a given currency is NOT + * guaranteed to be constant across versions of ICU or CLDR. For example, + * do NOT use this value as a mechanism for deciding the magnitude used + * to store currency values in a database. You should use this value for + * display purposes only. + * * @param currency null-terminated 3-letter ISO 4217 code * @param usage enum usage for the currency * @param ec input-output error code @@ -321,7 +321,7 @@ typedef enum UCurrCurrencyType { * Provides a UEnumeration object for listing ISO-4217 codes. * @param currType You can use one of several UCurrCurrencyType values for this * variable. You can also | (or) them together to get a specific list of - * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to + * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to * get a list of current currencies. * @param pErrorCode Error code * @stable ICU 3.2 diff --git a/contrib/libs/icu/include/unicode/udat.h b/contrib/libs/icu/include/unicode/udat.h index cf7a165e70..334817f160 100644 --- a/contrib/libs/icu/include/unicode/udat.h +++ b/contrib/libs/icu/include/unicode/udat.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -482,28 +482,28 @@ typedef enum UDateFormatStyle { #define UDAT_HOUR_TZ "jz" #endif /* U_HIDE_DEPRECATED_API */ -#ifndef U_HIDE_INTERNAL_API -/** - * Constant for Unicode string name of new (in 2019) Japanese calendar era, - * root/English abbreviated version (ASCII-range characters). - * @internal - */ -#define JP_ERA_2019_ROOT "Reiwa" -/** - * Constant for Unicode string name of new (in 2019) Japanese calendar era, - * Japanese abbreviated version (Han, or fullwidth Latin for testing). - * @internal - */ -#define JP_ERA_2019_JA "\\u4EE4\\u548C" -/** - * Constant for Unicode string name of new (in 2019) Japanese calendar era, - * root and Japanese narrow version (ASCII-range characters). - * @internal - */ -#define JP_ERA_2019_NARROW "R" -#endif // U_HIDE_INTERNAL_API - -/** +#ifndef U_HIDE_INTERNAL_API +/** + * Constant for Unicode string name of new (in 2019) Japanese calendar era, + * root/English abbreviated version (ASCII-range characters). + * @internal + */ +#define JP_ERA_2019_ROOT "Reiwa" +/** + * Constant for Unicode string name of new (in 2019) Japanese calendar era, + * Japanese abbreviated version (Han, or fullwidth Latin for testing). + * @internal + */ +#define JP_ERA_2019_JA "\\u4EE4\\u548C" +/** + * Constant for Unicode string name of new (in 2019) Japanese calendar era, + * root and Japanese narrow version (ASCII-range characters). + * @internal + */ +#define JP_ERA_2019_NARROW "R" +#endif // U_HIDE_INTERNAL_API + +/** * FieldPosition and UFieldPosition selectors for format fields * defined by DateFormat and UDateFormat. * @stable ICU 3.0 @@ -788,13 +788,13 @@ typedef enum UDateFormatField { * FieldPosition selector for 'b' field alignment. * Displays midnight and noon for 12am and 12pm, respectively, if available; * otherwise fall back to AM / PM. - * @stable ICU 57 + * @stable ICU 57 */ UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35, /* FieldPosition selector for 'B' field alignment. * Displays flexible day periods, such as "in the morning", if available. - * @stable ICU 57 + * @stable ICU 57 */ UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36, @@ -816,7 +816,7 @@ typedef enum UDateFormatField { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_FIELD_COUNT = 38 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UDateFormatField; @@ -838,7 +838,7 @@ typedef enum UDateFormatField { * of error (e.g., the input field is UDAT_FIELD_COUNT). * @stable ICU 4.4 */ -U_CAPI UCalendarDateFields U_EXPORT2 +U_CAPI UCalendarDateFields U_EXPORT2 udat_toCalendarDateField(UDateFormatField field); @@ -870,7 +870,7 @@ udat_toCalendarDateField(UDateFormatField field); * an error occurred. * @stable ICU 2.0 */ -U_CAPI UDateFormat* U_EXPORT2 +U_CAPI UDateFormat* U_EXPORT2 udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, @@ -887,7 +887,7 @@ udat_open(UDateFormatStyle timeStyle, * @param format The formatter to close. * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_close(UDateFormat* format); @@ -921,15 +921,15 @@ typedef enum UDateFormatBooleanAttribute { */ UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, - /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, - * it is needed for layout of DateFormat object. */ -#ifndef U_FORCE_HIDE_DEPRECATED_API + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DateFormat object. */ +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * One more than the highest normal UDateFormatBooleanAttribute value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4 -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API } UDateFormatBooleanAttribute; /** @@ -942,7 +942,7 @@ typedef enum UDateFormatBooleanAttribute { * @return The value of attr. * @stable ICU 53 */ -U_CAPI UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status); /** @@ -955,41 +955,41 @@ udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute att * @param status A pointer to an UErrorCode to receive any errors * @stable ICU 53 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status); -#ifndef U_HIDE_DRAFT_API -/** - * Hour Cycle. - * @draft ICU 67 - */ -typedef enum UDateFormatHourCycle { - /** - * Hour in am/pm (0~11) - * @draft ICU 67 - */ - UDAT_HOUR_CYCLE_11, - - /** - * Hour in am/pm (1~12) - * @draft ICU 67 - */ - UDAT_HOUR_CYCLE_12, - - /** - * Hour in day (0~23) - * @draft ICU 67 - */ - UDAT_HOUR_CYCLE_23, - - /** - * Hour in day (1~24) - * @draft ICU 67 - */ - UDAT_HOUR_CYCLE_24 -} UDateFormatHourCycle; -#endif /* U_HIDE_DRAFT_API */ - +#ifndef U_HIDE_DRAFT_API +/** + * Hour Cycle. + * @draft ICU 67 + */ +typedef enum UDateFormatHourCycle { + /** + * Hour in am/pm (0~11) + * @draft ICU 67 + */ + UDAT_HOUR_CYCLE_11, + + /** + * Hour in am/pm (1~12) + * @draft ICU 67 + */ + UDAT_HOUR_CYCLE_12, + + /** + * Hour in day (0~23) + * @draft ICU 67 + */ + UDAT_HOUR_CYCLE_23, + + /** + * Hour in day (1~24) + * @draft ICU 67 + */ + UDAT_HOUR_CYCLE_24 +} UDateFormatHourCycle; +#endif /* U_HIDE_DRAFT_API */ + #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN @@ -1017,7 +1017,7 @@ U_NAMESPACE_END * @return A pointer to a UDateFormat identical to fmt. * @stable ICU 2.0 */ -U_CAPI UDateFormat* U_EXPORT2 +U_CAPI UDateFormat* U_EXPORT2 udat_clone(const UDateFormat *fmt, UErrorCode *status); @@ -1039,7 +1039,7 @@ udat_clone(const UDateFormat *fmt, * @see UFieldPosition * @stable ICU 2.0 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_format( const UDateFormat* format, UDate dateToFormat, UChar* result, @@ -1069,7 +1069,7 @@ udat_format( const UDateFormat* format, * @see UFieldPosition * @stable ICU 55 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_formatCalendar( const UDateFormat* format, UCalendar* calendar, UChar* result, @@ -1104,7 +1104,7 @@ udat_formatCalendar( const UDateFormat* format, * @see UFieldPositionIterator * @stable ICU 55 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_formatForFields( const UDateFormat* format, UDate dateToFormat, UChar* result, @@ -1142,7 +1142,7 @@ udat_formatForFields( const UDateFormat* format, * @see UFieldPositionIterator * @stable ICU 55 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_formatCalendarForFields( const UDateFormat* format, UCalendar* calendar, UChar* result, @@ -1176,7 +1176,7 @@ udat_formatCalendarForFields( const UDateFormat* format, * @see udat_format * @stable ICU 2.0 */ -U_CAPI UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 udat_parse(const UDateFormat* format, const UChar* text, int32_t textLength, @@ -1204,7 +1204,7 @@ udat_parse(const UDateFormat* format, * @see udat_format * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_parseCalendar(const UDateFormat* format, UCalendar* calendar, const UChar* text, @@ -1221,7 +1221,7 @@ udat_parseCalendar(const UDateFormat* format, * @see udat_setLenient * @stable ICU 2.0 */ -U_CAPI UBool U_EXPORT2 +U_CAPI UBool U_EXPORT2 udat_isLenient(const UDateFormat* fmt); /** @@ -1233,7 +1233,7 @@ udat_isLenient(const UDateFormat* fmt); * @see dat_isLenient * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setLenient( UDateFormat* fmt, UBool isLenient); @@ -1246,7 +1246,7 @@ udat_setLenient( UDateFormat* fmt, * @see udat_setCalendar * @stable ICU 2.0 */ -U_CAPI const UCalendar* U_EXPORT2 +U_CAPI const UCalendar* U_EXPORT2 udat_getCalendar(const UDateFormat* fmt); /** @@ -1258,7 +1258,7 @@ udat_getCalendar(const UDateFormat* fmt); * @see udat_setCalendar * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setCalendar( UDateFormat* fmt, const UCalendar* calendarToSet); @@ -1271,7 +1271,7 @@ udat_setCalendar( UDateFormat* fmt, * @see udat_setNumberFormat * @stable ICU 2.0 */ -U_CAPI const UNumberFormat* U_EXPORT2 +U_CAPI const UNumberFormat* U_EXPORT2 udat_getNumberFormat(const UDateFormat* fmt); /** @@ -1283,7 +1283,7 @@ udat_getNumberFormat(const UDateFormat* fmt); * @see udat_setNumberFormatForField * @stable ICU 54 */ -U_CAPI const UNumberFormat* U_EXPORT2 +U_CAPI const UNumberFormat* U_EXPORT2 udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); /** @@ -1301,7 +1301,7 @@ udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); * @see udat_getNumberFormatForField * @stable ICU 54 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_adoptNumberFormatForFields( UDateFormat* fmt, const UChar* fields, UNumberFormat* numberFormatToSet, @@ -1318,7 +1318,7 @@ udat_adoptNumberFormatForFields( UDateFormat* fmt, * @see udat_setNumberFormatForField * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setNumberFormat( UDateFormat* fmt, const UNumberFormat* numberFormatToSet); /** @@ -1330,7 +1330,7 @@ udat_setNumberFormat( UDateFormat* fmt, * @see udat_getNumberFormat * @stable ICU 54 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_adoptNumberFormat( UDateFormat* fmt, UNumberFormat* numberFormatToAdopt); /** @@ -1342,7 +1342,7 @@ udat_adoptNumberFormat( UDateFormat* fmt, * @see udat_countAvailable * @stable ICU 2.0 */ -U_CAPI const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 udat_getAvailable(int32_t localeIndex); /** @@ -1353,7 +1353,7 @@ udat_getAvailable(int32_t localeIndex); * @see udat_getAvailable * @stable ICU 2.0 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_countAvailable(void); /** @@ -1366,7 +1366,7 @@ udat_countAvailable(void); * @see udat_Set2DigitYearStart * @stable ICU 2.0 */ -U_CAPI UDate U_EXPORT2 +U_CAPI UDate U_EXPORT2 udat_get2DigitYearStart( const UDateFormat *fmt, UErrorCode *status); @@ -1380,7 +1380,7 @@ udat_get2DigitYearStart( const UDateFormat *fmt, * @see udat_Set2DigitYearStart * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_set2DigitYearStart( UDateFormat *fmt, UDate d, UErrorCode *status); @@ -1397,7 +1397,7 @@ udat_set2DigitYearStart( UDateFormat *fmt, * @see udat_applyPattern * @stable ICU 2.0 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_toPattern( const UDateFormat *fmt, UBool localized, UChar *result, @@ -1414,7 +1414,7 @@ udat_toPattern( const UDateFormat *fmt, * @see udat_toPattern * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_applyPattern( UDateFormat *format, UBool localized, const UChar *pattern, @@ -1540,7 +1540,7 @@ typedef struct UDateFormatSymbols UDateFormatSymbols; * @see udat_setSymbols * @stable ICU 2.0 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_getSymbols(const UDateFormat *fmt, UDateFormatSymbolType type, int32_t symbolIndex, @@ -1560,7 +1560,7 @@ udat_getSymbols(const UDateFormat *fmt, * @see udat_setSymbols * @stable ICU 2.0 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 udat_countSymbols( const UDateFormat *fmt, UDateFormatSymbolType type); @@ -1579,7 +1579,7 @@ udat_countSymbols( const UDateFormat *fmt, * @see udat_countSymbols * @stable ICU 2.0 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setSymbols( UDateFormat *format, UDateFormatSymbolType type, int32_t symbolIndex, @@ -1596,7 +1596,7 @@ udat_setSymbols( UDateFormat *format, * @return the locale name * @stable ICU 2.8 */ -U_CAPI const char* U_EXPORT2 +U_CAPI const char* U_EXPORT2 udat_getLocaleByType(const UDateFormat *fmt, ULocDataLocaleType type, UErrorCode* status); @@ -1609,7 +1609,7 @@ udat_getLocaleByType(const UDateFormat *fmt, * @param status A pointer to an UErrorCode to receive any errors * @stable ICU 51 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); /** @@ -1621,7 +1621,7 @@ udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); * @return The UDisplayContextValue for the specified type. * @stable ICU 53 */ -U_CAPI UDisplayContext U_EXPORT2 +U_CAPI UDisplayContext U_EXPORT2 udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); #ifndef U_HIDE_INTERNAL_API diff --git a/contrib/libs/icu/include/unicode/udata.h b/contrib/libs/icu/include/unicode/udata.h index 325ffcf17d..61e683f2f6 100644 --- a/contrib/libs/icu/include/unicode/udata.h +++ b/contrib/libs/icu/include/unicode/udata.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * ****************************************************************************** * file name: udata.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -415,23 +415,23 @@ udata_setFileAccess(UDataFileAccess access, UErrorCode *status); U_CDECL_END -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUDataMemoryPointer - * "Smart pointer" class, closes a UDataMemory via udata_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 4.4 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close); - -U_NAMESPACE_END - -#endif // U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDataMemoryPointer + * "Smart pointer" class, closes a UDataMemory via udata_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close); + +U_NAMESPACE_END + +#endif // U_SHOW_CPLUSPLUS_API + #endif diff --git a/contrib/libs/icu/include/unicode/udateintervalformat.h b/contrib/libs/icu/include/unicode/udateintervalformat.h index 2f9ec91ad3..c3072b4e3b 100644 --- a/contrib/libs/icu/include/unicode/udateintervalformat.h +++ b/contrib/libs/icu/include/unicode/udateintervalformat.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -14,10 +14,10 @@ #if !UCONFIG_NO_FORMATTING -#include "unicode/ucal.h" +#include "unicode/ucal.h" #include "unicode/umisc.h" #include "unicode/localpointer.h" -#include "unicode/uformattedvalue.h" +#include "unicode/uformattedvalue.h" /** * \file @@ -83,14 +83,14 @@ struct UDateIntervalFormat; typedef struct UDateIntervalFormat UDateIntervalFormat; /**< C typedef for struct UDateIntervalFormat. @stable ICU 4.8 */ -struct UFormattedDateInterval; -/** - * Opaque struct to contain the results of a UDateIntervalFormat operation. - * @stable ICU 64 - */ -typedef struct UFormattedDateInterval UFormattedDateInterval; - +struct UFormattedDateInterval; /** + * Opaque struct to contain the results of a UDateIntervalFormat operation. + * @stable ICU 64 + */ +typedef struct UFormattedDateInterval UFormattedDateInterval; + +/** * Open a new UDateIntervalFormat object using the predefined rules for a * given locale plus a specified skeleton. * @param locale @@ -131,53 +131,53 @@ udtitvfmt_open(const char* locale, U_STABLE void U_EXPORT2 udtitvfmt_close(UDateIntervalFormat *formatter); -/** - * Creates an object to hold the result of a UDateIntervalFormat - * operation. The object can be used repeatedly; it is cleared whenever - * passed to a format function. - * - * @param ec Set if an error occurs. - * @return A pointer needing ownership. - * @stable ICU 64 - */ -U_CAPI UFormattedDateInterval* U_EXPORT2 -udtitvfmt_openResult(UErrorCode* ec); - -/** - * Returns a representation of a UFormattedDateInterval as a UFormattedValue, - * which can be subsequently passed to any API requiring that type. - * - * The returned object is owned by the UFormattedDateInterval and is valid - * only as long as the UFormattedDateInterval is present and unchanged in memory. - * - * You can think of this method as a cast between types. - * - * When calling ufmtval_nextPosition(): - * The fields are returned from left to right. The special field category - * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime - * primitives came from which arguments: 0 means fromCalendar, and 1 means - * toCalendar. The span category will always occur before the - * corresponding fields in UFIELD_CATEGORY_DATE - * in the ufmtval_nextPosition() iterator. - * - * @param uresult The object containing the formatted string. - * @param ec Set if an error occurs. - * @return A UFormattedValue owned by the input object. - * @stable ICU 64 - */ -U_CAPI const UFormattedValue* U_EXPORT2 -udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec); - -/** - * Releases the UFormattedDateInterval created by udtitvfmt_openResult(). - * - * @param uresult The object to release. - * @stable ICU 64 - */ -U_CAPI void U_EXPORT2 -udtitvfmt_closeResult(UFormattedDateInterval* uresult); - +/** + * Creates an object to hold the result of a UDateIntervalFormat + * operation. The object can be used repeatedly; it is cleared whenever + * passed to a format function. + * + * @param ec Set if an error occurs. + * @return A pointer needing ownership. + * @stable ICU 64 + */ +U_CAPI UFormattedDateInterval* U_EXPORT2 +udtitvfmt_openResult(UErrorCode* ec); +/** + * Returns a representation of a UFormattedDateInterval as a UFormattedValue, + * which can be subsequently passed to any API requiring that type. + * + * The returned object is owned by the UFormattedDateInterval and is valid + * only as long as the UFormattedDateInterval is present and unchanged in memory. + * + * You can think of this method as a cast between types. + * + * When calling ufmtval_nextPosition(): + * The fields are returned from left to right. The special field category + * UFIELD_CATEGORY_DATE_INTERVAL_SPAN is used to indicate which datetime + * primitives came from which arguments: 0 means fromCalendar, and 1 means + * toCalendar. The span category will always occur before the + * corresponding fields in UFIELD_CATEGORY_DATE + * in the ufmtval_nextPosition() iterator. + * + * @param uresult The object containing the formatted string. + * @param ec Set if an error occurs. + * @return A UFormattedValue owned by the input object. + * @stable ICU 64 + */ +U_CAPI const UFormattedValue* U_EXPORT2 +udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec); + +/** + * Releases the UFormattedDateInterval created by udtitvfmt_openResult(). + * + * @param uresult The object to release. + * @stable ICU 64 + */ +U_CAPI void U_EXPORT2 +udtitvfmt_closeResult(UFormattedDateInterval* uresult); + + #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN @@ -193,17 +193,17 @@ U_NAMESPACE_BEGIN */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close); -/** - * \class LocalUFormattedDateIntervalPointer - * "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 64 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult); - +/** + * \class LocalUFormattedDateIntervalPointer + * "Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 64 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult); + U_NAMESPACE_END #endif @@ -247,59 +247,59 @@ udtitvfmt_format(const UDateIntervalFormat* formatter, UFieldPosition* position, UErrorCode* status); - -#ifndef U_HIDE_DRAFT_API -/** - * Formats a date/time range using the conventions established for the - * UDateIntervalFormat object. - * @param formatter - * The UDateIntervalFormat object specifying the format conventions. - * @param fromDate - * The starting point of the range. - * @param toDate - * The ending point of the range. - * @param result - * The UFormattedDateInterval to contain the result of the - * formatting operation. - * @param status - * A pointer to a UErrorCode to receive any errors. - * @draft ICU 67 - */ -U_DRAFT void U_EXPORT2 -udtitvfmt_formatToResult( - const UDateIntervalFormat* formatter, - UDate fromDate, - UDate toDate, - UFormattedDateInterval* result, - UErrorCode* status); - -/** - * Formats a date/time range using the conventions established for the - * UDateIntervalFormat object. - * @param formatter - * The UDateIntervalFormat object specifying the format conventions. - * @param fromCalendar - * The starting point of the range. - * @param toCalendar - * The ending point of the range. - * @param result - * The UFormattedDateInterval to contain the result of the - * formatting operation. - * @param status - * A pointer to a UErrorCode to receive any errors. - * @draft ICU 67 - */ - -U_DRAFT void U_EXPORT2 -udtitvfmt_formatCalendarToResult( - const UDateIntervalFormat* formatter, - UCalendar* fromCalendar, - UCalendar* toCalendar, - UFormattedDateInterval* result, - UErrorCode* status); -#endif /* U_HIDE_DRAFT_API */ - - + +#ifndef U_HIDE_DRAFT_API +/** + * Formats a date/time range using the conventions established for the + * UDateIntervalFormat object. + * @param formatter + * The UDateIntervalFormat object specifying the format conventions. + * @param fromDate + * The starting point of the range. + * @param toDate + * The ending point of the range. + * @param result + * The UFormattedDateInterval to contain the result of the + * formatting operation. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @draft ICU 67 + */ +U_DRAFT void U_EXPORT2 +udtitvfmt_formatToResult( + const UDateIntervalFormat* formatter, + UDate fromDate, + UDate toDate, + UFormattedDateInterval* result, + UErrorCode* status); + +/** + * Formats a date/time range using the conventions established for the + * UDateIntervalFormat object. + * @param formatter + * The UDateIntervalFormat object specifying the format conventions. + * @param fromCalendar + * The starting point of the range. + * @param toCalendar + * The ending point of the range. + * @param result + * The UFormattedDateInterval to contain the result of the + * formatting operation. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @draft ICU 67 + */ + +U_DRAFT void U_EXPORT2 +udtitvfmt_formatCalendarToResult( + const UDateIntervalFormat* formatter, + UCalendar* fromCalendar, + UCalendar* toCalendar, + UFormattedDateInterval* result, + UErrorCode* status); +#endif /* U_HIDE_DRAFT_API */ + + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif diff --git a/contrib/libs/icu/include/unicode/udatpg.h b/contrib/libs/icu/include/unicode/udatpg.h index 5abe1472a6..c59702cfd4 100644 --- a/contrib/libs/icu/include/unicode/udatpg.h +++ b/contrib/libs/icu/include/unicode/udatpg.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: udatpg.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -20,7 +20,7 @@ #define __UDATPG_H__ #include "unicode/utypes.h" -#include "unicode/udat.h" +#include "unicode/udat.h" #include "unicode/uenum.h" #include "unicode/localpointer.h" @@ -87,31 +87,31 @@ typedef enum UDateTimePatternField { /** @stable ICU 3.8 */ UDATPG_ZONE_FIELD, - /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, - * it is needed for layout of DateTimePatternGenerator object. */ -#ifndef U_FORCE_HIDE_DEPRECATED_API + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DateTimePatternGenerator object. */ +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * One more than the highest normal UDateTimePatternField value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDATPG_FIELD_COUNT -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API } UDateTimePatternField; /** - * Field display name width constants for udatpg_getFieldDisplayName(). - * @stable ICU 61 - */ -typedef enum UDateTimePGDisplayWidth { - /** @stable ICU 61 */ - UDATPG_WIDE, - /** @stable ICU 61 */ - UDATPG_ABBREVIATED, - /** @stable ICU 61 */ - UDATPG_NARROW -} UDateTimePGDisplayWidth; - -/** + * Field display name width constants for udatpg_getFieldDisplayName(). + * @stable ICU 61 + */ +typedef enum UDateTimePGDisplayWidth { + /** @stable ICU 61 */ + UDATPG_WIDE, + /** @stable ICU 61 */ + UDATPG_ABBREVIATED, + /** @stable ICU 61 */ + UDATPG_NARROW +} UDateTimePGDisplayWidth; + +/** * 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. @@ -426,14 +426,14 @@ udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, /** * Getter corresponding to setAppendItemNames. Values below 0 or at or above - * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function - * for getting date/time field display names is udatpg_getFieldDisplayName. + * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function + * for getting date/time field display names is udatpg_getFieldDisplayName. * * @param dtpg a pointer to UDateTimePatternGenerator. * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD * @param pLength A pointer that will receive the length of the name for field. * @return name for field - * @see udatpg_getFieldDisplayName + * @see udatpg_getFieldDisplayName * @stable ICU 3.8 */ U_STABLE const UChar * U_EXPORT2 @@ -442,38 +442,38 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, int32_t *pLength); /** - * The general interface to get a display name for a particular date/time field, - * in one of several possible display widths. - * - * @param dtpg - * A pointer to the UDateTimePatternGenerator object with the localized - * display names. - * @param field - * The desired UDateTimePatternField, such as UDATPG_ERA_FIELD. - * @param width - * The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED. - * @param fieldName - * A pointer to a buffer to receive the NULL-terminated display name. If the name - * fits into fieldName but cannot be NULL-terminated (length == capacity) then - * the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't - * fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR. - * @param capacity - * The size of fieldName (in UChars). - * @param pErrorCode - * A pointer to a UErrorCode to receive any errors - * @return - * The full length of the name; if greater than capacity, fieldName contains a - * truncated result. - * @stable ICU 61 - */ -U_STABLE int32_t U_EXPORT2 -udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, - UDateTimePatternField field, - UDateTimePGDisplayWidth width, - UChar *fieldName, int32_t capacity, - UErrorCode *pErrorCode); - -/** + * The general interface to get a display name for a particular date/time field, + * in one of several possible display widths. + * + * @param dtpg + * A pointer to the UDateTimePatternGenerator object with the localized + * display names. + * @param field + * The desired UDateTimePatternField, such as UDATPG_ERA_FIELD. + * @param width + * The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED. + * @param fieldName + * A pointer to a buffer to receive the NULL-terminated display name. If the name + * fits into fieldName but cannot be NULL-terminated (length == capacity) then + * the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't + * fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * @param capacity + * The size of fieldName (in UChars). + * @param pErrorCode + * A pointer to a UErrorCode to receive any errors + * @return + * The full length of the name; if greater than capacity, fieldName contains a + * truncated result. + * @stable ICU 61 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg, + UDateTimePatternField field, + UDateTimePGDisplayWidth width, + UChar *fieldName, int32_t capacity, + UErrorCode *pErrorCode); + +/** * The DateTimeFormat is a message format pattern used to compose date and * time patterns. The default pattern in the root locale is "{1} {0}", where * {1} will be replaced by the date pattern and {0} will be replaced by the @@ -652,26 +652,26 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength); -#if !UCONFIG_NO_FORMATTING - -#ifndef U_HIDE_DRAFT_API -/** - * Return the default hour cycle for a locale. Uses the locale that the - * UDateTimePatternGenerator was initially created with. - * - * Cannot be used on an empty UDateTimePatternGenerator instance. - * - * @param dtpg a pointer to UDateTimePatternGenerator. - * @param pErrorCode a pointer to the UErrorCode which must not indicate a - * failure before the function call. Set to U_UNSUPPORTED_ERROR - * if used on an empty instance. - * @return the default hour cycle. - * @draft ICU 67 - */ -U_DRAFT UDateFormatHourCycle U_EXPORT2 -udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode); -#endif /* U_HIDE_DRAFT_API */ - -#endif /* #if !UCONFIG_NO_FORMATTING */ - +#if !UCONFIG_NO_FORMATTING + +#ifndef U_HIDE_DRAFT_API +/** + * Return the default hour cycle for a locale. Uses the locale that the + * UDateTimePatternGenerator was initially created with. + * + * Cannot be used on an empty UDateTimePatternGenerator instance. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. Set to U_UNSUPPORTED_ERROR + * if used on an empty instance. + * @return the default hour cycle. + * @draft ICU 67 + */ +U_DRAFT UDateFormatHourCycle U_EXPORT2 +udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode); +#endif /* U_HIDE_DRAFT_API */ + +#endif /* #if !UCONFIG_NO_FORMATTING */ + #endif diff --git a/contrib/libs/icu/include/unicode/udisplaycontext.h b/contrib/libs/icu/include/unicode/udisplaycontext.h index 398481c681..269b37407f 100644 --- a/contrib/libs/icu/include/unicode/udisplaycontext.h +++ b/contrib/libs/icu/include/unicode/udisplaycontext.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -47,7 +47,7 @@ enum UDisplayContextType { /** * Type to retrieve the substitute handling setting, e.g. * UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE. - * @stable ICU 58 + * @stable ICU 58 */ UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3 }; @@ -151,13 +151,13 @@ enum UDisplayContext { * A possible setting for SUBSTITUTE_HANDLING: * Returns a fallback value (e.g., the input code) when no data is available. * This is the default value. - * @stable ICU 58 + * @stable ICU 58 */ UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, /** * A possible setting for SUBSTITUTE_HANDLING: * Returns a null value when no data is available. - * @stable ICU 58 + * @stable ICU 58 */ UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 diff --git a/contrib/libs/icu/include/unicode/uenum.h b/contrib/libs/icu/include/unicode/uenum.h index c670eeafb1..08f5425bb4 100644 --- a/contrib/libs/icu/include/unicode/uenum.h +++ b/contrib/libs/icu/include/unicode/uenum.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uenum.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:2 * @@ -23,9 +23,9 @@ #include "unicode/localpointer.h" #if U_SHOW_CPLUSPLUS_API -U_NAMESPACE_BEGIN -class StringEnumeration; -U_NAMESPACE_END +U_NAMESPACE_BEGIN +class StringEnumeration; +U_NAMESPACE_END #endif /** diff --git a/contrib/libs/icu/include/unicode/ufieldpositer.h b/contrib/libs/icu/include/unicode/ufieldpositer.h index 3ae73b6d84..6d8686cc3d 100644 --- a/contrib/libs/icu/include/unicode/ufieldpositer.h +++ b/contrib/libs/icu/include/unicode/ufieldpositer.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** diff --git a/contrib/libs/icu/include/unicode/uformattable.h b/contrib/libs/icu/include/unicode/uformattable.h index 9ba2a36901..bca50e699c 100644 --- a/contrib/libs/icu/include/unicode/uformattable.h +++ b/contrib/libs/icu/include/unicode/uformattable.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** @@ -57,7 +57,7 @@ typedef enum UFormattableType { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UFMT_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UFormattableType; diff --git a/contrib/libs/icu/include/unicode/uformattedvalue.h b/contrib/libs/icu/include/unicode/uformattedvalue.h index 07f4281f57..bb3235846e 100644 --- a/contrib/libs/icu/include/unicode/uformattedvalue.h +++ b/contrib/libs/icu/include/unicode/uformattedvalue.h @@ -1,438 +1,438 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#ifndef __UFORMATTEDVALUE_H__ -#define __UFORMATTEDVALUE_H__ - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/ufieldpositer.h" - -/** - * \file - * \brief C API: Abstract operations for localized strings. - * - * This file contains declarations for classes that deal with formatted strings. A number - * of APIs throughout ICU use these classes for expressing their localized output. - */ - - -/** - * All possible field categories in ICU. Every entry in this enum corresponds - * to another enum that exists in ICU. - * - * In the APIs that take a UFieldCategory, an int32_t type is used. Field - * categories having any of the top four bits turned on are reserved as - * private-use for external APIs implementing FormattedValue. This means that - * categories 2^28 and higher or below zero (with the highest bit turned on) - * are private-use and will not be used by ICU in the future. - * - * @stable ICU 64 - */ -typedef enum UFieldCategory { - /** - * For an undefined field category. +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#ifndef __UFORMATTEDVALUE_H__ +#define __UFORMATTEDVALUE_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/ufieldpositer.h" + +/** + * \file + * \brief C API: Abstract operations for localized strings. + * + * This file contains declarations for classes that deal with formatted strings. A number + * of APIs throughout ICU use these classes for expressing their localized output. + */ + + +/** + * All possible field categories in ICU. Every entry in this enum corresponds + * to another enum that exists in ICU. + * + * In the APIs that take a UFieldCategory, an int32_t type is used. Field + * categories having any of the top four bits turned on are reserved as + * private-use for external APIs implementing FormattedValue. This means that + * categories 2^28 and higher or below zero (with the highest bit turned on) + * are private-use and will not be used by ICU in the future. + * + * @stable ICU 64 + */ +typedef enum UFieldCategory { + /** + * For an undefined field category. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_UNDEFINED = 0, + + /** + * For fields in UDateFormatField (udat.h), from ICU 3.0. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_DATE, + + /** + * For fields in UNumberFormatFields (unum.h), from ICU 49. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_NUMBER, + + /** + * For fields in UListFormatterField (ulistformatter.h), from ICU 63. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_LIST, + + /** + * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_RELATIVE_DATETIME, + + /** + * Reserved for possible future fields in UDateIntervalFormatField. + * + * @internal + */ + UFIELD_CATEGORY_DATE_INTERVAL, + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + UFIELD_CATEGORY_COUNT, +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Category for spans in a list. + * + * @stable ICU 64 + */ + UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST, + + /** + * Category for spans in a date interval. * - * @stable ICU 64 - */ - UFIELD_CATEGORY_UNDEFINED = 0, - - /** - * For fields in UDateFormatField (udat.h), from ICU 3.0. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_DATE, - - /** - * For fields in UNumberFormatFields (unum.h), from ICU 49. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_NUMBER, - - /** - * For fields in UListFormatterField (ulistformatter.h), from ICU 63. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_LIST, - - /** - * For fields in URelativeDateTimeFormatterField (ureldatefmt.h), from ICU 64. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_RELATIVE_DATETIME, - - /** - * Reserved for possible future fields in UDateIntervalFormatField. - * - * @internal - */ - UFIELD_CATEGORY_DATE_INTERVAL, - -#ifndef U_HIDE_INTERNAL_API - /** @internal */ - UFIELD_CATEGORY_COUNT, -#endif /* U_HIDE_INTERNAL_API */ - - /** - * Category for spans in a list. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_LIST_SPAN = 0x1000 + UFIELD_CATEGORY_LIST, - - /** - * Category for spans in a date interval. - * - * @stable ICU 64 - */ - UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL, - -} UFieldCategory; - - -struct UConstrainedFieldPosition; -/** - * Represents a span of a string containing a given field. - * - * This struct differs from UFieldPosition in the following ways: - * - * 1. It has information on the field category. - * 2. It allows you to set constraints to use when iterating over field positions. - * 3. It is used for the newer FormattedValue APIs. - * - * @stable ICU 64 - */ -typedef struct UConstrainedFieldPosition UConstrainedFieldPosition; - - -/** - * Creates a new UConstrainedFieldPosition. - * - * By default, the UConstrainedFieldPosition has no iteration constraints. - * - * @param ec Set if an error occurs. - * @return The new object, or NULL if an error occurs. - * @stable ICU 64 - */ -U_STABLE UConstrainedFieldPosition* U_EXPORT2 -ucfpos_open(UErrorCode* ec); - - -/** - * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created. - * - * Removes any constraints that may have been set on the instance. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_reset( - UConstrainedFieldPosition* ucfpos, - UErrorCode* ec); - - -/** - * Destroys a UConstrainedFieldPosition and releases its memory. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_close(UConstrainedFieldPosition* ucfpos); - - -/** - * Sets a constraint on the field category. - * - * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition, - * positions are skipped unless they have the given category. - * - * Any previously set constraints are cleared. - * - * For example, to loop over only the number-related fields: - * - * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); - * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec); - * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { - * // handle the number-related field position - * } - * ucfpos_close(ucfpos); - * - * Changing the constraint while in the middle of iterating over a FormattedValue - * does not generally have well-defined behavior. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param category The field category to fix when iterating. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_constrainCategory( - UConstrainedFieldPosition* ucfpos, - int32_t category, - UErrorCode* ec); - - -/** - * Sets a constraint on the category and field. - * - * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition, - * positions are skipped unless they have the given category and field. - * - * Any previously set constraints are cleared. - * - * For example, to loop over all grouping separators: - * - * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); - * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec); - * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { - * // handle the grouping separator position - * } - * ucfpos_close(ucfpos); - * - * Changing the constraint while in the middle of iterating over a FormattedValue - * does not generally have well-defined behavior. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param category The field category to fix when iterating. - * @param field The field to fix when iterating. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_constrainField( - UConstrainedFieldPosition* ucfpos, - int32_t category, - int32_t field, - UErrorCode* ec); - - -/** - * Gets the field category for the current position. - * - * If a category or field constraint was set, this function returns the constrained - * category. Otherwise, the return value is well-defined only after - * ufmtval_nextPosition returns TRUE. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param ec Set if an error occurs. - * @return The field category saved in the instance. - * @stable ICU 64 - */ -U_STABLE int32_t U_EXPORT2 -ucfpos_getCategory( - const UConstrainedFieldPosition* ucfpos, - UErrorCode* ec); - - -/** - * Gets the field for the current position. - * - * If a field constraint was set, this function returns the constrained - * field. Otherwise, the return value is well-defined only after - * ufmtval_nextPosition returns TRUE. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param ec Set if an error occurs. - * @return The field saved in the instance. - * @stable ICU 64 - */ -U_STABLE int32_t U_EXPORT2 -ucfpos_getField( - const UConstrainedFieldPosition* ucfpos, - UErrorCode* ec); - - -/** - * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position. - * - * The output values are well-defined only after ufmtval_nextPosition returns TRUE. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param pStart Set to the start index saved in the instance. Ignored if nullptr. - * @param pLimit Set to the end index saved in the instance. Ignored if nullptr. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_getIndexes( - const UConstrainedFieldPosition* ucfpos, - int32_t* pStart, - int32_t* pLimit, - UErrorCode* ec); - - -/** - * Gets an int64 that FormattedValue implementations may use for storage. - * - * The initial value is zero. - * - * Users of FormattedValue should not need to call this method. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param ec Set if an error occurs. - * @return The current iteration context from ucfpos_setInt64IterationContext. - * @stable ICU 64 - */ -U_STABLE int64_t U_EXPORT2 -ucfpos_getInt64IterationContext( - const UConstrainedFieldPosition* ucfpos, - UErrorCode* ec); - - -/** - * Sets an int64 that FormattedValue implementations may use for storage. - * - * Intended to be used by FormattedValue implementations. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param context The new iteration context. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_setInt64IterationContext( - UConstrainedFieldPosition* ucfpos, - int64_t context, - UErrorCode* ec); - - -/** - * Determines whether a given field should be included given the - * constraints. - * - * Intended to be used by FormattedValue implementations. - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param category The category to test. - * @param field The field to test. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE UBool U_EXPORT2 -ucfpos_matchesField( - const UConstrainedFieldPosition* ucfpos, - int32_t category, - int32_t field, - UErrorCode* ec); - - -/** - * Sets new values for the primary public getters. - * - * Intended to be used by FormattedValue implementations. - * - * It is up to the implementation to ensure that the user-requested - * constraints are satisfied. This method does not check! - * - * @param ucfpos The instance of UConstrainedFieldPosition. - * @param category The new field category. - * @param field The new field. - * @param start The new inclusive start index. - * @param limit The new exclusive end index. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ucfpos_setState( - UConstrainedFieldPosition* ucfpos, - int32_t category, - int32_t field, - int32_t start, - int32_t limit, - UErrorCode* ec); - - -struct UFormattedValue; -/** - * An abstract formatted value: a string with associated field attributes. - * Many formatters format to types compatible with UFormattedValue. - * - * @stable ICU 64 - */ -typedef struct UFormattedValue UFormattedValue; - - -/** - * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The - * return value is valid only as long as the UFormattedValue is present and unchanged in memory. - * - * The return value is NUL-terminated but could contain internal NULs. - * - * @param ufmtval - * The object containing the formatted string and attributes. - * @param pLength Output variable for the length of the string. Ignored if NULL. - * @param ec Set if an error occurs. - * @return A NUL-terminated char16 string owned by the UFormattedValue. - * @stable ICU 64 - */ -U_STABLE const UChar* U_EXPORT2 -ufmtval_getString( - const UFormattedValue* ufmtval, - int32_t* pLength, - UErrorCode* ec); - - -/** - * Iterates over field positions in the UFormattedValue. This lets you determine the position - * of specific types of substrings, like a month or a decimal separator. - * - * To loop over all field positions: - * - * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); - * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { - * // handle the field position; get information from ucfpos - * } - * ucfpos_close(ucfpos); - * - * @param ufmtval - * The object containing the formatted string and attributes. - * @param ucfpos - * The object used for iteration state; can provide constraints to iterate over only - * one specific category or field; - * see ucfpos_constrainCategory - * and ucfpos_constrainField. - * @param ec Set if an error occurs. - * @return TRUE if another position was found; FALSE otherwise. - * @stable ICU 64 - */ -U_STABLE UBool U_EXPORT2 -ufmtval_nextPosition( - const UFormattedValue* ufmtval, - UConstrainedFieldPosition* ucfpos, - UErrorCode* ec); - - -#if U_SHOW_CPLUSPLUS_API -U_NAMESPACE_BEGIN - -/** - * \class LocalUConstrainedFieldPositionPointer - * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close(). - * For most methods see the LocalPointerBase base class. - * - * Usage: - * - * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec)); - * // no need to explicitly call ucfpos_close() - * - * @stable ICU 64 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer, - UConstrainedFieldPosition, - ucfpos_close); - -U_NAMESPACE_END -#endif // U_SHOW_CPLUSPLUS_API - - -#endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // __UFORMATTEDVALUE_H__ + * @stable ICU 64 + */ + UFIELD_CATEGORY_DATE_INTERVAL_SPAN = 0x1000 + UFIELD_CATEGORY_DATE_INTERVAL, + +} UFieldCategory; + + +struct UConstrainedFieldPosition; +/** + * Represents a span of a string containing a given field. + * + * This struct differs from UFieldPosition in the following ways: + * + * 1. It has information on the field category. + * 2. It allows you to set constraints to use when iterating over field positions. + * 3. It is used for the newer FormattedValue APIs. + * + * @stable ICU 64 + */ +typedef struct UConstrainedFieldPosition UConstrainedFieldPosition; + + +/** + * Creates a new UConstrainedFieldPosition. + * + * By default, the UConstrainedFieldPosition has no iteration constraints. + * + * @param ec Set if an error occurs. + * @return The new object, or NULL if an error occurs. + * @stable ICU 64 + */ +U_STABLE UConstrainedFieldPosition* U_EXPORT2 +ucfpos_open(UErrorCode* ec); + + +/** + * Resets a UConstrainedFieldPosition to its initial state, as if it were newly created. + * + * Removes any constraints that may have been set on the instance. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_reset( + UConstrainedFieldPosition* ucfpos, + UErrorCode* ec); + + +/** + * Destroys a UConstrainedFieldPosition and releases its memory. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_close(UConstrainedFieldPosition* ucfpos); + + +/** + * Sets a constraint on the field category. + * + * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition, + * positions are skipped unless they have the given category. + * + * Any previously set constraints are cleared. + * + * For example, to loop over only the number-related fields: + * + * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); + * ucfpos_constrainCategory(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, ec); + * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { + * // handle the number-related field position + * } + * ucfpos_close(ucfpos); + * + * Changing the constraint while in the middle of iterating over a FormattedValue + * does not generally have well-defined behavior. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param category The field category to fix when iterating. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_constrainCategory( + UConstrainedFieldPosition* ucfpos, + int32_t category, + UErrorCode* ec); + + +/** + * Sets a constraint on the category and field. + * + * When this instance of UConstrainedFieldPosition is passed to ufmtval_nextPosition, + * positions are skipped unless they have the given category and field. + * + * Any previously set constraints are cleared. + * + * For example, to loop over all grouping separators: + * + * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); + * ucfpos_constrainField(ucfpos, UFIELDCATEGORY_NUMBER_FORMAT, UNUM_GROUPING_SEPARATOR_FIELD, ec); + * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { + * // handle the grouping separator position + * } + * ucfpos_close(ucfpos); + * + * Changing the constraint while in the middle of iterating over a FormattedValue + * does not generally have well-defined behavior. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param category The field category to fix when iterating. + * @param field The field to fix when iterating. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_constrainField( + UConstrainedFieldPosition* ucfpos, + int32_t category, + int32_t field, + UErrorCode* ec); + + +/** + * Gets the field category for the current position. + * + * If a category or field constraint was set, this function returns the constrained + * category. Otherwise, the return value is well-defined only after + * ufmtval_nextPosition returns TRUE. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param ec Set if an error occurs. + * @return The field category saved in the instance. + * @stable ICU 64 + */ +U_STABLE int32_t U_EXPORT2 +ucfpos_getCategory( + const UConstrainedFieldPosition* ucfpos, + UErrorCode* ec); + + +/** + * Gets the field for the current position. + * + * If a field constraint was set, this function returns the constrained + * field. Otherwise, the return value is well-defined only after + * ufmtval_nextPosition returns TRUE. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param ec Set if an error occurs. + * @return The field saved in the instance. + * @stable ICU 64 + */ +U_STABLE int32_t U_EXPORT2 +ucfpos_getField( + const UConstrainedFieldPosition* ucfpos, + UErrorCode* ec); + + +/** + * Gets the INCLUSIVE start and EXCLUSIVE end index stored for the current position. + * + * The output values are well-defined only after ufmtval_nextPosition returns TRUE. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param pStart Set to the start index saved in the instance. Ignored if nullptr. + * @param pLimit Set to the end index saved in the instance. Ignored if nullptr. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_getIndexes( + const UConstrainedFieldPosition* ucfpos, + int32_t* pStart, + int32_t* pLimit, + UErrorCode* ec); + + +/** + * Gets an int64 that FormattedValue implementations may use for storage. + * + * The initial value is zero. + * + * Users of FormattedValue should not need to call this method. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param ec Set if an error occurs. + * @return The current iteration context from ucfpos_setInt64IterationContext. + * @stable ICU 64 + */ +U_STABLE int64_t U_EXPORT2 +ucfpos_getInt64IterationContext( + const UConstrainedFieldPosition* ucfpos, + UErrorCode* ec); + + +/** + * Sets an int64 that FormattedValue implementations may use for storage. + * + * Intended to be used by FormattedValue implementations. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param context The new iteration context. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_setInt64IterationContext( + UConstrainedFieldPosition* ucfpos, + int64_t context, + UErrorCode* ec); + + +/** + * Determines whether a given field should be included given the + * constraints. + * + * Intended to be used by FormattedValue implementations. + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param category The category to test. + * @param field The field to test. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE UBool U_EXPORT2 +ucfpos_matchesField( + const UConstrainedFieldPosition* ucfpos, + int32_t category, + int32_t field, + UErrorCode* ec); + + +/** + * Sets new values for the primary public getters. + * + * Intended to be used by FormattedValue implementations. + * + * It is up to the implementation to ensure that the user-requested + * constraints are satisfied. This method does not check! + * + * @param ucfpos The instance of UConstrainedFieldPosition. + * @param category The new field category. + * @param field The new field. + * @param start The new inclusive start index. + * @param limit The new exclusive end index. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ucfpos_setState( + UConstrainedFieldPosition* ucfpos, + int32_t category, + int32_t field, + int32_t start, + int32_t limit, + UErrorCode* ec); + + +struct UFormattedValue; +/** + * An abstract formatted value: a string with associated field attributes. + * Many formatters format to types compatible with UFormattedValue. + * + * @stable ICU 64 + */ +typedef struct UFormattedValue UFormattedValue; + + +/** + * Returns a pointer to the formatted string. The pointer is owned by the UFormattedValue. The + * return value is valid only as long as the UFormattedValue is present and unchanged in memory. + * + * The return value is NUL-terminated but could contain internal NULs. + * + * @param ufmtval + * The object containing the formatted string and attributes. + * @param pLength Output variable for the length of the string. Ignored if NULL. + * @param ec Set if an error occurs. + * @return A NUL-terminated char16 string owned by the UFormattedValue. + * @stable ICU 64 + */ +U_STABLE const UChar* U_EXPORT2 +ufmtval_getString( + const UFormattedValue* ufmtval, + int32_t* pLength, + UErrorCode* ec); + + +/** + * Iterates over field positions in the UFormattedValue. This lets you determine the position + * of specific types of substrings, like a month or a decimal separator. + * + * To loop over all field positions: + * + * UConstrainedFieldPosition* ucfpos = ucfpos_open(ec); + * while (ufmtval_nextPosition(ufmtval, ucfpos, ec)) { + * // handle the field position; get information from ucfpos + * } + * ucfpos_close(ucfpos); + * + * @param ufmtval + * The object containing the formatted string and attributes. + * @param ucfpos + * The object used for iteration state; can provide constraints to iterate over only + * one specific category or field; + * see ucfpos_constrainCategory + * and ucfpos_constrainField. + * @param ec Set if an error occurs. + * @return TRUE if another position was found; FALSE otherwise. + * @stable ICU 64 + */ +U_STABLE UBool U_EXPORT2 +ufmtval_nextPosition( + const UFormattedValue* ufmtval, + UConstrainedFieldPosition* ucfpos, + UErrorCode* ec); + + +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN + +/** + * \class LocalUConstrainedFieldPositionPointer + * "Smart pointer" class; closes a UConstrainedFieldPosition via ucfpos_close(). + * For most methods see the LocalPointerBase base class. + * + * Usage: + * + * LocalUConstrainedFieldPositionPointer ucfpos(ucfpos_open(ec)); + * // no need to explicitly call ucfpos_close() + * + * @stable ICU 64 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConstrainedFieldPositionPointer, + UConstrainedFieldPosition, + ucfpos_close); + +U_NAMESPACE_END +#endif // U_SHOW_CPLUSPLUS_API + + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif // __UFORMATTEDVALUE_H__ diff --git a/contrib/libs/icu/include/unicode/ugender.h b/contrib/libs/icu/include/unicode/ugender.h index 903f3dd5de..3d5660f18b 100644 --- a/contrib/libs/icu/include/unicode/ugender.h +++ b/contrib/libs/icu/include/unicode/ugender.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -49,7 +49,7 @@ enum UGender { */ typedef enum UGender UGender; -struct UGenderInfo; +struct UGenderInfo; /** * Opaque UGenderInfo object for use in C programs. * @stable ICU 50 @@ -77,7 +77,7 @@ ugender_getInstance(const char *locale, UErrorCode *status); * @stable ICU 50 */ U_STABLE UGender U_EXPORT2 -ugender_getListGender(const UGenderInfo* genderInfo, const UGender *genders, int32_t size, UErrorCode *status); +ugender_getListGender(const UGenderInfo* genderInfo, const UGender *genders, int32_t size, UErrorCode *status); #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/contrib/libs/icu/include/unicode/uidna.h b/contrib/libs/icu/include/unicode/uidna.h index 0dafb76201..2747f03818 100644 --- a/contrib/libs/icu/include/unicode/uidna.h +++ b/contrib/libs/icu/include/unicode/uidna.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uidna.h - * encoding: UTF-8 + * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/uiter.h b/contrib/libs/icu/include/unicode/uiter.h index 11ad75acd5..aa4dad732c 100644 --- a/contrib/libs/icu/include/unicode/uiter.h +++ b/contrib/libs/icu/include/unicode/uiter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uiter.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/uldnames.h b/contrib/libs/icu/include/unicode/uldnames.h index 3ebffa23db..2365a1dd62 100644 --- a/contrib/libs/icu/include/unicode/uldnames.h +++ b/contrib/libs/icu/include/unicode/uldnames.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* diff --git a/contrib/libs/icu/include/unicode/ulistformatter.h b/contrib/libs/icu/include/unicode/ulistformatter.h index 2bdf0f81f0..b10334240d 100644 --- a/contrib/libs/icu/include/unicode/ulistformatter.h +++ b/contrib/libs/icu/include/unicode/ulistformatter.h @@ -1,334 +1,334 @@ -// © 2016 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html -/* -***************************************************************************************** -* Copyright (C) 2015-2016, International Business Machines -* Corporation and others. All Rights Reserved. -***************************************************************************************** -*/ - -#ifndef ULISTFORMATTER_H -#define ULISTFORMATTER_H - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING - -#include "unicode/localpointer.h" -#include "unicode/uformattedvalue.h" - -/** - * \file - * \brief C API: Format a list in a locale-appropriate way. - * - * A UListFormatter is used to format a list of items in a locale-appropriate way, - * using data from CLDR. - * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted - * as "Alice, Bob, Charlie, and Delta" in English. - */ - -/** - * Opaque UListFormatter object for use in C - * @stable ICU 55 - */ -struct UListFormatter; -typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */ - -struct UFormattedList; -/** - * Opaque struct to contain the results of a UListFormatter operation. - * @stable ICU 64 - */ -typedef struct UFormattedList UFormattedList; - -/** - * FieldPosition and UFieldPosition selectors for format fields - * defined by ListFormatter. - * @stable ICU 63 - */ -typedef enum UListFormatterField { - /** - * The literal text in the result which came from the resources. - * @stable ICU 63 - */ - ULISTFMT_LITERAL_FIELD, - /** - * The element text in the result which came from the input strings. - * @stable ICU 63 - */ - ULISTFMT_ELEMENT_FIELD -} UListFormatterField; - -#ifndef U_HIDE_DRAFT_API -/** - * Type of meaning expressed by the list. - * - * @draft ICU 67 - */ -typedef enum UListFormatterType { - /** - * Conjunction formatting, e.g. "Alice, Bob, Charlie, and Delta". - * - * @draft ICU 67 - */ - ULISTFMT_TYPE_AND, - - /** - * Disjunction (or alternative, or simply one of) formatting, e.g. - * "Alice, Bob, Charlie, or Delta". - * - * @draft ICU 67 - */ - ULISTFMT_TYPE_OR, - - /** - * Formatting of a list of values with units, e.g. "5 pounds, 12 ounces". - * - * @draft ICU 67 - */ - ULISTFMT_TYPE_UNITS -} UListFormatterType; - -/** - * Verbosity level of the list patterns. - * - * @draft ICU 67 - */ -typedef enum UListFormatterWidth { - /** - * Use list formatting with full words (no abbreviations) when possible. - * - * @draft ICU 67 - */ - ULISTFMT_WIDTH_WIDE, - - /** - * Use list formatting of typical length. - * @draft ICU 67 - */ - ULISTFMT_WIDTH_SHORT, - - /** - * Use list formatting of the shortest possible length. - * @draft ICU 67 - */ - ULISTFMT_WIDTH_NARROW, -} UListFormatterWidth; -#endif /* U_HIDE_DRAFT_API */ - -/** - * Open a new UListFormatter object using the rules for a given locale. - * The object will be initialized with AND type and WIDE width. - * - * @param locale - * The locale whose rules should be used; may be NULL for - * default locale. - * @param status - * A pointer to a standard ICU UErrorCode (input/output parameter). - * Its input value must pass the U_SUCCESS() test, or else the - * function returns immediately. The caller should check its output - * value with U_FAILURE(), or use with function chaining (see User - * Guide for details). - * @return - * A pointer to a UListFormatter object for the specified locale, - * or NULL if an error occurred. - * @stable ICU 55 - */ -U_CAPI UListFormatter* U_EXPORT2 -ulistfmt_open(const char* locale, - UErrorCode* status); - -#ifndef U_HIDE_DRAFT_API -/** - * Open a new UListFormatter object appropriate for the given locale, list type, - * and style. - * - * @param locale - * The locale whose rules should be used; may be NULL for - * default locale. - * @param type - * The type of list formatting to use. - * @param width - * The width of formatting to use. - * @param status - * A pointer to a standard ICU UErrorCode (input/output parameter). - * Its input value must pass the U_SUCCESS() test, or else the - * function returns immediately. The caller should check its output - * value with U_FAILURE(), or use with function chaining (see User - * Guide for details). - * @return - * A pointer to a UListFormatter object for the specified locale, - * or NULL if an error occurred. - * @draft ICU 67 - */ -U_DRAFT UListFormatter* U_EXPORT2 -ulistfmt_openForType(const char* locale, UListFormatterType type, - UListFormatterWidth width, UErrorCode* status); -#endif /* U_HIDE_DRAFT_API */ - -/** - * Close a UListFormatter object. Once closed it may no longer be used. - * @param listfmt - * The UListFormatter object to close. - * @stable ICU 55 - */ -U_CAPI void U_EXPORT2 -ulistfmt_close(UListFormatter *listfmt); - -/** - * Creates an object to hold the result of a UListFormatter - * operation. The object can be used repeatedly; it is cleared whenever - * passed to a format function. - * - * @param ec Set if an error occurs. - * @return A pointer needing ownership. - * @stable ICU 64 - */ -U_CAPI UFormattedList* U_EXPORT2 -ulistfmt_openResult(UErrorCode* ec); - -/** - * Returns a representation of a UFormattedList as a UFormattedValue, - * which can be subsequently passed to any API requiring that type. - * - * The returned object is owned by the UFormattedList and is valid - * only as long as the UFormattedList is present and unchanged in memory. - * - * You can think of this method as a cast between types. - * - * When calling ufmtval_nextPosition(): - * The fields are returned from start to end. The special field category - * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument - * was inserted at the given position. The span category will - * always occur before the corresponding instance of UFIELD_CATEGORY_LIST - * in the ufmtval_nextPosition() iterator. - * - * @param uresult The object containing the formatted string. - * @param ec Set if an error occurs. - * @return A UFormattedValue owned by the input object. - * @stable ICU 64 - */ -U_CAPI const UFormattedValue* U_EXPORT2 -ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec); - -/** - * Releases the UFormattedList created by ulistfmt_openResult(). - * - * @param uresult The object to release. - * @stable ICU 64 - */ -U_CAPI void U_EXPORT2 -ulistfmt_closeResult(UFormattedList* uresult); - - -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUListFormatterPointer - * "Smart pointer" class, closes a UListFormatter via ulistfmt_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 55 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close); - -/** - * \class LocalUFormattedListPointer - * "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 64 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult); - -U_NAMESPACE_END - -#endif - -/** - * Formats a list of strings using the conventions established for the - * UListFormatter object. - * @param listfmt - * The UListFormatter object specifying the list conventions. - * @param strings - * An array of pointers to UChar strings; the array length is - * specified by stringCount. Must be non-NULL if stringCount > 0. - * @param stringLengths - * An array of string lengths corresponding to the strings[] - * parameter; any individual length value may be negative to indicate - * that the corresponding strings[] entry is 0-terminated, or - * stringLengths itself may be NULL if all of the strings are - * 0-terminated. If non-NULL, the stringLengths array must have - * stringCount entries. - * @param stringCount - * the number of entries in strings[], and the number of entries - * in the stringLengths array if it is not NULL. Must be >= 0. - * @param result - * A pointer to a buffer to receive the formatted list. - * @param resultCapacity - * The maximum size of result. - * @param status - * A pointer to a standard ICU UErrorCode (input/output parameter). - * Its input value must pass the U_SUCCESS() test, or else the - * function returns immediately. The caller should check its output - * value with U_FAILURE(), or use with function chaining (see User - * Guide for details). - * @return - * The total buffer size needed; if greater than resultLength, the - * output was truncated. May be <=0 if unable to determine the - * total buffer size needed (e.g. for illegal arguments). - * @stable ICU 55 - */ -U_CAPI int32_t U_EXPORT2 -ulistfmt_format(const UListFormatter* listfmt, - const UChar* const strings[], - const int32_t * stringLengths, - int32_t stringCount, - UChar* result, - int32_t resultCapacity, - UErrorCode* status); - -/** - * Formats a list of strings to a UFormattedList, which exposes more - * information than the string exported by ulistfmt_format(). - * - * @param listfmt - * The UListFormatter object specifying the list conventions. - * @param strings - * An array of pointers to UChar strings; the array length is - * specified by stringCount. Must be non-NULL if stringCount > 0. - * @param stringLengths - * An array of string lengths corresponding to the strings[] - * parameter; any individual length value may be negative to indicate - * that the corresponding strings[] entry is 0-terminated, or - * stringLengths itself may be NULL if all of the strings are - * 0-terminated. If non-NULL, the stringLengths array must have - * stringCount entries. - * @param stringCount - * the number of entries in strings[], and the number of entries - * in the stringLengths array if it is not NULL. Must be >= 0. - * @param uresult - * The object in which to store the result of the list formatting - * operation. See ulistfmt_openResult(). - * @param status - * Error code set if an error occurred during formatting. - * @stable ICU 64 - */ -U_CAPI void U_EXPORT2 -ulistfmt_formatStringsToResult( - const UListFormatter* listfmt, - const UChar* const strings[], - const int32_t * stringLengths, - int32_t stringCount, - UFormattedList* uresult, - UErrorCode* status); - -#endif /* #if !UCONFIG_NO_FORMATTING */ - -#endif +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2015-2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef ULISTFORMATTER_H +#define ULISTFORMATTER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" +#include "unicode/uformattedvalue.h" + +/** + * \file + * \brief C API: Format a list in a locale-appropriate way. + * + * A UListFormatter is used to format a list of items in a locale-appropriate way, + * using data from CLDR. + * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted + * as "Alice, Bob, Charlie, and Delta" in English. + */ + +/** + * Opaque UListFormatter object for use in C + * @stable ICU 55 + */ +struct UListFormatter; +typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */ + +struct UFormattedList; +/** + * Opaque struct to contain the results of a UListFormatter operation. + * @stable ICU 64 + */ +typedef struct UFormattedList UFormattedList; + +/** + * FieldPosition and UFieldPosition selectors for format fields + * defined by ListFormatter. + * @stable ICU 63 + */ +typedef enum UListFormatterField { + /** + * The literal text in the result which came from the resources. + * @stable ICU 63 + */ + ULISTFMT_LITERAL_FIELD, + /** + * The element text in the result which came from the input strings. + * @stable ICU 63 + */ + ULISTFMT_ELEMENT_FIELD +} UListFormatterField; + +#ifndef U_HIDE_DRAFT_API +/** + * Type of meaning expressed by the list. + * + * @draft ICU 67 + */ +typedef enum UListFormatterType { + /** + * Conjunction formatting, e.g. "Alice, Bob, Charlie, and Delta". + * + * @draft ICU 67 + */ + ULISTFMT_TYPE_AND, + + /** + * Disjunction (or alternative, or simply one of) formatting, e.g. + * "Alice, Bob, Charlie, or Delta". + * + * @draft ICU 67 + */ + ULISTFMT_TYPE_OR, + + /** + * Formatting of a list of values with units, e.g. "5 pounds, 12 ounces". + * + * @draft ICU 67 + */ + ULISTFMT_TYPE_UNITS +} UListFormatterType; + +/** + * Verbosity level of the list patterns. + * + * @draft ICU 67 + */ +typedef enum UListFormatterWidth { + /** + * Use list formatting with full words (no abbreviations) when possible. + * + * @draft ICU 67 + */ + ULISTFMT_WIDTH_WIDE, + + /** + * Use list formatting of typical length. + * @draft ICU 67 + */ + ULISTFMT_WIDTH_SHORT, + + /** + * Use list formatting of the shortest possible length. + * @draft ICU 67 + */ + ULISTFMT_WIDTH_NARROW, +} UListFormatterWidth; +#endif /* U_HIDE_DRAFT_API */ + +/** + * Open a new UListFormatter object using the rules for a given locale. + * The object will be initialized with AND type and WIDE width. + * + * @param locale + * The locale whose rules should be used; may be NULL for + * default locale. + * @param status + * A pointer to a standard ICU UErrorCode (input/output parameter). + * Its input value must pass the U_SUCCESS() test, or else the + * function returns immediately. The caller should check its output + * value with U_FAILURE(), or use with function chaining (see User + * Guide for details). + * @return + * A pointer to a UListFormatter object for the specified locale, + * or NULL if an error occurred. + * @stable ICU 55 + */ +U_CAPI UListFormatter* U_EXPORT2 +ulistfmt_open(const char* locale, + UErrorCode* status); + +#ifndef U_HIDE_DRAFT_API +/** + * Open a new UListFormatter object appropriate for the given locale, list type, + * and style. + * + * @param locale + * The locale whose rules should be used; may be NULL for + * default locale. + * @param type + * The type of list formatting to use. + * @param width + * The width of formatting to use. + * @param status + * A pointer to a standard ICU UErrorCode (input/output parameter). + * Its input value must pass the U_SUCCESS() test, or else the + * function returns immediately. The caller should check its output + * value with U_FAILURE(), or use with function chaining (see User + * Guide for details). + * @return + * A pointer to a UListFormatter object for the specified locale, + * or NULL if an error occurred. + * @draft ICU 67 + */ +U_DRAFT UListFormatter* U_EXPORT2 +ulistfmt_openForType(const char* locale, UListFormatterType type, + UListFormatterWidth width, UErrorCode* status); +#endif /* U_HIDE_DRAFT_API */ + +/** + * Close a UListFormatter object. Once closed it may no longer be used. + * @param listfmt + * The UListFormatter object to close. + * @stable ICU 55 + */ +U_CAPI void U_EXPORT2 +ulistfmt_close(UListFormatter *listfmt); + +/** + * Creates an object to hold the result of a UListFormatter + * operation. The object can be used repeatedly; it is cleared whenever + * passed to a format function. + * + * @param ec Set if an error occurs. + * @return A pointer needing ownership. + * @stable ICU 64 + */ +U_CAPI UFormattedList* U_EXPORT2 +ulistfmt_openResult(UErrorCode* ec); + +/** + * Returns a representation of a UFormattedList as a UFormattedValue, + * which can be subsequently passed to any API requiring that type. + * + * The returned object is owned by the UFormattedList and is valid + * only as long as the UFormattedList is present and unchanged in memory. + * + * You can think of this method as a cast between types. + * + * When calling ufmtval_nextPosition(): + * The fields are returned from start to end. The special field category + * UFIELD_CATEGORY_LIST_SPAN is used to indicate which argument + * was inserted at the given position. The span category will + * always occur before the corresponding instance of UFIELD_CATEGORY_LIST + * in the ufmtval_nextPosition() iterator. + * + * @param uresult The object containing the formatted string. + * @param ec Set if an error occurs. + * @return A UFormattedValue owned by the input object. + * @stable ICU 64 + */ +U_CAPI const UFormattedValue* U_EXPORT2 +ulistfmt_resultAsValue(const UFormattedList* uresult, UErrorCode* ec); + +/** + * Releases the UFormattedList created by ulistfmt_openResult(). + * + * @param uresult The object to release. + * @stable ICU 64 + */ +U_CAPI void U_EXPORT2 +ulistfmt_closeResult(UFormattedList* uresult); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUListFormatterPointer + * "Smart pointer" class, closes a UListFormatter via ulistfmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 55 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close); + +/** + * \class LocalUFormattedListPointer + * "Smart pointer" class, closes a UFormattedList via ulistfmt_closeResult(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 64 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedListPointer, UFormattedList, ulistfmt_closeResult); + +U_NAMESPACE_END + +#endif + +/** + * Formats a list of strings using the conventions established for the + * UListFormatter object. + * @param listfmt + * The UListFormatter object specifying the list conventions. + * @param strings + * An array of pointers to UChar strings; the array length is + * specified by stringCount. Must be non-NULL if stringCount > 0. + * @param stringLengths + * An array of string lengths corresponding to the strings[] + * parameter; any individual length value may be negative to indicate + * that the corresponding strings[] entry is 0-terminated, or + * stringLengths itself may be NULL if all of the strings are + * 0-terminated. If non-NULL, the stringLengths array must have + * stringCount entries. + * @param stringCount + * the number of entries in strings[], and the number of entries + * in the stringLengths array if it is not NULL. Must be >= 0. + * @param result + * A pointer to a buffer to receive the formatted list. + * @param resultCapacity + * The maximum size of result. + * @param status + * A pointer to a standard ICU UErrorCode (input/output parameter). + * Its input value must pass the U_SUCCESS() test, or else the + * function returns immediately. The caller should check its output + * value with U_FAILURE(), or use with function chaining (see User + * Guide for details). + * @return + * The total buffer size needed; if greater than resultLength, the + * output was truncated. May be <=0 if unable to determine the + * total buffer size needed (e.g. for illegal arguments). + * @stable ICU 55 + */ +U_CAPI int32_t U_EXPORT2 +ulistfmt_format(const UListFormatter* listfmt, + const UChar* const strings[], + const int32_t * stringLengths, + int32_t stringCount, + UChar* result, + int32_t resultCapacity, + UErrorCode* status); + +/** + * Formats a list of strings to a UFormattedList, which exposes more + * information than the string exported by ulistfmt_format(). + * + * @param listfmt + * The UListFormatter object specifying the list conventions. + * @param strings + * An array of pointers to UChar strings; the array length is + * specified by stringCount. Must be non-NULL if stringCount > 0. + * @param stringLengths + * An array of string lengths corresponding to the strings[] + * parameter; any individual length value may be negative to indicate + * that the corresponding strings[] entry is 0-terminated, or + * stringLengths itself may be NULL if all of the strings are + * 0-terminated. If non-NULL, the stringLengths array must have + * stringCount entries. + * @param stringCount + * the number of entries in strings[], and the number of entries + * in the stringLengths array if it is not NULL. Must be >= 0. + * @param uresult + * The object in which to store the result of the list formatting + * operation. See ulistfmt_openResult(). + * @param status + * Error code set if an error occurred during formatting. + * @stable ICU 64 + */ +U_CAPI void U_EXPORT2 +ulistfmt_formatStringsToResult( + const UListFormatter* listfmt, + const UChar* const strings[], + const int32_t * stringLengths, + int32_t stringCount, + UFormattedList* uresult, + UErrorCode* status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/contrib/libs/icu/include/unicode/uloc.h b/contrib/libs/icu/include/unicode/uloc.h index d877ce49af..ae6e2e38ca 100644 --- a/contrib/libs/icu/include/unicode/uloc.h +++ b/contrib/libs/icu/include/unicode/uloc.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -61,7 +61,7 @@ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a> * * <P> - * The second option includes an additional <STRONG>ISO Country + * The second option includes an additional <STRONG>ISO Country * Code.</STRONG> These codes are the upper-case two-letter codes * as defined by ISO-3166. * You can find a full list of these codes at a number of sites, such as: @@ -69,7 +69,7 @@ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a> * * <P> - * The third option requires another additional information--the + * The third option requires another additional information--the * <STRONG>Variant.</STRONG> * The Variant codes are vendor and browser-specific. * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. @@ -157,7 +157,7 @@ * <STRONG>just</STRONG> a mechanism for identifying these services. * * <P> - * Each international service that performs locale-sensitive operations + * Each international service that performs locale-sensitive operations * allows you * to get all the available objects of that type. You can sift * through these objects by language, country, or variant, @@ -539,9 +539,9 @@ uloc_getISO3Country(const char* localeID); * Gets the Win32 LCID value for the specified locale. * If the ICU locale is not recognized by Windows, 0 will be returned. * - * LCIDs were deprecated with Windows Vista and Microsoft recommends - * that developers use BCP47 style tags instead (uloc_toLanguageTag). - * + * LCIDs were deprecated with Windows Vista and Microsoft recommends + * that developers use BCP47 style tags instead (uloc_toLanguageTag). + * * @param localeID the locale to get the Win32 LCID value with * @return country the Win32 LCID for localeID * @stable ICU 2.0 @@ -580,7 +580,7 @@ uloc_getDisplayLanguage(const char* locale, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "", while passing Locale::getGerman() * for inLocale would result in "". NULL may be used to specify the default. - * @param script the displayable script for the localeID + * @param script the displayable script for the localeID * @param scriptCapacity the size of the script buffer to store the * displayable script code with * @param status error information if retrieving the displayable script code failed @@ -742,18 +742,18 @@ uloc_getDisplayName(const char* localeID, /** - * Gets the specified locale from a list of available locales. - * - * This method corresponds to uloc_openAvailableByType called with the - * ULOC_AVAILABLE_DEFAULT type argument. - * - * The return value is a pointer to an item of a locale name array. Both this - * array and the pointers it contains are owned by ICU and should not be - * deleted or written through by the caller. The locale name is terminated by - * a null pointer. - * - * @param n the specific locale name index of the available locale list; - * should not exceed the number returned by uloc_countAvailable. + * Gets the specified locale from a list of available locales. + * + * This method corresponds to uloc_openAvailableByType called with the + * ULOC_AVAILABLE_DEFAULT type argument. + * + * The return value is a pointer to an item of a locale name array. Both this + * array and the pointers it contains are owned by ICU and should not be + * deleted or written through by the caller. The locale name is terminated by + * a null pointer. + * + * @param n the specific locale name index of the available locale list; + * should not exceed the number returned by uloc_countAvailable. * @return a specified locale name of all available locales * @stable ICU 2.0 */ @@ -768,74 +768,74 @@ uloc_getAvailable(int32_t n); */ U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); -#ifndef U_HIDE_DRAFT_API - -/** - * Types for uloc_getAvailableByType and uloc_countAvailableByType. - * - * @draft ICU 65 - */ -typedef enum ULocAvailableType { - /** - * Locales that return data when passed to ICU APIs, - * but not including legacy or alias locales. - * - * @draft ICU 65 - */ - ULOC_AVAILABLE_DEFAULT, - - /** - * Legacy or alias locales that return data when passed to ICU APIs. - * Examples of supported legacy or alias locales: - * - * - iw (alias to he) - * - mo (alias to ro) - * - zh_CN (alias to zh_Hans_CN) - * - sr_BA (alias to sr_Cyrl_BA) - * - ars (alias to ar_SA) - * - * The locales in this set are disjoint from the ones in - * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use - * ULOC_AVAILABLE_WITH_LEGACY_ALIASES. - * - * @draft ICU 65 - */ - ULOC_AVAILABLE_ONLY_LEGACY_ALIASES, - - /** - * The union of the locales in ULOC_AVAILABLE_DEFAULT and - * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS. - * - * @draft ICU 65 - */ - ULOC_AVAILABLE_WITH_LEGACY_ALIASES, - -#ifndef U_HIDE_INTERNAL_API - /** - * @internal - */ - ULOC_AVAILABLE_COUNT -#endif -} ULocAvailableType; - -/** - * Gets a list of available locales according to the type argument, allowing - * the user to access different sets of supported locales in ICU. - * - * The returned UEnumeration must be closed by the caller. - * - * @param type Type choice from ULocAvailableType. - * @param status Set if an error occurred. - * @return a UEnumeration owned by the caller, or nullptr on failure. - * @draft ICU 65 - */ -U_DRAFT UEnumeration* U_EXPORT2 -uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); - -#endif // U_HIDE_DRAFT_API - +#ifndef U_HIDE_DRAFT_API + /** - * + * Types for uloc_getAvailableByType and uloc_countAvailableByType. + * + * @draft ICU 65 + */ +typedef enum ULocAvailableType { + /** + * Locales that return data when passed to ICU APIs, + * but not including legacy or alias locales. + * + * @draft ICU 65 + */ + ULOC_AVAILABLE_DEFAULT, + + /** + * Legacy or alias locales that return data when passed to ICU APIs. + * Examples of supported legacy or alias locales: + * + * - iw (alias to he) + * - mo (alias to ro) + * - zh_CN (alias to zh_Hans_CN) + * - sr_BA (alias to sr_Cyrl_BA) + * - ars (alias to ar_SA) + * + * The locales in this set are disjoint from the ones in + * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use + * ULOC_AVAILABLE_WITH_LEGACY_ALIASES. + * + * @draft ICU 65 + */ + ULOC_AVAILABLE_ONLY_LEGACY_ALIASES, + + /** + * The union of the locales in ULOC_AVAILABLE_DEFAULT and + * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS. + * + * @draft ICU 65 + */ + ULOC_AVAILABLE_WITH_LEGACY_ALIASES, + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal + */ + ULOC_AVAILABLE_COUNT +#endif +} ULocAvailableType; + +/** + * Gets a list of available locales according to the type argument, allowing + * the user to access different sets of supported locales in ICU. + * + * The returned UEnumeration must be closed by the caller. + * + * @param type Type choice from ULocAvailableType. + * @param status Set if an error occurred. + * @return a UEnumeration owned by the caller, or nullptr on failure. + * @draft ICU 65 + */ +U_DRAFT UEnumeration* U_EXPORT2 +uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status); + +#endif // U_HIDE_DRAFT_API + +/** + * * Gets a list of all available 2-letter language codes defined in ISO 639, * plus additional 3-letter codes determined to be useful for locale generation as * defined by Unicode CLDR. This is a pointer @@ -927,12 +927,12 @@ uloc_openKeywords(const char* localeID, * Get the value for a keyword. Locale name does not need to be normalized. * * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") - * @param keywordName name of the keyword for which we want the value; must not be - * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * @param keywordName name of the keyword for which we want the value; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. * @param buffer receiving buffer * @param bufferCapacity capacity of receiving buffer - * @param status containing error code: e.g. buffer not big enough or ill-formed localeID - * or keywordName parameters. + * @param status containing error code: e.g. buffer not big enough or ill-formed localeID + * or keywordName parameters. * @return the length of keyword value * @stable ICU 2.8 */ @@ -949,26 +949,26 @@ uloc_getKeywordValue(const char* localeID, * For removing all keywords, use uloc_getBaseName(). * * NOTE: Unlike almost every other ICU function which takes a - * buffer, this function will NOT truncate the output text, and will - * not update the buffer with unterminated text setting a status of - * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received, - * it means a terminated version of the updated locale ID would not fit - * in the buffer, and the original buffer is untouched. This is done to - * prevent incorrect or possibly even malformed locales from being generated - * and used. - * - * @param keywordName name of the keyword to be set; must not be - * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * buffer, this function will NOT truncate the output text, and will + * not update the buffer with unterminated text setting a status of + * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received, + * it means a terminated version of the updated locale ID would not fit + * in the buffer, and the original buffer is untouched. This is done to + * prevent incorrect or possibly even malformed locales from being generated + * and used. + * + * @param keywordName name of the keyword to be set; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. * @param keywordValue value of the keyword to be set. If 0-length or - * NULL, will result in the keyword being removed; no error is given if - * that keyword does not exist. Otherwise, must consist only of - * [A-Za-z0-9] and [/_+-]. - * @param buffer input buffer containing well-formed locale ID to be - * modified. + * NULL, will result in the keyword being removed; no error is given if + * that keyword does not exist. Otherwise, must consist only of + * [A-Za-z0-9] and [/_+-]. + * @param buffer input buffer containing well-formed locale ID to be + * modified. * @param bufferCapacity capacity of receiving buffer - * @param status containing error code: e.g. buffer not big enough - * or ill-formed keywordName or keywordValue parameters, or ill-formed - * locale ID in buffer on input. + * @param status containing error code: e.g. buffer not big enough + * or ill-formed keywordName or keywordValue parameters, or ill-formed + * locale ID in buffer on input. * @return the length needed for the buffer * @see uloc_getKeywordValue * @stable ICU 3.2 @@ -1034,45 +1034,45 @@ uloc_getLineOrientation(const char* localeId, UErrorCode *status); /** - * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter. - * + * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter. + * * @see uloc_acceptLanguageFromHTTP * @see uloc_acceptLanguage * @stable ICU 3.2 */ typedef enum { - /** - * No exact match was found. - * @stable ICU 3.2 - */ - ULOC_ACCEPT_FAILED = 0, - /** - * An exact match was found. - * @stable ICU 3.2 - */ - ULOC_ACCEPT_VALID = 1, - /** - * A fallback was found. For example, the Accept-Language list includes 'ja_JP' - * and is matched with available locale 'ja'. - * @stable ICU 3.2 - */ - ULOC_ACCEPT_FALLBACK = 2 /* */ + /** + * No exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FAILED = 0, + /** + * An exact match was found. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_VALID = 1, + /** + * A fallback was found. For example, the Accept-Language list includes 'ja_JP' + * and is matched with available locale 'ja'. + * @stable ICU 3.2 + */ + ULOC_ACCEPT_FALLBACK = 2 /* */ } UAcceptResult; /** * Based on a HTTP header from a web browser and a list of available locales, * determine an acceptable locale for the user. - * - * This is a thin wrapper over C++ class LocaleMatcher. - * + * + * This is a thin wrapper over C++ class LocaleMatcher. + * * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. * @param availableLocales - list of available locales to match - * @param status ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) * @return length needed for the locale. * @stable ICU 3.2 */ @@ -1086,18 +1086,18 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, /** * Based on a list of available locales, * determine an acceptable locale for the user. - * - * This is a thin wrapper over C++ class LocaleMatcher. - * + * + * This is a thin wrapper over C++ class LocaleMatcher. + * * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param acceptList - list of acceptable languages * @param acceptListCount - count of acceptList items * @param availableLocales - list of available locales to match - * @param status ICU error code. Its input value must pass the U_SUCCESS() test, - * or else the function returns immediately. Check for U_FAILURE() - * on output or use with function chaining. (See User Guide for details.) + * @param status ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) * @return length needed for the locale. * @stable ICU 3.2 */ diff --git a/contrib/libs/icu/include/unicode/ulocdata.h b/contrib/libs/icu/include/unicode/ulocdata.h index de8d8539c6..dc936d31de 100644 --- a/contrib/libs/icu/include/unicode/ulocdata.h +++ b/contrib/libs/icu/include/unicode/ulocdata.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * * ****************************************************************************** * file name: ulocdata.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -55,7 +55,7 @@ typedef enum ULocaleDataExemplarSetType { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ ULOCDATA_ES_COUNT=4 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } ULocaleDataExemplarSetType; /** The possible types of delimiters. @@ -76,7 +76,7 @@ typedef enum ULocaleDataDelimiterType { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ ULOCDATA_DELIMITER_COUNT = 4 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } ULocaleDataDelimiterType; /** @@ -207,7 +207,7 @@ typedef enum UMeasurementSystem { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UMS_LIMIT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UMeasurementSystem; /** diff --git a/contrib/libs/icu/include/unicode/umachine.h b/contrib/libs/icu/include/unicode/umachine.h index 5f883b4ba5..bebdedb337 100644 --- a/contrib/libs/icu/include/unicode/umachine.h +++ b/contrib/libs/icu/include/unicode/umachine.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * ****************************************************************************** * file name: umachine.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -125,9 +125,9 @@ * May result in an error if it applied to something not an override. * @internal */ -#ifndef U_OVERRIDE -#define U_OVERRIDE override -#endif +#ifndef U_OVERRIDE +#define U_OVERRIDE override +#endif /** * \def U_FINAL @@ -136,45 +136,45 @@ * May result in an error if subclasses attempt to override. * @internal */ -#if !defined(U_FINAL) || defined(U_IN_DOXYGEN) +#if !defined(U_FINAL) || defined(U_IN_DOXYGEN) #define U_FINAL final #endif - -// Before ICU 65, function-like, multi-statement ICU macros were just defined as -// series of statements wrapped in { } blocks and the caller could choose to -// either treat them as if they were actual functions and end the invocation -// with a trailing ; creating an empty statement after the block or else omit -// this trailing ; using the knowledge that the macro would expand to { }. -// -// But doing so doesn't work well with macros that look like functions and -// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore -// switches to the standard solution of wrapping such macros in do { } while. -// -// This will however break existing code that depends on being able to invoke -// these macros without a trailing ; so to be able to remain compatible with -// such code the wrapper is itself defined as macros so that it's possible to -// build ICU 65 and later with the old macro behaviour, like this: -// -// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""' -// runConfigureICU ... -// - -/** - * \def UPRV_BLOCK_MACRO_BEGIN - * Defined as the "do" keyword by default. - * @internal - */ -#ifndef UPRV_BLOCK_MACRO_BEGIN -#define UPRV_BLOCK_MACRO_BEGIN do + +// Before ICU 65, function-like, multi-statement ICU macros were just defined as +// series of statements wrapped in { } blocks and the caller could choose to +// either treat them as if they were actual functions and end the invocation +// with a trailing ; creating an empty statement after the block or else omit +// this trailing ; using the knowledge that the macro would expand to { }. +// +// But doing so doesn't work well with macros that look like functions and +// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore +// switches to the standard solution of wrapping such macros in do { } while. +// +// This will however break existing code that depends on being able to invoke +// these macros without a trailing ; so to be able to remain compatible with +// such code the wrapper is itself defined as macros so that it's possible to +// build ICU 65 and later with the old macro behaviour, like this: +// +// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""' +// runConfigureICU ... +// + +/** + * \def UPRV_BLOCK_MACRO_BEGIN + * Defined as the "do" keyword by default. + * @internal + */ +#ifndef UPRV_BLOCK_MACRO_BEGIN +#define UPRV_BLOCK_MACRO_BEGIN do #endif - -/** - * \def UPRV_BLOCK_MACRO_END - * Defined as "while (FALSE)" by default. - * @internal - */ -#ifndef UPRV_BLOCK_MACRO_END -#define UPRV_BLOCK_MACRO_END while (FALSE) + +/** + * \def UPRV_BLOCK_MACRO_END + * Defined as "while (FALSE)" by default. + * @internal + */ +#ifndef UPRV_BLOCK_MACRO_END +#define UPRV_BLOCK_MACRO_END while (FALSE) #endif /*==========================================================================*/ @@ -316,96 +316,96 @@ typedef int8_t UBool; #define U_SIZEOF_UCHAR 2 /** - * \def U_CHAR16_IS_TYPEDEF - * If 1, then char16_t is a typedef and not a real type (yet) - * @internal - */ -#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) -// for AIX, uchar.h needs to be included -# error #include <uchar.h> -# define U_CHAR16_IS_TYPEDEF 1 -#elif defined(_MSC_VER) && (_MSC_VER < 1900) -// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type, -// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx -# define U_CHAR16_IS_TYPEDEF 1 -#else -# define U_CHAR16_IS_TYPEDEF 0 -#endif - - -/** + * \def U_CHAR16_IS_TYPEDEF + * If 1, then char16_t is a typedef and not a real type (yet) + * @internal + */ +#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// for AIX, uchar.h needs to be included +# error #include <uchar.h> +# define U_CHAR16_IS_TYPEDEF 1 +#elif defined(_MSC_VER) && (_MSC_VER < 1900) +// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type, +// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx +# define U_CHAR16_IS_TYPEDEF 1 +#else +# define U_CHAR16_IS_TYPEDEF 0 +#endif + + +/** * \var UChar * - * The base type for UTF-16 code units and pointers. - * Unsigned 16-bit integer. - * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar. - * - * UChar is configurable by defining the macro UCHAR_TYPE - * on the preprocessor or compiler command line: - * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. - * (The UCHAR_TYPE can also be \#defined earlier in this file, for outside the ICU library code.) - * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16. - * - * The default is UChar=char16_t. - * - * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type. - * - * In C, char16_t is a simple typedef of uint_least16_t. - * ICU requires uint_least16_t=uint16_t for data memory mapping. - * On macOS, char16_t is not available because the uchar.h standard header is missing. + * The base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar. * + * UChar is configurable by defining the macro UCHAR_TYPE + * on the preprocessor or compiler command line: + * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. + * (The UCHAR_TYPE can also be \#defined earlier in this file, for outside the ICU library code.) + * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16. + * + * The default is UChar=char16_t. + * + * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type. + * + * In C, char16_t is a simple typedef of uint_least16_t. + * ICU requires uint_least16_t=uint16_t for data memory mapping. + * On macOS, char16_t is not available because the uchar.h standard header is missing. + * * @stable ICU 4.4 */ - -#if 1 - // #if 1 is normal. UChar defaults to char16_t in C++. - // For configuration testing of UChar=uint16_t temporarily change this to #if 0. - // The intltest Makefile #defines UCHAR_TYPE=char16_t, - // so we only #define it to uint16_t if it is undefined so far. -#elif !defined(UCHAR_TYPE) -# define UCHAR_TYPE uint16_t -#endif - -#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ - defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) - // Inside the ICU library code, never configurable. - typedef char16_t UChar; -#elif defined(UCHAR_TYPE) + +#if 1 + // #if 1 is normal. UChar defaults to char16_t in C++. + // For configuration testing of UChar=uint16_t temporarily change this to #if 0. + // The intltest Makefile #defines UCHAR_TYPE=char16_t, + // so we only #define it to uint16_t if it is undefined so far. +#elif !defined(UCHAR_TYPE) +# define UCHAR_TYPE uint16_t +#endif + +#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ + defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Inside the ICU library code, never configurable. + typedef char16_t UChar; +#elif defined(UCHAR_TYPE) typedef UCHAR_TYPE UChar; -#elif (U_CPLUSPLUS_VERSION >= 11) - typedef char16_t UChar; +#elif (U_CPLUSPLUS_VERSION >= 11) + typedef char16_t UChar; #else typedef uint16_t UChar; #endif /** - * \var OldUChar - * Default ICU 58 definition of UChar. - * A base type for UTF-16 code units and pointers. - * Unsigned 16-bit integer. - * - * Define OldUChar to be wchar_t if that is 16 bits wide. - * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. - * - * This makes the definition of OldUChar platform-dependent - * but allows direct string type compatibility with platforms with - * 16-bit wchar_t types. - * - * This is how UChar was defined in ICU 58, for transition convenience. - * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. - * The current UChar responds to UCHAR_TYPE but OldUChar does not. - * - * @stable ICU 59 - */ -#if U_SIZEOF_WCHAR_T==2 - typedef wchar_t OldUChar; -#elif defined(__CHAR16_TYPE__) - typedef __CHAR16_TYPE__ OldUChar; -#else - typedef uint16_t OldUChar; -#endif - -/** + * \var OldUChar + * Default ICU 58 definition of UChar. + * A base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * + * Define OldUChar to be wchar_t if that is 16 bits wide. + * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. + * + * This makes the definition of OldUChar platform-dependent + * but allows direct string type compatibility with platforms with + * 16-bit wchar_t types. + * + * This is how UChar was defined in ICU 58, for transition convenience. + * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. + * The current UChar responds to UCHAR_TYPE but OldUChar does not. + * + * @stable ICU 59 + */ +#if U_SIZEOF_WCHAR_T==2 + typedef wchar_t OldUChar; +#elif defined(__CHAR16_TYPE__) + typedef __CHAR16_TYPE__ OldUChar; +#else + typedef uint16_t OldUChar; +#endif + +/** * Define UChar32 as a type for single Unicode code points. * UChar32 is a signed 32-bit integer (same as int32_t). * diff --git a/contrib/libs/icu/include/unicode/umisc.h b/contrib/libs/icu/include/unicode/umisc.h index 213290b9af..9b8c016218 100644 --- a/contrib/libs/icu/include/unicode/umisc.h +++ b/contrib/libs/icu/include/unicode/umisc.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ********************************************************************** * file name: umisc.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/umsg.h b/contrib/libs/icu/include/unicode/umsg.h index 5d235e42e8..4a4c7435e7 100644 --- a/contrib/libs/icu/include/unicode/umsg.h +++ b/contrib/libs/icu/include/unicode/umsg.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** * COPYRIGHT: @@ -8,7 +8,7 @@ ******************************************************************** * * file name: umsg.h - * encoding: UTF-8 + * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/umutablecptrie.h b/contrib/libs/icu/include/unicode/umutablecptrie.h index f2af36477d..3e1bbdd9f4 100644 --- a/contrib/libs/icu/include/unicode/umutablecptrie.h +++ b/contrib/libs/icu/include/unicode/umutablecptrie.h @@ -1,238 +1,238 @@ -// © 2017 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -// umutablecptrie.h (split out of ucptrie.h) -// created: 2018jan24 Markus W. Scherer - -#ifndef __UMUTABLECPTRIE_H__ -#define __UMUTABLECPTRIE_H__ - -#include "unicode/utypes.h" - -#include "unicode/localpointer.h" -#include "unicode/ucpmap.h" -#include "unicode/ucptrie.h" -#include "unicode/utf8.h" - -U_CDECL_BEGIN - -/** - * \file - * - * This file defines a mutable Unicode code point trie. - * - * @see UCPTrie - * @see UMutableCPTrie - */ - -/** - * Mutable Unicode code point trie. - * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values. - * For details see http://site.icu-project.org/design/struct/utrie - * - * Setting values (especially ranges) and lookup is fast. - * The mutable trie is only somewhat space-efficient. - * It builds a compacted, immutable UCPTrie. - * - * This trie can be modified while iterating over its contents. - * For example, it is possible to merge its values with those from another - * set of ranges (e.g., another mutable or immutable trie): - * Iterate over those source ranges; for each of them iterate over this trie; - * add the source value into the value of each trie range. - * - * @see UCPTrie - * @see umutablecptrie_buildImmutable - * @stable ICU 63 - */ -typedef struct UMutableCPTrie UMutableCPTrie; - -/** - * Creates a mutable trie that initially maps each Unicode code point to the same value. - * It uses 32-bit data values until umutablecptrie_buildImmutable() is called. - * umutablecptrie_buildImmutable() takes a valueWidth parameter which - * determines the number of bits in the data value in the resulting UCPTrie. - * You must umutablecptrie_close() the trie once you are done using it. - * - * @param initialValue the initial value that is set for all code points - * @param errorValue the value for out-of-range code points and ill-formed UTF-8/16 - * @param pErrorCode an in/out ICU UErrorCode - * @return the trie - * @stable ICU 63 - */ -U_CAPI UMutableCPTrie * U_EXPORT2 -umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode); - -/** - * Clones a mutable trie. - * You must umutablecptrie_close() the clone once you are done using it. - * - * @param other the trie to clone - * @param pErrorCode an in/out ICU UErrorCode - * @return the trie clone - * @stable ICU 63 - */ -U_CAPI UMutableCPTrie * U_EXPORT2 -umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode); - -/** - * Closes a mutable trie and releases associated memory. - * - * @param trie the trie - * @stable ICU 63 - */ -U_CAPI void U_EXPORT2 -umutablecptrie_close(UMutableCPTrie *trie); - -/** - * Creates a mutable trie with the same contents as the UCPMap. - * You must umutablecptrie_close() the mutable trie once you are done using it. - * - * @param map the source map - * @param pErrorCode an in/out ICU UErrorCode - * @return the mutable trie - * @stable ICU 63 - */ -U_CAPI UMutableCPTrie * U_EXPORT2 -umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode); - -/** - * Creates a mutable trie with the same contents as the immutable one. - * You must umutablecptrie_close() the mutable trie once you are done using it. - * - * @param trie the immutable trie - * @param pErrorCode an in/out ICU UErrorCode - * @return the mutable trie - * @stable ICU 63 - */ -U_CAPI UMutableCPTrie * U_EXPORT2 -umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode); - -/** - * Returns the value for a code point as stored in the trie. - * - * @param trie the trie - * @param c the code point - * @return the value - * @stable ICU 63 - */ -U_CAPI uint32_t U_EXPORT2 -umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c); - -/** - * Returns the last code point such that all those from start to there have the same value. - * Can be used to efficiently iterate over all same-value ranges in a trie. - * (This is normally faster than iterating over code points and get()ting each value, - * but much slower than a data structure that stores ranges directly.) - * - * The trie can be modified between calls to this function. - * - * If the UCPMapValueFilter function pointer is not NULL, then - * the value to be delivered is passed through that function, and the return value is the end - * of the range where all values are modified to the same actual value. - * The value is unchanged if that function pointer is NULL. - * - * See the same-signature ucptrie_getRange() for a code sample. - * - * @param trie the trie - * @param start range start - * @param option defines whether surrogates are treated normally, - * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL - * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL - * @param filter a pointer to a function that may modify the trie data value, - * or NULL if the values from the trie are to be used unmodified - * @param context an opaque pointer that is passed on to the filter function - * @param pValue if not NULL, receives the value that every code point start..end has; - * may have been modified by filter(context, trie value) - * if that function pointer is not NULL - * @return the range end code point, or -1 if start is not a valid code point - * @stable ICU 63 - */ -U_CAPI UChar32 U_EXPORT2 -umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start, - UCPMapRangeOption option, uint32_t surrogateValue, - UCPMapValueFilter *filter, const void *context, uint32_t *pValue); - -/** - * Sets a value for a code point. - * - * @param trie the trie - * @param c the code point - * @param value the value - * @param pErrorCode an in/out ICU UErrorCode - * @stable ICU 63 - */ -U_CAPI void U_EXPORT2 -umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode); - -/** - * Sets a value for each code point [start..end]. - * Faster and more space-efficient than setting the value for each code point separately. - * - * @param trie the trie - * @param start the first code point to get the value - * @param end the last code point to get the value (inclusive) - * @param value the value - * @param pErrorCode an in/out ICU UErrorCode - * @stable ICU 63 - */ -U_CAPI void U_EXPORT2 -umutablecptrie_setRange(UMutableCPTrie *trie, - UChar32 start, UChar32 end, - uint32_t value, UErrorCode *pErrorCode); - -/** - * Compacts the data and builds an immutable UCPTrie according to the parameters. - * After this, the mutable trie will be empty. - * - * The mutable trie stores 32-bit values until buildImmutable() is called. - * If values shorter than 32 bits are to be stored in the immutable trie, - * then the upper bits are discarded. - * For example, when the mutable trie contains values 0x81, -0x7f, and 0xa581, - * and the value width is 8 bits, then each of these is stored as 0x81 - * and the immutable trie will return that as an unsigned value. - * (Some implementations may want to make productive temporary use of the upper bits - * until buildImmutable() discards them.) - * - * Not every possible set of mappings can be built into a UCPTrie, - * because of limitations resulting from speed and space optimizations. - * Every Unicode assigned character can be mapped to a unique value. - * Typical data yields data structures far smaller than the limitations. - * - * It is possible to construct extremely unusual mappings that exceed the data structure limits. - * In such a case this function will fail with a U_INDEX_OUTOFBOUNDS_ERROR. - * - * @param trie the trie trie - * @param type selects the trie type - * @param valueWidth selects the number of bits in a trie data value; if smaller than 32 bits, - * then the values stored in the trie will be truncated first - * @param pErrorCode an in/out ICU UErrorCode - * - * @see umutablecptrie_fromUCPTrie - * @stable ICU 63 - */ -U_CAPI UCPTrie * U_EXPORT2 -umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth, - UErrorCode *pErrorCode); - -U_CDECL_END - -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUMutableCPTriePointer - * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 63 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close); - -U_NAMESPACE_END - -#endif - -#endif +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// umutablecptrie.h (split out of ucptrie.h) +// created: 2018jan24 Markus W. Scherer + +#ifndef __UMUTABLECPTRIE_H__ +#define __UMUTABLECPTRIE_H__ + +#include "unicode/utypes.h" + +#include "unicode/localpointer.h" +#include "unicode/ucpmap.h" +#include "unicode/ucptrie.h" +#include "unicode/utf8.h" + +U_CDECL_BEGIN + +/** + * \file + * + * This file defines a mutable Unicode code point trie. + * + * @see UCPTrie + * @see UMutableCPTrie + */ + +/** + * Mutable Unicode code point trie. + * Fast map from Unicode code points (U+0000..U+10FFFF) to 32-bit integer values. + * For details see http://site.icu-project.org/design/struct/utrie + * + * Setting values (especially ranges) and lookup is fast. + * The mutable trie is only somewhat space-efficient. + * It builds a compacted, immutable UCPTrie. + * + * This trie can be modified while iterating over its contents. + * For example, it is possible to merge its values with those from another + * set of ranges (e.g., another mutable or immutable trie): + * Iterate over those source ranges; for each of them iterate over this trie; + * add the source value into the value of each trie range. + * + * @see UCPTrie + * @see umutablecptrie_buildImmutable + * @stable ICU 63 + */ +typedef struct UMutableCPTrie UMutableCPTrie; + +/** + * Creates a mutable trie that initially maps each Unicode code point to the same value. + * It uses 32-bit data values until umutablecptrie_buildImmutable() is called. + * umutablecptrie_buildImmutable() takes a valueWidth parameter which + * determines the number of bits in the data value in the resulting UCPTrie. + * You must umutablecptrie_close() the trie once you are done using it. + * + * @param initialValue the initial value that is set for all code points + * @param errorValue the value for out-of-range code points and ill-formed UTF-8/16 + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode); + +/** + * Clones a mutable trie. + * You must umutablecptrie_close() the clone once you are done using it. + * + * @param other the trie to clone + * @param pErrorCode an in/out ICU UErrorCode + * @return the trie clone + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode); + +/** + * Closes a mutable trie and releases associated memory. + * + * @param trie the trie + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_close(UMutableCPTrie *trie); + +/** + * Creates a mutable trie with the same contents as the UCPMap. + * You must umutablecptrie_close() the mutable trie once you are done using it. + * + * @param map the source map + * @param pErrorCode an in/out ICU UErrorCode + * @return the mutable trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode); + +/** + * Creates a mutable trie with the same contents as the immutable one. + * You must umutablecptrie_close() the mutable trie once you are done using it. + * + * @param trie the immutable trie + * @param pErrorCode an in/out ICU UErrorCode + * @return the mutable trie + * @stable ICU 63 + */ +U_CAPI UMutableCPTrie * U_EXPORT2 +umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode); + +/** + * Returns the value for a code point as stored in the trie. + * + * @param trie the trie + * @param c the code point + * @return the value + * @stable ICU 63 + */ +U_CAPI uint32_t U_EXPORT2 +umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c); + +/** + * Returns the last code point such that all those from start to there have the same value. + * Can be used to efficiently iterate over all same-value ranges in a trie. + * (This is normally faster than iterating over code points and get()ting each value, + * but much slower than a data structure that stores ranges directly.) + * + * The trie can be modified between calls to this function. + * + * If the UCPMapValueFilter function pointer is not NULL, then + * the value to be delivered is passed through that function, and the return value is the end + * of the range where all values are modified to the same actual value. + * The value is unchanged if that function pointer is NULL. + * + * See the same-signature ucptrie_getRange() for a code sample. + * + * @param trie the trie + * @param start range start + * @param option defines whether surrogates are treated normally, + * or as having the surrogateValue; usually UCPMAP_RANGE_NORMAL + * @param surrogateValue value for surrogates; ignored if option==UCPMAP_RANGE_NORMAL + * @param filter a pointer to a function that may modify the trie data value, + * or NULL if the values from the trie are to be used unmodified + * @param context an opaque pointer that is passed on to the filter function + * @param pValue if not NULL, receives the value that every code point start..end has; + * may have been modified by filter(context, trie value) + * if that function pointer is not NULL + * @return the range end code point, or -1 if start is not a valid code point + * @stable ICU 63 + */ +U_CAPI UChar32 U_EXPORT2 +umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start, + UCPMapRangeOption option, uint32_t surrogateValue, + UCPMapValueFilter *filter, const void *context, uint32_t *pValue); + +/** + * Sets a value for a code point. + * + * @param trie the trie + * @param c the code point + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode); + +/** + * Sets a value for each code point [start..end]. + * Faster and more space-efficient than setting the value for each code point separately. + * + * @param trie the trie + * @param start the first code point to get the value + * @param end the last code point to get the value (inclusive) + * @param value the value + * @param pErrorCode an in/out ICU UErrorCode + * @stable ICU 63 + */ +U_CAPI void U_EXPORT2 +umutablecptrie_setRange(UMutableCPTrie *trie, + UChar32 start, UChar32 end, + uint32_t value, UErrorCode *pErrorCode); + +/** + * Compacts the data and builds an immutable UCPTrie according to the parameters. + * After this, the mutable trie will be empty. + * + * The mutable trie stores 32-bit values until buildImmutable() is called. + * If values shorter than 32 bits are to be stored in the immutable trie, + * then the upper bits are discarded. + * For example, when the mutable trie contains values 0x81, -0x7f, and 0xa581, + * and the value width is 8 bits, then each of these is stored as 0x81 + * and the immutable trie will return that as an unsigned value. + * (Some implementations may want to make productive temporary use of the upper bits + * until buildImmutable() discards them.) + * + * Not every possible set of mappings can be built into a UCPTrie, + * because of limitations resulting from speed and space optimizations. + * Every Unicode assigned character can be mapped to a unique value. + * Typical data yields data structures far smaller than the limitations. + * + * It is possible to construct extremely unusual mappings that exceed the data structure limits. + * In such a case this function will fail with a U_INDEX_OUTOFBOUNDS_ERROR. + * + * @param trie the trie trie + * @param type selects the trie type + * @param valueWidth selects the number of bits in a trie data value; if smaller than 32 bits, + * then the values stored in the trie will be truncated first + * @param pErrorCode an in/out ICU UErrorCode + * + * @see umutablecptrie_fromUCPTrie + * @stable ICU 63 + */ +U_CAPI UCPTrie * U_EXPORT2 +umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth, + UErrorCode *pErrorCode); + +U_CDECL_END + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUMutableCPTriePointer + * "Smart pointer" class, closes a UMutableCPTrie via umutablecptrie_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 63 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close); + +U_NAMESPACE_END + +#endif + +#endif diff --git a/contrib/libs/icu/include/unicode/unifilt.h b/contrib/libs/icu/include/unicode/unifilt.h index 420e1a1905..dbbafb3f78 100644 --- a/contrib/libs/icu/include/unicode/unifilt.h +++ b/contrib/libs/icu/include/unicode/unifilt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -12,10 +12,10 @@ #ifndef UNIFILT_H #define UNIFILT_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/unifunct.h" #include "unicode/unimatch.h" @@ -34,7 +34,7 @@ U_NAMESPACE_BEGIN * defined range. * @stable ICU 3.0 */ -#define U_ETHER ((char16_t)0xFFFF) +#define U_ETHER ((char16_t)0xFFFF) /** * @@ -72,14 +72,14 @@ public: virtual ~UnicodeFilter(); /** - * Clones this object polymorphically. - * The caller owns the result and should delete it when done. - * @return clone, or nullptr if an error occurred - * @stable ICU 2.4 - */ - virtual UnicodeFilter* clone() const = 0; - - /** + * Clones this object polymorphically. + * The caller owns the result and should delete it when done. + * @return clone, or nullptr if an error occurred + * @stable ICU 2.4 + */ + virtual UnicodeFilter* clone() const = 0; + + /** * Returns <tt>true</tt> for characters that are in the selected * subset. In other words, if a character is <b>to be * filtered</b>, then <tt>contains()</tt> returns @@ -131,6 +131,6 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/unifunct.h b/contrib/libs/icu/include/unicode/unifunct.h index 7d31af7daf..9c5e4ca4a2 100644 --- a/contrib/libs/icu/include/unicode/unifunct.h +++ b/contrib/libs/icu/include/unicode/unifunct.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -13,9 +13,9 @@ #define UNIFUNCT_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" /** @@ -127,6 +127,6 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/unimatch.h b/contrib/libs/icu/include/unicode/unimatch.h index 5a192b1b42..e0b2b46f38 100644 --- a/contrib/libs/icu/include/unicode/unimatch.h +++ b/contrib/libs/icu/include/unicode/unimatch.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. @@ -17,7 +17,7 @@ * \brief C++ API: Unicode Matcher */ -#if U_SHOW_CPLUSPLUS_API +#if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN @@ -163,6 +163,6 @@ public: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/unirepl.h b/contrib/libs/icu/include/unicode/unirepl.h index 1ec627abcb..01fd5d63a1 100644 --- a/contrib/libs/icu/include/unicode/unirepl.h +++ b/contrib/libs/icu/include/unicode/unirepl.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -14,8 +14,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: UnicodeReplacer @@ -98,6 +98,6 @@ class U_I18N_API UnicodeReplacer /* not : public UObject because this is an inte U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/uniset.h b/contrib/libs/icu/include/unicode/uniset.h index 9742311003..f1984956c7 100644 --- a/contrib/libs/icu/include/unicode/uniset.h +++ b/contrib/libs/icu/include/unicode/uniset.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* *************************************************************************** @@ -13,11 +13,11 @@ #ifndef UNICODESET_H #define UNICODESET_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/ucpmap.h" +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/ucpmap.h" #include "unicode/unifilt.h" #include "unicode/unistr.h" #include "unicode/uset.h" @@ -279,24 +279,24 @@ class RuleCharacterIterator; * @stable ICU 2.0 */ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { -private: - /** - * Enough for sets with few ranges. - * For example, White_Space has 10 ranges, list length 21. - */ - static constexpr int32_t INITIAL_CAPACITY = 25; - // fFlags constant - static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid) - - UChar32* list = stackList; // MUST be terminated with HIGH - int32_t capacity = INITIAL_CAPACITY; // capacity of list - int32_t len = 1; // length of list used; 1 <= len <= capacity - uint8_t fFlags = 0; // Bit flag (see constants above) - - BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL. - UChar32* buffer = nullptr; // internal buffer, may be NULL - int32_t bufferCapacity = 0; // capacity of buffer - +private: + /** + * Enough for sets with few ranges. + * For example, White_Space has 10 ranges, list length 21. + */ + static constexpr int32_t INITIAL_CAPACITY = 25; + // fFlags constant + static constexpr uint8_t kIsBogus = 1; // This set is bogus (i.e. not valid) + + UChar32* list = stackList; // MUST be terminated with HIGH + int32_t capacity = INITIAL_CAPACITY; // capacity of list + int32_t len = 1; // length of list used; 1 <= len <= capacity + uint8_t fFlags = 0; // Bit flag (see constants above) + + BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL. + UChar32* buffer = nullptr; // internal buffer, may be NULL + int32_t bufferCapacity = 0; // capacity of buffer + /** * The pattern representation of this set. This may not be the * most economical pattern. It is the pattern supplied to @@ -306,19 +306,19 @@ private: * indicating that toPattern() must generate a pattern * representation from the inversion list. */ - char16_t *pat = nullptr; - int32_t patLen = 0; - - UVector* strings = nullptr; // maintained in sorted order - UnicodeSetStringSpan *stringSpan = nullptr; - - /** - * Initial list array. - * Avoids some heap allocations, and list is never nullptr. - * Increases the object size a bit. - */ - UChar32 stackList[INITIAL_CAPACITY]; - + char16_t *pat = nullptr; + int32_t patLen = 0; + + UVector* strings = nullptr; // maintained in sorted order + UnicodeSetStringSpan *stringSpan = nullptr; + + /** + * Initial list array. + * Avoids some heap allocations, and list is never nullptr. + * Increases the object size a bit. + */ + UChar32 stackList[INITIAL_CAPACITY]; + public: /** * Determine if this object contains a valid set. @@ -494,7 +494,7 @@ public: * <tt>true</tt> if the specified set is not equal to this set. * @stable ICU 2.0 */ - inline UBool operator!=(const UnicodeSet& o) const; + inline UBool operator!=(const UnicodeSet& o) const; /** * Returns a copy of this object. All UnicodeFunctor objects have @@ -505,7 +505,7 @@ public: * @see cloneAsThawed * @stable ICU 2.0 */ - virtual UnicodeSet* clone() const; + virtual UnicodeSet* clone() const; /** * Returns the hash code value for this set. @@ -583,7 +583,7 @@ public: * @see cloneAsThawed * @stable ICU 3.8 */ - UnicodeSet *freeze(); + UnicodeSet *freeze(); /** * Clone the set and make the clone mutable. @@ -593,15 +593,15 @@ public: * @see isFrozen * @stable ICU 3.8 */ - UnicodeSet *cloneAsThawed() const; + UnicodeSet *cloneAsThawed() const; //---------------------------------------------------------------- // Public API //---------------------------------------------------------------- /** - * Make this object represent the range `start - end`. - * If `end > start` then this object is set to an empty range. + * Make this object represent the range `start - end`. + * If `end > start` then this object is set to an empty range. * A frozen set will not be modified. * * @param start first character in the set, inclusive @@ -906,7 +906,7 @@ public: * @stable ICU 3.8 * @see USetSpanCondition */ - int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; /** * Returns the end of the substring of the input string according to the USetSpanCondition. @@ -939,7 +939,7 @@ public: * @stable ICU 3.8 * @see USetSpanCondition */ - int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; /** * Returns the start of the substring of the input string according to the USetSpanCondition. @@ -1519,7 +1519,7 @@ private: //---------------------------------------------------------------- UnicodeSet(const UnicodeSet& o, UBool /* asThawed */); - UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed); + UnicodeSet& copyFrom(const UnicodeSet& o, UBool asThawed); //---------------------------------------------------------------- // Implementation: Pattern parsing @@ -1535,25 +1535,25 @@ private: UnicodeString& rebuiltPat, uint32_t options, UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute), - int32_t depth, + int32_t depth, UErrorCode& ec); //---------------------------------------------------------------- // Implementation: Utility methods //---------------------------------------------------------------- - static int32_t nextCapacity(int32_t minCapacity); + static int32_t nextCapacity(int32_t minCapacity); - bool ensureCapacity(int32_t newLen); - - bool ensureBufferCapacity(int32_t newLen); + bool ensureCapacity(int32_t newLen); + bool ensureBufferCapacity(int32_t newLen); + void swapBuffers(void); UBool allocateStrings(UErrorCode &status); - UBool hasStrings() const; - int32_t stringsSize() const; - UBool stringsContains(const UnicodeString &s) const; + UBool hasStrings() const; + int32_t stringsSize() const; + UBool stringsContains(const UnicodeString &s) const; UnicodeString& _toPattern(UnicodeString& result, UBool escapeUnprintable) const; @@ -1652,21 +1652,21 @@ private: */ void applyFilter(Filter filter, void* context, - const UnicodeSet* inclusions, + const UnicodeSet* inclusions, UErrorCode &status); - // UCPMap is now stable ICU 63 - void applyIntPropertyValue(const UCPMap *map, - UCPMapValueFilter *filter, const void *context, - UErrorCode &errorCode); - + // UCPMap is now stable ICU 63 + void applyIntPropertyValue(const UCPMap *map, + UCPMapValueFilter *filter, const void *context, + UErrorCode &errorCode); + /** * Set the new pattern to cache. */ - void setPattern(const UnicodeString& newPat) { - setPattern(newPat.getBuffer(), newPat.length()); - } - void setPattern(const char16_t *newPat, int32_t newPatLen); + void setPattern(const UnicodeString& newPat) { + setPattern(newPat.getBuffer(), newPat.length()); + } + void setPattern(const char16_t *newPat, int32_t newPatLen); /** * Release existing cached pattern. */ @@ -1739,6 +1739,6 @@ inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetS U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/unistr.h b/contrib/libs/icu/include/unicode/unistr.h index da79053765..a494aad6b3 100644 --- a/contrib/libs/icu/include/unicode/unistr.h +++ b/contrib/libs/icu/include/unicode/unistr.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -29,11 +29,11 @@ */ #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - -#include <cstddef> -#include "unicode/char16ptr.h" + +#if U_SHOW_CPLUSPLUS_API + +#include <cstddef> +#include "unicode/char16ptr.h" #include "unicode/rep.h" #include "unicode/std_string.h" #include "unicode/stringpiece.h" @@ -49,31 +49,31 @@ U_STABLE int32_t U_EXPORT2 u_strlen(const UChar *s); #endif -U_NAMESPACE_BEGIN - -#if !UCONFIG_NO_BREAK_ITERATION -class BreakIterator; // unicode/brkiter.h -#endif -class Edits; - -U_NAMESPACE_END +U_NAMESPACE_BEGIN -// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper. +#if !UCONFIG_NO_BREAK_ITERATION +class BreakIterator; // unicode/brkiter.h +#endif +class Edits; + +U_NAMESPACE_END + +// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper. /** * Internal string case mapping function type. - * All error checking must be done. - * src and dest must not overlap. + * All error checking must be done. + * src and dest must not overlap. * @internal */ typedef int32_t U_CALLCONV -UStringCaseMapper(int32_t caseLocale, uint32_t options, -#if !UCONFIG_NO_BREAK_ITERATION - icu::BreakIterator *iter, +UStringCaseMapper(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + icu::BreakIterator *iter, #endif - char16_t *dest, int32_t destCapacity, - const char16_t *src, int32_t srcLength, - icu::Edits *edits, - UErrorCode &errorCode); + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); U_NAMESPACE_BEGIN @@ -97,25 +97,25 @@ class UnicodeStringAppendable; // unicode/appendable.h /** * Unicode String literals in C++. - * - * Note: these macros are not recommended for new code. - * Prior to the availability of C++11 and u"unicode string literals", - * these macros were provided for portability and efficiency when - * initializing UnicodeStrings from literals. - * + * + * Note: these macros are not recommended for new code. + * Prior to the availability of C++11 and u"unicode string literals", + * these macros were provided for portability and efficiency when + * initializing UnicodeStrings from literals. + * * They work only for strings that contain "invariant characters", i.e., * only latin letters, digits, and some punctuation. * See utypes.h for details. * * The string parameter must be a C string literal. * The length of the string, not including the terminating - * `NUL`, must be specified as a constant. + * `NUL`, must be specified as a constant. * @stable ICU 2.0 */ -#if !U_CHAR16_IS_TYPEDEF -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +#if !U_CHAR16_IS_TYPEDEF +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) #else -# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) #endif /** @@ -136,7 +136,7 @@ class UnicodeStringAppendable; // unicode/appendable.h /** * \def UNISTR_FROM_CHAR_EXPLICIT * This can be defined to be empty or "explicit". - * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32) + * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32) * constructors are marked as explicit, preventing their inadvertent use. * @stable ICU 49 */ @@ -153,7 +153,7 @@ class UnicodeStringAppendable; // unicode/appendable.h /** * \def UNISTR_FROM_STRING_EXPLICIT * This can be defined to be empty or "explicit". - * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *) + * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *) * constructors are marked as explicit, preventing their inadvertent use. * * In particular, this helps prevent accidentally depending on ICU conversion code @@ -187,18 +187,18 @@ class UnicodeStringAppendable; // unicode/appendable.h * to 4 * sizeof(pointer) (or 3 * sizeof(pointer) for P128 data models), * to hold the fields for heap-allocated strings. * Such a minimum size also ensures that the object is easily large enough - * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH). + * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH). * * sizeof(UnicodeString) >= 48 should work for all known platforms. * * For example, on a 64-bit machine where sizeof(vtable pointer) is 8, * sizeof(UnicodeString) = 64 would leave space for * (64 - sizeof(vtable pointer) - 2) / U_SIZEOF_UCHAR = (64 - 8 - 2) / 2 = 27 - * char16_ts stored inside the object. + * char16_ts stored inside the object. * * The minimum object size on a 64-bit machine would be * 4 * sizeof(pointer) = 4 * 8 = 32 bytes, - * and the internal buffer would hold up to 11 char16_ts in that case. + * and the internal buffer would hold up to 11 char16_ts in that case. * * @see U16_MAX_LENGTH * @stable ICU 56 @@ -212,9 +212,9 @@ class UnicodeStringAppendable; // unicode/appendable.h * similar functionality as the Java String and StringBuffer/StringBuilder classes. * It is a concrete implementation of the abstract class Replaceable (for transliteration). * - * The UnicodeString equivalent of std::string’s clear() is remove(). - * - * A UnicodeString may "alias" an external array of characters + * The UnicodeString equivalent of std::string’s clear() is remove(). + * + * A UnicodeString may "alias" an external array of characters * (that is, point to it, rather than own the array) * whose lifetime must then at least match the lifetime of the aliasing object. * This aliasing may be preserved when returning a UnicodeString by value, @@ -226,35 +226,35 @@ class UnicodeStringAppendable; // unicode/appendable.h * * The UnicodeString class is not suitable for subclassing. * - * For an overview of Unicode strings in C and C++ see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-). + * For an overview of Unicode strings in C and C++ see the + * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Strings-in-C-C-). * - * In ICU, a Unicode string consists of 16-bit Unicode *code units*. + * In ICU, a Unicode string consists of 16-bit Unicode *code units*. * A Unicode character may be stored with either one code unit * (the most common case) or with a matched pair of special code units - * ("surrogates"). The data type for code units is char16_t. - * For single-character handling, a Unicode character code *point* is a value - * in the range 0..0x10ffff. ICU uses the UChar32 type for code points. + * ("surrogates"). The data type for code units is char16_t. + * For single-character handling, a Unicode character code *point* is a value + * in the range 0..0x10ffff. ICU uses the UChar32 type for code points. * - * Indexes and offsets into and lengths of strings always count code units, not code points. + * Indexes and offsets into and lengths of strings always count code units, not code points. * This is the same as with multi-byte char* strings in traditional string handling. * Operations on partial strings typically do not test for code point boundaries. * If necessary, the user needs to take care of such boundaries by testing for the code unit * values or by using functions like * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit() - * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h). + * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h). * * UnicodeString methods are more lenient with regard to input parameter values * than other ICU APIs. In particular: * - If indexes are out of bounds for a UnicodeString object - * (< 0 or > length()) then they are "pinned" to the nearest boundary. - * - If the buffer passed to an insert/append/replace operation is owned by the - * target object, e.g., calling str.append(str), an extra copy may take place - * to ensure safety. - * - If primitive string pointer values (e.g., const char16_t * or char *) + * (< 0 or > length()) then they are "pinned" to the nearest boundary. + * - If the buffer passed to an insert/append/replace operation is owned by the + * target object, e.g., calling str.append(str), an extra copy may take place + * to ensure safety. + * - If primitive string pointer values (e.g., const char16_t * or char *) * for input strings are NULL, then those input string parameters are treated * as if they pointed to an empty string. - * However, this is *not* the case for char * parameters for charset names + * However, this is *not* the case for char * parameters for charset names * or other IDs. * - Most UnicodeString methods do not take a UErrorCode parameter because * there are usually very few opportunities for failure other than a shortage @@ -278,14 +278,14 @@ class UnicodeStringAppendable; // unicode/appendable.h * This includes the const UnicodeString & parameters for * copy construction, assignment, and cloning. * - * UnicodeString uses several storage methods. + * UnicodeString uses several storage methods. * String contents can be stored inside the UnicodeString object itself, * in an allocated and shared buffer, or in an outside buffer that is "aliased". * Most of this is done transparently, but careful aliasing in particular provides * significant performance improvements. * Also, the internal buffer is accessible via special functions. * For details see the - * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model). + * [User Guide Strings chapter](http://userguide.icu-project.org/strings#TOC-Maximizing-Performance-with-the-UnicodeString-Storage-Model). * * @see utf.h * @see CharacterIterator @@ -320,7 +320,7 @@ public: /** * Equality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return TRUE if `text` contains the same characters as this one, + * @return TRUE if `text` contains the same characters as this one, * FALSE otherwise. * @stable ICU 2.0 */ @@ -329,7 +329,7 @@ public: /** * Inequality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. - * @return FALSE if `text` contains the same characters as this one, + * @return FALSE if `text` contains the same characters as this one, * TRUE otherwise. * @stable ICU 2.0 */ @@ -339,7 +339,7 @@ public: * Greater than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise - * greater than the characters in `text`, FALSE otherwise + * greater than the characters in `text`, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator> (const UnicodeString& text) const; @@ -348,7 +348,7 @@ public: * Less than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise - * less than the characters in `text`, FALSE otherwise + * less than the characters in `text`, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator< (const UnicodeString& text) const; @@ -357,7 +357,7 @@ public: * Greater than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise - * greater than or equal to the characters in `text`, FALSE otherwise + * greater than or equal to the characters in `text`, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator>= (const UnicodeString& text) const; @@ -366,37 +366,37 @@ public: * Less than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise - * less than or equal to the characters in `text`, FALSE otherwise + * less than or equal to the characters in `text`, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator<= (const UnicodeString& text) const; /** * Compare the characters bitwise in this UnicodeString to - * the characters in `text`. + * the characters in `text`. * @param text The UnicodeString to compare to this one. * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `text`, -1 if the characters in - * this are bitwise less than the characters in `text`, +1 if the + * contains the same characters as `text`, -1 if the characters in + * this are bitwise less than the characters in `text`, +1 if the * characters in this are bitwise greater than the characters - * in `text`. + * in `text`. * @stable ICU 2.0 */ inline int8_t compare(const UnicodeString& text) const; /** * Compare the characters bitwise in the range - * [`start`, `start + length`) with the characters - * in the **entire string** `text`. + * [`start`, `start + length`) with the characters + * in the **entire string** `text`. * (The parameters "start" and "length" are not applied to the other text "text".) * @param start the offset at which the compare operation begins * @param length the number of characters of text to compare. * @param text the other text to be compared against this string. * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `text`, -1 if the characters in - * this are bitwise less than the characters in `text`, +1 if the + * contains the same characters as `text`, -1 if the characters in + * this are bitwise less than the characters in `text`, +1 if the * characters in this are bitwise greater than the characters - * in `text`. + * in `text`. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, @@ -405,19 +405,19 @@ public: /** * Compare the characters bitwise in the range - * [`start`, `start + length`) with the characters - * in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`). + * [`start`, `start + length`) with the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). * @param start the offset at which the compare operation begins * @param length the number of characters in this to compare. * @param srcText the text to be compared - * @param srcStart the offset into `srcText` to start comparison - * @param srcLength the number of characters in `src` to compare + * @param srcStart the offset into `srcText` to start comparison + * @param srcLength the number of characters in `src` to compare * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `srcText`, -1 if the characters in - * this are bitwise less than the characters in `srcText`, +1 if the + * contains the same characters as `srcText`, -1 if the characters in + * this are bitwise less than the characters in `srcText`, +1 if the * characters in this are bitwise greater than the characters - * in `srcText`. + * in `srcText`. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, @@ -428,75 +428,75 @@ public: /** * Compare the characters bitwise in this UnicodeString with the first - * `srcLength` characters in `srcChars`. + * `srcLength` characters in `srcChars`. * @param srcChars The characters to compare to this UnicodeString. - * @param srcLength the number of characters in `srcChars` to compare + * @param srcLength the number of characters in `srcChars` to compare * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `srcChars`, -1 if the characters in - * this are bitwise less than the characters in `srcChars`, +1 if the + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the * characters in this are bitwise greater than the characters - * in `srcChars`. + * in `srcChars`. * @stable ICU 2.0 */ - inline int8_t compare(ConstChar16Ptr srcChars, + inline int8_t compare(ConstChar16Ptr srcChars, int32_t srcLength) const; /** * Compare the characters bitwise in the range - * [`start`, `start + length`) with the first - * `length` characters in `srcChars` + * [`start`, `start + length`) with the first + * `length` characters in `srcChars` * @param start the offset at which the compare operation begins * @param length the number of characters to compare. * @param srcChars the characters to be compared * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `srcChars`, -1 if the characters in - * this are bitwise less than the characters in `srcChars`, +1 if the + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the * characters in this are bitwise greater than the characters - * in `srcChars`. + * in `srcChars`. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, - const char16_t *srcChars) const; + const char16_t *srcChars) const; /** * Compare the characters bitwise in the range - * [`start`, `start + length`) with the characters - * in `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`). + * [`start`, `start + length`) with the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`). * @param start the offset at which the compare operation begins * @param length the number of characters in this to compare * @param srcChars the characters to be compared - * @param srcStart the offset into `srcChars` to start comparison - * @param srcLength the number of characters in `srcChars` to compare + * @param srcStart the offset into `srcChars` to start comparison + * @param srcLength the number of characters in `srcChars` to compare * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `srcChars`, -1 if the characters in - * this are bitwise less than the characters in `srcChars`, +1 if the + * contains the same characters as `srcChars`, -1 if the characters in + * this are bitwise less than the characters in `srcChars`, +1 if the * characters in this are bitwise greater than the characters - * in `srcChars`. + * in `srcChars`. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; /** * Compare the characters bitwise in the range - * [`start`, `limit`) with the characters - * in `srcText` in the range - * [`srcStart`, `srcLimit`). + * [`start`, `limit`) with the characters + * in `srcText` in the range + * [`srcStart`, `srcLimit`). * @param start the offset at which the compare operation begins * @param limit the offset immediately following the compare operation * @param srcText the text to be compared - * @param srcStart the offset into `srcText` to start comparison - * @param srcLimit the offset into `srcText` to limit comparison + * @param srcStart the offset into `srcText` to start comparison + * @param srcLimit the offset into `srcText` to limit comparison * @return The result of bitwise character comparison: 0 if this - * contains the same characters as `srcText`, -1 if the characters in - * this are bitwise less than the characters in `srcText`, +1 if the + * contains the same characters as `srcText`, -1 if the characters in + * this are bitwise less than the characters in `srcText`, +1 if the * characters in this are bitwise greater than the characters - * in `srcText`. + * in `srcText`. * @stable ICU 2.0 */ inline int8_t compareBetween(int32_t start, @@ -592,7 +592,7 @@ public: * in code point order * @stable ICU 2.0 */ - inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars, + inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars, int32_t srcLength) const; /** @@ -616,7 +616,7 @@ public: */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, - const char16_t *srcChars) const; + const char16_t *srcChars) const; /** * Compare two Unicode strings in code point order. @@ -641,7 +641,7 @@ public: */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; @@ -765,7 +765,7 @@ public: * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ - inline int8_t caseCompare(ConstChar16Ptr srcChars, + inline int8_t caseCompare(ConstChar16Ptr srcChars, int32_t srcLength, uint32_t options) const; @@ -791,7 +791,7 @@ public: */ inline int8_t caseCompare(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, uint32_t options) const; /** @@ -818,7 +818,7 @@ public: */ inline int8_t caseCompare(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const; @@ -853,21 +853,21 @@ public: uint32_t options) const; /** - * Determine if this starts with the characters in `text` + * Determine if this starts with the characters in `text` * @param text The text to match. - * @return TRUE if this starts with the characters in `text`, + * @return TRUE if this starts with the characters in `text`, * FALSE otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& text) const; /** - * Determine if this starts with the characters in `srcText` - * in the range [`srcStart`, `srcStart + srcLength`). + * Determine if this starts with the characters in `srcText` + * in the range [`srcStart`, `srcStart + srcLength`). * @param srcText The text to match. - * @param srcStart the offset into `srcText` to start matching - * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this starts with the characters in `text`, + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcText` to match + * @return TRUE if this starts with the characters in `text`, * FALSE otherwise * @stable ICU 2.0 */ @@ -876,45 +876,45 @@ public: int32_t srcLength) const; /** - * Determine if this starts with the characters in `srcChars` + * Determine if this starts with the characters in `srcChars` * @param srcChars The characters to match. - * @param srcLength the number of characters in `srcChars` - * @return TRUE if this starts with the characters in `srcChars`, + * @param srcLength the number of characters in `srcChars` + * @return TRUE if this starts with the characters in `srcChars`, * FALSE otherwise * @stable ICU 2.0 */ - inline UBool startsWith(ConstChar16Ptr srcChars, + inline UBool startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const; /** - * Determine if this ends with the characters in `srcChars` - * in the range [`srcStart`, `srcStart + srcLength`). + * Determine if this ends with the characters in `srcChars` + * in the range [`srcStart`, `srcStart + srcLength`). * @param srcChars The characters to match. - * @param srcStart the offset into `srcText` to start matching - * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcChars` to match + * @return TRUE if this ends with the characters in `srcChars`, FALSE otherwise * @stable ICU 2.0 */ - inline UBool startsWith(const char16_t *srcChars, + inline UBool startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; /** - * Determine if this ends with the characters in `text` + * Determine if this ends with the characters in `text` * @param text The text to match. - * @return TRUE if this ends with the characters in `text`, + * @return TRUE if this ends with the characters in `text`, * FALSE otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& text) const; /** - * Determine if this ends with the characters in `srcText` - * in the range [`srcStart`, `srcStart + srcLength`). + * Determine if this ends with the characters in `srcText` + * in the range [`srcStart`, `srcStart + srcLength`). * @param srcText The text to match. - * @param srcStart the offset into `srcText` to start matching - * @param srcLength the number of characters in `srcText` to match - * @return TRUE if this ends with the characters in `text`, + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcText` to match + * @return TRUE if this ends with the characters in `text`, * FALSE otherwise * @stable ICU 2.0 */ @@ -923,27 +923,27 @@ public: int32_t srcLength) const; /** - * Determine if this ends with the characters in `srcChars` + * Determine if this ends with the characters in `srcChars` * @param srcChars The characters to match. - * @param srcLength the number of characters in `srcChars` - * @return TRUE if this ends with the characters in `srcChars`, + * @param srcLength the number of characters in `srcChars` + * @return TRUE if this ends with the characters in `srcChars`, * FALSE otherwise * @stable ICU 2.0 */ - inline UBool endsWith(ConstChar16Ptr srcChars, + inline UBool endsWith(ConstChar16Ptr srcChars, int32_t srcLength) const; /** - * Determine if this ends with the characters in `srcChars` - * in the range [`srcStart`, `srcStart + srcLength`). + * Determine if this ends with the characters in `srcChars` + * in the range [`srcStart`, `srcStart + srcLength`). * @param srcChars The characters to match. - * @param srcStart the offset into `srcText` to start matching - * @param srcLength the number of characters in `srcChars` to match - * @return TRUE if this ends with the characters in `srcChars`, + * @param srcStart the offset into `srcText` to start matching + * @param srcLength the number of characters in `srcChars` to match + * @return TRUE if this ends with the characters in `srcChars`, * FALSE otherwise * @stable ICU 2.0 */ - inline UBool endsWith(const char16_t *srcChars, + inline UBool endsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; @@ -951,21 +951,21 @@ public: /* Searching - bitwise only */ /** - * Locate in this the first occurrence of the characters in `text`, + * Locate in this the first occurrence of the characters in `text`, * using bitwise comparison. * @param text The text to search for. - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UnicodeString& text) const; /** - * Locate in this the first occurrence of the characters in `text` - * starting at offset `start`, using bitwise comparison. + * Locate in this the first occurrence of the characters in `text` + * starting at offset `start`, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -974,12 +974,12 @@ public: /** * Locate in this the first occurrence in the range - * [`start`, `start + length`) of the characters - * in `text`, using bitwise comparison. + * [`start`, `start + length`) of the characters + * in `text`, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @param length The number of characters to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -989,17 +989,17 @@ public: /** * Locate in this the first occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`), + * [`start`, `start + length`) of the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`), * using bitwise comparison. * @param srcText The text to search for. - * @param srcStart the offset into `srcText` at which + * @param srcStart the offset into `srcText` at which * to start matching - * @param srcLength the number of characters in `srcText` to match + * @param srcLength the number of characters in `srcText` to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -1011,123 +1011,123 @@ public: /** * Locate in this the first occurrence of the characters in - * `srcChars` - * starting at offset `start`, using bitwise comparison. + * `srcChars` + * starting at offset `start`, using bitwise comparison. * @param srcChars The text to search for. - * @param srcLength the number of characters in `srcChars` to match + * @param srcLength the number of characters in `srcChars` to match * @param start the offset into this at which to start matching - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ - inline int32_t indexOf(const char16_t *srcChars, + inline int32_t indexOf(const char16_t *srcChars, int32_t srcLength, int32_t start) const; /** * Locate in this the first occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcChars`, using bitwise comparison. + * [`start`, `start + length`) of the characters + * in `srcChars`, using bitwise comparison. * @param srcChars The text to search for. - * @param srcLength the number of characters in `srcChars` + * @param srcLength the number of characters in `srcChars` * @param start The offset at which searching will start. * @param length The number of characters to search - * @return The offset into this of the start of `srcChars`, + * @return The offset into this of the start of `srcChars`, * or -1 if not found. * @stable ICU 2.0 */ - inline int32_t indexOf(ConstChar16Ptr srcChars, + inline int32_t indexOf(ConstChar16Ptr srcChars, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the first occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`), + * [`start`, `start + length`) of the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`), * using bitwise comparison. * @param srcChars The text to search for. - * @param srcStart the offset into `srcChars` at which + * @param srcStart the offset into `srcChars` at which * to start matching - * @param srcLength the number of characters in `srcChars` to match + * @param srcLength the number of characters in `srcChars` to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ - int32_t indexOf(const char16_t *srcChars, + int32_t indexOf(const char16_t *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** - * Locate in this the first occurrence of the BMP code point `c`, + * Locate in this the first occurrence of the BMP code point `c`, * using bitwise comparison. * @param c The code unit to search for. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t indexOf(char16_t c) const; + inline int32_t indexOf(char16_t c) const; /** - * Locate in this the first occurrence of the code point `c`, + * Locate in this the first occurrence of the code point `c`, * using bitwise comparison. * * @param c The code point to search for. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c) const; /** - * Locate in this the first occurrence of the BMP code point `c`, - * starting at offset `start`, using bitwise comparison. + * Locate in this the first occurrence of the BMP code point `c`, + * starting at offset `start`, using bitwise comparison. * @param c The code unit to search for. * @param start The offset at which searching will start. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t indexOf(char16_t c, + inline int32_t indexOf(char16_t c, int32_t start) const; /** - * Locate in this the first occurrence of the code point `c` - * starting at offset `start`, using bitwise comparison. + * Locate in this the first occurrence of the code point `c` + * starting at offset `start`, using bitwise comparison. * * @param c The code point to search for. * @param start The offset at which searching will start. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c, int32_t start) const; /** - * Locate in this the first occurrence of the BMP code point `c` - * in the range [`start`, `start + length`), + * Locate in this the first occurrence of the BMP code point `c` + * in the range [`start`, `start + length`), * using bitwise comparison. * @param c The code unit to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t indexOf(char16_t c, + inline int32_t indexOf(char16_t c, int32_t start, int32_t length) const; /** - * Locate in this the first occurrence of the code point `c` - * in the range [`start`, `start + length`), + * Locate in this the first occurrence of the code point `c` + * in the range [`start`, `start + length`), * using bitwise comparison. * * @param c The code point to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c, @@ -1135,21 +1135,21 @@ public: int32_t length) const; /** - * Locate in this the last occurrence of the characters in `text`, + * Locate in this the last occurrence of the characters in `text`, * using bitwise comparison. * @param text The text to search for. - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UnicodeString& text) const; /** - * Locate in this the last occurrence of the characters in `text` - * starting at offset `start`, using bitwise comparison. + * Locate in this the last occurrence of the characters in `text` + * starting at offset `start`, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -1158,12 +1158,12 @@ public: /** * Locate in this the last occurrence in the range - * [`start`, `start + length`) of the characters - * in `text`, using bitwise comparison. + * [`start`, `start + length`) of the characters + * in `text`, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @param length The number of characters to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -1173,17 +1173,17 @@ public: /** * Locate in this the last occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`), + * [`start`, `start + length`) of the characters + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`), * using bitwise comparison. * @param srcText The text to search for. - * @param srcStart the offset into `srcText` at which + * @param srcStart the offset into `srcText` at which * to start matching - * @param srcLength the number of characters in `srcText` to match + * @param srcLength the number of characters in `srcText` to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ @@ -1194,123 +1194,123 @@ public: int32_t length) const; /** - * Locate in this the last occurrence of the characters in `srcChars` - * starting at offset `start`, using bitwise comparison. + * Locate in this the last occurrence of the characters in `srcChars` + * starting at offset `start`, using bitwise comparison. * @param srcChars The text to search for. - * @param srcLength the number of characters in `srcChars` to match + * @param srcLength the number of characters in `srcChars` to match * @param start the offset into this at which to start matching - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ - inline int32_t lastIndexOf(const char16_t *srcChars, + inline int32_t lastIndexOf(const char16_t *srcChars, int32_t srcLength, int32_t start) const; /** * Locate in this the last occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcChars`, using bitwise comparison. + * [`start`, `start + length`) of the characters + * in `srcChars`, using bitwise comparison. * @param srcChars The text to search for. - * @param srcLength the number of characters in `srcChars` + * @param srcLength the number of characters in `srcChars` * @param start The offset at which searching will start. * @param length The number of characters to search - * @return The offset into this of the start of `srcChars`, + * @return The offset into this of the start of `srcChars`, * or -1 if not found. * @stable ICU 2.0 */ - inline int32_t lastIndexOf(ConstChar16Ptr srcChars, + inline int32_t lastIndexOf(ConstChar16Ptr srcChars, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the last occurrence in the range - * [`start`, `start + length`) of the characters - * in `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`), + * [`start`, `start + length`) of the characters + * in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`), * using bitwise comparison. * @param srcChars The text to search for. - * @param srcStart the offset into `srcChars` at which + * @param srcStart the offset into `srcChars` at which * to start matching - * @param srcLength the number of characters in `srcChars` to match + * @param srcLength the number of characters in `srcChars` to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of the start of `text`, + * @return The offset into this of the start of `text`, * or -1 if not found. * @stable ICU 2.0 */ - int32_t lastIndexOf(const char16_t *srcChars, + int32_t lastIndexOf(const char16_t *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** - * Locate in this the last occurrence of the BMP code point `c`, + * Locate in this the last occurrence of the BMP code point `c`, * using bitwise comparison. * @param c The code unit to search for. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t lastIndexOf(char16_t c) const; + inline int32_t lastIndexOf(char16_t c) const; /** - * Locate in this the last occurrence of the code point `c`, + * Locate in this the last occurrence of the code point `c`, * using bitwise comparison. * * @param c The code point to search for. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c) const; /** - * Locate in this the last occurrence of the BMP code point `c` - * starting at offset `start`, using bitwise comparison. + * Locate in this the last occurrence of the BMP code point `c` + * starting at offset `start`, using bitwise comparison. * @param c The code unit to search for. * @param start The offset at which searching will start. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t lastIndexOf(char16_t c, + inline int32_t lastIndexOf(char16_t c, int32_t start) const; /** - * Locate in this the last occurrence of the code point `c` - * starting at offset `start`, using bitwise comparison. + * Locate in this the last occurrence of the code point `c` + * starting at offset `start`, using bitwise comparison. * * @param c The code point to search for. * @param start The offset at which searching will start. - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c, int32_t start) const; /** - * Locate in this the last occurrence of the BMP code point `c` - * in the range [`start`, `start + length`), + * Locate in this the last occurrence of the BMP code point `c` + * in the range [`start`, `start + length`), * using bitwise comparison. * @param c The code unit to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ - inline int32_t lastIndexOf(char16_t c, + inline int32_t lastIndexOf(char16_t c, int32_t start, int32_t length) const; /** - * Locate in this the last occurrence of the code point `c` - * in the range [`start`, `start + length`), + * Locate in this the last occurrence of the code point `c` + * in the range [`start`, `start + length`), * using bitwise comparison. * * @param c The code point to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search - * @return The offset into this of `c`, or -1 if not found. + * @return The offset into this of `c`, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c, @@ -1321,32 +1321,32 @@ public: /* Character access */ /** - * Return the code unit at offset `offset`. + * Return the code unit at offset `offset`. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text - * @return the code unit at offset `offset` + * @return the code unit at offset `offset` * or 0xffff if the offset is not valid for this string * @stable ICU 2.0 */ - inline char16_t charAt(int32_t offset) const; + inline char16_t charAt(int32_t offset) const; /** - * Return the code unit at offset `offset`. + * Return the code unit at offset `offset`. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text - * @return the code unit at offset `offset` + * @return the code unit at offset `offset` * @stable ICU 2.0 */ - inline char16_t operator[] (int32_t offset) const; + inline char16_t operator[] (int32_t offset) const; /** * Return the code point that contains the code unit - * at offset `offset`. + * at offset `offset`. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text * that indicates the text offset of any of the code units * that will be assembled into a code point (21-bit value) and returned - * @return the code point of text at `offset` + * @return the code point of text at `offset` * or 0xffff if the offset is not valid for this string * @stable ICU 2.0 */ @@ -1403,33 +1403,33 @@ public: * This behaves like CharacterIterator::move32(delta, kCurrent). * * Behavior for out-of-bounds indexes: - * `moveIndex32` pins the input index to 0..length(), i.e., + * `moveIndex32` pins the input index to 0..length(), i.e., * if the input index<0 then it is pinned to 0; * if it is index>length() then it is pinned to length(). - * Afterwards, the index is moved by `delta` code points + * Afterwards, the index is moved by `delta` code points * forward or backward, * but no further backward than to 0 and no further forward than to length(). * The resulting index return value will be in between 0 and length(), inclusively. * * Examples: - * \code - * // s has code points 'a' U+10000 'b' U+10ffff U+2029 - * UnicodeString s(u"a\U00010000b\U0010ffff\u2029"); + * \code + * // s has code points 'a' U+10000 'b' U+10ffff U+2029 + * UnicodeString s(u"a\U00010000b\U0010ffff\u2029"); * - * // initial index: position of U+10000 - * int32_t index=1; + * // initial index: position of U+10000 + * int32_t index=1; * - * // the following examples will all result in index==4, position of U+10ffff + * // the following examples will all result in index==4, position of U+10ffff * - * // skip 2 code points from some position in the string - * index=s.moveIndex32(index, 2); // skips U+10000 and 'b' + * // skip 2 code points from some position in the string + * index=s.moveIndex32(index, 2); // skips U+10000 and 'b' * - * // go to the 3rd code point from the start of s (0-based) - * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b' + * // go to the 3rd code point from the start of s (0-based) + * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b' * - * // go to the next-to-last code point of s - * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff - * \endcode + * // go to the next-to-last code point of s + * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff + * \endcode * * @param index input code unit index * @param delta (signed) code point count to move the index forward or backward @@ -1443,22 +1443,22 @@ public: /** * Copy the characters in the range - * [`start`, `start + length`) into the array `dst`, - * beginning at `dstStart`. - * If the string aliases to `dst` itself as an external buffer, + * [`start`, `start + length`) into the array `dst`, + * beginning at `dstStart`. + * If the string aliases to `dst` itself as an external buffer, * then extract() will not copy the contents. * * @param start offset of first character which will be copied into the array * @param length the number of characters to extract - * @param dst array in which to copy characters. The length of `dst` - * must be at least (`dstStart + length`). - * @param dstStart the offset in `dst` where the first character + * @param dst array in which to copy characters. The length of `dst` + * must be at least (`dstStart + length`). + * @param dstStart the offset in `dst` where the first character * will be extracted * @stable ICU 2.0 */ inline void extract(int32_t start, int32_t length, - Char16Ptr dst, + Char16Ptr dst, int32_t dstStart = 0) const; /** @@ -1473,23 +1473,23 @@ public: * If the string itself does not fit into dest * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR. * - * If the string aliases to `dest` itself as an external buffer, + * If the string aliases to `dest` itself as an external buffer, * then extract() will not copy the contents. * * @param dest Destination string buffer. - * @param destCapacity Number of char16_ts available at dest. + * @param destCapacity Number of char16_ts available at dest. * @param errorCode ICU error code. * @return length() * @stable ICU 2.0 */ int32_t - extract(Char16Ptr dest, int32_t destCapacity, + extract(Char16Ptr dest, int32_t destCapacity, UErrorCode &errorCode) const; /** * Copy the characters in the range - * [`start`, `start + length`) into the UnicodeString - * `target`. + * [`start`, `start + length`) into the UnicodeString + * `target`. * @param start offset of first character which will be copied * @param length the number of characters to extract * @param target UnicodeString into which to copy characters. @@ -1500,24 +1500,24 @@ public: UnicodeString& target) const; /** - * Copy the characters in the range [`start`, `limit`) - * into the array `dst`, beginning at `dstStart`. + * Copy the characters in the range [`start`, `limit`) + * into the array `dst`, beginning at `dstStart`. * @param start offset of first character which will be copied into the array * @param limit offset immediately following the last character to be copied - * @param dst array in which to copy characters. The length of `dst` - * must be at least (`dstStart + (limit - start)`). - * @param dstStart the offset in `dst` where the first character + * @param dst array in which to copy characters. The length of `dst` + * must be at least (`dstStart + (limit - start)`). + * @param dstStart the offset in `dst` where the first character * will be extracted * @stable ICU 2.0 */ inline void extractBetween(int32_t start, int32_t limit, - char16_t *dst, + char16_t *dst, int32_t dstStart = 0) const; /** - * Copy the characters in the range [`start`, `limit`) - * into the UnicodeString `target`. Replaceable API. + * Copy the characters in the range [`start`, `limit`) + * into the UnicodeString `target`. Replaceable API. * @param start offset of first character which will be copied * @param limit offset immediately following the last character to be copied * @param target UnicodeString into which to copy characters. @@ -1529,11 +1529,11 @@ public: /** * Copy the characters in the range - * [`start`, `start + startLength`) into an array of characters. + * [`start`, `start + startLength`) into an array of characters. * All characters must be invariant (see utypes.h). * Use US_INV as the last, signature-distinguishing parameter. * - * This function does not write any more than `targetCapacity` + * This function does not write any more than `targetCapacity` * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. @@ -1558,9 +1558,9 @@ public: /** * Copy the characters in the range - * [`start`, `start + length`) into an array of characters + * [`start`, `start + length`) into an array of characters * in the platform's default codepage. - * This function does not write any more than `targetLength` + * This function does not write any more than `targetLength` * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. @@ -1570,8 +1570,8 @@ public: * @param startLength the number of characters to extract * @param target the target buffer for extraction * @param targetLength the length of the target buffer - * If `target` is NULL, then the number of bytes required for - * `target` is returned. + * If `target` is NULL, then the number of bytes required for + * `target` is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 */ @@ -1586,7 +1586,7 @@ public: /** * Copy the characters in the range - * [`start`, `start + length`) into an array of characters + * [`start`, `start + length`) into an array of characters * in a specified codepage. * The output string is NUL-terminated. * @@ -1600,11 +1600,11 @@ public: * @param target the target buffer for extraction * @param codepage the desired codepage for the characters. 0 has * the special meaning of the default codepage - * If `codepage` is an empty string (`""`), + * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. - * If `target` is NULL, then the number of bytes required for - * `target` is returned. It is assumed that the target is big enough + * If `target` is NULL, then the number of bytes required for + * `target` is returned. It is assumed that the target is big enough * to fit all of the characters. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 @@ -1616,9 +1616,9 @@ public: /** * Copy the characters in the range - * [`start`, `start + length`) into an array of characters + * [`start`, `start + length`) into an array of characters * in a specified codepage. - * This function does not write any more than `targetLength` + * This function does not write any more than `targetLength` * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. @@ -1635,11 +1635,11 @@ public: * @param targetLength the length of the target buffer * @param codepage the desired codepage for the characters. 0 has * the special meaning of the default codepage - * If `codepage` is an empty string (`""`), + * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. - * If `target` is NULL, then the number of bytes required for - * `target` is returned. + * If `target` is NULL, then the number of bytes required for + * `target` is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 */ @@ -1726,7 +1726,7 @@ public: */ template<typename StringClass> StringClass &toUTF8String(StringClass &result) const { - StringByteSink<StringClass> sbs(&result, length()); + StringByteSink<StringClass> sbs(&result, length()); toUTF8(sbs); return result; } @@ -1752,7 +1752,7 @@ public: /** * Return the length of the UnicodeString object. - * The length is the number of char16_t code units are in the UnicodeString. + * The length is the number of char16_t code units are in the UnicodeString. * If you want the number of code points, please use countChar32(). * @return the length of the UnicodeString object * @see countChar32 @@ -1761,14 +1761,14 @@ public: inline int32_t length(void) const; /** - * Count Unicode code points in the length char16_t code units of the string. - * A code point may occupy either one or two char16_t code units. + * Count Unicode code points in the length char16_t code units of the string. + * A code point may occupy either one or two char16_t code units. * Counting code points involves reading all code units. * * This functions is basically the inverse of moveIndex32(). * * @param start the index of the first code unit to check - * @param length the number of char16_t code units to check + * @param length the number of char16_t code units to check * @return the number of code points in the specified code units * @see length * @stable ICU 2.0 @@ -1777,7 +1777,7 @@ public: countChar32(int32_t start=0, int32_t length=INT32_MAX) const; /** - * Check if the length char16_t code units of the string + * Check if the length char16_t code units of the string * contain more Unicode code points than a certain number. * This is more efficient than counting all code points in this part of the string * and comparing that number with a threshold. @@ -1785,10 +1785,10 @@ public: * falls within a certain range, and * never needs to count more than 'number+1' code points. * Logically equivalent to (countChar32(start, length)>number). - * A Unicode code point may occupy either one or two char16_t code units. + * A Unicode code point may occupy either one or two char16_t code units. * * @param start the index of the first code unit to check (0 for the entire string) - * @param length the number of char16_t code units to check + * @param length the number of char16_t code units to check * (use INT32_MAX for the entire string; remember that start/length * values are pinned) * @param number The number of code points in the (sub)string is compared against @@ -1814,7 +1814,7 @@ public: * This is useful together with the getBuffer functions. * See there for details. * - * @return the number of char16_ts available in the internal buffer + * @return the number of char16_ts available in the internal buffer * @see getBuffer * @stable ICU 2.0 */ @@ -1852,7 +1852,7 @@ public: /** * Assignment operator. Replace the characters in this UnicodeString - * with the characters from `srcText`. + * with the characters from `srcText`. * * Starting with ICU 2.4, the assignment operator and the copy constructor * allocate a new buffer and copy the buffer contents even for readonly aliases. @@ -1873,7 +1873,7 @@ public: /** * Almost the same as the assignment operator. * Replace the characters in this UnicodeString - * with the characters from `srcText`. + * with the characters from `srcText`. * * This function works the same as the assignment operator * for all strings except for ones that are readonly aliases. @@ -1898,14 +1898,14 @@ public: UnicodeString &fastCopyFrom(const UnicodeString &src); /** - * Move assignment operator; might leave src in bogus state. + * Move assignment operator; might leave src in bogus state. * This string will have the same contents and state that the source string had. * The behavior is undefined if *this and src are the same object. * @param src source string * @return *this * @stable ICU 56 */ - UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT; + UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT; /** * Swap strings. @@ -1920,23 +1920,23 @@ public: * @param s2 will get s1's contents and state * @stable ICU 56 */ - friend inline void U_EXPORT2 + friend inline void U_EXPORT2 swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { s1.swap(s2); } /** * Assignment operator. Replace the characters in this UnicodeString - * with the code unit `ch`. + * with the code unit `ch`. * @param ch the code unit to replace * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& operator= (char16_t ch); + inline UnicodeString& operator= (char16_t ch); /** * Assignment operator. Replace the characters in this UnicodeString - * with the code point `ch`. + * with the code point `ch`. * @param ch the code point to replace * @return a reference to this * @stable ICU 2.0 @@ -1945,11 +1945,11 @@ public: /** * Set the text in the UnicodeString object to the characters - * in `srcText` in the range - * [`srcStart`, `srcText.length()`). - * `srcText` is not modified. + * in `srcText` in the range + * [`srcStart`, `srcText.length()`). + * `srcText` is not modified. * @param srcText the source for the new characters - * @param srcStart the offset into `srcText` where new characters + * @param srcStart the offset into `srcText` where new characters * will be obtained * @return a reference to this * @stable ICU 2.2 @@ -1959,13 +1959,13 @@ public: /** * Set the text in the UnicodeString object to the characters - * in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`). - * `srcText` is not modified. + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). + * `srcText` is not modified. * @param srcText the source for the new characters - * @param srcStart the offset into `srcText` where new characters + * @param srcStart the offset into `srcText` where new characters * will be obtained - * @param srcLength the number of characters in `srcText` in the + * @param srcLength the number of characters in `srcText` in the * replace string. * @return a reference to this * @stable ICU 2.0 @@ -1976,8 +1976,8 @@ public: /** * Set the text in the UnicodeString object to the characters in - * `srcText`. - * `srcText` is not modified. + * `srcText`. + * `srcText` is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 @@ -1986,37 +1986,37 @@ public: /** * Set the characters in the UnicodeString object to the characters - * in `srcChars`. `srcChars` is not modified. + * in `srcChars`. `srcChars` is not modified. * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars. * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& setTo(const char16_t *srcChars, + inline UnicodeString& setTo(const char16_t *srcChars, int32_t srcLength); /** * Set the characters in the UnicodeString object to the code unit - * `srcChar`. + * `srcChar`. * @param srcChar the code unit which becomes the UnicodeString's character * content * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& setTo(char16_t srcChar); + inline UnicodeString& setTo(char16_t srcChar); /** * Set the characters in the UnicodeString object to the code point - * `srcChar`. + * `srcChar`. * @param srcChar the code point which becomes the UnicodeString's character * content * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& setTo(UChar32 srcChar); + inline UnicodeString& setTo(UChar32 srcChar); /** - * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor. + * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has copy-on-write semantics: @@ -2029,21 +2029,21 @@ public: * When using fastCopyFrom(), the text will be aliased again, * so that both strings then alias the same readonly-text. * - * @param isTerminated specifies if `text` is `NUL`-terminated. - * This must be true if `textLength==-1`. + * @param isTerminated specifies if `text` is `NUL`-terminated. + * This must be true if `textLength==-1`. * @param text The characters to alias for the UnicodeString. - * @param textLength The number of Unicode characters in `text` to alias. + * @param textLength The number of Unicode characters in `text` to alias. * If -1, then this constructor will determine the length - * by calling `u_strlen()`. + * by calling `u_strlen()`. * @return a reference to this * @stable ICU 2.0 */ UnicodeString &setTo(UBool isTerminated, - ConstChar16Ptr text, + ConstChar16Ptr text, int32_t textLength); /** - * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor. + * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has write-through semantics: @@ -2052,16 +2052,16 @@ public: * a new buffer will be allocated and the contents copied as with regularly * constructed strings. * In an assignment to another UnicodeString, the buffer will be copied. - * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same * as the string buffer itself and will in this case not copy the contents. * * @param buffer The characters to alias for the UnicodeString. - * @param buffLength The number of Unicode characters in `buffer` to alias. - * @param buffCapacity The size of `buffer` in char16_ts. + * @param buffLength The number of Unicode characters in `buffer` to alias. + * @param buffCapacity The size of `buffer` in char16_ts. * @return a reference to this * @stable ICU 2.0 */ - UnicodeString &setTo(char16_t *buffer, + UnicodeString &setTo(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); @@ -2097,7 +2097,7 @@ public: * s.truncate(0); // set to an empty string (complete truncation), or * s=UnicodeString(); // assign an empty string, or * s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or - * s.setTo(u"", 0); // set to an empty C Unicode string + * s.setTo(u"", 0); // set to an empty C Unicode string * } * \endcode * @@ -2114,22 +2114,22 @@ public: * @stable ICU 2.0 */ UnicodeString& setCharAt(int32_t offset, - char16_t ch); + char16_t ch); /* Append operations */ /** - * Append operator. Append the code unit `ch` to the UnicodeString + * Append operator. Append the code unit `ch` to the UnicodeString * object. * @param ch the code unit to be appended * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& operator+= (char16_t ch); + inline UnicodeString& operator+= (char16_t ch); /** - * Append operator. Append the code point `ch` to the UnicodeString + * Append operator. Append the code point `ch` to the UnicodeString * object. * @param ch the code point to be appended * @return a reference to this @@ -2138,8 +2138,8 @@ public: inline UnicodeString& operator+= (UChar32 ch); /** - * Append operator. Append the characters in `srcText` to the - * UnicodeString object. `srcText` is not modified. + * Append operator. Append the characters in `srcText` to the + * UnicodeString object. `srcText` is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 @@ -2148,14 +2148,14 @@ public: /** * Append the characters - * in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`) to the - * UnicodeString object at offset `start`. `srcText` + * in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`) to the + * UnicodeString object at offset `start`. `srcText` * is not modified. * @param srcText the source for the new characters - * @param srcStart the offset into `srcText` where new characters + * @param srcStart the offset into `srcText` where new characters * will be obtained - * @param srcLength the number of characters in `srcText` in + * @param srcLength the number of characters in `srcText` in * the append string * @return a reference to this * @stable ICU 2.0 @@ -2165,8 +2165,8 @@ public: int32_t srcLength); /** - * Append the characters in `srcText` to the UnicodeString object. - * `srcText` is not modified. + * Append the characters in `srcText` to the UnicodeString object. + * `srcText` is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 @@ -2174,44 +2174,44 @@ public: inline UnicodeString& append(const UnicodeString& srcText); /** - * Append the characters in `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`) to the UnicodeString + * Append the characters in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`) to the UnicodeString * object at offset - * `start`. `srcChars` is not modified. + * `start`. `srcChars` is not modified. * @param srcChars the source for the new characters - * @param srcStart the offset into `srcChars` where new characters + * @param srcStart the offset into `srcChars` where new characters * will be obtained - * @param srcLength the number of characters in `srcChars` in - * the append string; can be -1 if `srcChars` is NUL-terminated + * @param srcLength the number of characters in `srcChars` in + * the append string; can be -1 if `srcChars` is NUL-terminated * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& append(const char16_t *srcChars, + inline UnicodeString& append(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); /** - * Append the characters in `srcChars` to the UnicodeString object - * at offset `start`. `srcChars` is not modified. + * Append the characters in `srcChars` to the UnicodeString object + * at offset `start`. `srcChars` is not modified. * @param srcChars the source for the new characters - * @param srcLength the number of Unicode characters in `srcChars`; - * can be -1 if `srcChars` is NUL-terminated + * @param srcLength the number of Unicode characters in `srcChars`; + * can be -1 if `srcChars` is NUL-terminated * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& append(ConstChar16Ptr srcChars, + inline UnicodeString& append(ConstChar16Ptr srcChars, int32_t srcLength); /** - * Append the code unit `srcChar` to the UnicodeString object. + * Append the code unit `srcChar` to the UnicodeString object. * @param srcChar the code unit to append * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& append(char16_t srcChar); + inline UnicodeString& append(char16_t srcChar); /** - * Append the code point `srcChar` to the UnicodeString object. + * Append the code point `srcChar` to the UnicodeString object. * @param srcChar the code point to append * @return a reference to this * @stable ICU 2.0 @@ -2222,14 +2222,14 @@ public: /* Insert operations */ /** - * Insert the characters in `srcText` in the range - * [`srcStart`, `srcStart + srcLength`) into the UnicodeString - * object at offset `start`. `srcText` is not modified. + * Insert the characters in `srcText` in the range + * [`srcStart`, `srcStart + srcLength`) into the UnicodeString + * object at offset `start`. `srcText` is not modified. * @param start the offset where the insertion begins * @param srcText the source for the new characters - * @param srcStart the offset into `srcText` where new characters + * @param srcStart the offset into `srcText` where new characters * will be obtained - * @param srcLength the number of characters in `srcText` in + * @param srcLength the number of characters in `srcText` in * the insert string * @return a reference to this * @stable ICU 2.0 @@ -2240,8 +2240,8 @@ public: int32_t srcLength); /** - * Insert the characters in `srcText` into the UnicodeString object - * at offset `start`. `srcText` is not modified. + * Insert the characters in `srcText` into the UnicodeString object + * at offset `start`. `srcText` is not modified. * @param start the offset where the insertion begins * @param srcText the source for the new characters * @return a reference to this @@ -2251,26 +2251,26 @@ public: const UnicodeString& srcText); /** - * Insert the characters in `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`) into the UnicodeString - * object at offset `start`. `srcChars` is not modified. + * Insert the characters in `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`) into the UnicodeString + * object at offset `start`. `srcChars` is not modified. * @param start the offset at which the insertion begins * @param srcChars the source for the new characters - * @param srcStart the offset into `srcChars` where new characters + * @param srcStart the offset into `srcChars` where new characters * will be obtained - * @param srcLength the number of characters in `srcChars` + * @param srcLength the number of characters in `srcChars` * in the insert string * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength); /** - * Insert the characters in `srcChars` into the UnicodeString object - * at offset `start`. `srcChars` is not modified. + * Insert the characters in `srcChars` into the UnicodeString object + * at offset `start`. `srcChars` is not modified. * @param start the offset where the insertion begins * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars. @@ -2278,23 +2278,23 @@ public: * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, - ConstChar16Ptr srcChars, + ConstChar16Ptr srcChars, int32_t srcLength); /** - * Insert the code unit `srcChar` into the UnicodeString object at - * offset `start`. + * Insert the code unit `srcChar` into the UnicodeString object at + * offset `start`. * @param start the offset at which the insertion occurs * @param srcChar the code unit to insert * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, - char16_t srcChar); + char16_t srcChar); /** - * Insert the code point `srcChar` into the UnicodeString object at - * offset `start`. + * Insert the code point `srcChar` into the UnicodeString object at + * offset `start`. * @param start the offset at which the insertion occurs * @param srcChar the code point to insert * @return a reference to this @@ -2308,22 +2308,22 @@ public: /** * Replace the characters in the range - * [`start`, `start + length`) with the characters in - * `srcText` in the range - * [`srcStart`, `srcStart + srcLength`). - * `srcText` is not modified. + * [`start`, `start + length`) with the characters in + * `srcText` in the range + * [`srcStart`, `srcStart + srcLength`). + * `srcText` is not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcText the source for the new characters - * @param srcStart the offset into `srcText` where new characters + * @param srcStart the offset into `srcText` where new characters * will be obtained - * @param srcLength the number of characters in `srcText` in + * @param srcLength the number of characters in `srcText` in * the replace string * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& replace(int32_t start, + inline UnicodeString& replace(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, @@ -2331,50 +2331,50 @@ public: /** * Replace the characters in the range - * [`start`, `start + length`) - * with the characters in `srcText`. `srcText` is + * [`start`, `start + length`) + * with the characters in `srcText`. `srcText` is * not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& replace(int32_t start, + inline UnicodeString& replace(int32_t start, int32_t length, const UnicodeString& srcText); /** * Replace the characters in the range - * [`start`, `start + length`) with the characters in - * `srcChars` in the range - * [`srcStart`, `srcStart + srcLength`). `srcChars` + * [`start`, `start + length`) with the characters in + * `srcChars` in the range + * [`srcStart`, `srcStart + srcLength`). `srcChars` * is not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcChars the source for the new characters - * @param srcStart the offset into `srcChars` where new characters + * @param srcStart the offset into `srcChars` where new characters * will be obtained - * @param srcLength the number of characters in `srcChars` + * @param srcLength the number of characters in `srcChars` * in the replace string * @return a reference to this * @stable ICU 2.0 */ - inline UnicodeString& replace(int32_t start, + inline UnicodeString& replace(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength); /** * Replace the characters in the range - * [`start`, `start + length`) with the characters in - * `srcChars`. `srcChars` is not modified. + * [`start`, `start + length`) with the characters in + * `srcChars`. `srcChars` is not modified. * @param start the offset at which the replace operation begins * @param length number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars * @return a reference to this @@ -2382,31 +2382,31 @@ public: */ inline UnicodeString& replace(int32_t start, int32_t length, - ConstChar16Ptr srcChars, + ConstChar16Ptr srcChars, int32_t srcLength); /** * Replace the characters in the range - * [`start`, `start + length`) with the code unit - * `srcChar`. + * [`start`, `start + length`) with the code unit + * `srcChar`. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcChar the new code unit * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replace(int32_t start, int32_t length, - char16_t srcChar); + char16_t srcChar); /** * Replace the characters in the range - * [`start`, `start + length`) with the code point - * `srcChar`. + * [`start`, `start + length`) with the code point + * `srcChar`. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at - * `start + length` is not modified. + * `start + length` is not modified. * @param srcChar the new code point * @return a reference to this * @stable ICU 2.0 @@ -2414,8 +2414,8 @@ public: UnicodeString& replace(int32_t start, int32_t length, UChar32 srcChar); /** - * Replace the characters in the range [`start`, `limit`) - * with the characters in `srcText`. `srcText` is not modified. + * Replace the characters in the range [`start`, `limit`) + * with the characters in `srcText`. `srcText` is not modified. * @param start the offset at which the replace operation begins * @param limit the offset immediately following the replace range * @param srcText the source for the new characters @@ -2427,16 +2427,16 @@ public: const UnicodeString& srcText); /** - * Replace the characters in the range [`start`, `limit`) - * with the characters in `srcText` in the range - * [`srcStart`, `srcLimit`). `srcText` is not modified. + * Replace the characters in the range [`start`, `limit`) + * with the characters in `srcText` in the range + * [`srcStart`, `srcLimit`). `srcText` is not modified. * @param start the offset at which the replace operation begins * @param limit the offset immediately following the replace range * @param srcText the source for the new characters - * @param srcStart the offset into `srcChars` where new characters + * @param srcStart the offset into `srcChars` where new characters * will be obtained * @param srcLimit the offset immediately following the range to copy - * in `srcText` + * in `srcText` * @return a reference to this * @stable ICU 2.0 */ @@ -2448,9 +2448,9 @@ public: /** * Replace a substring of this object with the given text. - * @param start the beginning index, inclusive; `0 <= start <= limit`. - * @param limit the ending index, exclusive; `start <= limit <= length()`. - * @param text the text to replace characters `start` to `limit - 1` + * @param start the beginning index, inclusive; `0 <= start <= limit`. + * @param limit the ending index, exclusive; `start <= limit <= length()`. + * @param text the text to replace characters `start` to `limit - 1` * @stable ICU 2.0 */ virtual void handleReplaceBetween(int32_t start, @@ -2469,12 +2469,12 @@ public: * information. This method is used to duplicate or reorder substrings. * The destination index must not overlap the source range. * - * @param start the beginning index, inclusive; `0 <= start <= limit`. - * @param limit the ending index, exclusive; `start <= limit <= length()`. + * @param start the beginning index, inclusive; `0 <= start <= limit`. + * @param limit the ending index, exclusive; `start <= limit <= length()`. * @param dest the destination index. The characters from - * `start..limit-1` will be copied to `dest`. - * Implementations of this method may assume that `dest <= start || - * dest >= limit`. + * `start..limit-1` will be copied to `dest`. + * Implementations of this method may assume that `dest <= start || + * dest >= limit`. * @stable ICU 2.0 */ virtual void copy(int32_t start, int32_t limit, int32_t dest); @@ -2495,7 +2495,7 @@ public: /** * Replace all occurrences of characters in oldText with characters * in newText - * in the range [`start`, `start + length`). + * in the range [`start`, `start + length`). * @param start the start of the range in which replace will performed * @param length the length of the range in which replace will be performed * @param oldText the text containing the search text @@ -2510,18 +2510,18 @@ public: /** * Replace all occurrences of characters in oldText in the range - * [`oldStart`, `oldStart + oldLength`) with the characters + * [`oldStart`, `oldStart + oldLength`) with the characters * in newText in the range - * [`newStart`, `newStart + newLength`) - * in the range [`start`, `start + length`). + * [`newStart`, `newStart + newLength`) + * in the range [`start`, `start + length`). * @param start the start of the range in which replace will performed * @param length the length of the range in which replace will be performed * @param oldText the text containing the search text - * @param oldStart the start of the search range in `oldText` - * @param oldLength the length of the search range in `oldText` + * @param oldStart the start of the search range in `oldText` + * @param oldLength the length of the search range in `oldText` * @param newText the text containing the replacement text - * @param newStart the start of the replacement range in `newText` - * @param newLength the length of the replacement range in `newText` + * @param newStart the start of the replacement range in `newText` + * @param newLength the length of the replacement range in `newText` * @return a reference to this * @stable ICU 2.0 */ @@ -2538,18 +2538,18 @@ public: /* Remove operations */ /** - * Removes all characters from the UnicodeString object and clears the bogus flag. - * This is the UnicodeString equivalent of std::string’s clear(). - * + * Removes all characters from the UnicodeString object and clears the bogus flag. + * This is the UnicodeString equivalent of std::string’s clear(). + * * @return a reference to this - * @see setToBogus + * @see setToBogus * @stable ICU 2.0 */ - inline UnicodeString& remove(); + inline UnicodeString& remove(); /** * Remove the characters in the range - * [`start`, `start + length`) from the UnicodeString object. + * [`start`, `start + length`) from the UnicodeString object. * @param start the offset of the first character to remove * @param length the number of characters to remove * @return a reference to this @@ -2560,7 +2560,7 @@ public: /** * Remove the characters in the range - * [`start`, `limit`) from the UnicodeString object. + * [`start`, `limit`) from the UnicodeString object. * @param start the offset of the first character to remove * @param limit the offset immediately following the range to remove * @return a reference to this @@ -2571,8 +2571,8 @@ public: /** * Retain only the characters in the range - * [`start`, `limit`) from the UnicodeString object. - * Removes characters before `start` and at and after `limit`. + * [`start`, `limit`) from the UnicodeString object. + * Removes characters before `start` and at and after `limit`. * @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 @@ -2583,7 +2583,7 @@ public: /* Length operations */ /** - * Pad the start of this UnicodeString with the character `padChar`. + * Pad the start of this UnicodeString with the character `padChar`. * If the length of this UnicodeString is less than targetLength, * length() - targetLength copies of padChar will be added to the * beginning of this UnicodeString. @@ -2594,10 +2594,10 @@ public: * @stable ICU 2.0 */ UBool padLeading(int32_t targetLength, - char16_t padChar = 0x0020); + char16_t padChar = 0x0020); /** - * Pad the end of this UnicodeString with the character `padChar`. + * Pad the end of this UnicodeString with the character `padChar`. * If the length of this UnicodeString is less than targetLength, * length() - targetLength copies of padChar will be added to the * end of this UnicodeString. @@ -2608,10 +2608,10 @@ public: * @stable ICU 2.0 */ UBool padTrailing(int32_t targetLength, - char16_t padChar = 0x0020); + char16_t padChar = 0x0020); /** - * Truncate this UnicodeString to the `targetLength`. + * Truncate this UnicodeString to the `targetLength`. * @param targetLength the desired length of this UnicodeString. * @return TRUE if the text was truncated, FALSE otherwise * @stable ICU 2.0 @@ -2636,7 +2636,7 @@ public: inline UnicodeString& reverse(void); /** - * Reverse the range [`start`, `start + length`) in + * Reverse the range [`start`, `start + length`) in * this UnicodeString. * @param start the start of the range to reverse * @param length the number of characters to to reverse @@ -2763,9 +2763,9 @@ public: * break iterator is opened. * Otherwise the provided iterator is set to the string's text. * @param locale The locale to consider. - * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, - * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, - * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. * @param options Options bit set, see ucasemap_open(). * @return A reference to this. * @stable ICU 3.8 @@ -2795,7 +2795,7 @@ public: /** * Get a read/write pointer to the internal buffer. - * The buffer is guaranteed to be large enough for at least minCapacity char16_ts, + * The buffer is guaranteed to be large enough for at least minCapacity char16_ts, * writable, and is still owned by the UnicodeString object. * Calls to getBuffer(minCapacity) must not be nested, and * must be matched with calls to releaseBuffer(newLength). @@ -2821,22 +2821,22 @@ public: * If the length() was greater than minCapacity, then any contents after minCapacity * may be lost. * The buffer contents is not NUL-terminated by getBuffer(). - * If length() < getCapacity() then you can terminate it by writing a NUL + * If length() < getCapacity() then you can terminate it by writing a NUL * at index length(). * - You must call releaseBuffer(newLength) before and in order to * return to normal UnicodeString operation. * - * @param minCapacity the minimum number of char16_ts that are to be available + * @param minCapacity the minimum number of char16_ts that are to be available * in the buffer, starting at the returned pointer; * default to the current string capacity if minCapacity==-1 * @return a writable pointer to the internal string buffer, - * or nullptr if an error occurs (nested calls, out of memory) + * or nullptr if an error occurs (nested calls, out of memory) * * @see releaseBuffer * @see getTerminatedBuffer() * @stable ICU 2.0 */ - char16_t *getBuffer(int32_t minCapacity); + char16_t *getBuffer(int32_t minCapacity); /** * Release a read/write buffer on a UnicodeString object with an @@ -2877,20 +2877,20 @@ public: * * The buffer contents is (probably) not NUL-terminated. * You can check if it is with - * `(s.length() < s.getCapacity() && buffer[s.length()]==0)`. + * `(s.length() < s.getCapacity() && buffer[s.length()]==0)`. * (See getTerminatedBuffer().) * * The buffer may reside in read-only memory. Its contents must not * be modified. * * @return a read-only pointer to the internal string buffer, - * or nullptr if the string is empty or bogus + * or nullptr if the string is empty or bogus * * @see getBuffer(int32_t minCapacity) * @see getTerminatedBuffer() * @stable ICU 2.0 */ - inline const char16_t *getBuffer() const; + inline const char16_t *getBuffer() const; /** * Get a read-only pointer to the internal buffer, @@ -2925,7 +2925,7 @@ public: * @see getBuffer() * @stable ICU 2.2 */ - const char16_t *getTerminatedBuffer(); + const char16_t *getTerminatedBuffer(); //======================================== // Constructors @@ -2937,8 +2937,8 @@ public: inline UnicodeString(); /** - * Construct a UnicodeString with capacity to hold `capacity` char16_ts - * @param capacity the number of char16_ts this UnicodeString should hold + * Construct a UnicodeString with capacity to hold `capacity` char16_ts + * @param capacity the number of char16_ts this UnicodeString should hold * before a resize is necessary; if count is greater than 0 and count * code points c take up more space than capacity, then capacity is adjusted * accordingly. @@ -2950,21 +2950,21 @@ public: UnicodeString(int32_t capacity, UChar32 c, int32_t count); /** - * Single char16_t (code unit) constructor. + * Single char16_t (code unit) constructor. * * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` + * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` * on the compiler command line or similar. * @param ch the character to place in the UnicodeString * @stable ICU 2.0 */ - UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch); + UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch); /** * Single UChar32 (code point) constructor. * * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` + * `-DUNISTR_FROM_CHAR_EXPLICIT=explicit` * on the compiler command line or similar. * @param ch the character to place in the UnicodeString * @stable ICU 2.0 @@ -2972,106 +2972,106 @@ public: UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch); /** - * char16_t* constructor. + * char16_t* constructor. * * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` * on the compiler command line or similar. - * @param text The characters to place in the UnicodeString. `text` + * @param text The characters to place in the UnicodeString. `text` * must be NULL (U+0000) terminated. * @stable ICU 2.0 */ - UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); - -#if !U_CHAR16_IS_TYPEDEF - /** - * uint16_t * constructor. - * Delegates to UnicodeString(const char16_t *). - * - * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` - * on the compiler command line or similar. - * @param text NUL-terminated UTF-16 string - * @stable ICU 59 - */ - UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) : - UnicodeString(ConstChar16Ptr(text)) {} -#endif - -#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) - /** - * wchar_t * constructor. - * (Only defined if U_SIZEOF_WCHAR_T==2.) - * Delegates to UnicodeString(const char16_t *). - * - * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` - * on the compiler command line or similar. - * @param text NUL-terminated UTF-16 string - * @stable ICU 59 - */ - UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) : - UnicodeString(ConstChar16Ptr(text)) {} -#endif - - /** - * nullptr_t constructor. - * Effectively the same as the default constructor, makes an empty string object. - * - * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` - * on the compiler command line or similar. - * @param text nullptr - * @stable ICU 59 - */ - UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); - - /** - * char16_t* constructor. + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); + +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * + * It is recommended to mark this constructor "explicit" by + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * on the compiler command line or similar. + * @param text nullptr + * @stable ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); + + /** + * char16_t* constructor. * @param text The characters to place in the UnicodeString. - * @param textLength The number of Unicode characters in `text` + * @param textLength The number of Unicode characters in `text` * to copy. * @stable ICU 2.0 */ - UnicodeString(const char16_t *text, + UnicodeString(const char16_t *text, int32_t textLength); -#if !U_CHAR16_IS_TYPEDEF - /** - * uint16_t * constructor. - * Delegates to UnicodeString(const char16_t *, int32_t). - * @param text UTF-16 string - * @param textLength string length - * @stable ICU 59 - */ - UnicodeString(const uint16_t *text, int32_t textLength) : - UnicodeString(ConstChar16Ptr(text), textLength) {} -#endif - -#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) - /** - * wchar_t * constructor. - * (Only defined if U_SIZEOF_WCHAR_T==2.) - * Delegates to UnicodeString(const char16_t *, int32_t). - * @param text NUL-terminated UTF-16 string - * @param textLength string length - * @stable ICU 59 - */ - UnicodeString(const wchar_t *text, int32_t textLength) : - UnicodeString(ConstChar16Ptr(text), textLength) {} -#endif - - /** - * nullptr_t constructor. - * Effectively the same as the default constructor, makes an empty string object. - * @param text nullptr - * @param textLength ignored - * @stable ICU 59 - */ - inline UnicodeString(const std::nullptr_t text, int32_t textLength); - - /** - * Readonly-aliasing char16_t* constructor. +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text UTF-16 string + * @param textLength string length + * @stable ICU 59 + */ + UnicodeString(const uint16_t *text, int32_t textLength) : + UnicodeString(ConstChar16Ptr(text), textLength) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text NUL-terminated UTF-16 string + * @param textLength string length + * @stable ICU 59 + */ + UnicodeString(const wchar_t *text, int32_t textLength) : + UnicodeString(ConstChar16Ptr(text), textLength) {} +#endif + + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param text nullptr + * @param textLength ignored + * @stable ICU 59 + */ + inline UnicodeString(const std::nullptr_t text, int32_t textLength); + + /** + * Readonly-aliasing char16_t* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has copy-on-write semantics: @@ -3084,20 +3084,20 @@ public: * When using fastCopyFrom(), the text will be aliased again, * so that both strings then alias the same readonly-text. * - * @param isTerminated specifies if `text` is `NUL`-terminated. - * This must be true if `textLength==-1`. + * @param isTerminated specifies if `text` is `NUL`-terminated. + * This must be true if `textLength==-1`. * @param text The characters to alias for the UnicodeString. - * @param textLength The number of Unicode characters in `text` to alias. + * @param textLength The number of Unicode characters in `text` to alias. * If -1, then this constructor will determine the length - * by calling `u_strlen()`. + * by calling `u_strlen()`. * @stable ICU 2.0 */ UnicodeString(UBool isTerminated, - ConstChar16Ptr text, + ConstChar16Ptr text, int32_t textLength); /** - * Writable-aliasing char16_t* constructor. + * Writable-aliasing char16_t* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has write-through semantics: @@ -3106,53 +3106,53 @@ public: * a new buffer will be allocated and the contents copied as with regularly * constructed strings. * In an assignment to another UnicodeString, the buffer will be copied. - * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same * as the string buffer itself and will in this case not copy the contents. * * @param buffer The characters to alias for the UnicodeString. - * @param buffLength The number of Unicode characters in `buffer` to alias. - * @param buffCapacity The size of `buffer` in char16_ts. - * @stable ICU 2.0 - */ - UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); - -#if !U_CHAR16_IS_TYPEDEF - /** - * Writable-aliasing uint16_t * constructor. - * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). - * @param buffer writable buffer of/for UTF-16 text - * @param buffLength length of the current buffer contents - * @param buffCapacity buffer capacity - * @stable ICU 59 - */ - UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) : - UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} -#endif - -#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) - /** - * Writable-aliasing wchar_t * constructor. - * (Only defined if U_SIZEOF_WCHAR_T==2.) - * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). - * @param buffer writable buffer of/for UTF-16 text - * @param buffLength length of the current buffer contents - * @param buffCapacity buffer capacity - * @stable ICU 59 - */ - UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) : - UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} -#endif - - /** - * Writable-aliasing nullptr_t constructor. - * Effectively the same as the default constructor, makes an empty string object. - * @param buffer nullptr - * @param buffLength ignored - * @param buffCapacity ignored - * @stable ICU 59 - */ - inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); - + * @param buffLength The number of Unicode characters in `buffer` to alias. + * @param buffCapacity The size of `buffer` in char16_ts. + * @stable ICU 2.0 + */ + UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); + +#if !U_CHAR16_IS_TYPEDEF + /** + * Writable-aliasing uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @stable ICU 59 + */ + UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Writable-aliasing wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @stable ICU 59 + */ + UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + + /** + * Writable-aliasing nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param buffer nullptr + * @param buffLength ignored + * @param buffCapacity ignored + * @stable ICU 59 + */ + inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); + #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION /** @@ -3166,7 +3166,7 @@ public: * UNICODE_STRING_SIMPLE. * * It is recommended to mark this constructor "explicit" by - * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` + * `-DUNISTR_FROM_STRING_EXPLICIT=explicit` * on the compiler command line or similar. * @param codepageData an array of bytes, null-terminated, * in the platform's default codepage. @@ -3181,7 +3181,7 @@ public: * Uses the default converter (and thus depends on the ICU conversion code) * unless U_CHARSET_IS_UTF8 is set to 1. * @param codepageData an array of bytes in the platform's default codepage. - * @param dataLength The number of bytes in `codepageData`. + * @param dataLength The number of bytes in `codepageData`. * @stable ICU 2.0 */ UnicodeString(const char *codepageData, int32_t dataLength); @@ -3193,11 +3193,11 @@ public: /** * char* constructor. * @param codepageData an array of bytes, null-terminated - * @param codepage the encoding of `codepageData`. The special - * value 0 for `codepage` indicates that the text is in the + * @param codepage the encoding of `codepageData`. The special + * value 0 for `codepage` indicates that the text is in the * platform's default codepage. * - * If `codepage` is an empty string (`""`), + * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * Recommendation: For invariant-character strings use the constructor @@ -3212,11 +3212,11 @@ public: /** * char* constructor. * @param codepageData an array of bytes. - * @param dataLength The number of bytes in `codepageData`. - * @param codepage the encoding of `codepageData`. The special - * value 0 for `codepage` indicates that the text is in the + * @param dataLength The number of bytes in `codepageData`. + * @param codepage the encoding of `codepageData`. The special + * value 0 for `codepage` indicates that the text is in the * platform's default codepage. - * If `codepage` is an empty string (`""`), + * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * Recommendation: For invariant-character strings use the constructor @@ -3267,19 +3267,19 @@ public: * * For example: * \code - * void fn(const char *s) { - * UnicodeString ustr(s, -1, US_INV); - * // use ustr ... - * } + * void fn(const char *s) { + * UnicodeString ustr(s, -1, US_INV); + * // use ustr ... + * } * \endcode * @param src String using only invariant characters. - * @param textLength Length of src, or -1 if NUL-terminated. + * @param textLength Length of src, or -1 if NUL-terminated. * @param inv Signature-distinguishing paramater, use US_INV. * * @see US_INV * @stable ICU 3.2 */ - UnicodeString(const char *src, int32_t textLength, enum EInvariant inv); + UnicodeString(const char *src, int32_t textLength, enum EInvariant inv); /** @@ -3301,7 +3301,7 @@ public: UnicodeString(const UnicodeString& that); /** - * Move constructor; might leave src in bogus state. + * Move constructor; might leave src in bogus state. * This string will have the same contents and state that the source string had. * @param src source string * @stable ICU 56 @@ -3311,7 +3311,7 @@ public: /** * 'Substring' constructor from tail of source string. * @param src The UnicodeString object to copy. - * @param srcStart The offset into `src` at which to start copying. + * @param srcStart The offset into `src` at which to start copying. * @stable ICU 2.2 */ UnicodeString(const UnicodeString& src, int32_t srcStart); @@ -3319,8 +3319,8 @@ public: /** * 'Substring' constructor from subrange of source string. * @param src The UnicodeString object to copy. - * @param srcStart The offset into `src` at which to start copying. - * @param srcLength The number of characters from `src` to copy. + * @param srcStart The offset into `src` at which to start copying. + * @param srcLength The number of characters from `src` to copy. * @stable ICU 2.2 */ UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength); @@ -3338,7 +3338,7 @@ public: * @see getDynamicClassID * @stable ICU 2.6 */ - virtual UnicodeString *clone() const; + virtual UnicodeString *clone() const; /** Destructor. * @stable ICU 2.0 @@ -3389,7 +3389,7 @@ public: * * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, - * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C + * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C * * Anything else following a backslash is generically escaped. For * example, "[a\\-z]" returns "[a-z]". @@ -3462,7 +3462,7 @@ protected: * UnicodeString::charAt() to be inline again (see jitterbug 709). * @stable ICU 2.4 */ - virtual char16_t getCharAt(int32_t offset) const; + virtual char16_t getCharAt(int32_t offset) const; /** * The change in Replaceable to use virtual getChar32At() allows @@ -3498,7 +3498,7 @@ private: int8_t doCompare(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; @@ -3511,7 +3511,7 @@ private: int8_t doCompareCodePointOrder(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const; @@ -3526,12 +3526,12 @@ private: int8_t doCaseCompare(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const; - int32_t doIndexOf(char16_t c, + int32_t doIndexOf(char16_t c, int32_t start, int32_t length) const; @@ -3539,7 +3539,7 @@ private: int32_t start, int32_t length) const; - int32_t doLastIndexOf(char16_t c, + int32_t doLastIndexOf(char16_t c, int32_t start, int32_t length) const; @@ -3549,14 +3549,14 @@ private: void doExtract(int32_t start, int32_t length, - char16_t *dst, + char16_t *dst, int32_t dstStart) const; inline void doExtract(int32_t start, int32_t length, UnicodeString& target) const; - inline char16_t doCharAt(int32_t offset) const; + inline char16_t doCharAt(int32_t offset) const; UnicodeString& doReplace(int32_t start, int32_t length, @@ -3566,12 +3566,12 @@ private: UnicodeString& doReplace(int32_t start, int32_t length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength); UnicodeString& doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcLength); - UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); + UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); UnicodeString& doReverse(int32_t start, int32_t length); @@ -3581,8 +3581,8 @@ private: // get pointer to start of array // these do not check for kOpenGetBuffer, unlike the public getBuffer() function - inline char16_t* getArrayStart(void); - inline const char16_t* getArrayStart(void) const; + inline char16_t* getArrayStart(void); + inline const char16_t* getArrayStart(void) const; inline UBool hasShortLength() const; inline int32_t getShortLength() const; @@ -3599,7 +3599,7 @@ private: inline void setShortLength(int32_t len); inline void setLength(int32_t len); inline void setToEmpty(); - inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags + inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags // allocate the array; result may be the stack buffer // sets refCount to 1 if appropriate @@ -3637,9 +3637,9 @@ private: * Real constructor for converting from codepage data. * It assumes that it is called with !fRefCounted. * - * If `codepage==0`, then the default converter + * If `codepage==0`, then the default converter * is used for the platform encoding. - * If `codepage` is an empty string (`""`), + * If `codepage` is an empty string (`""`), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. */ @@ -3682,11 +3682,11 @@ private: * as in ustr_imp.h for ustrcase_map(). */ UnicodeString & - caseMap(int32_t caseLocale, uint32_t options, -#if !UCONFIG_NO_BREAK_ITERATION - BreakIterator *iter, -#endif - UStringCaseMapper *stringCaseMapper); + caseMap(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + BreakIterator *iter, +#endif + UStringCaseMapper *stringCaseMapper); // ref counting void addRef(void); @@ -3777,15 +3777,15 @@ private: // Each struct of the union must begin with fLengthAndFlags. struct { int16_t fLengthAndFlags; // bit fields: see constants above - char16_t fBuffer[US_STACKBUF_SIZE]; // buffer for short strings + char16_t fBuffer[US_STACKBUF_SIZE]; // buffer for short strings } fStackFields; struct { int16_t fLengthAndFlags; // bit fields: see constants above int32_t fLength; // number of characters in fArray if >127; else undefined - int32_t fCapacity; // capacity of fArray (in char16_ts) + int32_t fCapacity; // capacity of fArray (in char16_ts) // array pointer last to minimize padding for machines with P128 data model // or pointer sizes that are not a power of 2 - char16_t *fArray; // the Unicode data + char16_t *fArray; // the Unicode data } fFields; } fUnion; }; @@ -3838,13 +3838,13 @@ UnicodeString::pinIndices(int32_t& start, } } -inline char16_t* +inline char16_t* UnicodeString::getArrayStart() { return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; } -inline const char16_t* +inline const char16_t* UnicodeString::getArrayStart() const { return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; @@ -3859,18 +3859,18 @@ UnicodeString::UnicodeString() { fUnion.fStackFields.fLengthAndFlags=kShortString; } -inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { - fUnion.fStackFields.fLengthAndFlags=kShortString; -} - -inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) { - fUnion.fStackFields.fLengthAndFlags=kShortString; -} - -inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { - fUnion.fStackFields.fLengthAndFlags=kShortString; -} - +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + //======================================== // Read-only implementation methods //======================================== @@ -3917,10 +3917,10 @@ UnicodeString::isBufferWritable() const (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1)); } -inline const char16_t * +inline const char16_t * UnicodeString::getBuffer() const { if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) { - return nullptr; + return nullptr; } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) { return fUnion.fStackFields.fBuffer; } else { @@ -3988,7 +3988,7 @@ UnicodeString::compare(int32_t start, { return doCompare(start, _length, srcText, 0, srcText.length()); } inline int8_t -UnicodeString::compare(ConstChar16Ptr srcChars, +UnicodeString::compare(ConstChar16Ptr srcChars, int32_t srcLength) const { return doCompare(0, length(), srcChars, 0, srcLength); } @@ -4003,13 +4003,13 @@ UnicodeString::compare(int32_t start, inline int8_t UnicodeString::compare(int32_t start, int32_t _length, - const char16_t *srcChars) const + const char16_t *srcChars) const { return doCompare(start, _length, srcChars, 0, _length); } inline int8_t UnicodeString::compare(int32_t start, int32_t _length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { return doCompare(start, _length, srcChars, srcStart, srcLength); } @@ -4049,7 +4049,7 @@ UnicodeString::compareCodePointOrder(int32_t start, { return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); } inline int8_t -UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars, +UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars, int32_t srcLength) const { return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); } @@ -4064,13 +4064,13 @@ UnicodeString::compareCodePointOrder(int32_t start, inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, - const char16_t *srcChars) const + const char16_t *srcChars) const { return doCompareCodePointOrder(start, _length, srcChars, 0, _length); } inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); } @@ -4114,7 +4114,7 @@ UnicodeString::caseCompare(int32_t start, } inline int8_t -UnicodeString::caseCompare(ConstChar16Ptr srcChars, +UnicodeString::caseCompare(ConstChar16Ptr srcChars, int32_t srcLength, uint32_t options) const { return doCaseCompare(0, length(), srcChars, 0, srcLength, options); @@ -4133,7 +4133,7 @@ UnicodeString::caseCompare(int32_t start, inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, - const char16_t *srcChars, + const char16_t *srcChars, uint32_t options) const { return doCaseCompare(start, _length, srcChars, 0, _length, options); } @@ -4141,7 +4141,7 @@ UnicodeString::caseCompare(int32_t start, inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const { @@ -4192,7 +4192,7 @@ UnicodeString::indexOf(const UnicodeString& text, { return indexOf(text, 0, text.length(), start, _length); } inline int32_t -UnicodeString::indexOf(const char16_t *srcChars, +UnicodeString::indexOf(const char16_t *srcChars, int32_t srcLength, int32_t start) const { pinIndex(start); @@ -4200,14 +4200,14 @@ UnicodeString::indexOf(const char16_t *srcChars, } inline int32_t -UnicodeString::indexOf(ConstChar16Ptr srcChars, +UnicodeString::indexOf(ConstChar16Ptr srcChars, int32_t srcLength, int32_t start, int32_t _length) const { return indexOf(srcChars, 0, srcLength, start, _length); } inline int32_t -UnicodeString::indexOf(char16_t c, +UnicodeString::indexOf(char16_t c, int32_t start, int32_t _length) const { return doIndexOf(c, start, _length); } @@ -4219,7 +4219,7 @@ UnicodeString::indexOf(UChar32 c, { return doIndexOf(c, start, _length); } inline int32_t -UnicodeString::indexOf(char16_t c) const +UnicodeString::indexOf(char16_t c) const { return doIndexOf(c, 0, length()); } inline int32_t @@ -4227,7 +4227,7 @@ UnicodeString::indexOf(UChar32 c) const { return indexOf(c, 0, length()); } inline int32_t -UnicodeString::indexOf(char16_t c, +UnicodeString::indexOf(char16_t c, int32_t start) const { pinIndex(start); return doIndexOf(c, start, length() - start); @@ -4241,14 +4241,14 @@ UnicodeString::indexOf(UChar32 c, } inline int32_t -UnicodeString::lastIndexOf(ConstChar16Ptr srcChars, +UnicodeString::lastIndexOf(ConstChar16Ptr srcChars, int32_t srcLength, int32_t start, int32_t _length) const { return lastIndexOf(srcChars, 0, srcLength, start, _length); } inline int32_t -UnicodeString::lastIndexOf(const char16_t *srcChars, +UnicodeString::lastIndexOf(const char16_t *srcChars, int32_t srcLength, int32_t start) const { pinIndex(start); @@ -4289,7 +4289,7 @@ UnicodeString::lastIndexOf(const UnicodeString& text) const { return lastIndexOf(text, 0, text.length(), 0, length()); } inline int32_t -UnicodeString::lastIndexOf(char16_t c, +UnicodeString::lastIndexOf(char16_t c, int32_t start, int32_t _length) const { return doLastIndexOf(c, start, _length); } @@ -4302,7 +4302,7 @@ UnicodeString::lastIndexOf(UChar32 c, } inline int32_t -UnicodeString::lastIndexOf(char16_t c) const +UnicodeString::lastIndexOf(char16_t c) const { return doLastIndexOf(c, 0, length()); } inline int32_t @@ -4311,7 +4311,7 @@ UnicodeString::lastIndexOf(UChar32 c) const { } inline int32_t -UnicodeString::lastIndexOf(char16_t c, +UnicodeString::lastIndexOf(char16_t c, int32_t start) const { pinIndex(start); return doLastIndexOf(c, start, length() - start); @@ -4335,17 +4335,17 @@ UnicodeString::startsWith(const UnicodeString& srcText, { return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } inline UBool -UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { +UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { if(srcLength < 0) { - srcLength = u_strlen(toUCharPtr(srcChars)); + srcLength = u_strlen(toUCharPtr(srcChars)); } return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; } inline UBool -UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { +UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { if(srcLength < 0) { - srcLength = u_strlen(toUCharPtr(srcChars)); + srcLength = u_strlen(toUCharPtr(srcChars)); } return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0; } @@ -4365,21 +4365,21 @@ UnicodeString::endsWith(const UnicodeString& srcText, } inline UBool -UnicodeString::endsWith(ConstChar16Ptr srcChars, +UnicodeString::endsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { if(srcLength < 0) { - srcLength = u_strlen(toUCharPtr(srcChars)); + srcLength = u_strlen(toUCharPtr(srcChars)); } return doCompare(length() - srcLength, srcLength, srcChars, 0, srcLength) == 0; } inline UBool -UnicodeString::endsWith(const char16_t *srcChars, +UnicodeString::endsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { if(srcLength < 0) { - srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); + srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); } return doCompare(length() - srcLength, srcLength, srcChars, srcStart, srcLength) == 0; @@ -4405,14 +4405,14 @@ UnicodeString::replace(int32_t start, inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, - ConstChar16Ptr srcChars, + ConstChar16Ptr srcChars, int32_t srcLength) { return doReplace(start, _length, srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) { return doReplace(start, _length, srcChars, srcStart, srcLength); } @@ -4420,7 +4420,7 @@ UnicodeString::replace(int32_t start, inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, - char16_t srcChar) + char16_t srcChar) { return doReplace(start, _length, &srcChar, 0, 1); } inline UnicodeString& @@ -4463,7 +4463,7 @@ UnicodeString::doExtract(int32_t start, inline void UnicodeString::extract(int32_t start, int32_t _length, - Char16Ptr target, + Char16Ptr target, int32_t targetStart) const { doExtract(start, _length, target, targetStart); } @@ -4491,7 +4491,7 @@ UnicodeString::extract(int32_t start, inline void UnicodeString::extractBetween(int32_t start, int32_t limit, - char16_t *dst, + char16_t *dst, int32_t dstStart) const { pinIndex(start); pinIndex(limit); @@ -4503,7 +4503,7 @@ UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { return tempSubString(start, limit - start); } -inline char16_t +inline char16_t UnicodeString::doCharAt(int32_t offset) const { if((uint32_t)offset < (uint32_t)length()) { @@ -4513,11 +4513,11 @@ UnicodeString::doCharAt(int32_t offset) const } } -inline char16_t +inline char16_t UnicodeString::charAt(int32_t offset) const { return doCharAt(offset); } -inline char16_t +inline char16_t UnicodeString::operator[] (int32_t offset) const { return doCharAt(offset); } @@ -4558,14 +4558,14 @@ UnicodeString::setToEmpty() { } inline void -UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) { +UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) { setLength(len); fUnion.fFields.fArray = array; fUnion.fFields.fCapacity = capacity; } inline UnicodeString& -UnicodeString::operator= (char16_t ch) +UnicodeString::operator= (char16_t ch) { return doReplace(0, length(), &ch, 0, 1); } inline UnicodeString& @@ -4597,7 +4597,7 @@ UnicodeString::setTo(const UnicodeString& srcText) } inline UnicodeString& -UnicodeString::setTo(const char16_t *srcChars, +UnicodeString::setTo(const char16_t *srcChars, int32_t srcLength) { unBogus(); @@ -4605,7 +4605,7 @@ UnicodeString::setTo(const char16_t *srcChars, } inline UnicodeString& -UnicodeString::setTo(char16_t srcChar) +UnicodeString::setTo(char16_t srcChar) { unBogus(); return doReplace(0, length(), &srcChar, 0, 1); @@ -4629,22 +4629,22 @@ UnicodeString::append(const UnicodeString& srcText) { return doAppend(srcText, 0, srcText.length()); } inline UnicodeString& -UnicodeString::append(const char16_t *srcChars, +UnicodeString::append(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) { return doAppend(srcChars, srcStart, srcLength); } inline UnicodeString& -UnicodeString::append(ConstChar16Ptr srcChars, +UnicodeString::append(ConstChar16Ptr srcChars, int32_t srcLength) { return doAppend(srcChars, 0, srcLength); } inline UnicodeString& -UnicodeString::append(char16_t srcChar) +UnicodeString::append(char16_t srcChar) { return doAppend(&srcChar, 0, 1); } inline UnicodeString& -UnicodeString::operator+= (char16_t ch) +UnicodeString::operator+= (char16_t ch) { return doAppend(&ch, 0, 1); } inline UnicodeString& @@ -4670,20 +4670,20 @@ UnicodeString::insert(int32_t start, inline UnicodeString& UnicodeString::insert(int32_t start, - const char16_t *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength) { return doReplace(start, 0, srcChars, srcStart, srcLength); } inline UnicodeString& UnicodeString::insert(int32_t start, - ConstChar16Ptr srcChars, + ConstChar16Ptr srcChars, int32_t srcLength) { return doReplace(start, 0, srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::insert(int32_t start, - char16_t srcChar) + char16_t srcChar) { return doReplace(start, 0, &srcChar, 0, 1); } inline UnicodeString& @@ -4752,6 +4752,6 @@ UnicodeString::reverse(int32_t start, U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/unorm.h b/contrib/libs/icu/include/unicode/unorm.h index 09dd366a96..ac6e07a318 100644 --- a/contrib/libs/icu/include/unicode/unorm.h +++ b/contrib/libs/icu/include/unicode/unorm.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -131,8 +131,8 @@ // Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API, // it is needed for layout of Normalizer object. -#ifndef U_FORCE_HIDE_DEPRECATED_API - +#ifndef U_FORCE_HIDE_DEPRECATED_API + /** * Constants for normalization modes. * @deprecated ICU 56 Use unorm2.h instead. @@ -157,8 +157,8 @@ typedef enum { UNORM_MODE_COUNT } UNormalizationMode; -#endif // U_FORCE_HIDE_DEPRECATED_API - +#endif // U_FORCE_HIDE_DEPRECATED_API + #ifndef U_HIDE_DEPRECATED_API /** @@ -214,7 +214,7 @@ enum { * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED int32_t U_EXPORT2 +U_DEPRECATED int32_t U_EXPORT2 unorm_normalize(const UChar *source, int32_t sourceLength, UNormalizationMode mode, int32_t options, UChar *result, int32_t resultLength, @@ -240,7 +240,7 @@ unorm_normalize(const UChar *source, int32_t sourceLength, * @see unorm_isNormalized * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 unorm_quickCheck(const UChar *source, int32_t sourcelength, UNormalizationMode mode, UErrorCode *status); @@ -261,7 +261,7 @@ unorm_quickCheck(const UChar *source, int32_t sourcelength, * @see unorm_isNormalized * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); @@ -287,7 +287,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, * @see unorm_quickCheck * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED UBool U_EXPORT2 +U_DEPRECATED UBool U_EXPORT2 unorm_isNormalized(const UChar *src, int32_t srcLength, UNormalizationMode mode, UErrorCode *pErrorCode); @@ -309,7 +309,7 @@ unorm_isNormalized(const UChar *src, int32_t srcLength, * @see unorm_isNormalized * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED UBool U_EXPORT2 +U_DEPRECATED UBool U_EXPORT2 unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); @@ -387,7 +387,7 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, * * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED int32_t U_EXPORT2 +U_DEPRECATED int32_t U_EXPORT2 unorm_next(UCharIterator *src, UChar *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, @@ -420,7 +420,7 @@ unorm_next(UCharIterator *src, * * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED int32_t U_EXPORT2 +U_DEPRECATED int32_t U_EXPORT2 unorm_previous(UCharIterator *src, UChar *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, @@ -464,7 +464,7 @@ unorm_previous(UCharIterator *src, * * @deprecated ICU 56 Use unorm2.h instead. */ -U_DEPRECATED int32_t U_EXPORT2 +U_DEPRECATED int32_t U_EXPORT2 unorm_concatenate(const UChar *left, int32_t leftLength, const UChar *right, int32_t rightLength, UChar *dest, int32_t destCapacity, diff --git a/contrib/libs/icu/include/unicode/unorm2.h b/contrib/libs/icu/include/unicode/unorm2.h index a9bd02f256..0fa7fdbced 100644 --- a/contrib/libs/icu/include/unicode/unorm2.h +++ b/contrib/libs/icu/include/unicode/unorm2.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: unorm2.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -32,7 +32,7 @@ #include "unicode/utypes.h" #include "unicode/localpointer.h" -#include "unicode/stringoptions.h" +#include "unicode/stringoptions.h" #include "unicode/uset.h" /** diff --git a/contrib/libs/icu/include/unicode/unum.h b/contrib/libs/icu/include/unicode/unum.h index 9036f9575d..ab4766fd4f 100644 --- a/contrib/libs/icu/include/unicode/unum.h +++ b/contrib/libs/icu/include/unicode/unum.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -25,17 +25,17 @@ #include "unicode/parseerr.h" #include "unicode/uformattable.h" #include "unicode/udisplaycontext.h" -#include "unicode/ufieldpositer.h" +#include "unicode/ufieldpositer.h" /** * \file - * \brief C API: Compatibility APIs for number formatting. + * \brief C API: Compatibility APIs for number formatting. * * <h2> Number Format C API </h2> - * - * <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to - * see if unumberformatter.h fits their use case. Although not deprecated, - * this header is provided for backwards compatibility only. + * + * <p><strong>IMPORTANT:</strong> New users with are strongly encouraged to + * see if unumberformatter.h fits their use case. Although not deprecated, + * this header is provided for backwards compatibility only. * * Number Format C API Provides functions for * formatting and parsing a number. Also provides methods for @@ -119,7 +119,7 @@ * <P> * You can also control the display of numbers with such function as * unum_getAttributes() and unum_setAttributes(), which let you set the - * minimum fraction digits, grouping, etc. + * minimum fraction digits, grouping, etc. * @see UNumberFormatAttributes for more details * <P> * You can also use forms of the parse and format methods with @@ -130,7 +130,7 @@ * </ul> * <p> * It is also possible to change or set the symbols used for a particular - * locale like the currency symbol, the grouping separator , monetary separator + * locale like the currency symbol, the grouping separator , monetary separator * etc by making use of functions unum_setSymbols() and unum_getSymbols(). */ @@ -254,7 +254,7 @@ typedef enum UNumberFormatStyle { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UNUM_FORMAT_STYLE_COUNT=17, -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ /** * Default format @@ -268,13 +268,13 @@ typedef enum UNumberFormatStyle { UNUM_IGNORE = UNUM_PATTERN_DECIMAL } UNumberFormatStyle; -/** The possible number format rounding modes. - * - * <p> - * For more detail on rounding modes, see: - * http://userguide.icu-project.org/formatparse/numbers/rounding-modes - * - * @stable ICU 2.0 +/** The possible number format rounding modes. + * + * <p> + * For more detail on rounding modes, see: + * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * + * @stable ICU 2.0 */ typedef enum UNumberFormatRoundingMode { UNUM_ROUND_CEILING, @@ -336,15 +336,15 @@ enum UCurrencySpacing { /** @stable ICU 4.8 */ UNUM_CURRENCY_INSERT, - /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, - * it is needed for layout of DecimalFormatSymbols object. */ -#ifndef U_FORCE_HIDE_DEPRECATED_API + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DecimalFormatSymbols object. */ +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * One more than the highest normal UCurrencySpacing value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UNUM_CURRENCY_SPACING_COUNT -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API }; typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */ @@ -377,18 +377,18 @@ typedef enum UNumberFormatFields { UNUM_PERMILL_FIELD, /** @stable ICU 49 */ UNUM_SIGN_FIELD, - /** @stable ICU 64 */ - UNUM_MEASURE_UNIT_FIELD, - /** @stable ICU 64 */ - UNUM_COMPACT_FIELD, - + /** @stable ICU 64 */ + UNUM_MEASURE_UNIT_FIELD, + /** @stable ICU 64 */ + UNUM_COMPACT_FIELD, + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UNumberFormatFields value. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3 -#endif /* U_HIDE_DEPRECATED_API */ + UNUM_FIELD_COUNT = UNUM_SIGN_FIELD + 3 +#endif /* U_HIDE_DEPRECATED_API */ } UNumberFormatFields; @@ -407,10 +407,10 @@ typedef enum UNumberFormatFields { * number format is opened using the given pattern, which must conform * to the syntax described in DecimalFormat or RuleBasedNumberFormat, * respectively. - * - * <p><strong>NOTE::</strong> New users with are strongly encouraged to - * use unumf_openForSkeletonAndLocale instead of unum_open. - * + * + * <p><strong>NOTE::</strong> New users with are strongly encouraged to + * use unumf_openForSkeletonAndLocale instead of unum_open. + * * @param pattern A pattern specifying the format to use. * This parameter is ignored unless the style is * UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED. @@ -575,57 +575,57 @@ unum_formatDouble( const UNumberFormat* fmt, UErrorCode* status); /** -* Format a double using a UNumberFormat according to the UNumberFormat's locale, -* and initialize a UFieldPositionIterator that enumerates the subcomponents of -* the resulting string. -* -* @param format -* The formatter to use. -* @param number -* The number to format. -* @param result -* A pointer to a buffer to receive the NULL-terminated formatted -* number. If the formatted number fits into dest but cannot be -* NULL-terminated (length == resultLength) then the error code is set -* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't -* fit into result then the error code is set to -* U_BUFFER_OVERFLOW_ERROR. -* @param resultLength -* The maximum size of result. -* @param fpositer -* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} -* (may be NULL if field position information is not needed, but in this -* case it's preferable to use {@link #unum_formatDouble}). Iteration -* information already present in the UFieldPositionIterator is deleted, -* and the iterator is reset to apply to the fields in the formatted -* string created by this function call. The field values and indexes -* returned by {@link #ufieldpositer_next} represent fields denoted by -* the UNumberFormatFields enum. Fields are not returned in a guaranteed -* order. Fields cannot overlap, but they may nest. For example, 1234 -* could format as "1,234" which might consist of a grouping separator -* field for ',' and an integer field encompassing the entire string. -* @param status -* A pointer to an UErrorCode to receive any errors -* @return -* The total buffer size needed; if greater than resultLength, the -* output was truncated. -* @see unum_formatDouble -* @see unum_parse -* @see unum_parseDouble -* @see UFieldPositionIterator -* @see UNumberFormatFields -* @stable ICU 59 -*/ -U_STABLE int32_t U_EXPORT2 -unum_formatDoubleForFields(const UNumberFormat* format, - double number, - UChar* result, - int32_t resultLength, - UFieldPositionIterator* fpositer, - UErrorCode* status); - - -/** +* Format a double using a UNumberFormat according to the UNumberFormat's locale, +* and initialize a UFieldPositionIterator that enumerates the subcomponents of +* the resulting string. +* +* @param format +* The formatter to use. +* @param number +* The number to format. +* @param result +* A pointer to a buffer to receive the NULL-terminated formatted +* number. If the formatted number fits into dest but cannot be +* NULL-terminated (length == resultLength) then the error code is set +* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't +* fit into result then the error code is set to +* U_BUFFER_OVERFLOW_ERROR. +* @param resultLength +* The maximum size of result. +* @param fpositer +* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} +* (may be NULL if field position information is not needed, but in this +* case it's preferable to use {@link #unum_formatDouble}). Iteration +* information already present in the UFieldPositionIterator is deleted, +* and the iterator is reset to apply to the fields in the formatted +* string created by this function call. The field values and indexes +* returned by {@link #ufieldpositer_next} represent fields denoted by +* the UNumberFormatFields enum. Fields are not returned in a guaranteed +* order. Fields cannot overlap, but they may nest. For example, 1234 +* could format as "1,234" which might consist of a grouping separator +* field for ',' and an integer field encompassing the entire string. +* @param status +* A pointer to an UErrorCode to receive any errors +* @return +* The total buffer size needed; if greater than resultLength, the +* output was truncated. +* @see unum_formatDouble +* @see unum_parse +* @see unum_parseDouble +* @see UFieldPositionIterator +* @see UNumberFormatFields +* @stable ICU 59 +*/ +U_STABLE int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + 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" @@ -901,7 +901,7 @@ unum_parseToUFormattable(const UNumberFormat* fmt, * @param localized TRUE if the pattern is localized, FALSE otherwise. * @param pattern The new pattern * @param patternLength The length of pattern, or -1 if null-terminated. - * @param parseError A pointer to UParseError to receive information + * @param parseError A pointer to UParseError to receive information * about errors occurred during parsing, or NULL if no parse error * information is desired. * @param status A pointer to an input-output UErrorCode. @@ -1025,18 +1025,18 @@ typedef enum UNumberFormatAttribute { * <p>Example: setting the scale to 3, 123 formats as "123,000" * <p>Example: setting the scale to -4, 123 formats as "0.0123" * - * This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h. - * + * This setting is analogous to getMultiplierScale() and setMultiplierScale() in decimfmt.h. + * * @stable ICU 51 */ UNUM_SCALE = 21, - + /** - * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000". + * Minimum grouping digits; most commonly set to 2 to print "1000" instead of "1,000". * See DecimalFormat::getMinimumGroupingDigits(). * - * For better control over grouping strategies, use UNumberFormatter. - * - * @stable ICU 64 + * For better control over grouping strategies, use UNumberFormatter. + * + * @stable ICU 64 */ UNUM_MINIMUM_GROUPING_DIGITS = 22, @@ -1048,12 +1048,12 @@ typedef enum UNumberFormatAttribute { */ UNUM_CURRENCY_USAGE = 23, -#ifndef U_HIDE_INTERNAL_API +#ifndef U_HIDE_INTERNAL_API /** One below the first bitfield-boolean item. * All items after this one are stored in boolean form. * @internal */ UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF, -#endif /* U_HIDE_INTERNAL_API */ +#endif /* U_HIDE_INTERNAL_API */ /** If 1, specifies that if setting the "max integer digits" attribute would truncate a value, set an error status rather than silently truncating. * For example, formatting the value 1234 with 4 max int digits would succeed, but formatting 12345 would fail. There is no effect on parsing. @@ -1067,7 +1067,7 @@ typedef enum UNumberFormatAttribute { * Default: 0 (unset) * @stable ICU 50 */ - UNUM_PARSE_NO_EXPONENT = 0x1001, + UNUM_PARSE_NO_EXPONENT = 0x1001, /** * if this attribute is set to 1, specifies that, if the pattern contains a @@ -1079,29 +1079,29 @@ typedef enum UNumberFormatAttribute { */ UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002, - /** - * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase). - * - * @stable ICU 64 - */ - UNUM_PARSE_CASE_SENSITIVE = 0x1003, - - /** - * Formatting: if set to 1, whether to show the plus sign on non-negative numbers. - * - * For better control over sign display, use UNumberFormatter. - * - * @stable ICU 64 - */ - UNUM_SIGN_ALWAYS_SHOWN = 0x1004, - -#ifndef U_HIDE_INTERNAL_API - /** Limit of boolean attributes. (value should - * not depend on U_HIDE conditionals) + /** + * Parsing: if set to 1, parsing is sensitive to case (lowercase/uppercase). + * + * @stable ICU 64 + */ + UNUM_PARSE_CASE_SENSITIVE = 0x1003, + + /** + * Formatting: if set to 1, whether to show the plus sign on non-negative numbers. + * + * For better control over sign display, use UNumberFormatter. + * + * @stable ICU 64 + */ + UNUM_SIGN_ALWAYS_SHOWN = 0x1004, + +#ifndef U_HIDE_INTERNAL_API + /** Limit of boolean attributes. (value should + * not depend on U_HIDE conditionals) * @internal */ - UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005, -#endif /* U_HIDE_INTERNAL_API */ - + UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1005, +#endif /* U_HIDE_INTERNAL_API */ + } UNumberFormatAttribute; /** @@ -1385,7 +1385,7 @@ typedef enum UNumberFormatSymbol { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UNUM_FORMAT_SYMBOL_COUNT = 28 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UNumberFormatSymbol; /** diff --git a/contrib/libs/icu/include/unicode/unumberformatter.h b/contrib/libs/icu/include/unicode/unumberformatter.h index af98ba0027..26a6c1fcb4 100644 --- a/contrib/libs/icu/include/unicode/unumberformatter.h +++ b/contrib/libs/icu/include/unicode/unumberformatter.h @@ -1,705 +1,705 @@ -// © 2018 and later: Unicode, Inc. and others. -// License & terms of use: http://www.unicode.org/copyright.html - -#include "unicode/utypes.h" - -#if !UCONFIG_NO_FORMATTING -#ifndef __UNUMBERFORMATTER_H__ -#define __UNUMBERFORMATTER_H__ - -#include "unicode/parseerr.h" -#include "unicode/ufieldpositer.h" -#include "unicode/umisc.h" -#include "unicode/uformattedvalue.h" - - -/** - * \file - * \brief C-compatible API for localized number formatting; not recommended for C++. - * - * This is the C-compatible version of the NumberFormatter API introduced in ICU 60. C++ users should - * include unicode/numberformatter.h and use the proper C++ APIs. - * - * The C API accepts a number skeleton string for specifying the settings for formatting, which covers a - * very large subset of all possible number formatting features. For more information on number skeleton - * strings, see unicode/numberformatter.h. - * - * When using UNumberFormatter, which is treated as immutable, the results are exported to a mutable - * UFormattedNumber object, which you subsequently use for populating your string buffer or iterating over - * the fields. - * - * Example code: - * <pre> - * // Setup: - * UErrorCode ec = U_ZERO_ERROR; - * UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec); - * UFormattedNumber* uresult = unumf_openResult(&ec); - * if (U_FAILURE(ec)) { return; } - * - * // Format a double: - * unumf_formatDouble(uformatter, 5142.3, uresult, &ec); - * if (U_FAILURE(ec)) { return; } - * - * // Export the string to a malloc'd buffer: - * int32_t len = unumf_resultToString(uresult, NULL, 0, &ec); - * // at this point, ec == U_BUFFER_OVERFLOW_ERROR - * ec = U_ZERO_ERROR; - * UChar* buffer = (UChar*) malloc((len+1)*sizeof(UChar)); - * unumf_resultToString(uresult, buffer, len+1, &ec); - * if (U_FAILURE(ec)) { return; } - * // buffer should equal "5,142" - * - * // Cleanup: - * unumf_close(uformatter); - * unumf_closeResult(uresult); - * free(buffer); - * </pre> - * - * If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these - * APIs. The following example uses LocalPointer with the decimal number and field position APIs: - * - * <pre> - * // Setup: - * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec)); - * LocalUFormattedNumberPointer uresult(unumf_openResult(&ec)); - * if (U_FAILURE(ec)) { return; } - * - * // Format a decimal number: - * unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec); - * if (U_FAILURE(ec)) { return; } - * - * // Get the location of the percent sign: - * UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0}; - * unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec); - * // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%" - * - * // No need to do any cleanup since we are using LocalPointer. - * </pre> - */ - -/** - * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123 - * meters in <em>en-CA</em>: - * - * <p> - * <ul> - * <li>NARROW*: "$123.00" and "123 m" - * <li>SHORT: "US$ 123.00" and "123 m" - * <li>FULL_NAME: "123.00 US dollars" and "123 meters" - * <li>ISO_CODE: "USD 123.00" and undefined behavior - * <li>HIDDEN: "123.00" and "123" - * </ul> - * - * <p> - * This enum is similar to {@link UMeasureFormatWidth}. - * - * @stable ICU 60 - */ -typedef enum UNumberUnitWidth { - /** - * Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available - * abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more - * information on the difference between NARROW and SHORT, see SHORT. - * - * <p> - * In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for - * currencies. - * - * @stable ICU 60 - */ - UNUM_UNIT_WIDTH_NARROW, - - /** - * Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or - * symbol when there may be ambiguity. This is the default behavior. - * - * <p> - * For example, in <em>es-US</em>, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°", - * since Fahrenheit is the customary unit for temperature in that locale. - * - * <p> - * In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for - * currencies. - * - * @stable ICU 60 - */ - UNUM_UNIT_WIDTH_SHORT, - - /** - * Print the full name of the unit, without any abbreviations. - * - * <p> - * In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for - * currencies. - * - * @stable ICU 60 - */ - UNUM_UNIT_WIDTH_FULL_NAME, - - /** - * Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this - * option is currently undefined for use with measure units. - * - * <p> - * In CLDR, this option corresponds to the "¤¤" placeholder for currencies. - * - * @stable ICU 60 - */ - UNUM_UNIT_WIDTH_ISO_CODE, - - /** - * Format the number according to the specified unit, but do not display the unit. For currencies, apply - * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is - * equivalent to not specifying the unit at all. - * - * @stable ICU 60 - */ - UNUM_UNIT_WIDTH_HIDDEN, - - /** - * One more than the highest UNumberUnitWidth value. - * - * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. - */ - UNUM_UNIT_WIDTH_COUNT -} UNumberUnitWidth; - -/** - * An enum declaring the strategy for when and how to display grouping separators (i.e., the - * separator, often a comma or period, after every 2-3 powers of ten). The choices are several - * pre-built strategies for different use cases that employ locale data whenever possible. Example - * outputs for 1234 and 1234567 in <em>en-IN</em>: - * - * <ul> - * <li>OFF: 1234 and 12345 - * <li>MIN2: 1234 and 12,34,567 - * <li>AUTO: 1,234 and 12,34,567 - * <li>ON_ALIGNED: 1,234 and 12,34,567 - * <li>THOUSANDS: 1,234 and 1,234,567 - * </ul> - * - * <p> - * The default is AUTO, which displays grouping separators unless the locale data says that grouping - * is not customary. To force grouping for all numbers greater than 1000 consistently across locales, - * use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2 - * or OFF. See the docs of each option for details. - * - * <p> - * Note: This enum specifies the strategy for grouping sizes. To set which character to use as the - * grouping separator, use the "symbols" setter. - * - * @stable ICU 63 - */ -typedef enum UNumberGroupingStrategy { - /** - * Do not display grouping separators in any locale. - * - * @stable ICU 61 - */ - UNUM_GROUPING_OFF, - - /** - * Display grouping using locale defaults, except do not show grouping on values smaller than - * 10000 (such that there is a <em>minimum of two digits</em> before the first separator). - * - * <p> - * Note that locales may restrict grouping separators to be displayed only on 1 million or - * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency). - * - * <p> - * Locale data is used to determine whether to separate larger numbers into groups of 2 - * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). - * - * @stable ICU 61 - */ - UNUM_GROUPING_MIN2, - - /** - * Display grouping using the default strategy for all locales. This is the default behavior. - * - * <p> - * Note that locales may restrict grouping separators to be displayed only on 1 million or - * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency). - * - * <p> - * Locale data is used to determine whether to separate larger numbers into groups of 2 - * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). - * - * @stable ICU 61 - */ - UNUM_GROUPING_AUTO, - - /** - * Always display the grouping separator on values of at least 1000. - * - * <p> - * This option ignores the locale data that restricts or disables grouping, described in MIN2 and - * AUTO. This option may be useful to normalize the alignment of numbers, such as in a - * spreadsheet. - * - * <p> - * Locale data is used to determine whether to separate larger numbers into groups of 2 - * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). - * - * @stable ICU 61 - */ - UNUM_GROUPING_ON_ALIGNED, - - /** - * Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use - * locale data for determining the grouping strategy. - * - * @stable ICU 61 - */ - UNUM_GROUPING_THOUSANDS - -#ifndef U_HIDE_INTERNAL_API - , - /** - * One more than the highest UNumberGroupingStrategy value. - * - * @internal ICU 62: The numeric value may change over time; see ICU ticket #12420. - */ - UNUM_GROUPING_COUNT -#endif /* U_HIDE_INTERNAL_API */ - -} UNumberGroupingStrategy; - -/** - * An enum declaring how to denote positive and negative numbers. Example outputs when formatting - * 123, 0, and -123 in <em>en-US</em>: - * - * <ul> - * <li>AUTO: "123", "0", and "-123" - * <li>ALWAYS: "+123", "+0", and "-123" - * <li>NEVER: "123", "0", and "123" - * <li>ACCOUNTING: "$123", "$0", and "($123)" - * <li>ACCOUNTING_ALWAYS: "+$123", "+$0", and "($123)" - * <li>EXCEPT_ZERO: "+123", "0", and "-123" - * <li>ACCOUNTING_EXCEPT_ZERO: "+$123", "$0", and "($123)" - * </ul> - * - * <p> - * The exact format, including the position and the code point of the sign, differ by locale. - * - * @stable ICU 60 - */ -typedef enum UNumberSignDisplay { - /** - * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default - * behavior. - * - * @stable ICU 60 - */ - UNUM_SIGN_AUTO, - - /** - * Show the minus sign on negative numbers and the plus sign on positive numbers, including zero. - * To hide the sign on zero, see {@link UNUM_SIGN_EXCEPT_ZERO}. - * - * @stable ICU 60 - */ - UNUM_SIGN_ALWAYS, - - /** - * Do not show the sign on positive or negative numbers. - * - * @stable ICU 60 - */ - UNUM_SIGN_NEVER, - - /** - * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers. - * - * <p> - * The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair - * of parentheses around the number. - * - * <p> - * Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the - * AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the - * future. - * - * @stable ICU 60 - */ - UNUM_SIGN_ACCOUNTING, - - /** - * Use the locale-dependent accounting format on negative numbers, and show the plus sign on - * positive numbers, including zero. For more information on the accounting format, see the - * ACCOUNTING sign display strategy. To hide the sign on zero, see - * {@link UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO}. - * - * @stable ICU 60 - */ - UNUM_SIGN_ACCOUNTING_ALWAYS, - - /** - * Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a - * sign on zero, numbers that round to zero, or NaN. - * - * @stable ICU 61 - */ - UNUM_SIGN_EXCEPT_ZERO, - - /** - * Use the locale-dependent accounting format on negative numbers, and show the plus sign on - * positive numbers. Do not show a sign on zero, numbers that round to zero, or NaN. For more - * information on the accounting format, see the ACCOUNTING sign display strategy. - * - * @stable ICU 61 - */ - UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO, - - /** - * One more than the highest UNumberSignDisplay value. - * - * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. - */ - UNUM_SIGN_COUNT -} UNumberSignDisplay; - -/** - * An enum declaring how to render the decimal separator. - * - * <p> - * <ul> - * <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1" - * <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1" - * </ul> - * - * @stable ICU 60 - */ -typedef enum UNumberDecimalSeparatorDisplay { - /** - * Show the decimal separator when there are one or more digits to display after the separator, and do not show - * it otherwise. This is the default behavior. - * - * @stable ICU 60 - */ - UNUM_DECIMAL_SEPARATOR_AUTO, - - /** - * Always show the decimal separator, even if there are no digits to display after the separator. - * - * @stable ICU 60 - */ - UNUM_DECIMAL_SEPARATOR_ALWAYS, - - /** - * One more than the highest UNumberDecimalSeparatorDisplay value. - * - * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. - */ - UNUM_DECIMAL_SEPARATOR_COUNT -} UNumberDecimalSeparatorDisplay; - -struct UNumberFormatter; -/** - * C-compatible version of icu::number::LocalizedNumberFormatter. - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @stable ICU 62 - */ -typedef struct UNumberFormatter UNumberFormatter; - -struct UFormattedNumber; -/** - * C-compatible version of icu::number::FormattedNumber. - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @stable ICU 62 - */ -typedef struct UFormattedNumber UFormattedNumber; - - -/** - * Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only - * method for creating a new UNumberFormatter. - * - * Objects of type UNumberFormatter returned by this method are threadsafe. - * - * For more details on skeleton strings, see the documentation in numberformatter.h. For more details on - * the usage of this API, see the documentation at the top of unumberformatter.h. - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @param skeleton The skeleton string, like u"percent precision-integer" - * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated. - * @param locale The NUL-terminated locale ID. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE UNumberFormatter* U_EXPORT2 -unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale, - UErrorCode* ec); - - -/** - * Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the - * location of a skeleton syntax error if such a syntax error exists. - * - * @param skeleton The skeleton string, like u"percent precision-integer" - * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated. - * @param locale The NUL-terminated locale ID. - * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL. - * If no error occurs, perror->offset will be set to -1. - * @param ec Set if an error occurs. - * @stable ICU 64 - */ -U_STABLE UNumberFormatter* U_EXPORT2 -unumf_openForSkeletonAndLocaleWithError( - const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec); - - -/** - * Creates an object to hold the result of a UNumberFormatter - * operation. The object can be used repeatedly; it is cleared whenever - * passed to a format function. - * - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE UFormattedNumber* U_EXPORT2 -unumf_openResult(UErrorCode* ec); - - -/** - * Uses a UNumberFormatter to format an integer to a UFormattedNumber. A string, field position, and other - * information can be retrieved from the UFormattedNumber. - * - * The UNumberFormatter can be shared between threads. Each thread should have its own local - * UFormattedNumber, however, for storing the result of the formatting operation. - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. - * @param value The number to be formatted. - * @param uresult The object that will be mutated to store the result; see unumf_openResult. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult, - UErrorCode* ec); - - -/** - * Uses a UNumberFormatter to format a double to a UFormattedNumber. A string, field position, and other - * information can be retrieved from the UFormattedNumber. - * - * The UNumberFormatter can be shared between threads. Each thread should have its own local - * UFormattedNumber, however, for storing the result of the formatting operation. - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. - * @param value The number to be formatted. - * @param uresult The object that will be mutated to store the result; see unumf_openResult. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult, - UErrorCode* ec); - - -/** - * Uses a UNumberFormatter to format a decimal number to a UFormattedNumber. A string, field position, and - * other information can be retrieved from the UFormattedNumber. - * - * The UNumberFormatter can be shared between threads. Each thread should have its own local - * UFormattedNumber, however, for storing the result of the formatting operation. - * - * The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic - * Specification, available at http://speleotrove.com/decimal - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. - * @param value The numeric string to be formatted. - * @param valueLen The length of the numeric string, or -1 if it is NUL-terminated. - * @param uresult The object that will be mutated to store the result; see unumf_openResult. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen, - UFormattedNumber* uresult, UErrorCode* ec); - -/** - * Returns a representation of a UFormattedNumber as a UFormattedValue, - * which can be subsequently passed to any API requiring that type. - * - * The returned object is owned by the UFormattedNumber and is valid - * only as long as the UFormattedNumber is present and unchanged in memory. - * - * You can think of this method as a cast between types. - * - * @param uresult The object containing the formatted string. - * @param ec Set if an error occurs. - * @return A UFormattedValue owned by the input object. - * @stable ICU 64 - */ -U_STABLE const UFormattedValue* U_EXPORT2 -unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec); - - -/** - * Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible. - * If bufferCapacity is greater than the required length, a terminating NUL is written. - * If bufferCapacity is less than the required length, an error code is set. - * - * Also see ufmtval_getString, which returns a NUL-terminated string: - * - * int32_t len; - * const UChar* str = ufmtval_getString(unumf_resultAsValue(uresult, &ec), &len, &ec); - * - * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. - * - * @param uresult The object containing the formatted number. - * @param buffer Where to save the string output. - * @param bufferCapacity The number of UChars available in the buffer. - * @param ec Set if an error occurs. - * @return The required length. - * @stable ICU 62 - */ -U_STABLE int32_t U_EXPORT2 -unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity, - UErrorCode* ec); - - -/** - * Determines the start and end indices of the next occurrence of the given <em>field</em> in the - * output string. This allows you to determine the locations of, for example, the integer part, - * fraction part, or symbols. - * - * This is a simpler but less powerful alternative to {@link ufmtval_nextPosition}. - * - * If a field occurs just once, calling this method will find that occurrence and return it. If a - * field occurs multiple times, this method may be called repeatedly with the following pattern: - * - * <pre> - * UFieldPosition ufpos = {UNUM_GROUPING_SEPARATOR_FIELD, 0, 0}; - * while (unumf_resultNextFieldPosition(uresult, ufpos, &ec)) { - * // do something with ufpos. - * } - * </pre> - * - * This method is useful if you know which field to query. If you want all available field position - * information, use unumf_resultGetAllFieldPositions(). - * - * NOTE: All fields of the UFieldPosition must be initialized before calling this method. - * - * @param uresult The object containing the formatted number. - * @param ufpos - * Input+output variable. On input, the "field" property determines which field to look up, - * and the "endIndex" property determines where to begin the search. On output, the - * "beginIndex" field is set to the beginning of the first occurrence of the field after the - * input "endIndex", and "endIndex" is set to the end of that occurrence of the field - * (exclusive index). If a field position is not found, the FieldPosition is not changed and - * the method returns FALSE. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE UBool U_EXPORT2 -unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec); - - -/** - * Populates the given iterator with all fields in the formatted output string. This allows you to - * determine the locations of the integer part, fraction part, and sign. - * - * This is an alternative to the more powerful {@link ufmtval_nextPosition} API. - * - * If you need information on only one field, use {@link ufmtval_nextPosition} or - * {@link unumf_resultNextFieldPosition}. - * - * @param uresult The object containing the formatted number. - * @param ufpositer - * A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}. Iteration - * information already present in the UFieldPositionIterator is deleted, and the iterator is reset - * to apply to the fields in the formatted string created by this function call. The field values - * and indexes returned by {@link #ufieldpositer_next} represent fields denoted by - * the UNumberFormatFields enum. Fields are not returned in a guaranteed order. Fields cannot - * overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a - * grouping separator field for ',' and an integer field encompassing the entire string. - * @param ec Set if an error occurs. - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer, - UErrorCode* ec); - - -// TODO(ICU-20775): Propose this as API. -// NOTE: This is not currently implemented. -// U_DRAFT int32_t U_EXPORT2 -// unumf_resultToDecimalNumber(const UFormattedNumber* uresult, char* buffer, int32_t bufferCapacity, -// UErrorCode* ec); - - -/** - * Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale(). - * - * @param uformatter An object created by unumf_openForSkeletonAndLocale(). - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_close(UNumberFormatter* uformatter); - - -/** - * Releases the UFormattedNumber created by unumf_openResult(). - * - * @param uresult An object created by unumf_openResult(). - * @stable ICU 62 - */ -U_STABLE void U_EXPORT2 -unumf_closeResult(UFormattedNumber* uresult); - - -#if U_SHOW_CPLUSPLUS_API -U_NAMESPACE_BEGIN - -/** - * \class LocalUNumberFormatterPointer - * "Smart pointer" class; closes a UNumberFormatter via unumf_close(). - * For most methods see the LocalPointerBase base class. - * - * Usage: - * <pre> - * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...)); - * // no need to explicitly call unumf_close() - * </pre> - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 62 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close); - -/** - * \class LocalUFormattedNumberPointer - * "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult(). - * For most methods see the LocalPointerBase base class. - * - * Usage: - * <pre> - * LocalUFormattedNumberPointer uformatter(unumf_openResult(...)); - * // no need to explicitly call unumf_closeResult() - * </pre> - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 62 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult); - -U_NAMESPACE_END -#endif // U_SHOW_CPLUSPLUS_API - -#endif //__UNUMBERFORMATTER_H__ -#endif /* #if !UCONFIG_NO_FORMATTING */ +// © 2018 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __UNUMBERFORMATTER_H__ +#define __UNUMBERFORMATTER_H__ + +#include "unicode/parseerr.h" +#include "unicode/ufieldpositer.h" +#include "unicode/umisc.h" +#include "unicode/uformattedvalue.h" + + +/** + * \file + * \brief C-compatible API for localized number formatting; not recommended for C++. + * + * This is the C-compatible version of the NumberFormatter API introduced in ICU 60. C++ users should + * include unicode/numberformatter.h and use the proper C++ APIs. + * + * The C API accepts a number skeleton string for specifying the settings for formatting, which covers a + * very large subset of all possible number formatting features. For more information on number skeleton + * strings, see unicode/numberformatter.h. + * + * When using UNumberFormatter, which is treated as immutable, the results are exported to a mutable + * UFormattedNumber object, which you subsequently use for populating your string buffer or iterating over + * the fields. + * + * Example code: + * <pre> + * // Setup: + * UErrorCode ec = U_ZERO_ERROR; + * UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec); + * UFormattedNumber* uresult = unumf_openResult(&ec); + * if (U_FAILURE(ec)) { return; } + * + * // Format a double: + * unumf_formatDouble(uformatter, 5142.3, uresult, &ec); + * if (U_FAILURE(ec)) { return; } + * + * // Export the string to a malloc'd buffer: + * int32_t len = unumf_resultToString(uresult, NULL, 0, &ec); + * // at this point, ec == U_BUFFER_OVERFLOW_ERROR + * ec = U_ZERO_ERROR; + * UChar* buffer = (UChar*) malloc((len+1)*sizeof(UChar)); + * unumf_resultToString(uresult, buffer, len+1, &ec); + * if (U_FAILURE(ec)) { return; } + * // buffer should equal "5,142" + * + * // Cleanup: + * unumf_close(uformatter); + * unumf_closeResult(uresult); + * free(buffer); + * </pre> + * + * If you are a C++ user linking against the C libraries, you can use the LocalPointer versions of these + * APIs. The following example uses LocalPointer with the decimal number and field position APIs: + * + * <pre> + * // Setup: + * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec)); + * LocalUFormattedNumberPointer uresult(unumf_openResult(&ec)); + * if (U_FAILURE(ec)) { return; } + * + * // Format a decimal number: + * unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec); + * if (U_FAILURE(ec)) { return; } + * + * // Get the location of the percent sign: + * UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0}; + * unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec); + * // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%" + * + * // No need to do any cleanup since we are using LocalPointer. + * </pre> + */ + +/** + * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123 + * meters in <em>en-CA</em>: + * + * <p> + * <ul> + * <li>NARROW*: "$123.00" and "123 m" + * <li>SHORT: "US$ 123.00" and "123 m" + * <li>FULL_NAME: "123.00 US dollars" and "123 meters" + * <li>ISO_CODE: "USD 123.00" and undefined behavior + * <li>HIDDEN: "123.00" and "123" + * </ul> + * + * <p> + * This enum is similar to {@link UMeasureFormatWidth}. + * + * @stable ICU 60 + */ +typedef enum UNumberUnitWidth { + /** + * Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available + * abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more + * information on the difference between NARROW and SHORT, see SHORT. + * + * <p> + * In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for + * currencies. + * + * @stable ICU 60 + */ + UNUM_UNIT_WIDTH_NARROW, + + /** + * Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or + * symbol when there may be ambiguity. This is the default behavior. + * + * <p> + * For example, in <em>es-US</em>, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°", + * since Fahrenheit is the customary unit for temperature in that locale. + * + * <p> + * In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for + * currencies. + * + * @stable ICU 60 + */ + UNUM_UNIT_WIDTH_SHORT, + + /** + * Print the full name of the unit, without any abbreviations. + * + * <p> + * In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for + * currencies. + * + * @stable ICU 60 + */ + UNUM_UNIT_WIDTH_FULL_NAME, + + /** + * Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this + * option is currently undefined for use with measure units. + * + * <p> + * In CLDR, this option corresponds to the "¤¤" placeholder for currencies. + * + * @stable ICU 60 + */ + UNUM_UNIT_WIDTH_ISO_CODE, + + /** + * Format the number according to the specified unit, but do not display the unit. For currencies, apply + * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is + * equivalent to not specifying the unit at all. + * + * @stable ICU 60 + */ + UNUM_UNIT_WIDTH_HIDDEN, + + /** + * One more than the highest UNumberUnitWidth value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_UNIT_WIDTH_COUNT +} UNumberUnitWidth; + +/** + * An enum declaring the strategy for when and how to display grouping separators (i.e., the + * separator, often a comma or period, after every 2-3 powers of ten). The choices are several + * pre-built strategies for different use cases that employ locale data whenever possible. Example + * outputs for 1234 and 1234567 in <em>en-IN</em>: + * + * <ul> + * <li>OFF: 1234 and 12345 + * <li>MIN2: 1234 and 12,34,567 + * <li>AUTO: 1,234 and 12,34,567 + * <li>ON_ALIGNED: 1,234 and 12,34,567 + * <li>THOUSANDS: 1,234 and 1,234,567 + * </ul> + * + * <p> + * The default is AUTO, which displays grouping separators unless the locale data says that grouping + * is not customary. To force grouping for all numbers greater than 1000 consistently across locales, + * use ON_ALIGNED. On the other hand, to display grouping less frequently than the default, use MIN2 + * or OFF. See the docs of each option for details. + * + * <p> + * Note: This enum specifies the strategy for grouping sizes. To set which character to use as the + * grouping separator, use the "symbols" setter. + * + * @stable ICU 63 + */ +typedef enum UNumberGroupingStrategy { + /** + * Do not display grouping separators in any locale. + * + * @stable ICU 61 + */ + UNUM_GROUPING_OFF, + + /** + * Display grouping using locale defaults, except do not show grouping on values smaller than + * 10000 (such that there is a <em>minimum of two digits</em> before the first separator). + * + * <p> + * Note that locales may restrict grouping separators to be displayed only on 1 million or + * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency). + * + * <p> + * Locale data is used to determine whether to separate larger numbers into groups of 2 + * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). + * + * @stable ICU 61 + */ + UNUM_GROUPING_MIN2, + + /** + * Display grouping using the default strategy for all locales. This is the default behavior. + * + * <p> + * Note that locales may restrict grouping separators to be displayed only on 1 million or + * greater (for example, ee and hu) or disable grouping altogether (for example, bg currency). + * + * <p> + * Locale data is used to determine whether to separate larger numbers into groups of 2 + * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). + * + * @stable ICU 61 + */ + UNUM_GROUPING_AUTO, + + /** + * Always display the grouping separator on values of at least 1000. + * + * <p> + * This option ignores the locale data that restricts or disables grouping, described in MIN2 and + * AUTO. This option may be useful to normalize the alignment of numbers, such as in a + * spreadsheet. + * + * <p> + * Locale data is used to determine whether to separate larger numbers into groups of 2 + * (customary in South Asia) or groups of 3 (customary in Europe and the Americas). + * + * @stable ICU 61 + */ + UNUM_GROUPING_ON_ALIGNED, + + /** + * Use the Western defaults: groups of 3 and enabled for all numbers 1000 or greater. Do not use + * locale data for determining the grouping strategy. + * + * @stable ICU 61 + */ + UNUM_GROUPING_THOUSANDS + +#ifndef U_HIDE_INTERNAL_API + , + /** + * One more than the highest UNumberGroupingStrategy value. + * + * @internal ICU 62: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_GROUPING_COUNT +#endif /* U_HIDE_INTERNAL_API */ + +} UNumberGroupingStrategy; + +/** + * An enum declaring how to denote positive and negative numbers. Example outputs when formatting + * 123, 0, and -123 in <em>en-US</em>: + * + * <ul> + * <li>AUTO: "123", "0", and "-123" + * <li>ALWAYS: "+123", "+0", and "-123" + * <li>NEVER: "123", "0", and "123" + * <li>ACCOUNTING: "$123", "$0", and "($123)" + * <li>ACCOUNTING_ALWAYS: "+$123", "+$0", and "($123)" + * <li>EXCEPT_ZERO: "+123", "0", and "-123" + * <li>ACCOUNTING_EXCEPT_ZERO: "+$123", "$0", and "($123)" + * </ul> + * + * <p> + * The exact format, including the position and the code point of the sign, differ by locale. + * + * @stable ICU 60 + */ +typedef enum UNumberSignDisplay { + /** + * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default + * behavior. + * + * @stable ICU 60 + */ + UNUM_SIGN_AUTO, + + /** + * Show the minus sign on negative numbers and the plus sign on positive numbers, including zero. + * To hide the sign on zero, see {@link UNUM_SIGN_EXCEPT_ZERO}. + * + * @stable ICU 60 + */ + UNUM_SIGN_ALWAYS, + + /** + * Do not show the sign on positive or negative numbers. + * + * @stable ICU 60 + */ + UNUM_SIGN_NEVER, + + /** + * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers. + * + * <p> + * The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair + * of parentheses around the number. + * + * <p> + * Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the + * AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the + * future. + * + * @stable ICU 60 + */ + UNUM_SIGN_ACCOUNTING, + + /** + * Use the locale-dependent accounting format on negative numbers, and show the plus sign on + * positive numbers, including zero. For more information on the accounting format, see the + * ACCOUNTING sign display strategy. To hide the sign on zero, see + * {@link UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO}. + * + * @stable ICU 60 + */ + UNUM_SIGN_ACCOUNTING_ALWAYS, + + /** + * Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a + * sign on zero, numbers that round to zero, or NaN. + * + * @stable ICU 61 + */ + UNUM_SIGN_EXCEPT_ZERO, + + /** + * Use the locale-dependent accounting format on negative numbers, and show the plus sign on + * positive numbers. Do not show a sign on zero, numbers that round to zero, or NaN. For more + * information on the accounting format, see the ACCOUNTING sign display strategy. + * + * @stable ICU 61 + */ + UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO, + + /** + * One more than the highest UNumberSignDisplay value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_SIGN_COUNT +} UNumberSignDisplay; + +/** + * An enum declaring how to render the decimal separator. + * + * <p> + * <ul> + * <li>UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1" + * <li>UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1" + * </ul> + * + * @stable ICU 60 + */ +typedef enum UNumberDecimalSeparatorDisplay { + /** + * Show the decimal separator when there are one or more digits to display after the separator, and do not show + * it otherwise. This is the default behavior. + * + * @stable ICU 60 + */ + UNUM_DECIMAL_SEPARATOR_AUTO, + + /** + * Always show the decimal separator, even if there are no digits to display after the separator. + * + * @stable ICU 60 + */ + UNUM_DECIMAL_SEPARATOR_ALWAYS, + + /** + * One more than the highest UNumberDecimalSeparatorDisplay value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_DECIMAL_SEPARATOR_COUNT +} UNumberDecimalSeparatorDisplay; + +struct UNumberFormatter; +/** + * C-compatible version of icu::number::LocalizedNumberFormatter. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @stable ICU 62 + */ +typedef struct UNumberFormatter UNumberFormatter; + +struct UFormattedNumber; +/** + * C-compatible version of icu::number::FormattedNumber. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @stable ICU 62 + */ +typedef struct UFormattedNumber UFormattedNumber; + + +/** + * Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only + * method for creating a new UNumberFormatter. + * + * Objects of type UNumberFormatter returned by this method are threadsafe. + * + * For more details on skeleton strings, see the documentation in numberformatter.h. For more details on + * the usage of this API, see the documentation at the top of unumberformatter.h. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param skeleton The skeleton string, like u"percent precision-integer" + * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated. + * @param locale The NUL-terminated locale ID. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE UNumberFormatter* U_EXPORT2 +unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale, + UErrorCode* ec); + + +/** + * Like unumf_openForSkeletonAndLocale, but accepts a UParseError, which will be populated with the + * location of a skeleton syntax error if such a syntax error exists. + * + * @param skeleton The skeleton string, like u"percent precision-integer" + * @param skeletonLen The number of UChars in the skeleton string, or -1 if it is NUL-terminated. + * @param locale The NUL-terminated locale ID. + * @param perror A parse error struct populated if an error occurs when parsing. Can be NULL. + * If no error occurs, perror->offset will be set to -1. + * @param ec Set if an error occurs. + * @stable ICU 64 + */ +U_STABLE UNumberFormatter* U_EXPORT2 +unumf_openForSkeletonAndLocaleWithError( + const UChar* skeleton, int32_t skeletonLen, const char* locale, UParseError* perror, UErrorCode* ec); + + +/** + * Creates an object to hold the result of a UNumberFormatter + * operation. The object can be used repeatedly; it is cleared whenever + * passed to a format function. + * + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE UFormattedNumber* U_EXPORT2 +unumf_openResult(UErrorCode* ec); + + +/** + * Uses a UNumberFormatter to format an integer to a UFormattedNumber. A string, field position, and other + * information can be retrieved from the UFormattedNumber. + * + * The UNumberFormatter can be shared between threads. Each thread should have its own local + * UFormattedNumber, however, for storing the result of the formatting operation. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. + * @param value The number to be formatted. + * @param uresult The object that will be mutated to store the result; see unumf_openResult. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult, + UErrorCode* ec); + + +/** + * Uses a UNumberFormatter to format a double to a UFormattedNumber. A string, field position, and other + * information can be retrieved from the UFormattedNumber. + * + * The UNumberFormatter can be shared between threads. Each thread should have its own local + * UFormattedNumber, however, for storing the result of the formatting operation. + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. + * @param value The number to be formatted. + * @param uresult The object that will be mutated to store the result; see unumf_openResult. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult, + UErrorCode* ec); + + +/** + * Uses a UNumberFormatter to format a decimal number to a UFormattedNumber. A string, field position, and + * other information can be retrieved from the UFormattedNumber. + * + * The UNumberFormatter can be shared between threads. Each thread should have its own local + * UFormattedNumber, however, for storing the result of the formatting operation. + * + * The syntax of the unformatted number is a "numeric string" as defined in the Decimal Arithmetic + * Specification, available at http://speleotrove.com/decimal + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar. + * @param value The numeric string to be formatted. + * @param valueLen The length of the numeric string, or -1 if it is NUL-terminated. + * @param uresult The object that will be mutated to store the result; see unumf_openResult. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen, + UFormattedNumber* uresult, UErrorCode* ec); + +/** + * Returns a representation of a UFormattedNumber as a UFormattedValue, + * which can be subsequently passed to any API requiring that type. + * + * The returned object is owned by the UFormattedNumber and is valid + * only as long as the UFormattedNumber is present and unchanged in memory. + * + * You can think of this method as a cast between types. + * + * @param uresult The object containing the formatted string. + * @param ec Set if an error occurs. + * @return A UFormattedValue owned by the input object. + * @stable ICU 64 + */ +U_STABLE const UFormattedValue* U_EXPORT2 +unumf_resultAsValue(const UFormattedNumber* uresult, UErrorCode* ec); + + +/** + * Extracts the result number string out of a UFormattedNumber to a UChar buffer if possible. + * If bufferCapacity is greater than the required length, a terminating NUL is written. + * If bufferCapacity is less than the required length, an error code is set. + * + * Also see ufmtval_getString, which returns a NUL-terminated string: + * + * int32_t len; + * const UChar* str = ufmtval_getString(unumf_resultAsValue(uresult, &ec), &len, &ec); + * + * NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead. + * + * @param uresult The object containing the formatted number. + * @param buffer Where to save the string output. + * @param bufferCapacity The number of UChars available in the buffer. + * @param ec Set if an error occurs. + * @return The required length. + * @stable ICU 62 + */ +U_STABLE int32_t U_EXPORT2 +unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity, + UErrorCode* ec); + + +/** + * Determines the start and end indices of the next occurrence of the given <em>field</em> in the + * output string. This allows you to determine the locations of, for example, the integer part, + * fraction part, or symbols. + * + * This is a simpler but less powerful alternative to {@link ufmtval_nextPosition}. + * + * If a field occurs just once, calling this method will find that occurrence and return it. If a + * field occurs multiple times, this method may be called repeatedly with the following pattern: + * + * <pre> + * UFieldPosition ufpos = {UNUM_GROUPING_SEPARATOR_FIELD, 0, 0}; + * while (unumf_resultNextFieldPosition(uresult, ufpos, &ec)) { + * // do something with ufpos. + * } + * </pre> + * + * This method is useful if you know which field to query. If you want all available field position + * information, use unumf_resultGetAllFieldPositions(). + * + * NOTE: All fields of the UFieldPosition must be initialized before calling this method. + * + * @param uresult The object containing the formatted number. + * @param ufpos + * Input+output variable. On input, the "field" property determines which field to look up, + * and the "endIndex" property determines where to begin the search. On output, the + * "beginIndex" field is set to the beginning of the first occurrence of the field after the + * input "endIndex", and "endIndex" is set to the end of that occurrence of the field + * (exclusive index). If a field position is not found, the FieldPosition is not changed and + * the method returns FALSE. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE UBool U_EXPORT2 +unumf_resultNextFieldPosition(const UFormattedNumber* uresult, UFieldPosition* ufpos, UErrorCode* ec); + + +/** + * Populates the given iterator with all fields in the formatted output string. This allows you to + * determine the locations of the integer part, fraction part, and sign. + * + * This is an alternative to the more powerful {@link ufmtval_nextPosition} API. + * + * If you need information on only one field, use {@link ufmtval_nextPosition} or + * {@link unumf_resultNextFieldPosition}. + * + * @param uresult The object containing the formatted number. + * @param ufpositer + * A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}. Iteration + * information already present in the UFieldPositionIterator is deleted, and the iterator is reset + * to apply to the fields in the formatted string created by this function call. The field values + * and indexes returned by {@link #ufieldpositer_next} represent fields denoted by + * the UNumberFormatFields enum. Fields are not returned in a guaranteed order. Fields cannot + * overlap, but they may nest. For example, 1234 could format as "1,234" which might consist of a + * grouping separator field for ',' and an integer field encompassing the entire string. + * @param ec Set if an error occurs. + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPositionIterator* ufpositer, + UErrorCode* ec); + + +// TODO(ICU-20775): Propose this as API. +// NOTE: This is not currently implemented. +// U_DRAFT int32_t U_EXPORT2 +// unumf_resultToDecimalNumber(const UFormattedNumber* uresult, char* buffer, int32_t bufferCapacity, +// UErrorCode* ec); + + +/** + * Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale(). + * + * @param uformatter An object created by unumf_openForSkeletonAndLocale(). + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_close(UNumberFormatter* uformatter); + + +/** + * Releases the UFormattedNumber created by unumf_openResult(). + * + * @param uresult An object created by unumf_openResult(). + * @stable ICU 62 + */ +U_STABLE void U_EXPORT2 +unumf_closeResult(UFormattedNumber* uresult); + + +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN + +/** + * \class LocalUNumberFormatterPointer + * "Smart pointer" class; closes a UNumberFormatter via unumf_close(). + * For most methods see the LocalPointerBase base class. + * + * Usage: + * <pre> + * LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...)); + * // no need to explicitly call unumf_close() + * </pre> + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 62 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatterPointer, UNumberFormatter, unumf_close); + +/** + * \class LocalUFormattedNumberPointer + * "Smart pointer" class; closes a UFormattedNumber via unumf_closeResult(). + * For most methods see the LocalPointerBase base class. + * + * Usage: + * <pre> + * LocalUFormattedNumberPointer uformatter(unumf_openResult(...)); + * // no need to explicitly call unumf_closeResult() + * </pre> + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 62 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedNumberPointer, UFormattedNumber, unumf_closeResult); + +U_NAMESPACE_END +#endif // U_SHOW_CPLUSPLUS_API + +#endif //__UNUMBERFORMATTER_H__ +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/contrib/libs/icu/include/unicode/unumsys.h b/contrib/libs/icu/include/unicode/unumsys.h index 1631c234fd..1529290717 100644 --- a/contrib/libs/icu/include/unicode/unumsys.h +++ b/contrib/libs/icu/include/unicode/unumsys.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -105,7 +105,7 @@ U_NAMESPACE_END /** * Returns an enumeration over the names of all of the predefined numbering systems known * to ICU. - * The numbering system names will be in alphabetical (invariant) order. + * The numbering system names will be in alphabetical (invariant) order. * @param status A pointer to a UErrorCode to receive any errors. * @return A pointer to a UEnumeration that must be closed with uenum_close(), * or NULL if an error occurred. diff --git a/contrib/libs/icu/include/unicode/uobject.h b/contrib/libs/icu/include/unicode/uobject.h index eeb331ce97..3eff5aac88 100644 --- a/contrib/libs/icu/include/unicode/uobject.h +++ b/contrib/libs/icu/include/unicode/uobject.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * ****************************************************************************** * file name: uobject.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -21,10 +21,10 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - -#include "unicode/platform.h" - +#if U_SHOW_CPLUSPLUS_API + +#include "unicode/platform.h" + /** * \file * \brief C++ API: Common ICU base class UObject. @@ -32,21 +32,21 @@ /** * \def U_NO_THROW - * Since ICU 64, use U_NOEXCEPT instead. - * - * Previously, define this to define the throw() specification so + * Since ICU 64, use U_NOEXCEPT instead. + * + * Previously, define this to define the throw() specification so * certain functions do not throw any exceptions * - * UMemory operator new methods should have the throw() specification + * UMemory operator new methods should have the throw() specification * appended to them, so that the compiler adds the additional NULL check * before calling constructors. Without, if <code>operator new</code> returns NULL the * constructor is still called, and if the constructor references member * data, (which it typically does), the result is a segmentation violation. * - * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422. + * @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422. */ #ifndef U_NO_THROW -#define U_NO_THROW U_NOEXCEPT +#define U_NO_THROW U_NOEXCEPT #endif /*===========================================================================*/ @@ -131,14 +131,14 @@ public: * for ICU4C C++ classes * @stable ICU 2.4 */ - static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT; + static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT; /** * Override for ICU4C C++ memory management. * See new(). * @stable ICU 2.4 */ - static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT; + static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT; /** * Override for ICU4C C++ memory management. @@ -148,14 +148,14 @@ public: * for ICU4C C++ classes * @stable ICU 2.4 */ - static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT; + static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT; /** * Override for ICU4C C++ memory management. * See delete(). * @stable ICU 2.4 */ - static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT; + static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT; #if U_HAVE_PLACEMENT_NEW /** @@ -163,14 +163,14 @@ public: * See new(). * @stable ICU 2.6 */ - static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; } + static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; } /** * Override for ICU4C C++ memory management for STL. * See delete(). * @stable ICU 2.6 */ - static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {} + static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {} #endif /* U_HAVE_PLACEMENT_NEW */ #if U_HAVE_DEBUG_LOCATION_NEW /** @@ -180,7 +180,7 @@ public: * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ - static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT; + static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT; /** * This method provides a matching delete for the MFC debug new * @@ -188,7 +188,7 @@ public: * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ - static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT; + static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT; #endif /* U_HAVE_DEBUG_LOCATION_NEW */ #endif /* U_OVERRIDE_CXX_ALLOCATION */ @@ -215,7 +215,7 @@ public: * The clone() function is not available in UObject because it is not * implemented by all ICU classes. * Many ICU services provide a clone() function for their class trees, - * defined on the service's C++ base class + * defined on the service's C++ base class * (which itself is a subclass of UObject). * * @stable ICU 2.2 @@ -319,6 +319,6 @@ protected: U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/upluralrules.h b/contrib/libs/icu/include/unicode/upluralrules.h index 9c09dfab8b..b5e77d07a5 100644 --- a/contrib/libs/icu/include/unicode/upluralrules.h +++ b/contrib/libs/icu/include/unicode/upluralrules.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -15,14 +15,14 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/localpointer.h" -#include "unicode/uenum.h" -#ifndef U_HIDE_INTERNAL_API -#include "unicode/unum.h" -#endif /* U_HIDE_INTERNAL_API */ - -// Forward-declaration -struct UFormattedNumber; - +#include "unicode/uenum.h" +#ifndef U_HIDE_INTERNAL_API +#include "unicode/unum.h" +#endif /* U_HIDE_INTERNAL_API */ + +// Forward-declaration +struct UFormattedNumber; + /** * \file * \brief C API: Plural rules, select plural keywords for numeric values. @@ -67,7 +67,7 @@ enum UPluralType { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UPLURAL_TYPE_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ }; /** * @stable ICU 50 @@ -90,7 +90,7 @@ typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRule * @return A UPluralRules for the specified locale, or NULL if an error occurred. * @stable ICU 4.8 */ -U_CAPI UPluralRules* U_EXPORT2 +U_CAPI UPluralRules* U_EXPORT2 uplrules_open(const char *locale, UErrorCode *status); /** @@ -102,7 +102,7 @@ uplrules_open(const char *locale, UErrorCode *status); * @return A UPluralRules for the specified locale, or NULL if an error occurred. * @stable ICU 50 */ -U_CAPI UPluralRules* U_EXPORT2 +U_CAPI UPluralRules* U_EXPORT2 uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); /** @@ -110,7 +110,7 @@ uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); * @param uplrules The UPluralRules object to close. * @stable ICU 4.8 */ -U_CAPI void U_EXPORT2 +U_CAPI void U_EXPORT2 uplrules_close(UPluralRules *uplrules); @@ -135,88 +135,88 @@ U_NAMESPACE_END /** - * Given a floating-point number, returns the keyword of the first rule that + * Given a floating-point number, returns the keyword of the first rule that * applies to the number, according to the supplied UPluralRules object. * @param uplrules The UPluralRules object specifying the rules. * @param number The number for which the rule has to be determined. - * @param keyword An output buffer to write the keyword of the rule that - * applies to number. - * @param capacity The capacity of the keyword buffer. + * @param keyword An output buffer to write the keyword of the rule that + * applies to number. + * @param capacity The capacity of the keyword buffer. * @param status A pointer to a UErrorCode to receive any errors. - * @return The length of the keyword. + * @return The length of the keyword. * @stable ICU 4.8 */ -U_CAPI int32_t U_EXPORT2 +U_CAPI int32_t U_EXPORT2 uplrules_select(const UPluralRules *uplrules, double number, UChar *keyword, int32_t capacity, UErrorCode *status); -/** - * Given a formatted number, returns the keyword of the first rule - * that applies to the number, according to the supplied UPluralRules object. - * - * A UFormattedNumber allows you to specify an exponent or trailing zeros, - * which can affect the plural category. To get a UFormattedNumber, see - * {@link UNumberFormatter}. - * - * @param uplrules The UPluralRules object specifying the rules. - * @param number The formatted number for which the rule has to be determined. - * @param keyword The destination buffer for the keyword of the rule that - * applies to number. - * @param capacity The capacity of the keyword buffer. - * @param status A pointer to a UErrorCode to receive any errors. - * @return The length of the keyword. - * @stable ICU 64 - */ -U_CAPI int32_t U_EXPORT2 -uplrules_selectFormatted(const UPluralRules *uplrules, - const struct UFormattedNumber* number, - UChar *keyword, int32_t capacity, - UErrorCode *status); - -#ifndef U_HIDE_INTERNAL_API -/** - * Given a number, returns the keyword of the first rule that applies to the - * number, according to the UPluralRules object and given the number format - * specified by the UNumberFormat object. - * Note: This internal preview interface may be removed in the future if - * an architecturally cleaner solution reaches stable status. - * @param uplrules The UPluralRules object specifying the rules. - * @param number The number for which the rule has to be determined. - * @param fmt The UNumberFormat specifying how the number will be formatted - * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). - * If this is NULL, the function behaves like uplrules_select. - * @param keyword An output buffer to write the keyword of the rule that - * applies to number. - * @param capacity The capacity of the keyword buffer. - * @param status A pointer to a UErrorCode to receive any errors. - * @return The length of keyword. - * @internal ICU 59 technology preview, may be removed in the future - */ -U_INTERNAL int32_t U_EXPORT2 -uplrules_selectWithFormat(const UPluralRules *uplrules, - double number, - const UNumberFormat *fmt, - UChar *keyword, int32_t capacity, - UErrorCode *status); - -#endif /* U_HIDE_INTERNAL_API */ - -/** - * Creates a string enumeration of all plural rule keywords used in this - * UPluralRules object. The rule "other" is always present by default. - * @param uplrules The UPluralRules object specifying the rules for - * a given locale. - * @param status A pointer to a UErrorCode to receive any errors. - * @return a string enumeration over plural rule keywords, or NULL - * upon error. The caller is responsible for closing the result. - * @stable ICU 59 - */ -U_STABLE UEnumeration* U_EXPORT2 -uplrules_getKeywords(const UPluralRules *uplrules, - UErrorCode *status); - +/** + * Given a formatted number, returns the keyword of the first rule + * that applies to the number, according to the supplied UPluralRules object. + * + * A UFormattedNumber allows you to specify an exponent or trailing zeros, + * which can affect the plural category. To get a UFormattedNumber, see + * {@link UNumberFormatter}. + * + * @param uplrules The UPluralRules object specifying the rules. + * @param number The formatted number for which the rule has to be determined. + * @param keyword The destination buffer for the keyword of the rule that + * applies to number. + * @param capacity The capacity of the keyword buffer. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The length of the keyword. + * @stable ICU 64 + */ +U_CAPI int32_t U_EXPORT2 +uplrules_selectFormatted(const UPluralRules *uplrules, + const struct UFormattedNumber* number, + UChar *keyword, int32_t capacity, + UErrorCode *status); + +#ifndef U_HIDE_INTERNAL_API +/** + * Given a number, returns the keyword of the first rule that applies to the + * number, according to the UPluralRules object and given the number format + * specified by the UNumberFormat object. + * Note: This internal preview interface may be removed in the future if + * an architecturally cleaner solution reaches stable status. + * @param uplrules The UPluralRules object specifying the rules. + * @param number The number for which the rule has to be determined. + * @param fmt The UNumberFormat specifying how the number will be formatted + * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). + * If this is NULL, the function behaves like uplrules_select. + * @param keyword An output buffer to write the keyword of the rule that + * applies to number. + * @param capacity The capacity of the keyword buffer. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The length of keyword. + * @internal ICU 59 technology preview, may be removed in the future + */ +U_INTERNAL int32_t U_EXPORT2 +uplrules_selectWithFormat(const UPluralRules *uplrules, + double number, + const UNumberFormat *fmt, + UChar *keyword, int32_t capacity, + UErrorCode *status); + +#endif /* U_HIDE_INTERNAL_API */ + +/** + * Creates a string enumeration of all plural rule keywords used in this + * UPluralRules object. The rule "other" is always present by default. + * @param uplrules The UPluralRules object specifying the rules for + * a given locale. + * @param status A pointer to a UErrorCode to receive any errors. + * @return a string enumeration over plural rule keywords, or NULL + * upon error. The caller is responsible for closing the result. + * @stable ICU 59 + */ +U_STABLE UEnumeration* U_EXPORT2 +uplrules_getKeywords(const UPluralRules *uplrules, + UErrorCode *status); + #endif /* #if !UCONFIG_NO_FORMATTING */ #endif diff --git a/contrib/libs/icu/include/unicode/uregex.h b/contrib/libs/icu/include/unicode/uregex.h index 131c492a55..2023781ed0 100644 --- a/contrib/libs/icu/include/unicode/uregex.h +++ b/contrib/libs/icu/include/unicode/uregex.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ********************************************************************** * file name: uregex.h -* encoding: UTF-8 +* encoding: UTF-8 * indentation:4 * * created on: 2004mar09 @@ -167,7 +167,7 @@ uregex_openUText(UText *pattern, UParseError *pe, UErrorCode *status); -#if !UCONFIG_NO_CONVERSION +#if !UCONFIG_NO_CONVERSION /** * Open (compile) an ICU regular expression. The resulting regular expression * handle can then be used to perform various matching operations. diff --git a/contrib/libs/icu/include/unicode/uregion.h b/contrib/libs/icu/include/unicode/uregion.h index a5de49674b..da68350694 100644 --- a/contrib/libs/icu/include/unicode/uregion.h +++ b/contrib/libs/icu/include/unicode/uregion.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -113,7 +113,7 @@ typedef enum URegionType { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ URGN_LIMIT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } URegionType; #if !UCONFIG_NO_FORMATTING diff --git a/contrib/libs/icu/include/unicode/ureldatefmt.h b/contrib/libs/icu/include/unicode/ureldatefmt.h index e2e1974f2d..fbae5aa122 100644 --- a/contrib/libs/icu/include/unicode/ureldatefmt.h +++ b/contrib/libs/icu/include/unicode/ureldatefmt.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************************** @@ -17,7 +17,7 @@ #include "unicode/unum.h" #include "unicode/udisplaycontext.h" #include "unicode/localpointer.h" -#include "unicode/uformattedvalue.h" +#include "unicode/uformattedvalue.h" /** * \file @@ -35,7 +35,7 @@ * for determining which unit to use, such as deciding between "in 7 days" * and "in 1 week". * - * @stable ICU 57 + * @stable ICU 57 */ /** @@ -67,103 +67,103 @@ typedef enum UDateRelativeDateTimeFormatterStyle { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_STYLE_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UDateRelativeDateTimeFormatterStyle; /** * Represents the unit for formatting a relative date. e.g "in 5 days" * or "next year" - * @stable ICU 57 + * @stable ICU 57 */ typedef enum URelativeDateTimeUnit { /** * Specifies that relative unit is year, e.g. "last year", * "in 5 years". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_YEAR, /** * Specifies that relative unit is quarter, e.g. "last quarter", * "in 5 quarters". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_QUARTER, /** * Specifies that relative unit is month, e.g. "last month", * "in 5 months". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_MONTH, /** * Specifies that relative unit is week, e.g. "last week", * "in 5 weeks". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_WEEK, /** * Specifies that relative unit is day, e.g. "yesterday", * "in 5 days". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_DAY, /** * Specifies that relative unit is hour, e.g. "1 hour ago", * "in 5 hours". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_HOUR, /** * Specifies that relative unit is minute, e.g. "1 minute ago", * "in 5 minutes". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_MINUTE, /** * Specifies that relative unit is second, e.g. "1 second ago", * "in 5 seconds". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_SECOND, /** * Specifies that relative unit is Sunday, e.g. "last Sunday", * "this Sunday", "next Sunday", "in 5 Sundays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_SUNDAY, /** * Specifies that relative unit is Monday, e.g. "last Monday", * "this Monday", "next Monday", "in 5 Mondays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_MONDAY, /** * Specifies that relative unit is Tuesday, e.g. "last Tuesday", * "this Tuesday", "next Tuesday", "in 5 Tuesdays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_TUESDAY, /** * Specifies that relative unit is Wednesday, e.g. "last Wednesday", * "this Wednesday", "next Wednesday", "in 5 Wednesdays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_WEDNESDAY, /** * Specifies that relative unit is Thursday, e.g. "last Thursday", * "this Thursday", "next Thursday", "in 5 Thursdays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_THURSDAY, /** * Specifies that relative unit is Friday, e.g. "last Friday", * "this Friday", "next Friday", "in 5 Fridays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_FRIDAY, /** * Specifies that relative unit is Saturday, e.g. "last Saturday", * "this Saturday", "next Saturday", "in 5 Saturdays". - * @stable ICU 57 + * @stable ICU 57 */ UDAT_REL_UNIT_SATURDAY, #ifndef U_HIDE_DEPRECATED_API @@ -172,34 +172,34 @@ typedef enum URelativeDateTimeUnit { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ UDAT_REL_UNIT_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } URelativeDateTimeUnit; -/** - * FieldPosition and UFieldPosition selectors for format fields - * defined by RelativeDateTimeFormatter. - * @stable ICU 64 - */ -typedef enum URelativeDateTimeFormatterField { - /** - * Represents a literal text string, like "tomorrow" or "days ago". - * @stable ICU 64 - */ - UDAT_REL_LITERAL_FIELD, - /** - * Represents a number quantity, like "3" in "3 days ago". - * @stable ICU 64 - */ - UDAT_REL_NUMERIC_FIELD, -} URelativeDateTimeFormatterField; - - +/** + * FieldPosition and UFieldPosition selectors for format fields + * defined by RelativeDateTimeFormatter. + * @stable ICU 64 + */ +typedef enum URelativeDateTimeFormatterField { + /** + * Represents a literal text string, like "tomorrow" or "days ago". + * @stable ICU 64 + */ + UDAT_REL_LITERAL_FIELD, + /** + * Represents a number quantity, like "3" in "3 days ago". + * @stable ICU 64 + */ + UDAT_REL_NUMERIC_FIELD, +} URelativeDateTimeFormatterField; + + /** * Opaque URelativeDateTimeFormatter object for use in C programs. - * @stable ICU 57 + * @stable ICU 57 */ struct URelativeDateTimeFormatter; -typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */ +typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */ /** @@ -232,9 +232,9 @@ typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C ty * @return * A pointer to a URelativeDateTimeFormatter object for the specified locale, * or NULL if an error occurred. - * @stable ICU 57 + * @stable ICU 57 */ -U_STABLE URelativeDateTimeFormatter* U_EXPORT2 +U_STABLE URelativeDateTimeFormatter* U_EXPORT2 ureldatefmt_open( const char* locale, UNumberFormat* nfToAdopt, UDateRelativeDateTimeFormatterStyle width, @@ -245,57 +245,57 @@ ureldatefmt_open( const char* locale, * Close a URelativeDateTimeFormatter object. Once closed it may no longer be used. * @param reldatefmt * The URelativeDateTimeFormatter object to close. - * @stable ICU 57 + * @stable ICU 57 */ -U_STABLE void U_EXPORT2 +U_STABLE void U_EXPORT2 ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt); -struct UFormattedRelativeDateTime; -/** - * Opaque struct to contain the results of a URelativeDateTimeFormatter operation. - * @stable ICU 64 - */ -typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime; - -/** - * Creates an object to hold the result of a URelativeDateTimeFormatter - * operation. The object can be used repeatedly; it is cleared whenever - * passed to a format function. - * - * @param ec Set if an error occurs. - * @return A pointer needing ownership. - * @stable ICU 64 - */ -U_STABLE UFormattedRelativeDateTime* U_EXPORT2 -ureldatefmt_openResult(UErrorCode* ec); - -/** - * Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue, - * which can be subsequently passed to any API requiring that type. - * - * The returned object is owned by the UFormattedRelativeDateTime and is valid - * only as long as the UFormattedRelativeDateTime is present and unchanged in memory. - * - * You can think of this method as a cast between types. - * - * @param ufrdt The object containing the formatted string. - * @param ec Set if an error occurs. - * @return A UFormattedValue owned by the input object. - * @stable ICU 64 - */ -U_STABLE const UFormattedValue* U_EXPORT2 -ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec); - -/** - * Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult. - * - * @param ufrdt The object to release. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt); - - +struct UFormattedRelativeDateTime; +/** + * Opaque struct to contain the results of a URelativeDateTimeFormatter operation. + * @stable ICU 64 + */ +typedef struct UFormattedRelativeDateTime UFormattedRelativeDateTime; + +/** + * Creates an object to hold the result of a URelativeDateTimeFormatter + * operation. The object can be used repeatedly; it is cleared whenever + * passed to a format function. + * + * @param ec Set if an error occurs. + * @return A pointer needing ownership. + * @stable ICU 64 + */ +U_STABLE UFormattedRelativeDateTime* U_EXPORT2 +ureldatefmt_openResult(UErrorCode* ec); + +/** + * Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue, + * which can be subsequently passed to any API requiring that type. + * + * The returned object is owned by the UFormattedRelativeDateTime and is valid + * only as long as the UFormattedRelativeDateTime is present and unchanged in memory. + * + * You can think of this method as a cast between types. + * + * @param ufrdt The object containing the formatted string. + * @param ec Set if an error occurs. + * @return A UFormattedValue owned by the input object. + * @stable ICU 64 + */ +U_STABLE const UFormattedValue* U_EXPORT2 +ureldatefmt_resultAsValue(const UFormattedRelativeDateTime* ufrdt, UErrorCode* ec); + +/** + * Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult. + * + * @param ufrdt The object to release. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ureldatefmt_closeResult(UFormattedRelativeDateTime* ufrdt); + + #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN @@ -307,21 +307,21 @@ U_NAMESPACE_BEGIN * * @see LocalPointerBase * @see LocalPointer - * @stable ICU 57 + * @stable ICU 57 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close); -/** - * \class LocalUFormattedRelativeDateTimePointer - * "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 64 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult); - +/** + * \class LocalUFormattedRelativeDateTimePointer + * "Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 64 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedRelativeDateTimePointer, UFormattedRelativeDateTime, ureldatefmt_closeResult); + U_NAMESPACE_END #endif @@ -352,9 +352,9 @@ U_NAMESPACE_END * @return * The length of the formatted result; may be greater * than resultCapacity, in which case an error is returned. - * @stable ICU 57 + * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, double offset, URelativeDateTimeUnit unit, @@ -363,37 +363,37 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, UErrorCode* status); /** - * Format a combination of URelativeDateTimeUnit and numeric - * offset using a numeric style, e.g. "1 week ago", "in 1 week", - * "5 weeks ago", "in 5 weeks". - * - * @param reldatefmt - * The URelativeDateTimeFormatter object specifying the - * format conventions. - * @param offset - * The signed offset for the specified unit. This will - * be formatted according to this object's UNumberFormat - * object. - * @param unit - * The unit to use when formatting the relative - * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. - * @param result - * A pointer to a UFormattedRelativeDateTime to populate. - * @param status - * A pointer to a UErrorCode to receive any errors. In - * case of error status, the contents of result are - * undefined. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ureldatefmt_formatNumericToResult( - const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UFormattedRelativeDateTime* result, - UErrorCode* status); - -/** + * Format a combination of URelativeDateTimeUnit and numeric + * offset using a numeric style, e.g. "1 week ago", "in 1 week", + * "5 weeks ago", "in 5 weeks". + * + * @param reldatefmt + * The URelativeDateTimeFormatter object specifying the + * format conventions. + * @param offset + * The signed offset for the specified unit. This will + * be formatted according to this object's UNumberFormat + * object. + * @param unit + * The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. + * @param result + * A pointer to a UFormattedRelativeDateTime to populate. + * @param status + * A pointer to a UErrorCode to receive any errors. In + * case of error status, the contents of result are + * undefined. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ureldatefmt_formatNumericToResult( + const URelativeDateTimeFormatter* reldatefmt, + double offset, + URelativeDateTimeUnit unit, + UFormattedRelativeDateTime* result, + UErrorCode* status); + +/** * Format a combination of URelativeDateTimeUnit and numeric offset * using a text style if possible, e.g. "last week", "this week", * "next week", "yesterday", "tomorrow". Falls back to numeric @@ -419,9 +419,9 @@ ureldatefmt_formatNumericToResult( * @return * The length of the formatted result; may be greater * than resultCapacity, in which case an error is returned. - * @stable ICU 57 + * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, double offset, URelativeDateTimeUnit unit, @@ -430,40 +430,40 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, UErrorCode* status); /** - * Format a combination of URelativeDateTimeUnit and numeric offset - * using a text style if possible, e.g. "last week", "this week", - * "next week", "yesterday", "tomorrow". Falls back to numeric - * style if no appropriate text term is available for the specified - * offset in the object's locale. - * - * This method populates a UFormattedRelativeDateTime, which exposes more - * information than the string populated by format(). - * - * @param reldatefmt - * The URelativeDateTimeFormatter object specifying the - * format conventions. - * @param offset - * The signed offset for the specified unit. - * @param unit - * The unit to use when formatting the relative - * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. - * @param result - * A pointer to a UFormattedRelativeDateTime to populate. - * @param status - * A pointer to a UErrorCode to receive any errors. In - * case of error status, the contents of result are - * undefined. - * @stable ICU 64 - */ -U_STABLE void U_EXPORT2 -ureldatefmt_formatToResult( - const URelativeDateTimeFormatter* reldatefmt, - double offset, - URelativeDateTimeUnit unit, - UFormattedRelativeDateTime* result, - UErrorCode* status); - -/** + * Format a combination of URelativeDateTimeUnit and numeric offset + * using a text style if possible, e.g. "last week", "this week", + * "next week", "yesterday", "tomorrow". Falls back to numeric + * style if no appropriate text term is available for the specified + * offset in the object's locale. + * + * This method populates a UFormattedRelativeDateTime, which exposes more + * information than the string populated by format(). + * + * @param reldatefmt + * The URelativeDateTimeFormatter object specifying the + * format conventions. + * @param offset + * The signed offset for the specified unit. + * @param unit + * The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. + * @param result + * A pointer to a UFormattedRelativeDateTime to populate. + * @param status + * A pointer to a UErrorCode to receive any errors. In + * case of error status, the contents of result are + * undefined. + * @stable ICU 64 + */ +U_STABLE void U_EXPORT2 +ureldatefmt_formatToResult( + const URelativeDateTimeFormatter* reldatefmt, + double offset, + URelativeDateTimeUnit unit, + UFormattedRelativeDateTime* result, + UErrorCode* status); + +/** * Combines a relative date string and a time string in this object's * locale. This is done with the same date-time separator used for the * default calendar in this locale to produce a result such as @@ -490,9 +490,9 @@ ureldatefmt_formatToResult( * @return * The length of the formatted result; may be greater than resultCapacity, * in which case an error is returned. - * @stable ICU 57 + * @stable ICU 57 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt, const UChar * relativeDateString, int32_t relativeDateStringLen, diff --git a/contrib/libs/icu/include/unicode/urename.h b/contrib/libs/icu/include/unicode/urename.h index 30f4b7af39..c1e6c01610 100644 --- a/contrib/libs/icu/include/unicode/urename.h +++ b/contrib/libs/icu/include/unicode/urename.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -7,7 +7,7 @@ ******************************************************************************* * * file name: urename.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -33,9 +33,9 @@ #if !U_DISABLE_RENAMING -// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work. -#if !(defined(_MSC_VER) && defined(__INTELLISENSE__)) - +// Disable Renaming for Visual Studio's IntelliSense feature, so that 'Go-to-Definition' (F12) will work. +#if !(defined(_MSC_VER) && defined(__INTELLISENSE__)) + /* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give the platform a chance to define it first. Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. @@ -103,19 +103,19 @@ #define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) #define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) #define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) -#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) +#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) #define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) #define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) #define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) #define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) #define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) -#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag) -#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) +#define _isUnicodeLocaleTypeSubtag U_ICU_ENTRY_POINT_RENAME(_isUnicodeLocaleTypeSubtag) +#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) #define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) -#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) -#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) +#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) +#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) #define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) -#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames) +#define initNumsysNames U_ICU_ENTRY_POINT_RENAME(initNumsysNames) #define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) #define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) #define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) @@ -134,8 +134,8 @@ #define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) #define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) #define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) -#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup) -#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup) +#define numSysCleanup U_ICU_ENTRY_POINT_RENAME(numSysCleanup) +#define rbbi_cleanup U_ICU_ENTRY_POINT_RENAME(rbbi_cleanup) #define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) #define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) #define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) @@ -193,18 +193,18 @@ #define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) #define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) #define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) -#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace) -#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace) +#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace) +#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace) #define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) #define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) -#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace) +#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace) #define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) #define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) #define res_load U_ICU_ENTRY_POINT_RENAME(res_load) #define res_read U_ICU_ENTRY_POINT_RENAME(res_read) #define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) #define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) -#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper) +#define u_asciiToUpper U_ICU_ENTRY_POINT_RENAME(u_asciiToUpper) #define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) #define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) #define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch) @@ -261,14 +261,14 @@ #define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) #define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) #define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket) -#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet) +#define u_getBinaryPropertySet U_ICU_ENTRY_POINT_RENAME(u_getBinaryPropertySet) #define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) #define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) #define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) #define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) #define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) #define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) -#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap) +#define u_getIntPropertyMap U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMap) #define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) #define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) #define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) @@ -489,7 +489,7 @@ #define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) #define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) #define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) -#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) +#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) #define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) #define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) #define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) @@ -497,7 +497,7 @@ #define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) #define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) #define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) -#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) +#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) #define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) #define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) #define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) @@ -525,7 +525,7 @@ #define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) #define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference) #define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) -#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone) +#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone) #define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) #define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) #define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) @@ -560,7 +560,7 @@ #define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) #define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) #define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) -#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie) +#define ucase_getTrie U_ICU_ENTRY_POINT_RENAME(ucase_getTrie) #define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) #define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) #define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) @@ -587,18 +587,18 @@ #define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) #define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) #define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) -#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close) -#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory) -#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField) -#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory) -#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField) -#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes) -#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext) -#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField) -#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open) -#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset) -#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext) -#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState) +#define ucfpos_close U_ICU_ENTRY_POINT_RENAME(ucfpos_close) +#define ucfpos_constrainCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainCategory) +#define ucfpos_constrainField U_ICU_ENTRY_POINT_RENAME(ucfpos_constrainField) +#define ucfpos_getCategory U_ICU_ENTRY_POINT_RENAME(ucfpos_getCategory) +#define ucfpos_getField U_ICU_ENTRY_POINT_RENAME(ucfpos_getField) +#define ucfpos_getIndexes U_ICU_ENTRY_POINT_RENAME(ucfpos_getIndexes) +#define ucfpos_getInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_getInt64IterationContext) +#define ucfpos_matchesField U_ICU_ENTRY_POINT_RENAME(ucfpos_matchesField) +#define ucfpos_open U_ICU_ENTRY_POINT_RENAME(ucfpos_open) +#define ucfpos_reset U_ICU_ENTRY_POINT_RENAME(ucfpos_reset) +#define ucfpos_setInt64IterationContext U_ICU_ENTRY_POINT_RENAME(ucfpos_setInt64IterationContext) +#define ucfpos_setState U_ICU_ENTRY_POINT_RENAME(ucfpos_setState) #define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) #define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) #define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) @@ -635,7 +635,7 @@ #define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) #define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) #define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) -#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup) +#define ucnv_enableCleanup U_ICU_ENTRY_POINT_RENAME(ucnv_enableCleanup) #define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) #define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) #define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) @@ -785,20 +785,20 @@ #define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) #define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) #define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) -#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get) -#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange) -#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close) -#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get) -#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange) -#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType) -#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth) -#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange) -#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex) -#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index) -#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex) -#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary) -#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap) -#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary) +#define ucpmap_get U_ICU_ENTRY_POINT_RENAME(ucpmap_get) +#define ucpmap_getRange U_ICU_ENTRY_POINT_RENAME(ucpmap_getRange) +#define ucptrie_close U_ICU_ENTRY_POINT_RENAME(ucptrie_close) +#define ucptrie_get U_ICU_ENTRY_POINT_RENAME(ucptrie_get) +#define ucptrie_getRange U_ICU_ENTRY_POINT_RENAME(ucptrie_getRange) +#define ucptrie_getType U_ICU_ENTRY_POINT_RENAME(ucptrie_getType) +#define ucptrie_getValueWidth U_ICU_ENTRY_POINT_RENAME(ucptrie_getValueWidth) +#define ucptrie_internalGetRange U_ICU_ENTRY_POINT_RENAME(ucptrie_internalGetRange) +#define ucptrie_internalSmallIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallIndex) +#define ucptrie_internalSmallU8Index U_ICU_ENTRY_POINT_RENAME(ucptrie_internalSmallU8Index) +#define ucptrie_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(ucptrie_internalU8PrevIndex) +#define ucptrie_openFromBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_openFromBinary) +#define ucptrie_swap U_ICU_ENTRY_POINT_RENAME(ucptrie_swap) +#define ucptrie_toBinary U_ICU_ENTRY_POINT_RENAME(ucptrie_toBinary) #define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) #define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) #define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) @@ -898,8 +898,8 @@ #define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) #define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) #define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) -#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle) -#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName) +#define udatpg_getDefaultHourCycle U_ICU_ENTRY_POINT_RENAME(udatpg_getDefaultHourCycle) +#define udatpg_getFieldDisplayName U_ICU_ENTRY_POINT_RENAME(udatpg_getFieldDisplayName) #define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) #define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) #define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) @@ -914,13 +914,13 @@ #define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) #define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap) #define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close) -#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult) +#define udtitvfmt_closeResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_closeResult) #define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) -#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult) -#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) +#define udtitvfmt_formatCalendarToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatCalendarToResult) +#define udtitvfmt_formatToResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_formatToResult) #define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) -#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) -#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) +#define udtitvfmt_openResult U_ICU_ENTRY_POINT_RENAME(udtitvfmt_openResult) +#define udtitvfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(udtitvfmt_resultAsValue) #define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) #define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) #define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) @@ -949,8 +949,8 @@ #define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars) #define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric) #define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open) -#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString) -#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition) +#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString) +#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition) #define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance) #define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender) #define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) @@ -979,7 +979,7 @@ #define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) #define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) #define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) -#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) +#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) #define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) #define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) #define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) @@ -1053,13 +1053,13 @@ #define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) #define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) #define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) -#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult) +#define ulistfmt_closeResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_closeResult) #define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format) -#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult) +#define ulistfmt_formatStringsToResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_formatStringsToResult) #define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open) -#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType) -#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult) -#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue) +#define ulistfmt_openForType U_ICU_ENTRY_POINT_RENAME(ulistfmt_openForType) +#define ulistfmt_openResult U_ICU_ENTRY_POINT_RENAME(ulistfmt_openResult) +#define ulistfmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ulistfmt_resultAsValue) #define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) #define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) #define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) @@ -1097,7 +1097,7 @@ #define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) #define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft) #define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) -#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType) +#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType) #define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) #define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) #define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) @@ -1118,33 +1118,33 @@ #define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) #define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) #define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) -#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags) -#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize) -#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) -#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName) +#define ulocimp_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_addLikelySubtags) +#define ulocimp_canonicalize U_ICU_ENTRY_POINT_RENAME(ulocimp_canonicalize) +#define ulocimp_forLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_forLanguageTag) +#define ulocimp_getBaseName U_ICU_ENTRY_POINT_RENAME(ulocimp_getBaseName) #define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) #define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) -#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName) +#define ulocimp_getName U_ICU_ENTRY_POINT_RENAME(ulocimp_getName) #define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) #define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) -#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) +#define ulocimp_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(ulocimp_minimizeSubtags) #define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) #define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) -#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag) +#define ulocimp_toLanguageTag U_ICU_ENTRY_POINT_RENAME(ulocimp_toLanguageTag) #define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey) #define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType) -#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags) -#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag) -#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags) -#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag) -#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag) -#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags) -#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags) -#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute) -#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes) +#define ultag_isExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isExtensionSubtags) +#define ultag_isLanguageSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isLanguageSubtag) +#define ultag_isPrivateuseValueSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isPrivateuseValueSubtags) +#define ultag_isRegionSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isRegionSubtag) +#define ultag_isScriptSubtag U_ICU_ENTRY_POINT_RENAME(ultag_isScriptSubtag) +#define ultag_isTransformedExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isTransformedExtensionSubtags) +#define ultag_isUnicodeExtensionSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeExtensionSubtags) +#define ultag_isUnicodeLocaleAttribute U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttribute) +#define ultag_isUnicodeLocaleAttributes U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleAttributes) #define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey) #define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType) -#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags) +#define ultag_isVariantSubtags U_ICU_ENTRY_POINT_RENAME(ultag_isVariantSubtags) #define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) #define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) #define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) @@ -1159,16 +1159,16 @@ #define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) #define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) #define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) -#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable) -#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone) -#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close) -#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap) -#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie) -#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get) -#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange) -#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open) -#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set) -#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange) +#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable) +#define umutablecptrie_clone U_ICU_ENTRY_POINT_RENAME(umutablecptrie_clone) +#define umutablecptrie_close U_ICU_ENTRY_POINT_RENAME(umutablecptrie_close) +#define umutablecptrie_fromUCPMap U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPMap) +#define umutablecptrie_fromUCPTrie U_ICU_ENTRY_POINT_RENAME(umutablecptrie_fromUCPTrie) +#define umutablecptrie_get U_ICU_ENTRY_POINT_RENAME(umutablecptrie_get) +#define umutablecptrie_getRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_getRange) +#define umutablecptrie_open U_ICU_ENTRY_POINT_RENAME(umutablecptrie_open) +#define umutablecptrie_set U_ICU_ENTRY_POINT_RENAME(umutablecptrie_set) +#define umutablecptrie_setRange U_ICU_ENTRY_POINT_RENAME(umutablecptrie_setRange) #define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) #define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) #define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) @@ -1211,7 +1211,7 @@ #define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) #define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) #define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) -#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) +#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) #define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) #define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) #define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) @@ -1234,18 +1234,18 @@ #define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) #define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) #define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) -#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close) -#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult) -#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal) -#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble) -#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt) -#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale) -#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError) -#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult) -#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) -#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) -#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) -#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) +#define unumf_close U_ICU_ENTRY_POINT_RENAME(unumf_close) +#define unumf_closeResult U_ICU_ENTRY_POINT_RENAME(unumf_closeResult) +#define unumf_formatDecimal U_ICU_ENTRY_POINT_RENAME(unumf_formatDecimal) +#define unumf_formatDouble U_ICU_ENTRY_POINT_RENAME(unumf_formatDouble) +#define unumf_formatInt U_ICU_ENTRY_POINT_RENAME(unumf_formatInt) +#define unumf_openForSkeletonAndLocale U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocale) +#define unumf_openForSkeletonAndLocaleWithError U_ICU_ENTRY_POINT_RENAME(unumf_openForSkeletonAndLocaleWithError) +#define unumf_openResult U_ICU_ENTRY_POINT_RENAME(unumf_openResult) +#define unumf_resultAsValue U_ICU_ENTRY_POINT_RENAME(unumf_resultAsValue) +#define unumf_resultGetAllFieldPositions U_ICU_ENTRY_POINT_RENAME(unumf_resultGetAllFieldPositions) +#define unumf_resultNextFieldPosition U_ICU_ENTRY_POINT_RENAME(unumf_resultNextFieldPosition) +#define unumf_resultToString U_ICU_ENTRY_POINT_RENAME(unumf_resultToString) #define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) #define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) #define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) @@ -1255,12 +1255,12 @@ #define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) #define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) #define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) -#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) +#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) #define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) #define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) #define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) -#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) -#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) +#define uplrules_selectFormatted U_ICU_ENTRY_POINT_RENAME(uplrules_selectFormatted) +#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) #define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) #define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) #define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) @@ -1284,10 +1284,10 @@ #define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) #define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) #define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) -#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts) +#define uprops_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uprops_addPropertyStarts) #define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) #define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) -#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow) +#define uprv_add32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_add32_overflow) #define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) #define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) #define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) @@ -1299,7 +1299,7 @@ #define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) #define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) #define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) -#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) +#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) #define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) #define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) #define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) @@ -1386,7 +1386,7 @@ #define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func) #define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) #define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) -#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii) +#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii) #define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii) #define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) #define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) @@ -1406,7 +1406,7 @@ #define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) #define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) #define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter) -#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign) +#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign) #define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) #define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) #define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) @@ -1422,7 +1422,7 @@ #define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) #define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) #define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) -#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow) +#define uprv_mul32_overflow U_ICU_ENTRY_POINT_RENAME(uprv_mul32_overflow) #define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) #define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) #define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) @@ -1534,15 +1534,15 @@ #define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) #define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) #define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) -#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult) +#define ureldatefmt_closeResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_closeResult) #define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) #define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) #define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) -#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult) -#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult) +#define ureldatefmt_formatNumericToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumericToResult) +#define ureldatefmt_formatToResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatToResult) #define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) -#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult) -#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue) +#define ureldatefmt_openResult U_ICU_ENTRY_POINT_RENAME(ureldatefmt_openResult) +#define ureldatefmt_resultAsValue U_ICU_ENTRY_POINT_RENAME(ureldatefmt_resultAsValue) #define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) #define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) #define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) @@ -1574,7 +1574,7 @@ #define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) #define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) #define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) -#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback) +#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback) #define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) #define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) #define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) @@ -1584,7 +1584,7 @@ #define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) #define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) #define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) -#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn) +#define ures_openDirectFillIn U_ICU_ENTRY_POINT_RENAME(ures_openDirectFillIn) #define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) #define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault) #define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) @@ -1741,14 +1741,14 @@ #define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) #define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) #define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) -#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) -#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) +#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) +#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) #define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) #define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) #define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) #define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) #define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) -#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) +#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) #define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) #define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) #define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) @@ -1850,7 +1850,7 @@ #define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) #define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) #define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) -#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion) +#define utrie_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie_swapAnyVersion) #define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) #define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) #define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) @@ -1900,7 +1900,7 @@ #define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) #define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) -#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */ -#endif /* U_DISABLE_RENAMING */ -#endif /* URENAME_H */ +#endif /* !(defined(_MSC_VER) && defined(__INTELLISENSE__)) */ +#endif /* U_DISABLE_RENAMING */ +#endif /* URENAME_H */ diff --git a/contrib/libs/icu/include/unicode/urep.h b/contrib/libs/icu/include/unicode/urep.h index 932202ddb0..9745fc88a2 100644 --- a/contrib/libs/icu/include/unicode/urep.h +++ b/contrib/libs/icu/include/unicode/urep.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** diff --git a/contrib/libs/icu/include/unicode/ures.h b/contrib/libs/icu/include/unicode/ures.h index 839779fada..4ef7c643b1 100644 --- a/contrib/libs/icu/include/unicode/ures.h +++ b/contrib/libs/icu/include/unicode/ures.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -16,7 +16,7 @@ * 04/04/99 helena Fixed internal header inclusion. * 04/15/99 Madhu Updated Javadoc * 06/14/99 stephen Removed functions taking a filename suffix. -* 07/20/99 stephen Language-independent typedef to void* +* 07/20/99 stephen Language-independent typedef to void* * 11/09/99 weiv Added ures_getLocale() * 06/24/02 weiv Added support for resource sharing ****************************************************************************** @@ -138,7 +138,7 @@ typedef enum { /** * Opens a UResourceBundle, from which users can extract strings by using * their corresponding keys. - * Note that the caller is responsible of calling <TT>ures_close</TT> on each successfully + * Note that the caller is responsible of calling <TT>ures_close</TT> on each successfully * opened resource bundle. * @param packageName The packageName and locale together point to an ICU udata object, * as defined by <code> udata_open( packageName, "res", locale, err) </code> @@ -301,7 +301,7 @@ ures_getVersion(const UResourceBundle* resB, * you to query for the real locale of the resource. For example, if you requested * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. * For subresources, the locale where this resource comes from will be returned. - * If fallback has occurred, getLocale will reflect this. + * If fallback has occurred, getLocale will reflect this. * * @param resourceBundle resource bundle in question * @param status just for catching illegal arguments @@ -333,19 +333,19 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle, #ifndef U_HIDE_INTERNAL_API /** - * Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle. - * + * Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle. + * * TODO need to revisit usefulness of this function * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) - * @param r The existing UResourceBundle to fill in. If NULL then status will be - * set to U_ILLEGAL_ARGUMENT_ERROR. + * @param r The existing UResourceBundle to fill in. If NULL then status will be + * set to U_ILLEGAL_ARGUMENT_ERROR. * @param packageName The packageName and locale together point to an ICU udata object, * as defined by <code> udata_open( packageName, "res", locale, err) </code> * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. If NULL, ICU data will be used. * @param localeID specifies the locale for which we want to open the resource - * @param status The error code. + * @param status The error code. * @internal */ U_INTERNAL void U_EXPORT2 @@ -580,7 +580,7 @@ ures_hasNext(const UResourceBundle *resourceBundle); * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. * Alternatively, you can supply a struct to be filled by this function. * @param status fills in the outgoing error code. You may still get a non NULL result even if an - * error occurred. Check status instead. + * error occurred. Check status instead. * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ @@ -596,7 +596,7 @@ ures_getNextResource(UResourceBundle *resourceBundle, * @param resourceBundle a resource * @param len fill in length of the string * @param key fill in for key associated with this string. NULL if no key - * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 @@ -615,7 +615,7 @@ ures_getNextString(UResourceBundle *resourceBundle, * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. * Alternatively, you can supply a struct to be filled by this function. * @param status fills in the outgoing error code. Don't count on NULL being returned if an error has - * occurred. Check status instead. + * occurred. Check status instead. * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ @@ -631,7 +631,7 @@ ures_getByIndex(const UResourceBundle *resourceBundle, * @param resourceBundle a resource * @param indexS an index to the wanted string. * @param len fill in length of the string - * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 @@ -722,7 +722,7 @@ ures_getByKey(const UResourceBundle *resourceBundle, * @param resB a resource * @param key a key associated with the wanted string * @param len fill in length of the string - * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't + * @param status fills in the outgoing error code. If an error occurred, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 diff --git a/contrib/libs/icu/include/unicode/uscript.h b/contrib/libs/icu/include/unicode/uscript.h index 53d57abed1..df5c6735a5 100644 --- a/contrib/libs/icu/include/unicode/uscript.h +++ b/contrib/libs/icu/include/unicode/uscript.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -444,46 +444,46 @@ typedef enum UScriptCode { /** @stable ICU 58 */ USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */ - /** @stable ICU 60 */ - USCRIPT_MASARAM_GONDI = 175,/* Gonm */ - /** @stable ICU 60 */ - USCRIPT_SOYOMBO = 176,/* Soyo */ - /** @stable ICU 60 */ - USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */ - - /** @stable ICU 62 */ - USCRIPT_DOGRA = 178,/* Dogr */ - /** @stable ICU 62 */ - USCRIPT_GUNJALA_GONDI = 179,/* Gong */ - /** @stable ICU 62 */ - USCRIPT_MAKASAR = 180,/* Maka */ - /** @stable ICU 62 */ - USCRIPT_MEDEFAIDRIN = 181,/* Medf */ - /** @stable ICU 62 */ - USCRIPT_HANIFI_ROHINGYA = 182,/* Rohg */ - /** @stable ICU 62 */ - USCRIPT_SOGDIAN = 183,/* Sogd */ - /** @stable ICU 62 */ - USCRIPT_OLD_SOGDIAN = 184,/* Sogo */ - - /** @stable ICU 64 */ - USCRIPT_ELYMAIC = 185,/* Elym */ - /** @stable ICU 64 */ - USCRIPT_NYIAKENG_PUACHUE_HMONG = 186,/* Hmnp */ - /** @stable ICU 64 */ - USCRIPT_NANDINAGARI = 187,/* Nand */ - /** @stable ICU 64 */ - USCRIPT_WANCHO = 188,/* Wcho */ - - /** @stable ICU 66 */ - USCRIPT_CHORASMIAN = 189,/* Chrs */ - /** @stable ICU 66 */ - USCRIPT_DIVES_AKURU = 190,/* Diak */ - /** @stable ICU 66 */ - USCRIPT_KHITAN_SMALL_SCRIPT = 191,/* Kits */ - /** @stable ICU 66 */ - USCRIPT_YEZIDI = 192,/* Yezi */ - + /** @stable ICU 60 */ + USCRIPT_MASARAM_GONDI = 175,/* Gonm */ + /** @stable ICU 60 */ + USCRIPT_SOYOMBO = 176,/* Soyo */ + /** @stable ICU 60 */ + USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */ + + /** @stable ICU 62 */ + USCRIPT_DOGRA = 178,/* Dogr */ + /** @stable ICU 62 */ + USCRIPT_GUNJALA_GONDI = 179,/* Gong */ + /** @stable ICU 62 */ + USCRIPT_MAKASAR = 180,/* Maka */ + /** @stable ICU 62 */ + USCRIPT_MEDEFAIDRIN = 181,/* Medf */ + /** @stable ICU 62 */ + USCRIPT_HANIFI_ROHINGYA = 182,/* Rohg */ + /** @stable ICU 62 */ + USCRIPT_SOGDIAN = 183,/* Sogd */ + /** @stable ICU 62 */ + USCRIPT_OLD_SOGDIAN = 184,/* Sogo */ + + /** @stable ICU 64 */ + USCRIPT_ELYMAIC = 185,/* Elym */ + /** @stable ICU 64 */ + USCRIPT_NYIAKENG_PUACHUE_HMONG = 186,/* Hmnp */ + /** @stable ICU 64 */ + USCRIPT_NANDINAGARI = 187,/* Nand */ + /** @stable ICU 64 */ + USCRIPT_WANCHO = 188,/* Wcho */ + + /** @stable ICU 66 */ + USCRIPT_CHORASMIAN = 189,/* Chrs */ + /** @stable ICU 66 */ + USCRIPT_DIVES_AKURU = 190,/* Diak */ + /** @stable ICU 66 */ + USCRIPT_KHITAN_SMALL_SCRIPT = 191,/* Kits */ + /** @stable ICU 66 */ + USCRIPT_YEZIDI = 192,/* Yezi */ + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal UScriptCode value. @@ -491,7 +491,7 @@ typedef enum UScriptCode { * * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - USCRIPT_CODE_LIMIT = 193 + USCRIPT_CODE_LIMIT = 193 #endif // U_HIDE_DEPRECATED_API } UScriptCode; @@ -509,7 +509,7 @@ typedef enum UScriptCode { * @param nameOrAbbrOrLocale name of the script, as given in * PropertyValueAliases.txt, or ISO 15924 code or locale * @param fillIn the UScriptCode buffer to fill in the script code - * @param capacity the capacity (size) of UScriptCode buffer passed in. + * @param capacity the capacity (size) of UScriptCode buffer passed in. * @param err the error status code. * @return The number of script codes filled in the buffer passed in * @stable ICU 2.4 diff --git a/contrib/libs/icu/include/unicode/usearch.h b/contrib/libs/icu/include/unicode/usearch.h index 080528e347..3a43a22c64 100644 --- a/contrib/libs/icu/include/unicode/usearch.h +++ b/contrib/libs/icu/include/unicode/usearch.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -24,7 +24,7 @@ * \file * \brief C API: StringSearch * - * C APIs for an engine that provides language-sensitive text searching based + * C APIs for an engine that provides language-sensitive text searching based * on the comparison rules defined in a <tt>UCollator</tt> data struct, * see <tt>ucol.h</tt>. This ensures that language eccentricity can be * handled, e.g. for the German collator, characters ß and SS will be matched @@ -55,7 +55,7 @@ * <p> * This search has APIs similar to that of other text iteration mechanisms * such as the break iterators in <tt>ubrk.h</tt>. Using these - * APIs, it is easy to scan through text looking for all occurrences of + * APIs, it is easy to scan through text looking for all occurrences of * a given pattern. This search iterator allows changing of direction by * calling a <tt>reset</tt> followed by a <tt>next</tt> or <tt>previous</tt>. * Though a direction change can occur without calling <tt>reset</tt> first, @@ -130,7 +130,7 @@ * pos = usearch_next(search, &status)) * { * printf("Found match at %d pos, length is %d\n", pos, - * usearch_getMatchedLength(search)); + * usearch_getMatchedLength(search)); * } * } * @@ -196,7 +196,7 @@ typedef enum { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ USEARCH_ATTRIBUTE_COUNT = 3 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } USearchAttribute; /** @@ -257,9 +257,9 @@ typedef enum { * match an e with the same diacritic or a plain e in the searched text. * * This option is similar to "asymmetric search" as described in - * [UTS #10 Unicode Collation Algorithm](http://www.unicode.org/reports/tr10/#Asymmetric_Search), - * but also allows unmarked characters in the searched text to match - * marked or unmarked versions of that character in the pattern. + * [UTS #10 Unicode Collation Algorithm](http://www.unicode.org/reports/tr10/#Asymmetric_Search), + * but also allows unmarked characters in the searched text to match + * marked or unmarked versions of that character in the pattern. * * @stable ICU 4.4 */ @@ -271,7 +271,7 @@ typedef enum { * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ USEARCH_ATTRIBUTE_VALUE_COUNT -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } USearchAttributeValue; /* open and close ------------------------------------------------------ */ @@ -479,7 +479,7 @@ U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength( * possible. If the buffer fits the matched text exactly, a null-termination * is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status. * Pre-flighting can be either done with length = 0 or the API -* <tt>usearch_getMatchedLength</tt>. +* <tt>usearch_getMatchedLength</tt>. * @param strsrch search iterator data struct * @param result UChar buffer to store the matched string * @param resultCapacity length of the result buffer @@ -766,7 +766,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); #ifndef U_HIDE_INTERNAL_API /** * Simple forward search for the pattern, starting at a specified index, - * and using a default set search options. + * and using a default set search options. * * This is an experimental function, and is not an official part of the * ICU API. @@ -783,7 +783,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); * are part of a combining sequence, as described below. * * A match will not include a partial combining sequence. Combining - * character sequences are considered to be inseparable units, + * character sequences are considered to be inseparable units, * and either match the pattern completely, or are considered to not match * at all. Thus, for example, an A followed a combining accent mark will * not be found when searching for a plain (unaccented) A. (unless @@ -792,7 +792,7 @@ U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); * When beginning a search, the initial starting position, startIdx, * is assumed to be an acceptable match boundary with respect to * combining characters. A combining sequence that spans across the - * starting point will not suppress a match beginning at startIdx. + * starting point will not suppress a match beginning at startIdx. * * Characters that expand to multiple collation elements * (German sharp-S becoming 'ss', or the composed forms of accented @@ -843,7 +843,7 @@ U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, * are part of a combining sequence, as described below. * * A match will not include a partial combining sequence. Combining - * character sequences are considered to be inseparable units, + * character sequences are considered to be inseparable units, * and either match the pattern completely, or are considered to not match * at all. Thus, for example, an A followed a combining accent mark will * not be found when searching for a plain (unaccented) A. (unless @@ -852,7 +852,7 @@ U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, * When beginning a search, the initial starting position, startIdx, * is assumed to be an acceptable match boundary with respect to * combining characters. A combining sequence that spans across the - * starting point will not suppress a match beginning at startIdx. + * starting point will not suppress a match beginning at startIdx. * * Characters that expand to multiple collation elements * (German sharp-S becoming 'ss', or the composed forms of accented diff --git a/contrib/libs/icu/include/unicode/uset.h b/contrib/libs/icu/include/unicode/uset.h index 18482c10e7..1b40980469 100644 --- a/contrib/libs/icu/include/unicode/uset.h +++ b/contrib/libs/icu/include/unicode/uset.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: uset.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -33,14 +33,14 @@ #include "unicode/uchar.h" #include "unicode/localpointer.h" -#ifndef USET_DEFINED - -#ifndef U_IN_DOXYGEN -#define USET_DEFINED -#endif +#ifndef USET_DEFINED + +#ifndef U_IN_DOXYGEN +#define USET_DEFINED +#endif /** - * USet is the C API type corresponding to C++ class UnicodeSet. - * Use the uset_* API to manipulate. Create with + * USet is the C API type corresponding to C++ class UnicodeSet. + * Use the uset_* API to manipulate. Create with * uset_open*, and destroy with uset_close. * @stable ICU 2.4 */ diff --git a/contrib/libs/icu/include/unicode/usetiter.h b/contrib/libs/icu/include/unicode/usetiter.h index c6396fd76c..61c6c43580 100644 --- a/contrib/libs/icu/include/unicode/usetiter.h +++ b/contrib/libs/icu/include/unicode/usetiter.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -10,9 +10,9 @@ #define USETITER_H #include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/uobject.h" #include "unicode/unistr.h" @@ -320,6 +320,6 @@ inline UChar32 UnicodeSetIterator::getCodepointEnd() const { U_NAMESPACE_END -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/ushape.h b/contrib/libs/icu/include/unicode/ushape.h index 78b4d027a8..05857bf255 100644 --- a/contrib/libs/icu/include/unicode/ushape.h +++ b/contrib/libs/icu/include/unicode/ushape.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** @@ -8,7 +8,7 @@ * ****************************************************************************** * file name: ushape.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -93,7 +93,7 @@ * which must not indicate a failure before the function call. * * @return The number of UChars written to the destination buffer. - * If an error occurred, then no output was written, or it may be + * If an error occurred, then no output was written, or it may be * incomplete. If <code>U_BUFFER_OVERFLOW_ERROR</code> is set, then * the return value indicates the necessary destination buffer size. * @stable ICU 2.0 diff --git a/contrib/libs/icu/include/unicode/uspoof.h b/contrib/libs/icu/include/unicode/uspoof.h index 63a13387b0..acc03f5378 100644 --- a/contrib/libs/icu/include/unicode/uspoof.h +++ b/contrib/libs/icu/include/unicode/uspoof.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* *************************************************************************** @@ -6,7 +6,7 @@ * and others. All Rights Reserved. *************************************************************************** * file name: uspoof.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -353,18 +353,18 @@ * @stable ICU 4.6 */ -U_CDECL_BEGIN - +U_CDECL_BEGIN + struct USpoofChecker; -/** - * @stable ICU 4.2 - */ +/** + * @stable ICU 4.2 + */ typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker */ struct USpoofCheckResult; /** * @see uspoof_openCheckResult - * @stable ICU 58 + * @stable ICU 58 */ typedef struct USpoofCheckResult USpoofCheckResult; @@ -413,7 +413,7 @@ typedef enum USpoofChecks { * * @see uspoof_areConfusable * @see uspoof_getSkeleton - * @stable ICU 58 + * @stable ICU 58 */ USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE, @@ -465,7 +465,7 @@ typedef enum USpoofChecks { */ USPOOF_CHAR_LIMIT = 64, - /** + /** * Check that an identifier does not mix numbers from different numbering systems. * For more information, see UTS 39 section 5.3. * @@ -473,27 +473,27 @@ typedef enum USpoofChecks { */ USPOOF_MIXED_NUMBERS = 128, - /** - * Check that an identifier does not have a combining character following a character in which that - * combining character would be hidden; for example 'i' followed by a U+0307 combining dot. - * - * More specifically, the following characters are forbidden from preceding a U+0307: - * <ul> - * <li>Those with the Soft_Dotted Unicode property (which includes 'i' and 'j')</li> - * <li>Latin lowercase letter 'l'</li> - * <li>Dotless 'i' and 'j' ('ı' and 'ȷ', U+0131 and U+0237)</li> - * <li>Any character whose confusable prototype ends with such a character - * (Soft_Dotted, 'l', 'ı', or 'ȷ')</li> - * </ul> - * In addition, combining characters are allowed between the above characters and U+0307 except those - * with combining class 0 or combining class "Above" (230, same class as U+0307). - * - * This list and the number of combing characters considered by this check may grow over time. - * - * @stable ICU 62 - */ - USPOOF_HIDDEN_OVERLAY = 256, - + /** + * Check that an identifier does not have a combining character following a character in which that + * combining character would be hidden; for example 'i' followed by a U+0307 combining dot. + * + * More specifically, the following characters are forbidden from preceding a U+0307: + * <ul> + * <li>Those with the Soft_Dotted Unicode property (which includes 'i' and 'j')</li> + * <li>Latin lowercase letter 'l'</li> + * <li>Dotless 'i' and 'j' ('ı' and 'ȷ', U+0131 and U+0237)</li> + * <li>Any character whose confusable prototype ends with such a character + * (Soft_Dotted, 'l', 'ı', or 'ȷ')</li> + * </ul> + * In addition, combining characters are allowed between the above characters and U+0307 except those + * with combining class 0 or combining class "Above" (230, same class as U+0307). + * + * This list and the number of combing characters considered by this check may grow over time. + * + * @stable ICU 62 + */ + USPOOF_HIDDEN_OVERLAY = 256, + /** * Enable all spoof checks. * @@ -986,9 +986,9 @@ uspoof_checkUTF8(const USpoofChecker *sc, * @see uspoof_openCheckResult * @see uspoof_check2UTF8 * @see uspoof_check2UnicodeString - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uspoof_check2(const USpoofChecker *sc, const UChar* id, int32_t length, USpoofCheckResult* checkResult, @@ -1023,9 +1023,9 @@ uspoof_check2(const USpoofChecker *sc, * @see uspoof_openCheckResult * @see uspoof_check2 * @see uspoof_check2UnicodeString - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uspoof_check2UTF8(const USpoofChecker *sc, const char *id, int32_t length, USpoofCheckResult* checkResult, @@ -1047,9 +1047,9 @@ uspoof_check2UTF8(const USpoofChecker *sc, * @see uspoof_check2 * @see uspoof_check2UTF8 * @see uspoof_check2UnicodeString - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE USpoofCheckResult* U_EXPORT2 +U_STABLE USpoofCheckResult* U_EXPORT2 uspoof_openCheckResult(UErrorCode *status); /** @@ -1057,9 +1057,9 @@ uspoof_openCheckResult(UErrorCode *status); * its implementation. * * @param checkResult The instance of USpoofCheckResult to close - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE void U_EXPORT2 +U_STABLE void U_EXPORT2 uspoof_closeCheckResult(USpoofCheckResult *checkResult); /** @@ -1074,9 +1074,9 @@ uspoof_closeCheckResult(USpoofCheckResult *checkResult); * will be zero if the input string passes all of the * enabled checks. * @see uspoof_setChecks - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status); /** @@ -1087,9 +1087,9 @@ uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *st * @param status The error code, set if an error occurred. * @return The restriction level contained in the USpoofCheckResult * @see uspoof_setRestrictionLevel - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE URestrictionLevel U_EXPORT2 +U_STABLE URestrictionLevel U_EXPORT2 uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status); /** @@ -1101,9 +1101,9 @@ uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErr * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} * @return The set of numerics contained in the USpoofCheckResult * @param status The error code, set if an error occurred. - * @stable ICU 58 + * @stable ICU 58 */ -U_STABLE const USet* U_EXPORT2 +U_STABLE const USet* U_EXPORT2 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status); @@ -1300,244 +1300,244 @@ uspoof_getInclusionSet(UErrorCode *status); U_STABLE const USet * U_EXPORT2 uspoof_getRecommendedSet(UErrorCode *status); -/** - * Serialize the data for a spoof detector into a chunk of memory. - * The flattened spoof detection tables can later be used to efficiently - * instantiate a new Spoof Detector. - * - * The serialized spoof checker includes only the data compiled from the - * Unicode data tables by uspoof_openFromSource(); it does not include - * include any other state or configuration that may have been set. - * - * @param sc the Spoof Detector whose data is to be serialized. - * @param data a pointer to 32-bit-aligned memory to be filled with the data, - * can be NULL if capacity==0 - * @param capacity the number of bytes available at data, - * or 0 for preflighting - * @param status an in/out ICU UErrorCode; possible errors include: - * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization - * - U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad - * @return the number of bytes written or needed for the spoof data - * - * @see utrie2_openFromSerialized() - * @stable ICU 4.2 - */ -U_STABLE int32_t U_EXPORT2 -uspoof_serialize(USpoofChecker *sc, - void *data, int32_t capacity, - UErrorCode *status); - -U_CDECL_END - +/** + * Serialize the data for a spoof detector into a chunk of memory. + * The flattened spoof detection tables can later be used to efficiently + * instantiate a new Spoof Detector. + * + * The serialized spoof checker includes only the data compiled from the + * Unicode data tables by uspoof_openFromSource(); it does not include + * include any other state or configuration that may have been set. + * + * @param sc the Spoof Detector whose data is to be serialized. + * @param data a pointer to 32-bit-aligned memory to be filled with the data, + * can be NULL if capacity==0 + * @param capacity the number of bytes available at data, + * or 0 for preflighting + * @param status an in/out ICU UErrorCode; possible errors include: + * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization + * - U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad + * @return the number of bytes written or needed for the spoof data + * + * @see utrie2_openFromSerialized() + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_serialize(USpoofChecker *sc, + void *data, int32_t capacity, + UErrorCode *status); + +U_CDECL_END + #if U_SHOW_CPLUSPLUS_API -U_NAMESPACE_BEGIN - -/** - * \class LocalUSpoofCheckerPointer - * "Smart pointer" class, closes a USpoofChecker via uspoof_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 4.4 - */ -/** - * \cond - * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER. - * For now, suppress with a Doxygen cond - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close); -/** \endcond */ - -/** - * \class LocalUSpoofCheckResultPointer - * "Smart pointer" class, closes a USpoofCheckResult via `uspoof_closeCheckResult()`. - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 58 - */ - -/** - * \cond - * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER. - * For now, suppress with a Doxygen cond - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult); -/** \endcond */ - -U_NAMESPACE_END - -/** - * Limit the acceptable characters to those specified by a Unicode Set. - * Any previously specified character limit is - * is replaced by the new settings. This includes limits on - * characters that were set with the uspoof_setAllowedLocales() function. - * - * The USPOOF_CHAR_LIMIT test is automatically enabled for this - * USoofChecker by this function. - * - * @param sc The USpoofChecker - * @param chars A Unicode Set containing the list of - * characters that are permitted. Ownership of the set - * remains with the caller. The incoming set is cloned by - * this function, so there are no restrictions on modifying - * or deleting the UnicodeSet after calling this function. - * @param status The error code, set if this function encounters a problem. - * @stable ICU 4.2 - */ -U_STABLE void U_EXPORT2 -uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status); - - -/** - * Get a UnicodeSet for the characters permitted in an identifier. - * This corresponds to the limits imposed by the Set Allowed Characters / - * UnicodeSet functions. Limitations imposed by other checks will not be - * reflected in the set returned by this function. - * - * The returned set will be frozen, meaning that it cannot be modified - * by the caller. - * - * Ownership of the returned set remains with the Spoof Detector. The - * returned set will become invalid if the spoof detector is closed, - * or if a new set of allowed characters is specified. - * - * - * @param sc The USpoofChecker - * @param status The error code, set if this function encounters a problem. - * @return A UnicodeSet containing the characters that are permitted by - * the USPOOF_CHAR_LIMIT test. - * @stable ICU 4.2 - */ -U_STABLE const icu::UnicodeSet * U_EXPORT2 -uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); - -/** - * Check the specified string for possible security issues. - * The text to be checked will typically be an identifier of some sort. - * The set of checks to be performed is specified with uspoof_setChecks(). - * - * \note - * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead. - * The newer API exposes additional information from the check procedure - * and is otherwise identical to this method. - * - * @param sc The USpoofChecker - * @param id A identifier to be checked for possible security issues. - * @param position Deprecated in ICU 51. Always returns zero. - * Originally, an out parameter for the index of the first - * string position that failed a check. - * This parameter may be NULL. - * @param status The error code, set if an error occurred while attempting to - * perform the check. - * Spoofing or security issues detected with the input string are - * not reported here, but through the function's return value. - * @return An integer value with bits set for any potential security - * or spoofing issues detected. The bits are defined by - * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) - * will be zero if the input string passes all of the - * enabled checks. - * @see uspoof_check2UnicodeString - * @stable ICU 4.2 - */ -U_STABLE int32_t U_EXPORT2 -uspoof_checkUnicodeString(const USpoofChecker *sc, - const icu::UnicodeString &id, - int32_t *position, - UErrorCode *status); - -/** - * Check the specified string for possible security issues. - * The text to be checked will typically be an identifier of some sort. - * The set of checks to be performed is specified with uspoof_setChecks(). - * - * @param sc The USpoofChecker - * @param id A identifier to be checked for possible security issues. - * @param checkResult An instance of USpoofCheckResult to be filled with - * details about the identifier. Can be NULL. - * @param status The error code, set if an error occurred while attempting to - * perform the check. - * Spoofing or security issues detected with the input string are - * not reported here, but through the function's return value. - * @return An integer value with bits set for any potential security - * or spoofing issues detected. The bits are defined by - * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) - * will be zero if the input string passes all of the - * enabled checks. Any information in this bitmask will be - * consistent with the information saved in the optional - * checkResult parameter. - * @see uspoof_openCheckResult - * @see uspoof_check2 - * @see uspoof_check2UTF8 - * @stable ICU 58 - */ -U_STABLE int32_t U_EXPORT2 -uspoof_check2UnicodeString(const USpoofChecker *sc, - const icu::UnicodeString &id, - USpoofCheckResult* checkResult, - UErrorCode *status); - -/** - * A version of {@link uspoof_areConfusable} accepting UnicodeStrings. - * - * @param sc The USpoofChecker - * @param s1 The first of the two identifiers to be compared for - * confusability. The strings are in UTF-8 format. - * @param s2 The second of the two identifiers to be compared for - * confusability. The strings are in UTF-8 format. - * @param status The error code, set if an error occurred while attempting to - * perform the check. - * Confusability of the identifiers is not reported here, - * but through this function's return value. - * @return An integer value with bit(s) set corresponding to - * the type of confusability found, as defined by - * enum USpoofChecks. Zero is returned if the identifiers - * are not confusable. - * - * @stable ICU 4.2 - * - * @see uspoof_areConfusable - */ -U_STABLE int32_t U_EXPORT2 -uspoof_areConfusableUnicodeString(const USpoofChecker *sc, - const icu::UnicodeString &s1, - const icu::UnicodeString &s2, - UErrorCode *status); - -/** - * Get the "skeleton" for an identifier. - * Skeletons are a transformation of the input identifier; - * Two identifiers are confusable if their skeletons are identical. - * See Unicode UAX #39 for additional information. - * - * Using skeletons directly makes it possible to quickly check - * whether an identifier is confusable with any of some large - * set of existing identifiers, by creating an efficiently - * searchable collection of the skeletons. - * - * @param sc The USpoofChecker. - * @param type Deprecated in ICU 58. You may pass any number. - * Originally, controlled which of the Unicode confusable data - * tables to use. - * @param id The input identifier whose skeleton will be computed. - * @param dest The output identifier, to receive the skeleton string. - * @param status The error code, set if an error occurred while attempting to - * perform the check. - * @return A reference to the destination (skeleton) string. - * - * @stable ICU 4.2 - */ -U_I18N_API icu::UnicodeString & U_EXPORT2 -uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, - uint32_t type, - const icu::UnicodeString &id, - icu::UnicodeString &dest, - UErrorCode *status); - +U_NAMESPACE_BEGIN + /** + * \class LocalUSpoofCheckerPointer + * "Smart pointer" class, closes a USpoofChecker via uspoof_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +/** + * \cond + * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER. + * For now, suppress with a Doxygen cond + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close); +/** \endcond */ + +/** + * \class LocalUSpoofCheckResultPointer + * "Smart pointer" class, closes a USpoofCheckResult via `uspoof_closeCheckResult()`. + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 58 + */ + +/** + * \cond + * Note: Doxygen is giving a bogus warning on this U_DEFINE_LOCAL_OPEN_POINTER. + * For now, suppress with a Doxygen cond + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult); +/** \endcond */ + +U_NAMESPACE_END + +/** + * Limit the acceptable characters to those specified by a Unicode Set. + * Any previously specified character limit is + * is replaced by the new settings. This includes limits on + * characters that were set with the uspoof_setAllowedLocales() function. + * + * The USPOOF_CHAR_LIMIT test is automatically enabled for this + * USoofChecker by this function. + * + * @param sc The USpoofChecker + * @param chars A Unicode Set containing the list of + * characters that are permitted. Ownership of the set + * remains with the caller. The incoming set is cloned by + * this function, so there are no restrictions on modifying + * or deleting the UnicodeSet after calling this function. + * @param status The error code, set if this function encounters a problem. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status); + + +/** + * Get a UnicodeSet for the characters permitted in an identifier. + * This corresponds to the limits imposed by the Set Allowed Characters / + * UnicodeSet functions. Limitations imposed by other checks will not be + * reflected in the set returned by this function. + * + * The returned set will be frozen, meaning that it cannot be modified + * by the caller. + * + * Ownership of the returned set remains with the Spoof Detector. The + * returned set will become invalid if the spoof detector is closed, + * or if a new set of allowed characters is specified. + * + * + * @param sc The USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return A UnicodeSet containing the characters that are permitted by + * the USPOOF_CHAR_LIMIT test. + * @stable ICU 4.2 + */ +U_STABLE const icu::UnicodeSet * U_EXPORT2 +uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * \note + * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead. + * The newer API exposes additional information from the check procedure + * and is otherwise identical to this method. + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues. + * @param position Deprecated in ICU 51. Always returns zero. + * Originally, an out parameter for the index of the first + * string position that failed a check. + * This parameter may be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. + * @see uspoof_check2UnicodeString + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_checkUnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &id, + int32_t *position, + UErrorCode *status); + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues. + * @param checkResult An instance of USpoofCheckResult to be filled with + * details about the identifier. Can be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. Any information in this bitmask will be + * consistent with the information saved in the optional + * checkResult parameter. + * @see uspoof_openCheckResult + * @see uspoof_check2 + * @see uspoof_check2UTF8 + * @stable ICU 58 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_check2UnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &id, + USpoofCheckResult* checkResult, + UErrorCode *status); + +/** + * A version of {@link uspoof_areConfusable} accepting UnicodeStrings. + * + * @param sc The USpoofChecker + * @param s1 The first of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param s2 The second of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Confusability of the identifiers is not reported here, + * but through this function's return value. + * @return An integer value with bit(s) set corresponding to + * the type of confusability found, as defined by + * enum USpoofChecks. Zero is returned if the identifiers + * are not confusable. + * + * @stable ICU 4.2 + * + * @see uspoof_areConfusable + */ +U_STABLE int32_t U_EXPORT2 +uspoof_areConfusableUnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &s1, + const icu::UnicodeString &s2, + UErrorCode *status); + +/** + * Get the "skeleton" for an identifier. + * Skeletons are a transformation of the input identifier; + * Two identifiers are confusable if their skeletons are identical. + * See Unicode UAX #39 for additional information. + * + * Using skeletons directly makes it possible to quickly check + * whether an identifier is confusable with any of some large + * set of existing identifiers, by creating an efficiently + * searchable collection of the skeletons. + * + * @param sc The USpoofChecker. + * @param type Deprecated in ICU 58. You may pass any number. + * Originally, controlled which of the Unicode confusable data + * tables to use. + * @param id The input identifier whose skeleton will be computed. + * @param dest The output identifier, to receive the skeleton string. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * @return A reference to the destination (skeleton) string. + * + * @stable ICU 4.2 + */ +U_I18N_API icu::UnicodeString & U_EXPORT2 +uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, + uint32_t type, + const icu::UnicodeString &id, + icu::UnicodeString &dest, + UErrorCode *status); + +/** * Get the set of Candidate Characters for Inclusion in Identifiers, as defined * in http://unicode.org/Public/security/latest/xidmodifications.txt * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. @@ -1569,6 +1569,6 @@ uspoof_getRecommendedUnicodeSet(UErrorCode *status); #endif /* U_SHOW_CPLUSPLUS_API */ -#endif /* UCONFIG_NO_NORMALIZATION */ +#endif /* UCONFIG_NO_NORMALIZATION */ #endif /* USPOOF_H */ diff --git a/contrib/libs/icu/include/unicode/usprep.h b/contrib/libs/icu/include/unicode/usprep.h index 914eb84871..e3f132e5f9 100644 --- a/contrib/libs/icu/include/unicode/usprep.h +++ b/contrib/libs/icu/include/unicode/usprep.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: usprep.h - * encoding: UTF-8 + * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -33,14 +33,14 @@ * StringPrep prepares Unicode strings for use in network protocols. * Profiles of StingPrep are set of rules and data according to with the * Unicode Strings are prepared. Each profiles contains tables which describe - * how a code point should be treated. The tables are broadly classified into + * how a code point should be treated. The tables are broadly classified into * <ul> - * <li> Unassigned Table: Contains code points that are unassigned + * <li> Unassigned Table: Contains code points that are unassigned * in the Unicode Version supported by StringPrep. Currently * RFC 3454 supports Unicode 3.2. </li> - * <li> Prohibited Table: Contains code points that are prohibited from + * <li> Prohibited Table: Contains code points that are prohibited from * the output of the StringPrep processing function. </li> - * <li> Mapping Table: Contains code points that are deleted from the output or case mapped. </li> + * <li> Mapping Table: Contains code points that are deleted from the output or case mapped. </li> * </ul> * * The procedure for preparing Unicode strings: @@ -230,7 +230,7 @@ U_NAMESPACE_END /** * Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), - * checks for prohibited and BiDi characters in the order defined by RFC 3454 + * checks for prohibited and BiDi characters in the order defined by RFC 3454 * depending on the options specified in the profile. * * @param prep The profile to use diff --git a/contrib/libs/icu/include/unicode/ustdio.h b/contrib/libs/icu/include/unicode/ustdio.h index 342c2b4604..d3837bca24 100644 --- a/contrib/libs/icu/include/unicode/ustdio.h +++ b/contrib/libs/icu/include/unicode/ustdio.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** diff --git a/contrib/libs/icu/include/unicode/ustream.h b/contrib/libs/icu/include/unicode/ustream.h index 927342cb03..3cf3b901e7 100644 --- a/contrib/libs/icu/include/unicode/ustream.h +++ b/contrib/libs/icu/include/unicode/ustream.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -17,10 +17,10 @@ #ifndef USTREAM_H #define USTREAM_H -#include "unicode/utypes.h" - -#if U_SHOW_CPLUSPLUS_API - +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + #include "unicode/unistr.h" #if !UCONFIG_NO_CONVERSION // not available without conversion @@ -34,7 +34,7 @@ * C++ I/O stream API. */ -#if defined(__GLIBCXX__) +#if defined(__GLIBCXX__) namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364 #endif @@ -64,6 +64,6 @@ U_NAMESPACE_END /* No operator for UChar because it can conflict with wchar_t */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif diff --git a/contrib/libs/icu/include/unicode/ustring.h b/contrib/libs/icu/include/unicode/ustring.h index 245b766545..38429f0970 100644 --- a/contrib/libs/icu/include/unicode/ustring.h +++ b/contrib/libs/icu/include/unicode/ustring.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -403,7 +403,7 @@ u_strspn(const UChar *string, const UChar *matchSet); * @param saveState The current pointer within the original string, * which is set by this function. The saveState * parameter should the address of a local variable of type - * UChar *. (i.e. defined "UChar *myLocalSaveState" and use + * UChar *. (i.e. defined "UChar *myLocalSaveState" and use * &myLocalSaveState for this parameter). * @return A pointer to the next token found in src, or NULL * when there are no more tokens. @@ -884,7 +884,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * Unicode String literals in C. * We need one macro to declare a variable for the string * and to statically preinitialize it if possible, - * and a second macro to dynamically initialize such a string variable if necessary. + * and a second macro to dynamically initialize such a string variable if necessary. * * The macros are defined for maximum performance. * They work only for strings that contain "invariant characters", i.e., @@ -895,32 +895,32 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count); * parameters. * The string parameter must be a C string literal. * The length of the string, not including the terminating - * `NUL`, must be specified as a constant. + * `NUL`, must be specified as a constant. * The U_STRING_DECL macro should be invoked exactly once for one * such string variable before it is used. * * Usage: - * - * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); - * U_STRING_DECL(ustringVar2, "jumps 5%", 8); - * static UBool didInit=FALSE; - * - * int32_t function() { - * if(!didInit) { - * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); - * U_STRING_INIT(ustringVar2, "jumps 5%", 8); - * didInit=TRUE; - * } - * return u_strcmp(ustringVar1, ustringVar2); - * } * - * Note that the macros will NOT consistently work if their argument is another #`define`. - * The following will not work on all platforms, don't use it. + * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_DECL(ustringVar2, "jumps 5%", 8); + * static UBool didInit=FALSE; + * + * int32_t function() { + * if(!didInit) { + * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_INIT(ustringVar2, "jumps 5%", 8); + * didInit=TRUE; + * } + * return u_strcmp(ustringVar1, ustringVar2); + * } + * + * Note that the macros will NOT consistently work if their argument is another #`define`. + * The following will not work on all platforms, don't use it. * * #define GLUCK "Mr. Gluck" * U_STRING_DECL(var, GLUCK, 9) * U_STRING_INIT(var, GLUCK, 9) - * + * * Instead, use the string literal "Mr. Gluck" as the argument to both macro * calls. * diff --git a/contrib/libs/icu/include/unicode/ustringtrie.h b/contrib/libs/icu/include/unicode/ustringtrie.h index fd85648225..b45426a5b8 100644 --- a/contrib/libs/icu/include/unicode/ustringtrie.h +++ b/contrib/libs/icu/include/unicode/ustringtrie.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -6,7 +6,7 @@ * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: udicttrie.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/utext.h b/contrib/libs/icu/include/unicode/utext.h index 37d71a3172..14c3245a92 100644 --- a/contrib/libs/icu/include/unicode/utext.h +++ b/contrib/libs/icu/include/unicode/utext.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utext.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -370,7 +370,7 @@ utext_equals(const UText *a, const UText *b); /***************************************************************************** * - * Functions to work with the text represented by a UText wrapper + * Functions to work with the text represented by a UText wrapper * *****************************************************************************/ @@ -414,7 +414,7 @@ utext_isLengthExpensive(const UText *ut); * * The iteration position will be set to the start of the returned code point. * - * This function is roughly equivalent to the sequence + * This function is roughly equivalent to the sequence * utext_setNativeIndex(index); * utext_current32(); * (There is a subtle difference if the index is out of bounds by being less than zero - @@ -573,7 +573,7 @@ U_STABLE void U_EXPORT2 utext_setNativeIndex(UText *ut, int64_t nativeIndex); /** - * Move the iterator position by delta code points. The number of code points + * Move the iterator position by delta code points. The number of code points * is a signed number; a negative delta will move the iterator backwards, * towards the start of the text. * <p> @@ -592,7 +592,7 @@ U_STABLE UBool U_EXPORT2 utext_moveIndex32(UText *ut, int32_t delta); /** - * Get the native index of the character preceding the current position. + * Get the native index of the character preceding the current position. * If the iteration position is already at the start of the text, zero * is returned. * The value returned is the same as that obtained from the following sequence, @@ -609,7 +609,7 @@ utext_moveIndex32(UText *ut, int32_t delta); * native index of the character most recently returned from utext_next(). * * @param ut the text to be accessed - * @return the native index of the character preceding the current index position, + * @return the native index of the character preceding the current index position, * or zero if the current position is at the start of the text. * @stable ICU 3.6 */ @@ -636,10 +636,10 @@ utext_getPreviousNativeIndex(UText *ut); * @param ut the UText from which to extract data. * @param nativeStart the native index of the first character to extract.\ * If the specified index is out of range, - * it will be pinned to be within 0 <= index <= textLength + * it will be pinned to be within 0 <= index <= textLength * @param nativeLimit the native string index of the position following the last * character to extract. If the specified index is out of range, - * it will be pinned to be within 0 <= index <= textLength. + * it will be pinned to be within 0 <= index <= textLength. * nativeLimit must be >= nativeStart. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed * @param destCapacity The size, in UChars, of the destination buffer. May be zero @@ -747,14 +747,14 @@ utext_extract(UText *ut, * * @stable ICU 3.8 */ -#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \ - int64_t __offset = (ix) - (ut)->chunkNativeStart; \ - if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ - (ut)->chunkOffset=(int32_t)__offset; \ - } else { \ - utext_setNativeIndex((ut), (ix)); \ - } \ -} UPRV_BLOCK_MACRO_END +#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \ + int64_t __offset = (ix) - (ut)->chunkNativeStart; \ + if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ + (ut)->chunkOffset=(int32_t)__offset; \ + } else { \ + utext_setNativeIndex((ut), (ix)); \ + } \ +} UPRV_BLOCK_MACRO_END @@ -889,7 +889,7 @@ utext_copy(UText *ut, * Caution: freezing a UText will disable changes made via the specific * frozen UText wrapper only; it will not have any effect on the ability to * directly modify the text by bypassing the UText. Any such backdoor modifications - * are always an error while UText access is occurring because the underlying + * are always an error while UText access is occurring because the underlying * text can get out of sync with UText's buffering. * </p> * @@ -1037,7 +1037,7 @@ UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); * be NUL-terminated if there is sufficient space in the destination buffer. * * @param ut the UText from which to extract data. - * @param nativeStart the native index of the first character to extract. + * @param nativeStart the native index of the first character to extract. * @param nativeLimit the native string index of the position following the last * character to extract. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed @@ -1194,7 +1194,7 @@ UTextClose(UText *ut); struct UTextFuncs { /** * (public) Function table size, sizeof(UTextFuncs) - * Intended for use should the table grow to accommodate added + * Intended for use should the table grow to accommodate added * functions in the future, to allow tests for older format * function tables that do not contain the extensions. * @@ -1328,7 +1328,7 @@ typedef struct UTextFuncs UTextFuncs; struct UText { /** * (private) Magic. Used to help detect when UText functions are handed - * invalid or uninitialized UText structs. + * invalid or uninitialized UText structs. * utext_openXYZ() functions take an initialized, * but not necessarily open, UText struct as an * optional fill-in parameter. This magic field @@ -1350,7 +1350,7 @@ struct UText { /** - * Text provider properties. This set of flags is maintained by the + * Text provider properties. This set of flags is maintained by the * text provider implementation. * @stable ICU 3.4 */ @@ -1435,7 +1435,7 @@ struct UText { void *pExtra; /** - * (protected) Pointer to string or text-containing object or similar. + * (protected) Pointer to string or text-containing object or similar. * This is the source of the text that this UText is wrapping, in a format * that is known to the text provider functions. * @stable ICU 3.4 @@ -1538,7 +1538,7 @@ struct UText { U_STABLE UText * U_EXPORT2 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); -// do not use #ifndef U_HIDE_INTERNAL_API around the following! +// do not use #ifndef U_HIDE_INTERNAL_API around the following! /** * @internal * Value used to help identify correctly initialized UText structs. @@ -1580,24 +1580,24 @@ enum { U_CDECL_END -#if U_SHOW_CPLUSPLUS_API - -U_NAMESPACE_BEGIN - -/** - * \class LocalUTextPointer - * "Smart pointer" class, closes a UText via utext_close(). - * For most methods see the LocalPointerBase base class. - * - * @see LocalPointerBase - * @see LocalPointer - * @stable ICU 4.4 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); - -U_NAMESPACE_END - -#endif - +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN + +/** + * \class LocalUTextPointer + * "Smart pointer" class, closes a UText via utext_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); + +U_NAMESPACE_END + #endif + + +#endif diff --git a/contrib/libs/icu/include/unicode/utf.h b/contrib/libs/icu/include/unicode/utf.h index ef512997f0..1ed2172bd8 100644 --- a/contrib/libs/icu/include/unicode/utf.h +++ b/contrib/libs/icu/include/unicode/utf.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utf.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -47,11 +47,11 @@ * but are optimized for the much more frequently occurring BMP code points. * * umachine.h defines UChar to be an unsigned 16-bit integer. - * Since ICU 59, ICU uses char16_t in C++, UChar only in C, - * and defines UChar=char16_t by default. See the UChar API docs for details. + * Since ICU 59, ICU uses char16_t in C++, UChar only in C, + * and defines UChar=char16_t by default. See the UChar API docs for details. * * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit - * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). + * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as * the definition of UChar. For details see the documentation for UChar32 itself. * @@ -60,20 +60,20 @@ * For actual Unicode character properties see uchar.h. * * By default, string operations must be done with error checking in case - * a string is not well-formed UTF-16 or UTF-8. - * - * The U16_ macros detect if a surrogate code unit is unpaired + * a string is not well-formed UTF-16 or UTF-8. + * + * The U16_ macros detect if a surrogate code unit is unpaired * (lead unit without trail unit or vice versa) and just return the unit itself * as the code point. * - * The U8_ macros detect illegal byte sequences and return a negative value. - * Starting with ICU 60, the observable length of a single illegal byte sequence - * skipped by one of these macros follows the Unicode 6+ recommendation - * which is consistent with the W3C Encoding Standard. - * - * There are ..._OR_FFFD versions of both U16_ and U8_ macros - * that return U+FFFD for illegal code unit sequences. - * + * The U8_ macros detect illegal byte sequences and return a negative value. + * Starting with ICU 60, the observable length of a single illegal byte sequence + * skipped by one of these macros follows the Unicode 6+ recommendation + * which is consistent with the W3C Encoding Standard. + * + * There are ..._OR_FFFD versions of both U16_ and U8_ macros + * that return U+FFFD for illegal code unit sequences. + * * The regular "safe" macros require that the initial, passed-in string index * is within bounds. They only check the index when they read more than one * code unit. This is usually done with code similar to the following loop: @@ -97,7 +97,7 @@ * The performance differences are much larger here because UTF-8 provides so * many opportunities for malformed sequences. * The unsafe UTF-8 macros are entirely implemented inside the macro definitions - * and are fast, while the safe UTF-8 macros call functions for some complicated cases. + * and are fast, while the safe UTF-8 macros call functions for some complicated cases. * * Unlike with UTF-16, malformed sequences cannot be expressed with distinct * code point values (0..U+10ffff). They are indicated with negative values instead. @@ -129,7 +129,7 @@ */ #define U_IS_UNICODE_NONCHAR(c) \ ((c)>=0xfdd0 && \ - ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff) + ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff) /** * Is c a Unicode code point value (0..U+10ffff) @@ -150,7 +150,7 @@ */ #define U_IS_UNICODE_CHAR(c) \ ((uint32_t)(c)<0xd800 || \ - (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c))) + (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c))) /** * Is this code point a BMP code point (U+0000..U+ffff)? diff --git a/contrib/libs/icu/include/unicode/utf16.h b/contrib/libs/icu/include/unicode/utf16.h index 9fd7d5c8a7..8581b166ba 100644 --- a/contrib/libs/icu/include/unicode/utf16.h +++ b/contrib/libs/icu/include/unicode/utf16.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utf16.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -163,7 +163,7 @@ * @see U16_GET * @stable ICU 2.4 */ -#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ if(U16_IS_SURROGATE(c)) { \ if(U16_IS_SURROGATE_LEAD(c)) { \ @@ -172,7 +172,7 @@ (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Get a code point from a string at a random-access offset, @@ -185,8 +185,8 @@ * * The length can be negative for a NUL-terminated string. * - * If the offset points to a single, unpaired surrogate, then - * c is set to that unpaired surrogate. + * If the offset points to a single, unpaired surrogate, then + * c is set to that unpaired surrogate. * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. * * @param s const UChar * string @@ -197,7 +197,7 @@ * @see U16_GET_UNSAFE * @stable ICU 2.4 */ -#define U16_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ if(U16_IS_SURROGATE(c)) { \ uint16_t __c2; \ @@ -211,51 +211,51 @@ } \ } \ } \ -} UPRV_BLOCK_MACRO_END - -/** - * Get a code point from a string at a random-access offset, - * without changing the offset. - * "Safe" macro, handles unpaired surrogates and checks for string boundaries. - * - * The offset may point to either the lead or trail surrogate unit - * for a supplementary code point, in which case the macro will read - * the adjacent matching surrogate as well. - * - * The length can be negative for a NUL-terminated string. - * - * If the offset points to a single, unpaired surrogate, then - * c is set to U+FFFD. - * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD. - * - * @param s const UChar * string - * @param start starting string offset (usually 0) - * @param i string offset, must be start<=i<length - * @param length string length - * @param c output UChar32 variable - * @see U16_GET_UNSAFE - * @stable ICU 60 - */ -#define U16_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ - (c)=(s)[i]; \ - if(U16_IS_SURROGATE(c)) { \ - uint16_t __c2; \ - if(U16_IS_SURROGATE_LEAD(c)) { \ - if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \ - (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ - } else { \ - (c)=0xfffd; \ - } \ - } else { \ - if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ - (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ - } else { \ - (c)=0xfffd; \ - } \ - } \ - } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END +/** + * Get a code point from a string at a random-access offset, + * without changing the offset. + * "Safe" macro, handles unpaired surrogates and checks for string boundaries. + * + * The offset may point to either the lead or trail surrogate unit + * for a supplementary code point, in which case the macro will read + * the adjacent matching surrogate as well. + * + * The length can be negative for a NUL-terminated string. + * + * If the offset points to a single, unpaired surrogate, then + * c is set to U+FFFD. + * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD. + * + * @param s const UChar * string + * @param start starting string offset (usually 0) + * @param i string offset, must be start<=i<length + * @param length string length + * @param c output UChar32 variable + * @see U16_GET_UNSAFE + * @stable ICU 60 + */ +#define U16_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[i]; \ + if(U16_IS_SURROGATE(c)) { \ + uint16_t __c2; \ + if(U16_IS_SURROGATE_LEAD(c)) { \ + if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \ + (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ + } else { \ + (c)=0xfffd; \ + } \ + } else { \ + if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ + (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ + } else { \ + (c)=0xfffd; \ + } \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + /* definitions with forward iteration --------------------------------------- */ /** @@ -277,12 +277,12 @@ * @see U16_NEXT * @stable ICU 2.4 */ -#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if(U16_IS_LEAD(c)) { \ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Get a code point from a string at a code point boundary offset, @@ -296,7 +296,7 @@ * for a supplementary code point, in which case the macro will read * the following trail surrogate as well. * If the offset points to a trail surrogate or - * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate. + * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate. * * @param s const UChar * string * @param i string offset, must be i<length @@ -305,7 +305,7 @@ * @see U16_NEXT_UNSAFE * @stable ICU 2.4 */ -#define U16_NEXT(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_NEXT(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if(U16_IS_LEAD(c)) { \ uint16_t __c2; \ @@ -314,43 +314,43 @@ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ } \ } \ -} UPRV_BLOCK_MACRO_END - -/** - * Get a code point from a string at a code point boundary offset, - * and advance the offset to the next code point boundary. - * (Post-incrementing forward iteration.) - * "Safe" macro, handles unpaired surrogates and checks for string boundaries. - * - * The length can be negative for a NUL-terminated string. - * - * The offset may point to the lead surrogate unit - * for a supplementary code point, in which case the macro will read - * the following trail surrogate as well. - * If the offset points to a trail surrogate or - * to a single, unpaired lead surrogate, then c is set to U+FFFD. - * - * @param s const UChar * string - * @param i string offset, must be i<length - * @param length string length - * @param c output UChar32 variable - * @see U16_NEXT_UNSAFE - * @stable ICU 60 - */ -#define U16_NEXT_OR_FFFD(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ - (c)=(s)[(i)++]; \ - if(U16_IS_SURROGATE(c)) { \ - uint16_t __c2; \ - if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ - ++(i); \ - (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ - } else { \ - (c)=0xfffd; \ - } \ - } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** + * Get a code point from a string at a code point boundary offset, + * and advance the offset to the next code point boundary. + * (Post-incrementing forward iteration.) + * "Safe" macro, handles unpaired surrogates and checks for string boundaries. + * + * The length can be negative for a NUL-terminated string. + * + * The offset may point to the lead surrogate unit + * for a supplementary code point, in which case the macro will read + * the following trail surrogate as well. + * If the offset points to a trail surrogate or + * to a single, unpaired lead surrogate, then c is set to U+FFFD. + * + * @param s const UChar * string + * @param i string offset, must be i<length + * @param length string length + * @param c output UChar32 variable + * @see U16_NEXT_UNSAFE + * @stable ICU 60 + */ +#define U16_NEXT_OR_FFFD(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[(i)++]; \ + if(U16_IS_SURROGATE(c)) { \ + uint16_t __c2; \ + if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ + ++(i); \ + (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ + } else { \ + (c)=0xfffd; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** * Append a code point to a string, overwriting 1 or 2 code units. * The offset points to the current end of the string contents * and is advanced (post-increment). @@ -363,14 +363,14 @@ * @see U16_APPEND * @stable ICU 2.4 */ -#define U16_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Append a code point to a string, overwriting 1 or 2 code units. @@ -389,7 +389,7 @@ * @see U16_APPEND_UNSAFE * @stable ICU 2.4 */ -#define U16_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \ @@ -398,7 +398,7 @@ } else /* c>0x10ffff or not enough space */ { \ (isError)=TRUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the next. @@ -410,11 +410,11 @@ * @see U16_FWD_1 * @stable ICU 2.4 */ -#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_LEAD((s)[(i)++])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the next. @@ -429,11 +429,11 @@ * @see U16_FWD_1_UNSAFE * @stable ICU 2.4 */ -#define U16_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_LEAD((s)[(i)++]) && (i)!=(length) && U16_IS_TRAIL((s)[i])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the n-th next one, @@ -447,13 +447,13 @@ * @see U16_FWD_N * @stable ICU 2.4 */ -#define U16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ U16_FWD_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the n-th next one, @@ -470,13 +470,13 @@ * @see U16_FWD_N_UNSAFE * @stable ICU 2.4 */ -#define U16_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \ U16_FWD_1(s, i, length); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary @@ -491,11 +491,11 @@ * @see U16_SET_CP_START * @stable ICU 2.4 */ -#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_TRAIL((s)[i])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary @@ -511,11 +511,11 @@ * @see U16_SET_CP_START_UNSAFE * @stable ICU 2.4 */ -#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /* definitions with backward iteration -------------------------------------- */ @@ -539,12 +539,12 @@ * @see U16_PREV * @stable ICU 2.4 */ -#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(U16_IS_TRAIL(c)) { \ (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one @@ -557,7 +557,7 @@ * for a supplementary code point, then the macro will read * the preceding lead surrogate as well. * If the offset is behind a lead surrogate or behind a single, unpaired - * trail surrogate, then c is set to that unpaired surrogate. + * trail surrogate, then c is set to that unpaired surrogate. * * @param s const UChar * string * @param start starting string offset (usually 0) @@ -566,7 +566,7 @@ * @see U16_PREV_UNSAFE * @stable ICU 2.4 */ -#define U16_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(U16_IS_TRAIL(c)) { \ uint16_t __c2; \ @@ -575,42 +575,42 @@ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ } \ } \ -} UPRV_BLOCK_MACRO_END - -/** - * Move the string offset from one code point boundary to the previous one - * and get the code point between them. - * (Pre-decrementing backward iteration.) - * "Safe" macro, handles unpaired surrogates and checks for string boundaries. - * - * The input offset may be the same as the string length. - * If the offset is behind a trail surrogate unit - * for a supplementary code point, then the macro will read - * the preceding lead surrogate as well. - * If the offset is behind a lead surrogate or behind a single, unpaired - * trail surrogate, then c is set to U+FFFD. - * - * @param s const UChar * string - * @param start starting string offset (usually 0) - * @param i string offset, must be start<i - * @param c output UChar32 variable - * @see U16_PREV_UNSAFE - * @stable ICU 60 - */ -#define U16_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ - (c)=(s)[--(i)]; \ - if(U16_IS_SURROGATE(c)) { \ - uint16_t __c2; \ - if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ - --(i); \ - (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ - } else { \ - (c)=0xfffd; \ - } \ - } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** + * Move the string offset from one code point boundary to the previous one + * and get the code point between them. + * (Pre-decrementing backward iteration.) + * "Safe" macro, handles unpaired surrogates and checks for string boundaries. + * + * The input offset may be the same as the string length. + * If the offset is behind a trail surrogate unit + * for a supplementary code point, then the macro will read + * the preceding lead surrogate as well. + * If the offset is behind a lead surrogate or behind a single, unpaired + * trail surrogate, then c is set to U+FFFD. + * + * @param s const UChar * string + * @param start starting string offset (usually 0) + * @param i string offset, must be start<i + * @param c output UChar32 variable + * @see U16_PREV_UNSAFE + * @stable ICU 60 + */ +#define U16_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + (c)=(s)[--(i)]; \ + if(U16_IS_SURROGATE(c)) { \ + uint16_t __c2; \ + if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ + --(i); \ + (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ + } else { \ + (c)=0xfffd; \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + +/** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. @@ -621,11 +621,11 @@ * @see U16_BACK_1 * @stable ICU 2.4 */ -#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_TRAIL((s)[--(i)])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one. @@ -639,11 +639,11 @@ * @see U16_BACK_1_UNSAFE * @stable ICU 2.4 */ -#define U16_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the n-th one before it, @@ -658,13 +658,13 @@ * @see U16_BACK_N * @stable ICU 2.4 */ -#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ U16_BACK_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the n-th one before it, @@ -680,13 +680,13 @@ * @see U16_BACK_N_UNSAFE * @stable ICU 2.4 */ -#define U16_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0 && (i)>(start)) { \ U16_BACK_1(s, start, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary after a code point. @@ -701,11 +701,11 @@ * @see U16_SET_CP_LIMIT * @stable ICU 2.4 */ -#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U16_IS_LEAD((s)[(i)-1])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary after a code point. @@ -724,10 +724,10 @@ * @see U16_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ -#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \ if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END #endif diff --git a/contrib/libs/icu/include/unicode/utf32.h b/contrib/libs/icu/include/unicode/utf32.h index 8822c4dd09..ba3e943ce4 100644 --- a/contrib/libs/icu/include/unicode/utf32.h +++ b/contrib/libs/icu/include/unicode/utf32.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utf32.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * diff --git a/contrib/libs/icu/include/unicode/utf8.h b/contrib/libs/icu/include/unicode/utf8.h index 4987a00e8e..e91647a63d 100644 --- a/contrib/libs/icu/include/unicode/utf8.h +++ b/contrib/libs/icu/include/unicode/utf8.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utf8.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -43,8 +43,8 @@ /** * Counts the trail bytes for a UTF-8 lead byte. - * Returns 0 for 0..0xc1 as well as for 0xf5..0xff. - * leadByte might be evaluated multiple times. + * Returns 0 for 0..0xc1 as well as for 0xf5..0xff. + * leadByte might be evaluated multiple times. * * This is internal since it is not meant to be called directly by external clients; * however it is called by public macros in this file and thus must remain stable. @@ -53,12 +53,12 @@ * @internal */ #define U8_COUNT_TRAIL_BYTES(leadByte) \ - (U8_IS_LEAD(leadByte) ? \ - ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0) + (U8_IS_LEAD(leadByte) ? \ + ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0) /** * Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence. - * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff. + * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff. * leadByte might be evaluated multiple times. * * This is internal since it is not meant to be called directly by external clients; @@ -68,7 +68,7 @@ * @internal */ #define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \ - (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)) + (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)) /** * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. @@ -80,40 +80,40 @@ #define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) /** - * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1. - * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. - * Lead byte E0..EF bits 3..0 are used as byte index, - * first trail byte bits 7..5 are used as bit index into that byte. - * @see U8_IS_VALID_LEAD3_AND_T1 - * @internal - */ -#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30" - -/** - * Internal 3-byte UTF-8 validity check. - * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence. - * @internal - */ -#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5))) - -/** - * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1. - * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. - * First trail byte bits 7..4 are used as byte index, - * lead byte F0..F4 bits 2..0 are used as bit index into that byte. - * @see U8_IS_VALID_LEAD4_AND_T1 - * @internal - */ -#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00" - -/** - * Internal 4-byte UTF-8 validity check. - * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence. - * @internal - */ -#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7))) - -/** + * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1. + * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. + * Lead byte E0..EF bits 3..0 are used as byte index, + * first trail byte bits 7..5 are used as bit index into that byte. + * @see U8_IS_VALID_LEAD3_AND_T1 + * @internal + */ +#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30" + +/** + * Internal 3-byte UTF-8 validity check. + * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence. + * @internal + */ +#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5))) + +/** + * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1. + * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence. + * First trail byte bits 7..4 are used as byte index, + * lead byte F0..F4 bits 2..0 are used as bit index into that byte. + * @see U8_IS_VALID_LEAD4_AND_T1 + * @internal + */ +#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00" + +/** + * Internal 4-byte UTF-8 validity check. + * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence. + * @internal + */ +#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7))) + +/** * Function for handling "next code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; @@ -172,21 +172,21 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); #define U8_IS_SINGLE(c) (((c)&0x80)==0) /** - * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4) + * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4) * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ -#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32) -// 0x32=0xf4-0xc2 +#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32) +// 0x32=0xf4-0xc2 /** - * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF) + * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF) * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ -#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40) +#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40) /** * How many code units (bytes) are used for the UTF-8 encoding @@ -229,11 +229,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_GET * @stable ICU 2.4 */ -#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ int32_t _u8_get_unsafe_index=(int32_t)(i); \ U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \ U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Get a code point from a string at a random-access offset, @@ -256,11 +256,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_GET_UNSAFE * @stable ICU 2.4 */ -#define U8_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ int32_t _u8_get_index=(i); \ U8_SET_CP_START(s, start, _u8_get_index); \ U8_NEXT(s, _u8_get_index, length, c); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Get a code point from a string at a random-access offset, @@ -287,11 +287,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_GET * @stable ICU 51 */ -#define U8_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ int32_t _u8_get_index=(i); \ U8_SET_CP_START(s, start, _u8_get_index); \ U8_NEXT_OR_FFFD(s, _u8_get_index, length, c); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /* definitions with forward iteration --------------------------------------- */ @@ -312,9 +312,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_NEXT * @stable ICU 2.4 */ -#define U8_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(uint8_t)(s)[(i)++]; \ - if(!U8_IS_SINGLE(c)) { \ + if(!U8_IS_SINGLE(c)) { \ if((c)<0xe0) { \ (c)=(((c)&0x1f)<<6)|((s)[(i)++]&0x3f); \ } else if((c)<0xf0) { \ @@ -326,7 +326,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); (i)+=3; \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Get a code point from a string at a code point boundary offset, @@ -348,7 +348,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_NEXT_UNSAFE * @stable ICU 2.4 */ -#define U8_NEXT(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, U_SENTINEL) +#define U8_NEXT(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, U_SENTINEL) /** * Get a code point from a string at a code point boundary offset, @@ -374,36 +374,36 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_NEXT * @stable ICU 51 */ -#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd) - -/** @internal */ -#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd) + +/** @internal */ +#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(uint8_t)(s)[(i)++]; \ - if(!U8_IS_SINGLE(c)) { \ - uint8_t __t = 0; \ - if((i)!=(length) && \ - /* fetch/validate/assemble all but last trail byte */ \ - ((c)>=0xe0 ? \ - ((c)<0xf0 ? /* U+0800..U+FFFF except surrogates */ \ - U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \ - (__t&=0x3f, 1) \ - : /* U+10000..U+10FFFF */ \ - ((c)-=0xf0)<=4 && \ - U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \ - ((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \ - (__t=(s)[i]-0x80)<=0x3f) && \ - /* valid second-to-last trail byte */ \ - ((c)=((c)<<6)|__t, ++(i)!=(length)) \ - : /* U+0080..U+07FF */ \ - (c)>=0xc2 && ((c)&=0x1f, 1)) && \ - /* last trail byte */ \ - (__t=(s)[i]-0x80)<=0x3f && \ - ((c)=((c)<<6)|__t, ++(i), 1)) { \ + if(!U8_IS_SINGLE(c)) { \ + uint8_t __t = 0; \ + if((i)!=(length) && \ + /* fetch/validate/assemble all but last trail byte */ \ + ((c)>=0xe0 ? \ + ((c)<0xf0 ? /* U+0800..U+FFFF except surrogates */ \ + U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \ + (__t&=0x3f, 1) \ + : /* U+10000..U+10FFFF */ \ + ((c)-=0xf0)<=4 && \ + U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \ + ((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \ + (__t=(s)[i]-0x80)<=0x3f) && \ + /* valid second-to-last trail byte */ \ + ((c)=((c)<<6)|__t, ++(i)!=(length)) \ + : /* U+0080..U+07FF */ \ + (c)>=0xc2 && ((c)&=0x1f, 1)) && \ + /* last trail byte */ \ + (__t=(s)[i]-0x80)<=0x3f && \ + ((c)=((c)<<6)|__t, ++(i), 1)) { \ } else { \ - (c)=(sub); /* ill-formed*/ \ + (c)=(sub); /* ill-formed*/ \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Append a code point to a string, overwriting 1 to 4 bytes. @@ -418,25 +418,25 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_APPEND * @stable ICU 2.4 */ -#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ - uint32_t __uc=(c); \ - if(__uc<=0x7f) { \ - (s)[(i)++]=(uint8_t)__uc; \ +#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ + uint32_t __uc=(c); \ + if(__uc<=0x7f) { \ + (s)[(i)++]=(uint8_t)__uc; \ } else { \ - if(__uc<=0x7ff) { \ - (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \ + if(__uc<=0x7ff) { \ + (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \ } else { \ - if(__uc<=0xffff) { \ - (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \ + if(__uc<=0xffff) { \ + (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \ } else { \ - (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \ - (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \ + (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \ } \ - (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ } \ - (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Append a code point to a string, overwriting 1 to 4 bytes. @@ -455,26 +455,26 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_APPEND_UNSAFE * @stable ICU 2.4 */ -#define U8_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \ - uint32_t __uc=(c); \ - if(__uc<=0x7f) { \ - (s)[(i)++]=(uint8_t)__uc; \ - } else if(__uc<=0x7ff && (i)+1<(capacity)) { \ - (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \ - (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ - } else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \ - (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \ - (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ - (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ - } else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \ - (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \ - (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \ - (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ - (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ +#define U8_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \ + uint32_t __uc=(c); \ + if(__uc<=0x7f) { \ + (s)[(i)++]=(uint8_t)__uc; \ + } else if(__uc<=0x7ff && (i)+1<(capacity)) { \ + (s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \ + (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ + } else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \ + (s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \ + (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ + } else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \ + (s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \ + (s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \ + (s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \ } else { \ - (isError)=TRUE; \ + (isError)=TRUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the next. @@ -486,9 +486,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_FWD_1 * @stable ICU 2.4 */ -#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ - (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \ -} UPRV_BLOCK_MACRO_END +#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ + (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \ +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the next. @@ -503,28 +503,28 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_FWD_1_UNSAFE * @stable ICU 2.4 */ -#define U8_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ - uint8_t __b=(s)[(i)++]; \ - if(U8_IS_LEAD(__b) && (i)!=(length)) { \ - uint8_t __t1=(s)[i]; \ - if((0xe0<=__b && __b<0xf0)) { \ - if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \ - ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ - ++(i); \ - } \ - } else if(__b<0xe0) { \ - if(U8_IS_TRAIL(__t1)) { \ - ++(i); \ - } \ - } else /* c>=0xf0 */ { \ - if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \ - ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \ - ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ - ++(i); \ - } \ +#define U8_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ + uint8_t __b=(s)[(i)++]; \ + if(U8_IS_LEAD(__b) && (i)!=(length)) { \ + uint8_t __t1=(s)[i]; \ + if((0xe0<=__b && __b<0xf0)) { \ + if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \ + ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ + ++(i); \ + } \ + } else if(__b<0xe0) { \ + if(U8_IS_TRAIL(__t1)) { \ + ++(i); \ + } \ + } else /* c>=0xf0 */ { \ + if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \ + ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \ + ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \ + ++(i); \ + } \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the n-th next one, @@ -538,13 +538,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_FWD_N * @stable ICU 2.4 */ -#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ U8_FWD_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Advance the string offset from one code point boundary to the n-th next one, @@ -561,13 +561,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_FWD_N_UNSAFE * @stable ICU 2.4 */ -#define U8_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \ U8_FWD_1(s, i, length); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary @@ -582,9 +582,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_SET_CP_START * @stable ICU 2.4 */ -#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ while(U8_IS_TRAIL((s)[i])) { --(i); } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary @@ -592,73 +592,73 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * If the offset points to a UTF-8 trail byte, * then the offset is moved backward to the corresponding lead byte. * Otherwise, it is not modified. - * + * * "Safe" macro, checks for illegal sequences and for string boundaries. - * Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i]. + * Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i]. * * @param s const uint8_t * string * @param start int32_t starting string offset (usually 0) * @param i int32_t string offset, must be start<=i * @see U8_SET_CP_START_UNSAFE - * @see U8_TRUNCATE_IF_INCOMPLETE + * @see U8_TRUNCATE_IF_INCOMPLETE * @stable ICU 2.4 */ -#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U8_IS_TRAIL((s)[(i)])) { \ (i)=utf8_back1SafeBody(s, start, (i)); \ } \ -} UPRV_BLOCK_MACRO_END - -/** - * If the string ends with a UTF-8 byte sequence that is valid so far - * but incomplete, then reduce the length of the string to end before - * the lead byte of that incomplete sequence. - * For example, if the string ends with E1 80, the length is reduced by 2. - * - * In all other cases (the string ends with a complete sequence, or it is not - * possible for any further trail byte to extend the trailing sequence) - * the length remains unchanged. - * - * Useful for processing text split across multiple buffers - * (save the incomplete sequence for later) - * and for optimizing iteration - * (check for string length only once per character). - * - * "Safe" macro, checks for illegal sequences and for string boundaries. - * Unlike U8_SET_CP_START(), this macro never reads s[length]. - * - * (In UTF-16, simply check for U16_IS_LEAD(last code unit).) - * - * @param s const uint8_t * string - * @param start int32_t starting string offset (usually 0) - * @param length int32_t string length (usually start<=length) - * @see U8_SET_CP_START - * @stable ICU 61 - */ -#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \ - if((length)>(start)) { \ - uint8_t __b1=s[(length)-1]; \ - if(U8_IS_SINGLE(__b1)) { \ - /* common ASCII character */ \ - } else if(U8_IS_LEAD(__b1)) { \ - --(length); \ - } else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \ - uint8_t __b2=s[(length)-2]; \ - if(0xe0<=__b2 && __b2<=0xf4) { \ - if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \ - U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \ - (length)-=2; \ - } \ - } else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \ - uint8_t __b3=s[(length)-3]; \ - if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \ - (length)-=3; \ - } \ - } \ - } \ - } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END +/** + * If the string ends with a UTF-8 byte sequence that is valid so far + * but incomplete, then reduce the length of the string to end before + * the lead byte of that incomplete sequence. + * For example, if the string ends with E1 80, the length is reduced by 2. + * + * In all other cases (the string ends with a complete sequence, or it is not + * possible for any further trail byte to extend the trailing sequence) + * the length remains unchanged. + * + * Useful for processing text split across multiple buffers + * (save the incomplete sequence for later) + * and for optimizing iteration + * (check for string length only once per character). + * + * "Safe" macro, checks for illegal sequences and for string boundaries. + * Unlike U8_SET_CP_START(), this macro never reads s[length]. + * + * (In UTF-16, simply check for U16_IS_LEAD(last code unit).) + * + * @param s const uint8_t * string + * @param start int32_t starting string offset (usually 0) + * @param length int32_t string length (usually start<=length) + * @see U8_SET_CP_START + * @stable ICU 61 + */ +#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \ + if((length)>(start)) { \ + uint8_t __b1=s[(length)-1]; \ + if(U8_IS_SINGLE(__b1)) { \ + /* common ASCII character */ \ + } else if(U8_IS_LEAD(__b1)) { \ + --(length); \ + } else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \ + uint8_t __b2=s[(length)-2]; \ + if(0xe0<=__b2 && __b2<=0xf4) { \ + if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \ + U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \ + (length)-=2; \ + } \ + } else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \ + uint8_t __b3=s[(length)-3]; \ + if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \ + (length)-=3; \ + } \ + } \ + } \ + } \ +} UPRV_BLOCK_MACRO_END + /* definitions with backward iteration -------------------------------------- */ /** @@ -680,7 +680,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_PREV * @stable ICU 2.4 */ -#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(uint8_t)(s)[--(i)]; \ if(U8_IS_TRAIL(c)) { \ uint8_t __b, __count=1, __shift=6; \ @@ -688,7 +688,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /* c is a trail byte */ \ (c)&=0x3f; \ for(;;) { \ - __b=(s)[--(i)]; \ + __b=(s)[--(i)]; \ if(__b>=0xc0) { \ U8_MASK_LEAD_BYTE(__b, __count); \ (c)|=(UChar32)__b<<__shift; \ @@ -700,7 +700,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); } \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one @@ -722,12 +722,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_PREV_UNSAFE * @stable ICU 2.4 */ -#define U8_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(uint8_t)(s)[--(i)]; \ - if(!U8_IS_SINGLE(c)) { \ + if(!U8_IS_SINGLE(c)) { \ (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one @@ -753,12 +753,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_PREV * @stable ICU 51 */ -#define U8_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(uint8_t)(s)[--(i)]; \ - if(!U8_IS_SINGLE(c)) { \ + if(!U8_IS_SINGLE(c)) { \ (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one. @@ -771,9 +771,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_BACK_1 * @stable ICU 2.4 */ -#define U8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ while(U8_IS_TRAIL((s)[--(i)])) {} \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the previous one. @@ -787,11 +787,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_BACK_1_UNSAFE * @stable ICU 2.4 */ -#define U8_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ if(U8_IS_TRAIL((s)[--(i)])) { \ (i)=utf8_back1SafeBody(s, start, (i)); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the n-th one before it, @@ -806,13 +806,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_BACK_N * @stable ICU 2.4 */ -#define U8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ U8_BACK_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Move the string offset from one code point boundary to the n-th one before it, @@ -828,13 +828,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_BACK_N_UNSAFE * @stable ICU 2.4 */ -#define U8_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0 && (i)>(start)) { \ U8_BACK_1(s, start, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary after a code point. @@ -849,10 +849,10 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_SET_CP_LIMIT * @stable ICU 2.4 */ -#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ U8_BACK_1_UNSAFE(s, i); \ U8_FWD_1_UNSAFE(s, i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** * Adjust a random-access offset to a code point boundary after a code point. @@ -871,11 +871,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); * @see U8_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ -#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \ if((start)<(i) && ((i)<(length) || (length)<0)) { \ U8_BACK_1(s, start, i); \ U8_FWD_1(s, i, length); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END #endif diff --git a/contrib/libs/icu/include/unicode/utf_old.h b/contrib/libs/icu/include/unicode/utf_old.h index b2428e6b31..9d08c3a1f3 100644 --- a/contrib/libs/icu/include/unicode/utf_old.h +++ b/contrib/libs/icu/include/unicode/utf_old.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utf_old.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -17,9 +17,9 @@ */ /** - * \file + * \file * \brief C API: Deprecated macros for Unicode string handling - * + * * The macros in utf_old.h are all deprecated and their use discouraged. * Some of the design principles behind the set of UTF macros * have changed or proved impractical. @@ -136,7 +136,7 @@ * * <hr> * - * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead. + * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead. */ #ifndef __UTF_OLD_H__ @@ -146,23 +146,23 @@ #include "unicode/utf8.h" #include "unicode/utf16.h" -/** - * \def U_HIDE_OBSOLETE_UTF_OLD_H - * - * Hides the obsolete definitions in unicode/utf_old.h. - * Recommended to be set to 1 at compile time to make sure - * the long-deprecated macros are no longer used. - * - * For reasons for the deprecation see the utf_old.h file comments. - * - * @internal - */ -#ifndef U_HIDE_OBSOLETE_UTF_OLD_H -# define U_HIDE_OBSOLETE_UTF_OLD_H 0 -#endif - -#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H - +/** + * \def U_HIDE_OBSOLETE_UTF_OLD_H + * + * Hides the obsolete definitions in unicode/utf_old.h. + * Recommended to be set to 1 at compile time to make sure + * the long-deprecated macros are no longer used. + * + * For reasons for the deprecation see the utf_old.h file comments. + * + * @internal + */ +#ifndef U_HIDE_OBSOLETE_UTF_OLD_H +# define U_HIDE_OBSOLETE_UTF_OLD_H 0 +#endif + +#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H + /* Formerly utf.h, part 1 --------------------------------------------------- */ #ifdef U_USE_UTF_DEPRECATES @@ -280,25 +280,25 @@ typedef int32_t UTextOffset; /* Formerly utf8.h ---------------------------------------------------------- */ /** -* \var utf8_countTrailBytes -* Internal array with numbers of trail bytes for any given byte used in -* lead byte position. -* -* This is internal since it is not meant to be called directly by external clients; -* however it is called by public macros in this file and thus must remain stable, -* and should not be hidden when other internal functions are hidden (otherwise -* public macros would fail to compile). -* @internal -*/ -#ifdef U_UTF8_IMPL -// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. -#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) -U_CFUNC const uint8_t utf8_countTrailBytes[]; -#else -U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ -#endif - -/** +* \var utf8_countTrailBytes +* Internal array with numbers of trail bytes for any given byte used in +* lead byte position. +* +* This is internal since it is not meant to be called directly by external clients; +* however it is called by public macros in this file and thus must remain stable, +* and should not be hidden when other internal functions are hidden (otherwise +* public macros would fail to compile). +* @internal +*/ +#ifdef U_UTF8_IMPL +// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. +#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) +U_CFUNC const uint8_t utf8_countTrailBytes[]; +#else +U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ +#endif + +/** * Count the trail bytes for a UTF-8 lead byte. * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. */ @@ -362,21 +362,21 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I #define UTF8_ARRAY_SIZE(size) ((5*(size))/2) /** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */ -#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \ UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \ UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */ -#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ int32_t _utf8_get_char_safe_index=(int32_t)(i); \ UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \ UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */ -#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if((uint8_t)((c)-0xc0)<0x35) { \ uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \ @@ -393,10 +393,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I break; \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */ -#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ @@ -413,29 +413,29 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I } \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */ -#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ (i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */ -#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ UTF8_FWD_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */ -#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ while(UTF8_IS_TRAIL((s)[i])) { --(i); } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */ -#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if((c)>=0x80) { \ if(UTF8_IS_LEAD(c)) { \ @@ -444,16 +444,16 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I (c)=UTF8_ERROR_VALUE_1; \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */ -#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */ #define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length) @@ -465,7 +465,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I #define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i) /** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */ -#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(UTF8_IS_TRAIL(c)) { \ uint8_t __b, __count=1, __shift=6; \ @@ -485,30 +485,30 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I } \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */ -#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ while(UTF8_IS_TRAIL((s)[--(i)])) {} \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */ -#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ UTF8_BACK_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ -#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ UTF8_BACK_1_UNSAFE(s, i); \ UTF8_FWD_1_UNSAFE(s, i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */ -#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if((c)>=0x80) { \ if((c)<=0xbf) { \ @@ -517,7 +517,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I (c)=UTF8_ERROR_VALUE_1; \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */ #define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i) @@ -590,7 +590,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I * UTF16_PREV_CHAR[_UNSAFE]() is more efficient for that. * @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h. */ -#define UTF16_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ if(UTF_IS_SURROGATE(c)) { \ if(UTF_IS_SURROGATE_FIRST(c)) { \ @@ -599,10 +599,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I (c)=UTF16_GET_PAIR_VALUE((s)[(i)-1], (c)); \ } \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */ -#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ if(UTF_IS_SURROGATE(c)) { \ uint16_t __c2; \ @@ -626,51 +626,51 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ -#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if(UTF_IS_FIRST_SURROGATE(c)) { \ (c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ -#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ -#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ -#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ UTF16_FWD_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ -#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(UTF_IS_SECOND_SURROGATE((s)[i])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ -#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if(UTF_IS_FIRST_SURROGATE(c)) { \ uint16_t __c2; \ @@ -686,10 +686,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I /* unmatched second surrogate or other non-character */ \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ -#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else if((uint32_t)(c)<=0x10ffff) { \ @@ -702,7 +702,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I } else /* c>0x10ffff, write error value */ { \ (s)[(i)++]=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ #define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length) @@ -714,38 +714,38 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I #define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i) /** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ -#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(UTF_IS_SECOND_SURROGATE(c)) { \ (c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ -#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \ --(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ -#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ int32_t __N=(n); \ while(__N>0) { \ UTF16_BACK_1_UNSAFE(s, i); \ --__N; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ -#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \ ++(i); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ -#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(UTF_IS_SECOND_SURROGATE(c)) { \ uint16_t __c2; \ @@ -761,7 +761,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I /* unmatched first surrogate or other non-character */ \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ #define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i) @@ -827,122 +827,122 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I #define UTF32_ARRAY_SIZE(size) (size) /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[i]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /* definitions with forward iteration --------------------------------------- */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (s)[(i)++]=(c); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ ++(i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ (i)+=(n); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ -} UPRV_BLOCK_MACRO_END +#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[(i)++]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \ if((uint32_t)(c)<=0x10ffff) { \ (s)[(i)++]=(c); \ } else /* c>0x10ffff, write 0xfffd */ { \ (s)[(i)++]=0xfffd; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ ++(i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \ if(((i)+=(n))>(length)) { \ (i)=(length); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ -} UPRV_BLOCK_MACRO_END +#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END /* definitions with backward iteration -------------------------------------- */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ --(i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \ (i)-=(n); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ -} UPRV_BLOCK_MACRO_END +#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \ (c)=(s)[--(i)]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \ --(i); \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ +#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \ (i)-=(n); \ if((i)<(start)) { \ (i)=(start); \ } \ -} UPRV_BLOCK_MACRO_END +} UPRV_BLOCK_MACRO_END /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ -#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ -} UPRV_BLOCK_MACRO_END +#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \ +} UPRV_BLOCK_MACRO_END /* Formerly utf.h, part 2 --------------------------------------------------- */ @@ -1196,6 +1196,6 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I */ #define UTF_SET_CHAR_LIMIT(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length) -#endif // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H +#endif // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H #endif diff --git a/contrib/libs/icu/include/unicode/utmscale.h b/contrib/libs/icu/include/unicode/utmscale.h index d8b8a2e668..9a4a9de512 100644 --- a/contrib/libs/icu/include/unicode/utmscale.h +++ b/contrib/libs/icu/include/unicode/utmscale.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -283,14 +283,14 @@ typedef enum UDateTimeScale { */ UDTS_UNIX_MICROSECONDS_TIME, -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * The first unused time scale value. The limit of this enum - * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. + * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. */ UDTS_MAX_SCALE -#endif /* U_HIDE_DEPRECATED_API */ - +#endif /* U_HIDE_DEPRECATED_API */ + } UDateTimeScale; /** @@ -427,15 +427,15 @@ typedef enum UTimeScaleValue { #endif /* U_HIDE_INTERNAL_API */ -#ifndef U_HIDE_DEPRECATED_API +#ifndef U_HIDE_DEPRECATED_API /** * The number of time scale values, in other words limit of this enum. * * @see utmscale_getTimeScaleValue - * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. + * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. */ UTSV_MAX_SCALE_VALUE=11 -#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_DEPRECATED_API */ } UTimeScaleValue; diff --git a/contrib/libs/icu/include/unicode/utrace.h b/contrib/libs/icu/include/unicode/utrace.h index 5b4a0497bf..304bc627d0 100644 --- a/contrib/libs/icu/include/unicode/utrace.h +++ b/contrib/libs/icu/include/unicode/utrace.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -8,7 +8,7 @@ * ******************************************************************************* * file name: utrace.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -66,7 +66,7 @@ typedef enum UTraceFunctionNumber { UTRACE_FUNCTION_START=0, UTRACE_U_INIT=UTRACE_FUNCTION_START, UTRACE_U_CLEANUP, - + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal collation trace location. @@ -84,7 +84,7 @@ typedef enum UTraceFunctionNumber { UTRACE_UCNV_FLUSH_CACHE, UTRACE_UCNV_LOAD, UTRACE_UCNV_UNLOAD, - + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal collation trace location. @@ -103,145 +103,145 @@ typedef enum UTraceFunctionNumber { UTRACE_UCOL_STRCOLLITER, UTRACE_UCOL_OPEN_FROM_SHORT_STRING, UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */ - + #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal collation trace location. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - UTRACE_COLLATION_LIMIT, + UTRACE_COLLATION_LIMIT, #endif // U_HIDE_DEPRECATED_API - -#ifndef U_HIDE_DRAFT_API - - /** - * The lowest resource/data location. - * @draft ICU 65 - */ - UTRACE_UDATA_START=0x3000, - - /** - * Indicates that a value was read from a resource bundle. Provides three - * C-style strings to UTraceData: type, file name, and resource path. The - * possible types are: - * - * - "string" (a string value was accessed) - * - "binary" (a binary value was accessed) - * - "intvector" (a integer vector value was accessed) - * - "int" (a signed integer value was accessed) - * - "uint" (a unsigned integer value was accessed) - * - "get" (a path was loaded, but the value was not accessed) - * - "getalias" (a path was loaded, and an alias was resolved) - * - * @draft ICU 65 - */ - UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START, - - /** - * Indicates that a resource bundle was opened. - * - * Provides one C-style string to UTraceData: file name. - * @draft ICU 65 - */ - UTRACE_UDATA_BUNDLE, - - /** - * Indicates that a data file was opened, but not *.res files. - * - * Provides one C-style string to UTraceData: file name. - * - * @draft ICU 65 - */ - UTRACE_UDATA_DATA_FILE, - - /** - * Indicates that a *.res file was opened. - * - * This differs from UTRACE_UDATA_BUNDLE because a res file is typically - * opened only once per application runtime, but the bundle corresponding - * to that res file may be opened many times. - * - * Provides one C-style string to UTraceData: file name. - * - * @draft ICU 65 - */ - UTRACE_UDATA_RES_FILE, - -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_INTERNAL_API - /** - * One more than the highest normal resource/data trace location. - * @internal The numeric value may change over time, see ICU ticket #12420. - */ - UTRACE_RES_DATA_LIMIT, -#endif // U_HIDE_INTERNAL_API - -#ifndef U_HIDE_DRAFT_API - /** - * The lowest break iterator location. - * @draft ICU 67 - */ - UTRACE_UBRK_START=0x4000, - - /** - * Indicates that a character instance of break iterator was created. - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START, - - /** - * Indicates that a word instance of break iterator was created. - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_WORD, - - /** - * Indicates that a line instance of break iterator was created. - * - * Provides one C-style string to UTraceData: the lb value ("", - * "loose", "strict", or "normal"). - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_LINE, - - /** - * Indicates that a sentence instance of break iterator was created. - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_SENTENCE, - - /** - * Indicates that a title instance of break iterator was created. - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_TITLE, - - /** - * Indicates that an internal dictionary break engine was created. - * - * Provides one C-style string to UTraceData: the script code of what - * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai"). - * - * @draft ICU 67 - */ - UTRACE_UBRK_CREATE_BREAK_ENGINE, - -#endif // U_HIDE_DRAFT_API - -#ifndef U_HIDE_INTERNAL_API - /** - * One more than the highest normal break iterator trace location. - * @internal The numeric value may change over time, see ICU ticket #12420. - */ - UTRACE_UBRK_LIMIT, -#endif // U_HIDE_INTERNAL_API - + +#ifndef U_HIDE_DRAFT_API + + /** + * The lowest resource/data location. + * @draft ICU 65 + */ + UTRACE_UDATA_START=0x3000, + + /** + * Indicates that a value was read from a resource bundle. Provides three + * C-style strings to UTraceData: type, file name, and resource path. The + * possible types are: + * + * - "string" (a string value was accessed) + * - "binary" (a binary value was accessed) + * - "intvector" (a integer vector value was accessed) + * - "int" (a signed integer value was accessed) + * - "uint" (a unsigned integer value was accessed) + * - "get" (a path was loaded, but the value was not accessed) + * - "getalias" (a path was loaded, and an alias was resolved) + * + * @draft ICU 65 + */ + UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START, + + /** + * Indicates that a resource bundle was opened. + * + * Provides one C-style string to UTraceData: file name. + * @draft ICU 65 + */ + UTRACE_UDATA_BUNDLE, + + /** + * Indicates that a data file was opened, but not *.res files. + * + * Provides one C-style string to UTraceData: file name. + * + * @draft ICU 65 + */ + UTRACE_UDATA_DATA_FILE, + + /** + * Indicates that a *.res file was opened. + * + * This differs from UTRACE_UDATA_BUNDLE because a res file is typically + * opened only once per application runtime, but the bundle corresponding + * to that res file may be opened many times. + * + * Provides one C-style string to UTraceData: file name. + * + * @draft ICU 65 + */ + UTRACE_UDATA_RES_FILE, + +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + /** + * One more than the highest normal resource/data trace location. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_RES_DATA_LIMIT, +#endif // U_HIDE_INTERNAL_API + +#ifndef U_HIDE_DRAFT_API + /** + * The lowest break iterator location. + * @draft ICU 67 + */ + UTRACE_UBRK_START=0x4000, + + /** + * Indicates that a character instance of break iterator was created. + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_CHARACTER = UTRACE_UBRK_START, + + /** + * Indicates that a word instance of break iterator was created. + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_WORD, + + /** + * Indicates that a line instance of break iterator was created. + * + * Provides one C-style string to UTraceData: the lb value ("", + * "loose", "strict", or "normal"). + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_LINE, + + /** + * Indicates that a sentence instance of break iterator was created. + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_SENTENCE, + + /** + * Indicates that a title instance of break iterator was created. + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_TITLE, + + /** + * Indicates that an internal dictionary break engine was created. + * + * Provides one C-style string to UTraceData: the script code of what + * the break engine cover ("Hani", "Khmr", "Laoo", "Mymr", or "Thai"). + * + * @draft ICU 67 + */ + UTRACE_UBRK_CREATE_BREAK_ENGINE, + +#endif // U_HIDE_DRAFT_API + +#ifndef U_HIDE_INTERNAL_API + /** + * One more than the highest normal break iterator trace location. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_UBRK_LIMIT, +#endif // U_HIDE_INTERNAL_API + } UTraceFunctionNumber; /** @@ -317,7 +317,7 @@ UTraceData(const void *context, int32_t fnNumber, int32_t level, * tracing functions must themselves filter by checking that the * current thread is the desired thread. * - * @param context an uninterpreted pointer. Whatever is passed in + * @param context an uninterpreted pointer. Whatever is passed in * here will in turn be passed to each of the tracing * functions UTraceEntry, UTraceExit and UTraceData. * ICU does not use or alter this pointer. @@ -454,7 +454,7 @@ utrace_getFunctions(const void **context, * human readable form. Note that a UTraceData function may choose * to not format the data; it could, for example, save it in * in the raw form it was received (more compact), leaving - * formatting for a later trace analysis tool. + * formatting for a later trace analysis tool. * @param outBuf pointer to a buffer to receive the formatted output. Output * will be nul terminated if there is space in the buffer - * if the length of the requested output < the output buffer size. diff --git a/contrib/libs/icu/include/unicode/utrans.h b/contrib/libs/icu/include/unicode/utrans.h index 021af498a8..9d39e87a6c 100644 --- a/contrib/libs/icu/include/unicode/utrans.h +++ b/contrib/libs/icu/include/unicode/utrans.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -142,7 +142,7 @@ typedef struct UTransPosition { int32_t contextLimit; /** - * Beginning index, inclusive, of the text to be transliterated. + * Beginning index, inclusive, of the text to be transliterated. * INPUT/OUTPUT parameter: This parameter is advanced past * characters that have already been transliterated by a * transliteration operation. @@ -151,7 +151,7 @@ typedef struct UTransPosition { int32_t start; /** - * Ending index, exclusive, of the text to be transliterated. + * Ending index, exclusive, of the text to be transliterated. * INPUT/OUTPUT parameter: This parameter is updated to reflect * changes in the length of the text, but points to the same * logical position in the text. @@ -382,14 +382,14 @@ utrans_openIDs(UErrorCode *pErrorCode); U_STABLE void U_EXPORT2 utrans_trans(const UTransliterator* trans, UReplaceable* rep, - const UReplaceableCallbacks* repFunc, + const UReplaceableCallbacks* repFunc, int32_t start, int32_t* limit, UErrorCode* status); /** * Transliterate the portion of the UReplaceable text buffer that can - * be transliterated unambiguously. This method is typically called + * be transliterated unambiguously. This method is typically called * after new text has been inserted, e.g. as a result of a keyboard * event. The transliterator will try to transliterate characters of * <code>rep</code> between <code>index.cursor</code> and @@ -433,7 +433,7 @@ utrans_trans(const UTransliterator* trans, U_STABLE void U_EXPORT2 utrans_transIncremental(const UTransliterator* trans, UReplaceable* rep, - const UReplaceableCallbacks* repFunc, + const UReplaceableCallbacks* repFunc, UTransPosition* pos, UErrorCode* status); @@ -454,7 +454,7 @@ utrans_transIncremental(const UTransliterator* trans, * zero-terminated. Upon return, the new length is stored in * *textLength. If textLength is NULL then the string is assumed to * be zero-terminated. - * @param textCapacity the length of the text buffer + * @param textCapacity the length of the text buffer * @param start the beginning index, inclusive; <code>0 <= start <= * limit</code>. * @param limit pointer to the ending index, exclusive; <code>start <= @@ -478,7 +478,7 @@ utrans_transUChars(const UTransliterator* trans, /** * Transliterate the portion of the UChar* text buffer that can be - * transliterated unambiguously. See utrans_transIncremental(). The + * transliterated unambiguously. See utrans_transIncremental(). The * string is passed in in a UChar* buffer. The string is modified in * place. If the result is longer than textCapacity, it is truncated. * The actual length of the result is returned in *textLength, if diff --git a/contrib/libs/icu/include/unicode/utypes.h b/contrib/libs/icu/include/unicode/utypes.h index 8d8f54764e..a4330d3ae7 100644 --- a/contrib/libs/icu/include/unicode/utypes.h +++ b/contrib/libs/icu/include/unicode/utypes.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** @@ -145,7 +145,7 @@ /** * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library. * Defined as a literal, not a string. - * Tricky Preprocessor use - ## operator replaces macro parameters with the literal string + * Tricky Preprocessor use - ## operator replaces macro parameters with the literal string * from the corresponding macro invocation, _before_ other macro substitutions. * Need a nested \#defines to get the actual version numbers rather than * the literal text U_ICU_VERSION_MAJOR_NUM into the name. @@ -178,12 +178,12 @@ /** * \def NULL - * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C. + * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C. * @stable ICU 2.0 */ #ifndef NULL #ifdef __cplusplus -#define NULL nullptr +#define NULL nullptr #else #define NULL ((void *)0) #endif @@ -290,11 +290,11 @@ typedef double UDate; * @stable ICU 3.4 */ -#ifdef U_IN_DOXYGEN -// This definition is required when generating the API docs. -#define U_COMBINED_IMPLEMENTATION 1 -#endif - +#ifdef U_IN_DOXYGEN +// This definition is required when generating the API docs. +#define U_COMBINED_IMPLEMENTATION 1 +#endif + #if defined(U_COMBINED_IMPLEMENTATION) #define U_DATA_API U_EXPORT #define U_COMMON_API U_EXPORT @@ -385,28 +385,28 @@ typedef double UDate; /*===========================================================================*/ /** - * Standard ICU4C error code type, a substitute for exceptions. - * - * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or - * failure using U_SUCCESS() or U_FAILURE(): - * - * UErrorCode errorCode = U_ZERO_ERROR; - * // call ICU API that needs an error code parameter. - * if (U_FAILURE(errorCode)) { - * // An error occurred. Handle it here. - * } - * - * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a - * suitable subclass. - * - * For more information, see: - * http://icu-project.org/userguide/conventions - * - * Note: By convention, ICU functions that take a reference (C++) or a pointer - * (C) to a UErrorCode first test: - * - * if (U_FAILURE(errorCode)) { return immediately; } + * Standard ICU4C error code type, a substitute for exceptions. * + * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or + * failure using U_SUCCESS() or U_FAILURE(): + * + * UErrorCode errorCode = U_ZERO_ERROR; + * // call ICU API that needs an error code parameter. + * if (U_FAILURE(errorCode)) { + * // An error occurred. Handle it here. + * } + * + * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a + * suitable subclass. + * + * For more information, see: + * http://icu-project.org/userguide/conventions + * + * Note: By convention, ICU functions that take a reference (C++) or a pointer + * (C) to a UErrorCode first test: + * + * if (U_FAILURE(errorCode)) { return immediately; } + * * so that in a chain of such functions the first one that sets an error code * causes the following ones to not perform any operations. * @@ -465,14 +465,14 @@ typedef enum UErrorCode { U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */ U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */ U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */ - U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */ + U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */ U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */ U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */ U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */ U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */ U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */ U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource. - It is very possible that a circular alias definition has occurred */ + It is very possible that a circular alias definition has occurred */ U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */ U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */ U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */ @@ -518,7 +518,7 @@ typedef enum UErrorCode { U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */ U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */ U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */ - U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */ + U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */ U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */ U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */ U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */ @@ -558,14 +558,14 @@ typedef enum UErrorCode { U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */ U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */ U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */ - U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */ - U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */ + U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @stable ICU 61 */ + U_NUMBER_SKELETON_SYNTAX_ERROR, /**< The number skeleton passed to C++ NumberFormatter or C UNumberFormatter was invalid or contained a syntax error. @stable ICU 62 */ #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal formatting API error code. * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. */ - U_FMT_PARSE_ERROR_LIMIT = 0x10114, + U_FMT_PARSE_ERROR_LIMIT = 0x10114, #endif // U_HIDE_DEPRECATED_API /* @@ -576,7 +576,7 @@ typedef enum UErrorCode { U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */ U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */ U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */ - U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */ + U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */ U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */ U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */ U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */ @@ -585,7 +585,7 @@ typedef enum UErrorCode { U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */ U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */ U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */ - U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */ + U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */ #ifndef U_HIDE_DEPRECATED_API /** * One more than the highest normal BreakIterator error code. diff --git a/contrib/libs/icu/include/unicode/uvernum.h b/contrib/libs/icu/include/unicode/uvernum.h index c66776d10b..fdad18ae10 100644 --- a/contrib/libs/icu/include/unicode/uvernum.h +++ b/contrib/libs/icu/include/unicode/uvernum.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -7,7 +7,7 @@ ******************************************************************************* * * file name: uvernum.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -34,11 +34,11 @@ * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. * * - * source/common/common_uwp.vcxproj + * source/common/common_uwp.vcxproj * source/common/common.vcxproj - update 'Output file name' on the link tab so * that it contains the new major/minor combination * source/i18n/i18n.vcxproj - same as for the common.vcxproj - * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj + * source/i18n/i18n_uwp.vcxproj - same as for the common_uwp.vcxproj * source/layoutex/layoutex.vcproj - same * source/stubdata/stubdata.vcproj - same as for the common.vcxproj * source/io/io.vcproj - same as for the common.vcxproj @@ -60,13 +60,13 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION_MAJOR_NUM 67 +#define U_ICU_VERSION_MAJOR_NUM 67 /** The current ICU minor version as an integer. * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ -#define U_ICU_VERSION_MINOR_NUM 1 +#define U_ICU_VERSION_MINOR_NUM 1 /** The current ICU patchlevel version as an integer. * This value will change in the subsequent releases of ICU @@ -86,7 +86,7 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ -#define U_ICU_VERSION_SUFFIX _67 +#define U_ICU_VERSION_SUFFIX _67 /** * \def U_DEF2_ICU_ENTRY_POINT_RENAME @@ -103,34 +103,34 @@ * \def U_ICU_ENTRY_POINT_RENAME * @stable ICU 4.2 */ -/** - * Disable the version suffix. Use the custom suffix if exists. - * \def U_DISABLE_VERSION_SUFFIX - * @internal - */ -#ifndef U_DISABLE_VERSION_SUFFIX -#define U_DISABLE_VERSION_SUFFIX 0 -#endif +/** + * Disable the version suffix. Use the custom suffix if exists. + * \def U_DISABLE_VERSION_SUFFIX + * @internal + */ +#ifndef U_DISABLE_VERSION_SUFFIX +#define U_DISABLE_VERSION_SUFFIX 0 +#endif #ifndef U_ICU_ENTRY_POINT_RENAME #ifdef U_HAVE_LIB_SUFFIX -# if !U_DISABLE_VERSION_SUFFIX -# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z -# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) -# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME) -# else -# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y -# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) -# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME) -# endif +# if !U_DISABLE_VERSION_SUFFIX +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME) +# else +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_LIB_SUFFIX_C_NAME) +# endif #else -# if !U_DISABLE_VERSION_SUFFIX -# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y -# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) -# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) -# else -# define U_ICU_ENTRY_POINT_RENAME(x) x -# endif +# if !U_DISABLE_VERSION_SUFFIX +# define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +# define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +# define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) +# else +# define U_ICU_ENTRY_POINT_RENAME(x) x +# endif #endif #endif @@ -139,26 +139,26 @@ * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ -#define U_ICU_VERSION "67.1" +#define U_ICU_VERSION "67.1" -/** - * The current ICU library major version number as a string, for library name suffixes. - * This value will change in subsequent releases of ICU. - * - * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers - * into one string without dots ("48"). - * Since ICU 49, it is the double-digit major ICU version number. - * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU - * - * @stable ICU 2.6 +/** + * The current ICU library major version number as a string, for library name suffixes. + * This value will change in subsequent releases of ICU. + * + * Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers + * into one string without dots ("48"). + * Since ICU 49, it is the double-digit major ICU version number. + * See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU + * + * @stable ICU 2.6 */ -#define U_ICU_VERSION_SHORT "67" +#define U_ICU_VERSION_SHORT "67" #ifndef U_HIDE_INTERNAL_API /** Data version in ICU4C. * @internal ICU 4.4 Internal Use Only **/ -#define U_ICU_DATA_VERSION "67.1" +#define U_ICU_DATA_VERSION "67.1" #endif /* U_HIDE_INTERNAL_API */ /*=========================================================================== diff --git a/contrib/libs/icu/include/unicode/uversion.h b/contrib/libs/icu/include/unicode/uversion.h index 5700f62cbf..2697ccef33 100644 --- a/contrib/libs/icu/include/unicode/uversion.h +++ b/contrib/libs/icu/include/unicode/uversion.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -7,7 +7,7 @@ ******************************************************************************* * * file name: uversion.h -* encoding: UTF-8 +* encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * @@ -62,13 +62,13 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; /* C++ namespace if supported. Versioned unless versioning is disabled. */ /*===========================================================================*/ -/* Define C++ namespace symbols. */ -#ifdef __cplusplus - +/* Define C++ namespace symbols. */ +#ifdef __cplusplus + /** * \def U_NAMESPACE_BEGIN - * This is used to begin a declaration of a public ICU C++ API within - * versioned-ICU-namespace block. + * This is used to begin a declaration of a public ICU C++ API within + * versioned-ICU-namespace block. * * @stable ICU 2.4 */ @@ -76,7 +76,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; /** * \def U_NAMESPACE_END * This is used to end a declaration of a public ICU C++ API. - * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. + * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. * * @stable ICU 2.4 */ @@ -107,24 +107,24 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; namespace icu = U_ICU_NAMESPACE; # endif -# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { -# define U_NAMESPACE_END } +# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { +# define U_NAMESPACE_END } # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: # ifndef U_USING_ICU_NAMESPACE -# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ - defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ - defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) -# define U_USING_ICU_NAMESPACE 0 -# else -# define U_USING_ICU_NAMESPACE 0 -# endif +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ + defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \ + defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION) +# define U_USING_ICU_NAMESPACE 0 +# else +# define U_USING_ICU_NAMESPACE 0 +# endif # endif # if U_USING_ICU_NAMESPACE U_NAMESPACE_USE # endif -#endif /* __cplusplus */ +#endif /* __cplusplus */ /*===========================================================================*/ /* General version helper functions. Definitions in putil.c */ diff --git a/contrib/libs/icu/include/unicode/vtzone.h b/contrib/libs/icu/include/unicode/vtzone.h index 641adec512..be7b24ebe5 100644 --- a/contrib/libs/icu/include/unicode/vtzone.h +++ b/contrib/libs/icu/include/unicode/vtzone.h @@ -1,4 +1,4 @@ -// © 2016 and later: Unicode, Inc. and others. +// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* @@ -11,8 +11,8 @@ #include "unicode/utypes.h" -#if U_SHOW_CPLUSPLUS_API - +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: RFC2445 VTIMEZONE support @@ -189,7 +189,7 @@ public: * @return A new copy of this TimeZone object. * @stable ICU 3.8 */ - virtual VTimeZone* clone() const; + virtual VTimeZone* clone() const; /** * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add @@ -292,7 +292,7 @@ public: */ virtual UBool useDaylightTime(void) const; -#ifndef U_FORCE_HIDE_DEPRECATED_API +#ifndef U_FORCE_HIDE_DEPRECATED_API /** * Queries if the given date is in daylight savings time in * this time zone. @@ -307,7 +307,7 @@ public: * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. */ virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; -#endif // U_FORCE_HIDE_DEPRECATED_API +#endif // U_FORCE_HIDE_DEPRECATED_API /** * Returns true if this zone has the same rule and offset as another zone. @@ -459,7 +459,7 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* U_SHOW_CPLUSPLUS_API */ - +#endif /* U_SHOW_CPLUSPLUS_API */ + #endif // VTZONE_H //eof |