Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svx / svdsob.hxx
blobb9e07dd2bbd8333bf6c9873c17f42a007159c102
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdsob.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVDSOB_HXX
32 #define _SVDSOB_HXX
34 #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
35 #include <com/sun/star/uno/Any.hxx>
36 #endif
38 #ifndef _STREAM_HXX
39 #include <tools/stream.hxx>
40 #endif
42 #ifndef _STRING_H
43 #define _STRING_H
44 #endif
45 namespace binfilter {
47 ////////////////////////////////////////////////////////////////////////////////////////////////////
49 Deklaration eines statischen Mengentyps. Die Menge kann die Elemente
50 0..255 aufnehmen und verbraucht stets 32 Bytes.
53 class SetOfByte {
54 protected:
55 BYTE aData[32];
56 public:
57 SetOfByte(FASTBOOL bInitVal=FALSE) { memset(aData,bInitVal ? 0xFF : 0x00,sizeof(aData)); }
58 FASTBOOL operator==(const SetOfByte& rCmpSet) const { return (memcmp(aData,rCmpSet.aData,sizeof(aData))==0); }
59 FASTBOOL operator!=(const SetOfByte& rCmpSet) const { return (memcmp(aData,rCmpSet.aData,sizeof(aData))!=0); }
60 void Set (BYTE a) { aData[a/8]|=1<<a%8; }
61 void Clear(BYTE a) { aData[a/8]&=~(1<<a%8); }
62 void Set (BYTE a, FASTBOOL b) { if (b) Set(a); else Clear(a); }
63 FASTBOOL IsSet(BYTE a) const { return (aData[a/8]&1<<a%8)!=0; }
64 FASTBOOL IsSet(USHORT a) const { return (a<=255) && (aData[a/8]&1<<a%8)!=0; }
65 void SetAll() { memset(aData,0xFF,sizeof(aData)); }
66 void ClearAll() { memset(aData,0x00,sizeof(aData)); }
67 FASTBOOL IsEmpty() const;
68 void operator&=(const SetOfByte& r2ndSet);
69 friend inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet);
70 friend inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet);
72 void PutValue( const ::com::sun::star::uno::Any & rAny ); // initialize this set with a uno sequence of sal_Int8
73 void QueryValue( ::com::sun::star::uno::Any & rAny ) const; // returns a uno sequence of sal_Int8
76 inline SvStream& operator<<(SvStream& rOut, const SetOfByte& rSet)
78 rOut.Write((char*)rSet.aData,32);
79 return rOut;
82 inline SvStream& operator>>(SvStream& rIn, SetOfByte& rSet)
84 rIn.Read((char*)rSet.aData,32);
85 return rIn;
88 }//end of namespace binfilter
89 #endif // _SVDSOB_HXX