LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/sfx2 - minarray.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 7 0.0 %
Date: 2012-12-27 Functions: 0 5 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             : #ifndef _SFXVARARR_HXX
      20             : #define _SFXVARARR_HXX
      21             : 
      22             : #include "sal/config.h"
      23             : #include "sfx2/dllapi.h"
      24             : 
      25             : #include <limits.h>
      26             : #include <string.h>
      27             : #include <tools/solar.h>
      28             : #include <tools/debug.hxx>
      29             : 
      30             : class SFX2_DLLPUBLIC SfxPtrArr
      31             : {
      32             : private:
      33             :     void** pData;
      34             :     sal_uInt16 nUsed;
      35             :     sal_uInt8 nGrow;
      36             :     sal_uInt8 nUnused;
      37             : public:
      38             :     SfxPtrArr( sal_uInt8 nInitSize = 0, sal_uInt8 nGrowSize = 8 );
      39             :     SfxPtrArr( const SfxPtrArr& rOrig );
      40             :     ~SfxPtrArr();
      41             :     SfxPtrArr& operator= ( const SfxPtrArr& rOrig );
      42           0 :     void* GetObject( sal_uInt16 nPos ) const { return operator[](nPos); }
      43           0 :     void*& GetObject( sal_uInt16 nPos ) { return operator[](nPos); }
      44             :     void Insert( sal_uInt16 nPos, void* rElem );
      45             :     void Append( void* rElem );
      46             :     sal_Bool Remove( void* rElem );
      47             :     sal_uInt16 Remove( sal_uInt16 nPos, sal_uInt16 nLen );
      48           0 :     sal_uInt16 Count() const { return nUsed; }
      49             :     inline void** operator*();
      50             :     inline void* operator[]( sal_uInt16 nPos ) const;
      51             :     inline void*& operator[]( sal_uInt16 nPos );
      52             :     sal_Bool Contains( const void* rItem ) const;
      53             :     void Clear() { Remove( 0, Count() ); }
      54             : };
      55             : 
      56             : inline void** SfxPtrArr::operator*()
      57             : {
      58             :     return ( nUsed==0 ? 0 : pData );
      59             : }
      60             : 
      61           0 : inline void* SfxPtrArr::operator[]( sal_uInt16 nPos ) const
      62             : {
      63             :     DBG_ASSERT( nPos < nUsed, "" );
      64           0 :     return *(pData+nPos);
      65             : }
      66             : 
      67           0 : inline void*& SfxPtrArr::operator [] (sal_uInt16 nPos)
      68             : {
      69             :     DBG_ASSERT( nPos < nUsed, "" );
      70           0 :     return *(pData+nPos);
      71             : }
      72             : 
      73             : 
      74             : #define DECL_PTRARRAY(ARR, T, nI, nG)\
      75             : class ARR: public SfxPtrArr\
      76             : {\
      77             : public:\
      78             :    ARR( sal_uInt8 nIni=nI, sal_uInt8 nGrowValue=nG ):\
      79             :        SfxPtrArr(nIni,nGrowValue) \
      80             :    {}\
      81             :    ARR( const ARR& rOrig ):\
      82             :        SfxPtrArr(rOrig) \
      83             :    {}\
      84             :    T GetObject( sal_uInt16 nPos ) const { return operator[](nPos); } \
      85             :    T& GetObject( sal_uInt16 nPos ) { return operator[](nPos); } \
      86             :    void Insert( sal_uInt16 nPos, T aElement ) {\
      87             :        SfxPtrArr::Insert(nPos,(void *)aElement);\
      88             :    }\
      89             :    void Append( T aElement ) {\
      90             :        SfxPtrArr::Append((void *)aElement);\
      91             :    }\
      92             :    void Remove( T aElement ) {\
      93             :        SfxPtrArr::Remove((void*)aElement);\
      94             :    }\
      95             :    void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 ) {\
      96             :        SfxPtrArr::Remove( nPos, nLen ); \
      97             :    }\
      98             :    T* operator *() {\
      99             :        return (T*) SfxPtrArr::operator*();\
     100             :    }\
     101             :    T operator[]( sal_uInt16 nPos ) const { \
     102             :        return (T) SfxPtrArr::operator[](nPos); } \
     103             :    T& operator[]( sal_uInt16 nPos ) { \
     104             :        return (T&) SfxPtrArr::operator[](nPos); } \
     105             :    void Clear() { Remove( 0, Count() ); }\
     106             : };
     107             : 
     108             : #endif
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10