LCOV - code coverage report
Current view: top level - svx/inc/svx - svdsob.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 26 92.3 %
Date: 2012-08-25 Functions: 8 9 88.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVDSOB_HXX
      30                 :            : #define _SVDSOB_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/uno/Any.hxx>
      33                 :            : #include <tools/stream.hxx>
      34                 :            : 
      35                 :            : #include "svx/svxdllapi.h"
      36                 :            : 
      37                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      38                 :            : /*
      39                 :            :   Deklaration eines statischen Mengentyps. Die Menge kann die Elemente
      40                 :            :   0..255 aufnehmen und verbraucht stets 32 Bytes.
      41                 :            : */
      42                 :            : 
      43                 :            : class SVX_DLLPUBLIC SetOfByte
      44                 :            : {
      45                 :            : protected:
      46                 :            :     sal_uInt8 aData[32];
      47                 :            : 
      48                 :            : public:
      49                 :      87315 :     explicit SetOfByte(sal_Bool bInitVal = sal_False)
      50                 :            :     {
      51         [ +  + ]:      87315 :         memset(aData, bInitVal ? 0xFF : 0x00, sizeof(aData));
      52                 :      87315 :     }
      53                 :            : 
      54                 :          0 :     sal_Bool operator==(const SetOfByte& rCmpSet) const
      55                 :            :     {
      56                 :          0 :         return (memcmp(aData, rCmpSet.aData, sizeof(aData)) == 0);
      57                 :            :     }
      58                 :            : 
      59                 :         97 :     sal_Bool operator!=(const SetOfByte& rCmpSet) const
      60                 :            :     {
      61                 :         97 :         return (memcmp(aData, rCmpSet.aData, sizeof(aData))!=0);
      62                 :            :     }
      63                 :            : 
      64                 :      72247 :     void Set(sal_uInt8 a)
      65                 :            :     {
      66                 :      72247 :         aData[a/8] |= 1<<a%8;
      67                 :      72247 :     }
      68                 :            : 
      69                 :       8377 :     void Clear(sal_uInt8 a)
      70                 :            :     {
      71                 :       8377 :         aData[a/8] &= ~(1<<a%8);
      72                 :       8377 :     }
      73                 :            : 
      74                 :       7246 :     void Set(sal_uInt8 a, sal_Bool b)
      75                 :            :     {
      76         [ +  + ]:       7246 :         if(b)
      77                 :       1091 :             Set(a);
      78                 :            :         else
      79                 :       6155 :             Clear(a);
      80                 :       7246 :     }
      81                 :            : 
      82                 :     197748 :     sal_Bool IsSet(sal_uInt8 a) const
      83                 :            :     {
      84                 :     197748 :         return (aData[a/8] & 1<<a%8) != 0;
      85                 :            :     }
      86                 :            : 
      87                 :      10172 :     void SetAll()
      88                 :            :     {
      89                 :      10172 :         memset(aData, 0xFF, sizeof(aData));
      90                 :      10172 :     }
      91                 :            : 
      92                 :      43512 :     void ClearAll()
      93                 :            :     {
      94                 :      43512 :         memset(aData, 0x00, sizeof(aData));
      95                 :      43512 :     }
      96                 :            : 
      97                 :            :     sal_Bool IsEmpty() const;
      98                 :            : 
      99                 :            :     void operator&=(const SetOfByte& r2ndSet);
     100                 :            :     void operator|=(const SetOfByte& r2ndSet);
     101                 :            : 
     102                 :            :     friend inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet);
     103                 :            :     friend inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet);
     104                 :            : 
     105                 :            :     // initialize this set with a uno sequence of sal_Int8
     106                 :            :     void PutValue(const com::sun::star::uno::Any & rAny);
     107                 :            : 
     108                 :            :     // returns a uno sequence of sal_Int8
     109                 :            :     void QueryValue(com::sun::star::uno::Any & rAny) const;
     110                 :            : };
     111                 :            : 
     112                 :            : inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet)
     113                 :            : {
     114                 :            :     rOut.Write((char*)rSet.aData,32);
     115                 :            :     return rOut;
     116                 :            : }
     117                 :            : 
     118                 :            : inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet)
     119                 :            : {
     120                 :            :     rIn.Read((char*)rSet.aData,32);
     121                 :            :     return rIn;
     122                 :            : }
     123                 :            : 
     124                 :            : #endif // _SVDSOB_HXX
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10