xref: /haiku/headers/os/locale/DurationFormat.h (revision fae7ea18b62865f5e1159e1678c851d3aa1ddce0)
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 namespace icu {
18 	class GregorianCalendar;
19 }
20 
21 
22 class BDurationFormat : public BFormat {
23 	typedef	BFormat				Inherited;
24 
25 public:
26 								BDurationFormat(const BLanguage& language,
27 									const BFormattingConventions& conventions,
28 									const BString& separator = ", ");
29 								BDurationFormat(
30 									const BString& separator = ", ");
31 								BDurationFormat(const BDurationFormat& other);
32 	virtual						~BDurationFormat();
33 
34 			void				SetSeparator(const BString& separator);
35 			status_t			SetTimeZone(const BTimeZone* timeZone);
36 
37 			status_t			Format(BString& buffer,
38 									const bigtime_t startValue,
39 									const bigtime_t stopValue,
40 									time_unit_style style = B_TIME_UNIT_FULL
41 									) const;
42 
43 private:
44 			BString				fSeparator;
45 			BTimeUnitFormat		fTimeUnitFormat;
46 			icu::GregorianCalendar*	fCalendar;
47 };
48 
49 
50 #endif
51