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 <Locale.h> 11 #include <String.h> 12 #include <TimeUnitFormat.h> 13 14 15 class BTimeZone; 16 17 #ifndef U_ICU_NAMESPACE 18 #define U_ICU_NAMESPACE icu 19 #endif 20 namespace U_ICU_NAMESPACE { 21 class GregorianCalendar; 22 } 23 24 25 class BDurationFormat : public BFormat { 26 typedef BFormat Inherited; 27 28 public: 29 BDurationFormat(const BLanguage& language, 30 const BFormattingConventions& conventions, 31 const BString& separator = ", "); 32 BDurationFormat( 33 const BString& separator = ", "); 34 BDurationFormat(const BDurationFormat& other); 35 virtual ~BDurationFormat(); 36 37 void SetSeparator(const BString& separator); 38 status_t SetTimeZone(const BTimeZone* timeZone); 39 40 status_t Format(BString& buffer, 41 const bigtime_t startValue, 42 const bigtime_t stopValue, 43 time_unit_style style = B_TIME_UNIT_FULL 44 ) const; 45 46 private: 47 BString fSeparator; 48 BTimeUnitFormat fTimeUnitFormat; 49 U_ICU_NAMESPACE::GregorianCalendar* fCalendar; 50 }; 51 52 53 #endif 54