Loading...
Searching...
No Matches
udateintervalformat.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************************
* Copyright (C) 2010-2012,2015 International Business Machines
* Corporation and others. All Rights Reserved.
*****************************************************************************************
*/
#ifndef UDATEINTERVALFORMAT_H
#define UDATEINTERVALFORMAT_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/ucal.h"
#include "unicode/umisc.h"
#include "unicode/uformattedvalue.h"
#include "unicode/udisplaycontext.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/localpointer.h"
#endif // U_SHOW_CPLUSPLUS_API
struct UDateIntervalFormat;
typedef struct UDateIntervalFormat UDateIntervalFormat;
struct UFormattedDateInterval;
typedef struct UFormattedDateInterval UFormattedDateInterval;
U_CAPI UDateIntervalFormat* U_EXPORT2
udtitvfmt_open(const char* locale,
const UChar* skeleton,
int32_t skeletonLength,
const UChar* tzID,
int32_t tzIDLength,
UErrorCode* status);
U_CAPI void U_EXPORT2
udtitvfmt_close(UDateIntervalFormat *formatter);
U_CAPI UFormattedDateInterval* U_EXPORT2
udtitvfmt_openResult(UErrorCode* ec);
U_CAPI const UFormattedValue* U_EXPORT2
udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
U_CAPI void U_EXPORT2
udtitvfmt_closeResult(UFormattedDateInterval* uresult);
#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close);
U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
U_NAMESPACE_END
#endif
U_CAPI int32_t U_EXPORT2
udtitvfmt_format(const UDateIntervalFormat* formatter,
UDate fromDate,
UDate toDate,
UChar* result,
int32_t resultCapacity,
UFieldPosition* position,
UErrorCode* status);
U_CAPI void U_EXPORT2
udtitvfmt_formatToResult(
const UDateIntervalFormat* formatter,
UDate fromDate,
UDate toDate,
UFormattedDateInterval* result,
UErrorCode* status);
U_CAPI void U_EXPORT2
udtitvfmt_formatCalendarToResult(
const UDateIntervalFormat* formatter,
UCalendar* fromCalendar,
UCalendar* toCalendar,
UFormattedDateInterval* result,
UErrorCode* status);
U_CAPI void U_EXPORT2
udtitvfmt_setContext(UDateIntervalFormat* formatter, UDisplayContext value, UErrorCode* status);
U_CAPI UDisplayContext U_EXPORT2
udtitvfmt_getContext(const UDateIntervalFormat* formatter, UDisplayContextType type, UErrorCode* status);
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif
LocalUDateIntervalFormatPointer
"Smart pointer" class, closes a UDateIntervalFormat via udtitvfmt_close().
LocalUFormattedDateIntervalPointer
"Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition localpointer.h:548
UFieldPosition
A struct representing a range of text containing a specific field.
Definition umisc.h:34
ucal.h
C API: Calendar.
UCalendar
void * UCalendar
A calendar.
Definition ucal.h:172
udtitvfmt_openResult
U_CAPI UFormattedDateInterval * udtitvfmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a UDateIntervalFormat operation.
udtitvfmt_open
U_CAPI UDateIntervalFormat * udtitvfmt_open(const char *locale, const UChar *skeleton, int32_t skeletonLength, const UChar *tzID, int32_t tzIDLength, UErrorCode *status)
Open a new UDateIntervalFormat object using the predefined rules for a given locale plus a specified ...
udtitvfmt_resultAsValue
U_CAPI const UFormattedValue * udtitvfmt_resultAsValue(const UFormattedDateInterval *uresult, UErrorCode *ec)
Returns a representation of a UFormattedDateInterval as a UFormattedValue, which can be subsequently ...
UFormattedDateInterval
struct UFormattedDateInterval UFormattedDateInterval
Opaque struct to contain the results of a UDateIntervalFormat operation.
Definition udateintervalformat.h:95
udtitvfmt_setContext
U_CAPI void udtitvfmt_setContext(UDateIntervalFormat *formatter, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
udtitvfmt_getContext
U_CAPI UDisplayContext udtitvfmt_getContext(const UDateIntervalFormat *formatter, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
udtitvfmt_format
U_CAPI int32_t udtitvfmt_format(const UDateIntervalFormat *formatter, UDate fromDate, UDate toDate, UChar *result, int32_t resultCapacity, UFieldPosition *position, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
udtitvfmt_close
U_CAPI void udtitvfmt_close(UDateIntervalFormat *formatter)
Close a UDateIntervalFormat object.
UDateIntervalFormat
struct UDateIntervalFormat UDateIntervalFormat
C typedef for struct UDateIntervalFormat.
Definition udateintervalformat.h:88
udtitvfmt_formatToResult
U_CAPI void 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.
udtitvfmt_formatCalendarToResult
U_CAPI void udtitvfmt_formatCalendarToResult(const UDateIntervalFormat *formatter, UCalendar *fromCalendar, UCalendar *toCalendar, UFormattedDateInterval *result, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
udtitvfmt_closeResult
U_CAPI void udtitvfmt_closeResult(UFormattedDateInterval *uresult)
Releases the UFormattedDateInterval created by udtitvfmt_openResult().
udisplaycontext.h
C API: Display context types (enum values).
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition udisplaycontext.h:64
uformattedvalue.h
C API: Abstract operations for localized strings.
UFormattedValue
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
Definition uformattedvalue.h:368
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:400
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
umisc.h
C API: Miscellaneous definitions.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:509
UDate
double UDate
Date and Time data type.
Definition utypes.h:218