haiku/headers/private/libroot/locale/ICULocaleBackend.h
Oliver Tappe de2e54ace0 Adjust tzset() implementation to better follow the POSIX specs and
make some more perl tests happy.
* no longer expect a ICU timezone ID in the TZ environment variable,
  but only expect this format if the TZ-value is starting with ':'
* accept "standard" TZ-values like "EST5" (of which only "EST" is
  relevant to us) - if such a value is specified, we hardcode the
  timezone name to the given value, no matter how ICU calls it
* adjust tests accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39415 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-13 01:13:38 +00:00

84 lines
2.1 KiB
C++

/*
* 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"
#include "ICUTimeConversion.h"
#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);
virtual status_t TZSet(const char* timeZoneID, const char* tz);
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);
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;
ICUTimeConversion fTimeConversion;
// static posix langinfo data
const char** fPosixLanginfo;
};
} // namespace BPrivate
#endif // _ICU_LOCALE_BACKEND_H