xref: /haiku/docs/user/locale/DurationFormat.dox (revision d17092ceb18bf47a96dbaf8a1acf10e6e3070704)
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 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 void BDurationFormat::SetSeparator(const BString& separator)
70	\brief Replace the separator for this formatter.
71
72	\param separator The separator string to set.
73
74	\since Haiku R1
75*/
76
77
78/*!
79	\fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
80	\brief Sets the timezone for this formatter.
81
82	\param timeZone The BTimeZone object to set.
83
84	\returns A status code.
85	\retval B_OK Everything went fine.
86	\retval B_NO_INIT Format object is \c NULL.
87	\retval B_ERROR Other errors.
88
89	\since Haiku R1
90*/
91
92
93/*!
94	\fn status_t BDurationFormat::Format(bigtime_t startValue,
95		bigtime_t stopValue, BString* buffer, time_unit_style style) const
96	\brief Formats a duration defined by its start and end values.
97
98	The start and end values are in milliseconds. The result is appended to
99	the buffer. The full time style uses full words (hours, minutes, seconds),
100	while the short one uses units (h, m, s).
101
102	\param startValue The start value in milliseconds.
103	\param stopValue The stop value in milliseconds.
104	\param buffer The buffer to fill out.
105	\param style The time unit style to use.
106
107	\returns A status code.
108	\retval B_OK Everything went fine.
109	\retval B_BAD_VALUE \a buffer was \c NULL or invalid.
110	\retval B_ERROR Formatting error.
111
112	\since Haiku R1
113*/
114