LCOV - code coverage report
Current view: top level - codemaker/source/cppumaker - cpputype.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 10 100.0 %
Date: 2012-08-25 Functions: 7 10 70.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.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                 :            : #ifndef INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_CPPUTYPE_HXX
      21                 :            : #define INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_CPPUTYPE_HXX
      22                 :            : 
      23                 :            : #include "codemaker/dependencies.hxx"
      24                 :            : #include "codemaker/options.hxx"
      25                 :            : #include "codemaker/typemanager.hxx"
      26                 :            : #include "codemaker/commoncpp.hxx"
      27                 :            : #include "registry/reader.hxx"
      28                 :            : #include "registry/types.h"
      29                 :            : #include "rtl/string.hxx"
      30                 :            : 
      31                 :            : namespace rtl { class OUString; }
      32                 :            : namespace codemaker {
      33                 :            :     namespace cppumaker { class Includes; }
      34                 :            :     struct ExceptionTreeNode;
      35                 :            :     class GeneratedTypeSet;
      36                 :            : }
      37                 :            : 
      38                 :            : enum CppuTypeDecl
      39                 :            : {
      40                 :            :     CPPUTYPEDECL_ALLTYPES,
      41                 :            :     CPPUTYPEDECL_NOINTERFACES,
      42                 :            :     CPPUTYPEDECL_ONLYINTERFACES
      43                 :            : };
      44                 :            : 
      45                 :            : class CppuOptions;
      46                 :            : class FileStream;
      47                 :            : 
      48                 :            : class CppuType
      49                 :            : {
      50                 :            : public:
      51                 :            :     CppuType(typereg::Reader& typeReader,
      52                 :            :              const ::rtl::OString& typeName,
      53                 :            :              const TypeManager& typeMgr);
      54                 :            : 
      55                 :            :     virtual ~CppuType();
      56                 :            : 
      57                 :            :     virtual sal_Bool dump(CppuOptions* pOptions) throw( CannotDumpException );
      58                 :            :     sal_Bool dumpFile(CppuOptions* pOptions,
      59                 :            :                       const ::rtl::OString& sExtension,
      60                 :            :                       const ::rtl::OString& sName,
      61                 :            :                       const ::rtl::OString& sOutPath )
      62                 :            :         throw( CannotDumpException );
      63                 :            :     void dumpDependedTypes(
      64                 :            :         codemaker::GeneratedTypeSet & generated, CppuOptions * options);
      65                 :            :     virtual sal_Bool dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException ) = 0;
      66                 :            :     virtual sal_Bool dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException ) = 0;
      67                 :            : 
      68                 :            :     ::rtl::OString dumpHeaderDefine(
      69                 :            :         FileStream& o, char const * prefix, sal_Bool bExtended=sal_False);
      70                 :            : 
      71                 :            :     void dumpGetCppuType(FileStream & out);
      72                 :            :     virtual void dumpLightGetCppuType(FileStream& o);
      73                 :            :     virtual void dumpNormalGetCppuType(FileStream& o);
      74                 :            :     virtual void dumpComprehensiveGetCppuType(FileStream& o);
      75                 :            : 
      76                 :            :     virtual void dumpType(FileStream& o, const ::rtl::OString& type, bool bConst=false,
      77                 :            :                           bool bRef=false, bool bNative=false, bool cppuUnoType=false)
      78                 :            :         const throw( CannotDumpException );
      79                 :            :     ::rtl::OString  getTypeClass(const ::rtl::OString& type="", sal_Bool bCStyle=sal_False);
      80                 :            :     void    dumpCppuGetType(FileStream& o, const ::rtl::OString& type, sal_Bool bDecl=sal_False, CppuTypeDecl eDeclFlag=CPPUTYPEDECL_ALLTYPES);
      81                 :            : 
      82                 :            :     ::rtl::OString typeToIdentifier(const ::rtl::OString& type);
      83                 :            : 
      84                 :            :     void    dumpConstantValue(FileStream& o, sal_uInt16 index);
      85                 :            : 
      86                 :            :     virtual sal_uInt32  getMemberCount();
      87                 :            :     virtual sal_uInt32  getInheritedMemberCount();
      88                 :            : 
      89                 :            :     void            inc(sal_Int32 num=4);
      90                 :            :     void            dec(sal_Int32 num=4);
      91                 :            :     ::rtl::OString  indent() const;
      92                 :            : protected:
      93                 :            :     virtual sal_uInt32 checkInheritedMemberCount(
      94                 :            :         const typereg::Reader* pReader);
      95                 :            : 
      96                 :            :     bool passByReference(rtl::OString const & unoType);
      97                 :            : 
      98                 :            :     ::rtl::OString  resolveTypedefs(const ::rtl::OString& type) const;
      99                 :            :     ::rtl::OString  checkRealBaseType(const ::rtl::OString& type, sal_Bool bResolveTypeOnly = sal_False) const;
     100                 :            :     void    dumpCppuGetTypeMemberDecl(FileStream& o, CppuTypeDecl eDeclFlag);
     101                 :            : 
     102                 :            :     codemaker::cpp::IdentifierTranslationMode isGlobal() const;
     103                 :            : 
     104                 :            :     virtual void dumpDeclaration(FileStream & out) throw (CannotDumpException);
     105                 :            : 
     106                 :       7326 :     virtual void addSpecialDependencies() {}
     107                 :            : 
     108                 :            :     virtual bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
     109                 :            : 
     110                 :            :     virtual void addLightGetCppuTypeIncludes(
     111                 :            :         codemaker::cppumaker::Includes & includes) const;
     112                 :            : 
     113                 :            :     virtual void addNormalGetCppuTypeIncludes(
     114                 :            :         codemaker::cppumaker::Includes & includes) const;
     115                 :            : 
     116                 :            :     virtual void addComprehensiveGetCppuTypeIncludes(
     117                 :            :         codemaker::cppumaker::Includes & includes) const;
     118                 :            : 
     119                 :            :     virtual bool isPolymorphic() const;
     120                 :            : 
     121                 :            :     virtual void dumpTemplateHead(FileStream & out) const;
     122                 :            : 
     123                 :            :     virtual void dumpTemplateParameters(FileStream & out) const;
     124                 :            : 
     125                 :            :     void dumpGetCppuTypePreamble(FileStream & out);
     126                 :            : 
     127                 :            :     void dumpGetCppuTypePostamble(FileStream & out);
     128                 :            : 
     129                 :            :     void addDefaultHIncludes(codemaker::cppumaker::Includes & includes) const;
     130                 :            :     void addDefaultHxxIncludes(codemaker::cppumaker::Includes & includes) const;
     131                 :            : 
     132                 :            :     void dumpInitializer(
     133                 :            :         FileStream & out, bool parameterized, rtl::OUString const & type) const;
     134                 :            : 
     135                 :            :     void dumpHFileContent(
     136                 :            :         FileStream & out, codemaker::cppumaker::Includes & includes);
     137                 :            : 
     138                 :            : protected:
     139                 :            :     sal_uInt32          m_inheritedMemberCount;
     140                 :            : 
     141                 :            :     sal_Bool            m_cppuTypeLeak;
     142                 :            :     sal_Bool            m_cppuTypeDynamic;
     143                 :            :     sal_Int32           m_indentLength;
     144                 :            :     ::rtl::OString      m_typeName;
     145                 :            :     ::rtl::OString      m_name;
     146                 :            :     typereg::Reader     m_reader;
     147                 :            :     TypeManager const & m_typeMgr;
     148                 :            :     codemaker::Dependencies m_dependencies;
     149                 :            : 
     150                 :            : private:
     151                 :            :     void addGetCppuTypeIncludes(codemaker::cppumaker::Includes & includes)
     152                 :            :         const;
     153                 :            : };
     154                 :            : 
     155                 :            : class InterfaceType : public CppuType
     156                 :            : {
     157                 :            : public:
     158                 :            :     InterfaceType(typereg::Reader& typeReader,
     159                 :            :                  const ::rtl::OString& typeName,
     160                 :            :                  const TypeManager& typeMgr);
     161                 :            : 
     162                 :            :     virtual ~InterfaceType();
     163                 :            : 
     164                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     165                 :            :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     166                 :            :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     167                 :            : 
     168                 :            :     void        dumpAttributes(FileStream& o);
     169                 :            :     void        dumpMethods(FileStream& o);
     170                 :            :     void        dumpNormalGetCppuType(FileStream& o);
     171                 :            :     void        dumpComprehensiveGetCppuType(FileStream& o);
     172                 :            :     void        dumpCppuAttributeRefs(FileStream& o, sal_uInt32& index);
     173                 :            :     void        dumpCppuMethodRefs(FileStream& o, sal_uInt32& index);
     174                 :            :     void        dumpCppuAttributes(FileStream& o, sal_uInt32& index);
     175                 :            :     void        dumpCppuMethods(FileStream& o, sal_uInt32& index);
     176                 :            :     void        dumpAttributesCppuDecl(FileStream& o, StringSet* pFinishedTypes, CppuTypeDecl eDeclFlag);
     177                 :            :     void        dumpMethodsCppuDecl(FileStream& o, StringSet* pFinishedTypes, CppuTypeDecl eDeclFlag );
     178                 :            : 
     179                 :            :     sal_uInt32  getMemberCount();
     180                 :            :     sal_uInt32  getInheritedMemberCount();
     181                 :            : 
     182                 :            : protected:
     183                 :            :     virtual void addSpecialDependencies();
     184                 :            : 
     185                 :            :     virtual void addComprehensiveGetCppuTypeIncludes(
     186                 :            :         codemaker::cppumaker::Includes & includes) const;
     187                 :            : 
     188                 :            :     sal_uInt32  checkInheritedMemberCount(const typereg::Reader* pReader);
     189                 :            : 
     190                 :            : protected:
     191                 :            :     sal_uInt32  m_inheritedMemberCount;
     192                 :            :     sal_Bool    m_hasAttributes;
     193                 :            :     sal_Bool    m_hasMethods;
     194                 :            : 
     195                 :            : private:
     196                 :            :     void dumpExceptionSpecification(
     197                 :            :         FileStream & out, sal_uInt32 methodIndex, bool runtimeException);
     198                 :            : 
     199                 :            :     void dumpAttributeExceptionSpecification(
     200                 :            :         FileStream & out, rtl::OUString const & name, RTMethodMode sort);
     201                 :            : 
     202                 :            :     void dumpExceptionTypeName(
     203                 :            :         FileStream & out, char const * prefix, sal_uInt32 index,
     204                 :            :         rtl::OUString name);
     205                 :            : 
     206                 :            :     sal_Int32 dumpExceptionTypeNames(
     207                 :            :         FileStream & out, char const * prefix, sal_uInt16 methodIndex,
     208                 :            :         bool runtimeException);
     209                 :            : 
     210                 :            :     sal_Int32 dumpAttributeExceptionTypeNames(
     211                 :            :         FileStream & out, char const * prefix, rtl::OUString const & name,
     212                 :            :         RTMethodMode sort);
     213                 :            : };
     214                 :            : 
     215                 :            : class ConstantsType : public CppuType
     216                 :            : {
     217                 :            : public:
     218                 :            :     ConstantsType(typereg::Reader& typeReader,
     219                 :            :                   const ::rtl::OString& typeName,
     220                 :            :                   const TypeManager& typeMgr);
     221                 :            : 
     222                 :            :     virtual ~ConstantsType();
     223                 :            : 
     224                 :            :     virtual sal_Bool    dump(CppuOptions* pOptions) throw( CannotDumpException );
     225                 :            : 
     226                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     227                 :            :     sal_Bool            dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     228                 :            :     sal_Bool            dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     229                 :            :     sal_Bool            hasConstants();
     230                 :            : };
     231                 :            : 
     232                 :            : class ModuleType : public ConstantsType
     233                 :            : {
     234                 :            : public:
     235                 :            :     ModuleType(typereg::Reader& typeReader,
     236                 :            :                   const ::rtl::OString& typeName,
     237                 :            :                const TypeManager& typeMgr);
     238                 :            : 
     239                 :            :     virtual ~ModuleType();
     240                 :            : 
     241                 :            : protected:
     242                 :            :     virtual bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
     243                 :            : };
     244                 :            : 
     245                 :            : class StructureType : public CppuType
     246                 :            : {
     247                 :            : public:
     248                 :            :     StructureType(typereg::Reader& typeReader,
     249                 :            :                   const ::rtl::OString& typeName,
     250                 :            :                   const TypeManager& typeMgr);
     251                 :            : 
     252                 :            :     virtual ~StructureType();
     253                 :            : 
     254                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     255                 :            :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     256                 :            :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     257                 :            : 
     258                 :            :     virtual void dumpLightGetCppuType(FileStream & out);
     259                 :            : 
     260                 :            :     virtual void dumpNormalGetCppuType(FileStream & out);
     261                 :            : 
     262                 :            :     virtual void dumpComprehensiveGetCppuType(FileStream & out);
     263                 :            : 
     264                 :            :     sal_Bool    dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType);
     265                 :            : 
     266                 :            : protected:
     267                 :            :     virtual void addLightGetCppuTypeIncludes(
     268                 :            :         codemaker::cppumaker::Includes & includes) const;
     269                 :            : 
     270                 :            :     virtual void addNormalGetCppuTypeIncludes(
     271                 :            :         codemaker::cppumaker::Includes & includes) const;
     272                 :            : 
     273                 :            :     virtual void addComprehensiveGetCppuTypeIncludes(
     274                 :            :         codemaker::cppumaker::Includes & includes) const;
     275                 :            : 
     276                 :            :     virtual bool isPolymorphic() const;
     277                 :            : 
     278                 :            :     virtual void dumpTemplateHead(FileStream & out) const;
     279                 :            : 
     280                 :            :     virtual void dumpTemplateParameters(FileStream & out) const;
     281                 :            : };
     282                 :            : 
     283                 :            : class ExceptionType : public CppuType
     284                 :            : {
     285                 :            : public:
     286                 :            :     ExceptionType(typereg::Reader& typeReader,
     287                 :            :                   const ::rtl::OString& typeName,
     288                 :            :                   const TypeManager& typeMgr);
     289                 :            : 
     290                 :            :     virtual ~ExceptionType();
     291                 :            : 
     292                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     293                 :            :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     294                 :            :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     295                 :            : 
     296                 :            :     sal_Bool    dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType);
     297                 :            : };
     298                 :            : 
     299                 :            : class EnumType : public CppuType
     300                 :            : {
     301                 :            : public:
     302                 :            :     EnumType(typereg::Reader& typeReader,
     303                 :            :               const ::rtl::OString& typeName,
     304                 :            :               const TypeManager& typeMgr);
     305                 :            : 
     306                 :            :     virtual ~EnumType();
     307                 :            : 
     308                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     309                 :            :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     310                 :            :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     311                 :            : 
     312                 :            :     void        dumpNormalGetCppuType(FileStream& o);
     313                 :            :     void        dumpComprehensiveGetCppuType(FileStream& o);
     314                 :            : };
     315                 :            : 
     316                 :            : class TypeDefType : public CppuType
     317                 :            : {
     318                 :            : public:
     319                 :            :     TypeDefType(typereg::Reader& typeReader,
     320                 :            :               const ::rtl::OString& typeName,
     321                 :            :               const TypeManager& typeMgr);
     322                 :            : 
     323                 :            :     virtual ~TypeDefType();
     324                 :            : 
     325                 :            :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     326                 :            :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     327                 :            :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     328                 :            : };
     329                 :            : 
     330         [ -  + ]:       5912 : class ConstructiveType: public CppuType {
     331                 :            : public:
     332                 :       5912 :     ConstructiveType(
     333                 :            :         typereg::Reader & reader, rtl::OString const & name,
     334                 :            :         TypeManager const & manager):
     335                 :       5912 :         CppuType(reader, name, manager) {}
     336                 :            : 
     337                 :            :     virtual sal_Bool dumpHFile(
     338                 :            :         FileStream & o, codemaker::cppumaker::Includes & includes)
     339                 :            :         throw (CannotDumpException);
     340                 :            : 
     341                 :            : protected:
     342                 :            :     virtual bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
     343                 :            : };
     344                 :            : 
     345         [ -  + ]:       5558 : class ServiceType: public ConstructiveType {
     346                 :            : public:
     347                 :       5558 :     ServiceType(
     348                 :            :         typereg::Reader & reader, rtl::OString const & name,
     349                 :            :         TypeManager const & manager):
     350                 :       5558 :         ConstructiveType(reader, name, manager) {}
     351                 :            : 
     352                 :            :     bool isSingleInterfaceBased();
     353                 :            : 
     354                 :            :     virtual sal_Bool dumpHxxFile(
     355                 :            :         FileStream & o, codemaker::cppumaker::Includes & includes)
     356                 :            :         throw (CannotDumpException);
     357                 :            : 
     358                 :            : private:
     359                 :            :     virtual void addSpecialDependencies();
     360                 :            : 
     361                 :            :     bool isDefaultConstructor(sal_uInt16 ctorIndex) const;
     362                 :            : 
     363                 :            :     bool hasRestParameter(sal_uInt16 ctorIndex) const;
     364                 :            : 
     365                 :            :     void dumpCatchClauses(
     366                 :            :         FileStream & out, codemaker::ExceptionTreeNode const * node);
     367                 :            : };
     368                 :            : 
     369         [ -  + ]:        354 : class SingletonType: public ConstructiveType {
     370                 :            : public:
     371                 :        354 :     SingletonType(
     372                 :            :         typereg::Reader & reader, rtl::OString const & name,
     373                 :            :         TypeManager const & manager):
     374                 :        354 :         ConstructiveType(reader, name, manager) {}
     375                 :            : 
     376                 :            :     bool isInterfaceBased();
     377                 :            : 
     378                 :            :     virtual sal_Bool dumpHxxFile(
     379                 :            :         FileStream & o, codemaker::cppumaker::Includes & includes)
     380                 :            :         throw (CannotDumpException);
     381                 :            : };
     382                 :            : 
     383                 :            : bool produceType(const ::rtl::OString& typeName,
     384                 :            :                      TypeManager const & typeMgr,
     385                 :            :                      codemaker::GeneratedTypeSet & generated,
     386                 :            :                      CppuOptions* pOptions)
     387                 :            :                  throw( CannotDumpException );
     388                 :            : 
     389                 :            : bool produceType(RegistryKey& typeName, bool bIsExtraType,
     390                 :            :                      TypeManager const & typeMgr,
     391                 :            :                      codemaker::GeneratedTypeSet & generated,
     392                 :            :                      CppuOptions* pOptions)
     393                 :            :                  throw( CannotDumpException );
     394                 :            : 
     395                 :            : /**
     396                 :            :  * This function returns a C++ scoped name, represents the namespace
     397                 :            :  * scoping of this type, e.g. com:.sun::star::uno::XInterface.
     398                 :            :  */
     399                 :            : // ::rtl::OString scopedName(const ::rtl::OString& scope, const ::rtl::OString& type,
     400                 :            : //                 sal_Bool bNoNameSpace=sal_False);
     401                 :            : 
     402                 :            : #endif // INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_CPPUTYPE_HXX
     403                 :            : 
     404                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10