LibreOffice Module registry (master)  1
reader.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 
20 #ifndef INCLUDED_REGISTRY_READER_HXX
21 #define INCLUDED_REGISTRY_READER_HXX
22 
24 #include <registry/refltype.hxx>
25 #include <registry/types.hxx>
26 #include <registry/version.h>
27 
28 #include <rtl/ustring.hxx>
29 #include <sal/types.h>
30 
31 #include <new>
32 
33 namespace typereg {
34 
42 class Reader {
43 public:
58  Reader(void const * buffer, sal_uInt32 length)
59  {
60  if (!typereg_reader_create(buffer, length, &m_handle))
61  {
62  throw std::bad_alloc();
63  }
64  }
65 
71  Reader(Reader const & other): m_handle(other.m_handle) {
73  }
74 
81  ~Reader() {
83  }
84 
92  Reader & operator =(Reader const & other) {
93  Reader temp(other);
94  std::swap(m_handle, temp.m_handle);
95  return *this;
96  }
97 
103  bool isValid() const {
104  return m_handle != nullptr;
105  }
106 
116  }
117 
126  OUString getDocumentation() const {
127  rtl_uString * s = nullptr;
129  if (s == nullptr) {
130  throw std::bad_alloc();
131  }
132  return OUString(s, SAL_NO_ACQUIRE);
133  }
134 
144  OUString getFileName() const {
145  rtl_uString * s = nullptr;
147  if (s == nullptr) {
148  throw std::bad_alloc();
149  }
150  return OUString(s, SAL_NO_ACQUIRE);
151  }
152 
165  }
166 
173  bool isPublished() const {
175  }
176 
185  OUString getTypeName() const {
186  rtl_uString * s = nullptr;
188  if (s == nullptr) {
189  throw std::bad_alloc();
190  }
191  return OUString(s, SAL_NO_ACQUIRE);
192  }
193 
200  sal_uInt16 getSuperTypeCount() const {
202  }
203 
214  OUString getSuperTypeName(sal_uInt16 index) const {
215  rtl_uString * s = nullptr;
217  if (s == nullptr) {
218  throw std::bad_alloc();
219  }
220  return OUString(s, SAL_NO_ACQUIRE);
221  }
222 
229  sal_uInt16 getFieldCount() const {
231  }
232 
242  OUString getFieldDocumentation(sal_uInt16 index) const {
243  rtl_uString * s = nullptr;
245  if (s == nullptr) {
246  throw std::bad_alloc();
247  }
248  return OUString(s, SAL_NO_ACQUIRE);
249  }
250 
261  OUString getFieldFileName(sal_uInt16 index) const {
262  rtl_uString * s = nullptr;
264  if (s == nullptr) {
265  throw std::bad_alloc();
266  }
267  return OUString(s, SAL_NO_ACQUIRE);
268  }
269 
277  RTFieldAccess getFieldFlags(sal_uInt16 index) const {
278  return typereg_reader_getFieldFlags(m_handle, index);
279  }
280 
290  OUString getFieldName(sal_uInt16 index) const {
291  rtl_uString * s = nullptr;
293  if (s == nullptr) {
294  throw std::bad_alloc();
295  }
296  return OUString(s, SAL_NO_ACQUIRE);
297  }
298 
308  OUString getFieldTypeName(sal_uInt16 index) const {
309  rtl_uString * s = nullptr;
311  if (s == nullptr) {
312  throw std::bad_alloc();
313  }
314  return OUString(s, SAL_NO_ACQUIRE);
315  }
316 
326  RTConstValue getFieldValue(sal_uInt16 index) const {
327  RTConstValue v;
329  m_handle, index, &v.m_type, &v.m_value))
330  {
331  throw std::bad_alloc();
332  }
333  return v;
334  }
335 
342  sal_uInt16 getMethodCount() const {
344  }
345 
355  OUString getMethodDocumentation(sal_uInt16 index) const {
356  rtl_uString * s = nullptr;
358  if (s == nullptr) {
359  throw std::bad_alloc();
360  }
361  return OUString(s, SAL_NO_ACQUIRE);
362  }
363 
371  RTMethodMode getMethodFlags(sal_uInt16 index) const {
373  }
374 
384  OUString getMethodName(sal_uInt16 index) const {
385  rtl_uString * s = nullptr;
387  if (s == nullptr) {
388  throw std::bad_alloc();
389  }
390  return OUString(s, SAL_NO_ACQUIRE);
391  }
392 
402  OUString getMethodReturnTypeName(sal_uInt16 index) const {
403  rtl_uString * s = nullptr;
405  if (s == nullptr) {
406  throw std::bad_alloc();
407  }
408  return OUString(s, SAL_NO_ACQUIRE);
409  }
410 
418  sal_uInt16 getMethodParameterCount(sal_uInt16 index) const {
420  }
421 
434  sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
435  {
437  m_handle, methodIndex, parameterIndex);
438  }
439 
454  sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
455  {
456  rtl_uString * s = nullptr;
458  m_handle, &s, methodIndex, parameterIndex);
459  if (s == nullptr) {
460  throw std::bad_alloc();
461  }
462  return OUString(s, SAL_NO_ACQUIRE);
463  }
464 
479  sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
480  {
481  rtl_uString * s = nullptr;
483  m_handle, &s, methodIndex, parameterIndex);
484  if (s == nullptr) {
485  throw std::bad_alloc();
486  }
487  return OUString(s, SAL_NO_ACQUIRE);
488  }
489 
497  sal_uInt16 getMethodExceptionCount(sal_uInt16 index) const {
499  }
500 
515  sal_uInt16 methodIndex, sal_uInt16 exceptionIndex) const
516  {
517  rtl_uString * s = nullptr;
519  m_handle, &s, methodIndex, exceptionIndex);
520  if (s == nullptr) {
521  throw std::bad_alloc();
522  }
523  return OUString(s, SAL_NO_ACQUIRE);
524  }
525 
532  sal_uInt16 getReferenceCount() const {
534  }
535 
546  OUString getReferenceDocumentation(sal_uInt16 index) const {
547  rtl_uString * s = nullptr;
549  if (s == nullptr) {
550  throw std::bad_alloc();
551  }
552  return OUString(s, SAL_NO_ACQUIRE);
553  }
554 
563  RTFieldAccess getReferenceFlags(sal_uInt16 index) const {
565  }
566 
575  RTReferenceType getReferenceSort(sal_uInt16 index) const {
577  }
578 
589  OUString getReferenceTypeName(sal_uInt16 index) const {
590  rtl_uString * s = nullptr;
592  if (s == nullptr) {
593  throw std::bad_alloc();
594  }
595  return OUString(s, SAL_NO_ACQUIRE);
596  }
597 
598 private:
599  void * m_handle;
600 };
601 
602 }
603 
604 #endif
605 
606 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reader(void const *buffer, sal_uInt32 length)
Creates a type reader.
Definition: reader.hxx:58
OUString getFieldTypeName(sal_uInt16 index) const
Returns the type name of a field of this type reader.
Definition: reader.hxx:308
void TYPEREG_CALLTYPE typereg_reader_release(void *hEntry)
Decrements the reference count of a type reader.
Definition: reflread.cxx:1231
OUString getMethodParameterName(sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
Returns the name of a parameter of a method of this type reader.
Definition: reader.hxx:453
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getFieldCount(void *hEntry)
Returns the number of fields of a type reader.
Definition: reflread.cxx:1349
Reader(Reader const &other)
Shares a type reader between two Reader instances.
Definition: reader.hxx:71
RTParamMode
specifies the mode of a parameter.
Definition: types.hxx:269
sal_uInt16 getFieldCount() const
Returns the number of fields of this type reader.
Definition: reader.hxx:229
RTReferenceType
specifies the type of a reference used in a service description.
Definition: types.hxx:297
OUString getReferenceTypeName(sal_uInt16 index) const
Returns the type name of a reference of this type reader.
Definition: reader.hxx:589
OUString getDocumentation() const
Returns the documentation of this type reader.
Definition: reader.hxx:126
RTValueType m_type
stores the type of the constant value.
Definition: refltype.hxx:46
RTMethodMode TYPEREG_CALLTYPE typereg_reader_getMethodFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a method of a type reader.
Definition: reflread.cxx:1580
sal_uInt16 getReferenceCount() const
Returns the number of references of this type reader.
Definition: reader.hxx:532
void * m_handle
Definition: reader.hxx:599
void TYPEREG_CALLTYPE typereg_reader_getMethodDocumentation(void *hEntry, rtl_uString **pMethodDoku, sal_uInt16 index)
Returns the documentation of a method of a type reader.
Definition: reflread.cxx:1589
bool TYPEREG_CALLTYPE typereg_reader_getFieldValue(void *hEntry, sal_uInt16 index, RTValueType *type, RTConstValueUnion *value)
Returns the value of a field of a type reader.
Definition: reflread.cxx:1403
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodParameterCount(void *hEntry, sal_uInt16 index)
Returns the number of parameters of a method of a type reader.
Definition: reflread.cxx:1487
OUString getMethodDocumentation(sal_uInt16 index) const
Returns the documentation of a method of this type reader.
Definition: reader.hxx:355
void TYPEREG_CALLTYPE typereg_reader_getFileName(void *hEntry, rtl_uString **pFileName)
Returns the file name of a type reader.
Definition: reflread.cxx:1331
sal_uInt16 getMethodCount() const
Returns the number of methods of this type reader.
Definition: reader.hxx:342
void TYPEREG_CALLTYPE typereg_reader_getReferenceDocumentation(void *hEntry, rtl_uString **pReferenceDoku, sal_uInt16 index)
Returns the documentation of a reference of a type reader.
Definition: reflread.cxx:1639
RTConstValue getFieldValue(sal_uInt16 index) const
Returns the value of a field of this type reader.
Definition: reader.hxx:326
RTFieldAccess getFieldFlags(sal_uInt16 index) const
Returns the flags of a field of this type reader.
Definition: reader.hxx:277
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getFieldFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a field of a type reader.
Definition: reflread.cxx:1394
A type reader working on a binary blob that represents a UNOIDL type.
Definition: reader.hxx:42
RTParamMode getMethodParameterFlags(sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
Returns the flags of a parameter of a method of this type reader.
Definition: reader.hxx:433
bool TYPEREG_CALLTYPE typereg_reader_isPublished(void *hEntry)
Returns whether a type reader is published.
Definition: reflread.cxx:1266
void TYPEREG_CALLTYPE typereg_reader_getFieldDocumentation(void *hEntry, rtl_uString **pDoku, sal_uInt16 index)
Returns the documentation of a field of a type reader.
Definition: reflread.cxx:1429
RTParamMode TYPEREG_CALLTYPE typereg_reader_getMethodParameterFlags(void *hEntry, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the flags of a parameter of a method of a type reader.
Definition: reflread.cxx:1529
bool isValid() const
Returns whether this type reader is valid.
Definition: reader.hxx:103
OUString getMethodName(sal_uInt16 index) const
Returns the name of a method of this type reader.
Definition: reader.hxx:384
OUString getReferenceDocumentation(sal_uInt16 index) const
Returns the documentation of a reference of this type reader.
Definition: reader.hxx:546
void TYPEREG_CALLTYPE typereg_reader_getTypeName(void *hEntry, rtl_uString **pTypeName)
Returns the type name of a type reader.
Definition: reflread.cxx:1279
typereg_Version
The version of a binary blob that represents a UNOIDL type.
Definition: version.h:41
RTConstValueUnion m_value
stores the value of the constant.
Definition: refltype.hxx:48
RTTypeClass getTypeClass() const
Returns the type class of this type reader.
Definition: reader.hxx:163
RTMethodMode getMethodFlags(sal_uInt16 index) const
Returns the flags of a method of this type reader.
Definition: reader.hxx:371
bool isPublished() const
Returns whether this type reader is published.
Definition: reader.hxx:173
void TYPEREG_CALLTYPE typereg_reader_getSuperTypeName(void *hEntry, rtl_uString **pSuperTypeName, sal_uInt16 index)
Returns the type name of a super type of a type reader.
Definition: reflread.cxx:1673
OUString getFileName() const
Returns the file name of this type reader.
Definition: reader.hxx:144
sal_uInt16 getMethodParameterCount(sal_uInt16 index) const
Returns the number of parameters of a method of this type reader.
Definition: reader.hxx:418
OUString getFieldName(sal_uInt16 index) const
Returns the name of a field of this type reader.
Definition: reader.hxx:290
sal_uInt16 getMethodExceptionCount(sal_uInt16 index) const
Returns the number of exceptions of a method of this type reader.
Definition: reader.hxx:497
OUString getTypeName() const
Returns the type name of this type reader.
Definition: reader.hxx:185
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getReferenceCount(void *hEntry)
Returns the number of references of a type reader.
Definition: reflread.cxx:1605
OUString getMethodParameterTypeName(sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
Returns the type name of a parameter of a method of this type reader.
Definition: reader.hxx:478
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodExceptionCount(void *hEntry, sal_uInt16 index)
Returns the number of exceptions of a method of a type reader.
Definition: reflread.cxx:1538
RTTypeClass
specifies the typeclass of a binary type blob.
Definition: types.hxx:31
OUString getSuperTypeName(sal_uInt16 index) const
Returns the type name of a super type of this type reader.
Definition: reader.hxx:214
RTFieldAccess TYPEREG_CALLTYPE typereg_reader_getReferenceFlags(void *hEntry, sal_uInt16 index)
Returns the flags of a reference of a type reader.
Definition: reflread.cxx:1655
void TYPEREG_CALLTYPE typereg_reader_getMethodParameterName(void *hEntry, rtl_uString **pMethodParamName, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the name of a parameter of a method of a type reader.
Definition: reflread.cxx:1513
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getSuperTypeCount(void *hEntry)
Returns the number of super types of a type reader.
Definition: reflread.cxx:1664
bool TYPEREG_CALLTYPE typereg_reader_create(void const *buffer, sal_uInt32 length, void **result)
Creates a type reader working on a binary blob that represents a UNOIDL type.
Definition: reflread.cxx:1182
float v
void TYPEREG_CALLTYPE typereg_reader_getFieldFileName(void *hEntry, rtl_uString **pFieldFileName, sal_uInt16 index)
Returns the file name of a field of a type reader.
Definition: reflread.cxx:1445
void TYPEREG_CALLTYPE typereg_reader_getReferenceTypeName(void *hEntry, rtl_uString **pReferenceName, sal_uInt16 index)
Returns the type name of a reference of a type reader.
Definition: reflread.cxx:1614
Reader & operator=(Reader const &other)
Replaces the underlying type reader.
Definition: reader.hxx:92
RTReferenceType TYPEREG_CALLTYPE typereg_reader_getReferenceSort(void *hEntry, sal_uInt16 index)
Returns the sort of a reference of a type reader.
Definition: reflread.cxx:1630
void TYPEREG_CALLTYPE typereg_reader_getMethodReturnTypeName(void *hEntry, rtl_uString **pMethodReturnType, sal_uInt16 index)
Returns the return type name of a method of a type reader.
Definition: reflread.cxx:1564
RTMethodMode
specifies the mode of a method.
Definition: types.hxx:231
OUString getFieldDocumentation(sal_uInt16 index) const
Returns the documentation of a field of this type reader.
Definition: reader.hxx:242
void TYPEREG_CALLTYPE typereg_reader_acquire(void *hEntry)
Increments the reference count of a type reader.
Definition: reflread.cxx:1223
void TYPEREG_CALLTYPE typereg_reader_getMethodParameterTypeName(void *hEntry, rtl_uString **pMethodParamType, sal_uInt16 index, sal_uInt16 paramIndex)
Returns the type name of a parameter of a method of a type reader.
Definition: reflread.cxx:1497
sal_uInt16 getSuperTypeCount() const
Returns the number of super types of this type reader.
Definition: reader.hxx:200
void TYPEREG_CALLTYPE typereg_reader_getFieldTypeName(void *hEntry, rtl_uString **pFieldType, sal_uInt16 index)
Returns the type name of a field of a type reader.
Definition: reflread.cxx:1378
void TYPEREG_CALLTYPE typereg_reader_getMethodName(void *hEntry, rtl_uString **pMethodName, sal_uInt16 index)
Returns the name of a method of a type reader.
Definition: reflread.cxx:1471
RTFieldAccess getReferenceFlags(sal_uInt16 index) const
Returns the flags of a reference of this type reader.
Definition: reader.hxx:563
void TYPEREG_CALLTYPE typereg_reader_getFieldName(void *hEntry, rtl_uString **pFieldName, sal_uInt16 index)
Returns the name of a field of a type reader.
Definition: reflread.cxx:1363
OUString getMethodExceptionTypeName(sal_uInt16 methodIndex, sal_uInt16 exceptionIndex) const
Returns the type name of an exception of a method of this type reader.
Definition: reader.hxx:514
typereg_Version TYPEREG_CALLTYPE typereg_reader_getVersion(void const *handle)
Returns the binary blob version of a type reader.
Definition: reflread.cxx:1242
typereg_Version getVersion() const
Returns the binary blob version of this type reader.
Definition: reader.hxx:114
RTTypeClass TYPEREG_CALLTYPE typereg_reader_getTypeClass(void *hEntry)
Returns the type class of a type reader.
Definition: reflread.cxx:1253
OUString getFieldFileName(sal_uInt16 index) const
Returns the file name of a field of this type reader.
Definition: reader.hxx:261
RTFieldAccess
specifies the type for the field access.
Definition: types.hxx:132
sal_uInt16 TYPEREG_CALLTYPE typereg_reader_getMethodCount(void *hEntry)
Returns the number of methods of a type reader.
Definition: reflread.cxx:1462
RTReferenceType getReferenceSort(sal_uInt16 index) const
Returns the sort of a reference of this type reader.
Definition: reader.hxx:575
~Reader()
Destroys this Reader instance.
Definition: reader.hxx:81
OUString getMethodReturnTypeName(sal_uInt16 index) const
Returns the return type name of a method of this type reader.
Definition: reader.hxx:402
void TYPEREG_CALLTYPE typereg_reader_getDocumentation(void *hEntry, rtl_uString **pDoku)
Returns the documentation of a type reader.
Definition: reflread.cxx:1314
void TYPEREG_CALLTYPE typereg_reader_getMethodExceptionTypeName(void *hEntry, rtl_uString **pMethodExcpType, sal_uInt16 index, sal_uInt16 excIndex)
Returns the type name of an exception of a method of a type reader.
Definition: reflread.cxx:1548
specifies a helper class for const values.
Definition: refltype.hxx:42