UDK 3.2.7 C/C++ API Reference
registry/reflread.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 
00029 #ifndef _REGISTRY_REFLREAD_HXX_
00030 #define _REGISTRY_REFLREAD_HXX_
00031 
00032 #include <registry/regdllapi.h>
00033 #include <registry/refltype.hxx>
00034 #include <registry/regtype.h>
00035 #include <rtl/ustring.hxx>
00036 
00038 typedef void* TypeReaderImpl;
00039 
00040 /****************************************************************************
00041 
00042     C-Api
00043 
00044 *****************************************************************************/
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00054 struct RegistryTypeReader_Api
00055 {
00056     TypeReaderImpl      (TYPEREG_CALLTYPE *createEntry)         (const sal_uInt8*, sal_uInt32, sal_Bool);
00057     void                (TYPEREG_CALLTYPE *acquire)             (TypeReaderImpl);
00058     void                (TYPEREG_CALLTYPE *release)             (TypeReaderImpl);
00059     sal_uInt16          (TYPEREG_CALLTYPE *getMinorVersion)     (TypeReaderImpl);
00060     sal_uInt16          (TYPEREG_CALLTYPE *getMajorVersion)     (TypeReaderImpl);
00061     RTTypeClass         (TYPEREG_CALLTYPE *getTypeClass)        (TypeReaderImpl);
00062     void                (TYPEREG_CALLTYPE *getUik)              (TypeReaderImpl, RTUik*);
00063     void                (TYPEREG_CALLTYPE *getDoku)             (TypeReaderImpl, rtl_uString**);
00064     void                (TYPEREG_CALLTYPE *getFileName)         (TypeReaderImpl, rtl_uString**);
00065     void                (TYPEREG_CALLTYPE *getTypeName)         (TypeReaderImpl, rtl_uString**);
00066     void                (TYPEREG_CALLTYPE *getSuperTypeName)    (TypeReaderImpl, rtl_uString**);
00067     sal_uInt32          (TYPEREG_CALLTYPE *getFieldCount)       (TypeReaderImpl);
00068     void                (TYPEREG_CALLTYPE *getFieldName)        (TypeReaderImpl, rtl_uString**, sal_uInt16);
00069     void                (TYPEREG_CALLTYPE *getFieldType)        (TypeReaderImpl, rtl_uString**, sal_uInt16);
00070     RTFieldAccess       (TYPEREG_CALLTYPE *getFieldAccess)      (TypeReaderImpl, sal_uInt16);
00071     RTValueType         (TYPEREG_CALLTYPE *getFieldConstValue)  (TypeReaderImpl, sal_uInt16, RTConstValueUnion*);
00072     void                (TYPEREG_CALLTYPE *getFieldDoku)        (TypeReaderImpl, rtl_uString**, sal_uInt16);
00073     void                (TYPEREG_CALLTYPE *getFieldFileName)    (TypeReaderImpl, rtl_uString**, sal_uInt16);
00074     sal_uInt32          (TYPEREG_CALLTYPE *getMethodCount)      (TypeReaderImpl);
00075     void                (TYPEREG_CALLTYPE *getMethodName)       (TypeReaderImpl, rtl_uString**, sal_uInt16);
00076     sal_uInt32          (TYPEREG_CALLTYPE *getMethodParamCount) (TypeReaderImpl, sal_uInt16);
00077     void                (TYPEREG_CALLTYPE *getMethodParamType)  (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
00078     void                (TYPEREG_CALLTYPE *getMethodParamName)  (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
00079     RTParamMode         (TYPEREG_CALLTYPE *getMethodParamMode)  (TypeReaderImpl, sal_uInt16, sal_uInt16);
00080     sal_uInt32          (TYPEREG_CALLTYPE *getMethodExcCount)   (TypeReaderImpl, sal_uInt16);
00081     void                (TYPEREG_CALLTYPE *getMethodExcType)    (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
00082     void                (TYPEREG_CALLTYPE *getMethodReturnType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
00083     RTMethodMode        (TYPEREG_CALLTYPE *getMethodMode)       (TypeReaderImpl, sal_uInt16);
00084     void                (TYPEREG_CALLTYPE *getMethodDoku)       (TypeReaderImpl, rtl_uString**, sal_uInt16);
00085 
00086     sal_uInt32          (TYPEREG_CALLTYPE *getReferenceCount)   (TypeReaderImpl);
00087     void                (TYPEREG_CALLTYPE *getReferenceName)    (TypeReaderImpl, rtl_uString**, sal_uInt16);
00088     RTReferenceType     (TYPEREG_CALLTYPE *getReferenceType)    (TypeReaderImpl, sal_uInt16);
00089     void                (TYPEREG_CALLTYPE *getReferenceDoku)    (TypeReaderImpl, rtl_uString**, sal_uInt16);
00090     RTFieldAccess       (TYPEREG_CALLTYPE *getReferenceAccess)  (TypeReaderImpl, sal_uInt16);
00091 };
00092 
00095 REG_DLLPUBLIC RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void);
00096 
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100 
00110 class RegistryTypeReader
00111 {
00112 public:
00113 
00122     inline RegistryTypeReader(const sal_uInt8* buffer,
00123                               sal_uInt32 bufferLen,
00124                               sal_Bool copyData);
00125 
00127     inline RegistryTypeReader(const RegistryTypeReader& toCopy);
00128 
00130     inline ~RegistryTypeReader();
00131 
00133     inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
00134 
00136     inline sal_Bool         isValid() const;
00137 
00144     inline sal_uInt16       getMinorVersion() const;
00145 
00152     inline sal_uInt16       getMajorVersion() const;
00153 
00159     inline RTTypeClass      getTypeClass() const;
00160 
00163     inline ::rtl::OUString  getTypeName() const;
00164 
00167     inline ::rtl::OUString  getSuperTypeName() const;
00168 
00176     inline void             getUik(RTUik& uik) const;
00177 
00180     inline ::rtl::OUString  getDoku() const;
00181 
00184     inline ::rtl::OUString  getFileName() const;
00185 
00190     inline sal_uInt32       getFieldCount() const;
00191 
00194     inline ::rtl::OUString  getFieldName( sal_uInt16 index ) const;
00195 
00198     inline ::rtl::OUString  getFieldType( sal_uInt16 index ) const;
00199 
00202     inline RTFieldAccess    getFieldAccess( sal_uInt16 index ) const;
00203 
00208     inline RTConstValue     getFieldConstValue( sal_uInt16 index ) const;
00209 
00214     inline ::rtl::OUString  getFieldDoku( sal_uInt16 index ) const;
00215 
00221     inline ::rtl::OUString  getFieldFileName( sal_uInt16 index ) const;
00222 
00225     inline sal_uInt32       getMethodCount() const;
00226 
00229     inline ::rtl::OUString  getMethodName( sal_uInt16 index ) const;
00230 
00233     inline sal_uInt32       getMethodParamCount( sal_uInt16 index ) const;
00234 
00240     inline ::rtl::OUString  getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
00241 
00247     inline ::rtl::OUString  getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
00248 
00254     inline RTParamMode      getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
00255 
00260     inline sal_uInt32       getMethodExcCount( sal_uInt16 index ) const;
00261 
00267     inline ::rtl::OUString  getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
00268 
00271     inline ::rtl::OUString  getMethodReturnType( sal_uInt16 index ) const;
00272 
00277     inline RTMethodMode     getMethodMode( sal_uInt16 index ) const;
00278 
00283     inline ::rtl::OUString  getMethodDoku( sal_uInt16 index ) const;
00284 
00287     inline sal_uInt32       getReferenceCount() const;
00288 
00293     inline ::rtl::OUString  getReferenceName( sal_uInt16 index ) const;
00294 
00299     inline RTReferenceType  getReferenceType( sal_uInt16 index ) const;
00300 
00305     inline ::rtl::OUString  getReferenceDoku( sal_uInt16 index ) const;
00306 
00313     inline RTFieldAccess    getReferenceAccess( sal_uInt16 index ) const;
00314 
00315 protected:
00316 
00318     const RegistryTypeReader_Api*                               m_pApi;
00320     TypeReaderImpl                                              m_hImpl;
00321 };
00322 
00323 
00324 
00325 inline RegistryTypeReader::RegistryTypeReader(const sal_uInt8* buffer,
00326                                               sal_uInt32 bufferLen,
00327                                               sal_Bool copyData)
00328     : m_pApi(initRegistryTypeReader_Api())
00329     , m_hImpl(NULL)
00330     {
00331         m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
00332     }
00333 
00334 
00335 inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
00336     : m_pApi(toCopy.m_pApi)
00337     , m_hImpl(toCopy.m_hImpl)
00338     { m_pApi->acquire(m_hImpl); }
00339 
00340 
00341 inline RegistryTypeReader::~RegistryTypeReader()
00342     {  m_pApi->release(m_hImpl); }
00343 
00344 inline RegistryTypeReader& RegistryTypeReader::operator == (const RegistryTypeReader& toAssign)
00345 {
00346     if (m_hImpl != toAssign.m_hImpl)
00347     {
00348         m_pApi->release(m_hImpl);
00349         m_hImpl = toAssign.m_hImpl;
00350         m_pApi->acquire(m_hImpl);
00351     }
00352 
00353     return *this;
00354 }
00355 
00356 inline sal_uInt16 RegistryTypeReader::getMinorVersion() const
00357     {  return m_pApi->getMinorVersion(m_hImpl); }
00358 
00359 inline sal_Bool RegistryTypeReader::isValid() const
00360     {  return (m_hImpl != NULL); }
00361 
00362 inline sal_uInt16 RegistryTypeReader::getMajorVersion() const
00363     {  return m_pApi->getMajorVersion(m_hImpl); }
00364 
00365 inline RTTypeClass RegistryTypeReader::getTypeClass() const
00366     {  return m_pApi->getTypeClass(m_hImpl); }
00367 
00368 inline ::rtl::OUString RegistryTypeReader::getTypeName() const
00369     {
00370         ::rtl::OUString sRet;
00371         m_pApi->getTypeName(m_hImpl, &sRet.pData);
00372         return sRet;
00373     }
00374 
00375 inline ::rtl::OUString RegistryTypeReader::getSuperTypeName() const
00376     {
00377         ::rtl::OUString sRet;
00378         m_pApi->getSuperTypeName(m_hImpl, &sRet.pData);
00379         return sRet;
00380     }
00381 
00382 inline void RegistryTypeReader::getUik(RTUik& uik) const
00383     {  m_pApi->getUik(m_hImpl, &uik); }
00384 
00385 inline ::rtl::OUString RegistryTypeReader::getDoku() const
00386     {
00387         ::rtl::OUString sRet;
00388         m_pApi->getDoku(m_hImpl, &sRet.pData);
00389         return sRet;
00390     }
00391 
00392 inline ::rtl::OUString RegistryTypeReader::getFileName() const
00393     {
00394         ::rtl::OUString sRet;
00395         m_pApi->getFileName(m_hImpl, &sRet.pData);
00396         return sRet;
00397     }
00398 
00399 inline sal_uInt32 RegistryTypeReader::getFieldCount() const
00400     {   return m_pApi->getFieldCount(m_hImpl); }
00401 
00402 inline ::rtl::OUString RegistryTypeReader::getFieldName( sal_uInt16 index ) const
00403     {
00404         ::rtl::OUString sRet;
00405         m_pApi->getFieldName(m_hImpl, &sRet.pData, index);
00406         return sRet;
00407     }
00408 
00409 inline ::rtl::OUString RegistryTypeReader::getFieldType( sal_uInt16 index ) const
00410     {
00411         ::rtl::OUString sRet;
00412         m_pApi->getFieldType(m_hImpl, &sRet.pData, index);
00413         return sRet;
00414     }
00415 
00416 inline RTFieldAccess RegistryTypeReader::getFieldAccess( sal_uInt16 index ) const
00417     {  return m_pApi->getFieldAccess(m_hImpl, index); }
00418 
00419 inline RTConstValue RegistryTypeReader::getFieldConstValue( sal_uInt16 index ) const
00420     {
00421         RTConstValue ret;
00422         ret.m_type = m_pApi->getFieldConstValue(m_hImpl, index, &ret.m_value);
00423         return ret;
00424     }
00425 
00426 inline ::rtl::OUString RegistryTypeReader::getFieldDoku( sal_uInt16 index ) const
00427     {
00428         ::rtl::OUString sRet;
00429         m_pApi->getFieldDoku(m_hImpl, &sRet.pData, index);
00430         return sRet;
00431     }
00432 
00433 inline ::rtl::OUString RegistryTypeReader::getFieldFileName( sal_uInt16 index ) const
00434     {
00435         ::rtl::OUString sRet;
00436         m_pApi->getFieldFileName(m_hImpl, &sRet.pData, index);
00437         return sRet;
00438     }
00439 
00440 inline sal_uInt32 RegistryTypeReader::getMethodCount() const
00441     {  return m_pApi->getMethodCount(m_hImpl); }
00442 
00443 inline ::rtl::OUString RegistryTypeReader::getMethodName( sal_uInt16 index ) const
00444     {
00445         ::rtl::OUString sRet;
00446         m_pApi->getMethodName(m_hImpl, &sRet.pData, index);
00447         return sRet;
00448     }
00449 
00450 inline sal_uInt32 RegistryTypeReader::getMethodParamCount( sal_uInt16 index ) const
00451     {  return m_pApi->getMethodParamCount(m_hImpl, index); }
00452 
00453 inline ::rtl::OUString RegistryTypeReader::getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
00454     {
00455         ::rtl::OUString sRet;
00456         m_pApi->getMethodParamType(m_hImpl, &sRet.pData, index, paramIndex);
00457         return sRet;
00458     }
00459 
00460 inline ::rtl::OUString RegistryTypeReader::getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
00461     {
00462         ::rtl::OUString sRet;
00463         m_pApi->getMethodParamName(m_hImpl, &sRet.pData, index, paramIndex);
00464         return sRet;
00465     }
00466 
00467 inline RTParamMode RegistryTypeReader::getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
00468     {  return m_pApi->getMethodParamMode(m_hImpl, index, paramIndex); }
00469 
00470 inline sal_uInt32 RegistryTypeReader::getMethodExcCount( sal_uInt16 index ) const
00471     {  return m_pApi->getMethodExcCount(m_hImpl, index); }
00472 
00473 inline ::rtl::OUString RegistryTypeReader::getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
00474     {
00475         ::rtl::OUString sRet;
00476         m_pApi->getMethodExcType(m_hImpl, &sRet.pData, index, excIndex);
00477         return sRet;
00478     }
00479 
00480 inline ::rtl::OUString RegistryTypeReader::getMethodReturnType( sal_uInt16 index ) const
00481     {
00482         ::rtl::OUString sRet;
00483         m_pApi->getMethodReturnType(m_hImpl, &sRet.pData, index);
00484         return sRet;
00485     }
00486 
00487 inline RTMethodMode RegistryTypeReader::getMethodMode( sal_uInt16 index ) const
00488     {  return m_pApi->getMethodMode(m_hImpl, index); }
00489 
00490 inline ::rtl::OUString RegistryTypeReader::getMethodDoku( sal_uInt16 index ) const
00491     {
00492         ::rtl::OUString sRet;
00493         m_pApi->getMethodDoku(m_hImpl, &sRet.pData, index);
00494         return sRet;
00495     }
00496 
00497 inline sal_uInt32 RegistryTypeReader::getReferenceCount() const
00498     {  return m_pApi->getReferenceCount(m_hImpl); }
00499 
00500 inline ::rtl::OUString RegistryTypeReader::getReferenceName( sal_uInt16 index ) const
00501     {
00502         ::rtl::OUString sRet;
00503         m_pApi->getReferenceName(m_hImpl, &sRet.pData, index);
00504         return sRet;
00505     }
00506 
00507 inline RTReferenceType RegistryTypeReader::getReferenceType( sal_uInt16 index ) const
00508     {  return m_pApi->getReferenceType(m_hImpl, index); }
00509 
00510 inline ::rtl::OUString RegistryTypeReader::getReferenceDoku( sal_uInt16 index ) const
00511     {
00512         ::rtl::OUString sRet;
00513         m_pApi->getReferenceDoku(m_hImpl, &sRet.pData, index);
00514         return sRet;
00515     }
00516 
00517 inline RTFieldAccess RegistryTypeReader::getReferenceAccess( sal_uInt16 index ) const
00518     {  return m_pApi->getReferenceAccess(m_hImpl, index); }
00519 
00520 #endif
00521 
00522 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines