LibreOffice Module extensions (master) 1
windata.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <oleidl.h>
22
23#if defined __clang__
24#pragma clang diagnostic push
25#pragma clang diagnostic ignored "-Wall"
26#pragma clang diagnostic ignored "-Wextra"
27#pragma clang diagnostic ignored "-Wignored-attributes"
28#pragma clang diagnostic ignored "-Wint-to-pointer-cast"
29#pragma clang diagnostic ignored "-Winvalid-noreturn"
30#pragma clang diagnostic ignored "-Wmicrosoft"
31#pragma clang diagnostic ignored "-Wnon-pod-varargs"
32#endif
33
34#include <atlbase.h>
35
36#if defined __clang__
37#pragma clang diagnostic pop
38#endif
39
40#include <osl/diagnose.h>
41
42//Wrapper for VARDESC
44{
45 VARDESC* operator = (const VarDesc*);
47// Construction
48public:
49 CComPtr< ITypeInfo > m_pTypeInfo;
50 VARDESC* m_pVarDesc;
51
52 explicit VarDesc(ITypeInfo* pTypeInfo) :
53 m_pTypeInfo(pTypeInfo),
54 m_pVarDesc(nullptr)
55 {
56 OSL_ASSERT(pTypeInfo);
57 }
59 {
60 if (m_pVarDesc != nullptr)
61 {
62 m_pTypeInfo->ReleaseVarDesc(m_pVarDesc);
63 }
64 }
65
66 VARDESC* operator->()
67 {
68 return m_pVarDesc;
69 }
70
71 VARDESC** operator&()
72 {
73 return &m_pVarDesc;
74 }
75
76 operator VARDESC* ()
77 {
78 return m_pVarDesc;
79 }
80};
81
82//Wrapper for FUNCDESC structure
84{
85 FUNCDESC* operator = (const FuncDesc &);
87 CComPtr<ITypeInfo> m_pTypeInfo;
88 FUNCDESC * m_pFuncDesc;
89
90public:
91
92 explicit FuncDesc(ITypeInfo * pTypeInfo) :
93 m_pTypeInfo(pTypeInfo),
94 m_pFuncDesc(nullptr)
95 {
96 OSL_ASSERT(pTypeInfo);
97 }
99 {
101 }
102
103 FUNCDESC* operator -> ()
104 {
105 return m_pFuncDesc;
106 }
107
108 FUNCDESC** operator & ()
109 {
110 return & m_pFuncDesc;
111 }
112
113 operator FUNCDESC* ()
114 {
115 return m_pFuncDesc;
116 }
117
118 FUNCDESC* operator = (FUNCDESC* pDesc)
119 {
121 m_pFuncDesc = pDesc;
122 return m_pFuncDesc;
123 }
124 FUNCDESC* Detach()
125 {
126 FUNCDESC* pDesc = m_pFuncDesc;
127 m_pFuncDesc = nullptr;
128 return pDesc;
129 }
130
132 {
133 if (m_pFuncDesc != nullptr)
134 {
135 m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc);
136 }
137 m_pFuncDesc = nullptr;
138 }
139};
140//Wrapper for EXCEPINFO structure
141class ExcepInfo : public EXCEPINFO
142{
143 EXCEPINFO* operator = (const ExcepInfo& );
145public:
147 : EXCEPINFO{}
148 {
149 }
151 {
152 if (bstrSource != nullptr)
153 ::SysFreeString(bstrSource);
154 if (bstrDescription != nullptr)
155 ::SysFreeString(bstrDescription);
156 if (bstrHelpFile != nullptr)
157 ::SysFreeString(bstrHelpFile);
158 }
159};
160
161//Wrapper for TYPEATTR
163{
164 TYPEATTR* operator = (const TypeAttr &);
166public:
167 CComPtr< ITypeInfo > m_pTypeInfo;
168 TYPEATTR* m_pTypeAttr;
169
170 explicit TypeAttr(ITypeInfo* pTypeInfo) :
171 m_pTypeInfo( pTypeInfo ),
172 m_pTypeAttr( nullptr )
173 {
174 OSL_ASSERT(pTypeInfo);
175 }
176 ~TypeAttr() noexcept
177 {
178 if (m_pTypeAttr != nullptr)
179 {
180 m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr);
181 }
182 }
183
184 TYPEATTR** operator&() noexcept
185 {
186 return &m_pTypeAttr;
187 }
188
189 TYPEATTR* operator->() noexcept
190 {
191 return m_pTypeAttr;
192 }
193};
194
195/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
~ExcepInfo()
Definition: windata.hxx:150
ExcepInfo(const ExcepInfo &)
EXCEPINFO * operator=(const ExcepInfo &)
FUNCDESC ** operator&()
Definition: windata.hxx:108
~FuncDesc()
Definition: windata.hxx:98
FUNCDESC * operator=(const FuncDesc &)
CComPtr< ITypeInfo > m_pTypeInfo
Definition: windata.hxx:87
FUNCDESC * m_pFuncDesc
Definition: windata.hxx:88
FUNCDESC * operator->()
Definition: windata.hxx:103
FUNCDESC * Detach()
Definition: windata.hxx:124
FuncDesc(const FuncDesc &)
void ReleaseFUNCDESC()
Definition: windata.hxx:131
FuncDesc(ITypeInfo *pTypeInfo)
Definition: windata.hxx:92
TypeAttr(ITypeInfo *pTypeInfo)
Definition: windata.hxx:170
~TypeAttr() noexcept
Definition: windata.hxx:176
TYPEATTR * m_pTypeAttr
Definition: windata.hxx:168
TYPEATTR * operator->() noexcept
Definition: windata.hxx:189
TYPEATTR * operator=(const TypeAttr &)
TYPEATTR ** operator&() noexcept
Definition: windata.hxx:184
TypeAttr(const TypeAttr &)
CComPtr< ITypeInfo > m_pTypeInfo
Definition: windata.hxx:167
VarDesc(ITypeInfo *pTypeInfo)
Definition: windata.hxx:52
VARDESC * operator=(const VarDesc *)
~VarDesc()
Definition: windata.hxx:58
VARDESC * operator->()
Definition: windata.hxx:66
CComPtr< ITypeInfo > m_pTypeInfo
Definition: windata.hxx:49
VARDESC * m_pVarDesc
Definition: windata.hxx:50
VARDESC ** operator&()
Definition: windata.hxx:71
VarDesc(const VarDesc &)