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 34 35/*! 36 \fn BDurationFormat::BDurationFormat(const BString& separator) 37 \brief Constructor. 38 39 \warning Creating a BDurationFormat is a costly operation. Most of the 40 time want to use the default one through the BLocale class. 41 42 \param separator String appended between the duration elements. 43*/ 44 45 46/*! 47 \fn BDurationFormat::BDurationFormat(const BDurationFormat& other) 48 \brief Copy Constructor. 49 50 \param other The BDurationFormat object to copy from. 51*/ 52 53 54/*! 55 \fn BDurationFormat::~BDurationFormat() 56 \brief Destructor. 57*/ 58 59 60/*! 61 \fn BDurationFormat& BDurationFormat::operator=(const BDurationFormat& other) 62 \brief Assignment overload. 63 64 \param other The BDurationFormat object to copy from. 65 66 \returns The resulting BDurationFormat object. 67*/ 68 69 70/*! 71 \fn void BDurationFormat::SetSeparator(const BString& separator) 72 \brief Replace the separator for this formatter. 73 74 \param separator The separator string to set. 75*/ 76 77 78/*! 79 \fn status_t BDurationFormat::SetLocale(const BLocale* locale) 80 \brief Sets the locale for this formatter. 81 82 \param locale The BLocale object to set. 83 84 \returns A status code, \c B_OK on success or an error code on error. 85*/ 86 87 88/*! 89 \fn status_t BDurationFormat::SetTimeZone(const BTimeZone* timeZone) 90 \brief Sets the timezone for this formatter. 91 92 \param timeZone The BTimeZone object to set. 93 94 \returns A status code. 95 \retval B_OK Everything went fine. 96 \retval B_NO_INIT Format object is \c NULL. 97 \retval B_ERROR Other errors. 98*/ 99 100 101/*! 102 \fn status_t BDurationFormat::Format(bigtime_t startValue, 103 bigtime_t stopValue, BString* buffer, time_unit_style style) const 104 \brief Formats a duration defined by its start and end values. 105 106 The start and end values are in milliseconds. The result is appended to 107 the buffer. The full time style uses full words (hours, minutes, seconds), 108 while the short one uses units (h, m, s). 109 110 \param startValue The start value in milliseconds. 111 \param stopValue The stop value in milliseconds. 112 \param buffer The buffer to fill out. 113 \param style The time unit style to use. 114 115 \returns A status code. 116 \retval B_OK Everything went fine. 117 \retval B_BAD_VALUE Buffer was \c NULL. 118 \retval B_ERROR Formatting error. 119*/ 120