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 INCLUDED_TOOLS_GLOBNAME_HXX
20 : #define INCLUDED_TOOLS_GLOBNAME_HXX
21 :
22 : #include <vector>
23 :
24 : #include <tools/toolsdllapi.h>
25 : #include <com/sun/star/uno/Sequence.hxx>
26 :
27 : struct ImpSvGlobalName
28 : {
29 : sal_uInt8 szData[ 16 ];
30 : sal_uInt16 nRefCount;
31 :
32 : enum Empty { EMPTY };
33 :
34 0 : ImpSvGlobalName()
35 : {
36 0 : nRefCount = 0;
37 0 : }
38 : ImpSvGlobalName( const ImpSvGlobalName & rObj );
39 : ImpSvGlobalName( Empty );
40 :
41 : bool operator == ( const ImpSvGlobalName & rObj ) const;
42 : };
43 :
44 : #ifdef WNT
45 : struct _GUID;
46 : typedef struct _GUID GUID;
47 : #else
48 : struct GUID;
49 : #endif
50 :
51 : typedef GUID CLSID;
52 : class SvStream;
53 :
54 : class TOOLS_DLLPUBLIC SvGlobalName
55 : {
56 : ImpSvGlobalName * pImp;
57 : void NewImp();
58 :
59 : public:
60 : SvGlobalName();
61 0 : SvGlobalName( const SvGlobalName & rObj )
62 : {
63 0 : pImp = rObj.pImp;
64 0 : pImp->nRefCount++;
65 0 : }
66 : SvGlobalName( ImpSvGlobalName * pImpP )
67 : {
68 : pImp = pImpP;
69 : pImp->nRefCount++;
70 : }
71 : SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
72 : sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
73 : sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
74 :
75 : // create SvGlobalName from a platform independent representation
76 : SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq );
77 :
78 : SvGlobalName & operator = ( const SvGlobalName & rObj );
79 : ~SvGlobalName();
80 :
81 : TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & );
82 : TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & );
83 :
84 : bool operator < ( const SvGlobalName & rObj ) const;
85 : SvGlobalName& operator += ( sal_uInt32 );
86 0 : SvGlobalName& operator ++ () { return operator += ( 1 ); }
87 :
88 : bool operator == ( const SvGlobalName & rObj ) const;
89 0 : bool operator != ( const SvGlobalName & rObj ) const
90 0 : { return !(*this == rObj); }
91 :
92 : void MakeFromMemory( void * pData );
93 : bool MakeId( const OUString & rId );
94 : OUString GetHexName() const;
95 :
96 : SvGlobalName( const CLSID & rId );
97 0 : const CLSID & GetCLSID() const { return *(CLSID *)pImp->szData; }
98 0 : const sal_uInt8* GetBytes() const { return pImp->szData; }
99 :
100 : // platform independent representation of a "GlobalName"
101 : // maybe transported remotely
102 : com::sun::star::uno::Sequence < sal_Int8 > GetByteSequence() const;
103 : };
104 :
105 : #endif
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|