/src/libreoffice/include/tools/globname.hxx
Line | Count | Source |
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 <tools/toolsdllapi.h> |
23 | | |
24 | | #include <rtl/ustring.hxx> |
25 | | |
26 | | namespace com::sun::star::uno { template <class E> class Sequence; } |
27 | | |
28 | | struct SAL_WARN_UNUSED SvGUID |
29 | | { |
30 | | sal_uInt32 Data1; |
31 | | sal_uInt16 Data2; |
32 | | sal_uInt16 Data3; |
33 | | sal_uInt8 Data4[8]; |
34 | 18.4E | friend constexpr auto operator<=>(const SvGUID&, const SvGUID&) = default; |
35 | 2.04M | friend constexpr bool operator==(const SvGUID&, const SvGUID&) = default; |
36 | | }; |
37 | | |
38 | | class SvStream; |
39 | | |
40 | | class SAL_WARN_UNUSED TOOLS_DLLPUBLIC SvGlobalName |
41 | | { |
42 | | public: |
43 | 192k | constexpr SvGlobalName() = default; |
44 | | constexpr SvGlobalName(const SvGlobalName& rObj) = default; |
45 | | |
46 | | inline constexpr SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, |
47 | | sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, |
48 | | sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ); |
49 | | |
50 | | // create SvGlobalName from a platform independent representation |
51 | | SvGlobalName( const css::uno::Sequence< sal_Int8 >& aSeq ); |
52 | | |
53 | | inline constexpr SvGlobalName( const SvGUID & rId ); |
54 | | |
55 | | SvGlobalName & operator = ( const SvGlobalName & rObj ) = default; |
56 | | |
57 | | TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); |
58 | | TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & ); |
59 | | |
60 | 1.54M | friend constexpr auto operator<=>(const SvGlobalName&, const SvGlobalName&) = default; |
61 | 95.4k | friend constexpr bool operator==(const SvGlobalName&, const SvGlobalName&) = default; |
62 | | |
63 | | void MakeFromMemory( void const * pData ); |
64 | | bool MakeId( std::u16string_view rId ); |
65 | | OUString GetHexName() const; |
66 | | |
67 | 350 | const SvGUID& GetCLSID() const { return m_aData; } |
68 | | |
69 | | // platform independent representation of a "GlobalName" |
70 | | // maybe transported remotely |
71 | | css::uno::Sequence < sal_Int8 > GetByteSequence() const; |
72 | | |
73 | | private: |
74 | | SvGUID m_aData = {}; |
75 | | }; |
76 | | |
77 | | inline constexpr SvGlobalName::SvGlobalName(const SvGUID& rId) |
78 | 3.17k | : m_aData(rId) |
79 | 3.17k | { |
80 | 3.17k | } |
81 | | |
82 | | inline constexpr SvGlobalName::SvGlobalName(sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, |
83 | | sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, |
84 | | sal_uInt8 b11, sal_uInt8 b12, sal_uInt8 b13, |
85 | | sal_uInt8 b14, sal_uInt8 b15) |
86 | 212k | : m_aData{ n1, n2, n3, { b8, b9, b10, b11, b12, b13, b14, b15 } } |
87 | 212k | { |
88 | 212k | } |
89 | | |
90 | | #endif |
91 | | |
92 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |