2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2009, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
2000-01-15 02:00:06 +00:00
|
|
|
********************************************************************/
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#ifndef _CALTZTST
|
|
|
|
#define _CALTZTST
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/unistr.h"
|
2001-10-08 23:26:58 +00:00
|
|
|
#include "unicode/calendar.h"
|
|
|
|
#include "unicode/datefmt.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "intltest.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class doesn't perform any tests, but provides utility methods to its subclasses.
|
|
|
|
**/
|
|
|
|
class CalendarTimeZoneTest : public IntlTest
|
|
|
|
{
|
2001-09-01 01:55:48 +00:00
|
|
|
public:
|
|
|
|
static void cleanup();
|
1999-08-16 21:50:52 +00:00
|
|
|
protected:
|
|
|
|
// Return true if the given status indicates failure. Also has the side effect
|
|
|
|
// of calling errln(). Msg should be of the form "Class::Method" in general.
|
2009-06-12 19:34:21 +00:00
|
|
|
UBool failure(UErrorCode status, const char* msg, UBool possibleDataError=FALSE);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// Utility method for formatting dates for printing; useful for Java->C++ conversion.
|
|
|
|
// Tries to mimic the Java Date.toString() format.
|
|
|
|
UnicodeString dateToString(UDate d);
|
|
|
|
UnicodeString& dateToString(UDate d, UnicodeString& str);
|
2003-08-15 18:23:37 +00:00
|
|
|
UnicodeString& dateToString(UDate d, UnicodeString& str, const TimeZone& z);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
// Utility methods to create a date. This is useful for converting Java constructs
|
|
|
|
// which create a Date object. Returns a Date in the current local time.
|
|
|
|
UDate date(int32_t y, int32_t m, int32_t d, int32_t hr=0, int32_t min=0, int32_t sec=0);
|
|
|
|
|
|
|
|
// Utility methods to create a date. Returns a Date in UTC. This will differ
|
|
|
|
// from local dates returned by date() by the current default zone offset.
|
|
|
|
// Date utcDate(int y, int m, int d, int hr=0, int min=0, int sec=0);
|
|
|
|
|
|
|
|
// Utility method to get the fields of a date; similar to Date.getYear() etc.
|
|
|
|
void dateToFields(UDate date, int32_t& y, int32_t& m, int32_t& d, int32_t& hr, int32_t& min, int32_t& sec);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static DateFormat* fgDateFormat;
|
|
|
|
static Calendar* fgCalendar;
|
|
|
|
|
|
|
|
// the 'get()' functions are not static because they can call errln().
|
|
|
|
// they are effectively static otherwise.
|
|
|
|
DateFormat* getDateFormat(void);
|
|
|
|
static void releaseDateFormat(DateFormat *f);
|
|
|
|
|
|
|
|
Calendar* getCalendar(void);
|
|
|
|
static void releaseCalendar(Calendar *c);
|
|
|
|
};
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif //_CALTZTST
|
|
|
|
//eof
|