1 /* 2 * Copyright 2010-2014, Haiku, Inc. 3 * Distributed under the terms of the MIT Licence. 4 */ 5 #ifndef _B_TIME_FORMAT_H_ 6 #define _B_TIME_FORMAT_H_ 7 8 #include <DateTimeFormat.h> 9 10 11 class BString; 12 class BTimeZone; 13 14 class BTimeFormat : public BFormat { 15 public: 16 BTimeFormat( 17 const BLanguage* const language = NULL, 18 const BFormattingConventions* const 19 format = NULL); 20 BTimeFormat(const BTimeFormat &other); 21 virtual ~BTimeFormat(); 22 23 // formatting 24 25 ssize_t Format(char* string, size_t maxSize, 26 time_t time, BTimeFormatStyle style) const; 27 ssize_t Format(char* string, size_t maxSize, 28 time_t time, BString format) const; 29 status_t Format(BString& string, const time_t time, 30 const BTimeFormatStyle style, 31 const BTimeZone* timeZone = NULL) const; 32 status_t Format(BString& string, const time_t time, 33 const BString format, 34 const BTimeZone* timeZone) const; 35 status_t Format(BString& string, 36 int*& fieldPositions, int& fieldCount, 37 time_t time, BTimeFormatStyle style) const; 38 39 status_t GetTimeFields(BDateElement*& fields, 40 int& fieldCount, BTimeFormatStyle style 41 ) const; 42 43 // TODO parsing 44 private: 45 icu::DateFormat* _CreateTimeFormatter( 46 const BString& format) const; 47 }; 48 49 50 #endif // _B_TIME_FORMAT_H_ 51