xref: /aoo41x/main/tools/inc/tools/globname.hxx (revision 67e470da)
1*8b851043SAndrew Rist /**************************************************************
2*8b851043SAndrew Rist  *
3*8b851043SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*8b851043SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*8b851043SAndrew Rist  * distributed with this work for additional information
6*8b851043SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*8b851043SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*8b851043SAndrew Rist  * "License"); you may not use this file except in compliance
9*8b851043SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*8b851043SAndrew Rist  *
11*8b851043SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*8b851043SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*8b851043SAndrew Rist  * software distributed under the License is distributed on an
15*8b851043SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*8b851043SAndrew Rist  * KIND, either express or implied.  See the License for the
17*8b851043SAndrew Rist  * specific language governing permissions and limitations
18*8b851043SAndrew Rist  * under the License.
19*8b851043SAndrew Rist  *
20*8b851043SAndrew Rist  *************************************************************/
21*8b851043SAndrew Rist 
22*8b851043SAndrew Rist 
23cdf0e10cSrcweir #ifndef _GLOBNAME_HXX
24cdf0e10cSrcweir #define _GLOBNAME_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "tools/toolsdllapi.h"
27cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
28cdf0e10cSrcweir #include <tools/string.hxx>
29cdf0e10cSrcweir #include <tools/list.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /*************************************************************************
32cdf0e10cSrcweir *************************************************************************/
33cdf0e10cSrcweir struct ImpSvGlobalName
34cdf0e10cSrcweir {
35cdf0e10cSrcweir     sal_uInt8       szData[ 16 ];
36cdf0e10cSrcweir     sal_uInt16      nRefCount;
37cdf0e10cSrcweir 
ImpSvGlobalNameImpSvGlobalName38cdf0e10cSrcweir                 ImpSvGlobalName()
39cdf0e10cSrcweir                 {
40cdf0e10cSrcweir                     nRefCount = 0;
41cdf0e10cSrcweir                 }
42cdf0e10cSrcweir                 ImpSvGlobalName( const ImpSvGlobalName & rObj );
43cdf0e10cSrcweir                 ImpSvGlobalName( int );
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     sal_Bool    operator == ( const ImpSvGlobalName & rObj ) const;
46cdf0e10cSrcweir };
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #ifdef WNT
49cdf0e10cSrcweir struct _GUID;
50cdf0e10cSrcweir typedef struct _GUID GUID;
51cdf0e10cSrcweir #else
52cdf0e10cSrcweir struct GUID;
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir typedef GUID CLSID;
55cdf0e10cSrcweir class SvStream;
56cdf0e10cSrcweir class SvGlobalNameList;
57cdf0e10cSrcweir class TOOLS_DLLPUBLIC SvGlobalName
58cdf0e10cSrcweir {
59cdf0e10cSrcweir friend class SvGlobalNameList;
60cdf0e10cSrcweir     ImpSvGlobalName * pImp;
61cdf0e10cSrcweir     void    NewImp();
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir             SvGlobalName();
SvGlobalName(const SvGlobalName & rObj)64cdf0e10cSrcweir             SvGlobalName( const SvGlobalName & rObj )
65cdf0e10cSrcweir             {
66cdf0e10cSrcweir                 pImp = rObj.pImp;
67cdf0e10cSrcweir                 pImp->nRefCount++;
68cdf0e10cSrcweir             }
SvGlobalName(ImpSvGlobalName * pImpP)69cdf0e10cSrcweir             SvGlobalName( ImpSvGlobalName * pImpP )
70cdf0e10cSrcweir             {
71cdf0e10cSrcweir                 pImp = pImpP;
72cdf0e10cSrcweir                 pImp->nRefCount++;
73cdf0e10cSrcweir             }
74cdf0e10cSrcweir             SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
75cdf0e10cSrcweir                           sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
76cdf0e10cSrcweir                           sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir             // create SvGlobalName from a platform independent representation
79cdf0e10cSrcweir             SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq );
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     SvGlobalName & operator = ( const SvGlobalName & rObj );
82cdf0e10cSrcweir             ~SvGlobalName();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & );
85cdf0e10cSrcweir     TOOLS_DLLPUBLIC friend SvStream & operator << ( SvStream &, const SvGlobalName & );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     sal_Bool            operator < ( const SvGlobalName & rObj ) const;
88cdf0e10cSrcweir     SvGlobalName &  operator += ( sal_uInt32 );
operator ++()89cdf0e10cSrcweir     SvGlobalName &  operator ++ () { return operator += ( 1 ); }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     sal_Bool    operator == ( const SvGlobalName & rObj ) const;
operator !=(const SvGlobalName & rObj) const92cdf0e10cSrcweir     sal_Bool    operator != ( const SvGlobalName & rObj ) const
93cdf0e10cSrcweir             { return !(*this == rObj); }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     void    MakeFromMemory( void * pData );
96cdf0e10cSrcweir     sal_Bool    MakeId( const String & rId );
97cdf0e10cSrcweir     String  GetctorName() const;
98cdf0e10cSrcweir     String  GetHexName() const;
GetRegDbName() const99cdf0e10cSrcweir     String  GetRegDbName() const
100cdf0e10cSrcweir 			{
101cdf0e10cSrcweir 				String a = '{';
102cdf0e10cSrcweir 				a += GetHexName();
103cdf0e10cSrcweir 				a += '}';
104cdf0e10cSrcweir 				return a;
105cdf0e10cSrcweir 			}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir                   SvGlobalName( const CLSID & rId );
GetCLSID() const108cdf0e10cSrcweir     const CLSID & GetCLSID() const { return *(CLSID *)pImp->szData; }
GetBytes() const109cdf0e10cSrcweir 	const sal_uInt8* GetBytes() const { return pImp->szData; }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     // platform independent representation of a "GlobalName"
112cdf0e10cSrcweir     // maybe transported remotely
113cdf0e10cSrcweir     com::sun::star::uno::Sequence < sal_Int8 > GetByteSequence() const;
114cdf0e10cSrcweir };
115cdf0e10cSrcweir 
116cdf0e10cSrcweir class SvGlobalNameList
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     List aList;
119cdf0e10cSrcweir public:
120cdf0e10cSrcweir                     SvGlobalNameList();
121cdf0e10cSrcweir                     ~SvGlobalNameList();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     void            Append( const SvGlobalName & );
124cdf0e10cSrcweir     SvGlobalName    GetObject( sal_uLong );
125cdf0e10cSrcweir     sal_Bool            IsEntry( const SvGlobalName & rName );
Count() const126cdf0e10cSrcweir     sal_uInt32           Count() const { return aList.Count(); }
127cdf0e10cSrcweir private:
128cdf0e10cSrcweir                 // nicht erlaubt
129cdf0e10cSrcweir                 SvGlobalNameList( const SvGlobalNameList & );
130cdf0e10cSrcweir     SvGlobalNameList & operator = ( const SvGlobalNameList & );
131cdf0e10cSrcweir };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir #endif // _GLOBNAME_HXX
134cdf0e10cSrcweir 
135