Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * |
michael@0 | 4 | * Copyright (C) 1997-2006, International Business Machines |
michael@0 | 5 | * Corporation and others. All Rights Reserved. |
michael@0 | 6 | * |
michael@0 | 7 | ******************************************************************************* |
michael@0 | 8 | * file name: resbund_cnv.cpp |
michael@0 | 9 | * encoding: US-ASCII |
michael@0 | 10 | * tab size: 8 (not used) |
michael@0 | 11 | * indentation:4 |
michael@0 | 12 | * |
michael@0 | 13 | * created on: 2004aug25 |
michael@0 | 14 | * created by: Markus W. Scherer |
michael@0 | 15 | * |
michael@0 | 16 | * Character conversion functions moved here from resbund.cpp |
michael@0 | 17 | */ |
michael@0 | 18 | |
michael@0 | 19 | #include "unicode/utypes.h" |
michael@0 | 20 | #include "unicode/resbund.h" |
michael@0 | 21 | #include "uinvchar.h" |
michael@0 | 22 | |
michael@0 | 23 | U_NAMESPACE_BEGIN |
michael@0 | 24 | |
michael@0 | 25 | ResourceBundle::ResourceBundle( const UnicodeString& path, |
michael@0 | 26 | const Locale& locale, |
michael@0 | 27 | UErrorCode& error) |
michael@0 | 28 | :UObject(), fLocale(NULL) |
michael@0 | 29 | { |
michael@0 | 30 | constructForLocale(path, locale, error); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | ResourceBundle::ResourceBundle( const UnicodeString& path, |
michael@0 | 34 | UErrorCode& error) |
michael@0 | 35 | :UObject(), fLocale(NULL) |
michael@0 | 36 | { |
michael@0 | 37 | constructForLocale(path, Locale::getDefault(), error); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | void |
michael@0 | 41 | ResourceBundle::constructForLocale(const UnicodeString& path, |
michael@0 | 42 | const Locale& locale, |
michael@0 | 43 | UErrorCode& error) |
michael@0 | 44 | { |
michael@0 | 45 | if (path.isEmpty()) { |
michael@0 | 46 | fResource = ures_open(NULL, locale.getName(), &error); |
michael@0 | 47 | } |
michael@0 | 48 | else { |
michael@0 | 49 | UnicodeString nullTerminatedPath(path); |
michael@0 | 50 | nullTerminatedPath.append((UChar)0); |
michael@0 | 51 | fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error); |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | U_NAMESPACE_END |