intl/icu/source/common/resbund_cnv.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/common/resbund_cnv.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 1997-2006, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  resbund_cnv.cpp
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 2004aug25
    1.17 +*   created by: Markus W. Scherer
    1.18 +*
    1.19 +*   Character conversion functions moved here from resbund.cpp
    1.20 +*/
    1.21 +
    1.22 +#include "unicode/utypes.h"
    1.23 +#include "unicode/resbund.h"
    1.24 +#include "uinvchar.h"
    1.25 +
    1.26 +U_NAMESPACE_BEGIN
    1.27 +
    1.28 +ResourceBundle::ResourceBundle( const UnicodeString&    path,
    1.29 +                                const Locale&           locale,
    1.30 +                                UErrorCode&              error)
    1.31 +                                :UObject(), fLocale(NULL)
    1.32 +{
    1.33 +    constructForLocale(path, locale, error);
    1.34 +}
    1.35 +
    1.36 +ResourceBundle::ResourceBundle( const UnicodeString&    path,
    1.37 +                                UErrorCode&              error)
    1.38 +                                :UObject(), fLocale(NULL)
    1.39 +{
    1.40 +    constructForLocale(path, Locale::getDefault(), error);
    1.41 +}
    1.42 +
    1.43 +void 
    1.44 +ResourceBundle::constructForLocale(const UnicodeString& path,
    1.45 +                                   const Locale& locale,
    1.46 +                                   UErrorCode& error)
    1.47 +{
    1.48 +    if (path.isEmpty()) {
    1.49 +        fResource = ures_open(NULL, locale.getName(), &error);
    1.50 +    }
    1.51 +    else {
    1.52 +        UnicodeString nullTerminatedPath(path);
    1.53 +        nullTerminatedPath.append((UChar)0);
    1.54 +        fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error);
    1.55 +    }
    1.56 +}
    1.57 +
    1.58 +U_NAMESPACE_END

mercurial