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