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/DateTimeFormat.h hrev48439 11 * src/kits/locale/DateTimeFormat.cpp hrev48439 12 */ 13 14 15/*! 16 \file DateTimeFormat.h 17 \ingroup locale 18 \ingroup libbe 19 \brief Contains BDateTimeFormat class, a datetime formatter and parser. 20*/ 21 22 23/*! 24 \class BDateTimeFormat 25 \ingroup locale 26 \ingroup libbe 27 \brief Formatter for datetimes. 28 29 \since Haiku R1 30*/ 31 32 33/*! 34 \fn BDateTimeFormat::BDateTimeFormat(const BLocale* locale) 35 \brief Locale constructor. 36 37 \param locale The locale to use, can be \c NULL for the default locale. 38*/ 39 40 41/*! 42 \fn BDateTimeFormat::BDateTimeFormat(const BLanguage& language, 43 const BFormattingConventions& format); 44 \brief Language and formatting convention constructor. 45 46 \param language The \a language to use. 47 \param format The formatting convention to use. 48*/ 49 50 51/*! 52 \fn BDateTimeFormat::BDateTimeFormat(const BDateTimeFormat& other) 53 \brief Copy Constructor. 54 55 \param other The BDateTimeFormat object to copy from. 56 57 \since Haiku R1 58*/ 59 60 61/*! 62 \fn BDateTimeFormat::~BDateTimeFormat() 63 \brief Destructor. 64 65 \since Haiku R1 66*/ 67 68 69/*! 70 \fn ssize_t BDateTimeFormat::Format(char* target, const size_t maxSize, 71 const time_t time, BDateFormatStyle dateStyle, 72 BTimeFormatStyle timeStyle) const; 73 \brief Fills in \a string with a formatted datetime up to \a maxSize bytes 74 for the given \a time and \a style for the locale. 75 76 \param target The string buffer to fill with the formatted datetime. 77 \param maxSize The size of the buffer. 78 \param time The time (in seconds since epoch) to format 79 \param dateStyle Specify the long format or the short format of the date. 80 \param timeStyle Specify the long format or the short format of the time. 81 82 \returns The number of bytes written during the datetime formatting. 83 \retval B_ERROR Unable to lock the BLocale. 84 \retval B_NO_MEMORY Ran out of memory while creating the object. 85 \retval B_BAD_VALUE There was not enough space to store the result. 86 87 \since Haiku R1 88*/ 89 90 91/*! 92 \fn status_t BDateTimeFormat::Format(BString& buffer, const time_t time, 93 BDateFormatStyle dateStyle, BTimeFormatStyle timeStyle, 94 const BTimeZone* timeZone) const 95 \brief Fills in \a string with a formatted datetime for the given 96 \a time, \a timeStyle, and \a timeZone for the locale. 97 98 \param buffer The string buffer to fill with the formatted date. 99 \param time The time (in seconds since epoch) to format 100 \param dateStyle Specifies the long format or the short format of the date. 101 \param timeStyle Specifies the long format or the short format of the time. 102 \param timeZone Specifies the time zone to use, if \c NULL, use the 103 system default time zone (usually UTC). 104 105 \returns A status code. 106 \retval B_OK Everything went fine. 107 \retval B_ERROR Unable to lock the BLocale. 108 \retval B_NO_MEMORY Ran out of memory while creating the object. 109 110 \since Haiku R1 111*/ 112