1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdsob.hxx,v $
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 ************************************************************************/
34 #ifndef _COM_SUN_STAR_UNO_ANY_HXX_
35 #include <com/sun/star/uno/Any.hxx>
39 #include <tools/stream.hxx>
47 ////////////////////////////////////////////////////////////////////////////////////////////////////
49 Deklaration eines statischen Mengentyps. Die Menge kann die Elemente
50 0..255 aufnehmen und verbraucht stets 32 Bytes.
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);
82 inline SvStream
& operator>>(SvStream
& rIn
, SetOfByte
& rSet
)
84 rIn
.Read((char*)rSet
.aData
,32);
88 }//end of namespace binfilter