UDK 3.2.7 C/C++ API Reference
registry/reflwrit.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_REFLWRIT_HXX_
00030 #define _REGISTRY_REFLWRIT_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* TypeWriterImpl;
00039 
00040 /****************************************************************************
00041 
00042     C-Api
00043 
00044 *****************************************************************************/
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00054 struct RegistryTypeWriter_Api
00055 {
00056     TypeWriterImpl          (TYPEREG_CALLTYPE *createEntry)         (RTTypeClass, rtl_uString*, rtl_uString*, sal_uInt16, sal_uInt16, sal_uInt16);
00057     void                    (TYPEREG_CALLTYPE *acquire)             (TypeWriterImpl);
00058     void                    (TYPEREG_CALLTYPE *release)             (TypeWriterImpl);
00059     void                    (TYPEREG_CALLTYPE *setUik)              (TypeWriterImpl, const RTUik*);
00060     void                    (TYPEREG_CALLTYPE *setDoku)             (TypeWriterImpl, rtl_uString*);
00061     void                    (TYPEREG_CALLTYPE *setFileName)         (TypeWriterImpl, rtl_uString*);
00062     void                    (TYPEREG_CALLTYPE *setFieldData)        (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, rtl_uString*, rtl_uString*, RTFieldAccess, RTValueType, RTConstValueUnion);
00063     void                    (TYPEREG_CALLTYPE *setMethodData)       (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, RTMethodMode, sal_uInt16, sal_uInt16, rtl_uString*);
00064     void                    (TYPEREG_CALLTYPE *setParamData)        (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*, rtl_uString*, RTParamMode);
00065     void                    (TYPEREG_CALLTYPE *setExcData)          (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*);
00066     const sal_uInt8*        (TYPEREG_CALLTYPE *getBlop)             (TypeWriterImpl);
00067     sal_uInt32              (TYPEREG_CALLTYPE *getBlopSize)         (TypeWriterImpl);
00068 
00069     void                    (TYPEREG_CALLTYPE *setReferenceData)    (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess);
00070 };
00071 
00074 REG_DLLPUBLIC RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api(void);
00075 
00076 #ifdef __cplusplus
00077 }
00078 #endif
00079 
00089 class RegistryTypeWriter
00090 {
00091 public:
00092 
00105     inline RegistryTypeWriter(RTTypeClass               RTTypeClass,
00106                               const ::rtl::OUString&    typeName,
00107                               const ::rtl::OUString&    superTypeName,
00108                               sal_uInt16                fieldCount,
00109                               sal_uInt16                methodCount,
00110                               sal_uInt16                referenceCount);
00111 
00113     inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
00114 
00119     inline ~RegistryTypeWriter();
00120 
00122     inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
00123 
00131     inline void setUik(const RTUik& uik);
00132 
00138     inline void setDoku(const ::rtl::OUString& doku);
00139 
00142     inline void setFileName(const ::rtl::OUString& fileName);
00143 
00155     inline void setFieldData( sal_uInt16                index,
00156                               const ::rtl::OUString&    name,
00157                               const ::rtl::OUString&    typeName,
00158                               const ::rtl::OUString&    doku,
00159                               const ::rtl::OUString&    fileName,
00160                               RTFieldAccess             access,
00161                               RTConstValue              constValue = RTConstValue());
00162 
00173     inline void setMethodData(sal_uInt16                index,
00174                               const ::rtl::OUString&    name,
00175                               const ::rtl::OUString&    returnTypeName,
00176                               RTMethodMode              mode,
00177                               sal_uInt16                paramCount,
00178                               sal_uInt16                excCount,
00179                               const ::rtl::OUString&    doku);
00180 
00189     inline void setParamData(sal_uInt16             index,
00190                              sal_uInt16             paramIndex,
00191                              const ::rtl::OUString& type,
00192                              const ::rtl::OUString& name,
00193                              RTParamMode            mode);
00194 
00201     inline void setExcData(sal_uInt16               index,
00202                            sal_uInt16               excIndex,
00203                            const ::rtl::OUString&   type);
00204 
00210     inline const sal_uInt8*     getBlop();
00211 
00214     inline sal_uInt32       getBlopSize();
00215 
00224     inline void setReferenceData( sal_uInt16                index,
00225                                     const ::rtl::OUString&  name,
00226                                     RTReferenceType             refType,
00227                                     const ::rtl::OUString&  doku,
00228                                     RTFieldAccess               access = RT_ACCESS_INVALID);
00229 
00230 protected:
00231 
00233     const RegistryTypeWriter_Api*                                m_pApi;
00235     TypeWriterImpl                                               m_hImpl;
00236 };
00237 
00238 
00239 
00240 inline RegistryTypeWriter::RegistryTypeWriter(RTTypeClass               RTTypeClass,
00241                                               const ::rtl::OUString&    typeName,
00242                                               const ::rtl::OUString&    superTypeName,
00243                                               sal_uInt16                fieldCount,
00244                                               sal_uInt16                methodCount,
00245                                               sal_uInt16                referenceCount)
00246     : m_pApi(initRegistryTypeWriter_Api())
00247     , m_hImpl(NULL)
00248 {
00249     m_hImpl = m_pApi->createEntry(RTTypeClass,
00250                                   typeName.pData,
00251                                   superTypeName.pData,
00252                                   fieldCount,
00253                                   methodCount,
00254                                   referenceCount);
00255 }
00256 
00257 
00258 inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter& toCopy)
00259     : m_pApi(toCopy.m_pApi)
00260     , m_hImpl(toCopy.m_hImpl)
00261 {
00262     m_pApi->acquire(m_hImpl);
00263 }
00264 
00265 inline RegistryTypeWriter::~RegistryTypeWriter()
00266 {
00267     m_pApi->release(m_hImpl);
00268 }
00269 
00270 inline RegistryTypeWriter& RegistryTypeWriter::operator == (const RegistryTypeWriter& toAssign)
00271 {
00272     if (m_hImpl != toAssign.m_hImpl)
00273     {
00274         m_pApi->release(m_hImpl);
00275         m_hImpl = toAssign.m_hImpl;
00276         m_pApi->acquire(m_hImpl);
00277     }
00278 
00279     return *this;
00280 }
00281 
00282 inline void RegistryTypeWriter::setFieldData( sal_uInt16                index,
00283                                               const ::rtl::OUString&    name,
00284                                               const ::rtl::OUString&    typeName,
00285                                               const ::rtl::OUString&    doku,
00286                                               const ::rtl::OUString&    fileName,
00287                                               RTFieldAccess             access,
00288                                               RTConstValue              constValue)
00289 {
00290     m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value);
00291 }
00292 
00293 
00294 inline void RegistryTypeWriter::setMethodData(sal_uInt16                index,
00295                                               const ::rtl::OUString&    name,
00296                                               const ::rtl::OUString&    returnTypeName,
00297                                               RTMethodMode              mode,
00298                                               sal_uInt16                paramCount,
00299                                               sal_uInt16                excCount,
00300                                               const ::rtl::OUString&    doku)
00301 {
00302     m_pApi->setMethodData(m_hImpl, index, name.pData, returnTypeName.pData, mode, paramCount, excCount, doku.pData);
00303 }
00304 
00305 
00306 inline void RegistryTypeWriter::setUik(const RTUik& uik)
00307 {
00308     m_pApi->setUik(m_hImpl, &uik);
00309 }
00310 
00311 inline void RegistryTypeWriter::setDoku(const ::rtl::OUString& doku)
00312 {
00313     m_pApi->setDoku(m_hImpl, doku.pData);
00314 }
00315 
00316 inline void RegistryTypeWriter::setFileName(const ::rtl::OUString& doku)
00317 {
00318     m_pApi->setFileName(m_hImpl, doku.pData);
00319 }
00320 
00321 inline void RegistryTypeWriter::setParamData(sal_uInt16             index,
00322                                              sal_uInt16             paramIndex,
00323                                              const ::rtl::OUString& type,
00324                                              const ::rtl::OUString& name,
00325                                              RTParamMode            mode)
00326 {
00327     m_pApi->setParamData(m_hImpl, index, paramIndex, type.pData, name.pData, mode);
00328 }
00329 
00330 inline void RegistryTypeWriter::setExcData(sal_uInt16               index,
00331                                            sal_uInt16               excIndex,
00332                                            const ::rtl::OUString&   type)
00333 {
00334     m_pApi->setExcData(m_hImpl, index, excIndex, type.pData);
00335 }
00336 
00337 inline const sal_uInt8* RegistryTypeWriter::getBlop()
00338 {
00339     return m_pApi->getBlop(m_hImpl);
00340 }
00341 
00342 inline sal_uInt32 RegistryTypeWriter::getBlopSize()
00343 {
00344     return m_pApi->getBlopSize(m_hImpl);
00345 }
00346 
00347 
00348 inline void RegistryTypeWriter::setReferenceData( sal_uInt16                index,
00349                                                     const ::rtl::OUString&  name,
00350                                                     RTReferenceType             refType,
00351                                                     const ::rtl::OUString&  doku,
00352                                                     RTFieldAccess           access)
00353 {
00354     m_pApi->setReferenceData(m_hImpl, index, name.pData, refType, doku.pData, access);
00355 }
00356 
00357 #endif
00358 
00359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines