bump product version to 4.1.6.2
[LibreOffice.git] / include / registry / reflwrit.hxx
blob8e84aa9b1483ff5b6340575d7056cfffd44f44cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _REGISTRY_REFLWRIT_HXX_
21 #define _REGISTRY_REFLWRIT_HXX_
23 #include <registry/regdllapi.h>
24 #include <registry/refltype.hxx>
25 #include <registry/regtype.h>
26 #include <rtl/ustring.hxx>
28 /// Implememetation handle
29 typedef void* TypeWriterImpl;
31 /****************************************************************************
33 C-Api
35 *****************************************************************************/
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 /** specifies a collection of function pointers which represents the complete registry type writer C-API.
43 This funtions pointers are used by the C++ wrapper to call the C-API.
45 struct RegistryTypeWriter_Api
47 TypeWriterImpl (TYPEREG_CALLTYPE *createEntry) (RTTypeClass, rtl_uString*, rtl_uString*, sal_uInt16, sal_uInt16, sal_uInt16);
48 void (TYPEREG_CALLTYPE *acquire) (TypeWriterImpl);
49 void (TYPEREG_CALLTYPE *release) (TypeWriterImpl);
50 void (TYPEREG_CALLTYPE *setUik) (TypeWriterImpl, const RTUik*);
51 void (TYPEREG_CALLTYPE *setDoku) (TypeWriterImpl, rtl_uString*);
52 void (TYPEREG_CALLTYPE *setFileName) (TypeWriterImpl, rtl_uString*);
53 void (TYPEREG_CALLTYPE *setFieldData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, rtl_uString*, rtl_uString*, RTFieldAccess, RTValueType, RTConstValueUnion);
54 void (TYPEREG_CALLTYPE *setMethodData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, RTMethodMode, sal_uInt16, sal_uInt16, rtl_uString*);
55 void (TYPEREG_CALLTYPE *setParamData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*, rtl_uString*, RTParamMode);
56 void (TYPEREG_CALLTYPE *setExcData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*);
57 const sal_uInt8* (TYPEREG_CALLTYPE *getBlop) (TypeWriterImpl);
58 sal_uInt32 (TYPEREG_CALLTYPE *getBlopSize) (TypeWriterImpl);
60 void (TYPEREG_CALLTYPE *setReferenceData) (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess);
63 /** the API initialization function.
65 REG_DLLPUBLIC RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api(void);
67 #ifdef __cplusplus
69 #endif
71 /** RegistryTypeWriter writes/creates a binary type blob.
73 This class provides the necessary functions to write type information
74 for all kinds of types into a blob.
75 The class is inline and use a C-Api.
77 @deprecated
78 use typereg::Writer instead
80 class RegistryTypeWriter
82 public:
84 /** Constructor.
86 @param RTTypeClass specifies the type of the new blob.
87 @param typeName specifies the full qualified type name with '/' as separator.
88 @param superTypeName specifies the full qualified type name of the base type
89 with '/' as separator.
90 @param fieldCount specifies the number of fields (eg. number of attrbutes/properties,
91 enum values or constants).
92 @param methodCount specifies the number of methods.
93 @param referenceCount specifies the number of references (eg. number of supported interfaces,
94 exported services ...)
96 inline RegistryTypeWriter(RTTypeClass RTTypeClass,
97 const OUString& typeName,
98 const OUString& superTypeName,
99 sal_uInt16 fieldCount,
100 sal_uInt16 methodCount,
101 sal_uInt16 referenceCount);
103 /// Copy constructcor
104 inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
106 /** Destructor. The Destructor frees the internal data block.
108 The pointer (returned by getBlop) will be set to NULL.
110 inline ~RegistryTypeWriter();
112 /// Assign operator
113 inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
115 /** @deprecated
116 sets the unique identifier for an interface type.
118 An earlier version of UNO used an unique identifier for interfaces. In the
119 current version of UNO this uik was eliminated and this function is
120 not longer used.
122 inline void setUik(const RTUik& uik);
124 /** sets a documentation string for the type.
126 This documentation should be the same as the documentation which is provided
127 for this type in IDL.
129 inline void setDoku(const OUString& doku);
131 /** sets the IDL filename where this type is defined.
133 inline void setFileName(const OUString& fileName);
135 /** sets the data for a field member of a type blob.
137 @param index indicates the index of the field.
138 @param name specifies the name.
139 @param typeName specifies the full qualified typename.
140 @param doku specifies the documentation string of the field.
141 @param fileName specifies the name of the IDL file where the field is defined.
142 @param access specifies the access mode of the field.
143 @param constValue specifies the value of the field. The value is only interesting
144 for enum values or constants.
146 inline void setFieldData( sal_uInt16 index,
147 const OUString& name,
148 const OUString& typeName,
149 const OUString& doku,
150 const OUString& fileName,
151 RTFieldAccess access,
152 RTConstValue constValue = RTConstValue());
154 /** sets the data for a method.
156 @param index indicates the index of the method.
157 @param name specifies the name.
158 @param returnTypeName specifies the full qualified return typename.
159 @param mode specifies the method mode.
160 @param paramCount specifies the number of parameters.
161 @param excCount specifies the number of exceptions.
162 @param doku specifies the documentation string of the field.
164 inline void setMethodData(sal_uInt16 index,
165 const OUString& name,
166 const OUString& returnTypeName,
167 RTMethodMode mode,
168 sal_uInt16 paramCount,
169 sal_uInt16 excCount,
170 const OUString& doku);
172 /** sets the data for the specified parameter of a method.
174 @param index indicates the index of the method.
175 @param paramIndex specifies the index of the parameter.
176 @param type specifies the full qualified typename.
177 @param name specifies the name.
178 @param mode specifies the parameter mode.
180 inline void setParamData(sal_uInt16 index,
181 sal_uInt16 paramIndex,
182 const OUString& type,
183 const OUString& name,
184 RTParamMode mode);
186 /** sets the data for the specified exception of a mehtod.
188 @param index indicates the index of the method.
189 @param excIndex specifies the index of the exception.
190 @param type specifies the full qualified typename of the exception.
192 inline void setExcData(sal_uInt16 index,
193 sal_uInt16 excIndex,
194 const OUString& type);
196 /** returns a pointer to the new type blob.
198 The pointer will be invalid (NULL) if the instance of
199 the RegistryTypeWriter will be destroyed.
201 inline const sal_uInt8* getBlop();
203 /** returns the size of the new type blob in bytes.
205 inline sal_uInt32 getBlopSize();
207 /** sets the data for a reference member.
209 @param index indicates the index of the reference.
210 @param name specifies the name.
211 @param refType specifies the full qualified typename of the reference.
212 @param doku specifies the documentation string of the reference.
213 @param access specifies the access mode of the reference.
215 inline void setReferenceData( sal_uInt16 index,
216 const OUString& name,
217 RTReferenceType refType,
218 const OUString& doku,
219 RTFieldAccess access = RT_ACCESS_INVALID);
221 protected:
223 /// stores the registry type writer Api.
224 const RegistryTypeWriter_Api* m_pApi;
225 /// stores the handle of an implementation class
226 TypeWriterImpl m_hImpl;
231 inline RegistryTypeWriter::RegistryTypeWriter(RTTypeClass RTTypeClass,
232 const OUString& typeName,
233 const OUString& superTypeName,
234 sal_uInt16 fieldCount,
235 sal_uInt16 methodCount,
236 sal_uInt16 referenceCount)
237 : m_pApi(initRegistryTypeWriter_Api())
238 , m_hImpl(NULL)
240 m_hImpl = m_pApi->createEntry(RTTypeClass,
241 typeName.pData,
242 superTypeName.pData,
243 fieldCount,
244 methodCount,
245 referenceCount);
249 inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter& toCopy)
250 : m_pApi(toCopy.m_pApi)
251 , m_hImpl(toCopy.m_hImpl)
253 m_pApi->acquire(m_hImpl);
256 inline RegistryTypeWriter::~RegistryTypeWriter()
258 m_pApi->release(m_hImpl);
261 inline RegistryTypeWriter& RegistryTypeWriter::operator == (const RegistryTypeWriter& toAssign)
263 if (m_hImpl != toAssign.m_hImpl)
265 m_pApi->release(m_hImpl);
266 m_hImpl = toAssign.m_hImpl;
267 m_pApi->acquire(m_hImpl);
270 return *this;
273 inline void RegistryTypeWriter::setFieldData( sal_uInt16 index,
274 const OUString& name,
275 const OUString& typeName,
276 const OUString& doku,
277 const OUString& fileName,
278 RTFieldAccess access,
279 RTConstValue constValue)
281 m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value);
285 inline void RegistryTypeWriter::setMethodData(sal_uInt16 index,
286 const OUString& name,
287 const OUString& returnTypeName,
288 RTMethodMode mode,
289 sal_uInt16 paramCount,
290 sal_uInt16 excCount,
291 const OUString& doku)
293 m_pApi->setMethodData(m_hImpl, index, name.pData, returnTypeName.pData, mode, paramCount, excCount, doku.pData);
297 inline void RegistryTypeWriter::setUik(const RTUik& uik)
299 m_pApi->setUik(m_hImpl, &uik);
302 inline void RegistryTypeWriter::setDoku(const OUString& doku)
304 m_pApi->setDoku(m_hImpl, doku.pData);
307 inline void RegistryTypeWriter::setFileName(const OUString& doku)
309 m_pApi->setFileName(m_hImpl, doku.pData);
312 inline void RegistryTypeWriter::setParamData(sal_uInt16 index,
313 sal_uInt16 paramIndex,
314 const OUString& type,
315 const OUString& name,
316 RTParamMode mode)
318 m_pApi->setParamData(m_hImpl, index, paramIndex, type.pData, name.pData, mode);
321 inline void RegistryTypeWriter::setExcData(sal_uInt16 index,
322 sal_uInt16 excIndex,
323 const OUString& type)
325 m_pApi->setExcData(m_hImpl, index, excIndex, type.pData);
328 inline const sal_uInt8* RegistryTypeWriter::getBlop()
330 return m_pApi->getBlop(m_hImpl);
333 inline sal_uInt32 RegistryTypeWriter::getBlopSize()
335 return m_pApi->getBlopSize(m_hImpl);
339 inline void RegistryTypeWriter::setReferenceData( sal_uInt16 index,
340 const OUString& name,
341 RTReferenceType refType,
342 const OUString& doku,
343 RTFieldAccess access)
345 m_pApi->setReferenceData(m_hImpl, index, name.pData, refType, doku.pData, access);
348 #endif
350 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */