]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/resbund_cnv.cpp
2 *******************************************************************************
4 * Copyright (C) 1997-2004, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: resbund_cnv.cpp
10 * tab size: 8 (not used)
13 * created on: 2004aug25
14 * created by: Markus W. Scherer
16 * Character conversion functions moved here from resbund.cpp
19 #include "unicode/utypes.h"
20 #include "unicode/resbund.h"
25 ResourceBundle::ResourceBundle( const UnicodeString
& path
,
28 :UObject(), fLocale(NULL
)
30 constructForLocale(path
, locale
, error
);
33 ResourceBundle::ResourceBundle( const UnicodeString
& path
,
35 :UObject(), fLocale(NULL
)
37 constructForLocale(path
, Locale::getDefault(), error
);
41 ResourceBundle::constructForLocale(const UnicodeString
& path
,
47 if(path
.length() >= (int32_t)sizeof(name
)) {
49 error
= U_ILLEGAL_ARGUMENT_ERROR
;
50 } else if(!path
.isEmpty()) {
51 if(uprv_isInvariantUString(path
.getBuffer(), path
.length())) {
52 // the invariant converter is sufficient for package and tree names
53 // and is more efficient
54 path
.extract(0, INT32_MAX
, name
, (int32_t)sizeof(name
), US_INV
);
56 #if !UCONFIG_NO_CONVERSION
57 // use the default converter to support variant-character paths
58 path
.extract(name
, sizeof(name
), 0, error
);
60 // the default converter is not available
62 error
= U_UNSUPPORTED_ERROR
;
66 fResource
= ures_open(name
, locale
.getName(), &error
);
68 fResource
= ures_open(0, locale
.getName(), &error
);