2009-05-01 19:23:59 +00:00
|
|
|
#ifndef _COUNTRY_H_
|
|
|
|
#define _COUNTRY_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <LocaleStrings.h>
|
|
|
|
#include <String.h>
|
|
|
|
|
2010-04-15 15:57:30 +00:00
|
|
|
|
|
|
|
class BBitmap;
|
|
|
|
|
2010-07-13 19:04:40 +00:00
|
|
|
namespace icu_44 {
|
2009-09-18 22:23:34 +00:00
|
|
|
class DateFormat;
|
2009-09-20 22:16:30 +00:00
|
|
|
class Locale;
|
2009-09-18 22:23:34 +00:00
|
|
|
}
|
|
|
|
|
2010-07-13 19:04:40 +00:00
|
|
|
|
2009-05-01 19:23:59 +00:00
|
|
|
enum {
|
|
|
|
B_METRIC = 0,
|
|
|
|
B_US
|
|
|
|
};
|
|
|
|
|
2010-07-14 16:43:04 +00:00
|
|
|
typedef enum {
|
2010-07-17 12:24:57 +00:00
|
|
|
B_DATE_ELEMENT_INVALID = B_BAD_DATA,
|
|
|
|
B_DATE_ELEMENT_YEAR = 0,
|
|
|
|
B_DATE_ELEMENT_MONTH,
|
|
|
|
B_DATE_ELEMENT_DAY,
|
|
|
|
B_DATE_ELEMENT_AM_PM,
|
|
|
|
B_DATE_ELEMENT_HOUR,
|
|
|
|
B_DATE_ELEMENT_MINUTE,
|
|
|
|
B_DATE_ELEMENT_SECOND
|
2010-07-14 19:43:46 +00:00
|
|
|
} BDateElement;
|
2010-07-14 16:43:04 +00:00
|
|
|
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2009-05-01 21:56:16 +00:00
|
|
|
class BCountry {
|
2009-05-01 19:23:59 +00:00
|
|
|
public:
|
2009-09-18 22:23:34 +00:00
|
|
|
BCountry(const char* languageCode, const char* countryCode);
|
|
|
|
BCountry(const char* languageAndCountryCode = "en_US");
|
2010-04-15 15:57:30 +00:00
|
|
|
virtual ~BCountry();
|
2009-05-01 21:56:16 +00:00
|
|
|
|
2010-04-15 15:57:30 +00:00
|
|
|
virtual bool Name(BString&) const;
|
|
|
|
const char* Code() const;
|
|
|
|
status_t GetIcon(BBitmap* result);
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2010-04-15 15:57:30 +00:00
|
|
|
const char* GetString(uint32 id) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
|
|
|
// date & time
|
|
|
|
|
2010-07-14 13:20:20 +00:00
|
|
|
virtual void FormatDate(char* string, size_t maxSize, time_t time,
|
2009-09-18 22:23:34 +00:00
|
|
|
bool longFormat);
|
2010-07-14 13:20:20 +00:00
|
|
|
virtual void FormatDate(BString* string, time_t time,
|
2009-09-18 22:23:34 +00:00
|
|
|
bool longFormat);
|
2010-07-17 12:24:57 +00:00
|
|
|
status_t FormatDate(BString* string, int*& fieldPositions,
|
|
|
|
int& fieldCount, time_t time, bool longFormat);
|
|
|
|
|
2010-07-14 13:20:20 +00:00
|
|
|
virtual void FormatTime(char* string, size_t maxSize, time_t time,
|
2009-09-18 22:23:34 +00:00
|
|
|
bool longFormat);
|
2010-07-14 13:20:20 +00:00
|
|
|
virtual void FormatTime(BString* string, time_t time,
|
|
|
|
bool longFormat);
|
|
|
|
status_t FormatTime(BString* string, int*& fieldPositions,
|
2010-07-14 16:43:04 +00:00
|
|
|
int& fieldCount, time_t time, bool longFormat);
|
2010-07-14 19:43:46 +00:00
|
|
|
status_t TimeFields(BDateElement*& fields, int& fieldCount,
|
2010-07-14 16:43:04 +00:00
|
|
|
bool longFormat);
|
2010-07-17 12:24:57 +00:00
|
|
|
status_t DateFields(BDateElement*& fields, int& fieldCount,
|
|
|
|
bool longFormat);
|
2009-09-18 22:23:34 +00:00
|
|
|
|
|
|
|
bool DateFormat(BString&, bool longFormat) const;
|
|
|
|
void SetDateFormat(const char* formatString,
|
|
|
|
bool longFormat = true);
|
2010-07-08 09:14:09 +00:00
|
|
|
void SetTimeFormat(const char* formatString,
|
|
|
|
bool longFormat = true);
|
2009-09-18 22:23:34 +00:00
|
|
|
bool TimeFormat(BString&, bool longFormat) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2010-07-02 17:15:55 +00:00
|
|
|
int StartOfWeek();
|
|
|
|
|
2009-05-01 19:23:59 +00:00
|
|
|
// numbers
|
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
virtual void FormatNumber(char* string, size_t maxSize, double value);
|
2009-09-20 22:16:30 +00:00
|
|
|
virtual status_t FormatNumber(BString* string, double value);
|
2009-09-18 22:23:34 +00:00
|
|
|
virtual void FormatNumber(char* string, size_t maxSize, int32 value);
|
|
|
|
virtual void FormatNumber(BString* string, int32 value);
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
bool DecimalPoint(BString&) const;
|
|
|
|
bool ThousandsSeparator(BString&) const;
|
|
|
|
bool Grouping(BString&) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
bool PositiveSign(BString&) const;
|
|
|
|
bool NegativeSign(BString&) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
|
|
|
|
// measurements
|
|
|
|
|
|
|
|
virtual int8 Measurement() const;
|
|
|
|
|
|
|
|
// monetary
|
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
virtual ssize_t FormatMonetary(char* string, size_t maxSize,
|
|
|
|
double value);
|
|
|
|
virtual ssize_t FormatMonetary(BString* string, double value);
|
2009-05-01 19:23:59 +00:00
|
|
|
|
2009-09-18 22:23:34 +00:00
|
|
|
bool CurrencySymbol(BString&) const;
|
|
|
|
bool InternationalCurrencySymbol(BString&) const;
|
|
|
|
bool MonDecimalPoint(BString&) const;
|
|
|
|
bool MonThousandsSeparator(BString&) const;
|
|
|
|
bool MonGrouping(BString&) const;
|
2009-05-01 19:23:59 +00:00
|
|
|
virtual int32 MonFracDigits() const;
|
|
|
|
|
|
|
|
private:
|
2010-07-13 19:04:40 +00:00
|
|
|
icu_44::DateFormat* fICULongDateFormatter;
|
|
|
|
icu_44::DateFormat* fICUShortDateFormatter;
|
|
|
|
icu_44::DateFormat* fICULongTimeFormatter;
|
|
|
|
icu_44::DateFormat* fICUShortTimeFormatter;
|
|
|
|
icu_44::Locale* fICULocale;
|
2009-05-01 19:23:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _COUNTRY_H_ */
|