xref: /haiku/headers/os/locale/DurationFormat.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
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 									const time_unit_style style = B_TIME_UNIT_FULL);
33 								BDurationFormat(const BString& separator = ", ",
34 									const time_unit_style style = B_TIME_UNIT_FULL);
35 								BDurationFormat(const BDurationFormat& other);
36 	virtual						~BDurationFormat();
37 
38 			void				SetSeparator(const BString& separator);
39 			status_t			SetTimeZone(const BTimeZone* timeZone);
40 
41 			status_t			Format(BString& buffer,
42 									const bigtime_t startValue,
43 									const bigtime_t stopValue) const;
44 
45 private:
46 			BString				fSeparator;
47 			BTimeUnitFormat		fTimeUnitFormat;
48 			U_ICU_NAMESPACE::GregorianCalendar*	fCalendar;
49 };
50 
51 
52 #endif
53