haiku/headers/private/libroot/locale/ICULocaleBackend.h
Oliver Tappe 560b10ff88 Implement tzset(), gmtime(), localtime() and mktime() on top of ICU
* no longer keep a separate time-backend, since the implementation needs to
  access (data of) the locale backend anyway
* moved more stuff from localtime_fading_out.c to localtime.cpp
* added respective tests to locale_test
* added two more tests copied from glibc, test_time.c and tst-mktime.c


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38162 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-16 21:14:23 +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);
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