xref: /haiku/docs/user/locale/DurationFormat.dox (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1/*
2 * Copyright 2011-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Adrien Destugues, pulkomandy@pulkomandy.ath.cx
7 *		John Scipione, jscipione@gmail.com
8 *
9 * Corresponds to:
10 *		headers/os/locale/DurationFormat.h	hrev48439
11 *		src/kits/locale/DurationFormat.cpp	hrev48439
12 */
13
14
15/*!
16	\file DurationFormat.h
17	\ingroup locale
18	\ingroup libbe
19	\brief Contains BDurationFormat class, a time interval formatter and parser.
20*/
21
22
23/*!
24	\class BDurationFormat
25	\ingroup locale
26	\ingroup libbe
27	\brief Formatter for time intervals.
28
29	BDurationFormat is a formatter for time intervals. A time interval is
30	defined by its start and end values, and the result is a string such as
31	"1 hour, 2 minutes, 28 seconds".
32
33	\since Haiku R1
34*/
35
36
37/*!
38	\fn BDurationFormat::BDurationFormat(const BLanguage& language,
39		const BFormattingConventions& conventions, const BString& separator,
40		const time_unit_style style)
41	\brief Constructor.
42
43	\warning Creating a BDurationFormat is a costly operation. Most of the
44	         time want to use the default one through the BLocale class.
45
46	\param language The language to use.
47	\param conventions The formatting conventions to use.
48	\param separator String appended between the duration elements.
49	\param style The time unit style to use.
50
51	\since Haiku R1
52*/
53
54
55/*!
56	\fn BDurationFormat::BDurationFormat(const BString& separator,
57		const time_unit_style style)
58	\brief Constructor.
59
60	\warning Creating a BDurationFormat is a costly operation. Most of the
61	         time want to use the default one through the BLocale class.
62
63	\param separator String appended between the duration elements.
64	\param style The time unit style to use.
65
66	\since Haiku R1
67*/
68
69
70/*!
71	\fn BDurationFormat::BDurationFormat(const BDurationFormat& other)
72	\brief Copy Constructor.
73
74	\param other The BDurationFormat object to copy from.
75
76	\since Haiku R1
77*/
78
79
80/*!
81	\fn BDurationFormat::~BDurationFormat()
82	\brief Destructor.
83
84	\since Haiku R1
85*/
86
87
88/*!
89	\fn void BDurationFormat::SetSeparator(const BString& separator)
90	\brief Replace the separator for this formatter.
91
92	\param separator The separator string to set.
93
94	\since Haiku R1
95*/
96
97
98/*!
99	\fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
100	\brief Sets the timezone for this formatter.
101
102	\param timeZone The BTimeZone object to set.
103
104	\returns A status code.
105	\retval B_OK Everything went fine.
106	\retval B_NO_INIT Format object is \c NULL.
107	\retval B_ERROR Other errors.
108
109	\since Haiku R1
110*/
111
112
113/*!
114	\fn status_t BDurationFormat::Format(BString& buffer, bigtime_t startValue,
115		bigtime_t stopValue) const
116	\brief Formats a duration defined by its start and end values.
117
118	The start and end values are in milliseconds. The result is appended to
119	the buffer. The full time style uses full words (hours, minutes, seconds),
120	while the short one uses units (h, m, s).
121
122	\param buffer The buffer to fill out.
123	\param startValue The start value in milliseconds.
124	\param stopValue The stop value in milliseconds.
125
126	\returns A status code.
127	\retval B_OK Everything went fine.
128	\retval B_BAD_VALUE \a buffer was \c NULL or invalid.
129	\retval B_ERROR Formatting error.
130
131	\since Haiku R1
132*/
133