ICU-21249 ICU4C API promotions

This commit is contained in:
Rich Gillam 2020-09-23 18:43:50 -07:00
parent 2b87e39ceb
commit 1ff371c225
12 changed files with 77 additions and 107 deletions

View file

@ -97,14 +97,13 @@ 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
* @stable ICU 65
*/
uint64_t getState64() const {
return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
@ -123,14 +122,13 @@ public:
* @see getState64
* @see resetToState
* @see reset
* @draft ICU 65
* @stable 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

View file

@ -279,7 +279,6 @@ public:
*/
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.
@ -287,10 +286,9 @@ public:
* Unchanged if there is no such error or if outErrorCode
* already contained an error.
* @return true if U_FAILURE(outErrorCode)
* @draft ICU 65
* @stable ICU 65
*/
UBool copyErrorTo(UErrorCode &outErrorCode) const;
#endif /* U_HIDE_DRAFT_API */
private:
friend class LocaleMatcher::Result;

View file

@ -20,26 +20,24 @@
* \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 LocaleMatcher::Builder#setFavorSubtag(ULocMatchFavorSubtag)
* @draft ICU 65
* @stable ICU 65
*/
enum ULocMatchFavorSubtag {
/**
* Language differences are most important, then script differences, then region differences.
* (This is the default behavior.)
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_FAVOR_LANGUAGE,
/**
* Makes script differences matter relatively more than language differences.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_FAVOR_SCRIPT
};
@ -52,13 +50,13 @@ typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag;
* earlier ones are preferred.
*
* @see LocaleMatcher::Builder#setDemotionPerDesiredLocale(ULocMatchDemotion)
* @draft ICU 65
* @stable ICU 65
*/
enum ULocMatchDemotion {
/**
* All desired locales are treated equally.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_DEMOTION_NONE,
/**
@ -85,7 +83,7 @@ enum ULocMatchDemotion {
* this is possible in future versions of the data.)
* </ul>
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_DEMOTION_REGION
};
@ -93,6 +91,8 @@ enum ULocMatchDemotion {
typedef enum ULocMatchDemotion ULocMatchDemotion;
#endif
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* 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.
@ -129,6 +129,8 @@ enum ULocMatchDirection {
typedef enum ULocMatchDirection ULocMatchDirection;
#endif
#endif // U_FORCE_HIDE_DRAFT_API
struct UHashtable;
U_NAMESPACE_BEGIN
@ -181,7 +183,7 @@ class XLikelySubtags;
*
* <p>This class is not intended for public subclassing.
*
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API LocaleMatcher : public UMemory {
public:
@ -189,7 +191,7 @@ public:
* Data for the best-matching pair of a desired and a supported locale.
* Movable but not copyable.
*
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Result : public UMemory {
public:
@ -198,14 +200,14 @@ public:
* This object will have the same contents that the source object had.
*
* @param src Result to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Result(Result &&src) U_NOEXCEPT;
/**
* Destructor.
*
* @draft ICU 65
* @stable ICU 65
*/
~Result();
@ -214,17 +216,16 @@ public:
* This object will have the same contents that the source object had.
*
* @param src Result to move contents from.
* @draft ICU 65
* @stable 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
* @stable ICU 65
*/
inline const Locale *getDesiredLocale() const { return desiredLocale; }
@ -235,7 +236,7 @@ public:
* or 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
* @stable ICU 65
*/
inline const Locale *getSupportedLocale() const { return supportedLocale; }
@ -244,7 +245,7 @@ public:
* -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
* @stable ICU 65
*/
inline int32_t getDesiredIndex() const { return desiredIndex; }
@ -256,7 +257,7 @@ public:
* -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
* @stable ICU 65
*/
inline int32_t getSupportedIndex() const { return supportedIndex; }
@ -270,10 +271,9 @@ public:
* <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
* @stable ICU 65
*/
Locale makeResolvedLocale(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
Result(const Locale *desired, const Locale *supported,
@ -298,7 +298,7 @@ public:
* LocaleMatcher builder.
* Movable but not copyable.
*
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Builder : public UMemory {
public:
@ -306,7 +306,7 @@ public:
* Constructs a builder used in chaining parameters for building a LocaleMatcher.
*
* @return a new Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder() {}
@ -315,14 +315,14 @@ public:
* This builder will have the same contents that the source builder had.
*
* @param src Builder to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Builder(Builder &&src) U_NOEXCEPT;
/**
* Destructor.
*
* @draft ICU 65
* @stable ICU 65
*/
~Builder();
@ -331,11 +331,10 @@ public:
* This builder will have the same contents that the source builder had.
*
* @param src Builder to move contents from.
* @draft ICU 65
* @stable 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>),
@ -345,7 +344,7 @@ public:
*
* @param locales the Accept-Language string of locales to set
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setSupportedLocalesFromListString(StringPiece locales);
@ -356,7 +355,7 @@ public:
*
* @param locales the list of locale
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setSupportedLocales(Locale::Iterator &locales);
@ -371,7 +370,7 @@ public:
* @param begin Start of range.
* @param end Exclusive end of range.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter>
Builder &setSupportedLocales(Iter begin, Iter end) {
@ -396,7 +395,7 @@ public:
* @param end Exclusive end of range.
* @param converter Converter from *begin to const Locale & or compatible.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter, typename Conv>
Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) {
@ -414,7 +413,7 @@ public:
*
* @param locale another locale
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &addSupportedLocale(const Locale &locale);
@ -438,7 +437,7 @@ public:
*
* @param defaultLocale the default locale (will be copied)
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setDefaultLocale(const Locale *defaultLocale);
@ -450,7 +449,7 @@ public:
*
* @param subtag the subtag to favor
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setFavorSubtag(ULocMatchFavorSubtag subtag);
@ -460,10 +459,11 @@ public:
*
* @param demotion the demotion per desired locale to set.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
#ifndef U_HIDE_DRAFT_API
/**
* Option for whether to include or ignore one-way (fallback) match data.
* By default, they are included.
@ -478,6 +478,7 @@ public:
}
return *this;
}
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DRAFT_API
/**
@ -512,7 +513,7 @@ public:
* and an error occurred while setting parameters.
* Otherwise unchanged.
* @return true if U_FAILURE(outErrorCode)
* @draft ICU 65
* @stable ICU 65
*/
UBool copyErrorTo(UErrorCode &outErrorCode) const;
@ -524,10 +525,9 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return LocaleMatcher
* @draft ICU 65
* @stable ICU 65
*/
LocaleMatcher build(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
friend class LocaleMatcher;
@ -556,13 +556,13 @@ public:
* 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
* @stable ICU 65
*/
LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
/**
* Destructor.
* @draft ICU 65
* @stable ICU 65
*/
~LocaleMatcher();
@ -572,11 +572,10 @@ public:
* The behavior is undefined if *this and src are the same object.
* @param src source matcher
* @return *this
* @draft ICU 65
* @stable ICU 65
*/
LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the supported locale which best matches the desired locale.
*
@ -585,7 +584,7 @@ public:
* 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
* @stable ICU 65
*/
const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const;
@ -597,7 +596,7 @@ public:
* 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
* @stable ICU 65
*/
const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
@ -613,7 +612,7 @@ public:
* 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
* @stable ICU 65
*/
const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const;
@ -627,7 +626,7 @@ public:
* 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
* @stable ICU 65
*/
Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const;
@ -641,10 +640,9 @@ public:
* 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
* @stable ICU 65
*/
Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DRAFT_API
/**
@ -718,6 +716,5 @@ private:
U_NAMESPACE_END
#endif // U_FORCE_HIDE_DRAFT_API
#endif // U_SHOW_CPLUSPLUS_API
#endif // __LOCALEMATCHER_H__

View file

@ -1009,32 +1009,31 @@ public:
*/
virtual UClassID getDynamicClassID() const;
#ifndef U_HIDE_DRAFT_API
/**
* A Locale iterator interface similar to a Java Iterator<Locale>.
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ {
public:
/** @draft ICU 65 */
/** @stable ICU 65 */
virtual ~Iterator();
/**
* @return true if next() can be called again.
* @draft ICU 65
* @stable ICU 65
*/
virtual UBool hasNext() const = 0;
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
virtual const Locale &next() = 0;
};
/**
* A generic Locale iterator implementation over Locale input iterators.
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter>
class RangeIterator : public Iterator, public UMemory {
@ -1046,19 +1045,19 @@ public:
*
* @param begin Start of range.
* @param end Exclusive end of range.
* @draft ICU 65
* @stable ICU 65
*/
RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
/**
* @return true if next() can be called again.
* @draft ICU 65
* @stable ICU 65
*/
UBool hasNext() const override { return it_ != end_; }
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale &next() override { return *it_++; }
@ -1070,7 +1069,7 @@ public:
/**
* A generic Locale iterator implementation over Locale input iterators.
* Calls the converter to convert each *begin to a const Locale &.
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter, typename Conv>
class ConvertingIterator : public Iterator, public UMemory {
@ -1083,20 +1082,20 @@ public:
* @param begin Start of range.
* @param end Exclusive end of range.
* @param converter Converter from *begin to const Locale & or compatible.
* @draft ICU 65
* @stable 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
* @stable ICU 65
*/
UBool hasNext() const override { return it_ != end_; }
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale &next() override { return converter_(*it_++); }
@ -1105,7 +1104,6 @@ public:
const Iter end_;
Conv converter_;
};
#endif // U_HIDE_DRAFT_API
protected: /* only protected for testing purposes. DO NOT USE. */
#ifndef U_HIDE_INTERNAL_API

View file

@ -111,7 +111,6 @@ class U_COMMON_API StringPiece : public UMemory {
#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:
@ -132,7 +131,7 @@ class U_COMMON_API StringPiece : public UMemory {
* as from std::u8string_view.
*
* @param str the other string piece
* @draft ICU 65
* @stable ICU 65
*/
template <typename T,
typename = typename std::enable_if<
@ -145,7 +144,6 @@ class U_COMMON_API StringPiece : public UMemory {
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.

View file

@ -97,14 +97,13 @@ 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
* @stable ICU 65
*/
uint64_t getState64() const {
return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
@ -123,14 +122,13 @@ public:
* @see getState64
* @see resetToState
* @see reset
* @draft ICU 65
* @stable 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

View file

@ -796,19 +796,17 @@ uloc_getAvailable(int32_t n);
*/
U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void);
#ifndef U_HIDE_DRAFT_API
/**
* Types for uloc_getAvailableByType and uloc_countAvailableByType.
*
* @draft ICU 65
* @stable ICU 65
*/
typedef enum ULocAvailableType {
/**
* Locales that return data when passed to ICU APIs,
* but not including legacy or alias locales.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOC_AVAILABLE_DEFAULT,
@ -826,7 +824,7 @@ typedef enum ULocAvailableType {
* ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
* ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
@ -834,7 +832,7 @@ typedef enum ULocAvailableType {
* The union of the locales in ULOC_AVAILABLE_DEFAULT and
* ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
@ -855,13 +853,11 @@ typedef enum ULocAvailableType {
* @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
* @stable ICU 65
*/
U_CAPI 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,

View file

@ -112,11 +112,9 @@ typedef enum UTraceFunctionNumber {
UTRACE_COLLATION_LIMIT,
#endif // U_HIDE_DEPRECATED_API
#ifndef U_HIDE_DRAFT_API
/**
* The lowest resource/data location.
* @draft ICU 65
* @stable ICU 65
*/
UTRACE_UDATA_START=0x3000,
@ -133,7 +131,7 @@ typedef enum UTraceFunctionNumber {
* - "get" (a path was loaded, but the value was not accessed)
* - "getalias" (a path was loaded, and an alias was resolved)
*
* @draft ICU 65
* @stable ICU 65
*/
UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START,
@ -141,7 +139,7 @@ typedef enum UTraceFunctionNumber {
* Indicates that a resource bundle was opened.
*
* Provides one C-style string to UTraceData: file name.
* @draft ICU 65
* @stable ICU 65
*/
UTRACE_UDATA_BUNDLE,
@ -150,7 +148,7 @@ typedef enum UTraceFunctionNumber {
*
* Provides one C-style string to UTraceData: file name.
*
* @draft ICU 65
* @stable ICU 65
*/
UTRACE_UDATA_DATA_FILE,
@ -163,12 +161,10 @@ typedef enum UTraceFunctionNumber {
*
* Provides one C-style string to UTraceData: file name.
*
* @draft ICU 65
* @stable 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.

View file

@ -25,7 +25,6 @@ namespace impl {
* A wrapper around LocalizedNumberFormatter implementing the Format interface, enabling improved
* compatibility with other APIs.
*
* @draft ICU 62
* @see NumberFormatter
*/
class U_I18N_API LocalizedNumberFormatterAsFormat : public Format {

View file

@ -2624,7 +2624,6 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
/** @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
@ -2641,11 +2640,10 @@ class U_I18N_API FormattedNumber : public UMemory, public FormattedValue {
* for example, std::string.
* @param status Set if an error occurs.
* @return A StringClass containing the numeric string.
* @draft ICU 65
* @stable ICU 65
*/
template<typename StringClass>
inline StringClass toDecimalNumber(UErrorCode& status) const;
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DRAFT_API
/**

View file

@ -175,19 +175,17 @@ typedef enum UDateAbsoluteUnit {
*/
UDAT_ABSOLUTE_QUARTER,
#ifndef U_HIDE_DRAFT_API
/**
* Hour
* @draft ICU 65
* @stable ICU 65
*/
UDAT_ABSOLUTE_HOUR,
/**
* Minute
* @draft ICU 65
* @stable ICU 65
*/
UDAT_ABSOLUTE_MINUTE,
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DEPRECATED_API
/**

View file

@ -662,8 +662,6 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
U_CAPI void U_EXPORT2
ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
#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
@ -691,13 +689,11 @@ ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
*
* @see #UCAL_UNKNOWN_ZONE_ID
*
* @draft ICU 65
* @stable ICU 65
*/
U_CAPI 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