2010-07-24 03:13:00 +04:00
|
|
|
/*
|
2011-11-23 22:55:34 +04:00
|
|
|
* Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
|
2010-07-24 03:13:00 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _ICU_CATEGORY_DATA_H
|
|
|
|
#define _ICU_CATEGORY_DATA_H
|
|
|
|
|
2011-11-22 20:17:18 +04:00
|
|
|
#include <pthread.h>
|
2010-07-24 03:13:00 +04:00
|
|
|
|
|
|
|
#include <unicode/locid.h>
|
|
|
|
#include <unicode/unistr.h>
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2011-12-15 16:10:26 +04:00
|
|
|
#include "ICUThreadLocalStorageValue.h"
|
2011-11-22 20:17:18 +04:00
|
|
|
|
2010-07-24 03:13:00 +04:00
|
|
|
|
|
|
|
namespace BPrivate {
|
2010-11-22 16:06:36 +03:00
|
|
|
namespace Libroot {
|
2010-07-24 03:13:00 +04:00
|
|
|
|
|
|
|
|
|
|
|
class ICUCategoryData {
|
|
|
|
public:
|
2011-11-22 20:17:18 +04:00
|
|
|
ICUCategoryData(pthread_key_t tlsKey);
|
2010-07-24 03:13:00 +04:00
|
|
|
virtual ~ICUCategoryData();
|
|
|
|
|
2020-08-02 12:53:25 +03:00
|
|
|
virtual status_t SetTo(const U_NAMESPACE_QUALIFIER Locale&
|
|
|
|
locale,
|
2010-07-24 03:13:00 +04:00
|
|
|
const char* posixLocaleName);
|
|
|
|
virtual status_t SetToPosix();
|
|
|
|
|
2011-11-22 20:17:18 +04:00
|
|
|
const char* PosixLocaleName()
|
2010-07-24 03:13:00 +04:00
|
|
|
{ return fPosixLocaleName; }
|
|
|
|
|
2020-08-02 12:53:25 +03:00
|
|
|
const U_NAMESPACE_QUALIFIER Locale& ICULocale() const;
|
2012-02-24 00:46:14 +04:00
|
|
|
|
2010-07-24 03:13:00 +04:00
|
|
|
protected:
|
|
|
|
status_t _ConvertUnicodeStringToLocaleconvEntry(
|
2020-08-02 12:53:25 +03:00
|
|
|
const U_NAMESPACE_QUALIFIER UnicodeString&
|
|
|
|
string,
|
2010-07-24 03:13:00 +04:00
|
|
|
char* destination, int destinationSize,
|
|
|
|
const char* defaultValue = "");
|
|
|
|
|
2011-12-15 16:10:26 +04:00
|
|
|
status_t _GetConverter(UConverter*& converterOut);
|
2011-11-22 20:17:18 +04:00
|
|
|
|
2010-07-24 03:13:00 +04:00
|
|
|
static const uint16 skMaxPosixLocaleNameLen = 128;
|
|
|
|
static const size_t skLCBufSize = 16;
|
|
|
|
|
2011-11-22 20:17:18 +04:00
|
|
|
pthread_key_t fThreadLocalStorageKey;
|
2020-08-02 12:53:25 +03:00
|
|
|
U_NAMESPACE_QUALIFIER Locale fLocale;
|
2010-07-24 03:13:00 +04:00
|
|
|
char fPosixLocaleName[skMaxPosixLocaleNameLen];
|
|
|
|
char fGivenCharset[UCNV_MAX_CONVERTER_NAME_LENGTH];
|
|
|
|
|
|
|
|
private:
|
2011-11-22 20:17:18 +04:00
|
|
|
status_t _SetupConverter();
|
2010-07-24 03:13:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-24 00:46:14 +04:00
|
|
|
inline
|
2020-08-02 12:53:25 +03:00
|
|
|
const U_NAMESPACE_QUALIFIER Locale&
|
2012-02-24 00:46:14 +04:00
|
|
|
ICUCategoryData::ICULocale() const
|
|
|
|
{
|
|
|
|
return fLocale;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-22 16:06:36 +03:00
|
|
|
} // namespace Libroot
|
2010-07-24 03:13:00 +04:00
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _ICU_CATEGORY_DATA_H
|