bump product version to 4.2.0.1
[LibreOffice.git] / include / registry / reflread.hxx
blob15fbe37800956396fbfcb1c6e7fb9518bf3d6f94
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 INCLUDED_REGISTRY_REFLREAD_HXX
21 #define INCLUDED_REGISTRY_REFLREAD_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* TypeReaderImpl;
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 reader C-API.
43 This funtions pointers are used by the C++ wrapper to call the C-API.
45 struct RegistryTypeReader_Api
47 TypeReaderImpl (TYPEREG_CALLTYPE *createEntry) (const sal_uInt8*, sal_uInt32, sal_Bool);
48 void (TYPEREG_CALLTYPE *acquire) (TypeReaderImpl);
49 void (TYPEREG_CALLTYPE *release) (TypeReaderImpl);
50 sal_uInt16 (TYPEREG_CALLTYPE *getMinorVersion) (TypeReaderImpl);
51 sal_uInt16 (TYPEREG_CALLTYPE *getMajorVersion) (TypeReaderImpl);
52 RTTypeClass (TYPEREG_CALLTYPE *getTypeClass) (TypeReaderImpl);
53 void (TYPEREG_CALLTYPE *getUik) (TypeReaderImpl, RTUik*);
54 void (TYPEREG_CALLTYPE *getDoku) (TypeReaderImpl, rtl_uString**);
55 void (TYPEREG_CALLTYPE *getFileName) (TypeReaderImpl, rtl_uString**);
56 void (TYPEREG_CALLTYPE *getTypeName) (TypeReaderImpl, rtl_uString**);
57 void (TYPEREG_CALLTYPE *getSuperTypeName) (TypeReaderImpl, rtl_uString**);
58 sal_uInt32 (TYPEREG_CALLTYPE *getFieldCount) (TypeReaderImpl);
59 void (TYPEREG_CALLTYPE *getFieldName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
60 void (TYPEREG_CALLTYPE *getFieldType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
61 RTFieldAccess (TYPEREG_CALLTYPE *getFieldAccess) (TypeReaderImpl, sal_uInt16);
62 RTValueType (TYPEREG_CALLTYPE *getFieldConstValue) (TypeReaderImpl, sal_uInt16, RTConstValueUnion*);
63 void (TYPEREG_CALLTYPE *getFieldDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
64 void (TYPEREG_CALLTYPE *getFieldFileName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
65 sal_uInt32 (TYPEREG_CALLTYPE *getMethodCount) (TypeReaderImpl);
66 void (TYPEREG_CALLTYPE *getMethodName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
67 sal_uInt32 (TYPEREG_CALLTYPE *getMethodParamCount) (TypeReaderImpl, sal_uInt16);
68 void (TYPEREG_CALLTYPE *getMethodParamType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
69 void (TYPEREG_CALLTYPE *getMethodParamName) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
70 RTParamMode (TYPEREG_CALLTYPE *getMethodParamMode) (TypeReaderImpl, sal_uInt16, sal_uInt16);
71 sal_uInt32 (TYPEREG_CALLTYPE *getMethodExcCount) (TypeReaderImpl, sal_uInt16);
72 void (TYPEREG_CALLTYPE *getMethodExcType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
73 void (TYPEREG_CALLTYPE *getMethodReturnType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
74 RTMethodMode (TYPEREG_CALLTYPE *getMethodMode) (TypeReaderImpl, sal_uInt16);
75 void (TYPEREG_CALLTYPE *getMethodDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
77 sal_uInt32 (TYPEREG_CALLTYPE *getReferenceCount) (TypeReaderImpl);
78 void (TYPEREG_CALLTYPE *getReferenceName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
79 RTReferenceType (TYPEREG_CALLTYPE *getReferenceType) (TypeReaderImpl, sal_uInt16);
80 void (TYPEREG_CALLTYPE *getReferenceDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
81 RTFieldAccess (TYPEREG_CALLTYPE *getReferenceAccess) (TypeReaderImpl, sal_uInt16);
84 /** the API initialization function.
86 REG_DLLPUBLIC RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void);
88 #ifdef __cplusplus
90 #endif
92 /** RegistryTypeReades reads a binary type blob.
94 This class provides the necessary functions to read type information
95 for all kinds of types of a type blob.
96 The class is inline and use a C-Api.
98 @deprecated
99 use typereg::Reader instead
101 class RegistryTypeReader
103 public:
105 /** Constructor.
107 @param buffer points to the binary data block.
108 @param bufferLen specifies the size of the binary data block.
109 @param copyData specifies if the data block should be copied.
110 The block can be copied to ensure that the data
111 is valid for the lifetime of this instance.
113 inline RegistryTypeReader(const sal_uInt8* buffer,
114 sal_uInt32 bufferLen,
115 sal_Bool copyData);
117 /// Copy constructcor
118 inline RegistryTypeReader(const RegistryTypeReader& toCopy);
120 /// Destructor. The Destructor frees the data block if the copyData flag was TRUE.
121 inline ~RegistryTypeReader();
123 /// Assign operator
124 inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
126 /// checks if the registry type reader points to a valid Api.
127 inline sal_Bool isValid() const;
129 /** @deprecated
130 returns the minor version number.
132 We currently don't support a versioning concept of IDL interfaces and
133 so this function is currently not used.
135 inline sal_uInt16 getMinorVersion() const;
137 /** @deprecated
138 returns the major version number.
140 We currently don't support a versioning concept of IDL interfaces and
141 so this function is currently not used.
143 inline sal_uInt16 getMajorVersion() const;
145 /** returns the typeclass of the type represented by this blob.
147 This function will always return the type class without the internal
148 RT_TYPE_PUBLISHED flag set.
150 inline RTTypeClass getTypeClass() const;
152 /** returns the full qualified name of the type.
154 inline OUString getTypeName() const;
156 /** returns the full qualified name of the supertype.
158 inline OUString getSuperTypeName() const;
160 /** @deprecated
161 returns the unique identifier for an interface type as an out parameter.
163 An earlier version of UNO used an unique identifier for interfaces. In the
164 current version of UNO this uik was eliminated and this function is
165 not longer used.
167 inline void getUik(RTUik& uik) const;
169 /** returns the documentation string of this type.
171 inline OUString getDoku() const;
173 /** returns the IDL filename where the type is defined.
175 inline OUString getFileName() const;
177 /** returns the number of fields (attributes/properties, enum values or number
178 of constants in a module).
181 inline sal_uInt32 getFieldCount() const;
183 /** returns the name of the field specified by index.
185 inline OUString getFieldName( sal_uInt16 index ) const;
187 /** returns the full qualified name of the field specified by index.
189 inline OUString getFieldType( sal_uInt16 index ) const;
191 /** returns the access mode of the field specified by index.
193 inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const;
195 /** returns the value of the field specified by index.
197 This function returns the value of an enum value or of a constant.
199 inline RTConstValue getFieldConstValue( sal_uInt16 index ) const;
201 /** returns the documentation string for the field specified by index.
203 Each field of a type can have their own documentation.
205 inline OUString getFieldDoku( sal_uInt16 index ) const;
207 /** returns the IDL filename of the field specified by index.
209 The IDL filename of a field can differ from the filename of the ype itself
210 because modules and also constants can be defined in different IDL files.
212 inline OUString getFieldFileName( sal_uInt16 index ) const;
214 /** returns the number of methods of an interface type.
216 inline sal_uInt32 getMethodCount() const;
218 /** returns the name of the method specified by index.
220 inline OUString getMethodName( sal_uInt16 index ) const;
222 /** returns number of parameters of the method specified by index.
224 inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const;
226 /** returns the full qualified parameter typename.
228 @param index indicates the method
229 @param paramIndex indeciates the parameter which type will be returned.
231 inline OUString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
233 /** returns the name of a parameter.
235 @param index indicates the method
236 @param paramIndex indiciates the parameter which name will be returned.
238 inline OUString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
240 /** returns the parameter mode, if it is an in, out or inout parameter.
242 @param index indicates the method
243 @param paramIndex indeciates the parameter which mode will be returned.
245 inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
247 /** returns the number of exceptions which are declared for the method specified by index.
249 @param index indicates the method
251 inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const;
253 /** returns the full qualified exception type of the specified exception.
255 @param index indicates the method
256 @param excIndex indeciates the exception which typename will be returned.
258 inline OUString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
260 /** returns the full qualified return type of the method specified by index.
262 inline OUString getMethodReturnType( sal_uInt16 index ) const;
264 /** returns the full qualified exception type of the specified exception.
266 @param index indicates the method
268 inline RTMethodMode getMethodMode( sal_uInt16 index ) const;
270 /** returns the documentation string of the method specified by index.
272 @param index indicates the method.
274 inline OUString getMethodDoku( sal_uInt16 index ) const;
276 /** returns the number of references (supported interfaces, exported services).
278 inline sal_uInt32 getReferenceCount() const;
280 /** returns the full qualified typename of the reference specified by index.
282 @param index indicates the reference.
284 inline OUString getReferenceName( sal_uInt16 index ) const;
286 /** returns the type of the reference specified by index.
288 @param index indicates the reference.
290 inline RTReferenceType getReferenceType( sal_uInt16 index ) const;
292 /** returns the documentation string of the reference specified by index.
294 @param index indicates the reference.
296 inline OUString getReferenceDoku( sal_uInt16 index ) const;
298 /** returns the access mode of the reference specified by index.
300 The only valid value is RT_ACCESS_OPTIONAL in the context of
301 references.
302 @param index indicates the reference.
304 inline RTFieldAccess getReferenceAccess( sal_uInt16 index ) const;
306 protected:
308 /// stores the registry type reader Api.
309 const RegistryTypeReader_Api* m_pApi;
310 /// stores the handle of an implementation class
311 TypeReaderImpl m_hImpl;
316 inline RegistryTypeReader::RegistryTypeReader(const sal_uInt8* buffer,
317 sal_uInt32 bufferLen,
318 sal_Bool copyData)
319 : m_pApi(initRegistryTypeReader_Api())
320 , m_hImpl(NULL)
322 m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
326 inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
327 : m_pApi(toCopy.m_pApi)
328 , m_hImpl(toCopy.m_hImpl)
329 { m_pApi->acquire(m_hImpl); }
332 inline RegistryTypeReader::~RegistryTypeReader()
333 { m_pApi->release(m_hImpl); }
335 inline RegistryTypeReader& RegistryTypeReader::operator == (const RegistryTypeReader& toAssign)
337 if (m_hImpl != toAssign.m_hImpl)
339 m_pApi->release(m_hImpl);
340 m_hImpl = toAssign.m_hImpl;
341 m_pApi->acquire(m_hImpl);
344 return *this;
347 inline sal_uInt16 RegistryTypeReader::getMinorVersion() const
348 { return m_pApi->getMinorVersion(m_hImpl); }
350 inline sal_Bool RegistryTypeReader::isValid() const
351 { return (m_hImpl != NULL); }
353 inline sal_uInt16 RegistryTypeReader::getMajorVersion() const
354 { return m_pApi->getMajorVersion(m_hImpl); }
356 inline RTTypeClass RegistryTypeReader::getTypeClass() const
357 { return m_pApi->getTypeClass(m_hImpl); }
359 inline OUString RegistryTypeReader::getTypeName() const
361 OUString sRet;
362 m_pApi->getTypeName(m_hImpl, &sRet.pData);
363 return sRet;
366 inline OUString RegistryTypeReader::getSuperTypeName() const
368 OUString sRet;
369 m_pApi->getSuperTypeName(m_hImpl, &sRet.pData);
370 return sRet;
373 inline void RegistryTypeReader::getUik(RTUik& uik) const
374 { m_pApi->getUik(m_hImpl, &uik); }
376 inline OUString RegistryTypeReader::getDoku() const
378 OUString sRet;
379 m_pApi->getDoku(m_hImpl, &sRet.pData);
380 return sRet;
383 inline OUString RegistryTypeReader::getFileName() const
385 OUString sRet;
386 m_pApi->getFileName(m_hImpl, &sRet.pData);
387 return sRet;
390 inline sal_uInt32 RegistryTypeReader::getFieldCount() const
391 { return m_pApi->getFieldCount(m_hImpl); }
393 inline OUString RegistryTypeReader::getFieldName( sal_uInt16 index ) const
395 OUString sRet;
396 m_pApi->getFieldName(m_hImpl, &sRet.pData, index);
397 return sRet;
400 inline OUString RegistryTypeReader::getFieldType( sal_uInt16 index ) const
402 OUString sRet;
403 m_pApi->getFieldType(m_hImpl, &sRet.pData, index);
404 return sRet;
407 inline RTFieldAccess RegistryTypeReader::getFieldAccess( sal_uInt16 index ) const
408 { return m_pApi->getFieldAccess(m_hImpl, index); }
410 inline RTConstValue RegistryTypeReader::getFieldConstValue( sal_uInt16 index ) const
412 RTConstValue ret;
413 ret.m_type = m_pApi->getFieldConstValue(m_hImpl, index, &ret.m_value);
414 return ret;
417 inline OUString RegistryTypeReader::getFieldDoku( sal_uInt16 index ) const
419 OUString sRet;
420 m_pApi->getFieldDoku(m_hImpl, &sRet.pData, index);
421 return sRet;
424 inline OUString RegistryTypeReader::getFieldFileName( sal_uInt16 index ) const
426 OUString sRet;
427 m_pApi->getFieldFileName(m_hImpl, &sRet.pData, index);
428 return sRet;
431 inline sal_uInt32 RegistryTypeReader::getMethodCount() const
432 { return m_pApi->getMethodCount(m_hImpl); }
434 inline OUString RegistryTypeReader::getMethodName( sal_uInt16 index ) const
436 OUString sRet;
437 m_pApi->getMethodName(m_hImpl, &sRet.pData, index);
438 return sRet;
441 inline sal_uInt32 RegistryTypeReader::getMethodParamCount( sal_uInt16 index ) const
442 { return m_pApi->getMethodParamCount(m_hImpl, index); }
444 inline OUString RegistryTypeReader::getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
446 OUString sRet;
447 m_pApi->getMethodParamType(m_hImpl, &sRet.pData, index, paramIndex);
448 return sRet;
451 inline OUString RegistryTypeReader::getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
453 OUString sRet;
454 m_pApi->getMethodParamName(m_hImpl, &sRet.pData, index, paramIndex);
455 return sRet;
458 inline RTParamMode RegistryTypeReader::getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
459 { return m_pApi->getMethodParamMode(m_hImpl, index, paramIndex); }
461 inline sal_uInt32 RegistryTypeReader::getMethodExcCount( sal_uInt16 index ) const
462 { return m_pApi->getMethodExcCount(m_hImpl, index); }
464 inline OUString RegistryTypeReader::getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
466 OUString sRet;
467 m_pApi->getMethodExcType(m_hImpl, &sRet.pData, index, excIndex);
468 return sRet;
471 inline OUString RegistryTypeReader::getMethodReturnType( sal_uInt16 index ) const
473 OUString sRet;
474 m_pApi->getMethodReturnType(m_hImpl, &sRet.pData, index);
475 return sRet;
478 inline RTMethodMode RegistryTypeReader::getMethodMode( sal_uInt16 index ) const
479 { return m_pApi->getMethodMode(m_hImpl, index); }
481 inline OUString RegistryTypeReader::getMethodDoku( sal_uInt16 index ) const
483 OUString sRet;
484 m_pApi->getMethodDoku(m_hImpl, &sRet.pData, index);
485 return sRet;
488 inline sal_uInt32 RegistryTypeReader::getReferenceCount() const
489 { return m_pApi->getReferenceCount(m_hImpl); }
491 inline OUString RegistryTypeReader::getReferenceName( sal_uInt16 index ) const
493 OUString sRet;
494 m_pApi->getReferenceName(m_hImpl, &sRet.pData, index);
495 return sRet;
498 inline RTReferenceType RegistryTypeReader::getReferenceType( sal_uInt16 index ) const
499 { return m_pApi->getReferenceType(m_hImpl, index); }
501 inline OUString RegistryTypeReader::getReferenceDoku( sal_uInt16 index ) const
503 OUString sRet;
504 m_pApi->getReferenceDoku(m_hImpl, &sRet.pData, index);
505 return sRet;
508 inline RTFieldAccess RegistryTypeReader::getReferenceAccess( sal_uInt16 index ) const
509 { return m_pApi->getReferenceAccess(m_hImpl, index); }
511 #endif
513 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */