2010-08-02 00:28:19 +04:00
|
|
|
/*
|
2014-09-26 20:24:07 +04:00
|
|
|
* Copyright 2010-2014, Haiku, Inc.
|
2010-08-02 00:28:19 +04:00
|
|
|
* Distributed under the terms of the MIT Licence.
|
|
|
|
*/
|
|
|
|
#ifndef _B_DATE_TIME_FORMAT_H_
|
|
|
|
#define _B_DATE_TIME_FORMAT_H_
|
|
|
|
|
2014-09-26 20:24:07 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
#include <Format.h>
|
|
|
|
#include <FormatParameters.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BString;
|
2014-10-07 14:46:51 +04:00
|
|
|
class BTimeZone;
|
|
|
|
|
|
|
|
|
|
|
|
enum BDateElement {
|
|
|
|
B_DATE_ELEMENT_INVALID = 0,
|
|
|
|
B_DATE_ELEMENT_YEAR = 1 << 0,
|
|
|
|
B_DATE_ELEMENT_MONTH = 1 << 1,
|
|
|
|
B_DATE_ELEMENT_WEEKDAY = 1 << 2,
|
|
|
|
B_DATE_ELEMENT_DAY = 1 << 3,
|
|
|
|
B_DATE_ELEMENT_AM_PM = 1 << 4,
|
|
|
|
B_DATE_ELEMENT_HOUR = 1 << 5,
|
|
|
|
B_DATE_ELEMENT_MINUTE = 1 << 6,
|
|
|
|
B_DATE_ELEMENT_SECOND = 1 << 7,
|
|
|
|
B_DATE_ELEMENT_TIMEZONE = 1 << 8
|
|
|
|
};
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
|
2014-09-26 20:24:07 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
class BDateTimeFormat : public BFormat {
|
|
|
|
public:
|
2014-10-27 11:05:48 +03:00
|
|
|
BDateTimeFormat(const BLocale* locale = NULL);
|
|
|
|
BDateTimeFormat(const BLanguage& language,
|
|
|
|
const BFormattingConventions& conventions);
|
2010-08-02 00:28:19 +04:00
|
|
|
BDateTimeFormat(const BDateTimeFormat &other);
|
|
|
|
virtual ~BDateTimeFormat();
|
|
|
|
|
2014-10-07 14:46:51 +04:00
|
|
|
void SetDateTimeFormat(BDateFormatStyle dateStyle,
|
|
|
|
BTimeFormatStyle timeStyle,
|
|
|
|
int32 elements);
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
// formatting
|
|
|
|
|
2014-10-02 11:19:54 +04:00
|
|
|
ssize_t Format(char* target, const size_t maxSize,
|
|
|
|
const time_t time,
|
|
|
|
BDateFormatStyle dateStyle,
|
|
|
|
BTimeFormatStyle timeStyle) const;
|
|
|
|
status_t Format(BString& buffer, const time_t time,
|
|
|
|
BDateFormatStyle dateStyle,
|
|
|
|
BTimeFormatStyle timeStyle,
|
|
|
|
const BTimeZone* timeZone = NULL) const;
|
|
|
|
|
|
|
|
private:
|
2015-05-10 22:13:59 +03:00
|
|
|
U_ICU_NAMESPACE::DateFormat* _CreateDateTimeFormatter(
|
2014-10-02 11:19:54 +04:00
|
|
|
const BString& format) const;
|
2010-08-02 00:28:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _B_DATE_TIME_FORMAT_H_
|