home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / caltztst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-07  |  2.9 KB  |  73 lines

  1. /*
  2. ********************************************************************************
  3. *                                                                              *
  4. * COPYRIGHT:                                                                   *
  5. *   (C) Copyright Taligent, Inc.,  1997                                        *
  6. *   (C) Copyright International Business Machines Corporation,  1997-1998      *
  7. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  10. *                                                                              *
  11. ********************************************************************************
  12. *
  13. * File CALTZTST.H
  14. *
  15. * Modification History:
  16. *
  17. *   Date        Name        Description
  18. *   08/06/97    aliu        Creation.
  19. ********************************************************************************
  20. */
  21.  
  22. #ifndef _CALTZTST
  23. #define _CALTZTST
  24.  
  25. #include "utypes.h"
  26. #include "unistr.h"
  27. #include "intltest.h"
  28. class SimpleDateFormat;
  29. class DateFormat;
  30. class Calendar;
  31.  
  32. /** 
  33.  * This class doesn't perform any tests, but provides utility methods to its subclasses.
  34.  **/
  35. class CalendarTimeZoneTest : public IntlTest
  36. {
  37. protected:
  38.     // Return true if the given status indicates failure.  Also has the side effect
  39.     // of calling errln().  Msg should be of the form "Class::Method" in general.
  40.     bool_t failure(UErrorCode status, const char* msg);
  41.  
  42.     // Utility method for formatting dates for printing; useful for Java->C++ conversion.
  43.     // Tries to mimic the Java Date.toString() format.
  44.     UnicodeString  dateToString(UDate d);
  45.     UnicodeString& dateToString(UDate d, UnicodeString& str);
  46.  
  47.     // Utility methods to create a date.  This is useful for converting Java constructs
  48.     // which create a Date object.  Returns a Date in the current local time.
  49.     UDate date(int32_t y, int32_t m, int32_t d, int32_t hr=0, int32_t min=0, int32_t sec=0);
  50.  
  51.     // Utility methods to create a date.  Returns a Date in UTC.  This will differ
  52.     // from local dates returned by date() by the current default zone offset.
  53. //  Date utcDate(int y, int m, int d, int hr=0, int min=0, int sec=0);  
  54.  
  55.     // Utility method to get the fields of a date; similar to Date.getYear() etc.
  56.     void dateToFields(UDate date, int32_t& y, int32_t& m, int32_t& d, int32_t& hr, int32_t& min, int32_t& sec);
  57.  
  58. protected:
  59.     static DateFormat*         fgDateFormat;
  60.     static Calendar*           fgCalendar;
  61.  
  62.     // the 'get()' functions are not static because they can call errln().
  63.     // they are effectively static otherwise.
  64.      DateFormat*               getDateFormat(void);
  65.     static void                releaseDateFormat(DateFormat *f);
  66.  
  67.      Calendar*                 getCalendar(void);
  68.     static void                releaseCalendar(Calendar *c);
  69. };
  70.  
  71. #endif //_CALTZTST
  72. //eof
  73.