+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
********************************************************************************
- * Copyright (C) 1997-2014, International Business Machines
+ * Copyright (C) 1997-2016, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
* \brief C++ API: Abstract class for converting dates.
*/
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
class TimeZone;
class DateTimePatternGenerator;
// explicit template instantiation. see digitlst.h
-#if defined (_MSC_VER)
+// (When building DLLs for Windows this is required.)
+#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API EnumSet<UDateFormatBooleanAttribute,
0,
UDAT_BOOLEAN_ATTRIBUTE_COUNT>;
EStyle timeStyle = kDefault,
const Locale& aLocale = Locale::getDefault());
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Returns the best pattern given a skeleton and locale.
+ * @param locale the locale
+ * @param skeleton the skeleton
+ * @param status ICU error returned here
+ * @return the best pattern.
+ * @internal For ICU use only.
+ */
+ static UnicodeString getBestPattern(
+ const Locale &locale,
+ const UnicodeString &skeleton,
+ UErrorCode &status);
+#endif /* U_HIDE_INTERNAL_API */
+
+ /**
+ * Creates a date/time formatter for the given skeleton and
+ * default locale.
+ *
+ * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
+ * be in any order, and this method uses the locale to
+ * map the skeleton to a pattern that includes locale
+ * specific separators with the fields in the appropriate
+ * order for that locale.
+ * @param status Any error returned here.
+ * @return A date/time formatter which the caller owns.
+ * @stable ICU 55
+ */
+ static DateFormat* U_EXPORT2 createInstanceForSkeleton(
+ const UnicodeString& skeleton,
+ UErrorCode &status);
+
+ /**
+ * Creates a date/time formatter for the given skeleton and locale.
+ *
+ * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
+ * be in any order, and this method uses the locale to
+ * map the skeleton to a pattern that includes locale
+ * specific separators with the fields in the appropriate
+ * order for that locale.
+ * @param locale The given locale.
+ * @param status Any error returned here.
+ * @return A date/time formatter which the caller owns.
+ * @stable ICU 55
+ */
+ static DateFormat* U_EXPORT2 createInstanceForSkeleton(
+ const UnicodeString& skeleton,
+ const Locale &locale,
+ UErrorCode &status);
+
+ /**
+ * Creates a date/time formatter for the given skeleton and locale.
+ *
+ * @param calendarToAdopt the calendar returned DateFormat is to use.
+ * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can
+ * be in any order, and this method uses the locale to
+ * map the skeleton to a pattern that includes locale
+ * specific separators with the fields in the appropriate
+ * order for that locale.
+ * @param locale The given locale.
+ * @param status Any error returned here.
+ * @return A date/time formatter which the caller owns.
+ * @stable ICU 55
+ */
+ static DateFormat* U_EXPORT2 createInstanceForSkeleton(
+ Calendar *calendarToAdopt,
+ const UnicodeString& skeleton,
+ const Locale &locale,
+ UErrorCode &status);
+
+
/**
* Gets the set of locales for which DateFormats are installed.
* @param count Filled in with the number of locales in the list that is returned.
virtual void setLenient(UBool lenient);
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Returns whether date/time parsing in the encapsulated Calendar object processing is lenient.
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual UBool isCalendarLenient(void) const;
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Specifies whether encapsulated Calendar date/time parsing is to be lenient. With
* lenient parsing, the parser may use heuristics to interpret inputs that
* inputs must match this object's format more closely.
* @param lenient when true, parsing is lenient
* @see com.ibm.icu.util.Calendar#setLenient
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual void setCalendarLenient(UBool lenient);
*/
virtual void setTimeZone(const TimeZone& zone);
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Set a particular UDisplayContext value in the formatter, such as
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE.
* @param status Input/output status. If at entry this indicates a failure
* status, the function will do nothing; otherwise this will be
* updated with any new status from the function.
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual void setContext(UDisplayContext value, UErrorCode& status);
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Get the formatter's UDisplayContext value for the specified UDisplayContextType,
* such as UDISPCTX_TYPE_CAPITALIZATION.
* status, the function will do nothing; otherwise this will be
* updated with any new status from the function.
* @return The UDisplayContextValue for the specified type.
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const;
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Sets an boolean attribute on this DateFormat.
* May return U_UNSUPPORTED_ERROR if this instance does not support
* @param newvalue new value
* @param status the error type
* @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) )
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual DateFormat& U_EXPORT2 setBooleanAttribute(UDateFormatBooleanAttribute attr,
UBool newvalue,
UErrorCode &status);
- /* Cannot use #ifndef U_HIDE_DRAFT_API for the following draft method since it is virtual */
/**
* Returns a boolean from this DateFormat
* May return U_UNSUPPORTED_ERROR if this instance does not support
* @param attr the attribute to set
* @param status the error type
* @return the attribute value. Undefined if there is an error.
- * @draft ICU 53
+ * @stable ICU 53
*/
virtual UBool U_EXPORT2 getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &status) const;
private:
+
/**
* Gets the date/time formatter with the given formatting styles for the
* given locale.
UDisplayContext fCapitalizationContext;
+ friend class DateFmtKeyByStyle;
public:
#ifndef U_HIDE_OBSOLETE_API
};
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
#endif /* #if !UCONFIG_NO_FORMATTING */