xref: /haiku/docs/user/locale/DurationFormat.dox (revision f648efd3d411e5d5590b586091e5cb75da896cfd)
1/*
2 * Copyright 2011 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	 hrev45084
11 *		src/kits/locale/DurationFormat.cpp	 hrev45084
12 */
13
14
15/*!
16	\file DurationFormat.h
17	\ingroup locale
18	\ingroup libbe
19	\brief Contains BDurationFormat class, a time interval formatter.
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 BString& separator)
39	\brief Constructor.
40
41	\warning Creating a BDurationFormat is a costly operation. Most of the
42	         time want to use the default one through the BLocale class.
43
44	\param separator String appended between the duration elements.
45
46	\since Haiku R1
47*/
48
49
50/*!
51	\fn BDurationFormat::BDurationFormat(const BDurationFormat& other)
52	\brief Copy Constructor.
53
54	\param other The BDurationFormat object to copy from.
55
56	\since Haiku R1
57*/
58
59
60/*!
61	\fn BDurationFormat::~BDurationFormat()
62	\brief Destructor.
63
64	\since Haiku R1
65*/
66
67
68/*!
69	\fn BDurationFormat& BDurationFormat::operator=(const BDurationFormat& other)
70	\brief Assignment overload.
71
72	\param other The BDurationFormat object to copy from.
73
74	\returns The resulting BDurationFormat object.
75
76	\since Haiku R1
77*/
78
79
80/*!
81	\fn void BDurationFormat::SetSeparator(const BString& separator)
82	\brief Replace the separator for this formatter.
83
84	\param separator The separator string to set.
85
86	\since Haiku R1
87*/
88
89
90/*!
91	\fn status_t BDurationFormat::SetLocale(const BLocale* locale)
92	\brief Sets the locale for this formatter.
93
94	\param locale The BLocale object to set.
95
96	\returns A status code, \c B_OK on success or an error code on error.
97
98	\since Haiku R1
99*/
100
101
102/*!
103	\fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
104	\brief Sets the timezone for this formatter.
105
106	\param timeZone The BTimeZone object to set.
107
108	\returns A status code.
109	\retval B_OK Everything went fine.
110	\retval B_NO_INIT Format object is \c NULL.
111	\retval B_ERROR Other errors.
112
113	\since Haiku R1
114*/
115
116
117/*!
118	\fn status_t BDurationFormat::Format(bigtime_t startValue,
119		bigtime_t stopValue, BString* buffer, time_unit_style style) const
120	\brief Formats a duration defined by its start and end values.
121
122	The start and end values are in milliseconds. The result is appended to
123	the buffer. The full time style uses full words (hours, minutes, seconds),
124	while the short one uses units (h, m, s).
125
126	\param startValue The start value in milliseconds.
127	\param stopValue The stop value in milliseconds.
128	\param buffer The buffer to fill out.
129	\param style The time unit style to use.
130
131	\returns A status code.
132	\retval B_OK Everything went fine.
133	\retval B_BAD_VALUE Buffer was \c NULL.
134	\retval B_ERROR Formatting error.
135
136	\since Haiku R1
137*/
138