Logo Search packages:      
Sourcecode: icu version File versions  Download package

udatpg.h File Reference


Detailed Description

C API: Wrapper for DateTimePatternGenerator (unicode/dtptngen.h).

UDateTimePatternGenerator provides flexible generation of date format patterns, like "yy-MM-dd". The user can build up the generator by adding successive patterns. Once that is done, a query can be made using a "skeleton", which is a pattern which just includes the desired fields and lengths. The generator will return the "best fit" pattern corresponding to that skeleton.

The main method people will use is udatpg_getBestPattern, since normally UDateTimePatternGenerator is pre-built with data from a particular locale. However, generators can be built directly from other data as well.

Issue: may be useful to also have a function that returns the list of fields in a pattern, in order, since we have that internally. That would be useful for getting the UI order of field elements.

Definition in file udatpg.h.

#include "unicode/utypes.h"
#include "unicode/uenum.h"
#include "unicode/localpointer.h"

Go to the source code of this file.

Typedefs

typedef void * UDateTimePatternGenerator

Enumerations

enum  UDateTimePatternConflict { UDATPG_NO_CONFLICT, UDATPG_BASE_CONFLICT, UDATPG_CONFLICT, UDATPG_CONFLICT_COUNT }
enum  UDateTimePatternField {
  UDATPG_ERA_FIELD, UDATPG_YEAR_FIELD, UDATPG_QUARTER_FIELD, UDATPG_MONTH_FIELD,
  UDATPG_WEEK_OF_YEAR_FIELD, UDATPG_WEEK_OF_MONTH_FIELD, UDATPG_WEEKDAY_FIELD, UDATPG_DAY_OF_YEAR_FIELD,
  UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_DAY_FIELD, UDATPG_DAYPERIOD_FIELD, UDATPG_HOUR_FIELD,
  UDATPG_MINUTE_FIELD, UDATPG_SECOND_FIELD, UDATPG_FRACTIONAL_SECOND_FIELD, UDATPG_ZONE_FIELD,
  UDATPG_FIELD_COUNT
}
enum  UDateTimePatternMatchOptions { UDATPG_MATCH_NO_OPTIONS = 0, UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD, UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1 }

Functions

U_DRAFT
UDateTimePatternConflict
U_EXPORT2 
udatpg_addPattern (UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, UBool override, UChar *conflictingPattern, int32_t capacity, int32_t *pLength, UErrorCode *pErrorCode)
U_DRAFT
UDateTimePatternGenerator
*U_EXPORT2 
udatpg_clone (const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
U_DRAFT void U_EXPORT2 udatpg_close (UDateTimePatternGenerator *dtpg)
U_DRAFT const UChar *U_EXPORT2 udatpg_getAppendItemFormat (const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
U_DRAFT const UChar *U_EXPORT2 udatpg_getAppendItemName (const UDateTimePatternGenerator *dtpg, UDateTimePatternField field, int32_t *pLength)
U_DRAFT int32_t U_EXPORT2 udatpg_getBaseSkeleton (UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t length, UChar *baseSkeleton, int32_t capacity, UErrorCode *pErrorCode)
U_DRAFT int32_t U_EXPORT2 udatpg_getBestPattern (UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UChar *bestPattern, int32_t capacity, UErrorCode *pErrorCode)
U_DRAFT int32_t U_EXPORT2 udatpg_getBestPatternWithOptions (UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t length, UDateTimePatternMatchOptions options, UChar *bestPattern, int32_t capacity, UErrorCode *pErrorCode)
U_DRAFT const UChar *U_EXPORT2 udatpg_getDateTimeFormat (const UDateTimePatternGenerator *dtpg, int32_t *pLength)
U_DRAFT const UChar *U_EXPORT2 udatpg_getDecimal (const UDateTimePatternGenerator *dtpg, int32_t *pLength)
U_DRAFT const UChar *U_EXPORT2 udatpg_getPatternForSkeleton (const UDateTimePatternGenerator *dtpg, const UChar *skeleton, int32_t skeletonLength, int32_t *pLength)
U_DRAFT int32_t U_EXPORT2 udatpg_getSkeleton (UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t length, UChar *skeleton, int32_t capacity, UErrorCode *pErrorCode)
U_DRAFT
UDateTimePatternGenerator
*U_EXPORT2 
udatpg_open (const char *locale, UErrorCode *pErrorCode)
U_DRAFT UEnumeration *U_EXPORT2 udatpg_openBaseSkeletons (const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
U_DRAFT
UDateTimePatternGenerator
*U_EXPORT2 
udatpg_openEmpty (UErrorCode *pErrorCode)
U_DRAFT UEnumeration *U_EXPORT2 udatpg_openSkeletons (const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode)
U_DRAFT int32_t U_EXPORT2 udatpg_replaceFieldTypes (UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode)
U_DRAFT int32_t U_EXPORT2 udatpg_replaceFieldTypesWithOptions (UDateTimePatternGenerator *dtpg, const UChar *pattern, int32_t patternLength, const UChar *skeleton, int32_t skeletonLength, UDateTimePatternMatchOptions options, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode)
U_DRAFT void U_EXPORT2 udatpg_setAppendItemFormat (UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
U_DRAFT void U_EXPORT2 udatpg_setAppendItemName (UDateTimePatternGenerator *dtpg, UDateTimePatternField field, const UChar *value, int32_t length)
U_DRAFT void U_EXPORT2 udatpg_setDateTimeFormat (const UDateTimePatternGenerator *dtpg, const UChar *dtFormat, int32_t length)
U_DRAFT void U_EXPORT2 udatpg_setDecimal (UDateTimePatternGenerator *dtpg, const UChar *decimal, int32_t length)


Generated by  Doxygen 1.6.0   Back to index