]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/resbund_cnv.cpp
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / common / resbund_cnv.cpp
CommitLineData
374ca955
A
1/*
2*******************************************************************************
3*
73c04bcf 4* Copyright (C) 1997-2006, International Business Machines
374ca955
A
5* Corporation and others. All Rights Reserved.
6*
7*******************************************************************************
8* file name: resbund_cnv.cpp
9* encoding: US-ASCII
10* tab size: 8 (not used)
11* indentation:4
12*
13* created on: 2004aug25
14* created by: Markus W. Scherer
15*
16* Character conversion functions moved here from resbund.cpp
17*/
18
19#include "unicode/utypes.h"
20#include "unicode/resbund.h"
21#include "uinvchar.h"
22
23U_NAMESPACE_BEGIN
24
25ResourceBundle::ResourceBundle( const UnicodeString& path,
26 const Locale& locale,
27 UErrorCode& error)
28 :UObject(), fLocale(NULL)
29{
30 constructForLocale(path, locale, error);
31}
32
33ResourceBundle::ResourceBundle( const UnicodeString& path,
34 UErrorCode& error)
35 :UObject(), fLocale(NULL)
36{
37 constructForLocale(path, Locale::getDefault(), error);
38}
39
40void
41ResourceBundle::constructForLocale(const UnicodeString& path,
42 const Locale& locale,
43 UErrorCode& error)
44{
73c04bcf
A
45 if (path.isEmpty()) {
46 fResource = ures_open(NULL, locale.getName(), &error);
47 }
48 else {
49 UnicodeString nullTerminatedPath(path);
50 nullTerminatedPath.append((UChar)0);
51 fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error);
374ca955
A
52 }
53}
54
55U_NAMESPACE_END