Line data Source code
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 0 : ResourceBundle::ResourceBundle( const UnicodeString& path,
28 : const Locale& locale,
29 0 : UErrorCode& error)
30 0 : :UObject(), fLocale(NULL)
31 : {
32 0 : constructForLocale(path, locale, error);
33 0 : }
34 :
35 0 : ResourceBundle::ResourceBundle( const UnicodeString& path,
36 0 : UErrorCode& error)
37 0 : :UObject(), fLocale(NULL)
38 : {
39 0 : constructForLocale(path, Locale::getDefault(), error);
40 0 : }
41 :
42 : void
43 0 : ResourceBundle::constructForLocale(const UnicodeString& path,
44 : const Locale& locale,
45 : UErrorCode& error)
46 : {
47 0 : if (path.isEmpty()) {
48 0 : fResource = ures_open(NULL, locale.getName(), &error);
49 : }
50 : else {
51 0 : UnicodeString nullTerminatedPath(path);
52 0 : nullTerminatedPath.append((UChar)0);
53 0 : fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error);
54 : }
55 0 : }
56 :
57 : U_NAMESPACE_END
|