LCOV - code coverage report
Current view: top level - layout/generic - nsIntervalSet.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : // vim:cindent:ts=8:et:sw=4:
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : /* a set of ranges on a number-line */
       8             : 
       9             : #ifndef nsIntervalSet_h___
      10             : #define nsIntervalSet_h___
      11             : 
      12             : #include "nsCoord.h"
      13             : 
      14             : class nsIPresShell;
      15             : 
      16             : /*
      17             :  * A list-based class (hopefully tree-based when I get around to it)
      18             :  * for representing a set of ranges on a number-line.
      19             :  */
      20             : class nsIntervalSet {
      21             : 
      22             : public:
      23             : 
      24             :     typedef nscoord coord_type;
      25             : 
      26             :     explicit nsIntervalSet(nsIPresShell* aPresShell);
      27             :     ~nsIntervalSet();
      28             : 
      29             :     /*
      30             :      * Include the interval [aBegin, aEnd] in the set.
      31             :      *
      32             :      * Removal of intervals added is not supported because that would
      33             :      * require keeping track of the individual intervals that were
      34             :      * added (nsIntervalMap should do that).  It would be simple to
      35             :      * implement ExcludeInterval if anyone wants it, though.
      36             :      */
      37             :     void IncludeInterval(coord_type aBegin, coord_type aEnd);
      38             : 
      39             :     /*
      40             :      * Are _some_ points in [aBegin, aEnd] contained within the set
      41             :      * of intervals?
      42             :      */
      43             :     bool Intersects(coord_type aBegin, coord_type aEnd) const;
      44             : 
      45             :     /*
      46             :      * Are _all_ points in [aBegin, aEnd] contained within the set
      47             :      * of intervals?
      48             :      */
      49             :     bool Contains(coord_type aBegin, coord_type aEnd) const;
      50             : 
      51           0 :     bool IsEmpty() const
      52             :     {
      53           0 :         return !mList;
      54             :     }
      55             : 
      56             : private:
      57             : 
      58             :     class Interval {
      59             : 
      60             :     public:
      61           0 :         Interval(coord_type aBegin, coord_type aEnd)
      62           0 :             : mBegin(aBegin),
      63             :               mEnd(aEnd),
      64             :               mPrev(nullptr),
      65           0 :               mNext(nullptr)
      66             :         {
      67           0 :         }
      68             : 
      69             :         coord_type mBegin;
      70             :         coord_type mEnd;
      71             :         Interval *mPrev;
      72             :         Interval *mNext;
      73             :     };
      74             : 
      75             :     void* AllocateInterval();
      76             :     void FreeInterval(Interval *aInterval);
      77             : 
      78             :     Interval           *mList;
      79             :     nsIPresShell       *mPresShell;
      80             : };
      81             : 
      82             : #endif // !defined(nsIntervalSet_h___)

Generated by: LCOV version 1.13