vfs: check userland buffers before reading them.
[haiku.git] / headers / os / locale / DateTimeFormat.h
blobded805974519a7bddf3acb575a9a488dfaab4747
1 /*
2 * Copyright 2010-2014, Haiku, Inc.
3 * Distributed under the terms of the MIT Licence.
4 */
5 #ifndef _B_DATE_TIME_FORMAT_H_
6 #define _B_DATE_TIME_FORMAT_H_
9 #include <Format.h>
12 class BString;
13 class BTimeZone;
16 enum BDateElement {
17 B_DATE_ELEMENT_INVALID = 0,
18 B_DATE_ELEMENT_YEAR = 1 << 0,
19 B_DATE_ELEMENT_MONTH = 1 << 1,
20 B_DATE_ELEMENT_WEEKDAY = 1 << 2,
21 B_DATE_ELEMENT_DAY = 1 << 3,
22 B_DATE_ELEMENT_AM_PM = 1 << 4,
23 B_DATE_ELEMENT_HOUR = 1 << 5,
24 B_DATE_ELEMENT_MINUTE = 1 << 6,
25 B_DATE_ELEMENT_SECOND = 1 << 7,
26 B_DATE_ELEMENT_TIMEZONE = 1 << 8
31 class BDateTimeFormat : public BFormat {
32 public:
33 BDateTimeFormat(const BLocale* locale = NULL);
34 BDateTimeFormat(const BLanguage& language,
35 const BFormattingConventions& conventions);
36 BDateTimeFormat(const BDateTimeFormat &other);
37 virtual ~BDateTimeFormat();
39 void SetDateTimeFormat(BDateFormatStyle dateStyle,
40 BTimeFormatStyle timeStyle,
41 int32 elements);
43 // formatting
45 ssize_t Format(char* target, const size_t maxSize,
46 const time_t time,
47 BDateFormatStyle dateStyle,
48 BTimeFormatStyle timeStyle) const;
49 status_t Format(BString& buffer, const time_t time,
50 BDateFormatStyle dateStyle,
51 BTimeFormatStyle timeStyle,
52 const BTimeZone* timeZone = NULL) const;
54 private:
55 U_ICU_NAMESPACE::DateFormat* _CreateDateTimeFormatter(
56 const BString& format) const;
60 #endif // _B_DATE_TIME_FORMAT_H_