2010-08-02 00:28:19 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _B_TIME_UNIT_FORMAT_H_
|
|
|
|
#define _B_TIME_UNIT_FORMAT_H_
|
|
|
|
|
|
|
|
|
2010-08-30 00:55:00 +04:00
|
|
|
#include <Format.h>
|
2010-08-02 00:28:19 +04:00
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BString;
|
|
|
|
|
2010-08-30 00:55:00 +04:00
|
|
|
namespace icu_44 {
|
|
|
|
class TimeUnitFormat;
|
|
|
|
}
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
|
|
|
|
enum time_unit_style {
|
|
|
|
B_TIME_UNIT_ABBREVIATED, // e.g. '5 hrs.'
|
|
|
|
B_TIME_UNIT_FULL, // e.g. '5 hours'
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum time_unit_element {
|
|
|
|
B_TIME_UNIT_YEAR,
|
|
|
|
B_TIME_UNIT_MONTH,
|
|
|
|
B_TIME_UNIT_WEEK,
|
|
|
|
B_TIME_UNIT_DAY,
|
|
|
|
B_TIME_UNIT_HOUR,
|
|
|
|
B_TIME_UNIT_MINUTE,
|
|
|
|
B_TIME_UNIT_SECOND,
|
|
|
|
|
|
|
|
B_TIME_UNIT_LAST = B_TIME_UNIT_SECOND
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BTimeUnitFormat : public BFormat {
|
2010-08-30 00:55:00 +04:00
|
|
|
typedef BFormat Inherited;
|
|
|
|
|
2010-08-02 00:28:19 +04:00
|
|
|
public:
|
2010-08-30 00:55:00 +04:00
|
|
|
BTimeUnitFormat();
|
|
|
|
BTimeUnitFormat(const BTimeUnitFormat& other);
|
|
|
|
virtual ~BTimeUnitFormat();
|
|
|
|
|
|
|
|
BTimeUnitFormat& operator=(const BTimeUnitFormat& other);
|
|
|
|
|
|
|
|
virtual status_t SetLocale(const BLocale* locale);
|
2010-08-02 00:28:19 +04:00
|
|
|
status_t Format(int32 value, time_unit_element unit,
|
|
|
|
BString* buffer,
|
|
|
|
time_unit_style style = B_TIME_UNIT_FULL
|
|
|
|
) const;
|
2010-08-30 00:55:00 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
icu_44::TimeUnitFormat* fFormatter;
|
2010-08-02 00:28:19 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|