From: Deborah G. <gol...@ap...> - 2006-05-19 17:26:37
|
OK, since there were no further comments, here is the revised C version of the Flexible Datetime API. Mark will revise the ICU4J version when he returns from vacation. Feedback is welcome. The descriptions are somewhat short here, and will be fleshed out when I actually implement it. :-) If there is something you don't understand, ask here, or refer to the ICU4J version. Deborah typedef void *UDatePatternGenerator; enum UDateSkeletonField { USKEL_ERA_FIELD = 0, USKEL_YEAR_FIELD = 1, USKEL_QUARTER_FIELD = 2, USKEL_MONTH_FIELD = 3, USKEL_WEEK_OF_YEAR_FIELD = 4, USKEL_WEEK_OF_MONTH_FIELD = 5, USKEL_WEEKDAY_FIELD = 6, USKEL_DAY_FIELD = 7, USKEL_DAY_OF_YEAR_FIELD = 8, USKEL_DAY_OF_WEEK_IN_MONTH_FIELD = 9, USKEL_DAYPERIOD_FIELD = 10, USKEL_HOUR_FIELD = 11, USKEL_MINUTE_FIELD = 12, USKEL_SECOND_FIELD = 13, USKEL_FRACTIONAL_SECOND_FIELD = 14, USKEL_ZONE_FIELD = 15, USKEL_TYPE_LIMIT = 16 }; /** * Open a new UDatePatternGenerator based on a locale */ UDatePatternGenerator * udpg_open(const char *locale, UErrorCode *status); /** * Open a new UDatePatternGenerator to be filled in with udpg_addPattern and other calls. */ UDatePatternGenerator * udpg_openEmpty(UErrorCode *status); /** * Close an open UDatePatternGenerator */ void udpg_close(UDatePatternGenerator *dpg); /** * Get the best pattern for the supplied skeleton. Returns the actual length of the * pattern. */ int32_t udpg_getBestPattern(UDatePatternGenerator *dpg, const UChar *skeleton, int32_t skeletonLength, UChar *result, int32_t resultLength, UErrorCode *status); /** * Add a pattern to an existing UDatePatternGenerator. There may be a conflict with an existing * pattern that has the same skeleton. If override is true, the new pattern will replace the old; * in either case, the length of the conflicting pattern (if any) is returned. If an output * buffer is supplied, the conflicting pattern is also returned. */ int32_t udpg_addPattern(UDatePatternGenerator *dpg, const UChar *pattern, int32_t patternLength, UBool override, UChar *conflicting, int32_t conflictingLength, UErrorCode *status); /** * Get the appendItemFormat for the given field. */ int32_t udpg_getAppendItemFormats(const UDatePatternGenerator *dpg, UDateSkeletonField field, UChar *result, int32_t resultLength, UErrorCode *status); /** * Set the appendItemFormat for the given field. */ void udpg_setAppendItemFormats(UDatePatternGenerator *dpg, UDateSkeletonField field, const UChar *format, int32_t formatLength, UErrorCode *status); /** * Get the appendItemName for the given field. */ int32_t udpg_getAppendItemNames(const UDatePatternGenerator *dpg, UDateSkeletonField field, UChar *result, int32_t resultLength, UErrorCode *status); /** * Set the appendItemName for the given field. */ void udpf_setAppendItemNames(UDatePatternGenerator *dpg, UDateSkeletonField field, const UChar *name, int32_t nameLength, UErrorCode *status); /** * Get the format used to compose separate date and time formats when there is not a combined * pattern that matches the desired skeleton. */ int32_t udpg_getDateTimeFormat(const UDatePatternGenerator *dpg, UChar *result, int32_t resultLength, UErrorCode *status); /** * Set the format used to compose separate date and time formats. */ void udpg_setDateTimeFormat(UDatePatternGenerator *dpg, const UChar *format, int32_t formatLength, UErrorCode *status); /** * Get the number formatter associated with the pattern generator. This is used to determine the decimal separator for fractional seconds. */ UNumberFormat * udpg_getNumberFormat(UDatePatternGenerator *dpg, UErrorCode *status); /** * Set the number formatter associated with the pattern generator. This is used to determine the decimal separator for fractional seconds. The caller retains ownership of the UNumberFormat. */ void udpg_setNumberFormat(UDatePatternGenerator *dpg, UNumberFormat *format, UErrorCode *status); /** * Convert a date/time pattern into the corresponding skeleton. */ int32_t udpg_getSkeleton(const UChar *pattern, int32_t patternLength, UChar *result, int32_t resultLength, UErrorCode *status); /** * Return an enumeration over the redundant patterns (those that, if removed, make no * difference in the result returned by udpg_getBestPattern). */ UEnumeration * udpg_openRedundants(UDatePatternGenerator *dpg, UErrorCode *status); /** * Return an enumeration over all the skeletons supported by the UDatePatternGenerator */ UEnumeration * udpg_openSkeletons(UDatePatternGenerator *dpg, UErrorCode *status); /** * Return the pattern corresponding to a given skeleton, if any. */ int32_t udpg_getPatternFor(const UDatePatternGenerator *dpg, const UChar *skeleton, int32_t skeletonLength, UChar *result, int32_t resultLength, UErrorCode *status); ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ icu-design mailing list icu...@li... To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-design |