haiku/headers/os/locale/DateTimeFormat.h
Jérôme Duval 73de58376a Update icu x86_64 package with namespace renaming enabled.
"Renaming" means the icu namespace is suffixed with the version number,
atm icu_55. Using "renaming" allows to use two different versions of ICU,
thus easing upgrades. For instance haikuwebkit uses a current version of ICU,
while the system uses a newer one after an upgrade.

* Replace all uses of the icu namespace in our public headers, with a macro
defaulting to icu. As the namespace is only used for private fields pointers,
there should be no impact.
* Locale kit *.cpp have to import the macro from <unicode/uversion.h> *before*
including any locale headers. Ditto for a Time preferences cpp file. This way,
the correct current icu namespace is referenced.
* Fixes bug #12057.
2015-05-10 21:52:36 +02:00

62 lines
1.5 KiB
C++

/*
* Copyright 2010-2014, Haiku, Inc.
* Distributed under the terms of the MIT Licence.
*/
#ifndef _B_DATE_TIME_FORMAT_H_
#define _B_DATE_TIME_FORMAT_H_
#include <Format.h>
#include <FormatParameters.h>
class BString;
class BTimeZone;
enum BDateElement {
B_DATE_ELEMENT_INVALID = 0,
B_DATE_ELEMENT_YEAR = 1 << 0,
B_DATE_ELEMENT_MONTH = 1 << 1,
B_DATE_ELEMENT_WEEKDAY = 1 << 2,
B_DATE_ELEMENT_DAY = 1 << 3,
B_DATE_ELEMENT_AM_PM = 1 << 4,
B_DATE_ELEMENT_HOUR = 1 << 5,
B_DATE_ELEMENT_MINUTE = 1 << 6,
B_DATE_ELEMENT_SECOND = 1 << 7,
B_DATE_ELEMENT_TIMEZONE = 1 << 8
};
class BDateTimeFormat : public BFormat {
public:
BDateTimeFormat(const BLocale* locale = NULL);
BDateTimeFormat(const BLanguage& language,
const BFormattingConventions& conventions);
BDateTimeFormat(const BDateTimeFormat &other);
virtual ~BDateTimeFormat();
void SetDateTimeFormat(BDateFormatStyle dateStyle,
BTimeFormatStyle timeStyle,
int32 elements);
// formatting
ssize_t Format(char* target, const size_t maxSize,
const time_t time,
BDateFormatStyle dateStyle,
BTimeFormatStyle timeStyle) const;
status_t Format(BString& buffer, const time_t time,
BDateFormatStyle dateStyle,
BTimeFormatStyle timeStyle,
const BTimeZone* timeZone = NULL) const;
private:
U_ICU_NAMESPACE::DateFormat* _CreateDateTimeFormatter(
const BString& format) const;
};
#endif // _B_DATE_TIME_FORMAT_H_