haiku/headers/os/locale/TimeFormat.h

58 lines
1.3 KiB
C
Raw Normal View History

/*
* Copyright 2010-2014, Haiku, Inc.
* Distributed under the terms of the MIT Licence.
*/
#ifndef _B_TIME_FORMAT_H_
#define _B_TIME_FORMAT_H_
2014-10-09 15:35:23 +04:00
#include <DateTimeFormat.h>
class BString;
2014-10-09 15:35:23 +04:00
namespace BPrivate {
class BTime;
}
class BTimeFormat : public BFormat {
public:
BTimeFormat(
const BLanguage* const language = NULL,
const BFormattingConventions* const
format = NULL);
BTimeFormat(const BTimeFormat &other);
virtual ~BTimeFormat();
2014-10-09 15:35:23 +04:00
void SetTimeFormat(BTimeFormatStyle style,
const BString& format);
// formatting
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);
private:
icu::DateFormat* _CreateTimeFormatter(
2014-10-09 15:35:23 +04:00
const BTimeFormatStyle style) const;
};
#endif // _B_TIME_FORMAT_H_