scuffed-code/icu4c/source/samples/translit/main.cpp
Steven R. Loomis f68efa2bf8 ICU-1886 AIX fix, ambiguous call to format
X-SVN-Rev: 8594
2002-05-10 20:53:26 +00:00

64 lines
1.6 KiB
C++

#include "unicode/translit.h"
#include "unicode/rbt.h"
#include "unicode/unistr.h"
#include "unicode/calendar.h"
#include "unicode/datefmt.h"
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
int main(int argc, char **argv) {
Calendar *cal;
DateFormat *fmt;
DateFormat *defFmt;
UErrorCode status = U_ZERO_ERROR;
Locale greece("el", "GR");
UnicodeString str, str2;
// Create a calendar in the Greek locale
cal = Calendar::createInstance(greece, status);
check(status, "Calendar::createInstance");
// Create a formatter
fmt = DateFormat::createDateInstance(DateFormat::kFull, greece);
fmt->setCalendar(*cal);
// Create a default formatter
defFmt = DateFormat::createDateInstance(DateFormat::kFull);
defFmt->setCalendar(*cal);
// Loop over various months
for (int32_t month = Calendar::JANUARY;
month <= Calendar::DECEMBER;
++month) {
// Set the calendar to a date
cal->clear();
cal->set(1999, month, 4);
// Format the date in default locale
str.remove();
defFmt->format((Formattable)cal->getTime(status), str, status);
check(status, "DateFormat::format");
printf("Date: ");
uprintf(escape(str));
printf("\n");
// Format the date for Greece
str.remove();
fmt->format((Formattable)cal->getTime(status), str, status);
check(status, "DateFormat::format");
printf("Greek formatted date: ");
uprintf(escape(str));
printf("\n\n");
}
// Clean up
delete fmt;
delete cal;
printf("Exiting successfully\n");
return 0;
}