LCOV - code coverage report
Current view: top level - sc/source/ui/inc - csvsplits.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 5 0.0 %
Date: 2014-04-14 Functions: 0 6 0.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 _SC_CSVSPLITS_HXX
      21             : #define _SC_CSVSPLITS_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : 
      25             : #include <vector>
      26             : 
      27             : 
      28             : /** Constant for an invalid vector index. */
      29             : const sal_uInt32 CSV_VEC_NOTFOUND   = SAL_MAX_UINT32;
      30             : /** Constant for an invalid ruler position. */
      31             : const sal_Int32 CSV_POS_INVALID     = -1;
      32             : 
      33             : 
      34             : /** A vector of column splits that supports inserting, removing and moving splits. */
      35           0 : class ScCsvSplits
      36             : {
      37             : private:
      38             :     typedef ::std::vector< sal_Int32 >      ScSplitVector;
      39             :     typedef ScSplitVector::iterator         iterator;
      40             :     typedef ScSplitVector::const_iterator   const_iterator;
      41             : 
      42             :     ScSplitVector               maVec;          /// The split containter.
      43             : 
      44             : public:
      45             :     // *** access by position *** ---------------------------------------------
      46             : 
      47             :     /** Inserts a new split at position nPos into the vector.
      48             :         @return  true = split inserted (nPos was valid and empty). */
      49             :     bool                        Insert( sal_Int32 nPos );
      50             :     /** Removes a split by position.
      51             :         @return  true = split found and removed. */
      52             :     bool                        Remove( sal_Int32 nPos );
      53             :     /** Removes a range of splits in the given position range. */
      54             :     void                        RemoveRange( sal_Int32 nPosStart, sal_Int32 nPosEnd );
      55             :     /** Removes all elements from the vector. */
      56             :     void                        Clear();
      57             : 
      58             :     /** Returns true if at position nPos is a split. */
      59             :     bool                        HasSplit( sal_Int32 nPos ) const;
      60             : 
      61             :     // *** access by index *** ------------------------------------------------
      62             : 
      63             :     /** Searches for a split at position nPos.
      64             :         @return  the vector index of the split. */
      65             :     sal_uInt32                  GetIndex( sal_Int32 nPos ) const;
      66             :     /** Returns index of the first split greater than or equal to nPos. */
      67             :     sal_uInt32                  LowerBound( sal_Int32 nPos ) const;
      68             :     /** Returns index of the last split less than or equal to nPos. */
      69             :     sal_uInt32                  UpperBound( sal_Int32 nPos ) const;
      70             : 
      71             :     /** Returns the number of splits. */
      72           0 :     inline sal_uInt32           Count() const
      73           0 :                                     { return maVec.size(); }
      74             :     /** Returns the position of the specified split. */
      75             :     sal_Int32                   GetPos( sal_uInt32 nIndex ) const;
      76             :     /** Returns the position of the specified split. */
      77           0 :     inline sal_Int32            operator[]( sal_uInt32 nIndex ) const
      78           0 :                                     { return GetPos( nIndex ); }
      79             : 
      80             : private:
      81             :     /** Returns the vector index of an iterator. */
      82             :     sal_uInt32                  GetIterIndex( const_iterator aIter ) const;
      83             : };
      84             : 
      85             : 
      86             : #endif
      87             : 
      88             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10