xref: /haiku/src/system/libroot/add-ons/icu/ICULocaleconvData.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2010-2011, Oliver Tappe, zooey@hirschkaefer.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "ICULocaleconvData.h"
8 
9 #include <string.h>
10 
11 
12 U_NAMESPACE_USE
13 
14 
15 namespace BPrivate {
16 namespace Libroot {
17 
18 
19 ICULocaleconvData::ICULocaleconvData(pthread_key_t tlsKey)
20 	: inherited(tlsKey)
21 {
22 }
23 
24 
25 status_t
26 ICULocaleconvData::_SetLocaleconvEntry(const DecimalFormatSymbols* formatSymbols,
27 	char* destination, FormatSymbol symbol, const char* defaultValue)
28 {
29 	status_t result = B_OK;
30 
31 	UnicodeString symbolString = formatSymbols->getSymbol(symbol);
32 	if (!symbolString.isEmpty()) {
33 		result = _ConvertUnicodeStringToLocaleconvEntry(symbolString,
34 			destination, skLCBufSize, defaultValue);
35 	} else
36 		destination[0] = '\0';
37 
38 	return result;
39 }
40 
41 
42 }	// namespace Libroot
43 }	// namespace BPrivate
44