xref: /haiku/headers/os/locale/DurationFormat.h (revision 6889394848e2dc9f41ff53b12141d572822ca0c6)
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
44 									) const;
45 
46 private:
47 			BString				fSeparator;
48 			BTimeUnitFormat		fTimeUnitFormat;
49 			U_ICU_NAMESPACE::GregorianCalendar*	fCalendar;
50 };
51 
52 
53 #endif
54