xref: /haiku/docs/user/locale/DurationFormat.dox (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1c6478376SAdrien Destugues/*
2*820dca4dSJohn Scipione * Copyright 2011 Haiku, Inc. 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
793ebe763SJohn Scipione *		John Scipione, jscipione@gmail.com
8c6478376SAdrien Destugues *
9c6478376SAdrien Destugues * Corresponds to:
10*820dca4dSJohn Scipione *		headers/os/locale/DurationFormat.h	 hrev45084
11*820dca4dSJohn Scipione *		src/kits/locale/DurationFormat.cpp	 hrev45084
12*820dca4dSJohn Scipione */
13*820dca4dSJohn Scipione
14*820dca4dSJohn Scipione
15*820dca4dSJohn Scipione/*!
16*820dca4dSJohn Scipione	\file DurationFormat.h
17*820dca4dSJohn Scipione	\ingroup locale
18*820dca4dSJohn Scipione	\ingroup libbe
19*820dca4dSJohn Scipione	\brief Contains BDurationFormat class, a time interval formatter.
20c6478376SAdrien Destugues*/
21c6478376SAdrien Destugues
22c6478376SAdrien Destugues
23c6478376SAdrien Destugues/*!
24c6478376SAdrien Destugues	\class BDurationFormat
25c6478376SAdrien Destugues	\ingroup locale
2693ebe763SJohn Scipione	\ingroup libbe
2793ebe763SJohn Scipione	\brief Formatter for time intervals.
28c6478376SAdrien Destugues
2993ebe763SJohn Scipione	BDurationFormat is a formatter for time intervals. A time interval is
3093ebe763SJohn Scipione	defined by its start and end values, and the result is a string such as
31c6478376SAdrien Destugues	"1 hour, 2 minutes, 28 seconds".
32c6478376SAdrien Destugues*/
33c6478376SAdrien Destugues
34c6478376SAdrien Destugues
35c6478376SAdrien Destugues/*!
36c6478376SAdrien Destugues	\fn BDurationFormat::BDurationFormat(const BString& separator)
37c6478376SAdrien Destugues	\brief Constructor.
38c6478376SAdrien Destugues
3993ebe763SJohn Scipione	\warning Creating a BDurationFormat is a costly operation. Most of the
4093ebe763SJohn Scipione		time want to use the default one through the BLocale class.
41c6478376SAdrien Destugues
4293ebe763SJohn Scipione	\param separator String appended between the duration elements.
43c6478376SAdrien Destugues*/
44c6478376SAdrien Destugues
45c6478376SAdrien Destugues
46c6478376SAdrien Destugues/*!
4793ebe763SJohn Scipione	\fn BDurationFormat::BDurationFormat(const BDurationFormat& other)
4893ebe763SJohn Scipione	\brief Copy Constructor.
4993ebe763SJohn Scipione
5093ebe763SJohn Scipione	\param other The BDurationFormat object to copy from.
51c6478376SAdrien Destugues*/
52c6478376SAdrien Destugues
53c6478376SAdrien Destugues
54c6478376SAdrien Destugues/*!
5593ebe763SJohn Scipione	\fn BDurationFormat::~BDurationFormat()
5693ebe763SJohn Scipione	\brief Destructor.
5793ebe763SJohn Scipione*/
5893ebe763SJohn Scipione
5993ebe763SJohn Scipione
6093ebe763SJohn Scipione/*!
61400a2a18SJohn Scipione	\fn BDurationFormat& BDurationFormat::operator=(const BDurationFormat& other)
6293ebe763SJohn Scipione	\brief Assignment overload.
6393ebe763SJohn Scipione
6493ebe763SJohn Scipione	\param other The BDurationFormat object to copy from.
6593ebe763SJohn Scipione
6693ebe763SJohn Scipione	\returns The resulting BDurationFormat object.
6793ebe763SJohn Scipione*/
6893ebe763SJohn Scipione
6993ebe763SJohn Scipione
7093ebe763SJohn Scipione/*!
7193ebe763SJohn Scipione	\fn void BDurationFormat::SetSeparator(const BString& separator)
7293ebe763SJohn Scipione	\brief Replace the separator for this formatter.
7393ebe763SJohn Scipione
7493ebe763SJohn Scipione	\param separator The separator string to set.
7593ebe763SJohn Scipione*/
7693ebe763SJohn Scipione
7793ebe763SJohn Scipione
7893ebe763SJohn Scipione/*!
7993ebe763SJohn Scipione	\fn status_t BDurationFormat::SetLocale(const BLocale* locale)
80c6478376SAdrien Destugues	\brief Sets the locale for this formatter.
8193ebe763SJohn Scipione
8293ebe763SJohn Scipione	\param locale The BLocale object to set.
8393ebe763SJohn Scipione
8493ebe763SJohn Scipione	\returns A status code, \c B_OK on success or an error code on error.
8593ebe763SJohn Scipione*/
8693ebe763SJohn Scipione
8793ebe763SJohn Scipione
8893ebe763SJohn Scipione/*!
8993ebe763SJohn Scipione	\fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
9093ebe763SJohn Scipione	\brief Sets the timezone for this formatter.
9193ebe763SJohn Scipione
9293ebe763SJohn Scipione	\param timeZone The BTimeZone object to set.
9393ebe763SJohn Scipione
9493ebe763SJohn Scipione	\returns A status code.
9593ebe763SJohn Scipione	\retval B_OK Everything went fine.
9693ebe763SJohn Scipione	\retval B_NO_INIT Format object is \c NULL.
9793ebe763SJohn Scipione	\retval B_ERROR Other errors.
98c6478376SAdrien Destugues*/
99c6478376SAdrien Destugues
100c6478376SAdrien Destugues
101c6478376SAdrien Destugues/*!
102c6478376SAdrien Destugues	\fn status_t BDurationFormat::Format(bigtime_t startValue,
10393ebe763SJohn Scipione		bigtime_t stopValue, BString* buffer, time_unit_style style) const
104c6478376SAdrien Destugues	\brief Formats a duration defined by its start and end values.
105c6478376SAdrien Destugues
10693ebe763SJohn Scipione	The start and end values are in milliseconds. The result is appended to
10793ebe763SJohn Scipione	the buffer. The full time style uses full words (hours, minutes, seconds),
10893ebe763SJohn Scipione	while the short one uses units (h, m, s).
10993ebe763SJohn Scipione
11093ebe763SJohn Scipione	\param startValue The start value in milliseconds.
11193ebe763SJohn Scipione	\param stopValue The stop value in milliseconds.
11293ebe763SJohn Scipione	\param buffer The buffer to fill out.
11393ebe763SJohn Scipione	\param style The time unit style to use.
11493ebe763SJohn Scipione
11593ebe763SJohn Scipione	\returns A status code.
11693ebe763SJohn Scipione	\retval B_OK Everything went fine.
11793ebe763SJohn Scipione	\retval B_BAD_VALUE Buffer was \c NULL.
11893ebe763SJohn Scipione	\retval B_ERROR Formatting error.
119c6478376SAdrien Destugues*/
120