LCOV - code coverage report
Current view: top level - libreoffice/writerfilter/source/doctok - WW8BinTableImpl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 31 3.2 %
Date: 2012-12-27 Functions: 2 5 40.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "WW8BinTableImpl.hxx"
      21             : 
      22             : namespace writerfilter {
      23             : namespace doctok
      24             : {
      25             : using namespace ::std;
      26             : 
      27           0 : void PageNumber::dump(OutputWithDepth<string> & /*output*/) const
      28             : {
      29           0 : }
      30             : 
      31           0 : sal_uInt32 WW8BinTableImpl::getPageNumber(const Fc & rFc) const
      32             : {
      33           0 :     sal_uInt32 nResult = 0;
      34             : 
      35           0 :     if (mPageMap.find(rFc) == mPageMap.end())
      36             :     {
      37           0 :         sal_uInt32 left = 0;
      38           0 :         sal_uInt32 right = getEntryCount();
      39             : 
      40           0 :         while (right - left > 1)
      41             :         {
      42           0 :             sal_uInt32 middle = (right + left) / 2;
      43             : 
      44           0 :             Fc aFc = getFc(middle);
      45             : 
      46           0 :             if (rFc < aFc)
      47           0 :                 right = middle;
      48             :             else
      49           0 :                 left = middle;
      50             : 
      51             :         }
      52             : 
      53           0 :         nResult = getPageNumber(left);
      54           0 :         mPageMap[rFc] = nResult;
      55             : 
      56             :     }
      57             :     else
      58           0 :         nResult = mPageMap[rFc];
      59             : 
      60           0 :     return nResult;
      61             : }
      62             : 
      63           0 : string WW8BinTableImpl::toString() const
      64             : {
      65           0 :     string aResult;
      66             :     char sBuffer[255];
      67             : 
      68           0 :     aResult += "(";
      69             : 
      70           0 :     for (sal_uInt32 n = 0; n < getEntryCount(); n++)
      71             :     {
      72           0 :         if (n > 0)
      73           0 :             aResult += ", ";
      74             : 
      75           0 :         snprintf(sBuffer, 255, "%" SAL_PRIxUINT32, getFc(n).get());
      76           0 :         aResult += sBuffer;
      77           0 :         aResult += "->";
      78           0 :         snprintf(sBuffer, 255, "%" SAL_PRIxUINT32, getPageNumber(n));
      79           0 :         aResult += sBuffer;
      80             :     }
      81             : 
      82           0 :     aResult += ")";
      83             : 
      84           0 :     return aResult;
      85             : }
      86          15 : }}
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10