2010-08-01 20:28:19 +00:00
|
|
|
/*
|
2011-08-18 22:13:06 +00:00
|
|
|
* Copyright 2010-2011, Haiku, Inc.
|
2010-08-01 20:28:19 +00:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _B_TIME_UNIT_FORMAT_H_
|
|
|
|
#define _B_TIME_UNIT_FORMAT_H_
|
|
|
|
|
|
|
|
|
2010-08-29 20:55:00 +00:00
|
|
|
#include <Format.h>
|
2010-08-01 20:28:19 +00:00
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BString;
|
|
|
|
|
2015-05-10 21:13:59 +02:00
|
|
|
#ifndef U_ICU_NAMESPACE
|
|
|
|
#define U_ICU_NAMESPACE icu
|
|
|
|
#endif
|
|
|
|
namespace U_ICU_NAMESPACE {
|
2010-08-29 20:55:00 +00:00
|
|
|
class TimeUnitFormat;
|
|
|
|
}
|
|
|
|
|
2010-08-01 20:28:19 +00: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-29 20:55:00 +00:00
|
|
|
typedef BFormat Inherited;
|
|
|
|
|
2010-08-01 20:28:19 +00:00
|
|
|
public:
|
2017-05-17 03:46:31 +05:30
|
|
|
BTimeUnitFormat(const time_unit_style style =
|
|
|
|
B_TIME_UNIT_FULL);
|
2014-10-27 09:05:48 +01:00
|
|
|
BTimeUnitFormat(const BLanguage& language,
|
2017-05-17 03:46:31 +05:30
|
|
|
const BFormattingConventions& conventions,
|
|
|
|
const time_unit_style style = B_TIME_UNIT_FULL);
|
2010-08-29 20:55:00 +00:00
|
|
|
BTimeUnitFormat(const BTimeUnitFormat& other);
|
|
|
|
virtual ~BTimeUnitFormat();
|
|
|
|
|
2014-10-01 18:13:35 +02:00
|
|
|
status_t Format(BString& buffer,
|
|
|
|
const int32 value,
|
2017-05-17 03:46:31 +05:30
|
|
|
const time_unit_element unit
|
2010-08-01 20:28:19 +00:00
|
|
|
) const;
|
2010-08-29 20:55:00 +00:00
|
|
|
|
|
|
|
private:
|
2015-05-10 21:13:59 +02:00
|
|
|
U_ICU_NAMESPACE::TimeUnitFormat* fFormatter;
|
2010-08-01 20:28:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|