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