QSet<QByteArray> QIcuTimeZonePrivate::availableTimeZoneIds(QLocale::Country country) const
{
    QByteArray regionCode = QLocalePrivate::countryToCode(country).toUtf8();
    UErrorCode status = U_ZERO_ERROR;
    UEnumeration *uenum = ucal_openCountryTimeZones(regionCode, &status);
    QSet<QByteArray> set;
    if (U_SUCCESS(status))
        set = uenumToIdSet(uenum);
    uenum_close(uenum);
    return set;
}
Example #2
0
/**
 * call-seq:
 *     UCalendar.tz_for_country(country)
 *  
 * Returns array with all time zones associated with the given country.
 * Note: <code>country</code> must be value of type String.
 * Returned array content is UString's
 *
 *     UCalendar.tz_for_country("GB") # => [ "Europe/Belfast", "Europe/London", "GB",  "GB-Eire"]
 *
 */
VALUE icu4r_cal_country_tz (VALUE obj, VALUE ctry)
{
	UErrorCode  status = U_ZERO_ERROR;
	UEnumeration * zones ; 
	VALUE ret ;
	UChar * name;
	int32_t len;
	Check_Type(ctry, T_STRING);
	zones = ucal_openCountryTimeZones (RSTRING_PTR(ctry), &status) ;
	ICU_RAISE(status);
	ret = rb_ary_new();
	while( (name = (UChar*)uenum_unext(zones, &len, &status))) {
		rb_ary_push(ret, icu_ustr_new(name, len));
	}
	uenum_close(zones);
	return ret;
}