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