LCOV - code coverage report
Current view: top level - svl/source/items - itemiter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 22 22 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.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             : 
      21             : #include <svl/itemiter.hxx>
      22             : #include <svl/itempool.hxx>
      23             : #include <svl/itemset.hxx>
      24             : 
      25     2151693 : SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
      26     2151693 :     : m_rSet( rItemSet )
      27             : {
      28     2151693 :     if (!m_rSet.m_nCount)
      29             :     {
      30        3555 :         m_nStart = 1;
      31        3555 :         m_nEnd = 0;
      32             :     }
      33             :     else
      34             :     {
      35     2148138 :         SfxItemArray ppFnd = m_rSet.m_pItems;
      36             : 
      37             :         // Find the first Item that is set
      38     2148138 :         for (m_nStart = 0; !*(ppFnd + m_nStart ); ++m_nStart)
      39             :             ; // empty loop
      40     2148138 :         if (1 < m_rSet.Count())
      41     1142447 :             for (m_nEnd = m_rSet.TotalCount(); !*(ppFnd + --m_nEnd); )
      42             :                 ; // empty loop
      43             :         else
      44     1005691 :             m_nEnd = m_nStart;
      45             :     }
      46             : 
      47     2151693 :     m_nCurrent = m_nStart;
      48     2151693 : }
      49             : 
      50     2151693 : SfxItemIter::~SfxItemIter()
      51             : {
      52     2151693 : }
      53             : 
      54     5374983 : const SfxPoolItem* SfxItemIter::NextItem()
      55             : {
      56     5374983 :     SfxItemArray ppFnd = m_rSet.m_pItems;
      57             : 
      58     5374983 :     if (m_nCurrent < m_nEnd)
      59             :     {
      60    67012968 :         do {
      61    67012968 :             m_nCurrent++;
      62   133072672 :         } while (m_nCurrent < m_nEnd && !*(ppFnd + m_nCurrent ));
      63     4673397 :         return *(ppFnd+m_nCurrent);
      64             :     }
      65      701586 :     return 0;
      66             : }
      67             : 
      68             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11