]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/caltztst.h
1 /********************************************************************
3 * Copyright (c) 1997-2009, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_FORMATTING
15 #include "unicode/unistr.h"
16 #include "unicode/calendar.h"
17 #include "unicode/datefmt.h"
21 * This class doesn't perform any tests, but provides utility methods to its subclasses.
23 class CalendarTimeZoneTest
: public IntlTest
26 static void cleanup();
28 // Return true if the given status indicates failure. Also has the side effect
29 // of calling errln(). Msg should be of the form "Class::Method" in general.
30 UBool
failure(UErrorCode status
, const char* msg
, UBool possibleDataError
=FALSE
);
32 // Utility method for formatting dates for printing; useful for Java->C++ conversion.
33 // Tries to mimic the Java Date.toString() format.
34 UnicodeString
dateToString(UDate d
);
35 UnicodeString
& dateToString(UDate d
, UnicodeString
& str
);
36 UnicodeString
& dateToString(UDate d
, UnicodeString
& str
, const TimeZone
& z
);
38 // Utility methods to create a date. This is useful for converting Java constructs
39 // which create a Date object. Returns a Date in the current local time.
40 UDate
date(int32_t y
, int32_t m
, int32_t d
, int32_t hr
=0, int32_t min
=0, int32_t sec
=0);
42 // Utility methods to create a date. Returns a Date in UTC. This will differ
43 // from local dates returned by date() by the current default zone offset.
44 // Date utcDate(int y, int m, int d, int hr=0, int min=0, int sec=0);
46 // Utility method to get the fields of a date; similar to Date.getYear() etc.
47 void dateToFields(UDate date
, int32_t& y
, int32_t& m
, int32_t& d
, int32_t& hr
, int32_t& min
, int32_t& sec
);
50 static DateFormat
* fgDateFormat
;
51 static Calendar
* fgCalendar
;
53 // the 'get()' functions are not static because they can call errln().
54 // they are effectively static otherwise.
55 DateFormat
* getDateFormat(void);
56 static void releaseDateFormat(DateFormat
*f
);
58 Calendar
* getCalendar(void);
59 static void releaseCalendar(Calendar
*c
);
62 #endif /* #if !UCONFIG_NO_FORMATTING */