LCOV - code coverage report
Current view: top level - intl/icu/source/common - appendable.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 25 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 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) 2011-2012, International Business Machines
       6             : *   Corporation and others.  All Rights Reserved.
       7             : *******************************************************************************
       8             : *   file name:  appendable.cpp
       9             : *   encoding:   UTF-8
      10             : *   tab size:   8 (not used)
      11             : *   indentation:4
      12             : *
      13             : *   created on: 2010dec07
      14             : *   created by: Markus W. Scherer
      15             : */
      16             : 
      17             : #include "unicode/utypes.h"
      18             : #include "unicode/appendable.h"
      19             : #include "unicode/utf16.h"
      20             : 
      21             : U_NAMESPACE_BEGIN
      22             : 
      23           0 : Appendable::~Appendable() {}
      24             : 
      25             : UBool
      26           0 : Appendable::appendCodePoint(UChar32 c) {
      27           0 :     if(c<=0xffff) {
      28           0 :         return appendCodeUnit((UChar)c);
      29             :     } else {
      30           0 :         return appendCodeUnit(U16_LEAD(c)) && appendCodeUnit(U16_TRAIL(c));
      31             :     }
      32             : }
      33             : 
      34             : UBool
      35           0 : Appendable::appendString(const UChar *s, int32_t length) {
      36           0 :     if(length<0) {
      37             :         UChar c;
      38           0 :         while((c=*s++)!=0) {
      39           0 :             if(!appendCodeUnit(c)) {
      40           0 :                 return FALSE;
      41             :             }
      42             :         }
      43           0 :     } else if(length>0) {
      44           0 :         const UChar *limit=s+length;
      45           0 :         do {
      46           0 :             if(!appendCodeUnit(*s++)) {
      47           0 :                 return FALSE;
      48             :             }
      49           0 :         } while(s<limit);
      50             :     }
      51           0 :     return TRUE;
      52             : }
      53             : 
      54             : UBool
      55           0 : Appendable::reserveAppendCapacity(int32_t /*appendCapacity*/) {
      56           0 :     return TRUE;
      57             : }
      58             : 
      59             : UChar *
      60           0 : Appendable::getAppendBuffer(int32_t minCapacity,
      61             :                             int32_t /*desiredCapacityHint*/,
      62             :                             UChar *scratch, int32_t scratchCapacity,
      63             :                             int32_t *resultCapacity) {
      64           0 :     if(minCapacity<1 || scratchCapacity<minCapacity) {
      65           0 :         *resultCapacity=0;
      66           0 :         return NULL;
      67             :     }
      68           0 :     *resultCapacity=scratchCapacity;
      69           0 :     return scratch;
      70             : }
      71             : 
      72             : // UnicodeStringAppendable is implemented in unistr.cpp.
      73             : 
      74             : U_NAMESPACE_END

Generated by: LCOV version 1.13