michael@0: /* michael@0: ******************************************************************************* michael@0: * michael@0: * Copyright (C) 1997-2006, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************* michael@0: * file name: resbund_cnv.cpp michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2004aug25 michael@0: * created by: Markus W. Scherer michael@0: * michael@0: * Character conversion functions moved here from resbund.cpp michael@0: */ michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/resbund.h" michael@0: #include "uinvchar.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: ResourceBundle::ResourceBundle( const UnicodeString& path, michael@0: const Locale& locale, michael@0: UErrorCode& error) michael@0: :UObject(), fLocale(NULL) michael@0: { michael@0: constructForLocale(path, locale, error); michael@0: } michael@0: michael@0: ResourceBundle::ResourceBundle( const UnicodeString& path, michael@0: UErrorCode& error) michael@0: :UObject(), fLocale(NULL) michael@0: { michael@0: constructForLocale(path, Locale::getDefault(), error); michael@0: } michael@0: michael@0: void michael@0: ResourceBundle::constructForLocale(const UnicodeString& path, michael@0: const Locale& locale, michael@0: UErrorCode& error) michael@0: { michael@0: if (path.isEmpty()) { michael@0: fResource = ures_open(NULL, locale.getName(), &error); michael@0: } michael@0: else { michael@0: UnicodeString nullTerminatedPath(path); michael@0: nullTerminatedPath.append((UChar)0); michael@0: fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error); michael@0: } michael@0: } michael@0: michael@0: U_NAMESPACE_END