LCOV - code coverage report
Current view: top level - sc/inc - segmenttree.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 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             : #ifndef INCLUDED_SC_INC_SEGMENTTREE_HXX
      21             : #define INCLUDED_SC_INC_SEGMENTTREE_HXX
      22             : 
      23             : #include "address.hxx"
      24             : 
      25             : #include <memory>
      26             : 
      27             : class ScFlatBoolSegmentsImpl;
      28             : 
      29             : class ScFlatBoolRowSegments
      30             : {
      31             : public:
      32             :     struct RangeData
      33             :     {
      34             :         SCROW   mnRow1;
      35             :         SCROW   mnRow2;
      36             :         bool    mbValue;
      37             :     };
      38             : 
      39             :     class ForwardIterator
      40             :     {
      41             :     public:
      42             :         explicit ForwardIterator(ScFlatBoolRowSegments& rSegs);
      43             : 
      44             :         bool getValue(SCROW nPos, bool& rVal);
      45      712440 :         SCROW getLastPos() const { return mnLastPos;}
      46             : 
      47             :     private:
      48             :         ScFlatBoolRowSegments&  mrSegs;
      49             : 
      50             :         SCROW   mnCurPos;
      51             :         SCROW   mnLastPos;
      52             :         bool    mbCurValue;
      53             :     };
      54             : 
      55             :     class RangeIterator
      56             :     {
      57             :     public:
      58             :         explicit RangeIterator(ScFlatBoolRowSegments& rSegs);
      59             :         bool getFirst(RangeData& rRange);
      60             :         bool getNext(RangeData& rRange);
      61             :     private:
      62             :         ScFlatBoolRowSegments& mrSegs;
      63             :     };
      64             : 
      65             :     ScFlatBoolRowSegments();
      66             :     ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r);
      67             :     ~ScFlatBoolRowSegments();
      68             : 
      69             :     bool setTrue(SCROW nRow1, SCROW nRow2);
      70             :     bool setFalse(SCROW nRow1, SCROW nRow2);
      71             :     bool getRangeData(SCROW nRow, RangeData& rData);
      72             :     bool getRangeDataLeaf(SCROW nRow, RangeData& rData);
      73             :     void removeSegment(SCROW nRow1, SCROW nRow2);
      74             :     void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
      75             : 
      76             :     SCROW findLastNotOf(bool bValue) const;
      77             : 
      78             : private:
      79             :     ::std::unique_ptr<ScFlatBoolSegmentsImpl> mpImpl;
      80             : };
      81             : 
      82             : class ScFlatBoolColSegments
      83             : {
      84             : public:
      85             :     struct RangeData
      86             :     {
      87             :         SCCOL   mnCol1;
      88             :         SCCOL   mnCol2;
      89             :         bool    mbValue;
      90             :     };
      91             :     ScFlatBoolColSegments();
      92             :     ScFlatBoolColSegments(const ScFlatBoolColSegments& r);
      93             :     ~ScFlatBoolColSegments();
      94             : 
      95             :     bool setTrue(SCCOL nCol1, SCCOL nCol2);
      96             :     bool setFalse(SCCOL nCol1, SCCOL nCol2);
      97             :     bool getRangeData(SCCOL nCol, RangeData& rData);
      98             :     void removeSegment(SCCOL nCol1, SCCOL nCol2);
      99             :     void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary);
     100             : 
     101             : private:
     102             :     ::std::unique_ptr<ScFlatBoolSegmentsImpl> mpImpl;
     103             : };
     104             : 
     105             : class ScFlatUInt16SegmentsImpl;
     106             : 
     107             : class ScFlatUInt16RowSegments
     108             : {
     109             : public:
     110             :     struct RangeData
     111             :     {
     112             :         SCROW       mnRow1;
     113             :         SCROW       mnRow2;
     114             :         sal_uInt16  mnValue;
     115             :     };
     116             : 
     117             :     class ForwardIterator
     118             :     {
     119             :     public:
     120             :         explicit ForwardIterator(ScFlatUInt16RowSegments& rSegs);
     121             : 
     122             :         bool getValue(SCROW nPos, sal_uInt16& rVal);
     123      713258 :         SCROW getLastPos() const { return mnLastPos;}
     124             : 
     125             :     private:
     126             :         ScFlatUInt16RowSegments&  mrSegs;
     127             : 
     128             :         SCROW       mnCurPos;
     129             :         SCROW       mnLastPos;
     130             :         sal_uInt16  mnCurValue;
     131             :     };
     132             : 
     133             :     ScFlatUInt16RowSegments(sal_uInt16 nDefault);
     134             :     ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r);
     135             :     ~ScFlatUInt16RowSegments();
     136             : 
     137             :     void setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue);
     138             :     sal_uInt16 getValue(SCROW nRow);
     139             :     sal_uInt32 getSumValue(SCROW nRow1, SCROW nRow2);
     140             :     bool getRangeData(SCROW nRow, RangeData& rData);
     141             :     void removeSegment(SCROW nRow1, SCROW nRow2);
     142             :     void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
     143             : 
     144             :     SCROW findLastNotOf(sal_uInt16 nValue) const;
     145             : 
     146             :     void enableTreeSearch(bool bEnable);
     147             : 
     148             : private:
     149             :     ::std::unique_ptr<ScFlatUInt16SegmentsImpl> mpImpl;
     150             : };
     151             : 
     152             : #endif
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11