2010-08-02 00:28:19 +04:00
|
|
|
/*
|
2014-10-01 20:13:35 +04:00
|
|
|
* Copyright 2010-2014, Haiku, Inc.
|
2010-08-02 00:28:19 +04:00
|
|
|
* Distributed under the terms of the MIT Licence.
|
2010-02-17 03:02:50 +03:00
|
|
|
*/
|
|
|
|
#ifndef _B_TIME_FORMAT_H_
|
|
|
|
#define _B_TIME_FORMAT_H_
|
|
|
|
|
2014-10-09 15:35:23 +04:00
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
#include <DateTimeFormat.h>
|
2010-02-17 03:02:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
class BString;
|
2014-10-07 14:46:51 +04:00
|
|
|
|
2014-10-09 15:35:23 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
class BTime;
|
|
|
|
}
|
|
|
|
|
2010-02-17 03:02:50 +03:00
|
|
|
|
2014-10-01 20:13:35 +04:00
|
|
|
class BTimeFormat : public BFormat {
|
2010-08-02 00:28:19 +04:00
|
|
|
public:
|
2014-10-27 11:05:48 +03:00
|
|
|
BTimeFormat();
|
|
|
|
BTimeFormat(const BLanguage& language,
|
|
|
|
const BFormattingConventions& conventions);
|
2010-08-02 00:28:19 +04:00
|
|
|
BTimeFormat(const BTimeFormat &other);
|
|
|
|
virtual ~BTimeFormat();
|
|
|
|
|
2014-10-09 15:35:23 +04:00
|
|
|
void SetTimeFormat(BTimeFormatStyle style,
|
|
|
|
const BString& format);
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
// formatting
|
2010-02-17 03:02:50 +03:00
|
|
|
|
2014-10-01 20:13:35 +04:00
|
|
|
ssize_t Format(char* string, size_t maxSize,
|
|
|
|
time_t time, BTimeFormatStyle style) const;
|
|
|
|
status_t Format(BString& string, const time_t time,
|
|
|
|
const BTimeFormatStyle style,
|
|
|
|
const BTimeZone* timeZone = NULL) const;
|
|
|
|
status_t Format(BString& string,
|
|
|
|
int*& fieldPositions, int& fieldCount,
|
|
|
|
time_t time, BTimeFormatStyle style) const;
|
|
|
|
|
|
|
|
status_t GetTimeFields(BDateElement*& fields,
|
|
|
|
int& fieldCount, BTimeFormatStyle style
|
|
|
|
) const;
|
|
|
|
|
2014-10-09 15:35:23 +04:00
|
|
|
// parsing
|
|
|
|
|
|
|
|
status_t Parse(BString source, BTimeFormatStyle style,
|
|
|
|
BPrivate::BTime& output);
|
|
|
|
|
2014-10-01 20:13:35 +04:00
|
|
|
private:
|
2015-05-10 22:13:59 +03:00
|
|
|
U_ICU_NAMESPACE::DateFormat* _CreateTimeFormatter(
|
2014-10-09 15:35:23 +04:00
|
|
|
const BTimeFormatStyle style) const;
|
2010-02-17 03:02:50 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
#endif // _B_TIME_FORMAT_H_
|