LCOV - code coverage report
Current view: top level - codemaker/source/cppumaker - cpputype.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2452 2612 93.9 %
Date: 2012-08-25 Functions: 128 139 92.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3388 6273 54.0 %

           Branch data     Line data    Source code
       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                 :            : 
      21                 :            : #include <algorithm>
      22                 :            : #include <map>
      23                 :            : #include <set>
      24                 :            : #include <stdio.h>
      25                 :            : #include <string.h>
      26                 :            : #include <vector>
      27                 :            : 
      28                 :            : #include "registry/reader.hxx"
      29                 :            : #include "rtl/alloc.h"
      30                 :            : #include "rtl/ustring.hxx"
      31                 :            : #include "rtl/strbuf.hxx"
      32                 :            : 
      33                 :            : #include "codemaker/dependencies.hxx"
      34                 :            : #include "codemaker/exceptiontree.hxx"
      35                 :            : #include "codemaker/generatedtypeset.hxx"
      36                 :            : #include "codemaker/unotype.hxx"
      37                 :            : 
      38                 :            : #include "cpputype.hxx"
      39                 :            : #include "cppuoptions.hxx"
      40                 :            : #include "dumputils.hxx"
      41                 :            : #include "includes.hxx"
      42                 :            : 
      43                 :            : using namespace codemaker::cpp;
      44                 :            : 
      45                 :            : using ::rtl::OUString;
      46                 :            : using ::rtl::OString;
      47                 :            : using ::rtl::OStringBuffer;
      48                 :            : 
      49                 :            : namespace {
      50                 :            : 
      51                 :      93422 : rtl::OString translateSimpleUnoType(rtl::OString const & unoType, bool cppuUnoType=false) {
      52                 :            :     static rtl::OString const trans[codemaker::UnoType::SORT_COMPLEX + 1] = {
      53                 :            :         "void", "::sal_Bool", "::sal_Int8", "::sal_Int16", "::sal_uInt16",
      54                 :            :         "::sal_Int32", "::sal_uInt32", "::sal_Int64", "::sal_uInt64", "float",
      55                 :            :         "double", "::sal_Unicode", "::rtl::OUString",
      56                 :            :         "::com::sun::star::uno::Type", "::com::sun::star::uno::Any",
      57 [ +  + ][ +  - ]:      93796 :         rtl::OString() };
                 [ +  + ]
      58                 :            : 
      59                 :      93422 :     const codemaker::UnoType::Sort sort = codemaker::UnoType::getSort(unoType);
      60 [ +  + ][ +  + ]:      93422 :     if (cppuUnoType &&
                 [ +  + ]
      61                 :            :         (sort == codemaker::UnoType::SORT_UNSIGNED_SHORT ||
      62                 :            :          sort == codemaker::UnoType::SORT_CHAR) )
      63                 :            :     {
      64         [ +  + ]:         18 :         if (sort == codemaker::UnoType::SORT_CHAR)
      65                 :         10 :             return "::cppu::UnoCharType";
      66                 :            :         else
      67                 :          8 :             return "::cppu::UnoUnsignedShortType";
      68                 :            :     }
      69                 :            : 
      70                 :      93422 :     return trans[sort];
      71                 :            : }
      72                 :            : 
      73                 :      12428 : bool isBootstrapType(rtl::OString const & name) {
      74                 :            :     static char const * const names[] = {
      75                 :            :         "com/sun/star/beans/PropertyAttribute",
      76                 :            :         "com/sun/star/beans/PropertyValue",
      77                 :            :         "com/sun/star/beans/XFastPropertySet",
      78                 :            :         "com/sun/star/beans/XMultiPropertySet",
      79                 :            :         "com/sun/star/beans/XPropertyAccess",
      80                 :            :         "com/sun/star/beans/XPropertySet",
      81                 :            :         "com/sun/star/beans/XPropertySetOption",
      82                 :            :         "com/sun/star/bridge/UnoUrlResolver",
      83                 :            :         "com/sun/star/bridge/XUnoUrlResolver",
      84                 :            :         "com/sun/star/connection/SocketPermission",
      85                 :            :         "com/sun/star/container/XElementAccess",
      86                 :            :         "com/sun/star/container/XEnumerationAccess",
      87                 :            :         "com/sun/star/container/XHierarchicalNameAccess",
      88                 :            :         "com/sun/star/container/XNameAccess",
      89                 :            :         "com/sun/star/container/XNameContainer",
      90                 :            :         "com/sun/star/container/XNameReplace",
      91                 :            :         "com/sun/star/container/XSet",
      92                 :            :         "com/sun/star/io/FilePermission",
      93                 :            :         "com/sun/star/io/IOException",
      94                 :            :         "com/sun/star/lang/DisposedException",
      95                 :            :         "com/sun/star/lang/WrappedTargetRuntimeException",
      96                 :            :         "com/sun/star/lang/XComponent",
      97                 :            :         "com/sun/star/lang/XEventListener",
      98                 :            :         "com/sun/star/lang/XInitialization",
      99                 :            :         "com/sun/star/lang/XMultiComponentFactory",
     100                 :            :         "com/sun/star/lang/XMultiServiceFactory",
     101                 :            :         "com/sun/star/lang/XServiceInfo",
     102                 :            :         "com/sun/star/lang/XSingleComponentFactory",
     103                 :            :         "com/sun/star/lang/XSingleServiceFactory",
     104                 :            :         "com/sun/star/lang/XTypeProvider",
     105                 :            :         "com/sun/star/loader/XImplementationLoader",
     106                 :            :         "com/sun/star/reflection/XArrayTypeDescription",
     107                 :            :         "com/sun/star/reflection/XCompoundTypeDescription",
     108                 :            :         "com/sun/star/reflection/XEnumTypeDescription",
     109                 :            :         "com/sun/star/reflection/XIdlClass",
     110                 :            :         "com/sun/star/reflection/XIdlField2",
     111                 :            :         "com/sun/star/reflection/XIdlReflection",
     112                 :            :         "com/sun/star/reflection/XIndirectTypeDescription",
     113                 :            :         "com/sun/star/reflection/XInterfaceAttributeTypeDescription",
     114                 :            :         "com/sun/star/reflection/XInterfaceAttributeTypeDescription2",
     115                 :            :         "com/sun/star/reflection/XInterfaceMemberTypeDescription",
     116                 :            :         "com/sun/star/reflection/XInterfaceMethodTypeDescription",
     117                 :            :         "com/sun/star/reflection/XInterfaceTypeDescription",
     118                 :            :         "com/sun/star/reflection/XInterfaceTypeDescription2",
     119                 :            :         "com/sun/star/reflection/XMethodParameter",
     120                 :            :         "com/sun/star/reflection/XStructTypeDescription",
     121                 :            :         "com/sun/star/reflection/XTypeDescription",
     122                 :            :         "com/sun/star/reflection/XUnionTypeDescription",
     123                 :            :         "com/sun/star/registry/XImplementationRegistration",
     124                 :            :         "com/sun/star/registry/XRegistryKey",
     125                 :            :         "com/sun/star/registry/XSimpleRegistry",
     126                 :            :         "com/sun/star/security/RuntimePermission",
     127                 :            :         "com/sun/star/security/XAccessController",
     128                 :            :         "com/sun/star/uno/DeploymentException",
     129                 :            :         "com/sun/star/uno/RuntimeException",
     130                 :            :         "com/sun/star/uno/XAggregation",
     131                 :            :         "com/sun/star/uno/XComponentContext",
     132                 :            :         "com/sun/star/uno/XCurrentContext",
     133                 :            :         "com/sun/star/uno/XUnloadingPreference",
     134                 :            :         "com/sun/star/uno/XWeak",
     135                 :            :         "com/sun/star/util/XMacroExpander"
     136                 :            :     }; // cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies)
     137         [ +  + ]:     760940 :     for (std::size_t i = 0; i < SAL_N_ELEMENTS(names); ++i) {
     138         [ +  + ]:     748844 :         if (name.equals(names[i])) {
     139                 :        332 :             return true;
     140                 :            :         }
     141                 :            :     }
     142                 :      12428 :     return false;
     143                 :            : }
     144                 :            : 
     145                 :            : }
     146                 :            : 
     147                 :            : //*************************************************************************
     148                 :            : // CppuType
     149                 :            : //*************************************************************************
     150                 :      20754 : CppuType::CppuType(typereg::Reader& typeReader,
     151                 :            :                    const OString& typeName,
     152                 :            :                    const TypeManager& typeMgr)
     153                 :            :     : m_inheritedMemberCount(0)
     154                 :            :     , m_cppuTypeLeak(sal_False)
     155                 :            :     , m_cppuTypeDynamic(sal_True)
     156                 :            :     , m_indentLength(0)
     157                 :            :     , m_typeName(typeName)
     158                 :      20754 :     , m_name(typeName.copy(typeName.lastIndexOf('/') + 1))
     159                 :            :     , m_reader(typeReader)
     160                 :            :     , m_typeMgr(typeMgr)
     161         [ +  - ]:      41508 :     , m_dependencies(typeMgr, typeName)
     162                 :      20754 : {}
     163                 :            : 
     164         [ +  - ]:      20754 : CppuType::~CppuType()
     165                 :            : {
     166                 :            : 
     167         [ -  + ]:      20754 : }
     168                 :            : 
     169                 :      15512 : void CppuType::addGetCppuTypeIncludes(codemaker::cppumaker::Includes & includes)
     170                 :            :     const
     171                 :            : {
     172   [ +  +  +  + ]:      46528 :     if (m_typeName.equals("com/sun/star/uno/XInterface")
         [ +  - ][ +  - ]
                 [ +  + ]
     173 [ +  + ][ +  + ]:      31016 :         || m_typeName.equals("com/sun/star/uno/Exception"))
     174                 :            :     {
     175                 :         16 :         includes.addType();
     176                 :         16 :         includes.addCppuUnotypeHxx();
     177                 :         16 :         includes.addSalTypesH();
     178                 :         16 :         includes.addTypelibTypeclassH();
     179                 :         16 :         includes.addTypelibTypedescriptionH();
     180         [ +  + ]:      15496 :     } else if (m_cppuTypeLeak) {
     181                 :       5869 :         addLightGetCppuTypeIncludes(includes);
     182         [ +  + ]:       9627 :     } else if (m_cppuTypeDynamic) {
     183                 :       3182 :         addNormalGetCppuTypeIncludes(includes);
     184                 :            :     } else {
     185                 :       6445 :         addComprehensiveGetCppuTypeIncludes(includes);
     186                 :            :     }
     187                 :      15512 : }
     188                 :            : 
     189                 :          0 : void CppuType::dumpDeclaration(FileStream &) throw (CannotDumpException) {
     190                 :            :     OSL_ASSERT(false);
     191                 :          0 : }
     192                 :            : 
     193                 :      14188 : bool CppuType::dumpFiles(CppuOptions * options, rtl::OString const & outPath) {
     194 [ +  - ][ +  - ]:      28376 :     return dumpFile(options, ".hdl", m_typeName, outPath)
                 [ +  - ]
           [ #  #  #  # ]
     195 [ +  - ][ +  - ]:      28376 :         && dumpFile(options, ".hpp", m_typeName, outPath);
         [ +  - ][ +  - ]
                 [ +  - ]
           [ #  #  #  # ]
     196                 :            : }
     197                 :            : 
     198                 :       4969 : void CppuType::addLightGetCppuTypeIncludes(
     199                 :            :     codemaker::cppumaker::Includes & includes) const
     200                 :            : {
     201                 :            :     //TODO: Determine what is really needed, instead of relying on
     202                 :            :     // addDefaultHxxIncludes
     203                 :       4969 :     includes.addCppuUnotypeHxx();
     204                 :       4969 : }
     205                 :            : 
     206                 :       3172 : void CppuType::addNormalGetCppuTypeIncludes(
     207                 :            :     codemaker::cppumaker::Includes & includes) const
     208                 :            : {
     209                 :            :     //TODO: Determine what is really needed, instead of relying on
     210                 :            :     // addDefaultHxxIncludes
     211                 :       3172 :     includes.addCppuUnotypeHxx();
     212                 :       3172 : }
     213                 :            : 
     214                 :       2023 : void CppuType::addComprehensiveGetCppuTypeIncludes(
     215                 :            :     codemaker::cppumaker::Includes & includes) const
     216                 :            : {
     217                 :            :     //TODO: Determine what is really needed, instead of relying on
     218                 :            :     // addDefaultHxxIncludes
     219                 :       2023 :     includes.addCppuUnotypeHxx();
     220                 :       2023 : }
     221                 :            : 
     222                 :      36074 : bool CppuType::isPolymorphic() const { return false; }
     223                 :            : 
     224                 :      18140 : void CppuType::dumpTemplateHead(FileStream &) const {}
     225                 :            : 
     226                 :      27202 : void CppuType::dumpTemplateParameters(FileStream &) const {}
     227                 :            : 
     228                 :      10888 : void CppuType::dumpGetCppuTypePreamble(FileStream & out) {
     229         [ +  + ]:      10888 :     if (isPolymorphic()) {
     230                 :         24 :         out << "namespace cppu {\n\n";
     231                 :         24 :         dumpTemplateHead(out);
     232                 :         24 :         out << "class UnoType< ";
     233                 :         24 :         dumpType(out, m_typeName);
     234                 :         24 :         dumpTemplateParameters(out);
     235                 :         24 :         out << " > {\npublic:\n";
     236                 :         24 :         inc();
     237         [ +  - ]:         48 :         out << indent()
     238         [ +  - ]:         24 :             << "static inline ::com::sun::star::uno::Type const & get() {\n";
     239                 :            :     } else {
     240         [ +  + ]:      10864 :         if (codemaker::cppumaker::dumpNamespaceOpen(out, m_typeName, false)) {
     241                 :      10832 :             out << "\n\n";
     242                 :            :         }
     243                 :            :         out << ("inline ::com::sun::star::uno::Type const &"
     244                 :      10864 :                 " cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ");
     245                 :      10864 :         dumpType(out, m_typeName, false, false, true);
     246                 :      10864 :         out << " const *) {\n";
     247                 :            :     }
     248                 :      10888 :     inc();
     249                 :      10888 : }
     250                 :            : 
     251                 :      10888 : void CppuType::dumpGetCppuTypePostamble(FileStream & out) {
     252                 :      10888 :     dec();
     253         [ +  + ]:      10888 :     if (isPolymorphic()) {
     254 [ +  - ][ +  - ]:         48 :         out << indent() << "}\n\nprivate:\n"
                 [ +  - ]
     255 [ +  - ][ +  - ]:         72 :             << indent() << "UnoType(UnoType &); // not defined\n"
                 [ +  - ]
     256 [ +  - ][ +  - ]:         72 :             << indent() << "~UnoType(); // not defined\n"
                 [ +  - ]
     257         [ +  - ]:         72 :             << indent()
     258         [ +  - ]:         24 :             << "void operator =(UnoType); // not defined\n};\n\n}\n\n";
     259                 :            :     } else {
     260                 :      10864 :         out << "}\n\n";
     261         [ +  + ]:      10864 :         if (codemaker::cppumaker::dumpNamespaceClose(out, m_typeName, false)) {
     262                 :      10832 :             out << "\n\n";
     263                 :            :         }
     264                 :            :     }
     265                 :      10888 :     dumpTemplateHead(out);
     266                 :            :     out << ("inline ::com::sun::star::uno::Type const & SAL_CALL"
     267                 :      10888 :             " getCppuType(SAL_UNUSED_PARAMETER ");
     268                 :      10888 :     dumpType(out, m_typeName);
     269                 :      10888 :     dumpTemplateParameters(out);
     270                 :      10888 :     out << " const *) SAL_THROW(()) {\n";
     271                 :      10888 :     inc();
     272 [ +  - ][ +  - ]:      10888 :     out << indent() << "return ::cppu::UnoType< ";
     273                 :      10888 :     dumpType(out, m_typeName);
     274                 :      10888 :     dumpTemplateParameters(out);
     275                 :      10888 :     out << " >::get();\n";
     276                 :      10888 :     dec();
     277 [ +  - ][ +  - ]:      10888 :     out << indent() << "}\n";
     278                 :      10888 : }
     279                 :            : 
     280                 :      12428 : sal_Bool CppuType::dump(CppuOptions* pOptions)
     281                 :            :     throw( CannotDumpException )
     282                 :            : {
     283         [ -  + ]:      12428 :     if (!m_dependencies.isValid()) {
     284                 :          0 :         return false;
     285                 :            :     }
     286         [ +  - ]:      12428 :     addSpecialDependencies();
     287                 :            : 
     288 [ +  - ][ +  + ]:      12428 :     if (isBootstrapType(m_typeName)) {
     289                 :        332 :         m_cppuTypeDynamic = false;
     290                 :            :     } else {
     291                 :            :         // -CS was used as an undocumented option to generate static getCppuType
     292                 :            :         // functions; since the introduction of cppu::UnoType this no longer is
     293                 :            :         // meaningful (getCppuType is just a forward to cppu::UnoType::get now),
     294                 :            :         // and -CS is handled the same way as -C now:
     295 [ +  - ][ +  + ]:      12096 :         if (pOptions->isValid("-L"))
     296                 :       5873 :             m_cppuTypeLeak = sal_True;
     297 [ +  - ][ +  + ]:      12096 :         if (pOptions->isValid("-C") || pOptions->isValid("-CS"))
         [ +  - ][ -  + ]
         [ +  + ][ +  + ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
          #  #  #  #  #  
                      # ]
     298                 :       6121 :             m_cppuTypeDynamic = sal_False;
     299                 :            :     }
     300                 :            : 
     301                 :      12428 :     OString outPath;
     302 [ +  - ][ +  - ]:      12428 :     if (pOptions->isValid("-O"))
     303         [ +  - ]:      12428 :         outPath = pOptions->getOption("-O");
     304                 :            : 
     305         [ +  - ]:      12428 :     return dumpFiles(pOptions, outPath);
     306                 :            : }
     307                 :            : 
     308                 :      29700 : sal_Bool CppuType::dumpFile(CppuOptions* pOptions,
     309                 :            :                             const OString& sExtension,
     310                 :            :                             const OString& sName,
     311                 :            :                             const OString& sOutPath )
     312                 :            :     throw( CannotDumpException )
     313                 :            : {
     314                 :      29700 :     sal_Bool ret = sal_False;
     315                 :            : 
     316                 :      29700 :     OString sTmpExt(".tml");
     317                 :      29700 :     sal_Bool bHdl = sal_True;    ;
     318         [ +  + ]:      29700 :     if (sExtension.equals(".hpp")) {
     319                 :      15512 :         sTmpExt = ".tmp";
     320                 :      15512 :         bHdl = sal_False;
     321                 :            :     }
     322                 :            : 
     323         [ +  - ]:      29700 :     OString sFileName = createFileNameFromType(sOutPath, sName, sExtension);
     324         [ -  + ]:      29700 :     if (sFileName.isEmpty())
     325                 :          0 :         return sal_False;
     326                 :            : 
     327         [ +  - ]:      29700 :     sal_Bool bFileExists = fileExists( sFileName );
     328                 :      29700 :     sal_Bool bFileCheck = sal_False;
     329                 :            : 
     330 [ +  + ][ +  - ]:      29700 :     if ( bFileExists && pOptions->isValid("-G") )
         [ -  + ][ +  + ]
         [ +  + ][ -  +  
             #  #  #  # ]
     331                 :          0 :         return sal_True;
     332                 :            : 
     333 [ +  + ][ +  - ]:      29700 :     if ( bFileExists && pOptions->isValid("-Gc") )
         [ +  + ][ +  + ]
         [ +  + ][ +  +  
             #  #  #  # ]
     334                 :      14831 :         bFileCheck = sal_True;
     335                 :            : 
     336         [ +  - ]:      29700 :     OString sTmpDir = getTempDir(sFileName);
     337         [ +  - ]:      29700 :     FileStream oFile;
     338         [ +  - ]:      29700 :     oFile.createTempFile(sTmpDir);
     339                 :      29700 :     OString sTmpFileName;
     340                 :            : 
     341 [ -  + ][ +  - ]:      29700 :     if(!oFile.isValid())
     342                 :            :     {
     343                 :          0 :         OString message("cannot open ");
     344                 :          0 :         message += sFileName + " for writing";
     345                 :          0 :         throw CannotDumpException(message);
     346                 :            :     } else
     347                 :      29700 :         sTmpFileName = oFile.getName();
     348                 :            : 
     349         [ +  - ]:      29700 :     codemaker::cppumaker::Includes includes(m_typeMgr, m_dependencies, !bHdl);
     350         [ +  + ]:      29700 :     if (bHdl)
     351         [ +  - ]:      14188 :         ret = dumpHFile(oFile, includes);
     352                 :            :     else {
     353         [ +  - ]:      15512 :         addGetCppuTypeIncludes(includes);
     354         [ +  - ]:      15512 :         ret = dumpHxxFile(oFile, includes);
     355                 :            :     }
     356                 :            : 
     357         [ +  - ]:      29700 :     oFile.close();
     358                 :            : 
     359         [ +  - ]:      29700 :     if (ret) {
     360         [ +  - ]:      29700 :         ret = makeValidTypeFile(sFileName, sTmpFileName, bFileCheck);
     361                 :            :     } else {
     362                 :            :         // remove existing type file if something goes wrong to ensure consistency
     363 [ #  # ][ #  # ]:          0 :         if (fileExists(sFileName))
     364         [ #  # ]:          0 :             removeTypeFile(sFileName);
     365                 :            : 
     366                 :            :         // remove tmp file if something goes wrong
     367         [ #  # ]:          0 :         removeTypeFile(sTmpFileName);
     368                 :            :     }
     369                 :            : 
     370 [ +  - ][ +  - ]:      29700 :     return ret;
     371                 :            : }
     372                 :            : 
     373                 :      12428 : void CppuType::dumpDependedTypes(
     374                 :            :     codemaker::GeneratedTypeSet & generated, CppuOptions * options)
     375                 :            : {
     376                 :      12428 :     codemaker::Dependencies::Map const & map(m_dependencies.getMap());
     377 [ +  + ][ +  - ]:      89516 :     for (codemaker::Dependencies::Map::const_iterator i(map.begin());
     378         [ +  - ]:      44758 :          i != map.end(); ++i)
     379                 :            :     {
     380 [ +  - ][ +  - ]:      32330 :         if (!produceType(i->first, m_typeMgr, generated, options)) {
                 [ -  + ]
     381                 :            :             fprintf(
     382                 :            :                 stderr, "%s ERROR: cannot dump Type '%s'\n",
     383 [ #  # ][ #  # ]:          0 :                 options->getProgramName().getStr(), i->first.getStr());
                 [ #  # ]
     384                 :          0 :             exit(99);
     385                 :            :         }
     386                 :            :     }
     387                 :      12428 : }
     388                 :            : 
     389                 :      29700 : OString CppuType::dumpHeaderDefine(
     390                 :            :     FileStream& o, char const * prefix, sal_Bool bExtended)
     391                 :            : {
     392         [ -  + ]:      29700 :     if (m_typeName.equals("/"))
     393                 :            :     {
     394                 :          0 :         bExtended = sal_False;
     395                 :          0 :         m_typeName = "global";
     396                 :            :     }
     397                 :            : 
     398                 :      29700 :     sal_uInt32 length = 3 + m_typeName.getLength() + strlen(prefix);
     399                 :            : 
     400         [ -  + ]:      29700 :     if (bExtended)
     401                 :          0 :         length += m_name.getLength() + 1;
     402                 :            : 
     403                 :      29700 :     OStringBuffer tmpBuf(length);
     404                 :            : 
     405         [ +  - ]:      29700 :     tmpBuf.append("INCLUDED_");
     406         [ +  - ]:      29700 :     tmpBuf.append(m_typeName);
     407         [ +  - ]:      29700 :     tmpBuf.append('_');
     408         [ -  + ]:      29700 :     if (bExtended)
     409                 :            :     {
     410         [ #  # ]:          0 :         tmpBuf.append(m_name);
     411         [ #  # ]:          0 :         tmpBuf.append('_');
     412                 :            :     }
     413         [ +  - ]:      29700 :     tmpBuf.append(prefix);
     414                 :            : 
     415                 :      29700 :     OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase());
     416                 :            : 
     417 [ +  - ][ +  - ]:      29700 :     o << "#ifndef " << tmp << "\n#define " << tmp << "\n";
         [ +  - ][ +  - ]
                 [ +  - ]
     418                 :            : 
     419                 :      29700 :     return tmp;
     420                 :            : }
     421                 :            : 
     422                 :      14188 : void CppuType::addDefaultHIncludes(codemaker::cppumaker::Includes & includes)
     423                 :            :     const
     424                 :            : {
     425                 :            :     //TODO: Only include what is really needed
     426                 :      14188 :     includes.addCppuMacrosHxx();
     427         [ +  + ]:      14188 :     if (m_typeMgr.getTypeClass(m_typeName) == RT_TYPE_INTERFACE) {
     428                 :       7198 :         includes.addReference();
     429                 :            :     }
     430                 :      14188 : }
     431                 :            : 
     432                 :       9278 : void CppuType::addDefaultHxxIncludes(codemaker::cppumaker::Includes & includes)
     433                 :            :     const
     434                 :            : {
     435                 :            :     //TODO: Only include what is really needed
     436                 :       9278 :     includes.addRtlInstanceHxx();
     437                 :       9278 :     includes.addOslMutexHxx();
     438                 :       9278 :     includes.addType();
     439         [ +  + ]:       9278 :     if (m_typeMgr.getTypeClass(m_typeName) == RT_TYPE_INTERFACE) {
     440                 :       7198 :         includes.addReference();
     441                 :            :     }
     442                 :       9278 : }
     443                 :            : 
     444                 :       7230 : void CppuType::dumpInitializer(
     445                 :            :     FileStream & out, bool parameterized, rtl::OUString const & type) const
     446                 :            : {
     447                 :       7230 :     out << "(";
     448         [ +  + ]:       7230 :     if (!parameterized) {
     449                 :        136 :         for (rtl::OString t(
     450         [ +  - ]:       7202 :                  rtl::OUStringToOString(type, RTL_TEXTENCODING_UTF8));;)
     451                 :            :         {
     452                 :            :             sal_Int32 rank;
     453         [ +  - ]:       7338 :             std::vector< rtl::OString > args;
     454         [ +  - ]:       7338 :             t = codemaker::UnoType::decompose(t, &rank, &args);
     455         [ +  + ]:       7338 :             if (rank == 0) {
     456         [ +  - ]:       6874 :                 switch (codemaker::UnoType::getSort(t)) {
           [ +  +  +  + ]
     457                 :            :                 case codemaker::UnoType::SORT_BOOLEAN:
     458         [ +  - ]:        664 :                     out << "false";
     459                 :        664 :                     break;
     460                 :            : 
     461                 :            :                 case codemaker::UnoType::SORT_BYTE:
     462                 :            :                 case codemaker::UnoType::SORT_SHORT:
     463                 :            :                 case codemaker::UnoType::SORT_UNSIGNED_SHORT:
     464                 :            :                 case codemaker::UnoType::SORT_LONG:
     465                 :            :                 case codemaker::UnoType::SORT_UNSIGNED_LONG:
     466                 :            :                 case codemaker::UnoType::SORT_HYPER:
     467                 :            :                 case codemaker::UnoType::SORT_UNSIGNED_HYPER:
     468                 :            :                 case codemaker::UnoType::SORT_FLOAT:
     469                 :            :                 case codemaker::UnoType::SORT_DOUBLE:
     470                 :            :                 case codemaker::UnoType::SORT_CHAR:
     471         [ +  - ]:       2936 :                     out << "0";
     472                 :       2936 :                     break;
     473                 :            : 
     474                 :            :                 case codemaker::UnoType::SORT_COMPLEX:
     475         [ +  - ]:       1238 :                     switch (m_typeMgr.getTypeClass(t)) {
              [ +  +  + ]
     476                 :            :                     case RT_TYPE_ENUM:
     477                 :            :                         {
     478         [ +  - ]:        284 :                             typereg::Reader reader(m_typeMgr.getTypeReader(t));
     479                 :            :                             OSL_ASSERT(reader.isValid());
     480 [ +  - ][ +  - ]:        568 :                             out << scopedCppName(t) << "_"
                 [ +  - ]
     481                 :            :                                 << rtl::OUStringToOString(
     482                 :            :                                     reader.getFieldName(0),
     483 [ +  - ][ +  - ]:        852 :                                     RTL_TEXTENCODING_UTF8);
                 [ +  - ]
     484                 :        284 :                             break;
     485                 :            :                         }
     486                 :            : 
     487                 :            :                     case RT_TYPE_TYPEDEF:
     488         [ +  - ]:        136 :                         t = resolveTypedefs(t);
     489                 :        136 :                         continue;
     490                 :            : 
     491                 :            :                     default:
     492                 :        818 :                         break;
     493                 :            :                     }
     494                 :       1102 :                     break;
     495                 :            : 
     496                 :            :                 default:
     497                 :       7202 :                     break;
     498                 :            :                 }
     499                 :            :             }
     500         [ +  + ]:       7338 :             break;
     501                 :      14540 :         }
     502                 :            :     }
     503                 :       7230 :     out << ")";
     504                 :       7230 : }
     505                 :            : 
     506                 :      10904 : void CppuType::dumpHFileContent(
     507                 :            :     FileStream & out, codemaker::cppumaker::Includes & includes)
     508                 :            : {
     509                 :      10904 :     addDefaultHIncludes(includes);
     510                 :      10904 :     dumpHeaderDefine(out, "HDL");
     511                 :      10904 :     out << "\n";
     512                 :      10904 :     includes.dump(out, 0);
     513                 :            :     out << ("\nnamespace com { namespace sun { namespace star { namespace uno"
     514                 :      10904 :             " { class Type; } } } }\n\n");
     515         [ +  + ]:      10904 :     if (codemaker::cppumaker::dumpNamespaceOpen(out, m_typeName, false)) {
     516                 :      10870 :         out << "\n";
     517                 :            :     }
     518                 :      10904 :     dumpDeclaration(out);
     519         [ +  + ]:      10904 :     if (!(m_typeName.equalsL(
     520                 :      10904 :               RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/XInterface")) ||
     521                 :            :           m_typeName.equalsL(
     522                 :      10896 :               RTL_CONSTASCII_STRINGPARAM("com/sun/star/uno/Exception")) ||
     523         [ +  + ]:      21800 :           isPolymorphic()))
           [ +  +  +  + ]
     524                 :            :     {
     525 [ +  - ][ +  - ]:      21728 :         out << "\n" << indent()
     526                 :            :             << ("inline ::com::sun::star::uno::Type const &"
     527         [ +  - ]:      10864 :                 " cppu_detail_getUnoType(SAL_UNUSED_PARAMETER ");
     528                 :      10864 :         dumpType(out, m_typeName, false, false, true);
     529                 :      10864 :         out << " const *);\n";
     530                 :            :     }
     531         [ +  + ]:      10904 :     if (codemaker::cppumaker::dumpNamespaceClose(out, m_typeName, false)) {
     532                 :      10870 :         out << "\n";
     533                 :            :     }
     534                 :      10904 :     out << "\n";
     535                 :      10904 :     dumpTemplateHead(out);
     536                 :      10904 :     out << "inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(";
     537                 :      10904 :     dumpType(out, m_typeName, true);
     538                 :      10904 :     dumpTemplateParameters(out);
     539                 :      10904 :     out << " *) SAL_THROW(());\n\n#endif\n";
     540                 :      10904 : }
     541                 :            : 
     542                 :      10904 : void CppuType::dumpGetCppuType(FileStream & out) {
     543         [ +  + ]:      10904 :     if (m_typeName.equals("com/sun/star/uno/XInterface")) {
     544         [ +  - ]:         16 :         out << indent()
     545                 :            :             << ("inline ::com::sun::star::uno::Type const & SAL_CALL"
     546         [ +  - ]:          8 :                 " getCppuType(SAL_UNUSED_PARAMETER ");
     547                 :          8 :         dumpType(out, m_typeName, true, false);
     548                 :          8 :         out << " *) SAL_THROW(()) {\n";
     549                 :          8 :         inc();
     550         [ +  - ]:         16 :         out << indent()
     551                 :            :             << ("return ::cppu::UnoType< ::com::sun::star::uno::XInterface"
     552         [ +  - ]:          8 :                 " >::get();\n");
     553                 :          8 :         dec();
     554 [ +  - ][ +  - ]:          8 :         out << indent() << "}\n";
     555         [ +  + ]:      10896 :     } else if (m_typeName.equals("com/sun/star/uno/Exception")) {
     556         [ +  - ]:         16 :         out << indent()
     557                 :            :             << ("inline ::com::sun::star::uno::Type const & SAL_CALL"
     558         [ +  - ]:          8 :                 " getCppuType(SAL_UNUSED_PARAMETER ");
     559                 :          8 :         dumpType(out, m_typeName, true, false);
     560                 :          8 :         out << " *) SAL_THROW(()) {\n";
     561                 :          8 :         inc();
     562         [ +  - ]:         16 :         out << indent()
     563                 :            :             << ("return ::cppu::UnoType< ::com::sun::star::uno::Exception"
     564         [ +  - ]:          8 :                 " >::get();\n");
     565                 :          8 :         dec();
     566 [ +  - ][ +  - ]:          8 :         out << indent() << "}\n";
     567         [ +  + ]:      10888 :     } else if (m_cppuTypeLeak) {
     568                 :       5430 :         dumpLightGetCppuType(out);
     569         [ +  + ]:       5458 :     } else if (m_cppuTypeDynamic) {
     570                 :         98 :         dumpNormalGetCppuType(out);
     571                 :            :     } else {
     572                 :       5360 :         dumpComprehensiveGetCppuType(out);
     573                 :            :     }
     574                 :      10904 : }
     575                 :            : 
     576                 :       4530 : void CppuType::dumpLightGetCppuType(FileStream& o)
     577                 :            : {
     578                 :       4530 :     dumpGetCppuTypePreamble(o);
     579         [ +  - ]:       9060 :     o << indent()
     580         [ +  - ]:       4530 :       << "static typelib_TypeDescriptionReference * the_type = 0;\n";
     581                 :            : 
     582 [ +  - ][ +  - ]:       4530 :     o << indent() << "if ( !the_type )\n" << indent() << "{\n";
         [ +  - ][ +  - ]
                 [ +  - ]
     583                 :       4530 :     inc();
     584 [ +  - ][ +  - ]:       9060 :     o << indent() << "typelib_static_type_init( &the_type, "
                 [ +  - ]
     585 [ +  - ][ +  - ]:      13590 :       << getTypeClass(m_typeName, sal_True) << ", \"" << m_typeName.replace('/', '.') << "\" );\n";
         [ +  - ][ +  - ]
                 [ +  - ]
     586                 :       4530 :     dec();
     587 [ +  - ][ +  - ]:       4530 :     o << indent() << "}\n";
     588         [ +  - ]:       9060 :     o << indent()
     589                 :            :       << ("return * reinterpret_cast< ::com::sun::star::uno::Type * >("
     590         [ +  - ]:       4530 :           " &the_type );\n");
     591                 :       4530 :     dumpGetCppuTypePostamble(o);
     592                 :       4530 : }
     593                 :            : 
     594                 :         30 : void CppuType::dumpNormalGetCppuType(FileStream& o)
     595                 :            : {
     596         [ +  - ]:         30 :     dumpGetCppuTypePreamble(o);
     597                 :            : 
     598 [ +  - ][ +  - ]:         60 :     o << indent()
     599         [ +  - ]:         30 :       << "static typelib_TypeDescriptionReference * the_type = 0;\n";
     600                 :            : 
     601 [ +  - ][ +  - ]:         30 :     o << indent() << "if ( !the_type )\n" << indent() << "{\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     602                 :         30 :     inc();
     603                 :            : 
     604                 :         30 :     OString superType;
     605         [ +  - ]:         30 :     if (m_reader.getSuperTypeCount() >= 1) {
     606                 :            :         superType = rtl::OUStringToOString(
     607 [ +  - ][ +  - ]:         30 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     608                 :            :     }
     609                 :         30 :     sal_Bool bIsBaseException = sal_False;
     610         [ +  - ]:         30 :     if (!superType.isEmpty())
     611                 :            :     {
     612         [ +  + ]:         30 :         if ( superType.equals("com/sun/star/uno/Exception") )
     613                 :            :         {
     614                 :         26 :             bIsBaseException = sal_True;
     615                 :            :         } else
     616                 :            :         {
     617 [ +  - ][ +  - ]:          4 :             o << indent() << "const ::com::sun::star::uno::Type& rBaseType = ::cppu::UnoType< ";
                 [ +  - ]
     618         [ +  - ]:          4 :             dumpType(o, superType, true, false, false, true);
     619         [ +  - ]:          4 :             o << " >::get();\n\n";
     620                 :            :         }
     621                 :            :     }
     622                 :            : 
     623         [ +  - ]:         30 :     sal_uInt32 count = getMemberCount();
     624         [ +  + ]:         30 :     if (count)
     625                 :            :     {
     626 [ +  - ][ +  - ]:          6 :         o << indent() << "typelib_TypeDescriptionReference * aMemberRefs[" << count << "];\n";
         [ +  - ][ +  - ]
                 [ +  - ]
     627                 :            : 
     628                 :          6 :         sal_uInt16      fieldCount = m_reader.getFieldCount();
     629                 :          6 :         RTFieldAccess   access = RT_ACCESS_INVALID;
     630                 :          6 :         OString         fieldType, fieldName;
     631                 :          6 :         OString         scope = m_typeName.replace('/', '.');
     632                 :          6 :         OString         modFieldType;
     633         [ +  - ]:          6 :         StringSet       generatedTypeSet;
     634                 :          6 :         StringSet::iterator findIter;
     635                 :            : 
     636         [ +  + ]:         12 :         for (sal_uInt16 i=0; i < fieldCount; i++)
     637                 :            :         {
     638                 :          6 :             access = m_reader.getFieldFlags(i);
     639                 :            : 
     640 [ -  + ][ +  - ]:          6 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
     641                 :          0 :                 continue;
     642                 :            : 
     643                 :            :             fieldName = rtl::OUStringToOString(
     644 [ +  - ][ +  - ]:          6 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
     645                 :            :             fieldType = checkRealBaseType(
     646                 :            :                 rtl::OUStringToOString(
     647                 :            :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8),
     648 [ +  - ][ +  - ]:          6 :                 sal_True);
                 [ +  - ]
     649                 :            : 
     650         [ +  - ]:          6 :             modFieldType = typeToIdentifier(fieldType);
     651                 :            : 
     652         [ +  - ]:          6 :             findIter = generatedTypeSet.find(fieldType);
     653         [ +  - ]:          6 :             if ( findIter == generatedTypeSet.end() )
     654                 :            :             {
     655         [ +  - ]:          6 :                 generatedTypeSet.insert(fieldType);
     656 [ +  - ][ +  - ]:         12 :                  o << indent() << "const ::com::sun::star::uno::Type& rMemberType_"
                 [ +  - ]
     657 [ +  - ][ +  - ]:          6 :                   << modFieldType/*i*/ << " = ::cppu::UnoType< ";
     658         [ +  - ]:          6 :                 dumpType(o, fieldType, false, false, false, true);
     659         [ +  - ]:          6 :                 o << " >::get();\n";
     660                 :            :             }
     661                 :            : 
     662 [ +  - ][ +  - ]:         12 :             o << indent() << "aMemberRefs[" << i << "] = rMemberType_"
         [ +  - ][ +  - ]
                 [ +  - ]
     663 [ +  - ][ +  - ]:          6 :               << modFieldType/*i*/ << ".getTypeLibType();\n";
     664                 :            :         }
     665         [ +  - ]:          6 :         o << "\n";
     666                 :            :     }
     667                 :            : 
     668 [ +  - ][ +  - ]:         60 :     o << indent() << "typelib_static_compound_type_init( &the_type, "
                 [ +  - ]
     669 [ +  - ][ +  - ]:         90 :       << getTypeClass(m_typeName, sal_True) << ", \"" << m_typeName.replace('/', '.') << "\", ";
         [ +  - ][ +  - ]
                 [ +  - ]
     670 [ #  # ][ +  - ]:         30 :     if ( !superType.isEmpty() || bIsBaseException )
                 [ -  + ]
     671                 :            :     {
     672         [ +  + ]:         30 :         if ( bIsBaseException )
     673                 :            :         {
     674         [ +  - ]:         26 :             o << "* ::typelib_static_type_getByTypeClass( typelib_TypeClass_EXCEPTION ), "
     675 [ +  - ][ +  - ]:         26 :               << count << ", ";
     676                 :            :         } else
     677                 :            :         {
     678 [ +  - ][ +  - ]:          4 :             o << "rBaseType.getTypeLibType(), " << count << ", ";
                 [ +  - ]
     679                 :            :         }
     680                 :            :     } else
     681                 :            :     {
     682 [ #  # ][ #  # ]:          0 :         o << "0, " << count << ", ";
                 [ #  # ]
     683                 :            :     }
     684                 :            : 
     685         [ +  + ]:         30 :     if (count)
     686                 :            :     {
     687         [ +  - ]:          6 :         o << " aMemberRefs );\n";
     688                 :            :     } else
     689                 :            :     {
     690         [ +  - ]:         24 :         o << " 0 );\n";
     691                 :            :     }
     692         [ +  - ]:         30 :     dec();
     693 [ +  - ][ +  - ]:         30 :     o << indent() << "}\n";
                 [ +  - ]
     694 [ +  - ][ +  - ]:         60 :     o << indent()
     695                 :            :       << ("return * reinterpret_cast< const ::com::sun::star::uno::Type * >("
     696         [ +  - ]:         30 :           " &the_type );\n");
     697                 :            : 
     698         [ +  - ]:         30 :     dumpGetCppuTypePostamble(o);
     699                 :         30 : }
     700                 :            : 
     701                 :        524 : void CppuType::dumpComprehensiveGetCppuType(FileStream& o)
     702                 :            : {
     703 [ +  - ][ +  - ]:        524 :     if (!isPolymorphic())
     704         [ +  - ]:        524 :         codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false);
     705                 :            :     else
     706         [ #  # ]:          0 :         o << "namespace cppu { ";
     707         [ +  - ]:        524 :     o << " namespace detail {\n\n";
     708                 :            : 
     709                 :        524 :     OString sType = m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
     710                 :        524 :     OString sStaticTypeClass = "the" + sType + "Type";
     711 [ +  - ][ +  - ]:        524 :     o << indent() << "struct " << sStaticTypeClass << " : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, " << sStaticTypeClass << " >\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     712 [ +  - ][ +  - ]:        524 :     o << indent() << "{\n";
                 [ +  - ]
     713                 :        524 :     inc();
     714 [ +  - ][ +  - ]:        524 :     o << indent() << "::com::sun::star::uno::Type * operator()() const\n";
                 [ +  - ]
     715 [ +  - ][ +  - ]:        524 :     o << indent() << "{\n";
                 [ +  - ]
     716                 :        524 :     inc();
     717                 :            : 
     718 [ +  - ][ +  - ]:       1048 :     o << indent() << "::rtl::OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM(\""
                 [ +  - ]
     719 [ +  - ][ +  - ]:       1572 :       << m_typeName.replace('/', '.') << "\") );\n\n";
     720                 :            : 
     721 [ +  - ][ +  - ]:       1048 :     o << indent() << "// Start inline typedescription generation\n"
                 [ +  - ]
     722 [ +  - ][ +  - ]:       1572 :       << indent() << "typelib_TypeDescription * pTD = 0;\n";
                 [ +  - ]
     723                 :            : 
     724                 :        524 :     OString superType;
     725         [ +  - ]:        524 :     if (m_reader.getSuperTypeCount() >= 1) {
     726                 :            :         superType = rtl::OUStringToOString(
     727 [ +  - ][ +  - ]:        524 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     728                 :            :     }
     729         [ +  - ]:        524 :     if (!superType.isEmpty()) {
     730 [ +  - ][ +  - ]:       1048 :         o << indent()
     731         [ +  - ]:        524 :           << "const ::com::sun::star::uno::Type& rSuperType = ::cppu::UnoType< ";
     732         [ +  - ]:        524 :         dumpType(o, superType, false, false, false, true);
     733         [ +  - ]:        524 :         o << " >::get();\n";
     734                 :            :     }
     735                 :            : 
     736         [ +  - ]:        524 :     dumpCppuGetTypeMemberDecl(o, CPPUTYPEDECL_ALLTYPES);
     737                 :            : 
     738         [ +  - ]:        524 :     sal_uInt32 count = getMemberCount();
     739         [ +  + ]:        524 :     if (count)
     740                 :            :     {
     741 [ +  - ][ +  - ]:        408 :         o << "\n" << indent() << "typelib_CompoundMember_Init aMembers["
         [ +  - ][ +  - ]
     742 [ +  - ][ +  - ]:        204 :           << count << "];\n";
     743                 :            : 
     744                 :        204 :         sal_uInt16      fieldCount = m_reader.getFieldCount();
     745                 :        204 :         RTFieldAccess   access = RT_ACCESS_INVALID;
     746                 :        204 :         OString         fieldType, fieldName;
     747                 :        204 :         OString         scope = m_typeName.replace('/', '.');
     748         [ +  + ]:        534 :         for (sal_uInt16 i=0; i < fieldCount; i++)
     749                 :            :         {
     750                 :        330 :             access = m_reader.getFieldFlags(i);
     751                 :            : 
     752 [ -  + ][ +  - ]:        330 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID) {
     753                 :          0 :                 continue;
     754                 :            :             }
     755                 :            : 
     756                 :            :             fieldName = rtl::OUStringToOString(
     757 [ +  - ][ +  - ]:        330 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
     758                 :            :             fieldType = checkRealBaseType(
     759                 :            :                 rtl::OUStringToOString(
     760                 :            :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8),
     761 [ +  - ][ +  - ]:        330 :                 sal_True);
                 [ +  - ]
     762                 :            : 
     763 [ +  - ][ +  - ]:        660 :             o << indent() << "::rtl::OUString sMemberType" << i
         [ +  - ][ +  - ]
     764         [ +  - ]:        330 :               << "( RTL_CONSTASCII_USTRINGPARAM(\""
     765 [ +  - ][ +  - ]:        990 :               << fieldType.replace('/', '.') << "\") );\n";
     766 [ +  - ][ +  - ]:        660 :             o << indent() << "::rtl::OUString sMemberName" << i
         [ +  - ][ +  - ]
     767         [ +  - ]:        330 :               << "( RTL_CONSTASCII_USTRINGPARAM(\"";
     768 [ +  - ][ +  - ]:        330 :             o << fieldName << "\") );\n";
     769 [ +  - ][ +  - ]:        660 :             o << indent() << "aMembers[" << i << "].eTypeClass = "
         [ +  - ][ +  - ]
                 [ +  - ]
     770 [ +  - ][ +  - ]:        990 :               << "(typelib_TypeClass)" << getTypeClass(fieldType) << ";\n"
         [ +  - ][ +  - ]
     771 [ +  - ][ +  - ]:        990 :               << indent() << "aMembers[" << i << "].pTypeName = sMemberType"
         [ +  - ][ +  - ]
                 [ +  - ]
     772 [ +  - ][ +  - ]:        330 :               << i << ".pData;\n"
     773 [ +  - ][ +  - ]:        990 :               << indent() << "aMembers[" << i << "].pMemberName = sMemberName"
         [ +  - ][ +  - ]
                 [ +  - ]
     774 [ +  - ][ +  - ]:        330 :               << i << ".pData;\n";
     775                 :        204 :         }
     776                 :            :     }
     777                 :            : 
     778 [ +  - ][ +  - ]:        524 :     o << "\n" << indent() << "typelib_typedescription_new(\n";
         [ +  - ][ +  - ]
     779                 :        524 :     inc();
     780 [ +  - ][ +  - ]:       1048 :     o << indent() << "&pTD,\n" << indent() << "(typelib_TypeClass)"
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     781 [ +  - ][ +  - ]:       1572 :       << getTypeClass() << ", sTypeName.pData,\n";
                 [ +  - ]
     782                 :            : 
     783         [ +  - ]:        524 :     if (!superType.isEmpty()) {
     784 [ +  - ][ +  - ]:        524 :         o << indent() << "rSuperType.getTypeLibType(),\n";
                 [ +  - ]
     785                 :            :     } else {
     786 [ #  # ][ #  # ]:          0 :         o << indent() << "0,\n";
                 [ #  # ]
     787                 :            :     }
     788                 :            : 
     789         [ +  + ]:        524 :     if ( count ) {
     790 [ +  - ][ +  - ]:        204 :         o << indent() << count << ",\n" << indent() << "aMembers );\n\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     791                 :            :     } else {
     792 [ +  - ][ +  - ]:        320 :         o << indent() << count << ",\n" << indent() << "0 );\n\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
     793                 :            :     }
     794         [ +  - ]:        524 :     dec();
     795                 :            : 
     796 [ +  - ][ +  - ]:       1048 :     o << indent()
     797                 :            :       << ("typelib_typedescription_register( (typelib_TypeDescription**)&pTD"
     798         [ +  - ]:        524 :           " );\n\n");
     799                 :            : 
     800 [ +  - ][ +  - ]:       1048 :     o << indent() << "typelib_typedescription_release( pTD );\n"
                 [ +  - ]
     801 [ +  - ][ +  - ]:       1572 :       << indent() << "// End inline typedescription generation\n\n";
                 [ +  - ]
     802                 :            : 
     803 [ +  - ][ +  - ]:       1048 :     o << indent() << "return new ::com::sun::star::uno::Type( "
                 [ +  - ]
     804 [ +  - ][ +  - ]:       1572 :       << getTypeClass(m_typeName) << ", sTypeName ); // leaked\n";
                 [ +  - ]
     805                 :            : 
     806         [ +  - ]:        524 :     dec();
     807 [ +  - ][ +  - ]:        524 :     o << indent() << "}\n";
                 [ +  - ]
     808         [ +  - ]:        524 :     dec();
     809 [ +  - ][ +  - ]:        524 :     o << indent() << "};\n\n";
                 [ +  - ]
     810                 :            : 
     811 [ +  - ][ +  - ]:        524 :     if (!isPolymorphic())
     812         [ +  - ]:        524 :         codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false);
     813                 :            :     else
     814         [ #  # ]:          0 :         o << " }";
     815                 :            : 
     816         [ +  - ]:        524 :     o << " }\n\n";
     817                 :            : 
     818         [ +  - ]:        524 :     dumpGetCppuTypePreamble(o);
     819 [ +  - ][ +  - ]:        524 :     o  << indent() << "return *detail::" << sStaticTypeClass << "::get();\n";
         [ +  - ][ +  - ]
                 [ +  - ]
     820         [ +  - ]:        524 :     dumpGetCppuTypePostamble(o);
     821                 :        524 : }
     822                 :            : 
     823                 :        524 : void CppuType::dumpCppuGetTypeMemberDecl(FileStream& o, CppuTypeDecl eDeclFlag)
     824                 :            : {
     825                 :        524 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
     826                 :        524 :     RTFieldAccess   access = RT_ACCESS_INVALID;
     827                 :            : 
     828         [ +  - ]:        524 :     StringSet aFinishedTypes;
     829         [ +  + ]:        854 :     for (sal_uInt16 i=0; i < fieldCount; i++)
     830                 :            :     {
     831                 :        330 :         access = m_reader.getFieldFlags(i);
     832                 :            : 
     833 [ +  - ][ -  + ]:        330 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID
                 [ +  - ]
     834                 :            :             || (access & RT_ACCESS_PARAMETERIZED_TYPE) != 0)
     835                 :          0 :             continue;
     836                 :            : 
     837                 :            :         rtl::OString typeName(
     838                 :            :             rtl::OUStringToOString(
     839 [ +  - ][ +  - ]:        330 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
     840 [ +  + ][ +  - ]:        330 :         if (aFinishedTypes.count(typeName) == 0)
     841                 :            :         {
     842         [ +  - ]:        262 :             aFinishedTypes.insert(typeName);
     843         [ +  - ]:        262 :             dumpCppuGetType(o, typeName, sal_True, eDeclFlag);
     844                 :            :         }
     845                 :        854 :     }
     846                 :        524 : }
     847                 :            : 
     848                 :       1324 : IdentifierTranslationMode CppuType::isGlobal() const {
     849         [ +  + ]:       1324 :     if ( m_typeName.indexOf('/') < 0 )
     850                 :          8 :         return ITM_GLOBAL;
     851                 :            :     else
     852                 :       1324 :         return ITM_NONGLOBAL;
     853                 :            : }
     854                 :            : 
     855                 :        554 : sal_uInt32 CppuType::getMemberCount()
     856                 :            : {
     857                 :        554 :     sal_uInt16 count = m_reader.getMethodCount();
     858                 :            : 
     859                 :        554 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
     860                 :        554 :     RTFieldAccess access = RT_ACCESS_INVALID;
     861         [ +  + ]:        890 :     for (sal_uInt16 i=0; i < fieldCount; i++)
     862                 :            :     {
     863                 :        336 :         access = m_reader.getFieldFlags(i);
     864                 :            : 
     865 [ +  - ][ +  - ]:        336 :         if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID)
     866                 :        336 :             count++;
     867                 :            :     }
     868                 :        554 :     return count;
     869                 :            : }
     870                 :            : 
     871                 :       1710 : sal_uInt32 CppuType::checkInheritedMemberCount(const typereg::Reader* pReader)
     872                 :            : {
     873                 :       1710 :     sal_Bool bSelfCheck = sal_True;
     874         [ +  + ]:       1710 :     if (!pReader)
     875                 :            :     {
     876                 :        638 :         bSelfCheck = sal_False;
     877                 :        638 :         pReader = &m_reader;
     878                 :            :     }
     879                 :            : 
     880                 :       1710 :     sal_uInt32 count = 0;
     881                 :       1710 :     OString superType;
     882         [ +  + ]:       1710 :     if (pReader->getSuperTypeCount() >= 1) {
     883                 :            :         superType = rtl::OUStringToOString(
     884 [ +  - ][ +  - ]:       1072 :             pReader->getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
     885                 :            :     }
     886         [ +  + ]:       1710 :     if (!superType.isEmpty())
     887                 :            :     {
     888         [ +  - ]:       1072 :         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
     889         [ +  - ]:       1072 :         if ( aSuperReader.isValid() )
     890                 :            :         {
     891         [ +  - ]:       1072 :             count = checkInheritedMemberCount(&aSuperReader);
     892                 :       1072 :         }
     893                 :            :     }
     894                 :            : 
     895         [ +  + ]:       1710 :     if (bSelfCheck)
     896                 :            :     {
     897                 :       1072 :         count += pReader->getMethodCount();
     898                 :       1072 :         sal_uInt16 fieldCount = pReader->getFieldCount();
     899                 :       1072 :         RTFieldAccess access = RT_ACCESS_INVALID;
     900         [ +  + ]:       2474 :         for (sal_uInt16 i=0; i < fieldCount; i++)
     901                 :            :         {
     902                 :       1402 :             access = pReader->getFieldFlags(i);
     903                 :            : 
     904 [ +  - ][ +  - ]:       1402 :             if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID)
     905                 :            :             {
     906                 :       1402 :                 count++;
     907                 :            :             }
     908                 :            :         }
     909                 :            :     }
     910                 :            : 
     911                 :       1710 :     return count;
     912                 :            : }
     913                 :            : 
     914                 :       1276 : sal_uInt32 CppuType::getInheritedMemberCount()
     915                 :            : {
     916         [ +  + ]:       1276 :     if (m_inheritedMemberCount == 0)
     917                 :            :     {
     918                 :        638 :         m_inheritedMemberCount = checkInheritedMemberCount(0);
     919                 :            :     }
     920                 :            : 
     921                 :       1276 :     return m_inheritedMemberCount;
     922                 :            : }
     923                 :            : 
     924                 :      40964 : OString CppuType::getTypeClass(const OString& type, sal_Bool bCStyle)
     925                 :            : {
     926         [ +  + ]:      40964 :     OString     typeName = (!type.isEmpty() ? type : m_typeName);
     927                 :      40964 :     RTTypeClass rtTypeClass = RT_TYPE_INVALID;
     928                 :            : 
     929         [ +  + ]:      40964 :     if (!type.isEmpty())
     930                 :            :     {
     931                 :      40440 :         typeName = type;
     932         [ +  - ]:      40440 :         rtTypeClass = m_typeMgr.getTypeClass(typeName);
     933                 :            :     } else
     934                 :            :     {
     935                 :        524 :         typeName = m_typeName;
     936                 :        524 :         rtTypeClass = m_reader.getTypeClass();
     937                 :            :     }
     938                 :            : 
     939 [ +  - ][ +  + ]:      40964 :     if (codemaker::UnoType::isSequenceType(typeName))
     940         [ +  + ]:       2462 :         return bCStyle ? "typelib_TypeClass_SEQUENCE" : "::com::sun::star::uno::TypeClass_SEQUENCE";
     941                 :            : 
     942   [ +  -  +  +  :      38502 :     switch (rtTypeClass)
             +  +  -  +  
                      - ]
     943                 :            :     {
     944                 :            :         case RT_TYPE_INTERFACE:
     945         [ +  + ]:      12110 :             return bCStyle ? "typelib_TypeClass_INTERFACE" : "::com::sun::star::uno::TypeClass_INTERFACE";
     946                 :            :         case RT_TYPE_MODULE:
     947         [ #  # ]:          0 :             return bCStyle ? "typelib_TypeClass_MODULE" : "::com::sun::star::uno::TypeClass_MODULE";
     948                 :            :         case RT_TYPE_STRUCT:
     949         [ +  + ]:       4008 :             return bCStyle ? "typelib_TypeClass_STRUCT" : "::com::sun::star::uno::TypeClass_STRUCT";
     950                 :            :         case RT_TYPE_ENUM:
     951         [ +  + ]:       1224 :             return bCStyle ? "typelib_TypeClass_ENUM" : "::com::sun::star::uno::TypeClass_ENUM";
     952                 :            :         case RT_TYPE_EXCEPTION:
     953         [ +  + ]:       1564 :             return bCStyle ? "typelib_TypeClass_EXCEPTION" : "::com::sun::star::uno::TypeClass_EXCEPTION";
     954                 :            :         case RT_TYPE_TYPEDEF:
     955                 :            :             {
     956         [ +  - ]:         70 :                 OString realType = checkRealBaseType( typeName );
     957         [ +  - ]:         70 :                 return getTypeClass( realType, bCStyle );
     958                 :            :             }
     959                 :            :         case RT_TYPE_SERVICE:
     960         [ #  # ]:          0 :             return bCStyle ? "typelib_TypeClass_SERVICE" : "::com::sun::star::uno::TypeClass_SERVICE";
     961                 :            :         case RT_TYPE_INVALID:
     962                 :            :             {
     963         [ +  + ]:      19526 :                 if (type.equals("long"))
     964         [ +  + ]:       3572 :                     return bCStyle ? "typelib_TypeClass_LONG" : "::com::sun::star::uno::TypeClass_LONG";
     965         [ +  + ]:      15954 :                 if (type.equals("short"))
     966         [ +  + ]:       1124 :                     return bCStyle ? "typelib_TypeClass_SHORT" : "::com::sun::star::uno::TypeClass_SHORT";
     967         [ +  + ]:      14830 :                 if (type.equals("hyper"))
     968         [ +  + ]:        134 :                     return bCStyle ? "typelib_TypeClass_HYPER" : "::com::sun::star::uno::TypeClass_HYPER";
     969         [ +  + ]:      14696 :                 if (type.equals("string"))
     970         [ +  + ]:       5108 :                     return bCStyle ? "typelib_TypeClass_STRING" : "::com::sun::star::uno::TypeClass_STRING";
     971         [ +  + ]:       9588 :                 if (type.equals("boolean"))
     972         [ +  + ]:       2528 :                     return bCStyle ? "typelib_TypeClass_BOOLEAN" : "::com::sun::star::uno::TypeClass_BOOLEAN";
     973         [ +  + ]:       7060 :                 if (type.equals("char"))
     974         [ +  + ]:         50 :                     return bCStyle ? "typelib_TypeClass_CHAR" : "::com::sun::star::uno::TypeClass_CHAR";
     975         [ +  + ]:       7010 :                 if (type.equals("byte"))
     976         [ +  + ]:        194 :                     return bCStyle ? "typelib_TypeClass_BYTE" : "::com::sun::star::uno::TypeClass_BYTE";
     977         [ +  + ]:       6816 :                 if (type.equals("any"))
     978         [ +  + ]:        880 :                     return bCStyle ? "typelib_TypeClass_ANY" : "::com::sun::star::uno::TypeClass_ANY";
     979         [ +  + ]:       5936 :                 if (type.equals("type"))
     980         [ +  + ]:         68 :                     return bCStyle ? "typelib_TypeClass_TYPE" : "::com::sun::star::uno::TypeClass_TYPE";
     981         [ +  + ]:       5868 :                 if (type.equals("float"))
     982         [ +  + ]:         66 :                     return bCStyle ? "typelib_TypeClass_FLOAT" : "::com::sun::star::uno::TypeClass_FLOAT";
     983         [ +  + ]:       5802 :                 if (type.equals("double"))
     984         [ +  + ]:        704 :                     return bCStyle ? "typelib_TypeClass_DOUBLE" : "::com::sun::star::uno::TypeClass_DOUBLE";
     985         [ +  + ]:       5098 :                 if (type.equals("void"))
     986         [ -  + ]:       4854 :                     return bCStyle ? "typelib_TypeClass_VOID" : "::com::sun::star::uno::TypeClass_VOID";
     987         [ +  + ]:        244 :                 if (type.equals("unsigned long"))
     988         [ +  + ]:         98 :                     return bCStyle ? "typelib_TypeClass_UNSIGNED_LONG" : "::com::sun::star::uno::TypeClass_UNSIGNED_LONG";
     989         [ +  + ]:        146 :                 if (type.equals("unsigned short"))
     990         [ +  + ]:        100 :                     return bCStyle ? "typelib_TypeClass_UNSIGNED_SHORT" : "::com::sun::star::uno::TypeClass_UNSIGNED_SHORT";
     991         [ +  + ]:         46 :                 if (type.equals("unsigned hyper"))
     992         [ +  + ]:         14 :                     return bCStyle ? "typelib_TypeClass_UNSIGNED_HYPER" : "::com::sun::star::uno::TypeClass_UNSIGNED_HYPER";
     993                 :            :             }
     994                 :         32 :             break;
     995                 :            :         default:
     996                 :            :             OSL_ASSERT(false);
     997                 :          0 :             break;
     998                 :            :     }
     999                 :            : 
    1000         [ +  + ]:      40964 :     return bCStyle ? "typelib_TypeClass_UNKNOWN" : "::com::sun::star::uno::TypeClass_UNKNOWN";
    1001                 :            : }
    1002                 :            : 
    1003                 :     196324 : void CppuType::dumpType(FileStream& o, const OString& type,
    1004                 :            :                         bool bConst, bool bRef, bool bNative, bool cppuUnoType)
    1005                 :            :     const throw( CannotDumpException )
    1006                 :            : {
    1007                 :            :     sal_Int32 seqNum;
    1008         [ +  - ]:     196324 :     std::vector< rtl::OString > args;
    1009                 :            :     rtl::OString relType(
    1010                 :            :         codemaker::UnoType::decompose(
    1011 [ +  - ][ +  - ]:     196324 :             checkRealBaseType(type, true), &seqNum, &args));
    1012                 :            : 
    1013         [ +  - ]:     196324 :     RTTypeClass typeClass = m_typeMgr.getTypeClass(relType);
    1014                 :            : 
    1015 [ +  + ][ +  - ]:     196324 :     if (bConst) o << "const ";
    1016                 :            : 
    1017         [ +  + ]:     204814 :     {for (sal_Int32 i = 0; i < seqNum; ++i) {
    1018         [ +  + ]:       8490 :         if (cppuUnoType)
    1019         [ +  - ]:       1732 :             o << "::cppu::UnoSequenceType< ";
    1020                 :            :         else
    1021         [ +  - ]:       6758 :             o << "::com::sun::star::uno::Sequence< ";
    1022                 :            :     }}
    1023                 :            : 
    1024   [ +  +  +  - ]:     196324 :     switch (typeClass)
    1025                 :            :     {
    1026                 :            :         case RT_TYPE_INTERFACE:
    1027         [ +  + ]:      64608 :             if (bNative)
    1028 [ +  - ][ +  - ]:      14380 :                 o << scopedCppName(relType);
    1029                 :            :             else
    1030         [ +  - ]:      50228 :                 o << "::com::sun::star::uno::Reference< "
    1031 [ +  - ][ +  - ]:     100456 :                   << scopedCppName(relType) << " >";
                 [ +  - ]
    1032                 :      64608 :             break;
    1033                 :            :         case RT_TYPE_INVALID:
    1034                 :            :             {
    1035         [ +  - ]:      93422 :                 OString tmp(translateSimpleUnoType(relType, cppuUnoType));
    1036         [ +  - ]:      93422 :                 if (!tmp.isEmpty())
    1037                 :            :                 {
    1038         [ +  - ]:      93422 :                     o << tmp;
    1039                 :            :                 } else
    1040                 :            :                     throw CannotDumpException("Unknown type '" + relType +
    1041                 :      93422 :                                               "', incomplete type library.");
    1042                 :            :             }
    1043                 :      93422 :             break;
    1044                 :            :         case RT_TYPE_STRUCT:
    1045                 :            :         case RT_TYPE_ENUM:
    1046                 :            :         case RT_TYPE_TYPEDEF:
    1047                 :            :         case RT_TYPE_EXCEPTION:
    1048                 :            :             {
    1049 [ +  - ][ +  - ]:      38294 :                 o << scopedCppName(relType);
    1050         [ +  + ]:      38294 :                 if (!args.empty()) {
    1051         [ +  - ]:        342 :                     o << "< ";
    1052 [ +  - ][ +  + ]:       1612 :                     for (std::vector< rtl::OString >::iterator i(args.begin());
    1053                 :        806 :                          i != args.end(); ++i)
    1054                 :            :                     {
    1055 [ +  - ][ +  + ]:        464 :                         if (i != args.begin()) {
    1056         [ +  - ]:        122 :                             o << ", ";
    1057                 :            :                         }
    1058         [ +  - ]:        464 :                         dumpType(o, *i);
    1059                 :            :                     }
    1060         [ +  - ]:        342 :                     o << " >";
    1061                 :            :                 }
    1062                 :      38294 :                 break;
    1063                 :            :             }
    1064                 :            :         default:
    1065                 :            :             OSL_ASSERT(false);
    1066                 :          0 :             break;
    1067                 :            :     }
    1068                 :            : 
    1069         [ +  + ]:     204814 :     {for (sal_Int32 i = 0; i < seqNum; ++i) {
    1070         [ +  - ]:       8490 :         o << " >";
    1071                 :            :     }}
    1072                 :            : 
    1073 [ +  + ][ +  - ]:     196324 :     if (bRef) o << "&";
    1074                 :     196324 : }
    1075                 :            : 
    1076                 :      18300 : void CppuType::dumpCppuGetType(FileStream& o, const OString& type, sal_Bool bDecl, CppuTypeDecl eDeclFlag)
    1077                 :            : {
    1078                 :            :     rtl::OString relType(
    1079 [ +  - ][ +  - ]:      18300 :         codemaker::UnoType::decompose(checkRealBaseType(type, true)));
    1080                 :            : 
    1081         [ -  + ]:      18300 :     if (eDeclFlag == CPPUTYPEDECL_ONLYINTERFACES)
    1082                 :            :     {
    1083 [ #  # ][ #  # ]:          0 :          if (m_typeMgr.getTypeClass(relType) == RT_TYPE_INTERFACE)
    1084                 :            :         {
    1085 [ #  # ][ #  # ]:          0 :             o << indent() << "::cppu::UnoType< ";
                 [ #  # ]
    1086         [ #  # ]:          0 :             dumpType(o, type, false, false, false, true);
    1087         [ #  # ]:          0 :             o << " >::get()";
    1088                 :            : 
    1089         [ #  # ]:          0 :             if (bDecl)
    1090         [ #  # ]:          0 :                 o << ";\n";
    1091                 :            :         }
    1092                 :            :     } else
    1093                 :            :     {
    1094 [ +  - ][ +  + ]:      18300 :         if (codemaker::UnoType::getSort(type)
    1095                 :            :             != codemaker::UnoType::SORT_COMPLEX)
    1096                 :            :         {
    1097                 :            :             return;
    1098                 :            :         } else
    1099                 :            :         {
    1100 [ -  + ][ #  # ]:      12306 :             if (eDeclFlag == CPPUTYPEDECL_NOINTERFACES &&
                 [ -  + ]
    1101         [ #  # ]:          0 :                 m_typeMgr.getTypeClass(relType) == RT_TYPE_INTERFACE)
    1102                 :            :                 return;
    1103                 :            : 
    1104                 :            : //          if (m_typeMgr.getTypeClass(type) == RT_TYPE_TYPEDEF)
    1105                 :            : //          {
    1106                 :            : //              o << indent() << "get_" << type.replace('/', '_') << "_Type()";
    1107                 :            : //          } else
    1108                 :            : //          {
    1109 [ +  - ][ +  - ]:      12306 :                 o << indent() << "::cppu::UnoType< ";
                 [ +  - ]
    1110         [ +  - ]:      12306 :                 dumpType(o, type, false, false, false, true);
    1111         [ +  - ]:      12306 :                 o << " >::get()";
    1112                 :            : //          }
    1113                 :            :         }
    1114         [ +  - ]:      12306 :         if (bDecl)
    1115         [ +  - ]:      12306 :             o << ";\n";
    1116         [ +  + ]:      18300 :     }
    1117                 :            : }
    1118                 :            : 
    1119                 :          6 : OString CppuType::typeToIdentifier(const OString& type)
    1120                 :            : {
    1121                 :            :     sal_Int32 seqNum;
    1122         [ +  - ]:          6 :     rtl::OString relType(codemaker::UnoType::decompose(type, &seqNum));
    1123                 :          6 :     OString sIdentifier;
    1124                 :            : 
    1125         [ -  + ]:          6 :     while( seqNum > 0 )
    1126                 :            :     {
    1127                 :          0 :         sIdentifier += OString("seq");
    1128                 :            : 
    1129         [ #  # ]:          0 :         if ( --seqNum == 0 )
    1130                 :            :         {
    1131                 :          0 :             sIdentifier += OString("_");
    1132                 :            :         }
    1133                 :            :     }
    1134                 :            : 
    1135                 :            :     sIdentifier += relType.replace(
    1136         [ +  - ]:          6 :         ((codemaker::UnoType::getSort(relType)
    1137                 :            :           == codemaker::UnoType::SORT_COMPLEX)
    1138                 :            :          ? '/' : ' '),
    1139         [ -  + ]:          6 :         '_');
    1140                 :            : 
    1141                 :            :     // TODO: find better solution to create an identifier
    1142                 :          6 :     sIdentifier = sIdentifier.replace('<', '_');
    1143                 :          6 :     sIdentifier = sIdentifier.replace('>', '_');
    1144                 :          6 :     sIdentifier = sIdentifier.replace(',', '_');
    1145                 :            : 
    1146                 :          6 :     return sIdentifier;
    1147                 :            : }
    1148                 :            : 
    1149                 :      29072 : bool CppuType::passByReference(rtl::OString const & unoType) {
    1150         [ +  - ]:      29072 :     rtl::OString type(resolveTypedefs(unoType));
    1151         [ +  - ]:      29072 :     switch (codemaker::UnoType::getSort(type)) {
              [ +  +  + ]
    1152                 :            :     default:
    1153                 :       9178 :         return false;
    1154                 :            : 
    1155                 :            :     case codemaker::UnoType::SORT_STRING:
    1156                 :            :     case codemaker::UnoType::SORT_TYPE:
    1157                 :            :     case codemaker::UnoType::SORT_ANY:
    1158                 :       8824 :         return true;
    1159                 :            : 
    1160                 :            :     case codemaker::UnoType::SORT_COMPLEX:
    1161         [ +  - ]:      11070 :         return m_typeMgr.getTypeClass(type) != RT_TYPE_ENUM;
    1162                 :      29072 :     }
    1163                 :            : }
    1164                 :            : 
    1165                 :      29208 : OString CppuType::resolveTypedefs(const OString& type) const
    1166                 :            : {
    1167                 :      29208 :     OString baseType(type);
    1168                 :            : 
    1169         [ +  - ]:      29208 :     RegistryKey     key;
    1170                 :            :     RTTypeClass     typeClass;
    1171         [ +  - ]:      29208 :     sal_Bool        isTypeDef = (m_typeMgr.getTypeClass(baseType) == RT_TYPE_TYPEDEF);
    1172                 :      29208 :     typereg::Reader reader;
    1173                 :            : 
    1174         [ +  + ]:      29744 :     while (isTypeDef)
    1175                 :            :     {
    1176         [ +  - ]:       1030 :         reader = m_typeMgr.getTypeReader(baseType);
    1177                 :            : 
    1178         [ +  + ]:       1030 :         if (reader.isValid())
    1179                 :            :         {
    1180                 :        536 :             typeClass = reader.getTypeClass();
    1181                 :            : 
    1182         [ +  + ]:        536 :             if (typeClass == RT_TYPE_TYPEDEF)
    1183                 :            :                 baseType = rtl::OUStringToOString(
    1184 [ +  - ][ +  - ]:        516 :                     reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    1185                 :            :             else
    1186                 :         20 :                 isTypeDef = sal_False;
    1187                 :            :         } else
    1188                 :            :         {
    1189                 :        494 :             break;
    1190                 :            :         }
    1191                 :            :     }
    1192                 :            : 
    1193         [ +  - ]:      29208 :     return baseType;
    1194                 :            : }
    1195                 :            : 
    1196                 :     242950 : OString CppuType::checkRealBaseType(const OString& type, sal_Bool bResolveTypeOnly) const
    1197                 :            : {
    1198                 :            :     sal_Int32 rank;
    1199         [ +  - ]:     242950 :     rtl::OString baseType(codemaker::UnoType::decompose(type, &rank));
    1200                 :            : 
    1201         [ +  - ]:     242950 :     RegistryKey     key;
    1202                 :            :     RTTypeClass     typeClass;
    1203         [ +  - ]:     242950 :     sal_Bool        mustBeChecked = (m_typeMgr.getTypeClass(baseType) == RT_TYPE_TYPEDEF);
    1204                 :     242950 :     typereg::Reader reader;
    1205                 :            : 
    1206         [ +  + ]:     245020 :     while (mustBeChecked)
    1207                 :            :     {
    1208         [ +  - ]:       3212 :         reader = m_typeMgr.getTypeReader(baseType);
    1209                 :            : 
    1210         [ +  + ]:       3212 :         if (reader.isValid())
    1211                 :            :         {
    1212                 :       2070 :             typeClass = reader.getTypeClass();
    1213                 :            : 
    1214         [ +  + ]:       2070 :             if (typeClass == RT_TYPE_TYPEDEF)
    1215                 :            :             {
    1216                 :            :                 sal_Int32 n;
    1217                 :            :                 baseType = codemaker::UnoType::decompose(
    1218                 :            :                     rtl::OUStringToOString(
    1219                 :            :                         reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8),
    1220 [ +  - ][ +  - ]:       1612 :                     &n);
                 [ +  - ]
    1221                 :            :                 OSL_ASSERT(n <= SAL_MAX_INT32 - rank); //TODO
    1222                 :       1612 :                 rank += n;
    1223                 :            :             } else
    1224                 :        458 :                 mustBeChecked = sal_False;
    1225                 :            :         } else
    1226                 :            :         {
    1227                 :       1142 :             break;
    1228                 :            :         }
    1229                 :            :     }
    1230                 :            : 
    1231         [ +  + ]:     242950 :     if (bResolveTypeOnly) {
    1232                 :     242880 :         rtl::OStringBuffer buf;
    1233         [ +  + ]:     255548 :         for (sal_Int32 i = 0; i < rank; ++i) {
    1234         [ +  - ]:      12668 :             buf.append(RTL_CONSTASCII_STRINGPARAM("[]"));
    1235                 :            :         }
    1236                 :     242880 :         baseType = buf.makeStringAndClear() + baseType;
    1237                 :            :     }
    1238                 :            : 
    1239         [ +  - ]:     242950 :     return baseType;
    1240                 :            : }
    1241                 :            : 
    1242                 :      30054 : void CppuType::dumpConstantValue(FileStream& o, sal_uInt16 index)
    1243                 :            : {
    1244         [ +  - ]:      30054 :     RTConstValue constValue = m_reader.getFieldValue(index);
    1245                 :            : 
    1246   [ -  -  +  +  :      30054 :     switch (constValue.m_type)
          +  +  +  +  +  
             +  -  -  - ]
    1247                 :            :     {
    1248                 :            :         case RT_TYPE_NONE:
    1249                 :          0 :             break;
    1250                 :            :         case RT_TYPE_BOOL:
    1251         [ #  # ]:          0 :             if (constValue.m_value.aBool)
    1252         [ #  # ]:          0 :                 o << "sal_True";
    1253                 :            :             else
    1254         [ #  # ]:          0 :                 o << "sal_False";
    1255                 :          0 :             break;
    1256                 :            :         case RT_TYPE_BYTE:
    1257 [ +  - ][ +  - ]:        986 :             o << "(sal_Int8)" << constValue.m_value.aByte;
    1258                 :        986 :             break;
    1259                 :            :         case RT_TYPE_INT16:
    1260 [ +  - ][ +  - ]:       8216 :             o << "(sal_Int16)" << constValue.m_value.aShort;
    1261                 :       8216 :             break;
    1262                 :            :         case RT_TYPE_UINT16:
    1263 [ +  - ][ +  - ]:          4 :             o << "(sal_uInt16)" << constValue.m_value.aUShort;
    1264                 :          4 :             break;
    1265                 :            :         case RT_TYPE_INT32:
    1266                 :            :             // Avoid C++ compiler warnings about (un)signedness of literal
    1267                 :            :             // -2^31:
    1268         [ +  + ]:      20484 :             if (constValue.m_value.aLong == SAL_MIN_INT32) {
    1269         [ +  - ]:         22 :                 o << "SAL_MIN_INT32";
    1270                 :            :             } else {
    1271 [ +  - ][ +  - ]:      20462 :                 o << "(sal_Int32)" << constValue.m_value.aLong;
    1272                 :            :             }
    1273                 :      20484 :             break;
    1274                 :            :         case RT_TYPE_UINT32:
    1275         [ +  - ]:        160 :             o << "(sal_uInt32)"
    1276                 :            :               << OString::valueOf(
    1277         [ +  - ]:        480 :                   static_cast< sal_Int64 >(constValue.m_value.aULong)).getStr()
    1278         [ +  - ]:        160 :               << "U";
    1279                 :        160 :             break;
    1280                 :            :         case RT_TYPE_INT64:
    1281                 :            :             // Avoid C++ compiler warnings about (un)signedness of literal
    1282                 :            :             // -2^63:
    1283         [ +  + ]:        120 :             if (constValue.m_value.aHyper == SAL_MIN_INT64) {
    1284         [ +  - ]:          2 :                 o << "SAL_MIN_INT64";
    1285                 :            :             } else {
    1286                 :        118 :                 ::rtl::OString tmp(OString::valueOf(constValue.m_value.aHyper));
    1287 [ +  - ][ +  - ]:        118 :                 o << "(sal_Int64) SAL_CONST_INT64(" << tmp.getStr() << ")";
                 [ +  - ]
    1288                 :            :             }
    1289                 :        120 :             break;
    1290                 :            :         case RT_TYPE_UINT64:
    1291                 :            :             {
    1292         [ +  - ]:          4 :                 o << "SAL_CONST_UINT64(";
    1293                 :          4 :                 sal_uInt64 n = constValue.m_value.aUHyper;
    1294         [ +  + ]:          4 :                 if (n == 0) {
    1295         [ +  - ]:          2 :                     o << "0";
    1296                 :            :                 } else {
    1297         [ +  - ]:          2 :                     std::vector< char > buf;
    1298         [ +  + ]:         42 :                     for (; n != 0; n /= 10) {
    1299         [ +  - ]:         40 :                         buf.push_back('0' + static_cast< char >(n % 10));
    1300                 :            :                     }
    1301   [ +  -  +  - ]:         84 :                     for (std::vector< char >::reverse_iterator i(buf.rbegin());
                 [ +  + ]
    1302                 :         42 :                          i != buf.rend(); ++i)
    1303                 :            :                     {
    1304 [ +  - ][ +  - ]:         40 :                         o << rtl::OString::valueOf(*i).getStr();
    1305                 :          2 :                     }
    1306                 :            :                 }
    1307         [ +  - ]:          4 :                 o << ")";
    1308                 :            :             }
    1309                 :          4 :             break;
    1310                 :            :         case RT_TYPE_FLOAT:
    1311                 :            :             {
    1312                 :         80 :                 ::rtl::OString tmp( OString::valueOf(constValue.m_value.aFloat) );
    1313 [ +  - ][ +  - ]:         80 :                 o << "(float)" << tmp.getStr();
    1314                 :            :             }
    1315                 :         80 :             break;
    1316                 :            :         case RT_TYPE_DOUBLE:
    1317                 :            :             {
    1318                 :          0 :                 ::rtl::OString tmp( OString::valueOf(constValue.m_value.aDouble) );
    1319 [ #  # ][ #  # ]:          0 :                 o << "(double)" << tmp.getStr();
    1320                 :            :             }
    1321                 :          0 :             break;
    1322                 :            :         case RT_TYPE_STRING:
    1323                 :            :             {
    1324                 :          0 :                 ::rtl::OUString aUStr(constValue.m_value.aString);
    1325         [ #  # ]:          0 :                 ::rtl::OString aStr = ::rtl::OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US);
    1326 [ #  # ][ #  # ]:          0 :                 o << "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" << aStr.getStr() << "\"))";
                 [ #  # ]
    1327                 :            :             }
    1328                 :          0 :             break;
    1329                 :      30054 :     }
    1330                 :      30054 : }
    1331                 :            : 
    1332                 :     135252 : void CppuType::inc(sal_Int32 num)
    1333                 :            : {
    1334                 :     135252 :     m_indentLength += num;
    1335                 :     135252 : }
    1336                 :            : 
    1337                 :     135228 : void CppuType::dec(sal_Int32 num)
    1338                 :            : {
    1339         [ +  - ]:     135228 :     m_indentLength = std::max< sal_Int32 >(m_indentLength - num, 0);
    1340                 :     135228 : }
    1341                 :            : 
    1342                 :     748174 : OString CppuType::indent() const
    1343                 :            : {
    1344                 :     748174 :     OStringBuffer tmp(m_indentLength);
    1345                 :            : 
    1346         [ +  + ]:    9100526 :     for (sal_Int32 i=0; i < m_indentLength; i++)
    1347                 :            :     {
    1348         [ +  - ]:    8352352 :         tmp.append(' ');
    1349                 :            :     }
    1350                 :     748174 :     return tmp.makeStringAndClear();
    1351                 :            : }
    1352                 :            : 
    1353                 :            : //*************************************************************************
    1354                 :            : // InterfaceType
    1355                 :            : //*************************************************************************
    1356                 :       7198 : InterfaceType::InterfaceType(typereg::Reader& typeReader,
    1357                 :            :                               const OString& typeName,
    1358                 :            :                              const TypeManager& typeMgr)
    1359                 :       7198 :     : CppuType(typeReader, typeName, typeMgr)
    1360                 :            : {
    1361                 :       7198 :     m_inheritedMemberCount = 0;
    1362                 :       7198 :     m_hasAttributes = sal_False;
    1363                 :       7198 :     m_hasMethods = sal_False;
    1364                 :       7198 : }
    1365                 :            : 
    1366                 :       7198 : InterfaceType::~InterfaceType()
    1367                 :            : {
    1368                 :            : 
    1369         [ -  + ]:       7198 : }
    1370                 :            : 
    1371                 :       7198 : sal_Bool InterfaceType::dumpHFile(
    1372                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    1373                 :            :     throw( CannotDumpException )
    1374                 :            : {
    1375         [ +  + ]:       7198 :     if (m_reader.getMethodCount() != 0) {
    1376         [ +  - ]:       6682 :         includes.add("com/sun/star/uno/RuntimeException");
    1377                 :            :     }
    1378                 :       7198 :     dumpHFileContent(o, includes);
    1379                 :       7198 :     return sal_True;
    1380                 :            : }
    1381                 :            : 
    1382                 :       7198 : void InterfaceType::dumpDeclaration(FileStream& o)
    1383                 :            :     throw( CannotDumpException )
    1384                 :            : {
    1385                 :            : //     rtl::OString cppName(translateUnoToCppIdentifier(
    1386                 :            : //                              m_name, "interface", ITM_KEYWORDSONLY, &m_name));
    1387                 :            : 
    1388                 :            : //  o << "\nclass SAL_NO_VTABLE " << cppName;
    1389                 :       7198 :     o << "\nclass SAL_NO_VTABLE " << m_name;
    1390                 :            : 
    1391         [ +  + ]:      14954 :     for (sal_Int16 i = 0; i < m_reader.getSuperTypeCount(); ++i) {
    1392 [ +  + ][ +  - ]:       7756 :         o << (i == 0 ? " :" : ",") << " public "
                 [ +  - ]
    1393                 :            :           << scopedCppName(rtl::OUStringToOString(
    1394 [ +  - ][ +  - ]:      15512 :                             m_reader.getSuperTypeName(i), RTL_TEXTENCODING_UTF8));
                 [ +  - ]
    1395                 :            :     }
    1396                 :            : 
    1397                 :       7198 :     o << "\n{\npublic:\n";
    1398                 :            : 
    1399                 :       7198 :     inc();
    1400                 :            : 
    1401                 :       7198 :     dumpAttributes(o);
    1402                 :       7198 :     dumpMethods(o);
    1403                 :            : 
    1404 [ +  - ][ +  - ]:      14396 :     o << "\n" << indent()
    1405                 :            :       << ("static inline ::com::sun::star::uno::Type const & SAL_CALL"
    1406         [ +  - ]:       7198 :           " static_type(void * = 0);\n\n");
    1407                 :       7198 :     dec();
    1408                 :       7198 :     o << "protected:\n";
    1409                 :       7198 :     inc();
    1410 [ +  - ][ +  - ]:      14396 :     o << indent() << "~" << m_name
                 [ +  - ]
    1411                 :            :       << ("() throw () {} // avoid warnings about virtual members and"
    1412         [ +  - ]:       7198 :           " non-virtual dtor\n");
    1413                 :       7198 :     dec();
    1414                 :       7198 :     o << "};\n\n";
    1415                 :       7198 : }
    1416                 :            : 
    1417                 :       7198 : sal_Bool InterfaceType::dumpHxxFile(
    1418                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    1419                 :            :     throw( CannotDumpException )
    1420                 :            : {
    1421         [ +  - ]:       7198 :     OString headerDefine(dumpHeaderDefine(o, "HPP"));
    1422         [ +  - ]:       7198 :     o << "\n";
    1423                 :            : 
    1424         [ +  - ]:       7198 :     addDefaultHxxIncludes(includes);
    1425         [ +  - ]:       7198 :     includes.dump(o, &m_typeName);
    1426         [ +  - ]:       7198 :     o << "\n";
    1427                 :            : 
    1428         [ +  - ]:       7198 :     dumpGetCppuType(o);
    1429                 :            : 
    1430                 :            : //     rtl::OString cppName(translateUnoToCppIdentifier(
    1431                 :            : //                              m_name, "interface", ITM_KEYWORDSONLY, &m_name));
    1432                 :            : 
    1433         [ +  - ]:       7198 :     o << "\n::com::sun::star::uno::Type const & "
    1434 [ +  - ][ +  - ]:      21594 :       << scopedCppName(m_typeName)
    1435         [ +  - ]:       7198 :       << "::static_type(SAL_UNUSED_PARAMETER void *) {\n";
    1436                 :       7198 :     inc();
    1437 [ +  - ][ +  - ]:       7198 :     o << indent() << "return ::getCppuType(static_cast< ";
                 [ +  - ]
    1438         [ +  - ]:       7198 :     dumpType(o, m_typeName);
    1439         [ +  - ]:       7198 :     o << " * >(0));\n";
    1440         [ +  - ]:       7198 :     dec();
    1441         [ +  - ]:       7198 :     o << "}\n";
    1442                 :            : 
    1443 [ +  - ][ +  - ]:       7198 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    1444                 :       7198 :     return sal_True;
    1445                 :            : }
    1446                 :            : 
    1447                 :       7198 : void InterfaceType::dumpAttributes(FileStream& o)
    1448                 :            : {
    1449                 :       7198 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
    1450                 :       7198 :     sal_Bool first=sal_True;
    1451                 :            : 
    1452                 :       7198 :     RTFieldAccess access = RT_ACCESS_INVALID;
    1453                 :       7198 :     OString fieldName;
    1454                 :       7198 :     OString fieldType;
    1455         [ +  + ]:      10580 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    1456                 :            :     {
    1457                 :       3382 :         access = m_reader.getFieldFlags(i);
    1458                 :            : 
    1459 [ -  + ][ +  - ]:       3382 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    1460                 :          0 :             continue;
    1461                 :            : 
    1462         [ +  - ]:       3382 :         rtl::OUString name(m_reader.getFieldName(i));
    1463         [ +  - ]:       3382 :         fieldName = rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8);
    1464                 :            :         fieldType = rtl::OUStringToOString(
    1465 [ +  - ][ +  - ]:       3382 :             m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    1466                 :            : 
    1467         [ +  + ]:       3382 :         if (first)
    1468                 :            :         {
    1469                 :        666 :             first = sal_False;
    1470 [ +  - ][ +  - ]:        666 :             o << "\n" << indent() << "// Attributes\n";
         [ +  - ][ +  - ]
    1471                 :            :         }
    1472                 :            : 
    1473 [ +  - ][ +  - ]:       3382 :         o << indent() << "virtual ";
                 [ +  - ]
    1474         [ +  - ]:       3382 :         dumpType(o, fieldType);
    1475 [ +  - ][ +  - ]:       3382 :         o << " SAL_CALL get" << fieldName << "()";
                 [ +  - ]
    1476         [ +  - ]:       3382 :         dumpAttributeExceptionSpecification(o, name, RT_MODE_ATTRIBUTE_GET);
    1477         [ +  - ]:       3382 :         o << " = 0;\n";
    1478                 :            : 
    1479         [ +  + ]:       3382 :         if ((access & RT_ACCESS_READONLY) == 0)
    1480                 :            :         {
    1481         [ +  - ]:       2578 :             bool byRef = passByReference(fieldType);
    1482 [ +  - ][ +  - ]:       2578 :             o << indent() << "virtual void SAL_CALL set" << fieldName << "( ";
         [ +  - ][ +  - ]
                 [ +  - ]
    1483         [ +  - ]:       2578 :             dumpType(o, fieldType, byRef, byRef);
    1484 [ +  - ][ +  - ]:       2578 :             o << " _" << fieldName.toAsciiLowerCase() << " )";
                 [ +  - ]
    1485         [ +  - ]:       2578 :             dumpAttributeExceptionSpecification(o, name, RT_MODE_ATTRIBUTE_SET);
    1486         [ +  - ]:       2578 :             o << " = 0;\n";
    1487                 :            :         }
    1488                 :      10580 :     }
    1489                 :       7198 : }
    1490                 :            : 
    1491                 :       7198 : void InterfaceType::dumpMethods(FileStream& o)
    1492                 :            : {
    1493                 :       7198 :     sal_uInt16 methodCount = m_reader.getMethodCount();
    1494                 :       7198 :     sal_Bool first=sal_True;
    1495                 :            : 
    1496                 :       7198 :     OString methodName, returnType, paramType, paramName;
    1497                 :       7198 :     sal_uInt16 paramCount = 0;
    1498                 :       7198 :     RTMethodMode methodMode = RT_MODE_INVALID;
    1499                 :       7198 :     RTParamMode  paramMode = RT_PARAM_INVALID;
    1500                 :            : 
    1501                 :       7198 :     sal_Bool bRef = sal_False;
    1502                 :       7198 :     sal_Bool bConst = sal_False;
    1503                 :       7198 :     sal_Bool bWithRunTimeExcp = sal_True;
    1504                 :            : 
    1505         [ +  + ]:      32550 :     for (sal_uInt16 i=0; i < methodCount; i++)
    1506                 :            :     {
    1507                 :      25352 :         methodMode = m_reader.getMethodFlags(i);
    1508 [ +  + ][ +  + ]:      25352 :         if (methodMode == RT_MODE_ATTRIBUTE_GET
    1509                 :            :             || methodMode == RT_MODE_ATTRIBUTE_SET)
    1510                 :            :         {
    1511                 :        762 :             continue;
    1512                 :            :         }
    1513                 :            : 
    1514                 :            :         methodName = rtl::OUStringToOString(
    1515 [ +  - ][ +  - ]:      24590 :             m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8);
    1516                 :            :         returnType = rtl::OUStringToOString(
    1517 [ +  - ][ +  - ]:      24590 :             m_reader.getMethodReturnTypeName(i), RTL_TEXTENCODING_UTF8);
    1518                 :      24590 :         paramCount = m_reader.getMethodParameterCount(i);
    1519                 :            : 
    1520 [ +  + ][ +  + ]:      24590 :         if ( methodName.equals("acquire") || methodName.equals("release") )
         [ +  + ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
    1521                 :            :         {
    1522                 :         16 :             bWithRunTimeExcp = sal_False;
    1523                 :            :         }
    1524                 :            : 
    1525         [ +  + ]:      24590 :         if (first)
    1526                 :            :         {
    1527                 :       6646 :             first = sal_False;
    1528 [ +  - ][ +  - ]:       6646 :             o << "\n" << indent() << "// Methods\n";
         [ +  - ][ +  - ]
    1529                 :            :         }
    1530                 :            : 
    1531 [ +  - ][ +  - ]:      24590 :         o << indent() << "virtual ";
                 [ +  - ]
    1532         [ +  - ]:      24590 :         dumpType(o, returnType);
    1533 [ +  - ][ +  - ]:      24590 :         o << " SAL_CALL " << methodName << "( ";
                 [ +  - ]
    1534         [ +  + ]:      50742 :         for (sal_uInt16 j=0; j < paramCount; j++)
    1535                 :            :         {
    1536                 :            :             paramName = rtl::OUStringToOString(
    1537 [ +  - ][ +  - ]:      26152 :                 m_reader.getMethodParameterName(i, j), RTL_TEXTENCODING_UTF8);
    1538                 :            :             paramType = rtl::OUStringToOString(
    1539                 :            :                 m_reader.getMethodParameterTypeName(i, j),
    1540 [ +  - ][ +  - ]:      26152 :                 RTL_TEXTENCODING_UTF8);
    1541                 :      26152 :             paramMode = m_reader.getMethodParameterFlags(i, j);
    1542                 :            : 
    1543      [ +  +  - ]:      26152 :             switch (paramMode)
    1544                 :            :             {
    1545                 :            :                 case RT_PARAM_IN:
    1546         [ +  - ]:      25408 :                     bConst = passByReference(paramType);
    1547                 :      25408 :                     bRef = bConst;
    1548                 :      25408 :                     break;
    1549                 :            :                 case RT_PARAM_OUT:
    1550                 :            :                 case RT_PARAM_INOUT:
    1551                 :        744 :                     bConst = sal_False;
    1552                 :        744 :                     bRef = sal_True;
    1553                 :        744 :                     break;
    1554                 :            :                 default:
    1555                 :          0 :                     break;
    1556                 :            :             }
    1557                 :            : 
    1558         [ +  - ]:      26152 :             dumpType(o, paramType, bConst, bRef);
    1559                 :            : //          o << " " << translateUnoToCppIdentifier(
    1560                 :            : //                 paramName, "param", ITM_KEYWORDSONLY, NULL);
    1561 [ +  - ][ +  - ]:      26152 :             o << " " << paramName;
    1562                 :            : 
    1563 [ +  + ][ +  - ]:      26152 :             if (j+1 < (sal_uInt16)paramCount) o << ", ";
    1564                 :            :         }
    1565         [ +  - ]:      24590 :         o << " )";
    1566         [ +  - ]:      24590 :         dumpExceptionSpecification(o, i, bWithRunTimeExcp);
    1567         [ +  - ]:      24590 :         o << " = 0;\n";
    1568                 :       7198 :     }
    1569                 :       7198 : }
    1570                 :            : 
    1571                 :         50 : void InterfaceType::dumpNormalGetCppuType(FileStream& o)
    1572                 :            : {
    1573                 :         50 :     dumpGetCppuTypePreamble(o);
    1574                 :            : 
    1575         [ +  - ]:        100 :     o << indent()
    1576         [ +  - ]:         50 :       << "static typelib_TypeDescriptionReference * the_type = 0;\n";
    1577                 :            : 
    1578 [ +  - ][ +  - ]:         50 :     o << indent() << "if ( !the_type )\n" << indent() << "{\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    1579                 :         50 :     inc();
    1580                 :         50 :     sal_Int16 nBases = m_reader.getSuperTypeCount();
    1581                 :            :     OSL_ASSERT(nBases > 0);
    1582 [ +  - ][ +  + ]:         50 :     if (nBases == 1 && m_reader.getSuperTypeName(0) == "com/sun/star/uno/XInterface" )
                 [ +  - ]
           [ +  +  #  # ]
                 [ +  - ]
    1583                 :            :     {
    1584                 :         24 :         nBases = 0;
    1585                 :            :     }
    1586         [ +  + ]:         50 :     if (nBases > 0) {
    1587 [ +  - ][ +  - ]:         52 :         o << indent() << "typelib_TypeDescriptionReference * aSuperTypes["
    1588 [ +  - ][ +  - ]:         26 :           << nBases << "];\n";
    1589         [ +  + ]:         52 :         for (sal_Int16 i = 0; i < nBases; ++i) {
    1590 [ +  - ][ +  - ]:         26 :             o << indent() << "aSuperTypes[" << i << "] = ::cppu::UnoType< ";
         [ +  - ][ +  - ]
    1591                 :            :             dumpType(
    1592                 :            :                 o,
    1593                 :            :                 rtl::OUStringToOString(
    1594                 :            :                     m_reader.getSuperTypeName(i), RTL_TEXTENCODING_UTF8),
    1595 [ +  - ][ +  - ]:         26 :                 true, false, false, true);
    1596                 :         26 :             o << " >::get().getTypeLibType();\n";
    1597                 :            :         }
    1598                 :            :     }
    1599                 :            : 
    1600 [ +  - ][ +  - ]:        100 :     o << indent() << "typelib_static_mi_interface_type_init( &the_type, \""
                 [ +  - ]
    1601 [ +  - ][ +  - ]:        150 :       << m_typeName.replace('/', '.') << "\", " << nBases << ", ";
         [ +  - ][ +  - ]
    1602                 :            : 
    1603         [ +  + ]:         50 :     if ( nBases > 0 )
    1604                 :            :     {
    1605                 :         26 :         o << "aSuperTypes );\n";
    1606                 :            :     } else
    1607                 :            :     {
    1608                 :         24 :         o << "0 );\n";
    1609                 :            :     }
    1610                 :            : 
    1611                 :         50 :     dec();
    1612 [ +  - ][ +  - ]:         50 :     o << indent() << "}\n";
    1613         [ +  - ]:        100 :     o << indent()
    1614                 :            :       << ("return * reinterpret_cast< ::com::sun::star::uno::Type * >("
    1615         [ +  - ]:         50 :           " &the_type );\n");
    1616                 :            : 
    1617                 :         50 :     dumpGetCppuTypePostamble(o);
    1618                 :         50 : }
    1619                 :            : 
    1620                 :       3506 : void InterfaceType::dumpComprehensiveGetCppuType(FileStream& o)
    1621                 :            : {
    1622 [ +  - ][ +  - ]:       3506 :     if (!isPolymorphic())
    1623         [ +  - ]:       3506 :         codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false);
    1624                 :            :     else
    1625         [ #  # ]:          0 :         o << "namespace cppu { ";
    1626         [ +  - ]:       3506 :     o << " namespace detail {\n\n";
    1627                 :            : 
    1628                 :       3506 :     OString sType = m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
    1629                 :       3506 :     OString sStaticTypeClass = "the" + sType + "Type";
    1630 [ +  - ][ +  - ]:       3506 :     o << indent() << "struct " << sStaticTypeClass << " : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, " << sStaticTypeClass << " >\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1631 [ +  - ][ +  - ]:       3506 :     o << indent() << "{\n";
                 [ +  - ]
    1632                 :       3506 :     inc();
    1633 [ +  - ][ +  - ]:       3506 :     o << indent() << "::com::sun::star::uno::Type * operator()() const\n";
                 [ +  - ]
    1634 [ +  - ][ +  - ]:       3506 :     o << indent() << "{\n";
                 [ +  - ]
    1635                 :            : 
    1636                 :       3506 :     inc();
    1637 [ +  - ][ +  - ]:       7012 :     o << indent() << "::rtl::OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM(\""
                 [ +  - ]
    1638 [ +  - ][ +  - ]:      10518 :       << m_typeName.replace('/', '.') << "\") );\n\n";
    1639                 :            : 
    1640 [ +  - ][ +  - ]:       7012 :     o << indent() << "// Start inline typedescription generation\n"
                 [ +  - ]
    1641 [ +  - ][ +  - ]:      10518 :       << indent() << "typelib_InterfaceTypeDescription * pTD = 0;\n\n";
                 [ +  - ]
    1642                 :            : 
    1643                 :            :     OSL_ASSERT(m_reader.getSuperTypeCount() > 0);
    1644 [ +  - ][ +  - ]:       7012 :     o << indent() << "typelib_TypeDescriptionReference * aSuperTypes["
                 [ +  - ]
    1645 [ +  - ][ +  - ]:       7012 :       << m_reader.getSuperTypeCount() << "];\n";
    1646         [ +  + ]:       7270 :     for (sal_Int16 i = 0; i < m_reader.getSuperTypeCount(); ++i) {
    1647 [ +  - ][ +  - ]:       3764 :         o << indent() << "aSuperTypes[" << i << "] = ::cppu::UnoType< ";
         [ +  - ][ +  - ]
                 [ +  - ]
    1648                 :            :         dumpType(
    1649                 :            :             o,
    1650                 :            :             rtl::OUStringToOString(
    1651                 :            :                 m_reader.getSuperTypeName(i), RTL_TEXTENCODING_UTF8),
    1652 [ +  - ][ +  - ]:       3764 :             false, false, false, true);
                 [ +  - ]
    1653         [ +  - ]:       3764 :         o << " >::get().getTypeLibType();\n";
    1654                 :            :     }
    1655                 :            : 
    1656         [ +  - ]:       3506 :     sal_uInt32 count = getMemberCount();
    1657         [ +  + ]:       3506 :     if (count)
    1658                 :            :     {
    1659 [ +  - ][ +  - ]:       6808 :         o << indent() << "typelib_TypeDescriptionReference * pMembers[" << count
         [ +  - ][ +  - ]
    1660         [ +  - ]:       3404 :           << "] = { ";
    1661         [ +  + ]:      16682 :         for (sal_uInt32 i = 0; i < count; i++)
    1662                 :            :         {
    1663         [ +  - ]:      13278 :             o << "0";
    1664         [ +  + ]:      13278 :             if (i+1 < count) {
    1665         [ +  - ]:       9874 :                 o << ",";
    1666                 :            :             } else {
    1667         [ +  - ]:       3404 :                 o << " };\n";
    1668                 :            :             }
    1669                 :            :         }
    1670                 :            : 
    1671                 :       3404 :         sal_uInt32 index = 0;
    1672         [ +  - ]:       3404 :         dumpCppuAttributeRefs(o, index);
    1673         [ +  - ]:       3404 :         dumpCppuMethodRefs(o, index);
    1674                 :            :     }
    1675                 :            : 
    1676 [ +  - ][ +  - ]:       3506 :     o << "\n" << indent() << "typelib_typedescription_newMIInterface(\n";
         [ +  - ][ +  - ]
    1677                 :       3506 :     inc();
    1678 [ +  - ][ +  - ]:       3506 :     o << indent() << "&pTD,\n" << indent() << "sTypeName.pData, ";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1679                 :            : 
    1680         [ +  - ]:       3506 :     o << "0x00000000, 0x0000, 0x0000, 0x00000000, 0x00000000,\n"; // UIK
    1681                 :            : 
    1682 [ +  - ][ +  - ]:       3506 :     o << indent() << m_reader.getSuperTypeCount() << ", aSuperTypes,\n";
         [ +  - ][ +  - ]
    1683                 :            : 
    1684         [ +  + ]:       3506 :     if ( count ) {
    1685 [ +  - ][ +  - ]:       3404 :         o << indent() << count << ",\n" << indent() << "pMembers );\n\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1686                 :            :     } else {
    1687 [ +  - ][ +  - ]:        102 :         o << indent() << count << ",\n" << indent() << "0 );\n\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1688                 :            :     }
    1689         [ +  - ]:       3506 :     dec();
    1690                 :            : 
    1691 [ +  - ][ +  - ]:       7012 :     o << indent()
    1692                 :            :       << ("typelib_typedescription_register( (typelib_TypeDescription**)&pTD"
    1693         [ +  - ]:       3506 :           " );\n");
    1694         [ +  + ]:       3506 :     if ( count )
    1695                 :            :     {
    1696         [ +  + ]:      16682 :         for (sal_uInt16 i=0; i < count; i++)
    1697                 :            :         {
    1698 [ +  - ][ +  - ]:      26556 :             o << indent()
    1699 [ +  - ][ +  - ]:      13278 :               << "typelib_typedescriptionreference_release( pMembers[" << i
    1700         [ +  - ]:      13278 :               << "] );\n";
    1701                 :            :         }
    1702                 :            :     }
    1703 [ +  - ][ +  - ]:       7012 :     o << indent()
    1704                 :            :       << ("typelib_typedescription_release( (typelib_TypeDescription*)pTD"
    1705         [ +  - ]:       3506 :           " );\n\n");
    1706                 :            : 
    1707 [ +  - ][ +  - ]:       7012 :     o << indent() << "return new ::com::sun::star::uno::Type( "
                 [ +  - ]
    1708 [ +  - ][ +  - ]:      10518 :       << getTypeClass(m_typeName) << ", sTypeName ); // leaked\n";
                 [ +  - ]
    1709                 :            : 
    1710         [ +  - ]:       3506 :     dec();
    1711                 :            : 
    1712 [ +  - ][ +  - ]:       3506 :     o << indent() << "}\n";
                 [ +  - ]
    1713         [ +  - ]:       3506 :     dec();
    1714 [ +  - ][ +  - ]:       3506 :     o << indent() << "};\n\n";
                 [ +  - ]
    1715                 :            : 
    1716 [ +  - ][ +  - ]:       3506 :     if (!isPolymorphic())
    1717         [ +  - ]:       3506 :         codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false);
    1718                 :            :     else
    1719         [ #  # ]:          0 :         o << " }";
    1720         [ +  - ]:       3506 :     o << " }\n\n";
    1721                 :            : 
    1722         [ +  - ]:       3506 :     dumpGetCppuTypePreamble(o);
    1723 [ +  - ][ +  - ]:       3506 :     o  << indent() << "const ::com::sun::star::uno::Type &rRet = *detail::" << sStaticTypeClass << "::get();\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    1724                 :            : 
    1725 [ +  - ][ +  - ]:       3506 :     o << indent() << "// End inline typedescription generation\n";
                 [ +  - ]
    1726                 :            : 
    1727 [ +  - ][ +  - ]:       3506 :     o  << indent() << "static bool bInitStarted = false;\n";
                 [ +  - ]
    1728 [ +  - ][ +  - ]:       3506 :     o  << indent() << "if (!bInitStarted)\n";
                 [ +  - ]
    1729 [ +  - ][ +  - ]:       3506 :     o  << indent() << "{\n";
                 [ +  - ]
    1730                 :       3506 :     inc();
    1731 [ +  - ][ +  - ]:       3506 :     o  << indent() << "::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );\n";
                 [ +  - ]
    1732 [ +  - ][ +  - ]:       3506 :     o  << indent() << "if (!bInitStarted)\n";
                 [ +  - ]
    1733 [ +  - ][ +  - ]:       3506 :     o  << indent() << "{\n";
                 [ +  - ]
    1734                 :       3506 :     inc();
    1735 [ +  - ][ +  - ]:       3506 :     o  << indent() << "OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();\n";
                 [ +  - ]
    1736 [ +  - ][ +  - ]:       3506 :     o  << indent() << "bInitStarted = true;\n";
                 [ +  - ]
    1737                 :            : 
    1738         [ +  - ]:       3506 :     StringSet   aTypes;
    1739                 :            :     // type for RuntimeException is always needed
    1740                 :       3506 :     OString     sRunTimeExceptionType("com/sun/star/uno/RuntimeException");
    1741         [ +  - ]:       3506 :     aTypes.insert(sRunTimeExceptionType);
    1742         [ +  - ]:       3506 :     dumpCppuGetType(o, sRunTimeExceptionType, sal_True, CPPUTYPEDECL_ALLTYPES);
    1743                 :            : 
    1744         [ +  - ]:       3506 :     dumpAttributesCppuDecl(o, &aTypes, CPPUTYPEDECL_ALLTYPES);
    1745         [ +  - ]:       3506 :     dumpMethodsCppuDecl(o, &aTypes, CPPUTYPEDECL_ALLTYPES);
    1746                 :            : 
    1747         [ +  + ]:       3506 :     if (count)
    1748                 :            :     {
    1749         [ +  - ]:       3404 :         sal_uInt32 index = getInheritedMemberCount();
    1750         [ +  - ]:       3404 :         dumpCppuAttributes(o, index);
    1751         [ +  - ]:       3404 :         dumpCppuMethods(o, index);
    1752                 :            :     }
    1753                 :            : 
    1754         [ +  - ]:       3506 :     dec();
    1755 [ +  - ][ +  - ]:       3506 :     o  << indent() << "}\n";
                 [ +  - ]
    1756         [ +  - ]:       3506 :     dec();
    1757 [ +  - ][ +  - ]:       3506 :     o  << indent() << "}\n";
                 [ +  - ]
    1758 [ +  - ][ +  - ]:       3506 :     o  << indent() << "else\n";
                 [ +  - ]
    1759 [ +  - ][ +  - ]:       3506 :     o  << indent() << "{\n";
                 [ +  - ]
    1760                 :       3506 :     inc();
    1761 [ +  - ][ +  - ]:       3506 :     o  << indent() << "OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();\n";
                 [ +  - ]
    1762         [ +  - ]:       3506 :     dec();
    1763 [ +  - ][ +  - ]:       3506 :     o  << indent() << "}\n";
                 [ +  - ]
    1764                 :            : 
    1765 [ +  - ][ +  - ]:       3506 :     o  << indent() << "return rRet;\n";
                 [ +  - ]
    1766         [ +  - ]:       3506 :     dumpGetCppuTypePostamble(o);
    1767                 :       3506 : }
    1768                 :            : 
    1769                 :       3404 : void InterfaceType::dumpCppuAttributeRefs(FileStream& o, sal_uInt32& index)
    1770                 :            : {
    1771                 :       3404 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
    1772                 :            : 
    1773                 :       3404 :     RTFieldAccess access = RT_ACCESS_INVALID;
    1774                 :       3404 :     OString fieldName;
    1775                 :       3404 :     OString scope = m_typeName.replace('/', '.');
    1776                 :            : 
    1777         [ +  + ]:       4510 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    1778                 :            :     {
    1779                 :       1106 :         access = m_reader.getFieldFlags(i);
    1780                 :            : 
    1781 [ -  + ][ +  - ]:       1106 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    1782                 :          0 :             continue;
    1783                 :            : 
    1784                 :            :         fieldName = rtl::OUStringToOString(
    1785 [ +  - ][ +  - ]:       1106 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    1786                 :            : 
    1787 [ +  - ][ +  - ]:       2212 :         o << indent() << "::rtl::OUString sAttributeName" << i << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    1788 [ +  - ][ +  - ]:       3318 :           << scope.replace('/', '.') << "::" << fieldName << "\") );\n";
         [ +  - ][ +  - ]
    1789 [ +  - ][ +  - ]:       2212 :         o << indent() << "typelib_typedescriptionreference_new( &pMembers["
                 [ +  - ]
    1790 [ +  - ][ +  - ]:       1106 :           << index << "],\n";
    1791                 :       1106 :         inc(38);
    1792 [ +  - ][ +  - ]:       2212 :         o << indent() << "(typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_ATTRIBUTE,\n"
                 [ +  - ]
    1793 [ +  - ][ +  - ]:       3318 :           << indent() << "sAttributeName" << i << ".pData );\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    1794         [ +  - ]:       1106 :         dec(38);
    1795                 :       1106 :         index++;
    1796                 :       3404 :     }
    1797                 :       3404 : }
    1798                 :            : 
    1799                 :       3404 : void InterfaceType::dumpCppuMethodRefs(FileStream& o, sal_uInt32& index)
    1800                 :            : {
    1801                 :       3404 :     sal_uInt16  methodCount = m_reader.getMethodCount();
    1802                 :       3404 :     OString     methodName;
    1803                 :       3404 :     OString     scope = m_typeName.replace('/', '.');
    1804                 :            : 
    1805         [ +  + ]:      15958 :     for (sal_uInt16 i = 0; i < methodCount; i++)
    1806                 :            :     {
    1807                 :      12554 :         RTMethodMode flags = m_reader.getMethodFlags(i);
    1808 [ +  + ][ +  + ]:      12554 :         if (flags == RT_MODE_ATTRIBUTE_GET || flags == RT_MODE_ATTRIBUTE_SET) {
    1809                 :        382 :             continue;
    1810                 :            :         }
    1811                 :            : 
    1812                 :            :         methodName = rtl::OUStringToOString(
    1813 [ +  - ][ +  - ]:      12172 :             m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8);
    1814                 :            : 
    1815 [ +  - ][ +  - ]:      24344 :         o << indent() << "::rtl::OUString sMethodName" << i << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    1816 [ +  - ][ +  - ]:      36516 :           << scope.replace('/', '.') << "::" << methodName << "\") );\n";
         [ +  - ][ +  - ]
    1817 [ +  - ][ +  - ]:      24344 :         o << indent() << "typelib_typedescriptionreference_new( &pMembers["
                 [ +  - ]
    1818 [ +  - ][ +  - ]:      12172 :           << index << "],\n";
    1819                 :      12172 :         inc(38);
    1820 [ +  - ][ +  - ]:      24344 :         o << indent() << "(typelib_TypeClass)::com::sun::star::uno::TypeClass_INTERFACE_METHOD,\n"
                 [ +  - ]
    1821 [ +  - ][ +  - ]:      36516 :           << indent() << "sMethodName" << i << ".pData );\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    1822         [ +  - ]:      12172 :         dec(38);
    1823                 :      12172 :         index++;
    1824                 :       3404 :     }
    1825                 :       3404 : }
    1826                 :            : 
    1827                 :       3506 : sal_uInt32 InterfaceType::getMemberCount() {
    1828                 :       3506 :     sal_uInt16 count = 0;
    1829                 :       3506 :     sal_uInt16 methodCount = m_reader.getMethodCount();
    1830         [ +  + ]:      16060 :     {for (sal_uInt16 i = 0; i < methodCount; ++i) {
    1831                 :      12554 :         RTMethodMode flags = m_reader.getMethodFlags(i);
    1832 [ +  + ][ +  + ]:      12554 :         if (flags != RT_MODE_ATTRIBUTE_GET && flags != RT_MODE_ATTRIBUTE_SET) {
    1833                 :      12172 :             m_hasMethods = true;
    1834                 :      12172 :             ++count;
    1835                 :            :         }
    1836                 :            :     }}
    1837                 :       3506 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
    1838         [ +  + ]:       4612 :     {for (sal_uInt16 i = 0; i < fieldCount; ++i) {
    1839                 :       1106 :         RTFieldAccess flags = m_reader.getFieldFlags(i);
    1840 [ +  - ][ +  - ]:       1106 :         if (flags != RT_ACCESS_CONST && flags != RT_ACCESS_INVALID) {
    1841                 :       1106 :             m_hasAttributes = true;
    1842                 :       1106 :             ++count;
    1843                 :            :         }
    1844                 :            :     }}
    1845                 :       3506 :     return count;
    1846                 :            : }
    1847                 :            : 
    1848                 :            : namespace {
    1849                 :            : 
    1850                 :       3404 : class BaseOffset {
    1851                 :            : public:
    1852                 :            :     BaseOffset(TypeManager const & theManager, typereg::Reader const & reader);
    1853                 :            : 
    1854                 :       3404 :     sal_Int32 get() const { return offset; }
    1855                 :            : 
    1856                 :            : private:
    1857                 :            :     void calculateBases(typereg::Reader const & reader);
    1858                 :            : 
    1859                 :            :     void calculate(typereg::Reader const & reader);
    1860                 :            : 
    1861                 :            :     TypeManager const & manager;
    1862                 :            :     std::set< rtl::OString > set;
    1863                 :            :     sal_Int32 offset;
    1864                 :            : };
    1865                 :            : 
    1866                 :       3404 : BaseOffset::BaseOffset(
    1867                 :            :     TypeManager const & theManager, typereg::Reader const & reader):
    1868                 :       3404 :     manager(theManager)
    1869                 :            : {
    1870                 :       3404 :     offset = 0;
    1871         [ +  - ]:       3404 :     calculateBases(reader);
    1872                 :       3404 : }
    1873                 :            : 
    1874                 :       8722 : void BaseOffset::calculateBases(typereg::Reader const & reader) {
    1875         [ +  + ]:      14336 :     for (sal_Int16 i = 0; i < reader.getSuperTypeCount(); ++i) {
    1876                 :            :         typereg::Reader super(
    1877                 :            :             manager.getTypeReader(
    1878                 :            :                 rtl::OUStringToOString(
    1879 [ +  - ][ +  - ]:       5614 :                     reader.getSuperTypeName(i), RTL_TEXTENCODING_UTF8)));
                 [ +  - ]
    1880         [ +  - ]:       5614 :         if (super.isValid()) {
    1881         [ +  - ]:       5614 :             calculate(super);
    1882                 :            :         }
    1883                 :       5614 :     }
    1884                 :       8722 : }
    1885                 :            : 
    1886                 :       5614 : void BaseOffset::calculate(typereg::Reader const & reader) {
    1887 [ +  - ][ +  - ]:       5614 :     if (set.insert(
                 [ +  + ]
    1888                 :            :             rtl::OUStringToOString(reader.getTypeName(), RTL_TEXTENCODING_UTF8))
    1889                 :            :         .second)
    1890                 :            :     {
    1891                 :       5318 :         calculateBases(reader);
    1892         [ +  + ]:      23810 :         {for (sal_uInt16 i = 0; i < reader.getMethodCount(); ++i) {
    1893                 :      18492 :             RTMethodMode flags = reader.getMethodFlags(i);
    1894 [ +  + ][ +  + ]:      18492 :             if (flags != RT_MODE_ATTRIBUTE_GET
    1895                 :            :                 && flags != RT_MODE_ATTRIBUTE_SET)
    1896                 :            :             {
    1897                 :      16564 :                 ++offset;
    1898                 :            :             }
    1899                 :            :         }}
    1900         [ +  + ]:       6898 :         {for (sal_uInt16 i = 0; i < reader.getFieldCount(); ++i) {
    1901                 :       1580 :             RTFieldAccess flags = reader.getFieldFlags(i);
    1902 [ +  - ][ +  - ]:       1580 :             if (flags != RT_ACCESS_CONST && flags != RT_ACCESS_INVALID) {
    1903                 :       1580 :                 ++offset;
    1904                 :            :             }
    1905                 :            :         }}
    1906                 :            :     }
    1907                 :       5614 : }
    1908                 :            : 
    1909                 :            : }
    1910                 :            : 
    1911                 :       7198 : void InterfaceType::addSpecialDependencies() {
    1912 [ +  + ][ +  + ]:       7198 :     if (m_reader.getMethodCount() > 0 || m_reader.getFieldCount() > 0) {
                 [ +  + ]
    1913         [ +  - ]:       6928 :         m_dependencies.add("com/sun/star/uno/RuntimeException");
    1914                 :            :     }
    1915                 :       7198 : }
    1916                 :            : 
    1917                 :       3506 : void InterfaceType::addComprehensiveGetCppuTypeIncludes(
    1918                 :            :     codemaker::cppumaker::Includes & includes) const
    1919                 :            : {
    1920                 :            :     // The comprehensive getCppuType method always includes a line
    1921                 :            :     // "getCppuType( (const ::com::sun::star::uno::RuntimeException*)0 );":
    1922                 :       3506 :     includes.addCppuUnotypeHxx();
    1923         [ +  - ]:       3506 :     includes.add("com/sun/star/uno/RuntimeException");
    1924                 :       3506 : }
    1925                 :            : 
    1926                 :       3404 : sal_uInt32 InterfaceType::checkInheritedMemberCount(const typereg::Reader*)
    1927                 :            : {
    1928                 :       3404 :     return BaseOffset(m_typeMgr, m_reader).get();
    1929                 :            : }
    1930                 :            : 
    1931                 :       3404 : sal_uInt32 InterfaceType::getInheritedMemberCount()
    1932                 :            : {
    1933         [ +  - ]:       3404 :     if (m_inheritedMemberCount == 0)
    1934                 :            :     {
    1935                 :       3404 :         m_inheritedMemberCount = checkInheritedMemberCount(0);
    1936                 :            :     }
    1937                 :            : 
    1938                 :       3404 :     return m_inheritedMemberCount;
    1939                 :            : }
    1940                 :            : 
    1941                 :       3404 : void InterfaceType::dumpCppuAttributes(FileStream& o, sal_uInt32& index)
    1942                 :            : {
    1943                 :       3404 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
    1944                 :            : 
    1945                 :       3404 :     RTFieldAccess access = RT_ACCESS_INVALID;
    1946                 :       3404 :     OString fieldName;
    1947                 :       3404 :     OString fieldType;
    1948                 :       3404 :     OString scope = m_typeName.replace('/', '.');
    1949                 :            : 
    1950                 :       3404 :     sal_uInt32 absoluteIndex = index;
    1951                 :            : 
    1952         [ +  + ]:       3404 :     if (m_hasAttributes)
    1953                 :            :     {
    1954 [ +  - ][ +  - ]:        226 :         o << "\n" << indent() << "typelib_InterfaceAttributeTypeDescription * pAttribute = 0;\n";
         [ +  - ][ +  - ]
    1955                 :            : 
    1956         [ +  + ]:       1332 :         for (sal_uInt16 i=0; i < fieldCount; i++)
    1957                 :            :         {
    1958                 :       1106 :             access = m_reader.getFieldFlags(i);
    1959                 :            : 
    1960 [ -  + ][ +  - ]:       1106 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    1961                 :          0 :                 continue;
    1962                 :            : 
    1963         [ +  - ]:       1106 :             rtl::OUString name(m_reader.getFieldName(i));
    1964         [ +  - ]:       1106 :             fieldName = rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8);
    1965                 :            :             fieldType = checkRealBaseType(
    1966                 :            :                 rtl::OUStringToOString(
    1967                 :            :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8),
    1968 [ +  - ][ +  - ]:       1106 :                 sal_True);
                 [ +  - ]
    1969                 :            : 
    1970 [ +  - ][ +  - ]:       1106 :             o << indent() << "{\n";
                 [ +  - ]
    1971                 :       1106 :             inc();
    1972 [ +  - ][ +  - ]:       2212 :             o << indent() << "::rtl::OUString sAttributeType" << i << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    1973 [ +  - ][ +  - ]:       3318 :               << fieldType.replace('/', '.') << "\") );\n";
    1974                 :            : 
    1975 [ +  - ][ +  - ]:       2212 :             o << indent() << "::rtl::OUString sAttributeName" << i << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    1976 [ +  - ][ +  - ]:       3318 :               << scope.replace('/', '.') << "::" << fieldName << "\") );\n";
         [ +  - ][ +  - ]
    1977                 :            : 
    1978                 :            :             sal_Int32 getExceptions = dumpAttributeExceptionTypeNames(
    1979         [ +  - ]:       1106 :                 o, "get", name, RT_MODE_ATTRIBUTE_GET);
    1980                 :            :             sal_Int32 setExceptions = dumpAttributeExceptionTypeNames(
    1981         [ +  - ]:       1106 :                 o, "set", name, RT_MODE_ATTRIBUTE_SET);
    1982 [ +  - ][ +  - ]:       2212 :             o << indent()
    1983                 :            :               << ("typelib_typedescription_newExtendedInterfaceAttribute("
    1984         [ +  - ]:       1106 :                   " &pAttribute,\n");
    1985                 :       1106 :             inc();
    1986 [ +  - ][ +  - ]:       1106 :             o << indent() << absoluteIndex++ << ", sAttributeName" << i << ".pData,\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1987 [ +  - ][ +  - ]:       2212 :             o << indent() << "(typelib_TypeClass)" << getTypeClass(fieldType)
         [ +  - ][ +  - ]
                 [ +  - ]
    1988 [ +  - ][ +  - ]:       1106 :               << ", sAttributeType" << i << ".pData,\n";
                 [ +  - ]
    1989 [ +  - ][ +  - ]:       2212 :             o << indent() << "sal_"
                 [ +  - ]
    1990 [ +  + ][ +  - ]:       2212 :               << ((access & RT_ACCESS_READONLY) == 0 ? "False" : "True") << ", "
                 [ +  - ]
    1991 [ +  - ][ +  - ]:       1106 :               << getExceptions << ", "
    1992 [ +  + ][ +  - ]:       2212 :               << (getExceptions == 0 ? "0" : "the_getExceptions") << ", "
                 [ +  - ]
    1993 [ +  - ][ +  - ]:       1106 :               << setExceptions << ", "
    1994 [ +  - ][ +  - ]:       2212 :               << (setExceptions == 0 ? "0" : "the_setExceptions") << " );\n";
                 [ +  + ]
    1995         [ +  - ]:       1106 :             dec();
    1996 [ +  - ][ +  - ]:       1106 :             o << indent() << "typelib_typedescription_register( (typelib_TypeDescription**)&pAttribute );\n";
                 [ +  - ]
    1997         [ +  - ]:       1106 :             dec();
    1998 [ +  - ][ +  - ]:       1106 :             o << indent() << "}\n";
                 [ +  - ]
    1999                 :       1106 :         }
    2000 [ +  - ][ +  - ]:        226 :          o << indent() << "typelib_typedescription_release( (typelib_TypeDescription*)pAttribute );\n";
                 [ +  - ]
    2001                 :            : 
    2002                 :        226 :         index = absoluteIndex;
    2003                 :       3404 :     }
    2004                 :       3404 : }
    2005                 :            : 
    2006                 :       3404 : void InterfaceType::dumpCppuMethods(FileStream& o, sal_uInt32& index)
    2007                 :            : {
    2008                 :       3404 :     sal_uInt16      methodCount = m_reader.getMethodCount();
    2009                 :       3404 :     OString         methodName, returnType, paramType, paramName;
    2010                 :       3404 :     RTMethodMode    methodMode = RT_MODE_INVALID;
    2011                 :       3404 :     RTParamMode     paramMode = RT_PARAM_INVALID;
    2012                 :       3404 :     sal_Bool        bWithRuntimeException = sal_True;
    2013                 :            : 
    2014                 :       3404 :     sal_uInt32 absoluteIndex = index;
    2015                 :            : 
    2016         [ +  + ]:       3404 :     if (m_hasMethods)
    2017                 :            :     {
    2018 [ +  - ][ +  - ]:       3304 :         o << "\n" << indent() << "typelib_InterfaceMethodTypeDescription * pMethod = 0;\n";
         [ +  - ][ +  - ]
    2019                 :       3304 :         OString             scope = m_typeName.replace('/', '.');
    2020                 :            : 
    2021                 :       3304 :         sal_uInt16 paramCount = 0;
    2022         [ +  + ]:      15544 :         for (sal_uInt16 i=0; i < methodCount; i++)
    2023                 :            :         {
    2024                 :      12240 :             methodMode = m_reader.getMethodFlags(i);
    2025 [ +  + ][ +  + ]:      12240 :             if (methodMode == RT_MODE_ATTRIBUTE_GET
    2026                 :            :                 || methodMode == RT_MODE_ATTRIBUTE_SET)
    2027                 :            :             {
    2028                 :         68 :                 continue;
    2029                 :            :             }
    2030                 :            : 
    2031                 :            :             methodName = rtl::OUStringToOString(
    2032 [ +  - ][ +  - ]:      12172 :                 m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8);
    2033                 :            :             returnType = checkRealBaseType(
    2034                 :            :                 rtl::OUStringToOString(
    2035                 :            :                     m_reader.getMethodReturnTypeName(i), RTL_TEXTENCODING_UTF8),
    2036 [ +  - ][ +  - ]:      12172 :                 sal_True);
                 [ +  - ]
    2037                 :      12172 :             paramCount = m_reader.getMethodParameterCount(i);
    2038                 :            : 
    2039 [ -  + ][ +  - ]:      12172 :             if ( methodName.equals("acquire") || methodName.equals("release") )
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
                 [ +  - ]
    2040                 :            :             {
    2041                 :          0 :                 bWithRuntimeException = sal_False;
    2042                 :            :             }
    2043                 :            : 
    2044 [ +  - ][ +  - ]:      12172 :             o << indent() << "{\n";
                 [ +  - ]
    2045                 :      12172 :             inc();
    2046                 :            : 
    2047         [ +  + ]:      12172 :             if (paramCount)
    2048                 :            :             {
    2049 [ +  - ][ +  - ]:       7668 :                 o << indent() << "typelib_Parameter_Init aParameters[" << paramCount << "];\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2050                 :            :             }
    2051                 :            : 
    2052         [ +  + ]:      24844 :             for (sal_uInt16 j = 0; j < paramCount; j++)
    2053                 :            :             {
    2054                 :            :                 paramName = rtl::OUStringToOString(
    2055                 :            :                     m_reader.getMethodParameterName(i, j),
    2056 [ +  - ][ +  - ]:      12672 :                     RTL_TEXTENCODING_UTF8);
    2057                 :            :                 paramType = checkRealBaseType(
    2058                 :            :                     rtl::OUStringToOString(
    2059                 :            :                         m_reader.getMethodParameterTypeName(i, j),
    2060                 :            :                         RTL_TEXTENCODING_UTF8),
    2061 [ +  - ][ +  - ]:      12672 :                     sal_True);
                 [ +  - ]
    2062                 :      12672 :                 paramMode = m_reader.getMethodParameterFlags(i, j);
    2063                 :            : 
    2064 [ +  - ][ +  - ]:      25344 :                 o << indent() << "::rtl::OUString sParamName" << j << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    2065 [ +  - ][ +  - ]:      12672 :                   << paramName << "\") );\n";
    2066 [ +  - ][ +  - ]:      25344 :                 o << indent() << "::rtl::OUString sParamType" << j << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    2067 [ +  - ][ +  - ]:      38016 :                   << paramType.replace('/', '.') << "\") );\n";
    2068 [ +  - ][ +  - ]:      12672 :                 o << indent() << "aParameters[" << j << "].pParamName = sParamName" << j << ".pData;\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    2069 [ +  - ][ +  - ]:      25344 :                 o << indent() << "aParameters[" << j << "].eTypeClass = (typelib_TypeClass)"
         [ +  - ][ +  - ]
                 [ +  - ]
    2070 [ +  - ][ +  - ]:      38016 :                   << getTypeClass(paramType) << ";\n";
                 [ +  - ]
    2071 [ +  - ][ +  - ]:      12672 :                 o << indent() << "aParameters[" << j << "].pTypeName = sParamType" << j << ".pData;\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    2072                 :            : 
    2073 [ +  + ][ +  + ]:      12672 :                 if (paramMode == RT_PARAM_IN || paramMode == RT_PARAM_INOUT)
    2074 [ +  - ][ +  - ]:      12474 :                     o << indent() << "aParameters[" << j << "].bIn = sal_True;\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2075                 :            :                 else
    2076 [ +  - ][ +  - ]:        198 :                     o << indent() << "aParameters[" << j << "].bIn = sal_False;\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2077                 :            : 
    2078 [ +  + ][ +  + ]:      12672 :                 if (paramMode == RT_PARAM_OUT || paramMode == RT_PARAM_INOUT)
    2079 [ +  - ][ +  - ]:        306 :                     o << indent() << "aParameters[" << j << "].bOut = sal_True;\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2080                 :            :                 else
    2081 [ +  - ][ +  - ]:      12366 :                     o << indent() << "aParameters[" << j << "].bOut = sal_False;\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2082                 :            :             }
    2083                 :            : 
    2084                 :            :             sal_Int32 excCount = dumpExceptionTypeNames(
    2085         [ +  - ]:      12172 :                 o, "", i, bWithRuntimeException);
    2086                 :            : 
    2087 [ +  - ][ +  - ]:      24344 :             o << indent() << "::rtl::OUString sReturnType" << i << "( RTL_CONSTASCII_USTRINGPARAM(\""
         [ +  - ][ +  - ]
                 [ +  - ]
    2088 [ +  - ][ +  - ]:      36516 :               << returnType.replace('/', '.') << "\") );\n";
    2089 [ +  - ][ +  - ]:      24344 :             o << indent() << "::rtl::OUString sMethodName" << i <<
         [ +  - ][ +  - ]
    2090         [ +  - ]:      12172 :                 "( RTL_CONSTASCII_USTRINGPARAM(\""
    2091 [ +  - ][ +  - ]:      36516 :               << scope.replace('/', '.') << "::" << methodName << "\") );\n";
         [ +  - ][ +  - ]
    2092 [ +  - ][ +  - ]:      12172 :             o << indent() << "typelib_typedescription_newInterfaceMethod( &pMethod,\n";
                 [ +  - ]
    2093                 :      12172 :             inc();
    2094 [ +  - ][ +  - ]:      12172 :             o << indent() << absoluteIndex++ << ", ";
         [ +  - ][ +  - ]
    2095 [ -  + ][ +  + ]:      12172 :             if (methodMode == RT_MODE_ONEWAY || methodMode == RT_MODE_ONEWAY_CONST)
    2096         [ +  - ]:       1076 :                 o << "sal_True,\n";
    2097                 :            :             else
    2098         [ +  - ]:      11096 :                 o << "sal_False,\n";
    2099                 :            : 
    2100 [ +  - ][ +  - ]:      12172 :             o << indent() << "sMethodName" << i << ".pData,\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2101 [ +  - ][ +  - ]:      24344 :             o << indent() << "(typelib_TypeClass)" << getTypeClass(returnType)
         [ +  - ][ +  - ]
                 [ +  - ]
    2102 [ +  - ][ +  - ]:      12172 :               << ", sReturnType" << i << ".pData,\n";
                 [ +  - ]
    2103         [ +  + ]:      12172 :             if (paramCount)
    2104 [ +  - ][ +  - ]:       7668 :                 o << indent() << paramCount << ", aParameters,\n";
         [ +  - ][ +  - ]
    2105                 :            :             else
    2106 [ +  - ][ +  - ]:       4504 :                 o << indent() << "0, 0,\n";
                 [ +  - ]
    2107 [ +  - ][ +  - ]:      24344 :             o << indent() << excCount << ", "
         [ +  - ][ +  - ]
    2108 [ -  + ][ +  - ]:      24344 :               << (excCount == 0 ? "0" : "the_Exceptions") << " );\n";
                 [ +  - ]
    2109                 :            : 
    2110         [ +  - ]:      12172 :             dec();
    2111 [ +  - ][ +  - ]:      12172 :             o << indent() << "typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );\n";
                 [ +  - ]
    2112                 :            : 
    2113         [ +  - ]:      12172 :             dec();
    2114 [ +  - ][ +  - ]:      12172 :             o << indent() << "}\n";
                 [ +  - ]
    2115                 :            :         }
    2116 [ +  - ][ +  - ]:       3304 :         o << indent() << "typelib_typedescription_release( (typelib_TypeDescription*)pMethod );\n";
                 [ +  - ]
    2117                 :            : 
    2118                 :       3304 :         index = absoluteIndex;
    2119                 :       3404 :     }
    2120                 :       3404 : }
    2121                 :            : 
    2122                 :       3506 : void InterfaceType::dumpAttributesCppuDecl(FileStream& o, StringSet* pFinishedTypes, CppuTypeDecl eDeclFlag)
    2123                 :            : {
    2124                 :       3506 :     sal_uInt16 fieldCount = m_reader.getFieldCount();
    2125                 :            : 
    2126                 :       3506 :     RTFieldAccess access = RT_ACCESS_INVALID;
    2127                 :       3506 :     OString fieldName;
    2128                 :       3506 :     OString fieldType;
    2129         [ +  + ]:       4612 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    2130                 :            :     {
    2131                 :       1106 :         access = m_reader.getFieldFlags(i);
    2132                 :            : 
    2133 [ -  + ][ +  - ]:       1106 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    2134                 :          0 :             continue;
    2135                 :            : 
    2136                 :            :         fieldName = rtl::OUStringToOString(
    2137 [ +  - ][ +  - ]:       1106 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    2138                 :            :         fieldType = rtl::OUStringToOString(
    2139 [ +  - ][ +  - ]:       1106 :             m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    2140                 :            : 
    2141 [ +  + ][ +  - ]:       1106 :         if (pFinishedTypes->count(fieldType) == 0)
    2142                 :            :         {
    2143         [ +  - ]:        594 :             pFinishedTypes->insert(fieldType);
    2144         [ +  - ]:        594 :             dumpCppuGetType(o, fieldType, sal_True, eDeclFlag);
    2145                 :            :         }
    2146                 :       3506 :     }
    2147                 :       3506 : }
    2148                 :            : 
    2149                 :       3506 : void InterfaceType::dumpMethodsCppuDecl(FileStream& o, StringSet* pFinishedTypes, CppuTypeDecl eDeclFlag)
    2150                 :            : {
    2151                 :       3506 :     sal_uInt16      methodCount = m_reader.getMethodCount();
    2152                 :       3506 :     OString         returnType, paramType, excType;
    2153                 :       3506 :     sal_uInt16      paramCount = 0;
    2154                 :       3506 :     sal_uInt16      excCount = 0;
    2155                 :            : 
    2156         [ +  + ]:      16060 :     for (sal_uInt16 i=0; i < methodCount; i++)
    2157                 :            :     {
    2158                 :            :         returnType = rtl::OUStringToOString(
    2159 [ +  - ][ +  - ]:      12554 :             m_reader.getMethodReturnTypeName(i), RTL_TEXTENCODING_UTF8);
    2160                 :      12554 :         paramCount = m_reader.getMethodParameterCount(i);
    2161                 :      12554 :         excCount = m_reader.getMethodExceptionCount(i);
    2162                 :            : 
    2163 [ +  + ][ +  - ]:      12554 :         if (pFinishedTypes->count(returnType) == 0)
    2164                 :            :         {
    2165         [ +  - ]:       6158 :             pFinishedTypes->insert(returnType);
    2166         [ +  - ]:       6158 :             dumpCppuGetType(o, returnType, sal_True, eDeclFlag);
    2167                 :            :         }
    2168                 :            :         sal_uInt16 j;
    2169         [ +  + ]:      25226 :         for (j=0; j < paramCount; j++)
    2170                 :            :         {
    2171                 :            :             paramType = rtl::OUStringToOString(
    2172                 :            :                 m_reader.getMethodParameterTypeName(i, j),
    2173 [ +  - ][ +  - ]:      12672 :                 RTL_TEXTENCODING_UTF8);
    2174                 :            : 
    2175 [ +  + ][ +  - ]:      12672 :             if (pFinishedTypes->count(paramType) == 0)
    2176                 :            :             {
    2177         [ +  - ]:       4500 :                 pFinishedTypes->insert(paramType);
    2178         [ +  - ]:       4500 :                 dumpCppuGetType(o, paramType, sal_True, eDeclFlag);
    2179                 :            :             }
    2180                 :            :         }
    2181                 :            : 
    2182         [ +  + ]:      18824 :         for (j=0; j < excCount; j++)
    2183                 :            :         {
    2184                 :            :             excType = rtl::OUStringToOString(
    2185                 :            :                 m_reader.getMethodExceptionTypeName(i, j),
    2186 [ +  - ][ +  - ]:       6270 :                 RTL_TEXTENCODING_UTF8);
    2187 [ +  + ][ +  - ]:       6270 :             if (pFinishedTypes->count(excType) == 0)
    2188                 :            :             {
    2189         [ +  - ]:       2224 :                 pFinishedTypes->insert(excType);
    2190         [ +  - ]:       2224 :                 dumpCppuGetType(o, excType, sal_True, eDeclFlag);
    2191                 :            :             }
    2192                 :            :         }
    2193                 :       3506 :     }
    2194                 :       3506 : }
    2195                 :            : 
    2196                 :      30550 : void InterfaceType::dumpExceptionSpecification(
    2197                 :            :     FileStream & out, sal_uInt32 methodIndex, bool runtimeException)
    2198                 :            : {
    2199                 :      30550 :     out << " throw (";
    2200                 :      30550 :     bool first = true;
    2201         [ +  + ]:      30550 :     if (methodIndex <= SAL_MAX_UINT16) {
    2202                 :            :         sal_uInt16 count = m_reader.getMethodExceptionCount(
    2203                 :      25352 :             static_cast< sal_uInt16 >(methodIndex));
    2204         [ +  + ]:      37502 :         for (sal_uInt16 i = 0; i < count; ++i) {
    2205                 :            :             rtl::OUString name(
    2206                 :            :                 m_reader.getMethodExceptionTypeName(
    2207         [ +  - ]:      12150 :                     static_cast< sal_uInt16 >(methodIndex), i));
    2208         [ +  + ]:      12150 :             if ( name != "com/sun/star/uno/RuntimeException" )
    2209                 :            :             {
    2210         [ +  + ]:      12148 :                 if (!first) {
    2211         [ +  - ]:       3326 :                     out << ", ";
    2212                 :            :                 }
    2213                 :      12148 :                 first = false;
    2214                 :            :                 out << scopedCppName(
    2215 [ +  - ][ +  - ]:      12148 :                     rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8));
                 [ +  - ]
    2216                 :            :             }
    2217                 :      12150 :         }
    2218                 :            :     }
    2219         [ +  + ]:      30550 :     if (runtimeException) {
    2220         [ +  + ]:      30534 :         if (!first) {
    2221                 :       8822 :             out << ", ";
    2222                 :            :         }
    2223                 :      30534 :         out << "::com::sun::star::uno::RuntimeException";
    2224                 :            :     }
    2225                 :      30550 :     out << ")";
    2226                 :      30550 : }
    2227                 :            : 
    2228                 :       5960 : void InterfaceType::dumpAttributeExceptionSpecification(
    2229                 :            :     FileStream & out, rtl::OUString const & name, RTMethodMode sort)
    2230                 :            : {
    2231                 :       5960 :     sal_uInt16 methodCount = m_reader.getMethodCount();
    2232         [ +  + ]:      66358 :     for (sal_uInt16 i = 0; i < methodCount; ++i) {
    2233   [ +  +  +  + ]:     139756 :         if (m_reader.getMethodFlags(i) == sort
                 [ +  + ]
    2234 [ +  - ][ +  + ]:      78596 :             && m_reader.getMethodName(i) == name)
                 [ #  # ]
    2235                 :            :         {
    2236                 :        762 :             dumpExceptionSpecification(out, i, true);
    2237                 :       5960 :             return;
    2238                 :            :         }
    2239                 :            :     }
    2240                 :       5198 :     dumpExceptionSpecification(out, 0xFFFFFFFF, true);
    2241                 :            : }
    2242                 :            : 
    2243                 :      18440 : void InterfaceType::dumpExceptionTypeName(
    2244                 :            :     FileStream & out, char const * prefix, sal_uInt32 index, rtl::OUString name)
    2245                 :            : {
    2246 [ +  - ][ +  - ]:      36880 :     out << indent() << "::rtl::OUString the_" << prefix << "ExceptionName"
         [ +  - ][ +  - ]
                 [ +  - ]
    2247 [ +  - ][ +  - ]:      18440 :         << index << "(RTL_CONSTASCII_USTRINGPARAM(\""
    2248         [ +  - ]:      55320 :         << rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).replace('/', '.')
    2249         [ +  - ]:      18440 :         << "\"));\n";
    2250                 :      18440 : }
    2251                 :            : 
    2252                 :      12554 : sal_Int32 InterfaceType::dumpExceptionTypeNames(
    2253                 :            :     FileStream & out, char const * prefix, sal_uInt16 methodIndex,
    2254                 :            :     bool runtimeException)
    2255                 :            : {
    2256                 :      12554 :     sal_Int32 count = 0;
    2257                 :      12554 :     sal_uInt16 n = m_reader.getMethodExceptionCount(methodIndex);
    2258         [ +  + ]:      18824 :     for (sal_uInt16 i = 0; i < n; ++i) {
    2259         [ +  - ]:       6270 :         rtl::OUString name(m_reader.getMethodExceptionTypeName(methodIndex, i));
    2260         [ +  + ]:       6270 :         if ( name != "com/sun/star/uno/RuntimeException" )
    2261                 :            :         {
    2262         [ +  - ]:       6268 :             dumpExceptionTypeName(out, prefix, count++, name);
    2263                 :            :         }
    2264                 :       6270 :     }
    2265         [ +  + ]:      12554 :     if (runtimeException) {
    2266                 :            :         dumpExceptionTypeName(
    2267                 :            :             out, prefix, count++,
    2268                 :            :             rtl::OUString(
    2269                 :            :                 RTL_CONSTASCII_USTRINGPARAM(
    2270         [ +  - ]:      12172 :                     "com/sun/star/uno/RuntimeException")));
    2271                 :            :     }
    2272         [ +  + ]:      12554 :     if (count > 0) {
    2273 [ +  - ][ +  - ]:      12552 :         out << indent() << "rtl_uString * the_" << prefix << "Exceptions[] = {";
         [ +  - ][ +  - ]
    2274         [ +  + ]:      30992 :         for (sal_Int32 i = 0; i < count; ++i) {
    2275         [ +  + ]:      18440 :             out << (i == 0 ? " " : ", ") << "the_" << prefix << "ExceptionName"
    2276                 :      18440 :                 << i << ".pData";
    2277                 :            :         }
    2278                 :      12552 :         out << " };\n";
    2279                 :            :     }
    2280                 :      12554 :     return count;
    2281                 :            : }
    2282                 :            : 
    2283                 :       2212 : sal_Int32 InterfaceType::dumpAttributeExceptionTypeNames(
    2284                 :            :     FileStream & out, char const * prefix, rtl::OUString const & name,
    2285                 :            :     RTMethodMode sort)
    2286                 :            : {
    2287                 :       2212 :     sal_uInt16 methodCount = m_reader.getMethodCount();
    2288         [ +  + ]:      25126 :     for (sal_uInt16 i = 0; i < methodCount; ++i) {
    2289   [ +  +  +  + ]:      55392 :         if (m_reader.getMethodFlags(i) == sort
                 [ +  + ]
    2290 [ +  - ][ +  + ]:      32096 :             && m_reader.getMethodName(i) == name)
                 [ #  # ]
    2291                 :            :         {
    2292                 :        382 :             return dumpExceptionTypeNames(out, prefix, i, false);
    2293                 :            :         }
    2294                 :            :     }
    2295                 :       2212 :     return 0;
    2296                 :            : }
    2297                 :            : 
    2298                 :            : //*************************************************************************
    2299                 :            : // ConstantsType
    2300                 :            : //*************************************************************************
    2301                 :       3738 : ConstantsType::ConstantsType(typereg::Reader& typeReader,
    2302                 :            :                              const OString& typeName,
    2303                 :            :                              const TypeManager& typeMgr)
    2304                 :       3738 :     : CppuType(typeReader, typeName, typeMgr)
    2305                 :            : {
    2306                 :       3738 : }
    2307                 :            : 
    2308                 :       3738 : ConstantsType::~ConstantsType()
    2309                 :            : {
    2310                 :            : 
    2311         [ -  + ]:       3738 : }
    2312                 :            : 
    2313                 :       3084 : sal_Bool ConstantsType::dump(CppuOptions* pOptions)
    2314                 :            :     throw( CannotDumpException )
    2315                 :            : {
    2316         [ -  + ]:       3084 :     if (!m_dependencies.isValid()) {
    2317                 :          0 :         return false;
    2318                 :            :     }
    2319         [ +  - ]:       3084 :     addSpecialDependencies();
    2320                 :            : 
    2321 [ +  - ][ -  + ]:       3084 :     if (pOptions->isValid("-U"))
    2322                 :          0 :         m_cppuTypeDynamic = sal_True;
    2323                 :            : 
    2324                 :       3084 :     OString outPath;
    2325 [ +  - ][ +  - ]:       3084 :     if (pOptions->isValid("-O"))
    2326         [ +  - ]:       3084 :         outPath = pOptions->getOption("-O");
    2327                 :            : 
    2328         [ +  - ]:       3084 :     return dumpFiles(pOptions, outPath);
    2329                 :            : }
    2330                 :            : 
    2331                 :       3084 : sal_Bool ConstantsType::dumpHFile(
    2332                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    2333                 :            :     throw( CannotDumpException )
    2334                 :            : {
    2335                 :       3084 :     sal_Bool bSpecialDefine = sal_True;
    2336                 :            : 
    2337         [ +  - ]:       3084 :     if (m_reader.getTypeClass() == RT_TYPE_CONSTANTS)
    2338                 :            :     {
    2339                 :       3084 :         bSpecialDefine = sal_False;
    2340                 :            :     }
    2341                 :            : 
    2342         [ +  - ]:       3084 :     OString headerDefine(dumpHeaderDefine(o, "HDL", bSpecialDefine));
    2343         [ +  - ]:       3084 :     o << "\n";
    2344                 :            : 
    2345         [ +  - ]:       3084 :     addDefaultHIncludes(includes);
    2346         [ +  - ]:       3084 :     includes.dump(o, 0);
    2347         [ +  - ]:       3084 :     o << "\n";
    2348                 :            : 
    2349 [ +  - ][ +  - ]:       3084 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, true)) {
    2350         [ +  - ]:       3084 :         o << "\n";
    2351                 :            :     }
    2352         [ +  - ]:       3084 :     o << "\n";
    2353                 :            : 
    2354         [ +  - ]:       3084 :     dumpDeclaration(o);
    2355         [ +  - ]:       3084 :     o << "\n";
    2356                 :            : 
    2357 [ +  - ][ +  - ]:       3084 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, true)) {
    2358         [ +  - ]:       3084 :         o << "\n";
    2359                 :            :     }
    2360 [ +  - ][ +  - ]:       3084 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    2361                 :            : 
    2362                 :       3084 :     return sal_True;
    2363                 :            : }
    2364                 :            : 
    2365                 :       3084 : void ConstantsType::dumpDeclaration(FileStream& o)
    2366                 :            :     throw( CannotDumpException )
    2367                 :            : {
    2368                 :       3084 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
    2369                 :       3084 :     OString         fieldName;
    2370                 :       3084 :     OString         fieldType;
    2371         [ +  + ]:      33138 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    2372                 :            :     {
    2373                 :            :         fieldName = rtl::OUStringToOString(
    2374 [ +  - ][ +  - ]:      30054 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    2375                 :            :         fieldType = rtl::OUStringToOString(
    2376 [ +  - ][ +  - ]:      30054 :             m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    2377                 :            : 
    2378         [ +  - ]:      30054 :         o << "static const ";
    2379         [ +  - ]:      30054 :         dumpType(o, fieldType);
    2380 [ +  - ][ +  - ]:      30054 :         o << " " << fieldName << " = ";
                 [ +  - ]
    2381         [ +  - ]:      30054 :         dumpConstantValue(o, i);
    2382         [ +  - ]:      30054 :         o << ";\n";
    2383                 :       3084 :     }
    2384                 :       3084 : }
    2385                 :            : 
    2386                 :       3738 : sal_Bool ConstantsType::hasConstants()
    2387                 :            : {
    2388                 :       3738 :     return m_reader.getFieldCount() > 0;
    2389                 :            : }
    2390                 :            : 
    2391                 :       3084 : sal_Bool ConstantsType::dumpHxxFile(
    2392                 :            :     FileStream& o, codemaker::cppumaker::Includes &)
    2393                 :            :     throw( CannotDumpException )
    2394                 :            : {
    2395                 :       3084 :     sal_Bool bSpecialDefine = sal_True;
    2396                 :            : 
    2397         [ +  - ]:       3084 :     if (m_reader.getTypeClass() == RT_TYPE_CONSTANTS)
    2398                 :            :     {
    2399                 :       3084 :         bSpecialDefine = sal_False;
    2400                 :            :     }
    2401                 :            : 
    2402         [ +  - ]:       3084 :     OString headerDefine(dumpHeaderDefine(o, "HPP", bSpecialDefine));
    2403         [ +  - ]:       3084 :     o << "\n";
    2404                 :            : 
    2405                 :       3084 :     rtl::OString suffix;
    2406         [ -  + ]:       3084 :     if (bSpecialDefine) {
    2407                 :          0 :         suffix = m_name;
    2408                 :            :     }
    2409         [ +  - ]:       3084 :     codemaker::cppumaker::Includes::dumpInclude(o, m_typeName, false, suffix);
    2410                 :            : 
    2411 [ +  - ][ +  - ]:       3084 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    2412                 :            : 
    2413                 :       3084 :     return sal_True;
    2414                 :            : }
    2415                 :            : 
    2416                 :            : //*************************************************************************
    2417                 :            : // ModuleType
    2418                 :            : //*************************************************************************
    2419                 :        654 : ModuleType::ModuleType(typereg::Reader& typeReader,
    2420                 :            :                        const OString& typeName,
    2421                 :            :                        const TypeManager& typeMgr)
    2422                 :        654 :     : ConstantsType(typeReader, typeName, typeMgr)
    2423                 :            : {
    2424                 :        654 : }
    2425                 :            : 
    2426                 :        654 : ModuleType::~ModuleType()
    2427                 :            : {
    2428                 :            : 
    2429         [ -  + ]:        654 : }
    2430                 :            : 
    2431                 :          0 : bool ModuleType::dumpFiles(
    2432                 :            :     CppuOptions * options, rtl::OString const & outPath)
    2433                 :            : {
    2434                 :          0 :     rtl::OString tmpName(m_typeName);
    2435         [ #  # ]:          0 :     if (tmpName.equals("/")) {
    2436                 :          0 :         tmpName = "global";
    2437                 :            :     } else {
    2438                 :          0 :         tmpName += "/" + m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
    2439                 :            :     }
    2440 [ #  # ][ #  # ]:          0 :     return dumpFile(options, ".hdl", tmpName, outPath)
                 [ #  # ]
           [ #  #  #  # ]
    2441 [ #  # ][ #  # ]:          0 :         && dumpFile(options, ".hpp", tmpName, outPath);
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    2442                 :            : }
    2443                 :            : 
    2444                 :            : //*************************************************************************
    2445                 :            : // StructureType
    2446                 :            : //*************************************************************************
    2447                 :            : 
    2448                 :            : namespace {
    2449                 :            : 
    2450                 :        684 : void dumpTypeParameterName(FileStream & out, rtl::OString const & name) {
    2451                 :            :     // Prefix all type parameters with "typeparam_" to avoid problems when a
    2452                 :            :     // struct member has the same name as a type parameter, as in
    2453                 :            :     // struct<T> { T T; };
    2454                 :        684 :     out << "typeparam_" << name;
    2455                 :        684 : }
    2456                 :            : 
    2457                 :            : }
    2458                 :            : 
    2459                 :       1826 : StructureType::StructureType(typereg::Reader& typeReader,
    2460                 :            :                               const OString& typeName,
    2461                 :            :                              const TypeManager& typeMgr)
    2462                 :       1826 :     : CppuType(typeReader, typeName, typeMgr)
    2463                 :            : {
    2464                 :       1826 : }
    2465                 :            : 
    2466                 :       1826 : StructureType::~StructureType()
    2467                 :            : {
    2468                 :            : 
    2469         [ -  + ]:       1826 : }
    2470                 :            : 
    2471                 :       1826 : sal_Bool StructureType::dumpHFile(
    2472                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    2473                 :            :     throw( CannotDumpException )
    2474                 :            : {
    2475                 :       1826 :     dumpHFileContent(o, includes);
    2476                 :       1826 :     return sal_True;
    2477                 :            : }
    2478                 :            : 
    2479                 :       1826 : void StructureType::dumpDeclaration(FileStream& o)
    2480                 :            :     throw( CannotDumpException )
    2481                 :            : {
    2482         [ +  - ]:       1826 :     o << "\n#ifdef SAL_W32\n"
    2483         [ +  - ]:       1826 :       << "#   pragma pack(push, 8)\n"
    2484         [ +  - ]:       1826 :       << "#endif\n\n";
    2485                 :            : 
    2486                 :            :     OSL_ASSERT(!isPolymorphic() || m_reader.getSuperTypeCount() == 0); //TODO
    2487 [ +  - ][ +  - ]:       1826 :     o << indent();
    2488         [ +  - ]:       1826 :     dumpTemplateHead(o);
    2489 [ +  - ][ +  - ]:       1826 :     o << "struct " << m_name;
    2490                 :       1826 :     rtl::OString base;
    2491         [ +  + ]:       1826 :     if (m_reader.getSuperTypeCount() != 0) {
    2492                 :            :         base = rtl::OUStringToOString(
    2493 [ +  - ][ +  - ]:        460 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    2494                 :            :         OSL_ASSERT(!base.isEmpty()); //TODO
    2495                 :            :     }
    2496         [ +  + ]:       1826 :     if (!base.isEmpty()) {
    2497 [ +  - ][ +  - ]:        460 :         o << ": public " << scopedCppName(base);
                 [ +  - ]
    2498                 :            :     }
    2499         [ +  - ]:       1826 :     o << " {\n";
    2500                 :       1826 :     inc();
    2501 [ +  - ][ +  - ]:       1826 :     o << indent() << "inline " << m_name << "() SAL_THROW(());\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    2502                 :       1826 :     sal_uInt16 members = m_reader.getFieldCount();
    2503 [ #  # ][ #  # ]:       1826 :     if (members > 0 || getInheritedMemberCount() > 0) {
         [ +  - ][ -  + ]
    2504 [ +  - ][ +  - ]:       1826 :         o << "\n" << indent() << "inline " << m_name << "(";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    2505         [ +  - ]:       1826 :         bool prev = dumpSuperMember(o, base, true);
    2506         [ +  + ]:       8394 :         for (sal_uInt16 i = 0; i < members; ++i) {
    2507         [ +  + ]:       6568 :             if (prev) {
    2508         [ +  - ]:       5202 :                 o << ", ";
    2509                 :            :             }
    2510                 :       6568 :             prev = true;
    2511                 :            :             rtl::OString type(
    2512                 :            :                 rtl::OUStringToOString(
    2513 [ +  - ][ +  - ]:       6568 :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    2514         [ +  + ]:       6568 :             if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0)
    2515                 :            :             {
    2516         [ +  - ]:         28 :                 dumpTypeParameterName(o, type);
    2517         [ +  - ]:         28 :                 o << " const &";
    2518                 :            :             } else {
    2519         [ +  - ]:       6540 :                 dumpType(o, type, true, true);
    2520                 :            :             }
    2521         [ +  - ]:       6568 :             o << " "
    2522                 :            :               << rtl::OUStringToOString(
    2523 [ +  - ][ +  - ]:      19704 :                   m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8)
                 [ +  - ]
    2524         [ +  - ]:       6568 :               << "_";
    2525                 :       6568 :         }
    2526         [ +  - ]:       1826 :         o << ") SAL_THROW(());\n";
    2527                 :            :     }
    2528         [ +  - ]:       1826 :     if (members > 0) {
    2529         [ +  - ]:       1826 :         o << "\n";
    2530         [ +  + ]:       8394 :         for (sal_uInt16 i = 0; i < members; ++i) {
    2531 [ +  - ][ +  - ]:       6568 :             o << indent();
    2532                 :            :             bool parameterized
    2533                 :       6568 :                 = ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE)
    2534                 :       6568 :                    != 0);
    2535                 :            :             rtl::OString type(
    2536                 :            :                 rtl::OUStringToOString(
    2537 [ +  - ][ +  - ]:       6568 :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    2538         [ +  + ]:       6568 :             if (parameterized) {
    2539         [ +  - ]:         28 :                 dumpTypeParameterName(o, type);
    2540                 :            :             } else {
    2541         [ +  - ]:       6540 :                 dumpType(o, type);
    2542                 :            :             }
    2543         [ +  - ]:       6568 :             o << " "
    2544                 :            :                 << rtl::OUStringToOString(
    2545 [ +  - ][ +  - ]:      13136 :                     m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
                 [ +  - ]
    2546 [ +  + ][ +  - ]:       7488 :             if (i == 0 && !base.isEmpty() && type != "double"
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
                 [ +  + ]
    2547 [ +  - ][ +  - ]:        920 :                 && type != "hyper" && type != "unsigned hyper")
    2548                 :            :             {
    2549                 :            :                 OSL_ASSERT(!parameterized);
    2550 [ +  - ][ +  - ]:        460 :                 o << " CPPU_GCC3_ALIGN(" << scopedCppName(base) << ")";
         [ +  - ][ +  - ]
    2551                 :            :             }
    2552         [ +  - ]:       6568 :             o << ";\n";
    2553                 :       6568 :         }
    2554                 :            :     }
    2555         [ +  - ]:       1826 :     dec();
    2556         [ +  - ]:       1826 :     o << "};\n\n";
    2557                 :            : 
    2558         [ +  - ]:       1826 :     o << "#ifdef SAL_W32\n"
    2559         [ +  - ]:       1826 :       << "#   pragma pack(pop)\n"
    2560         [ +  - ]:       1826 :       << "#endif\n\n";
    2561                 :       1826 : }
    2562                 :            : 
    2563                 :       1826 : sal_Bool StructureType::dumpHxxFile(
    2564                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    2565                 :            :     throw( CannotDumpException )
    2566                 :            : {
    2567         [ +  - ]:       1826 :     OString headerDefine(dumpHeaderDefine(o, "HPP"));
    2568         [ +  - ]:       1826 :     o << "\n";
    2569                 :            : 
    2570         [ +  - ]:       1826 :     includes.dump(o, &m_typeName);
    2571         [ +  - ]:       1826 :     o << "\n";
    2572                 :            : 
    2573 [ +  - ][ +  + ]:       1826 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
    2574         [ +  - ]:       1814 :         o << "\n";
    2575                 :            :     }
    2576         [ +  - ]:       1826 :     o << "\n";
    2577                 :            : 
    2578         [ +  - ]:       1826 :     dumpTemplateHead(o);
    2579 [ +  - ][ +  - ]:       1826 :     o << "inline " << m_name;
    2580         [ +  - ]:       1826 :     dumpTemplateParameters(o);
    2581 [ +  - ][ +  - ]:       1826 :     o << "::" << m_name << "() SAL_THROW(())\n";
                 [ +  - ]
    2582                 :       1826 :     inc();
    2583                 :       1826 :     OString superType;
    2584         [ +  + ]:       1826 :     if (m_reader.getSuperTypeCount() >= 1) {
    2585                 :            :         superType = rtl::OUStringToOString(
    2586 [ +  - ][ +  - ]:        460 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    2587                 :            :     }
    2588                 :       1826 :     sal_Bool first = sal_True;
    2589         [ +  + ]:       1826 :     if (!superType.isEmpty())
    2590                 :            :     {
    2591 [ +  - ][ +  - ]:        460 :         o << indent() << ": " << scopedCppName(superType) << "()\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    2592                 :        460 :         first = sal_False;
    2593                 :            :     }
    2594                 :            : 
    2595                 :       1826 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
    2596                 :       1826 :     RTFieldAccess   access = RT_ACCESS_INVALID;
    2597                 :       1826 :     OString         fieldName;
    2598                 :       1826 :     OString         fieldType;
    2599                 :            : 
    2600         [ +  + ]:       8394 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    2601                 :            :     {
    2602                 :       6568 :         access = m_reader.getFieldFlags(i);
    2603                 :            : 
    2604 [ -  + ][ +  - ]:       6568 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    2605                 :          0 :             continue;
    2606                 :            : 
    2607                 :            :         fieldName = rtl::OUStringToOString(
    2608 [ +  - ][ +  - ]:       6568 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    2609                 :            : 
    2610         [ +  + ]:       6568 :         if (first)
    2611                 :            :         {
    2612                 :       1366 :             first = sal_False;
    2613 [ +  - ][ +  - ]:       1366 :             o << indent() << ": ";
                 [ +  - ]
    2614                 :            :         } else
    2615 [ +  - ][ +  - ]:       5202 :             o << indent() << ", ";
                 [ +  - ]
    2616                 :            : 
    2617         [ +  - ]:       6568 :         o << fieldName;
    2618                 :            :         dumpInitializer(
    2619                 :            :             o, (access & RT_ACCESS_PARAMETERIZED_TYPE) != 0,
    2620 [ +  - ][ +  - ]:       6568 :             m_reader.getFieldTypeName(i));
    2621         [ +  - ]:       6568 :         o << "\n";
    2622                 :            :     }
    2623         [ +  - ]:       1826 :     dec();
    2624         [ +  - ]:       1826 :     o << "{\n}\n\n";
    2625                 :            : 
    2626 [ -  + ][ #  # ]:       1826 :     if (fieldCount > 0 || getInheritedMemberCount() > 0)
         [ #  # ][ +  - ]
    2627                 :            :     {
    2628         [ +  - ]:       1826 :         dumpTemplateHead(o);
    2629 [ +  - ][ +  - ]:       1826 :         o << "inline " << m_name;
    2630         [ +  - ]:       1826 :         dumpTemplateParameters(o);
    2631 [ +  - ][ +  - ]:       1826 :         o << "::" << m_name << "(";
                 [ +  - ]
    2632                 :            : 
    2633         [ +  - ]:       1826 :         sal_Bool superHasMember = dumpSuperMember(o, superType, sal_True);
    2634                 :            : 
    2635         [ +  + ]:       8394 :         for (sal_uInt16 i=0; i < fieldCount; i++)
    2636                 :            :         {
    2637                 :       6568 :             access = m_reader.getFieldFlags(i);
    2638                 :            : 
    2639 [ -  + ][ +  - ]:       6568 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    2640                 :          0 :                 continue;
    2641                 :            : 
    2642                 :            :             fieldName = rtl::OUStringToOString(
    2643 [ +  - ][ +  - ]:       6568 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    2644                 :            :             fieldType = rtl::OUStringToOString(
    2645 [ +  - ][ +  - ]:       6568 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    2646                 :            : 
    2647         [ +  + ]:       6568 :             if (superHasMember)
    2648         [ +  - ]:       5202 :                 o << ", ";
    2649                 :            :             else
    2650                 :       1366 :                 superHasMember = sal_True;
    2651                 :            : 
    2652         [ +  + ]:       6568 :             if ((access & RT_ACCESS_PARAMETERIZED_TYPE) != 0) {
    2653         [ +  - ]:         28 :                 dumpTypeParameterName(o, fieldType);
    2654         [ +  - ]:         28 :                 o << " const &";
    2655                 :            :             } else {
    2656         [ +  - ]:       6540 :                 dumpType(o, fieldType, sal_True, sal_True);
    2657                 :            :             }
    2658                 :            : //          o << " __" << fieldName;
    2659 [ +  - ][ +  - ]:       6568 :             o << " " << fieldName << "_";
                 [ +  - ]
    2660                 :            :         }
    2661         [ +  - ]:       1826 :         o << ") SAL_THROW(())\n";
    2662                 :            : 
    2663                 :       1826 :         inc();
    2664                 :       1826 :         first = sal_True;
    2665         [ +  + ]:       1826 :         if (!superType.isEmpty())
    2666                 :            :         {
    2667 [ +  - ][ +  - ]:        460 :             o << indent() << ": " << scopedCppName(superType) << "(";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    2668         [ +  - ]:        460 :             dumpSuperMember(o, superType, sal_False);
    2669         [ +  - ]:        460 :             o << ")\n";
    2670                 :        460 :             first = sal_False;
    2671                 :            :         }
    2672                 :            : 
    2673         [ +  + ]:       8394 :         for (sal_uInt16 i=0; i < fieldCount; i++)
    2674                 :            :         {
    2675                 :       6568 :             access = m_reader.getFieldFlags(i);
    2676                 :            : 
    2677 [ -  + ][ +  - ]:       6568 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    2678                 :          0 :                 continue;
    2679                 :            : 
    2680                 :            :             fieldName = rtl::OUStringToOString(
    2681 [ +  - ][ +  - ]:       6568 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    2682                 :            : 
    2683         [ +  + ]:       6568 :             if (first)
    2684                 :            :             {
    2685                 :       1366 :                 first = sal_False;
    2686 [ +  - ][ +  - ]:       1366 :                 o << indent() << ": ";
                 [ +  - ]
    2687                 :            :             } else
    2688 [ +  - ][ +  - ]:       5202 :                 o << indent() << ", ";
                 [ +  - ]
    2689                 :            : 
    2690                 :            : //          o << fieldName << "(__" << fieldName << ")\n";
    2691 [ +  - ][ +  - ]:       6568 :             o << fieldName << "(" << fieldName << "_)\n";
         [ +  - ][ +  - ]
    2692                 :            :         }
    2693                 :            : 
    2694         [ +  - ]:       1826 :         dec();
    2695         [ +  - ]:       1826 :         o << "{\n}\n\n";
    2696                 :            :     }
    2697                 :            : 
    2698 [ +  - ][ +  + ]:       1826 :     if (isPolymorphic() && fieldCount > 0) {
         [ +  - ][ +  + ]
    2699 [ +  - ][ +  - ]:         24 :         o << indent();
    2700         [ +  - ]:         24 :         dumpTemplateHead(o);
    2701         [ +  - ]:         24 :         o << "\n";
    2702 [ +  - ][ +  - ]:         24 :         o << indent();
    2703 [ +  - ][ +  - ]:         24 :         o << "inline " << m_name;
    2704         [ +  - ]:         24 :         dumpTemplateParameters(o);
    2705         [ +  - ]:         24 :         o << "\n";
    2706 [ +  - ][ +  - ]:         24 :         o << indent();
    2707 [ +  - ][ +  - ]:         24 :         o << "make_" << m_name << "(";
                 [ +  - ]
    2708         [ +  + ]:         68 :         for (sal_uInt16 i = 0; i < fieldCount; ++i) {
    2709         [ +  + ]:         44 :             if (i > 0) {
    2710         [ +  - ]:         20 :                 o << ", ";
    2711                 :            :             }
    2712                 :            :             rtl::OString type(
    2713                 :            :                 rtl::OUStringToOString(
    2714 [ +  - ][ +  - ]:         44 :                     m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    2715         [ +  + ]:         44 :             if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0)
    2716                 :            :             {
    2717         [ +  - ]:         28 :                 dumpTypeParameterName(o, type);
    2718         [ +  - ]:         28 :                 o << " const &";
    2719                 :            :             } else {
    2720         [ +  - ]:         16 :                 dumpType(o, type, true, true);
    2721                 :            :             }
    2722         [ +  - ]:         44 :             o << " "
    2723                 :            :               << rtl::OUStringToOString(
    2724 [ +  - ][ +  - ]:        132 :                   m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8)
                 [ +  - ]
    2725         [ +  - ]:         44 :               << "_";
    2726                 :         44 :         }
    2727         [ +  - ]:         24 :         o << ") SAL_THROW(())\n";
    2728 [ +  - ][ +  - ]:         24 :         o << indent() << "{\n";
                 [ +  - ]
    2729                 :         24 :         inc();
    2730 [ +  - ][ +  - ]:         24 :         o << indent() << "return " << m_name;
         [ +  - ][ +  - ]
    2731         [ +  - ]:         24 :         dumpTemplateParameters(o);
    2732         [ +  - ]:         24 :         o << "(";
    2733         [ +  + ]:         68 :         for (sal_uInt16 i = 0; i < fieldCount; ++i) {
    2734         [ +  + ]:         44 :             if (i > 0) {
    2735         [ +  - ]:         20 :                 o << ", ";
    2736                 :            :             }
    2737                 :            :             o << rtl::OUStringToOString(
    2738 [ +  - ][ +  - ]:         88 :                   m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8)
                 [ +  - ]
    2739         [ +  - ]:         44 :               << "_";
    2740                 :            :         }
    2741         [ +  - ]:         24 :         o << ");\n";
    2742         [ +  - ]:         24 :         dec();
    2743 [ +  - ][ +  - ]:         24 :         o << indent() << "}\n\n";
                 [ +  - ]
    2744                 :            :     }
    2745                 :            : 
    2746 [ +  - ][ +  + ]:       1826 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
    2747         [ +  - ]:       1814 :         o << "\n";
    2748                 :            :     }
    2749                 :            : 
    2750         [ +  - ]:       1826 :     o << "\n";
    2751         [ +  - ]:       1826 :     dumpGetCppuType(o);
    2752                 :            : 
    2753 [ +  - ][ +  - ]:       1826 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    2754                 :            : 
    2755                 :       1826 :     return sal_True;
    2756                 :            : }
    2757                 :            : 
    2758                 :        900 : void StructureType::dumpLightGetCppuType(FileStream & out) {
    2759                 :        900 :     dumpGetCppuTypePreamble(out);
    2760 [ +  - ][ +  - ]:       1800 :     out << indent()
    2761                 :            :         << ("//TODO: On certain platforms with weak memory models, the"
    2762                 :            :             " following code can result in some threads observing that the_type"
    2763         [ +  - ]:        900 :             " points to garbage\n")
    2764 [ +  - ][ +  - ]:       2700 :         << indent()
    2765         [ +  - ]:        900 :         << "static ::typelib_TypeDescriptionReference * the_type = 0;\n"
    2766 [ +  - ][ +  - ]:       2700 :         << indent() << "if (the_type == 0) {\n";
    2767                 :        900 :     inc();
    2768         [ +  + ]:        900 :     if (isPolymorphic()) {
    2769 [ +  - ][ +  - ]:         24 :         out << indent() << "::rtl::OStringBuffer the_buffer(\""
                 [ +  - ]
    2770 [ +  - ][ +  - ]:         36 :             << m_typeName.replace('/', '.') << "<\");\n";
    2771                 :         12 :         sal_uInt16 n = m_reader.getReferenceCount();
    2772         [ +  + ]:         28 :         for (sal_uInt16 i = 0; i < n; ++i) {
    2773         [ +  - ]:         32 :             out << indent()
    2774                 :            :                 << ("the_buffer.append(::rtl::OUStringToOString("
    2775         [ +  - ]:         16 :                     "::cppu::getTypeFavourChar(static_cast< ");
    2776                 :            :             dumpTypeParameterName(
    2777                 :            :                 out,
    2778                 :            :                 rtl::OUStringToOString(
    2779 [ +  - ][ +  - ]:         16 :                     m_reader.getReferenceTypeName(i), RTL_TEXTENCODING_UTF8));
    2780                 :         16 :             out << " * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8));\n";
    2781         [ +  + ]:         16 :             if (i != n - 1) {
    2782 [ +  - ][ +  - ]:          4 :                 out << indent() << "the_buffer.append(',');\n";
    2783                 :            :             }
    2784                 :            :         }
    2785 [ +  - ][ +  - ]:         12 :         out << indent() << "the_buffer.append('>');\n";
    2786                 :            :     }
    2787 [ +  - ][ +  - ]:       1800 :     out << indent() << "::typelib_static_type_init(&the_type, "
                 [ +  - ]
    2788 [ +  - ][ +  - ]:       2700 :         << getTypeClass(m_typeName, true) << ", ";
    2789         [ +  + ]:        900 :     if (isPolymorphic()) {
    2790                 :         12 :         out << "the_buffer.getStr()";
    2791                 :            :     } else {
    2792 [ +  - ][ +  - ]:        888 :         out << "\"" << m_typeName.replace('/', '.') << "\"";
                 [ +  - ]
    2793                 :            :     }
    2794                 :        900 :     out << ");\n";
    2795                 :        900 :     dec();
    2796 [ +  - ][ +  - ]:       1800 :     out << indent() << "}\n" << indent()
         [ +  - ][ +  - ]
    2797                 :            :         << ("return *reinterpret_cast< ::com::sun::star::uno::Type * >("
    2798         [ +  - ]:        900 :             "&the_type);\n");
    2799                 :        900 :     dumpGetCppuTypePostamble(out);
    2800                 :        900 : }
    2801                 :            : 
    2802                 :         10 : void StructureType::dumpNormalGetCppuType(FileStream & out) {
    2803                 :         10 :     dumpGetCppuTypePreamble(out);
    2804 [ +  - ][ +  - ]:         20 :     out << indent()
    2805                 :            :         << ("//TODO: On certain platforms with weak memory models, the"
    2806                 :            :             " following code can result in some threads observing that the_type"
    2807         [ +  - ]:         10 :             " points to garbage\n")
    2808 [ +  - ][ +  - ]:         30 :         << indent()
    2809         [ +  - ]:         10 :         << "static ::typelib_TypeDescriptionReference * the_type = 0;\n"
    2810 [ +  - ][ +  - ]:         30 :         << indent() << "if (the_type == 0) {\n";
    2811                 :         10 :     inc();
    2812         [ -  + ]:         10 :     if (isPolymorphic()) {
    2813 [ #  # ][ #  # ]:          0 :         out << indent() << "::rtl::OStringBuffer the_buffer(\""
                 [ #  # ]
    2814 [ #  # ][ #  # ]:          0 :             << m_typeName.replace('/', '.') << "<\");\n";
    2815                 :          0 :         sal_uInt16 n = m_reader.getReferenceCount();
    2816         [ #  # ]:          0 :         for (sal_uInt16 i = 0; i < n; ++i) {
    2817         [ #  # ]:          0 :             out << indent()
    2818                 :            :                 << ("the_buffer.append(::rtl::OUStringToOString("
    2819         [ #  # ]:          0 :                     "::cppu::getTypeFavourChar(static_cast< ");
    2820                 :            :             dumpTypeParameterName(
    2821                 :            :                 out,
    2822                 :            :                 rtl::OUStringToOString(
    2823 [ #  # ][ #  # ]:          0 :                     m_reader.getReferenceTypeName(i), RTL_TEXTENCODING_UTF8));
    2824                 :          0 :             out << " * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8));\n";
    2825         [ #  # ]:          0 :             if (i != n - 1) {
    2826 [ #  # ][ #  # ]:          0 :                 out << indent() << "the_buffer.append(',');\n";
    2827                 :            :             }
    2828                 :            :         }
    2829 [ #  # ][ #  # ]:          0 :         out << indent() << "the_buffer.append('>');\n";
    2830                 :            :     }
    2831         [ +  - ]:         20 :     out << indent()
    2832         [ +  - ]:         10 :         << "::typelib_TypeDescriptionReference * the_members[] = {\n";
    2833                 :         10 :     inc();
    2834                 :         10 :     sal_uInt16 fields = m_reader.getFieldCount();
    2835         [ +  + ]:         42 :     for (sal_uInt16 i = 0; i < fields; ++i) {
    2836 [ +  - ][ +  - ]:         32 :         out << indent();
    2837                 :            :         rtl::OString type(
    2838                 :            :             rtl::OUStringToOString(
    2839 [ +  - ][ +  - ]:         32 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    2840         [ -  + ]:         32 :         if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0) {
    2841         [ #  # ]:          0 :             out << "::cppu::getTypeFavourChar(static_cast< ";
    2842         [ #  # ]:          0 :             dumpTypeParameterName(out, type);
    2843         [ #  # ]:          0 :             out << " * >(0))";
    2844                 :            :         } else {
    2845         [ +  - ]:         32 :             out << "::cppu::UnoType< ";
    2846         [ +  - ]:         32 :             dumpType(out, type, false, false, false, true);
    2847         [ +  - ]:         32 :             out << " >::get()";
    2848                 :            :         }
    2849 [ +  + ][ +  - ]:         32 :         out << ".getTypeLibType()" << (i == fields - 1 ? " };" : ",")
                 [ +  - ]
    2850         [ +  - ]:         32 :             << "\n";
    2851                 :         32 :     }
    2852                 :         10 :     dec();
    2853         [ -  + ]:         10 :     if (isPolymorphic()) {
    2854         [ #  # ]:          0 :         out << indent()
    2855         [ #  # ]:          0 :             << "static ::sal_Bool const the_parameterizedTypes[] = { ";
    2856         [ #  # ]:          0 :         for (sal_uInt16 i = 0; i < fields; ++i) {
    2857         [ #  # ]:          0 :             if (i != 0) {
    2858                 :          0 :                 out << ", ";
    2859                 :            :             }
    2860                 :          0 :             out << (((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE)
    2861                 :            :                      == 0)
    2862         [ #  # ]:          0 :                     ? "false" : "true");
    2863                 :            :         }
    2864                 :          0 :         out << " };\n";
    2865                 :            :     }
    2866 [ +  - ][ +  - ]:         10 :     out << indent() << "::typelib_static_struct_type_init(&the_type, ";
    2867         [ -  + ]:         10 :     if (isPolymorphic()) {
    2868                 :          0 :         out << "the_buffer.getStr()";
    2869                 :            :     } else {
    2870 [ +  - ][ +  - ]:         10 :         out << "\"" << m_typeName.replace('/', '.') << "\"";
                 [ +  - ]
    2871                 :            :     }
    2872                 :         10 :     out << ", ";
    2873         [ +  + ]:         10 :     if (m_reader.getSuperTypeCount() == 0) {
    2874                 :          8 :         out << "0";
    2875                 :            :     } else {
    2876                 :          2 :         out << "::cppu::UnoType< ";
    2877                 :            :         dumpType(
    2878                 :            :             out,
    2879                 :            :             rtl::OUStringToOString(
    2880                 :            :                 m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8),
    2881 [ +  - ][ +  - ]:          2 :             false, false, false, true);
    2882                 :          2 :         out << " >::get().getTypeLibType()";
    2883                 :            :     }
    2884                 :         10 :     out << ", " << fields << ", the_members, "
    2885         [ -  + ]:         20 :         << (isPolymorphic() ? "the_parameterizedTypes" : "0") << ");\n";
    2886                 :         10 :     dec();
    2887 [ +  - ][ +  - ]:         20 :     out << indent() << "}\n" << indent()
         [ +  - ][ +  - ]
    2888                 :            :         << ("return *reinterpret_cast< ::com::sun::star::uno::Type * >("
    2889         [ +  - ]:         10 :             "&the_type);\n");
    2890                 :         10 :     dumpGetCppuTypePostamble(out);
    2891                 :         10 : }
    2892                 :            : 
    2893                 :        916 : void StructureType::dumpComprehensiveGetCppuType(FileStream & out)
    2894                 :            : {
    2895 [ +  - ][ +  + ]:        916 :     if (!isPolymorphic())
    2896         [ +  - ]:        904 :         codemaker::cppumaker::dumpNamespaceOpen(out, m_typeName, false);
    2897                 :            :     else
    2898         [ +  - ]:         12 :         out << "namespace cppu { ";
    2899         [ +  - ]:        916 :     out << " namespace detail {\n\n";
    2900                 :            : 
    2901                 :        916 :     OString sType = m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
    2902                 :        916 :     OString sStaticTypeClass = "the" + sType + "Type";
    2903 [ +  - ][ +  - ]:        916 :     out << indent();
    2904 [ +  + ][ +  - ]:        916 :     if (isPolymorphic())
    2905         [ +  - ]:         12 :         dumpTemplateHead(out);
    2906 [ +  - ][ +  - ]:        916 :     out << "struct " << sStaticTypeClass << " : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, ";
                 [ +  - ]
    2907         [ +  - ]:        916 :     out << sStaticTypeClass;
    2908 [ +  - ][ +  + ]:        916 :     if (isPolymorphic())
    2909         [ +  - ]:         12 :         dumpTemplateParameters(out);
    2910         [ +  - ]:        916 :     out << " >\n";
    2911                 :            : 
    2912 [ +  - ][ +  - ]:        916 :     out << indent() << "{\n";
                 [ +  - ]
    2913                 :        916 :     inc();
    2914 [ +  - ][ +  - ]:        916 :     out << indent() << "::com::sun::star::uno::Type * operator()() const\n";
                 [ +  - ]
    2915 [ +  - ][ +  - ]:        916 :     out << indent() << "{\n";
                 [ +  - ]
    2916                 :            : 
    2917                 :        916 :     inc();
    2918 [ +  + ][ +  - ]:        916 :     if (isPolymorphic()) {
    2919 [ +  - ][ +  - ]:         24 :         out << indent() << "::rtl::OUStringBuffer the_buffer;\n" << indent()
         [ +  - ][ +  - ]
                 [ +  - ]
    2920         [ +  - ]:         12 :             << "the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM(\""
    2921 [ +  - ][ +  - ]:         36 :             << m_typeName.replace('/', '.') << "<\"));\n";
    2922                 :         12 :         sal_uInt16 n = m_reader.getReferenceCount();
    2923         [ +  + ]:         28 :         for (sal_uInt16 i = 0; i < n; ++i) {
    2924 [ +  - ][ +  - ]:         32 :             out << indent()
    2925         [ +  - ]:         16 :                 << "the_buffer.append(::cppu::getTypeFavourChar(static_cast< ";
    2926                 :            :             dumpTypeParameterName(
    2927                 :            :                 out,
    2928                 :            :                 rtl::OUStringToOString(
    2929 [ +  - ][ +  - ]:         16 :                     m_reader.getReferenceTypeName(i), RTL_TEXTENCODING_UTF8));
                 [ +  - ]
    2930         [ +  - ]:         16 :             out << " * >(0)).getTypeName());\n";
    2931         [ +  + ]:         16 :             if (i != n - 1) {
    2932 [ +  - ][ +  - ]:          8 :                 out << indent()
    2933                 :            :                     << ("the_buffer.append("
    2934         [ +  - ]:          4 :                         "static_cast< ::sal_Unicode >(','));\n");
    2935                 :            :             }
    2936                 :            :         }
    2937 [ +  - ][ +  - ]:         24 :         out << indent()
    2938         [ +  - ]:         12 :             << "the_buffer.append(static_cast< ::sal_Unicode >('>'));\n"
    2939 [ +  - ][ +  - ]:         36 :             << indent()
    2940         [ +  - ]:         12 :             << "::rtl::OUString the_name(the_buffer.makeStringAndClear());\n";
    2941                 :            :     } else {
    2942 [ +  - ][ +  - ]:       1808 :         out << indent()
    2943         [ +  - ]:        904 :             << "::rtl::OUString the_name(RTL_CONSTASCII_USTRINGPARAM(\""
    2944 [ +  - ][ +  - ]:       2712 :             << m_typeName.replace('/', '.') << "\"));\n";
    2945                 :            :     }
    2946                 :        916 :     sal_uInt16 fields = m_reader.getFieldCount();
    2947                 :            :     typedef std::map< rtl::OString, sal_uInt32 > Map;
    2948         [ +  - ]:        916 :     Map parameters;
    2949         [ +  - ]:        916 :     Map types;
    2950         [ +  + ]:       4198 :     {for (sal_uInt16 i = 0; i < fields; ++i) {
    2951                 :            :         rtl::OString type(
    2952                 :            :             rtl::OUStringToOString(
    2953 [ +  - ][ +  - ]:       3282 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    2954         [ +  + ]:       3282 :         if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0) {
    2955 [ +  - ][ +  - ]:         12 :             if (parameters.insert(
    2956                 :            :                     Map::value_type(
    2957                 :         12 :                         type, static_cast< sal_uInt32 >(parameters.size()))).
    2958                 :            :                 second)
    2959                 :            :             {
    2960                 :         12 :                 sal_uInt32 n = static_cast< sal_uInt32 >(parameters.size() - 1);
    2961 [ +  - ][ +  - ]:         24 :                 out << indent()
    2962 [ +  - ][ +  - ]:         12 :                     << "::com::sun::star::uno::Type const & the_ptype" << n
    2963         [ +  - ]:         12 :                     << " = ::cppu::getTypeFavourChar(static_cast< ";
    2964         [ +  - ]:         12 :                 dumpTypeParameterName(out, type);
    2965 [ +  - ][ +  - ]:         24 :                 out << " * >(0));\n" << indent()
                 [ +  - ]
    2966 [ +  - ][ +  - ]:         12 :                     << "::typelib_TypeClass the_pclass" << n
    2967 [ +  - ][ +  - ]:         12 :                     << " = (::typelib_TypeClass) the_ptype" << n
    2968 [ +  - ][ +  - ]:         36 :                     << ".getTypeClass();\n" << indent()
                 [ +  - ]
    2969 [ +  - ][ +  - ]:         12 :                     << "::rtl::OUString the_pname" << n << "(the_ptype" << n
         [ +  - ][ +  - ]
    2970         [ +  - ]:         12 :                     << ".getTypeName());\n";
    2971                 :            :             }
    2972 [ +  + ][ +  - ]:       3270 :         } else if (types.insert(
    2973                 :            :                        Map::value_type(
    2974                 :       3270 :                            type, static_cast< sal_uInt32 >(types.size()))).
    2975                 :            :                    second)
    2976                 :            :         {
    2977         [ +  - ]:       4582 :             if ((codemaker::UnoType::getSort(type) ==
           [ +  +  +  + ]
                 [ +  + ]
    2978                 :            :                  codemaker::UnoType::SORT_COMPLEX) &&
    2979 [ +  - ][ +  + ]:       2612 :                 codemaker::UnoType::decompose(type) != m_typeName)
                 [ #  # ]
    2980                 :            :                     // take care of recursion like struct S { sequence<S> x; };
    2981                 :            :             {
    2982 [ +  - ][ +  - ]:        640 :                 out << indent() << "::cppu::UnoType< ";
                 [ +  - ]
    2983         [ +  - ]:        640 :                 dumpType(out, type, false, false, false, true);
    2984         [ +  - ]:        640 :                 out << " >::get();\n";
    2985                 :            :             }
    2986                 :            :             // For typedefs, use the resolved type name, as there will be no
    2987                 :            :             // information available about the typedef itself at runtime (the
    2988                 :            :             // above getCppuType call will make available information about the
    2989                 :            :             // resolved type); no extra #include for the resolved type is
    2990                 :            :             // needed, as the header for the typedef includes it already:
    2991 [ +  - ][ +  - ]:       3940 :             out << indent() << "::rtl::OUString the_tname"
                 [ +  - ]
    2992         [ +  - ]:       3940 :                 << static_cast< sal_uInt32 >(types.size() - 1)
    2993         [ +  - ]:       1970 :                 << "(RTL_CONSTASCII_USTRINGPARAM(\""
    2994 [ +  - ][ +  - ]:       5910 :                 << checkRealBaseType(type, true).replace('/', '.') << "\"));\n";
                 [ +  - ]
    2995                 :            :         }
    2996 [ +  - ][ +  - ]:       6564 :         out << indent() << "::rtl::OUString the_name" << i
         [ +  - ][ +  - ]
    2997         [ +  - ]:       3282 :             << "(RTL_CONSTASCII_USTRINGPARAM(\""
    2998                 :            :             << rtl::OUStringToOString(
    2999                 :            :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8).replace(
    3000 [ +  - ][ +  - ]:       9846 :                     '/', '.')
                 [ +  - ]
    3001         [ +  - ]:       3282 :             << "\"));\n";
    3002                 :       3282 :     }}
    3003 [ +  - ][ +  - ]:        916 :     out << indent() << "::typelib_StructMember_Init the_members[] = {\n";
                 [ +  - ]
    3004                 :        916 :     inc();
    3005         [ +  + ]:       4198 :     {for (sal_uInt16 i = 0; i < fields; ++i) {
    3006 [ +  - ][ +  - ]:       3282 :         out << indent() << "{ { ";
                 [ +  - ]
    3007                 :            :         rtl::OString type(
    3008                 :            :             rtl::OUStringToOString(
    3009 [ +  - ][ +  - ]:       3282 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8));
    3010         [ +  + ]:       3282 :         if ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) != 0) {
    3011         [ +  - ]:         12 :             sal_uInt32 n = parameters.find(type)->second;
    3012 [ +  - ][ +  - ]:         12 :             out << "the_pclass" << n << ", the_pname" << n << ".pData";
         [ +  - ][ +  - ]
                 [ +  - ]
    3013                 :            :         } else {
    3014 [ +  - ][ +  - ]:       6540 :             out << getTypeClass(type, true) << ", the_tname"
                 [ +  - ]
    3015 [ +  - ][ +  - ]:       9810 :                 << types.find(type)->second << ".pData";
                 [ +  - ]
    3016                 :            :         }
    3017 [ +  - ][ +  - ]:       3282 :         out << ", the_name" << i << ".pData }, "
                 [ +  - ]
    3018                 :       3282 :             << ((m_reader.getFieldFlags(i) & RT_ACCESS_PARAMETERIZED_TYPE) == 0
    3019 [ +  - ][ +  + ]:       6564 :                 ? "false" : "true")
    3020 [ +  + ][ +  - ]:       6564 :             << " }" << (i == fields - 1 ? " };" : ",") << "\n";
         [ +  - ][ +  - ]
    3021                 :       3282 :     }}
    3022         [ +  - ]:        916 :     dec();
    3023 [ +  - ][ +  - ]:        916 :     out << indent() << "::typelib_TypeDescription * the_newType = 0;\n";
                 [ +  - ]
    3024 [ +  - ][ +  - ]:       1832 :     out << indent()
    3025         [ +  - ]:        916 :         << "::typelib_typedescription_newStruct(&the_newType, the_name.pData, ";
    3026         [ +  + ]:        916 :     if (m_reader.getSuperTypeCount() == 0) {
    3027         [ +  - ]:        686 :         out << "0";
    3028                 :            :     } else {
    3029         [ +  - ]:        230 :         out << "::cppu::UnoType< ";
    3030                 :            :         dumpType(
    3031                 :            :             out,
    3032                 :            :             rtl::OUStringToOString(
    3033                 :            :                 m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8),
    3034 [ +  - ][ +  - ]:        230 :             false, false, false, true);
                 [ +  - ]
    3035         [ +  - ]:        230 :         out << " >::get().getTypeLibType()";
    3036                 :            :     }
    3037 [ +  - ][ +  - ]:        916 :     out << ", " << fields << ", the_members);\n";
                 [ +  - ]
    3038 [ +  - ][ +  - ]:        916 :     out << indent() << "::typelib_typedescription_register(&the_newType);\n";
                 [ +  - ]
    3039 [ +  - ][ +  - ]:        916 :     out << indent() << "::typelib_typedescription_release(the_newType);\n";
                 [ +  - ]
    3040                 :            : 
    3041 [ +  - ][ +  - ]:       1832 :     out << indent() << "return new ::com::sun::star::uno::Type("
                 [ +  - ]
    3042 [ +  - ][ +  - ]:       2748 :         << getTypeClass(m_typeName) << ", the_name); // leaked\n";
                 [ +  - ]
    3043         [ +  - ]:        916 :     dec();
    3044 [ +  - ][ +  - ]:        916 :     out << indent() << "}\n";
                 [ +  - ]
    3045         [ +  - ]:        916 :     dec();
    3046 [ +  - ][ +  - ]:        916 :     out << indent() << "};\n";
                 [ +  - ]
    3047                 :            : 
    3048 [ +  + ][ +  - ]:        916 :     if (!isPolymorphic())
    3049         [ +  - ]:        904 :         codemaker::cppumaker::dumpNamespaceClose(out, m_typeName, false);
    3050                 :            :     else
    3051         [ +  - ]:         12 :         out << " }";
    3052         [ +  - ]:        916 :     out << " }\n\n";
    3053                 :            : 
    3054         [ +  - ]:        916 :     dumpGetCppuTypePreamble(out);
    3055 [ +  - ][ +  - ]:        916 :     out  << indent() << "return *detail::" << sStaticTypeClass;
         [ +  - ][ +  - ]
    3056 [ +  + ][ +  - ]:        916 :     if (isPolymorphic())
    3057         [ +  - ]:         12 :         dumpTemplateParameters(out);
    3058         [ +  - ]:        916 :     out  << "::get();\n";
    3059         [ +  - ]:        916 :     dumpGetCppuTypePostamble(out);
    3060                 :        916 : }
    3061                 :            : 
    3062                 :       5684 : sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, sal_Bool bWithType)
    3063                 :            : {
    3064                 :       5684 :     sal_Bool hasMember = sal_False;
    3065                 :            : 
    3066         [ +  + ]:       5684 :     if (!superType.isEmpty())
    3067                 :            :     {
    3068         [ +  - ]:       1572 :         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
    3069                 :            : 
    3070         [ +  - ]:       1572 :         if (aSuperReader.isValid())
    3071                 :            :         {
    3072                 :       1572 :             rtl::OString superSuper;
    3073         [ +  + ]:       1572 :             if (aSuperReader.getSuperTypeCount() >= 1) {
    3074                 :            :                 superSuper = rtl::OUStringToOString(
    3075 [ +  - ][ +  - ]:        192 :                     aSuperReader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    3076                 :            :             }
    3077         [ +  - ]:       1572 :             hasMember = dumpSuperMember(o, superSuper, bWithType);
    3078                 :            : 
    3079                 :       1572 :             sal_uInt16      fieldCount = aSuperReader.getFieldCount();
    3080                 :       1572 :             RTFieldAccess   access = RT_ACCESS_INVALID;
    3081                 :       1572 :             OString         fieldName;
    3082                 :       1572 :             OString         fieldType;
    3083         [ +  + ]:       4518 :             for (sal_uInt16 i=0; i < fieldCount; i++)
    3084                 :            :             {
    3085                 :       2946 :                 access = aSuperReader.getFieldFlags(i);
    3086                 :            : 
    3087 [ -  + ][ +  - ]:       2946 :                 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3088                 :          0 :                     continue;
    3089                 :            : 
    3090                 :            :                 fieldName = rtl::OUStringToOString(
    3091 [ +  - ][ +  - ]:       2946 :                     aSuperReader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3092                 :            :                 fieldType = rtl::OUStringToOString(
    3093 [ +  - ][ +  - ]:       2946 :                     aSuperReader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    3094                 :            : 
    3095         [ +  + ]:       2946 :                 if (hasMember)
    3096                 :            :                 {
    3097         [ +  - ]:       1566 :                     o << ", ";
    3098                 :            :                 } else
    3099                 :            :                 {
    3100                 :       1380 :                     hasMember = (fieldCount > 0);
    3101                 :            :                 }
    3102                 :            : 
    3103         [ +  + ]:       2946 :                 if (bWithType)
    3104                 :            :                 {
    3105         [ +  - ]:       1964 :                     dumpType(o, fieldType, sal_True, sal_True);
    3106         [ +  - ]:       1964 :                     o << " ";
    3107                 :            :                 }
    3108                 :            : //              o << "__" << fieldName;
    3109 [ +  - ][ +  - ]:       2946 :                 o << fieldName << "_";
    3110                 :       1572 :             }
    3111                 :       1572 :         }
    3112                 :            :     }
    3113                 :            : 
    3114                 :       5684 :     return hasMember;
    3115                 :            : }
    3116                 :            : 
    3117                 :        900 : void StructureType::addLightGetCppuTypeIncludes(
    3118                 :            :     codemaker::cppumaker::Includes & includes) const
    3119                 :            : {
    3120                 :        900 :     includes.addType();
    3121                 :        900 :     includes.addCppuUnotypeHxx();
    3122                 :        900 :     includes.addSalTypesH();
    3123                 :        900 :     includes.addTypelibTypeclassH();
    3124                 :        900 :     includes.addTypelibTypedescriptionH();
    3125         [ +  + ]:        900 :     if (isPolymorphic()) {
    3126                 :         12 :         includes.addRtlStrbufHxx();
    3127                 :         12 :         includes.addRtlTextencH();
    3128                 :         12 :         includes.addRtlUstringHxx();
    3129                 :            :     }
    3130                 :        900 : }
    3131                 :            : 
    3132                 :         10 : void StructureType::addNormalGetCppuTypeIncludes(
    3133                 :            :     codemaker::cppumaker::Includes & includes) const
    3134                 :            : {
    3135                 :         10 :     includes.addType();
    3136                 :         10 :     includes.addCppuUnotypeHxx();
    3137                 :         10 :     includes.addSalTypesH();
    3138                 :         10 :     includes.addTypelibTypeclassH();
    3139                 :         10 :     includes.addTypelibTypedescriptionH();
    3140         [ -  + ]:         10 :     if (isPolymorphic()) {
    3141                 :          0 :         includes.addRtlStrbufHxx();
    3142                 :          0 :         includes.addRtlTextencH();
    3143                 :          0 :         includes.addRtlUstringHxx();
    3144                 :            :     }
    3145                 :         10 : }
    3146                 :            : 
    3147                 :        916 : void StructureType::addComprehensiveGetCppuTypeIncludes(
    3148                 :            :     codemaker::cppumaker::Includes & includes) const
    3149                 :            : {
    3150                 :        916 :     includes.addType();
    3151                 :        916 :     includes.addCppuUnotypeHxx();
    3152                 :        916 :     includes.addRtlInstanceHxx();
    3153                 :        916 :     includes.addOslMutexHxx();
    3154                 :        916 :     includes.addRtlUstringH();
    3155                 :        916 :     includes.addRtlUstringHxx();
    3156                 :        916 :     includes.addSalTypesH();
    3157                 :        916 :     includes.addTypelibTypeclassH();
    3158                 :        916 :     includes.addTypelibTypedescriptionH();
    3159         [ +  + ]:        916 :     if (isPolymorphic()) {
    3160                 :         12 :         includes.addRtlStringH();
    3161                 :         12 :         includes.addRtlUstrbufHxx();
    3162                 :            :     }
    3163                 :        916 : }
    3164                 :            : 
    3165                 :      34882 : bool StructureType::isPolymorphic() const {
    3166                 :      34882 :     return m_reader.getReferenceCount() > 0;
    3167                 :            : }
    3168                 :            : 
    3169                 :       9190 : void StructureType::dumpTemplateHead(FileStream & out) const {
    3170         [ +  + ]:       9190 :     if (isPolymorphic()) {
    3171                 :        180 :         out << "template< ";
    3172         [ +  + ]:        420 :         for (sal_uInt16 i = 0; i < m_reader.getReferenceCount(); ++i) {
    3173         [ +  + ]:        240 :             if (i != 0) {
    3174                 :         60 :                 out << ", ";
    3175                 :            :             }
    3176                 :            :             OSL_ASSERT(
    3177                 :            :                 m_reader.getReferenceFlags(i) == RT_ACCESS_INVALID
    3178                 :            :                 && m_reader.getReferenceSort(i) == RT_REF_TYPE_PARAMETER);
    3179                 :        240 :             out << "typename ";
    3180                 :            :             dumpTypeParameterName(
    3181                 :            :                 out,
    3182                 :            :                 rtl::OUStringToOString(
    3183 [ +  - ][ +  - ]:        240 :                     m_reader.getReferenceTypeName(i), RTL_TEXTENCODING_UTF8));
    3184                 :            :         }
    3185                 :        180 :         out << " > ";
    3186                 :            :     }
    3187                 :       9190 : }
    3188                 :            : 
    3189                 :       9226 : void StructureType::dumpTemplateParameters(FileStream & out) const {
    3190         [ +  + ]:       9226 :     if (isPolymorphic()) {
    3191                 :        216 :         out << "< ";
    3192         [ +  + ]:        504 :         for (sal_uInt16 i = 0; i < m_reader.getReferenceCount(); ++i) {
    3193         [ +  + ]:        288 :             if (i != 0) {
    3194                 :         72 :                 out << ", ";
    3195                 :            :             }
    3196                 :            :             OSL_ASSERT(
    3197                 :            :                 m_reader.getReferenceFlags(i) == RT_ACCESS_INVALID
    3198                 :            :                 && m_reader.getReferenceSort(i) == RT_REF_TYPE_PARAMETER);
    3199                 :            :             dumpTypeParameterName(
    3200                 :            :                 out,
    3201                 :            :                 rtl::OUStringToOString(
    3202 [ +  - ][ +  - ]:        288 :                     m_reader.getReferenceTypeName(i), RTL_TEXTENCODING_UTF8));
    3203                 :            :         }
    3204                 :        216 :         out << " >";
    3205                 :            :     }
    3206                 :       9226 : }
    3207                 :            : 
    3208                 :            : //*************************************************************************
    3209                 :            : // ExceptionType
    3210                 :            : //*************************************************************************
    3211                 :       1048 : ExceptionType::ExceptionType(typereg::Reader& typeReader,
    3212                 :            :                               const OString& typeName,
    3213                 :            :                              const TypeManager& typeMgr)
    3214                 :       1048 :     : CppuType(typeReader, typeName, typeMgr)
    3215                 :            : {
    3216                 :       1048 : }
    3217                 :            : 
    3218                 :       1048 : ExceptionType::~ExceptionType()
    3219                 :            : {
    3220                 :            : 
    3221         [ -  + ]:       1048 : }
    3222                 :            : 
    3223                 :       1048 : sal_Bool ExceptionType::dumpHFile(
    3224                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3225                 :            :     throw( CannotDumpException )
    3226                 :            : {
    3227                 :       1048 :     dumpHFileContent(o, includes);
    3228                 :       1048 :     return sal_True;
    3229                 :            : }
    3230                 :            : 
    3231                 :       1048 : void ExceptionType::dumpDeclaration(FileStream& o)
    3232                 :            :     throw( CannotDumpException )
    3233                 :            : {
    3234 [ +  - ][ +  - ]:       1048 :     o << "\nclass CPPU_GCC_DLLPUBLIC_EXPORT " << m_name;
    3235                 :            : 
    3236                 :       1048 :     OString superType;
    3237         [ +  + ]:       1048 :     if (m_reader.getSuperTypeCount() >= 1) {
    3238                 :            :         superType = rtl::OUStringToOString(
    3239 [ +  - ][ +  - ]:       1040 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    3240                 :            :     }
    3241         [ +  + ]:       1048 :     if (!superType.isEmpty())
    3242 [ +  - ][ +  - ]:       1040 :                     o << " : public " << scopedCppName(superType);
                 [ +  - ]
    3243                 :            : 
    3244         [ +  - ]:       1048 :     o << "\n{\npublic:\n";
    3245                 :       1048 :     inc();
    3246 [ +  - ][ +  - ]:       2096 :     o << indent() << "inline CPPU_GCC_DLLPRIVATE " << m_name
         [ +  - ][ +  - ]
    3247         [ +  - ]:       1048 :       << "() SAL_THROW(());\n\n";
    3248                 :            : 
    3249                 :       1048 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
    3250                 :       1048 :     RTFieldAccess   access = RT_ACCESS_INVALID;
    3251                 :       1048 :     OString         fieldName;
    3252                 :       1048 :     OString         fieldType;
    3253                 :       1048 :     sal_uInt16      i = 0;
    3254                 :            : 
    3255 [ +  - ][ +  - ]:       1048 :     if (fieldCount > 0 || getInheritedMemberCount() > 0)
         [ +  - ][ +  + ]
    3256                 :            :     {
    3257 [ +  - ][ +  - ]:       1048 :         o << indent() << "inline CPPU_GCC_DLLPRIVATE " << m_name << "(";
         [ +  - ][ +  - ]
                 [ +  - ]
    3258                 :            : 
    3259         [ +  - ]:       1048 :         sal_Bool superHasMember = dumpSuperMember(o, superType, sal_True);
    3260                 :            : 
    3261         [ +  + ]:       1710 :         for (i=0; i < fieldCount; i++)
    3262                 :            :         {
    3263                 :        662 :             access = m_reader.getFieldFlags(i);
    3264                 :            : 
    3265 [ -  + ][ +  - ]:        662 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3266                 :          0 :                             continue;
    3267                 :            : 
    3268                 :            :             fieldName = rtl::OUStringToOString(
    3269 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3270                 :            :             fieldType = rtl::OUStringToOString(
    3271 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    3272                 :            : 
    3273         [ +  + ]:        662 :             if (superHasMember)
    3274         [ +  - ]:        654 :                 o << ", ";
    3275                 :            :             else
    3276                 :          8 :                 superHasMember = sal_True;
    3277                 :            : 
    3278         [ +  - ]:        662 :             dumpType(o, fieldType, sal_True, sal_True);
    3279                 :            : //          o << " __" << fieldName;
    3280 [ +  - ][ +  - ]:        662 :             o << " " << fieldName << "_";
                 [ +  - ]
    3281                 :            :         }
    3282         [ +  - ]:       1048 :         o << ") SAL_THROW(());\n\n";
    3283                 :            :     }
    3284 [ +  - ][ +  - ]:       2096 :     o << indent() << "inline CPPU_GCC_DLLPRIVATE " << m_name << "(" << m_name
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3285         [ +  - ]:       1048 :       << " const &);\n\n"
    3286 [ +  - ][ +  - ]:       3144 :       << indent() << "inline CPPU_GCC_DLLPRIVATE ~" << m_name << "();\n\n"
         [ +  - ][ +  - ]
                 [ +  - ]
    3287 [ +  - ][ +  - ]:       3144 :       << indent() << "inline CPPU_GCC_DLLPRIVATE " << m_name << " & operator =("
         [ +  - ][ +  - ]
                 [ +  - ]
    3288 [ +  - ][ +  - ]:       1048 :       << m_name << " const &);\n\n";
    3289                 :            : 
    3290         [ +  + ]:       1710 :     for (i=0; i < fieldCount; i++)
    3291                 :            :     {
    3292                 :        662 :         access = m_reader.getFieldFlags(i);
    3293                 :            : 
    3294 [ -  + ][ +  - ]:        662 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3295                 :          0 :             continue;
    3296                 :            : 
    3297                 :            :         fieldName = rtl::OUStringToOString(
    3298 [ +  - ][ +  - ]:        662 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3299                 :            :         fieldType = rtl::OUStringToOString(
    3300 [ +  - ][ +  - ]:        662 :             m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    3301                 :            : 
    3302 [ +  - ][ +  - ]:        662 :         o << indent();
    3303         [ +  - ]:        662 :         dumpType(o, fieldType);
    3304 [ +  - ][ +  - ]:        662 :         o << " " << fieldName;
    3305 [ +  + ][ +  +  :       2530 :         if (i == 0 && !superType.isEmpty() &&
          +  -  +  -  +  
              - ][ +  + ]
    3306 [ +  + ][ +  + ]:       1868 :             !fieldType.equals("double") && !fieldType.equals("hyper") && !fieldType.equals("unsigned hyper"))
         [ +  + ][ +  + ]
         [ +  + ][ +  + ]
    3307                 :            :         {
    3308 [ +  - ][ +  - ]:        402 :             o << " CPPU_GCC3_ALIGN( " << scopedCppName(superType) << " )";
         [ +  - ][ +  - ]
    3309                 :            :         }
    3310         [ +  - ]:        662 :         o << ";\n";
    3311                 :            :     }
    3312                 :            : 
    3313                 :            : 
    3314         [ +  - ]:       1048 :     dec();
    3315         [ +  - ]:       1048 :     o << "};\n\n";
    3316                 :       1048 : }
    3317                 :            : 
    3318                 :       1048 : sal_Bool ExceptionType::dumpHxxFile(
    3319                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3320                 :            :     throw( CannotDumpException )
    3321                 :            : {
    3322         [ +  - ]:       1048 :     OString headerDefine(dumpHeaderDefine(o, "HPP"));
    3323         [ +  - ]:       1048 :     o << "\n";
    3324                 :            : 
    3325         [ +  - ]:       1048 :     addDefaultHxxIncludes(includes);
    3326         [ +  - ]:       1048 :     includes.dump(o, &m_typeName);
    3327         [ +  - ]:       1048 :     o << "\n";
    3328                 :            : 
    3329 [ +  - ][ +  + ]:       1048 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
    3330         [ +  - ]:       1040 :         o << "\n";
    3331                 :            :     }
    3332         [ +  - ]:       1048 :     o << "\n";
    3333                 :            : 
    3334 [ +  - ][ +  - ]:       1048 :     o << "inline " << m_name << "::" << m_name << "() SAL_THROW(())\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    3335                 :       1048 :     inc();
    3336                 :       1048 :     OString superType;
    3337         [ +  + ]:       1048 :     if (m_reader.getSuperTypeCount() >= 1) {
    3338                 :            :         superType = rtl::OUStringToOString(
    3339 [ +  - ][ +  - ]:       1040 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    3340                 :            :     }
    3341                 :       1048 :     sal_Bool first = sal_True;
    3342         [ +  + ]:       1048 :     if (!superType.isEmpty())
    3343                 :            :     {
    3344 [ +  - ][ +  - ]:       1040 :         o << indent() << ": " << scopedCppName(superType) << "()\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3345                 :       1040 :         first = sal_False;
    3346                 :            :     }
    3347                 :            : 
    3348                 :       1048 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
    3349                 :       1048 :     RTFieldAccess   access = RT_ACCESS_INVALID;
    3350                 :       1048 :     OString         fieldName;
    3351                 :       1048 :     OString         fieldType;
    3352                 :            : 
    3353         [ +  + ]:       1710 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    3354                 :            :     {
    3355                 :        662 :         access = m_reader.getFieldFlags(i);
    3356                 :            : 
    3357 [ -  + ][ +  - ]:        662 :         if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3358                 :          0 :             continue;
    3359                 :            : 
    3360                 :            :         fieldName = rtl::OUStringToOString(
    3361 [ +  - ][ +  - ]:        662 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3362                 :            : 
    3363         [ +  + ]:        662 :         if (first)
    3364                 :            :         {
    3365                 :          8 :             first = sal_False;
    3366 [ +  - ][ +  - ]:          8 :             o << indent() << ": ";
                 [ +  - ]
    3367                 :            :         } else
    3368 [ +  - ][ +  - ]:        654 :             o << indent() << ", ";
                 [ +  - ]
    3369                 :            : 
    3370         [ +  - ]:        662 :         o << fieldName;
    3371 [ +  - ][ +  - ]:        662 :         dumpInitializer(o, false, m_reader.getFieldTypeName(i));
    3372         [ +  - ]:        662 :         o << "\n";
    3373                 :            :     }
    3374         [ +  - ]:       1048 :     dec();
    3375         [ +  + ]:       1048 :     if ( !m_cppuTypeDynamic )
    3376                 :            :     {
    3377         [ +  - ]:        528 :         o << "{\n";
    3378                 :        528 :         inc();
    3379         [ +  - ]:        528 :         dumpCppuGetType(o, m_typeName, sal_True);
    3380         [ +  - ]:        528 :         dec();
    3381         [ +  - ]:        528 :         o << "}\n\n";
    3382                 :            :     } else
    3383                 :            :     {
    3384         [ +  - ]:        520 :         o << "{ }\n\n";
    3385                 :            :     }
    3386                 :            : 
    3387 [ +  + ][ +  - ]:       1048 :     if (fieldCount > 0 || getInheritedMemberCount() > 0)
         [ +  - ][ +  - ]
    3388                 :            :     {
    3389 [ +  - ][ +  - ]:       1048 :         o << indent() << "inline " << m_name << "::" << m_name << "(";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3390                 :            : 
    3391         [ +  - ]:       1048 :         sal_Bool superHasMember = dumpSuperMember(o, superType, sal_True);
    3392                 :            : 
    3393         [ +  + ]:       1710 :         for (sal_uInt16 i=0; i < fieldCount; i++)
    3394                 :            :         {
    3395                 :        662 :             access = m_reader.getFieldFlags(i);
    3396                 :            : 
    3397 [ -  + ][ +  - ]:        662 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3398                 :          0 :                 continue;
    3399                 :            : 
    3400                 :            :             fieldName = rtl::OUStringToOString(
    3401 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3402                 :            :             fieldType = rtl::OUStringToOString(
    3403 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    3404                 :            : 
    3405         [ +  + ]:        662 :             if (superHasMember)
    3406         [ +  - ]:        654 :                 o << ", ";
    3407                 :            :             else
    3408                 :          8 :                 superHasMember = sal_True;
    3409                 :            : 
    3410         [ +  - ]:        662 :             dumpType(o, fieldType, sal_True, sal_True);
    3411                 :            : //          o << " __" << fieldName;
    3412 [ +  - ][ +  - ]:        662 :             o << " " << fieldName << "_";
                 [ +  - ]
    3413                 :            :         }
    3414         [ +  - ]:       1048 :         o << ") SAL_THROW(())\n";
    3415                 :            : 
    3416                 :       1048 :         inc();
    3417                 :       1048 :         first = sal_True;
    3418         [ +  + ]:       1048 :         if (!superType.isEmpty())
    3419                 :            :         {
    3420 [ +  - ][ +  - ]:       1040 :             o << indent() << ": " << scopedCppName(superType) << "(";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3421         [ +  - ]:       1040 :             dumpSuperMember(o, superType, sal_False);
    3422         [ +  - ]:       1040 :             o << ")\n";
    3423                 :       1040 :             first = sal_False;
    3424                 :            :         }
    3425                 :            : 
    3426         [ +  + ]:       1710 :         for (sal_uInt16 i=0; i < fieldCount; i++)
    3427                 :            :         {
    3428                 :        662 :             access = m_reader.getFieldFlags(i);
    3429                 :            : 
    3430 [ -  + ][ +  - ]:        662 :             if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3431                 :          0 :                 continue;
    3432                 :            : 
    3433                 :            :             fieldName = rtl::OUStringToOString(
    3434 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3435                 :            : 
    3436         [ +  + ]:        662 :             if (first)
    3437                 :            :             {
    3438                 :          8 :                 first = sal_False;
    3439 [ +  - ][ +  - ]:          8 :                 o << indent() << ": ";
                 [ +  - ]
    3440                 :            :             } else
    3441 [ +  - ][ +  - ]:        654 :                 o << indent() << ", ";
                 [ +  - ]
    3442                 :            : 
    3443                 :            : //          o << fieldName << "(__" << fieldName << ")\n";
    3444 [ +  - ][ +  - ]:        662 :             o << fieldName << "(" << fieldName << "_)\n";
         [ +  - ][ +  - ]
    3445                 :            :         }
    3446                 :            : 
    3447         [ +  - ]:       1048 :         dec();
    3448         [ +  + ]:       1048 :         if ( !m_cppuTypeDynamic )
    3449                 :            :         {
    3450         [ +  - ]:        528 :             o << "{\n";
    3451                 :        528 :             inc();
    3452         [ +  - ]:        528 :             dumpCppuGetType(o, m_typeName, sal_True);
    3453         [ +  - ]:        528 :             dec();
    3454         [ +  - ]:        528 :             o << "}\n\n";
    3455                 :            :         } else
    3456                 :            :         {
    3457         [ +  - ]:        520 :             o << "{ }\n\n";
    3458                 :            :         }
    3459                 :            :     }
    3460 [ +  - ][ +  - ]:       2096 :     o << indent() << m_name << "::" << m_name << "(" << m_name
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3461         [ +  - ]:       1048 :       << " const & the_other)";
    3462                 :       1048 :     first = true;
    3463         [ +  + ]:       1048 :     if (!superType.isEmpty()) {
    3464 [ +  - ][ +  - ]:       1040 :         o << ": " << scopedCppName(superType) << "(the_other)";
         [ +  - ][ +  - ]
    3465                 :       1040 :         first = false;
    3466                 :            :     }
    3467         [ +  + ]:       1710 :     for (sal_uInt16 i = 0; i < fieldCount; ++i) {
    3468                 :            :         rtl::OString name(
    3469                 :            :             rtl::OUStringToOString(
    3470 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8));
    3471 [ +  - ][ +  - ]:        662 :         o << (first ? ": " : ", ") << name << "(the_other." << name << ")";
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
    3472                 :        662 :         first = false;
    3473                 :        662 :     }
    3474 [ +  - ][ +  - ]:       2096 :     o << indent() << " {}\n\n"
                 [ +  - ]
    3475 [ +  - ][ +  - ]:       3144 :       << indent() << m_name << "::~" << m_name << "() {}\n\n"
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3476 [ +  - ][ +  - ]:       3144 :       << indent() << m_name << " & " << m_name << "::operator =(" << m_name
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3477         [ +  - ]:       1048 :       << " const & the_other) {\n";
    3478                 :       1048 :     inc();
    3479 [ +  - ][ +  - ]:       2096 :     o << indent()
    3480                 :            :       << ("//TODO: Just like its implicitly-defined counterpart, this function"
    3481         [ +  - ]:       1048 :           " definition is not exception-safe\n");
    3482         [ +  + ]:       1048 :     if (!superType.isEmpty()) {
    3483 [ +  - ][ +  - ]:       2080 :         o << indent() << scopedCppName(superType)
         [ +  - ][ +  - ]
    3484         [ +  - ]:       1040 :           << "::operator =(the_other);\n";
    3485                 :            :     }
    3486         [ +  + ]:       1710 :     for (sal_uInt16 i = 0; i < fieldCount; ++i) {
    3487                 :            :         rtl::OString name(
    3488                 :            :             rtl::OUStringToOString(
    3489 [ +  - ][ +  - ]:        662 :                 m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8));
    3490 [ +  - ][ +  - ]:        662 :         o << indent() << name << " = the_other." << name << ";\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3491                 :        662 :     }
    3492 [ +  - ][ +  - ]:       1048 :     o << indent() << "return *this;\n";
                 [ +  - ]
    3493         [ +  - ]:       1048 :     dec();
    3494 [ +  - ][ +  - ]:       1048 :     o << indent() << "}\n\n";
                 [ +  - ]
    3495                 :            : 
    3496 [ +  + ][ +  - ]:       1048 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
    3497         [ +  - ]:       1040 :         o << "\n";
    3498                 :            :     }
    3499                 :            : 
    3500         [ +  - ]:       1048 :     o << "\n";
    3501         [ +  - ]:       1048 :     dumpGetCppuType(o);
    3502                 :            : 
    3503 [ +  - ][ +  - ]:       1048 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    3504                 :       1048 :     return sal_True;
    3505                 :            : }
    3506                 :            : 
    3507                 :       8434 : sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType, sal_Bool bWithType)
    3508                 :            : {
    3509                 :       8434 :     sal_Bool hasMember = sal_False;
    3510                 :            : 
    3511         [ +  + ]:       8434 :     if (!superType.isEmpty())
    3512                 :            :     {
    3513         [ +  - ]:       5298 :         typereg::Reader aSuperReader(m_typeMgr.getTypeReader(superType));
    3514                 :            : 
    3515         [ +  - ]:       5298 :         if (aSuperReader.isValid())
    3516                 :            :         {
    3517                 :       5298 :             rtl::OString superSuper;
    3518         [ +  + ]:       5298 :             if (aSuperReader.getSuperTypeCount() >= 1) {
    3519                 :            :                 superSuper = rtl::OUStringToOString(
    3520 [ +  - ][ +  - ]:       2178 :                     aSuperReader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8);
    3521                 :            :             }
    3522         [ +  - ]:       5298 :             hasMember = dumpSuperMember(o, superSuper, bWithType);
    3523                 :            : 
    3524                 :       5298 :             sal_uInt16      fieldCount = aSuperReader.getFieldCount();
    3525                 :       5298 :             RTFieldAccess   access = RT_ACCESS_INVALID;
    3526                 :       5298 :             OString         fieldName;
    3527                 :       5298 :             OString         fieldType;
    3528         [ +  + ]:      12654 :             for (sal_uInt16 i=0; i < fieldCount; i++)
    3529                 :            :             {
    3530                 :       7356 :                 access = aSuperReader.getFieldFlags(i);
    3531                 :            : 
    3532 [ -  + ][ +  - ]:       7356 :                 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
    3533                 :          0 :                     continue;
    3534                 :            : 
    3535                 :            :                 fieldName = rtl::OUStringToOString(
    3536 [ +  - ][ +  - ]:       7356 :                     aSuperReader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3537                 :            :                 fieldType = rtl::OUStringToOString(
    3538 [ +  - ][ +  - ]:       7356 :                     aSuperReader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8);
    3539                 :            : 
    3540         [ +  + ]:       7356 :                 if (hasMember)
    3541                 :            :                 {
    3542         [ +  - ]:       4236 :                     o << ", ";
    3543                 :            :                 } else
    3544                 :            :                 {
    3545                 :       3120 :                     hasMember = (fieldCount > 0);
    3546                 :            :                 }
    3547                 :            : 
    3548         [ +  + ]:       7356 :                 if (bWithType)
    3549                 :            :                 {
    3550         [ +  - ]:       4904 :                     dumpType(o, fieldType, sal_True, sal_True);
    3551         [ +  - ]:       4904 :                     o << " ";
    3552                 :            :                 }
    3553                 :            : //              o << "__" << fieldName;
    3554 [ +  - ][ +  - ]:       7356 :                 o << fieldName << "_";
    3555                 :       5298 :             }
    3556                 :       5298 :         }
    3557                 :            :     }
    3558                 :            : 
    3559                 :       8434 :     return hasMember;
    3560                 :            : }
    3561                 :            : 
    3562                 :            : //*************************************************************************
    3563                 :            : // EnumType
    3564                 :            : //*************************************************************************
    3565                 :        832 : EnumType::EnumType(typereg::Reader& typeReader,
    3566                 :            :                     const OString& typeName,
    3567                 :            :                    const TypeManager& typeMgr)
    3568                 :        832 :     : CppuType(typeReader, typeName, typeMgr)
    3569                 :            : {
    3570                 :        832 : }
    3571                 :            : 
    3572                 :        832 : EnumType::~EnumType()
    3573                 :            : {
    3574                 :            : 
    3575         [ -  + ]:        832 : }
    3576                 :            : 
    3577                 :        832 : sal_Bool EnumType::dumpHFile(
    3578                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3579                 :            :     throw( CannotDumpException )
    3580                 :            : {
    3581                 :        832 :     dumpHFileContent(o, includes);
    3582                 :        832 :     return sal_True;
    3583                 :            : }
    3584                 :            : 
    3585                 :        832 : void EnumType::dumpDeclaration(FileStream& o)
    3586                 :            :     throw( CannotDumpException )
    3587                 :            : {
    3588 [ +  - ][ +  - ]:        832 :     o << "\nenum " << m_name << "\n{\n";
                 [ +  - ]
    3589                 :        832 :     inc();
    3590                 :            : 
    3591                 :        832 :     sal_uInt16      fieldCount = m_reader.getFieldCount();
    3592                 :        832 :     RTFieldAccess   access = RT_ACCESS_INVALID;
    3593                 :        832 :     RTConstValue    constValue;
    3594                 :        832 :     OString         fieldName;
    3595                 :        832 :     sal_Int32       value=0;
    3596         [ +  + ]:       6636 :     for (sal_uInt16 i=0; i < fieldCount; i++)
    3597                 :            :     {
    3598                 :       5804 :         access = m_reader.getFieldFlags(i);
    3599                 :            : 
    3600         [ -  + ]:       5804 :         if (access != RT_ACCESS_CONST)
    3601                 :          0 :             continue;
    3602                 :            : 
    3603                 :            :         fieldName = rtl::OUStringToOString(
    3604 [ +  - ][ +  - ]:       5804 :             m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8);
    3605         [ +  - ]:       5804 :         constValue = m_reader.getFieldValue(i);
    3606                 :            : 
    3607         [ +  - ]:       5804 :         if (constValue.m_type == RT_TYPE_INT32)
    3608                 :       5804 :             value = constValue.m_value.aLong;
    3609                 :            :         else
    3610                 :          0 :             value++;
    3611                 :            : 
    3612 [ +  - ][ +  - ]:       5804 :         o << indent() << m_name << "_" << fieldName << " = " << value << ",\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3613                 :            :     }
    3614                 :            : 
    3615 [ +  - ][ +  - ]:        832 :     o << indent() << m_name << "_MAKE_FIXED_SIZE = SAL_MAX_ENUM\n";
         [ +  - ][ +  - ]
    3616                 :            : 
    3617         [ +  - ]:        832 :     dec();
    3618         [ +  - ]:        832 :     o << "};\n\n";
    3619                 :        832 : }
    3620                 :            : 
    3621                 :        832 : sal_Bool EnumType::dumpHxxFile(
    3622                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3623                 :            :     throw( CannotDumpException )
    3624                 :            : {
    3625         [ +  - ]:        832 :     OString headerDefine(dumpHeaderDefine(o, "HPP"));
    3626         [ +  - ]:        832 :     o << "\n";
    3627                 :            : 
    3628         [ +  - ]:        832 :     addDefaultHxxIncludes(includes);
    3629         [ +  - ]:        832 :     includes.dump(o, &m_typeName);
    3630         [ +  - ]:        832 :     o << "\n";
    3631                 :            : 
    3632         [ +  - ]:        832 :     dumpGetCppuType(o);
    3633                 :            : 
    3634 [ +  - ][ +  - ]:        832 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    3635                 :        832 :     return sal_True;
    3636                 :            : }
    3637                 :            : 
    3638                 :          8 : void EnumType::dumpNormalGetCppuType(FileStream& o)
    3639                 :            : {
    3640                 :          8 :     dumpGetCppuTypePreamble(o);
    3641                 :            : 
    3642         [ +  - ]:         16 :     o << indent()
    3643         [ +  - ]:          8 :       << "static typelib_TypeDescriptionReference * the_type = 0;\n";
    3644                 :            : 
    3645 [ +  - ][ +  - ]:          8 :     o << indent() << "if ( !the_type )\n" << indent() << "{\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    3646                 :          8 :     inc();
    3647                 :            : 
    3648 [ +  - ][ +  - ]:          8 :     o << indent() << "typelib_static_enum_type_init( &the_type,\n";
    3649                 :          8 :     inc(31);
    3650 [ +  - ][ +  - ]:         16 :     o << indent() << "\"" << m_typeName.replace('/', '.') << "\",\n"
         [ +  - ][ +  - ]
                 [ +  - ]
    3651 [ +  - ][ +  - ]:         24 :       << indent() << scopedCppName(m_typeName) << "_"
         [ +  - ][ +  - ]
                 [ +  - ]
    3652 [ +  - ][ +  - ]:         24 :       << rtl::OUStringToOString(m_reader.getFieldName(0), RTL_TEXTENCODING_UTF8)
    3653         [ +  - ]:          8 :       << " );\n";
    3654                 :          8 :     dec(31);
    3655                 :          8 :     dec();
    3656 [ +  - ][ +  - ]:          8 :     o << indent() << "}\n";
    3657         [ +  - ]:         16 :     o << indent()
    3658                 :            :       << ("return * reinterpret_cast< ::com::sun::star::uno::Type * >("
    3659         [ +  - ]:          8 :           " &the_type );\n");
    3660                 :          8 :     dumpGetCppuTypePostamble(o);
    3661                 :          8 : }
    3662                 :            : 
    3663                 :        414 : void EnumType::dumpComprehensiveGetCppuType(FileStream& o)
    3664                 :            : {
    3665 [ +  - ][ +  - ]:        414 :     if (!isPolymorphic())
    3666         [ +  - ]:        414 :         codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false);
    3667                 :            :     else
    3668         [ #  # ]:          0 :         o << "namespace cppu { ";
    3669         [ +  - ]:        414 :     o << " namespace detail {\n\n";
    3670                 :            : 
    3671                 :        414 :     OString sType = m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
    3672                 :        414 :     OString sStaticTypeClass = "the" + sType + "Type";
    3673 [ +  - ][ +  - ]:        414 :     o << indent() << "struct " << sStaticTypeClass << " : public rtl::StaticWithInit< ::com::sun::star::uno::Type *, " << sStaticTypeClass << " >\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    3674 [ +  - ][ +  - ]:        414 :     o << indent() << "{\n";
                 [ +  - ]
    3675                 :        414 :     inc();
    3676 [ +  - ][ +  - ]:        414 :     o << indent() << "::com::sun::star::uno::Type * operator()() const\n";
                 [ +  - ]
    3677 [ +  - ][ +  - ]:        414 :     o << indent() << "{\n";
                 [ +  - ]
    3678                 :            : 
    3679                 :        414 :     inc();
    3680 [ +  - ][ +  - ]:        828 :     o << indent() << "::rtl::OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM(\""
                 [ +  - ]
    3681 [ +  - ][ +  - ]:       1242 :       << m_typeName.replace('/', '.') << "\") );\n\n";
    3682                 :            : 
    3683 [ +  - ][ +  - ]:        828 :     o << indent() << "// Start inline typedescription generation\n"
                 [ +  - ]
    3684 [ +  - ][ +  - ]:       1242 :       << indent() << "typelib_TypeDescription * pTD = 0;\n\n";
                 [ +  - ]
    3685                 :            : 
    3686                 :        414 :     sal_uInt16 count = m_reader.getFieldCount();
    3687 [ +  - ][ +  - ]:        414 :     o << indent() << "rtl_uString* enumValueNames[" << count << "];\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    3688                 :            :     sal_uInt16 i;
    3689         [ +  + ]:       3304 :     for (i = 0; i < count; i++)
    3690                 :            :     {
    3691 [ +  - ][ +  - ]:       5780 :         o << indent() << "::rtl::OUString sEnumValue" << i
         [ +  - ][ +  - ]
    3692         [ +  - ]:       2890 :           << "( RTL_CONSTASCII_USTRINGPARAM(\""
    3693                 :            :           << rtl::OUStringToOString(
    3694 [ +  - ][ +  - ]:       8670 :               m_reader.getFieldName(i), RTL_TEXTENCODING_UTF8)
                 [ +  - ]
    3695         [ +  - ]:       2890 :           << "\") );\n";
    3696 [ +  - ][ +  - ]:       5780 :         o << indent() << "enumValueNames[" << i << "] = sEnumValue" << i
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3697         [ +  - ]:       2890 :           << ".pData;\n";
    3698                 :            :     }
    3699                 :            : 
    3700 [ +  - ][ +  - ]:        414 :     o << "\n" << indent() << "sal_Int32 enumValues[" << count << "];\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    3701                 :        414 :     RTConstValue    constValue;
    3702                 :        414 :     sal_Int32       value=0;
    3703         [ +  + ]:       3304 :     for (i = 0; i < count; i++)
    3704                 :            :     {
    3705 [ +  - ][ +  - ]:       2890 :         o << indent() << "enumValues[" << i << "] = ";
         [ +  - ][ +  - ]
                 [ +  - ]
    3706         [ +  - ]:       2890 :         constValue = m_reader.getFieldValue(i);
    3707         [ +  - ]:       2890 :         if (constValue.m_type == RT_TYPE_INT32)
    3708                 :       2890 :             value = constValue.m_value.aLong;
    3709                 :            :         else
    3710                 :          0 :             value++;
    3711 [ +  - ][ +  - ]:       2890 :         o << value << ";\n";
    3712                 :            :     }
    3713                 :            : 
    3714 [ +  - ][ +  - ]:        414 :     o << "\n" << indent() << "typelib_typedescription_newEnum( &pTD,\n";
         [ +  - ][ +  - ]
    3715                 :        414 :     inc();
    3716 [ +  - ][ +  - ]:        828 :     o << indent() << "sTypeName.pData,\n"
                 [ +  - ]
    3717 [ +  - ][ +  - ]:       1242 :       << indent() << "(sal_Int32)" << scopedCppName(m_typeName, sal_False)
         [ +  - ][ +  - ]
                 [ +  - ]
    3718         [ +  - ]:        414 :       << "_"
    3719 [ +  - ][ +  - ]:       1242 :       << rtl::OUStringToOString(m_reader.getFieldName(0), RTL_TEXTENCODING_UTF8)
                 [ +  - ]
    3720         [ +  - ]:        414 :       << ",\n"
    3721 [ +  - ][ +  - ]:       1242 :       << indent() << count << ", enumValueNames, enumValues );\n\n";
         [ +  - ][ +  - ]
    3722         [ +  - ]:        414 :     dec();
    3723                 :            : 
    3724 [ +  - ][ +  - ]:        828 :     o << indent()
    3725                 :            :       << ("typelib_typedescription_register( (typelib_TypeDescription**)&pTD"
    3726         [ +  - ]:        414 :           " );\n");
    3727 [ +  - ][ +  - ]:        828 :     o << indent() << "typelib_typedescription_release( pTD );\n"
                 [ +  - ]
    3728 [ +  - ][ +  - ]:       1242 :       << indent() << "// End inline typedescription generation\n\n";
                 [ +  - ]
    3729                 :            : 
    3730 [ +  - ][ +  - ]:        828 :     o << indent() << "return new ::com::sun::star::uno::Type( "
                 [ +  - ]
    3731 [ +  - ][ +  - ]:       1242 :       << getTypeClass(m_typeName) << ", sTypeName ); // leaked\n";
                 [ +  - ]
    3732                 :            : 
    3733         [ +  - ]:        414 :     dec();
    3734 [ +  - ][ +  - ]:        414 :     o << indent() << "}\n";
                 [ +  - ]
    3735         [ +  - ]:        414 :     dec();
    3736 [ +  - ][ +  - ]:        414 :     o << indent() << "};\n\n";
                 [ +  - ]
    3737                 :            : 
    3738 [ +  - ][ +  - ]:        414 :     if (!isPolymorphic())
    3739         [ +  - ]:        414 :         codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false);
    3740                 :            :     else
    3741         [ #  # ]:          0 :         o << " }";
    3742         [ +  - ]:        414 :     o << " }\n\n";
    3743                 :            : 
    3744         [ +  - ]:        414 :     dumpGetCppuTypePreamble(o);
    3745 [ +  - ][ +  - ]:        414 :     o  << indent() << "return *detail::" << sStaticTypeClass << "::get();\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    3746         [ +  - ]:        414 :     dumpGetCppuTypePostamble(o);
    3747                 :        414 : }
    3748                 :            : 
    3749                 :            : //*************************************************************************
    3750                 :            : // TypeDefType
    3751                 :            : //*************************************************************************
    3752                 :        200 : TypeDefType::TypeDefType(typereg::Reader& typeReader,
    3753                 :            :                              const OString& typeName,
    3754                 :            :                             const TypeManager& typeMgr)
    3755                 :        200 :     : CppuType(typeReader, typeName, typeMgr)
    3756                 :            : {
    3757                 :        200 : }
    3758                 :            : 
    3759                 :        200 : TypeDefType::~TypeDefType()
    3760                 :            : {
    3761                 :            : 
    3762         [ -  + ]:        200 : }
    3763                 :            : 
    3764                 :        200 : sal_Bool TypeDefType::dumpHFile(
    3765                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3766                 :            :     throw( CannotDumpException )
    3767                 :            : {
    3768         [ +  - ]:        200 :     OString headerDefine(dumpHeaderDefine(o, "HDL"));
    3769         [ +  - ]:        200 :     o << "\n";
    3770                 :            : 
    3771         [ +  - ]:        200 :     addDefaultHIncludes(includes);
    3772         [ +  - ]:        200 :     includes.dump(o, 0);
    3773         [ +  - ]:        200 :     o << "\n";
    3774                 :            : 
    3775 [ +  - ][ +  - ]:        200 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
    3776         [ +  - ]:        200 :         o << "\n";
    3777                 :            :     }
    3778                 :            : 
    3779         [ +  - ]:        200 :     dumpDeclaration(o);
    3780                 :            : 
    3781 [ +  - ][ +  - ]:        200 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
    3782         [ +  - ]:        200 :         o << "\n";
    3783                 :            :     }
    3784                 :            : 
    3785                 :            : //  o << "\nnamespace com { namespace sun { namespace star { namespace uno {\n"
    3786                 :            : //    << "class Type;\n} } } }\n\n";
    3787                 :            : //  o << "inline const ::com::sun::star::uno::Type& SAL_CALL get_" << m_typeName.replace('/', '_')
    3788                 :            : //    <<  "_Type( ) SAL_THROW(());\n\n";
    3789                 :            : 
    3790 [ +  - ][ +  - ]:        200 :     o << "#endif // "<< headerDefine << "\n";
                 [ +  - ]
    3791                 :            : 
    3792                 :        200 :     return sal_True;
    3793                 :            : }
    3794                 :            : 
    3795                 :        200 : void TypeDefType::dumpDeclaration(FileStream& o)
    3796                 :            :     throw( CannotDumpException )
    3797                 :            : {
    3798                 :        200 :     o << "\ntypedef ";
    3799                 :            :     dumpType(
    3800                 :            :         o,
    3801                 :            :         rtl::OUStringToOString(
    3802 [ +  - ][ +  - ]:        200 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
    3803                 :        200 :     o << " " << m_name << ";\n\n";
    3804                 :        200 : }
    3805                 :            : 
    3806                 :        200 : sal_Bool TypeDefType::dumpHxxFile(
    3807                 :            :     FileStream& o, codemaker::cppumaker::Includes & includes)
    3808                 :            :     throw( CannotDumpException )
    3809                 :            : {
    3810         [ +  - ]:        200 :     OString headerDefine(dumpHeaderDefine(o, "HPP"));
    3811         [ +  - ]:        200 :     o << "\n";
    3812                 :            : 
    3813         [ +  - ]:        200 :     addDefaultHxxIncludes(includes);
    3814         [ +  - ]:        200 :     includes.dump(o, &m_typeName);
    3815         [ +  - ]:        200 :     o << "\n";
    3816                 :            : 
    3817 [ +  - ][ +  - ]:        200 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    3818                 :        200 :     return sal_True;
    3819                 :            : }
    3820                 :            : 
    3821                 :            : //*************************************************************************
    3822                 :            : // ConstructiveType
    3823                 :            : //*************************************************************************
    3824                 :            : 
    3825                 :          0 : sal_Bool ConstructiveType::dumpHFile(
    3826                 :            :     FileStream &, codemaker::cppumaker::Includes &) throw (CannotDumpException)
    3827                 :            : {
    3828                 :            :     OSL_ASSERT(false);
    3829                 :          0 :     return false;
    3830                 :            : }
    3831                 :            : 
    3832                 :       1324 : bool ConstructiveType::dumpFiles(
    3833                 :            :     CppuOptions * options, rtl::OString const & outPath)
    3834                 :            : {
    3835         [ +  - ]:       1324 :     return dumpFile(options, ".hpp", m_typeName, outPath);
    3836                 :            : }
    3837                 :            : 
    3838                 :            : //*************************************************************************
    3839                 :            : // ServiceType
    3840                 :            : //*************************************************************************
    3841                 :            : 
    3842                 :            : namespace {
    3843                 :            : 
    3844                 :        774 : void includeExceptions(
    3845                 :            :     codemaker::cppumaker::Includes & includes,
    3846                 :            :     codemaker::ExceptionTreeNode const * node)
    3847                 :            : {
    3848         [ +  + ]:        774 :     if (node->present) {
    3849                 :        148 :         includes.add(node->name);
    3850                 :            :     } else {
    3851 [ +  - ][ +  + ]:       1548 :         for (codemaker::ExceptionTreeNode::Children::const_iterator i(
    3852                 :        626 :                  node->children.begin());
    3853                 :        774 :              i != node->children.end(); ++i)
    3854                 :            :         {
    3855         [ +  - ]:        148 :             includeExceptions(includes, *i);
    3856                 :            :         }
    3857                 :            :     }
    3858                 :        774 : }
    3859                 :            : 
    3860                 :            : }
    3861                 :            : 
    3862                 :       5558 : bool ServiceType::isSingleInterfaceBased() {
    3863                 :       5558 :     return m_reader.getSuperTypeCount() == 1;
    3864                 :            : }
    3865                 :            : 
    3866                 :        988 : sal_Bool ServiceType::dumpHxxFile(
    3867                 :            :     FileStream & o, codemaker::cppumaker::Includes & includes)
    3868                 :            :     throw (CannotDumpException)
    3869                 :            : {
    3870                 :        988 :     sal_uInt16 ctors = m_reader.getMethodCount();
    3871         [ +  + ]:        988 :     if (ctors > 0) {
    3872                 :            :         //TODO: Decide whether the types added to includes should rather be
    3873                 :            :         // added to m_dependencies (and thus be generated during
    3874                 :            :         // dumpDependedTypes):
    3875                 :        904 :         includes.addReference();
    3876                 :        904 :         includes.addRtlUstringH();
    3877                 :        904 :         includes.addRtlUstringHxx();
    3878         [ +  - ]:        904 :         includes.add("com/sun/star/lang/XMultiComponentFactory");
    3879         [ +  - ]:        904 :         includes.add("com/sun/star/uno/DeploymentException");
    3880         [ +  - ]:        904 :         includes.add("com/sun/star/uno/XComponentContext");
    3881         [ +  + ]:       1934 :         for (sal_uInt16 i = 0; i < ctors; ++i) {
    3882 [ +  - ][ +  + ]:       1030 :             if (isDefaultConstructor(i)) {
    3883         [ +  - ]:        390 :                 includes.add("com/sun/star/uno/Exception");
    3884         [ +  - ]:        390 :                 includes.add("com/sun/star/uno/RuntimeException");
    3885                 :            :             } else {
    3886         [ +  + ]:        640 :                 if (!hasRestParameter(i)) {
    3887                 :        636 :                     includes.addAny();
    3888                 :        636 :                     includes.addSequence();
    3889                 :        636 :                     sal_uInt16 params = m_reader.getMethodParameterCount(i);
    3890         [ +  + ]:       1546 :                     for (sal_uInt16 j = 0; j < params; ++j) {
    3891         [ +  + ]:        910 :                         if (codemaker::UnoType::getSort(
    3892                 :            :                                 codemaker::UnoType::decompose(
    3893                 :            :                                     rtl::OUStringToOString(
    3894                 :            :                                         m_reader.getMethodParameterTypeName(
    3895                 :            :                                             i, j),
    3896                 :            :                                         RTL_TEXTENCODING_UTF8),
    3897 [ +  - ][ +  - ]:        910 :                                     0, 0))
         [ +  - ][ +  - ]
    3898                 :            :                             == codemaker::UnoType::SORT_CHAR)
    3899                 :            :                         {
    3900                 :          4 :                             includes.addCppuUnotypeHxx();
    3901                 :          4 :                             break;
    3902                 :            :                         }
    3903                 :            :                     }
    3904                 :            :                 }
    3905         [ +  - ]:        640 :                 codemaker::ExceptionTree tree;
    3906         [ +  + ]:        838 :                 for (sal_uInt16 j = 0; j < m_reader.getMethodExceptionCount(i);
    3907                 :            :                      ++j)
    3908                 :            :                 {
    3909                 :            :                     tree.add(
    3910                 :            :                         rtl::OUStringToOString(
    3911                 :            :                             m_reader.getMethodExceptionTypeName(i, j),
    3912                 :            :                             RTL_TEXTENCODING_UTF8),
    3913 [ +  - ][ +  - ]:        198 :                         m_typeMgr);
                 [ +  - ]
    3914                 :            :                 }
    3915         [ +  + ]:        640 :                 if (!tree.getRoot()->present) {
    3916         [ +  - ]:        626 :                     includes.add("com/sun/star/uno/Exception");
    3917         [ +  - ]:        626 :                     includes.add("com/sun/star/uno/RuntimeException");
    3918         [ +  - ]:        626 :                     includeExceptions(includes, tree.getRoot());
    3919         [ +  - ]:        640 :                 }
    3920                 :            :             }
    3921                 :            :         }
    3922                 :            :     }
    3923                 :            :     rtl::OString cppName(translateUnoToCppIdentifier(
    3924         [ +  - ]:        988 :                              m_name, "service", isGlobal()));
    3925         [ +  - ]:        988 :     rtl::OString headerDefine(dumpHeaderDefine(o, "HPP"));
    3926         [ +  - ]:        988 :     o << "\n";
    3927         [ +  - ]:        988 :     includes.dump(o, 0);
    3928         [ +  - ]:        988 :     o << "\n";
    3929 [ +  - ][ +  - ]:        988 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
    3930         [ +  - ]:        988 :         o << "\n";
    3931                 :            :     }
    3932 [ +  - ][ +  - ]:        988 :     o << "\nclass " << cppName << " {\n";
                 [ +  - ]
    3933                 :        988 :     inc();
    3934         [ +  + ]:        988 :     if (ctors > 0) {
    3935                 :        904 :         rtl::OString fullName(m_typeName.replace('/', '.'));
    3936                 :            :         rtl::OString baseName(
    3937                 :            :             rtl::OUStringToOString(
    3938 [ +  - ][ +  - ]:        904 :                 m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
    3939                 :        904 :         rtl::OString fullBaseName(baseName.replace('/', '.'));
    3940         [ +  - ]:        904 :         rtl::OString scopedBaseName(scopedCppName(baseName));
    3941         [ +  - ]:        904 :         o << "public:\n";
    3942         [ +  + ]:       1934 :         for (sal_uInt16 i = 0; i < ctors; ++i) {
    3943 [ +  - ][ +  + ]:       1030 :             if (isDefaultConstructor(i)) {
    3944 [ +  - ][ +  - ]:        780 :                 o << indent() << "static ::com::sun::star::uno::Reference< "
                 [ +  - ]
    3945 [ +  - ][ +  - ]:        390 :                   << scopedBaseName << " > "
    3946                 :            :                   << translateUnoToCppIdentifier(
    3947 [ +  - ][ +  - ]:       1170 :                       "create", "method", ITM_NONGLOBAL, &cppName)
    3948                 :            :                   << ("(::com::sun::star::uno::Reference<"
    3949                 :            :                       " ::com::sun::star::uno::XComponentContext > const &"
    3950         [ +  - ]:        390 :                       " the_context) {\n");
    3951                 :        390 :                 inc();
    3952 [ +  - ][ +  - ]:        780 :                 o << indent()
    3953                 :            :                   << ("::com::sun::star::uno::Reference<"
    3954                 :            :                       " ::com::sun::star::lang::XMultiComponentFactory >"
    3955         [ +  - ]:        390 :                       " the_factory(the_context->getServiceManager());\n")
    3956 [ +  - ][ +  - ]:       1170 :                   << indent() << "if (!the_factory.is()) {\n";
                 [ +  - ]
    3957                 :        390 :                 inc();
    3958 [ +  - ][ +  - ]:        780 :                 o << indent()
    3959                 :            :                   << ("throw ::com::sun::star::uno::DeploymentException("
    3960                 :            :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"component"
    3961                 :            :                       " context fails to supply service manager\")),"
    3962         [ +  - ]:        390 :                       " the_context);\n");
    3963         [ +  - ]:        390 :                 dec();
    3964 [ +  - ][ +  - ]:        780 :                 o << indent() << "}\n" << indent()
         [ +  - ][ +  - ]
                 [ +  - ]
    3965 [ +  - ][ +  - ]:        390 :                   << "::com::sun::star::uno::Reference< " << scopedBaseName
    3966 [ +  - ][ +  - ]:       1170 :                   << " > the_instance;\n" << indent() << "try {\n";
         [ +  - ][ +  - ]
    3967                 :        390 :                 inc();
    3968 [ +  - ][ +  - ]:        780 :                 o << indent()
    3969         [ +  - ]:        390 :                   << "the_instance = ::com::sun::star::uno::Reference< "
    3970         [ +  - ]:        390 :                   << scopedBaseName
    3971                 :            :                   << (" >(the_factory->createInstanceWithContext("
    3972         [ +  - ]:        390 :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"")
    3973         [ +  - ]:        390 :                   << fullName
    3974         [ +  - ]:        390 :                   << "\")), the_context), ::com::sun::star::uno::UNO_QUERY);\n";
    3975         [ +  - ]:        390 :                 dec();
    3976 [ +  - ][ +  - ]:        780 :                 o << indent()
    3977         [ +  - ]:        390 :                   << "} catch (::com::sun::star::uno::RuntimeException &) {\n";
    3978                 :        390 :                 inc();
    3979 [ +  - ][ +  - ]:        390 :                 o << indent() << "throw;\n";
                 [ +  - ]
    3980         [ +  - ]:        390 :                 dec();
    3981 [ +  - ][ +  - ]:        780 :                 o << indent()
    3982                 :            :                   << ("} catch (::com::sun::star::uno::Exception &"
    3983         [ +  - ]:        390 :                       " the_exception) {\n");
    3984                 :        390 :                 inc();
    3985 [ +  - ][ +  - ]:        780 :                 o << indent()
    3986                 :            :                   << ("throw ::com::sun::star::uno::DeploymentException("
    3987                 :            :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("
    3988         [ +  - ]:        390 :                       "\"component context fails to supply service ")
    3989 [ +  - ][ +  - ]:        390 :                   << fullName << " of type " << fullBaseName
                 [ +  - ]
    3990         [ +  - ]:        390 :                   << ": \")) + the_exception.Message, the_context);\n";
    3991         [ +  - ]:        390 :                 dec();
    3992 [ +  - ][ +  - ]:        780 :                 o << indent() << "}\n" << indent()
         [ +  - ][ +  - ]
                 [ +  - ]
    3993         [ +  - ]:        390 :                   << "if (!the_instance.is()) {\n";
    3994                 :        390 :                 inc();
    3995 [ +  - ][ +  - ]:        780 :                 o << indent()
    3996                 :            :                   << ("throw ::com::sun::star::uno::DeploymentException("
    3997                 :            :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("
    3998         [ +  - ]:        390 :                       "\"component context fails to supply service ")
    3999 [ +  - ][ +  - ]:        390 :                   << fullName << " of type " << fullBaseName
                 [ +  - ]
    4000         [ +  - ]:        390 :                   << "\")), the_context);\n";
    4001         [ +  - ]:        390 :                 dec();
    4002 [ +  - ][ +  - ]:        390 :                 o << indent() << "}\n" << indent() << "return the_instance;\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4003         [ +  - ]:        390 :                 dec();
    4004 [ +  - ][ +  - ]:        390 :                 o << indent() << "}\n\n";
                 [ +  - ]
    4005                 :            :             } else {
    4006 [ +  - ][ +  - ]:       1280 :                 o << indent() << "static ::com::sun::star::uno::Reference< "
                 [ +  - ]
    4007 [ +  - ][ +  - ]:        640 :                   << scopedBaseName << " > "
    4008                 :            :                   << translateUnoToCppIdentifier(
    4009                 :            :                       rtl::OUStringToOString(
    4010                 :            :                           m_reader.getMethodName(i), RTL_TEXTENCODING_UTF8),
    4011 [ +  - ][ +  - ]:       1920 :                       "method", ITM_NONGLOBAL, &cppName)
         [ +  - ][ +  - ]
    4012                 :            :                   << ("(::com::sun::star::uno::Reference<"
    4013                 :            :                       " ::com::sun::star::uno::XComponentContext > const &"
    4014         [ +  - ]:        640 :                       " the_context");
    4015                 :        640 :                 sal_uInt16 params = m_reader.getMethodParameterCount(i);
    4016                 :        640 :                 bool rest = hasRestParameter(i);
    4017         [ +  + ]:       1726 :                 for (sal_uInt16 j = 0; j < params; ++j) {
    4018         [ +  - ]:       1086 :                     o << ", ";
    4019                 :       1086 :                     rtl::OStringBuffer buf;
    4020         [ +  + ]:       1086 :                     if ((m_reader.getMethodParameterFlags(i, j) & RT_PARAM_REST)
    4021                 :            :                         != 0)
    4022                 :            :                     {
    4023         [ +  - ]:          4 :                         buf.append(RTL_CONSTASCII_STRINGPARAM("[]"));
    4024                 :            :                     }
    4025                 :            :                     buf.append(
    4026                 :            :                         rtl::OUStringToOString(
    4027                 :            :                             m_reader.getMethodParameterTypeName(i, j),
    4028 [ +  - ][ +  - ]:       1086 :                             RTL_TEXTENCODING_UTF8));
                 [ +  - ]
    4029                 :       1086 :                     rtl::OString type(buf.makeStringAndClear());
    4030         [ +  - ]:       1086 :                     bool byRef = passByReference(type);
    4031         [ +  - ]:       1086 :                     dumpType(o, type, byRef, byRef);
    4032         [ +  - ]:       1086 :                     o << " "
    4033                 :            :                       << translateUnoToCppIdentifier(
    4034                 :            :                           rtl::OUStringToOString(
    4035                 :            :                               m_reader.getMethodParameterName(i, j),
    4036                 :            :                               RTL_TEXTENCODING_UTF8),
    4037 [ +  - ][ +  - ]:       2172 :                           "param", ITM_NONGLOBAL);
         [ +  - ][ +  - ]
    4038                 :       1086 :                 }
    4039         [ +  - ]:        640 :                 o << ") {\n";
    4040                 :        640 :                 inc();
    4041 [ +  - ][ +  - ]:       1280 :                 o << indent()
    4042                 :            :                   << ("::com::sun::star::uno::Reference<"
    4043                 :            :                       " ::com::sun::star::lang::XMultiComponentFactory >"
    4044         [ +  - ]:        640 :                       " the_factory(the_context->getServiceManager());\n")
    4045 [ +  - ][ +  - ]:       1920 :                   << indent() << "if (!the_factory.is()) {\n";
                 [ +  - ]
    4046                 :        640 :                 inc();
    4047 [ +  - ][ +  - ]:       1280 :                 o << indent()
    4048                 :            :                   << ("throw com::sun::star::uno::DeploymentException("
    4049                 :            :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("
    4050                 :            :                       "\"component context fails to supply service manager\")),"
    4051         [ +  - ]:        640 :                       " the_context);\n");
    4052         [ +  - ]:        640 :                 dec();
    4053 [ +  - ][ +  - ]:        640 :                 o << indent() << "}\n";
                 [ +  - ]
    4054 [ +  + ][ +  + ]:        640 :                 if (!rest && params > 0) {
    4055 [ +  - ][ +  - ]:       1124 :                     o << indent()
    4056                 :            :                       << ("::com::sun::star::uno::Sequence<"
    4057         [ +  - ]:        562 :                           " ::com::sun::star::uno::Any > the_arguments(")
    4058 [ +  - ][ +  - ]:        562 :                       << params << ");\n";
    4059         [ +  + ]:       1644 :                     for (sal_uInt16 j = 0; j < params; ++j) {
    4060 [ +  - ][ +  - ]:       1082 :                         o << indent() << "the_arguments[" << j << "] ";
         [ +  - ][ +  - ]
                 [ +  - ]
    4061                 :            :                         rtl::OString param(
    4062                 :            :                             translateUnoToCppIdentifier(
    4063                 :            :                                 rtl::OUStringToOString(
    4064                 :            :                                     m_reader.getMethodParameterName(i, j),
    4065                 :            :                                     RTL_TEXTENCODING_UTF8),
    4066 [ +  - ][ +  - ]:       1082 :                                 "param", ITM_NONGLOBAL));
                 [ +  - ]
    4067                 :            :                         sal_Int32 rank;
    4068         [ +  + ]:       1082 :                         if (codemaker::UnoType::getSort(
    4069                 :            :                                 codemaker::UnoType::decompose(
    4070                 :            :                                     rtl::OUStringToOString(
    4071                 :            :                                         m_reader.getMethodParameterTypeName(
    4072                 :            :                                             i, j),
    4073                 :            :                                         RTL_TEXTENCODING_UTF8),
    4074 [ +  - ][ +  - ]:       1082 :                                     &rank, 0))
         [ +  - ][ +  - ]
    4075                 :            :                             == codemaker::UnoType::SORT_CHAR)
    4076                 :            :                         {
    4077 [ +  - ][ +  - ]:         10 :                             o << "= ::com::sun::star::uno::Any(&" << param
    4078         [ +  - ]:         10 :                               << ", ::cppu::UnoType< ";
    4079         [ +  + ]:         20 :                             for (sal_Int32 k = 0; k < rank; ++k) {
    4080         [ +  - ]:         10 :                                 o << "::cppu::UnoSequenceType< ";
    4081                 :            :                             }
    4082         [ +  - ]:         10 :                             o << "::cppu::UnoCharType";
    4083         [ +  + ]:         20 :                             for (sal_Int32 k = 0; k < rank; ++k) {
    4084         [ +  - ]:         10 :                                 o << " >";
    4085                 :            :                             }
    4086         [ +  - ]:         10 :                             o << " >::get())";
    4087                 :            :                         } else {
    4088 [ +  - ][ +  - ]:       1072 :                             o << "<<= " << param;
    4089                 :            :                         }
    4090         [ +  - ]:       1082 :                         o << ";\n";
    4091                 :       1082 :                     }
    4092                 :            :                 }
    4093 [ +  - ][ +  - ]:       1280 :                 o << indent() << "::com::sun::star::uno::Reference< "
                 [ +  - ]
    4094 [ +  - ][ +  - ]:        640 :                   << scopedBaseName << " > the_instance;\n";
    4095         [ +  - ]:        640 :                 codemaker::ExceptionTree tree;
    4096                 :        640 :                 sal_uInt16 exceptions = m_reader.getMethodExceptionCount(i);
    4097         [ +  + ]:        838 :                 for (sal_uInt16 j = 0; j < exceptions; ++j) {
    4098                 :            :                     tree.add(
    4099                 :            :                         rtl::OUStringToOString(
    4100                 :            :                             m_reader.getMethodExceptionTypeName(i, j),
    4101                 :            :                             RTL_TEXTENCODING_UTF8),
    4102 [ +  - ][ +  - ]:        198 :                         m_typeMgr);
                 [ +  - ]
    4103                 :            :                 }
    4104         [ +  + ]:        640 :                 if (!tree.getRoot()->present) {
    4105 [ +  - ][ +  - ]:        626 :                     o << indent() << "try {\n";
                 [ +  - ]
    4106                 :        626 :                     inc();
    4107                 :            :                 }
    4108 [ +  - ][ +  - ]:       1280 :                 o << indent()
    4109         [ +  - ]:        640 :                   << "the_instance = ::com::sun::star::uno::Reference< "
    4110         [ +  - ]:        640 :                   << scopedBaseName
    4111                 :            :                   << (" >(the_factory->createInstanceWithArgumentsAndContext("
    4112         [ +  - ]:        640 :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"")
    4113 [ +  - ][ +  - ]:        640 :                   << fullName << "\")), ";
    4114         [ +  + ]:        640 :                 if (rest) {
    4115                 :            :                     o << translateUnoToCppIdentifier(
    4116                 :            :                         rtl::OUStringToOString(
    4117                 :            :                             m_reader.getMethodParameterName(i, 0),
    4118                 :            :                             RTL_TEXTENCODING_UTF8),
    4119 [ +  - ][ +  - ]:          4 :                         "param", ITM_NONGLOBAL);
         [ +  - ][ +  - ]
    4120         [ +  + ]:        636 :                 } else if (params == 0) {
    4121                 :            :                     o << ("::com::sun::star::uno::Sequence<"
    4122         [ +  - ]:         74 :                           " ::com::sun::star::uno::Any >()");
    4123                 :            :                 } else {
    4124         [ +  - ]:        562 :                     o << "the_arguments";
    4125                 :            :                 }
    4126         [ +  - ]:        640 :                 o << ", the_context), ::com::sun::star::uno::UNO_QUERY);\n";
    4127         [ +  + ]:        640 :                 if (!tree.getRoot()->present) {
    4128         [ +  - ]:        626 :                     dec();
    4129 [ +  - ][ +  - ]:       1252 :                     o << indent()
    4130                 :            :                       << ("} catch (::com::sun::star::uno::RuntimeException &)"
    4131         [ +  - ]:        626 :                           " {\n");
    4132                 :        626 :                     inc();
    4133 [ +  - ][ +  - ]:        626 :                     o << indent() << "throw;\n";
                 [ +  - ]
    4134         [ +  - ]:        626 :                     dec();
    4135         [ +  - ]:        626 :                     dumpCatchClauses(o, tree.getRoot());
    4136 [ +  - ][ +  - ]:       1252 :                     o << indent()
    4137                 :            :                       << ("} catch (::com::sun::star::uno::Exception &"
    4138         [ +  - ]:        626 :                           " the_exception) {\n");
    4139                 :        626 :                     inc();
    4140 [ +  - ][ +  - ]:       1252 :                     o << indent()
    4141                 :            :                       << ("throw ::com::sun::star::uno::DeploymentException("
    4142                 :            :                           "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("
    4143         [ +  - ]:        626 :                           "\"component context fails to supply service ")
    4144 [ +  - ][ +  - ]:        626 :                       << fullName << " of type " << fullBaseName
                 [ +  - ]
    4145         [ +  - ]:        626 :                       << ": \")) + the_exception.Message, the_context);\n";
    4146         [ +  - ]:        626 :                     dec();
    4147 [ +  - ][ +  - ]:        626 :                     o << indent() << "}\n";
                 [ +  - ]
    4148                 :            :                 }
    4149 [ +  - ][ +  - ]:        640 :                 o << indent() << "if (!the_instance.is()) {\n";
                 [ +  - ]
    4150                 :        640 :                 inc();
    4151 [ +  - ][ +  - ]:       1280 :                 o << indent()
    4152                 :            :                   << ("throw ::com::sun::star::uno::DeploymentException("
    4153                 :            :                       "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("
    4154         [ +  - ]:        640 :                       "\"component context fails to supply service ")
    4155 [ +  - ][ +  - ]:        640 :                   << fullName << " of type " << fullBaseName
                 [ +  - ]
    4156         [ +  - ]:        640 :                   << "\")), the_context);\n";
    4157         [ +  - ]:        640 :                 dec();
    4158 [ +  - ][ +  - ]:        640 :                 o << indent() << "}\n" << indent() << "return the_instance;\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4159         [ +  - ]:        640 :                 dec();
    4160 [ +  - ][ +  - ]:        640 :                 o << indent() << "}\n\n";
         [ +  - ][ +  - ]
    4161                 :            :             }
    4162                 :        904 :         }
    4163                 :            :     }
    4164         [ +  - ]:        988 :     o << "private:\n";
    4165 [ +  - ][ +  - ]:       1976 :     o << indent() << cppName << "(); // not implemented\n"
         [ +  - ][ +  - ]
    4166 [ +  - ][ +  - ]:       2964 :       << indent() << cppName << "(" << cppName << " &); // not implemented\n"
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4167 [ +  - ][ +  - ]:       2964 :       << indent() << "~" << cppName << "(); // not implemented\n"
         [ +  - ][ +  - ]
                 [ +  - ]
    4168 [ +  - ][ +  - ]:       2964 :       << indent() << "void operator =(" << cppName << "); // not implemented\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    4169         [ +  - ]:        988 :     dec();
    4170         [ +  - ]:        988 :     o << "};\n\n";
    4171 [ +  - ][ +  - ]:        988 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
    4172         [ +  - ]:        988 :         o << "\n";
    4173                 :            :     }
    4174 [ +  - ][ +  - ]:        988 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    4175                 :        988 :     return true;
    4176                 :            : }
    4177                 :            : 
    4178                 :        988 : void ServiceType::addSpecialDependencies() {
    4179         [ +  + ]:        988 :     if (m_reader.getMethodCount() > 0) {
    4180                 :            :         OSL_ASSERT(m_reader.getSuperTypeCount() == 1);
    4181                 :            :         m_dependencies.add(
    4182                 :            :             rtl::OUStringToOString(
    4183 [ +  - ][ +  - ]:        904 :                 m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
    4184                 :            :     }
    4185                 :        988 : }
    4186                 :            : 
    4187                 :       2060 : bool ServiceType::isDefaultConstructor(sal_uInt16 ctorIndex) const {
    4188                 :       2060 :     return m_reader.getMethodName(ctorIndex).isEmpty();
    4189                 :            : }
    4190                 :            : 
    4191                 :       1280 : bool ServiceType::hasRestParameter(sal_uInt16 ctorIndex) const {
    4192                 :       1280 :     return m_reader.getMethodParameterCount(ctorIndex) == 1
    4193                 :        848 :         && ((m_reader.getMethodParameterFlags(ctorIndex, 0) & RT_PARAM_REST)
    4194   [ +  +  +  + ]:       2128 :             != 0);
    4195                 :            : }
    4196                 :            : 
    4197                 :        774 : void ServiceType::dumpCatchClauses(
    4198                 :            :     FileStream & out, codemaker::ExceptionTreeNode const * node)
    4199                 :            : {
    4200         [ +  + ]:        774 :     if (node->present) {
    4201 [ +  - ][ +  - ]:        148 :         out << indent() << "} catch (";
    4202                 :        148 :         dumpType(out, node->name);
    4203                 :        148 :         out << " &) {\n";
    4204                 :        148 :         inc();
    4205 [ +  - ][ +  - ]:        148 :         out << indent() << "throw;\n";
    4206                 :        148 :         dec();
    4207                 :            :     } else {
    4208 [ +  - ][ +  + ]:       1548 :         for (codemaker::ExceptionTreeNode::Children::const_iterator i(
    4209                 :        626 :                  node->children.begin());
    4210                 :        774 :              i != node->children.end(); ++i)
    4211                 :            :         {
    4212         [ +  - ]:        148 :             dumpCatchClauses(out, *i);
    4213                 :            :         }
    4214                 :            :     }
    4215                 :        774 : }
    4216                 :            : 
    4217                 :            : //*************************************************************************
    4218                 :            : // SingletonType
    4219                 :            : //*************************************************************************
    4220                 :            : 
    4221                 :        354 : bool SingletonType::isInterfaceBased() {
    4222                 :            :     return (m_typeMgr.getTypeClass(
    4223                 :            :                 rtl::OUStringToOString(
    4224 [ +  - ][ +  - ]:        354 :                     m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8)))
    4225                 :        354 :         == RT_TYPE_INTERFACE;
    4226                 :            : }
    4227                 :            : 
    4228                 :        336 : sal_Bool SingletonType::dumpHxxFile(
    4229                 :            :     FileStream & o, codemaker::cppumaker::Includes & includes)
    4230                 :            :     throw (CannotDumpException)
    4231                 :            : {
    4232                 :            :     rtl::OString cppName(translateUnoToCppIdentifier(
    4233         [ +  - ]:        336 :                              m_name, "singleton", isGlobal()));
    4234                 :        336 :     rtl::OString fullName(m_typeName.replace('/', '.'));
    4235                 :            :     rtl::OString baseName(
    4236                 :            :         rtl::OUStringToOString(
    4237 [ +  - ][ +  - ]:        336 :             m_reader.getSuperTypeName(0), RTL_TEXTENCODING_UTF8));
    4238                 :        336 :     rtl::OString fullBaseName(baseName.replace('/', '.'));
    4239         [ +  - ]:        336 :     rtl::OString scopedBaseName(scopedCppName(baseName));
    4240         [ +  - ]:        336 :     rtl::OString headerDefine(dumpHeaderDefine(o, "HPP"));
    4241         [ +  - ]:        336 :     o << "\n";
    4242                 :            :     //TODO: Decide whether the types added to includes should rather be added to
    4243                 :            :     // m_dependencies (and thus be generated during dumpDependedTypes):
    4244         [ +  - ]:        336 :     includes.add("com/sun/star/uno/DeploymentException");
    4245         [ +  - ]:        336 :     includes.add("com/sun/star/uno/XComponentContext");
    4246                 :        336 :     includes.addAny();
    4247                 :        336 :     includes.addReference();
    4248                 :        336 :     includes.addRtlUstringH();
    4249                 :        336 :     includes.addRtlUstringHxx();
    4250         [ +  - ]:        336 :     includes.dump(o, 0);
    4251         [ +  - ]:        336 :     o << "\n";
    4252 [ +  - ][ +  + ]:        336 :     if (codemaker::cppumaker::dumpNamespaceOpen(o, m_typeName, false)) {
    4253         [ +  - ]:        328 :         o << "\n";
    4254                 :            :     }
    4255 [ +  - ][ +  - ]:        336 :     o << "\nclass " << cppName << " {\npublic:\n";
                 [ +  - ]
    4256                 :        336 :     inc();
    4257 [ +  - ][ +  - ]:        672 :     o << indent() << "static ::com::sun::star::uno::Reference< "
                 [ +  - ]
    4258 [ +  - ][ +  - ]:        336 :       << scopedBaseName << " > "
    4259 [ +  - ][ +  - ]:       1008 :       << translateUnoToCppIdentifier("get", "method", ITM_NONGLOBAL, &cppName)
    4260                 :            :       << ("(::com::sun::star::uno::Reference<"
    4261         [ +  - ]:        336 :           " ::com::sun::star::uno::XComponentContext > const & context) {\n");
    4262                 :        336 :     inc();
    4263 [ +  - ][ +  - ]:        672 :     o << indent() << "::com::sun::star::uno::Reference< " << scopedBaseName
         [ +  - ][ +  - ]
    4264 [ +  - ][ +  - ]:       1008 :       << " > instance;\n" << indent()
                 [ +  - ]
    4265                 :            :       << ("if (!(context->getValueByName("
    4266         [ +  - ]:        336 :           "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"/singletons/")
    4267 [ +  - ][ +  - ]:        336 :       << fullName << "\"))) >>= instance) || !instance.is()) {\n";
    4268                 :        336 :     inc();
    4269 [ +  - ][ +  - ]:        672 :     o << indent()
    4270                 :            :       << ("throw ::com::sun::star::uno::DeploymentException("
    4271                 :            :           "::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"component context"
    4272         [ +  - ]:        336 :           " fails to supply singleton ")
    4273 [ +  - ][ +  - ]:        336 :       << fullName << " of type " << fullBaseName << "\")), context);\n";
         [ +  - ][ +  - ]
    4274         [ +  - ]:        336 :     dec();
    4275 [ +  - ][ +  - ]:        336 :     o << indent() << "}\n" << indent() << "return instance;\n";
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4276         [ +  - ]:        336 :     dec();
    4277 [ +  - ][ +  - ]:        336 :     o << indent() << "}\n\n";
                 [ +  - ]
    4278         [ +  - ]:        336 :     o << "private:\n";
    4279 [ +  - ][ +  - ]:        672 :     o << indent() << cppName << "(); // not implemented\n"
         [ +  - ][ +  - ]
    4280 [ +  - ][ +  - ]:       1008 :       << indent() << cppName << "(" << cppName << " &); // not implemented\n"
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    4281 [ +  - ][ +  - ]:       1008 :       << indent() << "~" << cppName << "(); // not implemented\n"
         [ +  - ][ +  - ]
                 [ +  - ]
    4282 [ +  - ][ +  - ]:       1008 :       << indent() << "void operator =(" << cppName << "); // not implemented\n";
         [ +  - ][ +  - ]
                 [ +  - ]
    4283         [ +  - ]:        336 :     dec();
    4284         [ +  - ]:        336 :     o << "};\n\n";
    4285 [ +  - ][ +  + ]:        336 :     if (codemaker::cppumaker::dumpNamespaceClose(o, m_typeName, false)) {
    4286         [ +  - ]:        328 :         o << "\n";
    4287                 :            :     }
    4288 [ +  - ][ +  - ]:        336 :     o << "\n#endif // "<< headerDefine << "\n";
                 [ +  - ]
    4289                 :        336 :     return true;
    4290                 :            : }
    4291                 :            : 
    4292                 :            : //*************************************************************************
    4293                 :            : // produceType
    4294                 :            : //*************************************************************************
    4295                 :      32420 : bool produceType(const OString& typeName,
    4296                 :            :                  TypeManager const & typeMgr,
    4297                 :            :                  codemaker::GeneratedTypeSet & generated,
    4298                 :            :                  CppuOptions* pOptions)
    4299                 :            :     throw( CannotDumpException )
    4300                 :            : {
    4301 [ +  + ][ +  - ]:      97220 :     if (typeName.equals("/") || typeName.equals(typeMgr.getBase()) ||
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
             #  #  #  # ]
    4302 [ +  - ][ +  - ]:      64800 :         TypeManager::isBaseType(typeName) || generated.contains(typeName))
    4303                 :            :     {
    4304                 :      27848 :         return true;
    4305                 :            :     }
    4306                 :            : 
    4307                 :       4572 :     sal_Bool bIsExtraType = sal_False;
    4308         [ +  - ]:       4572 :     typereg::Reader reader(typeMgr.getTypeReader(typeName, &bIsExtraType));
    4309         [ +  + ]:       4572 :     if (bIsExtraType) {
    4310         [ +  - ]:        434 :         generated.add(typeName);
    4311                 :        434 :         return true;
    4312                 :            :     }
    4313                 :            : 
    4314         [ -  + ]:       4138 :     if (!reader.isValid()) {
    4315                 :          0 :         return false;
    4316                 :            :     }
    4317                 :            : 
    4318                 :       4138 :     RTTypeClass typeClass = reader.getTypeClass();
    4319                 :       4138 :     bool ret = false;
    4320   [ +  -  +  +  :       4138 :     switch (typeClass)
          +  +  -  -  -  
                   -  - ]
    4321                 :            :     {
    4322                 :            :         case RT_TYPE_INTERFACE:
    4323                 :            :             {
    4324         [ +  - ]:       2410 :                 InterfaceType iType(reader, typeName, typeMgr);
    4325         [ +  - ]:       2410 :                 ret = iType.dump(pOptions);
    4326 [ +  - ][ +  - ]:       2410 :                 if (ret) generated.add(typeName);
    4327 [ +  - ][ +  - ]:       2410 :                 iType.dumpDependedTypes(generated, pOptions);
    4328                 :            :             }
    4329                 :       2410 :             break;
    4330                 :            :         case RT_TYPE_MODULE:
    4331                 :            :             {
    4332         [ #  # ]:          0 :                 ModuleType mType(reader, typeName, typeMgr);
    4333         [ #  # ]:          0 :                 if (mType.hasConstants())
    4334                 :            :                 {
    4335         [ #  # ]:          0 :                     ret = mType.dump(pOptions);
    4336 [ #  # ][ #  # ]:          0 :                     if (ret) generated.add(typeName);
    4337                 :            :                 } else
    4338                 :            :                 {
    4339         [ #  # ]:          0 :                     generated.add(typeName);
    4340                 :          0 :                     ret = true;
    4341         [ #  # ]:          0 :                 }
    4342                 :            :             }
    4343                 :          0 :             break;
    4344                 :            :         case RT_TYPE_STRUCT:
    4345                 :            :             {
    4346         [ +  - ]:        920 :                 StructureType sType(reader, typeName, typeMgr);
    4347         [ +  - ]:        920 :                 ret = sType.dump(pOptions);
    4348 [ +  - ][ +  - ]:        920 :                 if (ret) generated.add(typeName);
    4349 [ +  - ][ +  - ]:        920 :                 sType.dumpDependedTypes(generated, pOptions);
    4350                 :            :             }
    4351                 :        920 :             break;
    4352                 :            :         case RT_TYPE_ENUM:
    4353                 :            :             {
    4354         [ +  - ]:        316 :                 EnumType enType(reader, typeName, typeMgr);
    4355         [ +  - ]:        316 :                 ret = enType.dump(pOptions);
    4356 [ +  - ][ +  - ]:        316 :                 if (ret) generated.add(typeName);
    4357 [ +  - ][ +  - ]:        316 :                 enType.dumpDependedTypes(generated, pOptions);
    4358                 :            :             }
    4359                 :        316 :             break;
    4360                 :            :         case RT_TYPE_EXCEPTION:
    4361                 :            :             {
    4362         [ +  - ]:        418 :                 ExceptionType eType(reader, typeName, typeMgr);
    4363         [ +  - ]:        418 :                 ret = eType.dump(pOptions);
    4364 [ +  - ][ +  - ]:        418 :                 if (ret) generated.add(typeName);
    4365 [ +  - ][ +  - ]:        418 :                 eType.dumpDependedTypes(generated, pOptions);
    4366                 :            :             }
    4367                 :        418 :             break;
    4368                 :            :         case RT_TYPE_TYPEDEF:
    4369                 :            :             {
    4370         [ +  - ]:         74 :                 TypeDefType tdType(reader, typeName, typeMgr);
    4371         [ +  - ]:         74 :                 ret = tdType.dump(pOptions);
    4372 [ +  - ][ +  - ]:         74 :                 if (ret) generated.add(typeName);
    4373 [ +  - ][ +  - ]:         74 :                 tdType.dumpDependedTypes(generated, pOptions);
    4374                 :            :             }
    4375                 :         74 :             break;
    4376                 :            :         case RT_TYPE_CONSTANTS:
    4377                 :            :             {
    4378         [ #  # ]:          0 :                 ConstantsType cType(reader, typeName, typeMgr);
    4379         [ #  # ]:          0 :                 if (cType.hasConstants())
    4380                 :            :                 {
    4381         [ #  # ]:          0 :                     ret = cType.dump(pOptions);
    4382 [ #  # ][ #  # ]:          0 :                     if (ret) generated.add(typeName);
    4383                 :            :                 } else
    4384                 :            :                 {
    4385         [ #  # ]:          0 :                     generated.add(typeName);
    4386                 :          0 :                     ret = true;
    4387         [ #  # ]:          0 :                 }
    4388                 :            :             }
    4389                 :          0 :             break;
    4390                 :            :         case RT_TYPE_SERVICE:
    4391                 :            :             {
    4392         [ #  # ]:          0 :                 ServiceType t(reader, typeName, typeMgr);
    4393         [ #  # ]:          0 :                 if (t.isSingleInterfaceBased()) {
    4394         [ #  # ]:          0 :                     ret = t.dump(pOptions);
    4395         [ #  # ]:          0 :                     if (ret) {
    4396         [ #  # ]:          0 :                         generated.add(typeName);
    4397         [ #  # ]:          0 :                         t.dumpDependedTypes(generated, pOptions);
    4398                 :            :                     }
    4399                 :            :                 } else {
    4400                 :          0 :                     ret = true;
    4401         [ #  # ]:          0 :                 }
    4402                 :            :             }
    4403                 :          0 :             break;
    4404                 :            :         case RT_TYPE_SINGLETON:
    4405                 :            :             {
    4406         [ #  # ]:          0 :                 SingletonType t(reader, typeName, typeMgr);
    4407 [ #  # ][ #  # ]:          0 :                 if (t.isInterfaceBased()) {
    4408         [ #  # ]:          0 :                     ret = t.dump(pOptions);
    4409         [ #  # ]:          0 :                     if (ret) {
    4410         [ #  # ]:          0 :                         generated.add(typeName);
    4411         [ #  # ]:          0 :                         t.dumpDependedTypes(generated, pOptions);
    4412                 :            :                     }
    4413                 :            :                 } else {
    4414                 :          0 :                     ret = true;
    4415         [ #  # ]:          0 :                 }
    4416                 :            :             }
    4417                 :          0 :             break;
    4418                 :            :         case RT_TYPE_OBJECT:
    4419                 :          0 :             ret = true;
    4420                 :          0 :             break;
    4421                 :            :         default:
    4422                 :            :             OSL_ASSERT(false);
    4423                 :          0 :             break;
    4424                 :            :     }
    4425                 :            : 
    4426                 :      32420 :     return ret;
    4427                 :            : }
    4428                 :            : 
    4429                 :      20746 : bool produceType(RegistryKey& rTypeKey, bool bIsExtraType,
    4430                 :            :                      TypeManager const & typeMgr,
    4431                 :            :                      codemaker::GeneratedTypeSet & generated,
    4432                 :            :                      CppuOptions* pOptions)
    4433                 :            :     throw( CannotDumpException )
    4434                 :            : {
    4435         [ +  - ]:      20746 :     OString typeName = typeMgr.getTypeName(rTypeKey);
    4436                 :            : 
    4437 [ +  - ][ +  - ]:      62238 :     if (typeName.equals("/") ||typeName.equals(typeMgr.getBase()) ||
         [ +  - ][ +  - ]
         [ +  + ][ +  - ]
         [ +  - ][ +  - ]
           [ +  +  #  #  
             #  #  #  # ]
    4438 [ +  - ][ +  - ]:      41492 :         TypeManager::isBaseType(typeName) || generated.contains(typeName))
    4439                 :            :     {
    4440                 :       4130 :         return true;
    4441                 :            :     }
    4442                 :            : 
    4443         [ -  + ]:      16616 :     if (bIsExtraType) {
    4444         [ #  # ]:          0 :         generated.add(typeName);
    4445                 :          0 :         return true;
    4446                 :            :     }
    4447                 :            : 
    4448         [ +  - ]:      16616 :     typereg::Reader reader(typeMgr.getTypeReader(rTypeKey));
    4449         [ -  + ]:      16616 :     if (!reader.isValid()) {
    4450                 :          0 :         return false;
    4451                 :            :     }
    4452                 :            : 
    4453                 :      16616 :     RTTypeClass typeClass = reader.getTypeClass();
    4454                 :      16616 :     bool ret = false;
    4455   [ +  +  +  +  :      16616 :     switch (typeClass)
          +  +  +  +  +  
                   -  - ]
    4456                 :            :     {
    4457                 :            :         case RT_TYPE_INTERFACE:
    4458                 :            :             {
    4459         [ +  - ]:       4788 :                 InterfaceType iType(reader, typeName, typeMgr);
    4460         [ +  - ]:       4788 :                 ret = iType.dump(pOptions);
    4461 [ +  - ][ +  - ]:       4788 :                 if (ret) generated.add(typeName);
    4462 [ +  - ][ +  - ]:       4788 :                 iType.dumpDependedTypes(generated, pOptions);
    4463                 :            :             }
    4464                 :       4788 :             break;
    4465                 :            :         case RT_TYPE_MODULE:
    4466                 :            :             {
    4467         [ +  - ]:        654 :                 ModuleType mType(reader, typeName, typeMgr);
    4468         [ -  + ]:        654 :                 if (mType.hasConstants())
    4469                 :            :                 {
    4470         [ #  # ]:          0 :                     ret = mType.dump(pOptions);
    4471 [ #  # ][ #  # ]:          0 :                     if (ret) generated.add(typeName);
    4472                 :            :                 } else
    4473                 :            :                 {
    4474         [ +  - ]:        654 :                     generated.add(typeName);
    4475                 :        654 :                     ret = true;
    4476         [ +  - ]:        654 :                 }
    4477                 :            :             }
    4478                 :        654 :             break;
    4479                 :            :         case RT_TYPE_STRUCT:
    4480                 :            :             {
    4481         [ +  - ]:        906 :                 StructureType sType(reader, typeName, typeMgr);
    4482         [ +  - ]:        906 :                 ret = sType.dump(pOptions);
    4483 [ +  - ][ +  - ]:        906 :                 if (ret) generated.add(typeName);
    4484 [ +  - ][ +  - ]:        906 :                 sType.dumpDependedTypes(generated, pOptions);
    4485                 :            :             }
    4486                 :        906 :             break;
    4487                 :            :         case RT_TYPE_ENUM:
    4488                 :            :             {
    4489         [ +  - ]:        516 :                 EnumType enType(reader, typeName, typeMgr);
    4490         [ +  - ]:        516 :                 ret = enType.dump(pOptions);
    4491 [ +  - ][ +  - ]:        516 :                 if (ret) generated.add(typeName);
    4492 [ +  - ][ +  - ]:        516 :                 enType.dumpDependedTypes(generated, pOptions);
    4493                 :            :             }
    4494                 :        516 :             break;
    4495                 :            :         case RT_TYPE_EXCEPTION:
    4496                 :            :             {
    4497         [ +  - ]:        630 :                 ExceptionType eType(reader, typeName, typeMgr);
    4498         [ +  - ]:        630 :                 ret = eType.dump(pOptions);
    4499 [ +  - ][ +  - ]:        630 :                 if (ret) generated.add(typeName);
    4500 [ +  - ][ +  - ]:        630 :                 eType.dumpDependedTypes(generated, pOptions);
    4501                 :            :             }
    4502                 :        630 :             break;
    4503                 :            :         case RT_TYPE_TYPEDEF:
    4504                 :            :             {
    4505         [ +  - ]:        126 :                 TypeDefType tdType(reader, typeName, typeMgr);
    4506         [ +  - ]:        126 :                 ret = tdType.dump(pOptions);
    4507 [ +  - ][ +  - ]:        126 :                 if (ret) generated.add(typeName);
    4508 [ +  - ][ +  - ]:        126 :                 tdType.dumpDependedTypes(generated, pOptions);
    4509                 :            :             }
    4510                 :        126 :             break;
    4511                 :            :         case RT_TYPE_CONSTANTS:
    4512                 :            :             {
    4513         [ +  - ]:       3084 :                 ConstantsType cType(reader, typeName, typeMgr);
    4514         [ +  - ]:       3084 :                 if (cType.hasConstants())
    4515                 :            :                 {
    4516         [ +  - ]:       3084 :                     ret = cType.dump(pOptions);
    4517 [ +  - ][ +  - ]:       3084 :                     if (ret) generated.add(typeName);
    4518                 :            :                 } else
    4519                 :            :                 {
    4520         [ #  # ]:          0 :                     generated.add(typeName);
    4521                 :          0 :                     ret = true;
    4522         [ +  - ]:       3084 :                 }
    4523                 :            :             }
    4524                 :       3084 :             break;
    4525                 :            :         case RT_TYPE_SERVICE:
    4526                 :            :             {
    4527         [ +  - ]:       5558 :                 ServiceType t(reader, typeName, typeMgr);
    4528         [ +  + ]:       5558 :                 if (t.isSingleInterfaceBased()) {
    4529         [ +  - ]:        988 :                     ret = t.dump(pOptions);
    4530         [ +  - ]:        988 :                     if (ret) {
    4531         [ +  - ]:        988 :                         generated.add(typeName);
    4532         [ +  - ]:        988 :                         t.dumpDependedTypes(generated, pOptions);
    4533                 :            :                     }
    4534                 :            :                 } else {
    4535                 :       4570 :                     ret = true;
    4536         [ +  - ]:       5558 :                 }
    4537                 :            :             }
    4538                 :       5558 :             break;
    4539                 :            :         case RT_TYPE_SINGLETON:
    4540                 :            :             {
    4541         [ +  - ]:        354 :                 SingletonType t(reader, typeName, typeMgr);
    4542 [ +  - ][ +  + ]:        354 :                 if (t.isInterfaceBased()) {
    4543         [ +  - ]:        336 :                     ret = t.dump(pOptions);
    4544         [ +  - ]:        336 :                     if (ret) {
    4545         [ +  - ]:        336 :                         generated.add(typeName);
    4546         [ +  - ]:        336 :                         t.dumpDependedTypes(generated, pOptions);
    4547                 :            :                     }
    4548                 :            :                 } else {
    4549                 :         18 :                     ret = true;
    4550         [ +  - ]:        354 :                 }
    4551                 :            :             }
    4552                 :        354 :             break;
    4553                 :            :         case RT_TYPE_OBJECT:
    4554                 :          0 :             ret = true;
    4555                 :          0 :             break;
    4556                 :            :         default:
    4557                 :            :             OSL_ASSERT(false);
    4558                 :          0 :             break;
    4559                 :            :     }
    4560                 :            : 
    4561                 :      20746 :     return ret;
    4562                 :            : }
    4563                 :            : 
    4564                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10