Formatter for time intervals. More...
Inherits BFormat.
Public Member Functions | |
| BDurationFormat (const BString &separator=", ") | |
| Constructor. | |
| BDurationFormat (const BDurationFormat &other) | |
| Copy Constructor. | |
| virtual | ~BDurationFormat () |
| Destructor. | |
| status_t | Format (bigtime_t startValue, bigtime_t stopValue, BString *buffer, time_unit_style style=B_TIME_UNIT_FULL) const |
| Formats a duration defined by its start and end values. | |
| BDurationFormat & | operator= (const BDurationFormat &other) |
| Assignment overload. | |
| virtual status_t | SetLocale (const BLocale *locale) |
| Sets the locale for this formatter. | |
| void | SetSeparator (const BString &separator) |
| Replace the separator for this formatter. | |
| status_t | SetTimeZone (const BTimeZone *timeZone) |
| Sets the timezone for this formatter. | |
Formatter for time intervals.
BDurationFormat is a formatter for time intervals. A time interval is defined by its start and end values, and the result is a string such as "1 hour, 2 minutes, 28 seconds".
| BDurationFormat::BDurationFormat | ( | const BString & | separator = ", " | ) |
Constructor.
| separator | String appended between the duration elements. |
| BDurationFormat::BDurationFormat | ( | const BDurationFormat & | other | ) |
Copy Constructor.
| other | The BDurationFormat object to copy from. |
| status_t BDurationFormat::Format | ( | bigtime_t | startValue, |
| bigtime_t | stopValue, | ||
| BString * | buffer, | ||
| time_unit_style | style = B_TIME_UNIT_FULL |
||
| ) | const |
Formats a duration defined by its start and end values.
The start and end values are in milliseconds. The result is appended to the buffer. The full time style uses full words (hours, minutes, seconds), while the short one uses units (h, m, s).
| startValue | The start value in milliseconds. |
| stopValue | The stop value in milliseconds. |
| buffer | The buffer to fill out. |
| style | The time unit style to use. |
| B_OK | Everything went fine. |
| B_BAD_VALUE | Buffer was NULL. |
| B_ERROR | Formatting error. |
| BDurationFormat & BDurationFormat::operator= | ( | const BDurationFormat & | other | ) |
Assignment overload.
| other | The BDurationFormat object to copy from. |
Sets the locale for this formatter.
| locale | The BLocale object to set. |
B_OK on success or an error code on error. | void BDurationFormat::SetSeparator | ( | const BString & | separator | ) |
Replace the separator for this formatter.
| separator | The separator string to set. |