haiku/headers/private/libroot/locale/ICUCategoryData.h
Oliver Tappe c894d1868e Bring rewritten multibyte-support into repository.
* update copyrights of locale backend files

Multibyte-support has been rewritten to use ICU as backend.
While this does not necessarily work properly in every aspect
(e.g. the shell still has [different] problems with multibyte-
characters now), it does fix #6263 and #7700.
2011-11-23 19:55:34 +01:00

61 lines
1.3 KiB
C++

/*
* Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _ICU_CATEGORY_DATA_H
#define _ICU_CATEGORY_DATA_H
#include <pthread.h>
#include <unicode/locid.h>
#include <unicode/ucnv.h>
#include <unicode/unistr.h>
#include <SupportDefs.h>
#include "ICUConverterManager.h"
namespace BPrivate {
namespace Libroot {
class ICUCategoryData {
public:
ICUCategoryData(pthread_key_t tlsKey);
virtual ~ICUCategoryData();
virtual status_t SetTo(const Locale& locale,
const char* posixLocaleName);
virtual status_t SetToPosix();
const char* PosixLocaleName()
{ return fPosixLocaleName; }
protected:
status_t _ConvertUnicodeStringToLocaleconvEntry(
const UnicodeString& string,
char* destination, int destinationSize,
const char* defaultValue = "");
status_t _GetConverter(ICUConverterRef& converterRefOut);
static const uint16 skMaxPosixLocaleNameLen = 128;
static const size_t skLCBufSize = 16;
pthread_key_t fThreadLocalStorageKey;
Locale fLocale;
char fPosixLocaleName[skMaxPosixLocaleNameLen];
char fGivenCharset[UCNV_MAX_CONVERTER_NAME_LENGTH];
private:
status_t _SetupConverter();
};
} // namespace Libroot
} // namespace BPrivate
#endif // _ICU_CATEGORY_DATA_H