a9faf94392
values * added locking to BLocale (needed since the data of the global object may change any time) * BLocale no longer passes out pointers to internal objects, it fill objects passed in by the client instead (just like be_locale_roster does) * dropped default language as member from RosterData, it is no part of the default locale * fleshed out implementation of TimeUnitFormat and DurationFormat, both of which can now be given a BLocale in order to set the strings being used during formatting git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38428 a95241bf-73f2-0310-859d-f6bbb57e9c96
61 lines
1.1 KiB
C++
61 lines
1.1 KiB
C++
/*
|
|
* Copyright 2010, Haiku, Inc.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _B_TIME_UNIT_FORMAT_H_
|
|
#define _B_TIME_UNIT_FORMAT_H_
|
|
|
|
|
|
#include <Format.h>
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
class BString;
|
|
|
|
namespace icu_44 {
|
|
class TimeUnitFormat;
|
|
}
|
|
|
|
|
|
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 {
|
|
typedef BFormat Inherited;
|
|
|
|
public:
|
|
BTimeUnitFormat();
|
|
BTimeUnitFormat(const BTimeUnitFormat& other);
|
|
virtual ~BTimeUnitFormat();
|
|
|
|
BTimeUnitFormat& operator=(const BTimeUnitFormat& other);
|
|
|
|
virtual status_t SetLocale(const BLocale* locale);
|
|
status_t Format(int32 value, time_unit_element unit,
|
|
BString* buffer,
|
|
time_unit_style style = B_TIME_UNIT_FULL
|
|
) const;
|
|
|
|
private:
|
|
icu_44::TimeUnitFormat* fFormatter;
|
|
};
|
|
|
|
|
|
#endif
|