/src/mozilla-central/intl/icu/source/common/resbund_cnv.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // © 2016 and later: Unicode, Inc. and others. |
2 | | // License & terms of use: http://www.unicode.org/copyright.html |
3 | | /* |
4 | | ******************************************************************************* |
5 | | * |
6 | | * Copyright (C) 1997-2006, International Business Machines |
7 | | * Corporation and others. All Rights Reserved. |
8 | | * |
9 | | ******************************************************************************* |
10 | | * file name: resbund_cnv.cpp |
11 | | * encoding: UTF-8 |
12 | | * tab size: 8 (not used) |
13 | | * indentation:4 |
14 | | * |
15 | | * created on: 2004aug25 |
16 | | * created by: Markus W. Scherer |
17 | | * |
18 | | * Character conversion functions moved here from resbund.cpp |
19 | | */ |
20 | | |
21 | | #include "unicode/utypes.h" |
22 | | #include "unicode/resbund.h" |
23 | | #include "uinvchar.h" |
24 | | |
25 | | U_NAMESPACE_BEGIN |
26 | | |
27 | | ResourceBundle::ResourceBundle( const UnicodeString& path, |
28 | | const Locale& locale, |
29 | | UErrorCode& error) |
30 | | :UObject(), fLocale(NULL) |
31 | 0 | { |
32 | 0 | constructForLocale(path, locale, error); |
33 | 0 | } |
34 | | |
35 | | ResourceBundle::ResourceBundle( const UnicodeString& path, |
36 | | UErrorCode& error) |
37 | | :UObject(), fLocale(NULL) |
38 | 0 | { |
39 | 0 | constructForLocale(path, Locale::getDefault(), error); |
40 | 0 | } |
41 | | |
42 | | void |
43 | | ResourceBundle::constructForLocale(const UnicodeString& path, |
44 | | const Locale& locale, |
45 | | UErrorCode& error) |
46 | 0 | { |
47 | 0 | if (path.isEmpty()) { |
48 | 0 | fResource = ures_open(NULL, locale.getName(), &error); |
49 | 0 | } |
50 | 0 | else { |
51 | 0 | UnicodeString nullTerminatedPath(path); |
52 | 0 | nullTerminatedPath.append((UChar)0); |
53 | 0 | fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error); |
54 | 0 | } |
55 | 0 | } |
56 | | |
57 | | U_NAMESPACE_END |