LCOV - code coverage report
Current view: top level - intl/icu/source/i18n - zrule.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 52 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 20 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) 2009-2011, International Business Machines Corporation and
       6             : * others. All Rights Reserved.
       7             : *******************************************************************************
       8             : */
       9             : 
      10             : /**
      11             :  * \file 
      12             :  * \brief C API: Time zone rule classes
      13             :  */
      14             : 
      15             : #include "unicode/utypes.h"
      16             : 
      17             : #if !UCONFIG_NO_FORMATTING
      18             : 
      19             : #include "unicode/uobject.h"
      20             : #include "zrule.h"
      21             : #include "unicode/tzrule.h"
      22             : #include "cmemory.h"
      23             : #include "unicode/ustring.h"
      24             : #include "unicode/parsepos.h"
      25             : 
      26             : U_NAMESPACE_USE
      27             : 
      28             : /*********************************************************************
      29             :  * ZRule API
      30             :  *********************************************************************/
      31             : 
      32             : U_CAPI void U_EXPORT2
      33           0 : zrule_close(ZRule* rule) {
      34           0 :     delete (TimeZoneRule*)rule;
      35           0 : }
      36             : 
      37             : U_CAPI UBool U_EXPORT2
      38           0 : zrule_equals(const ZRule* rule1, const ZRule* rule2) {
      39           0 :     return *(const TimeZoneRule*)rule1 == *(const TimeZoneRule*)rule2;
      40             : }
      41             : 
      42             : U_CAPI void U_EXPORT2
      43           0 : zrule_getName(ZRule* rule, UChar* name, int32_t nameLength) {
      44           0 :     UnicodeString s(nameLength==-1, name, nameLength);
      45           0 :     s = ((TimeZoneRule*)rule)->TimeZoneRule::getName(s);
      46           0 :     nameLength = s.length();
      47           0 :     memcpy(name, s.getBuffer(), nameLength);
      48           0 :     return;
      49             : }
      50             : 
      51             : U_CAPI int32_t U_EXPORT2
      52           0 : zrule_getRawOffset(ZRule* rule) {
      53           0 :     return ((TimeZoneRule*)rule)->TimeZoneRule::getRawOffset();
      54             : }
      55             : 
      56             : U_CAPI int32_t U_EXPORT2
      57           0 : zrule_getDSTSavings(ZRule* rule) {
      58           0 :     return ((TimeZoneRule*)rule)->TimeZoneRule::getDSTSavings();
      59             : }
      60             : 
      61             : U_CAPI UBool U_EXPORT2
      62           0 : zrule_isEquivalentTo(ZRule* rule1,  ZRule* rule2) {
      63           0 :     return ((TimeZoneRule*)rule1)->TimeZoneRule::isEquivalentTo(*(TimeZoneRule*)rule2);
      64             : }
      65             : 
      66             : /*********************************************************************
      67             :  * IZRule API
      68             :  *********************************************************************/
      69             : 
      70             : U_CAPI IZRule* U_EXPORT2
      71           0 : izrule_open(const UChar* name, int32_t nameLength, int32_t rawOffset, int32_t dstSavings) {
      72           0 :     UnicodeString s(nameLength==-1, name, nameLength);
      73           0 :     return (IZRule*) new InitialTimeZoneRule(s, rawOffset, dstSavings);
      74             : }
      75             : 
      76             : U_CAPI void U_EXPORT2
      77           0 : izrule_close(IZRule* rule) {
      78           0 :     delete (InitialTimeZoneRule*)rule;
      79           0 : }
      80             : 
      81             : U_CAPI IZRule* U_EXPORT2
      82           0 : izrule_clone(IZRule *rule) {
      83           0 :     return (IZRule*) (((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::clone());
      84             : }
      85             : 
      86             : U_CAPI UBool U_EXPORT2
      87           0 : izrule_equals(const IZRule* rule1, const IZRule* rule2) {
      88           0 :     return *(const InitialTimeZoneRule*)rule1 == *(const InitialTimeZoneRule*)rule2;
      89             : }
      90             : 
      91             : U_CAPI void U_EXPORT2
      92           0 : izrule_getName(IZRule* rule, UChar* & name, int32_t & nameLength) {
      93             :     // UnicodeString s(nameLength==-1, name, nameLength);
      94           0 :     UnicodeString s;
      95           0 :     ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getName(s);
      96           0 :     nameLength = s.length();
      97           0 :     name = (UChar*)uprv_malloc(nameLength);
      98           0 :     memcpy(name, s.getBuffer(), nameLength);
      99           0 :     return;
     100             : }
     101             : 
     102             : U_CAPI int32_t U_EXPORT2
     103           0 : izrule_getRawOffset(IZRule* rule) {
     104           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getRawOffset();
     105             : }
     106             : 
     107             : U_CAPI int32_t U_EXPORT2
     108           0 : izrule_getDSTSavings(IZRule* rule) {
     109           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getDSTSavings();
     110             : }
     111             : 
     112             : U_CAPI UBool U_EXPORT2
     113           0 : izrule_isEquivalentTo(IZRule* rule1,  IZRule* rule2) {
     114           0 :     return ((InitialTimeZoneRule*)rule1)->InitialTimeZoneRule::isEquivalentTo(*(InitialTimeZoneRule*)rule2);
     115             : }
     116             : 
     117             : U_CAPI UBool U_EXPORT2
     118           0 : izrule_getFirstStart(IZRule* rule, int32_t prevRawOffset, int32_t prevDSTSavings, 
     119             :                     UDate& result) {
     120           0 :     return ((const InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getFirstStart(prevRawOffset, prevDSTSavings, result);
     121             : }
     122             : 
     123             : U_CAPI UBool U_EXPORT2
     124           0 : izrule_getFinalStart(IZRule* rule, int32_t prevRawOffset, int32_t prevDSTSavings, 
     125             :                     UDate& result) {
     126           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getFinalStart(prevRawOffset, prevDSTSavings, result);
     127             : }
     128             : 
     129             : U_CAPI UBool U_EXPORT2
     130           0 : izrule_getNextStart(IZRule* rule, UDate base, int32_t prevRawOffset, 
     131             :                    int32_t prevDSTSavings, UBool inclusive, UDate& result) {
     132           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getNextStart(base, prevRawOffset, prevDSTSavings, inclusive, result);
     133             : }
     134             : 
     135             : U_CAPI UBool U_EXPORT2
     136           0 : izrule_getPreviousStart(IZRule* rule, UDate base, int32_t prevRawOffset, 
     137             :                        int32_t prevDSTSavings, UBool inclusive, UDate& result) {
     138           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getPreviousStart(base, prevRawOffset, prevDSTSavings, inclusive, result);
     139             : }
     140             : 
     141             : U_CAPI UClassID U_EXPORT2
     142           0 : izrule_getStaticClassID(IZRule* rule) {
     143           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getStaticClassID();
     144             : }
     145             : 
     146             : U_CAPI UClassID U_EXPORT2
     147           0 : izrule_getDynamicClassID(IZRule* rule) {
     148           0 :     return ((InitialTimeZoneRule*)rule)->InitialTimeZoneRule::getDynamicClassID();
     149             : }
     150             : 
     151             : #endif

Generated by: LCOV version 1.13