2010-07-23 23:13:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2010, Oliver Tappe, zooey@hirschkaefer.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _ICU_LOCALE_BACKEND_H
|
|
|
|
#define _ICU_LOCALE_BACKEND_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "LocaleBackend.h"
|
|
|
|
|
|
|
|
#include <locale.h>
|
|
|
|
#include <timelocal.h>
|
|
|
|
|
|
|
|
#include "ICUCollateData.h"
|
|
|
|
#include "ICUCtypeData.h"
|
|
|
|
#include "ICUMessagesData.h"
|
|
|
|
#include "ICUMonetaryData.h"
|
|
|
|
#include "ICUNumericData.h"
|
2010-08-16 21:14:23 +00:00
|
|
|
#include "ICUTimeConversion.h"
|
2010-07-23 23:13:00 +00:00
|
|
|
#include "ICUTimeData.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
|
|
|
class ICULocaleBackend : public LocaleBackend {
|
|
|
|
public:
|
|
|
|
ICULocaleBackend();
|
|
|
|
virtual ~ICULocaleBackend();
|
|
|
|
|
|
|
|
virtual void Initialize(LocaleDataBridge* dataBridge);
|
|
|
|
|
|
|
|
virtual const char* SetLocale(int category,
|
|
|
|
const char* posixLocaleName);
|
|
|
|
virtual const struct lconv* LocaleConv();
|
|
|
|
virtual const struct lc_time_t* LCTimeInfo();
|
|
|
|
|
|
|
|
virtual int IsWCType(wint_t wc, wctype_t charClass);
|
|
|
|
virtual status_t ToWCTrans(wint_t wc, wctrans_t transition,
|
|
|
|
wint_t& result);
|
|
|
|
|
|
|
|
virtual const char* GetLanginfo(int index);
|
|
|
|
|
|
|
|
virtual status_t Strcoll(const char* a, const char* b, int& out);
|
|
|
|
virtual status_t Strxfrm(char* out, const char* in, size_t size,
|
|
|
|
size_t& outSize);
|
|
|
|
|
2010-08-16 21:14:23 +00:00
|
|
|
virtual status_t TZSet(const char* timeZoneID);
|
|
|
|
virtual status_t Localtime(const time_t* inTime,
|
|
|
|
struct tm* tmOut);
|
|
|
|
virtual status_t Gmtime(const time_t* inTime, struct tm* tmOut);
|
|
|
|
|
|
|
|
virtual status_t Mktime(struct tm* inOutTm, time_t& timeOut);
|
|
|
|
|
2010-07-23 23:13:00 +00:00
|
|
|
private:
|
|
|
|
const char* _QueryLocale(int category);
|
|
|
|
const char* _SetPosixLocale(int category);
|
|
|
|
|
|
|
|
// buffer for locale names (up to one per category)
|
|
|
|
char fLocaleDescription[512];
|
|
|
|
|
|
|
|
// data containers
|
|
|
|
struct lconv fLocaleConv;
|
|
|
|
struct lc_time_t fLCTimeInfo;
|
|
|
|
|
|
|
|
// these work on the data containers above
|
|
|
|
ICUCollateData fCollateData;
|
|
|
|
ICUCtypeData fCtypeData;
|
|
|
|
ICUMessagesData fMessagesData;
|
|
|
|
ICUMonetaryData fMonetaryData;
|
|
|
|
ICUNumericData fNumericData;
|
|
|
|
ICUTimeData fTimeData;
|
2010-08-16 21:14:23 +00:00
|
|
|
ICUTimeConversion fTimeConversion;
|
2010-07-23 23:13:00 +00:00
|
|
|
|
|
|
|
// static posix langinfo data
|
|
|
|
const char** fPosixLanginfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _ICU_LOCALE_BACKEND_H
|