1 /* 2 * Copyright 2010-2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _B_DURATION_FORMAT_H_ 6 #define _B_DURATION_FORMAT_H_ 7 8 9 #include <Format.h> 10 #include <String.h> 11 #include <TimeUnitFormat.h> 12 13 14 class BTimeZone; 15 16 namespace icu { 17 class GregorianCalendar; 18 } 19 20 21 class BDurationFormat : public BFormat { 22 typedef BFormat Inherited; 23 24 public: 25 BDurationFormat( 26 const BString& separator = ", "); 27 BDurationFormat(const BDurationFormat& other); 28 virtual ~BDurationFormat(); 29 30 BDurationFormat& operator=(const BDurationFormat& other); 31 32 void SetSeparator(const BString& separator); 33 34 virtual status_t SetLocale(const BLocale* locale); 35 status_t SetTimeZone(const BTimeZone* timeZone); 36 37 status_t Format(bigtime_t startValue, 38 bigtime_t stopValue, BString* buffer, 39 time_unit_style style = B_TIME_UNIT_FULL 40 ) const; 41 42 private: 43 BString fSeparator; 44 BTimeUnitFormat fTimeUnitFormat; 45 icu::GregorianCalendar* fCalendar; 46 }; 47 48 49 #endif 50