]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/servrbf.cpp
2 *******************************************************************************
3 * Copyright (C) 2001-2014, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 *******************************************************************************
9 #include "unicode/utypes.h"
11 #if !UCONFIG_NO_SERVICE
13 #include "unicode/resbund.h"
23 #define UNDERSCORE_CHAR ((UChar)0x005f)
24 #define AT_SIGN_CHAR ((UChar)64)
25 #define PERIOD_CHAR ((UChar)46)
29 ICUResourceBundleFactory::ICUResourceBundleFactory()
30 : LocaleKeyFactory(VISIBLE
)
35 ICUResourceBundleFactory::ICUResourceBundleFactory(const UnicodeString
& bundleName
)
36 : LocaleKeyFactory(VISIBLE
)
37 , _bundleName(bundleName
)
41 ICUResourceBundleFactory::~ICUResourceBundleFactory() {}
44 ICUResourceBundleFactory::getSupportedIDs(UErrorCode
& status
) const
46 if (U_SUCCESS(status
)) {
47 return LocaleUtility::getAvailableLocaleNames(_bundleName
);
53 ICUResourceBundleFactory::handleCreate(const Locale
& loc
, int32_t /* kind */, const ICUService
* /* service */, UErrorCode
& status
) const
55 if (U_SUCCESS(status
)) {
56 // _bundleName is a package name
57 // and should only contain invariant characters
58 // ??? is it always true that the max length of the bundle name is 19?
59 // who made this change? -- dlf
62 length
=_bundleName
.extract(0, INT32_MAX
, pkg
, (int32_t)sizeof(pkg
), US_INV
);
63 if(length
>=(int32_t)sizeof(pkg
)) {
66 return new ResourceBundle(pkg
, loc
, status
);
73 ICUResourceBundleFactory::debug(UnicodeString
& result
) const
75 LocaleKeyFactory::debug(result
);
76 result
.append((UnicodeString
)", bundle: ");
77 return result
.append(_bundleName
);
81 ICUResourceBundleFactory::debugClass(UnicodeString
& result
) const
83 return result
.append((UnicodeString
)"ICUResourceBundleFactory");
87 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUResourceBundleFactory
)
91 /* !UCONFIG_NO_SERVICE */