LCOV - code coverage report
Current view: top level - intl/icu/source/common - servrbf.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          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             :  * Copyright (C) 2001-2014, International Business Machines Corporation and    *
       6             :  * others. All Rights Reserved.                                                *
       7             :  *******************************************************************************
       8             :  *
       9             :  *******************************************************************************
      10             :  */
      11             : #include "unicode/utypes.h"
      12             : 
      13             : #if !UCONFIG_NO_SERVICE
      14             : 
      15             : #include "unicode/resbund.h"
      16             : #include "uresimp.h"
      17             : #include "cmemory.h"
      18             : #include "servloc.h"
      19             : #include "ustrfmt.h"
      20             : #include "uhash.h"
      21             : #include "charstr.h"
      22             : #include "ucln_cmn.h"
      23             : #include "uassert.h"
      24             : 
      25             : #define UNDERSCORE_CHAR ((UChar)0x005f)
      26             : #define AT_SIGN_CHAR    ((UChar)64)
      27             : #define PERIOD_CHAR     ((UChar)46)
      28             : 
      29             : U_NAMESPACE_BEGIN
      30             : 
      31           0 : ICUResourceBundleFactory::ICUResourceBundleFactory()
      32             :   : LocaleKeyFactory(VISIBLE)
      33           0 :   , _bundleName()
      34             : {
      35           0 : }
      36             : 
      37           0 : ICUResourceBundleFactory::ICUResourceBundleFactory(const UnicodeString& bundleName)
      38             :   : LocaleKeyFactory(VISIBLE)
      39           0 :   , _bundleName(bundleName)
      40             : {
      41           0 : }
      42             : 
      43           0 : ICUResourceBundleFactory::~ICUResourceBundleFactory() {}
      44             : 
      45             : const Hashtable*
      46           0 : ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const
      47             : {
      48           0 :     if (U_SUCCESS(status)) {
      49           0 :         return LocaleUtility::getAvailableLocaleNames(_bundleName);
      50             :     }
      51           0 :     return NULL;
      52             : }
      53             : 
      54             : UObject*
      55           0 : ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, const ICUService* /* service */, UErrorCode& status) const
      56             : {
      57           0 :     if (U_SUCCESS(status)) {
      58             :         // _bundleName is a package name
      59             :         // and should only contain invariant characters
      60             :                 // ??? is it always true that the max length of the bundle name is 19?
      61             :                 // who made this change? -- dlf
      62             :         char pkg[20];
      63             :         int32_t length;
      64           0 :         length=_bundleName.extract(0, INT32_MAX, pkg, (int32_t)sizeof(pkg), US_INV);
      65           0 :         if(length>=(int32_t)sizeof(pkg)) {
      66           0 :             return NULL;
      67             :         }
      68           0 :         return new ResourceBundle(pkg, loc, status);
      69             :     }
      70           0 :     return NULL;
      71             : }
      72             : 
      73             : #ifdef SERVICE_DEBUG
      74             : UnicodeString&
      75             : ICUResourceBundleFactory::debug(UnicodeString& result) const
      76             : {
      77             :     LocaleKeyFactory::debug(result);
      78             :     result.append((UnicodeString)", bundle: ");
      79             :     return result.append(_bundleName);
      80             : }
      81             : 
      82             : UnicodeString&
      83             : ICUResourceBundleFactory::debugClass(UnicodeString& result) const
      84             : {
      85             :     return result.append((UnicodeString)"ICUResourceBundleFactory");
      86             : }
      87             : #endif
      88             : 
      89           0 : UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUResourceBundleFactory)
      90             : 
      91             : U_NAMESPACE_END
      92             : 
      93             : /* !UCONFIG_NO_SERVICE */
      94             : #endif
      95             : 
      96             : 

Generated by: LCOV version 1.13