LCOV - code coverage report
Current view: top level - libreoffice/codemaker/source/cppumaker - cpputype.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 10 100.0 %
Date: 2012-12-27 Functions: 7 10 70.0 %
Legend: Lines: hit not hit

          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        3566 :     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             :     bool                m_cppuTypeLeak;
     142             :     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             :     bool        m_hasAttributes;
     193             :     bool        m_hasMethods;
     194             :     bool        m_isDeprecated;
     195             : 
     196             : private:
     197             :     void dumpExceptionSpecification(
     198             :         FileStream & out, sal_uInt32 methodIndex, bool runtimeException);
     199             : 
     200             :     void dumpAttributeExceptionSpecification(
     201             :         FileStream & out, rtl::OUString const & name, RTMethodMode sort);
     202             : 
     203             :     void dumpExceptionTypeName(
     204             :         FileStream & out, char const * prefix, sal_uInt32 index,
     205             :         rtl::OUString name);
     206             : 
     207             :     sal_Int32 dumpExceptionTypeNames(
     208             :         FileStream & out, char const * prefix, sal_uInt16 methodIndex,
     209             :         bool runtimeException);
     210             : 
     211             :     sal_Int32 dumpAttributeExceptionTypeNames(
     212             :         FileStream & out, char const * prefix, rtl::OUString const & name,
     213             :         RTMethodMode sort);
     214             : };
     215             : 
     216             : class ConstantsType : public CppuType
     217             : {
     218             : public:
     219             :     ConstantsType(typereg::Reader& typeReader,
     220             :                   const ::rtl::OString& typeName,
     221             :                   const TypeManager& typeMgr);
     222             : 
     223             :     virtual ~ConstantsType();
     224             : 
     225             :     virtual sal_Bool    dump(CppuOptions* pOptions) throw( CannotDumpException );
     226             : 
     227             :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     228             :     sal_Bool            dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     229             :     sal_Bool            dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     230             :     sal_Bool            hasConstants();
     231             : };
     232             : 
     233             : class ModuleType : public ConstantsType
     234             : {
     235             : public:
     236             :     ModuleType(typereg::Reader& typeReader,
     237             :                   const ::rtl::OString& typeName,
     238             :                const TypeManager& typeMgr);
     239             : 
     240             :     virtual ~ModuleType();
     241             : 
     242             : protected:
     243             :     virtual bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
     244             : };
     245             : 
     246             : class StructureType : public CppuType
     247             : {
     248             : public:
     249             :     StructureType(typereg::Reader& typeReader,
     250             :                   const ::rtl::OString& typeName,
     251             :                   const TypeManager& typeMgr);
     252             : 
     253             :     virtual ~StructureType();
     254             : 
     255             :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     256             :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     257             :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     258             : 
     259             :     virtual void dumpLightGetCppuType(FileStream & out);
     260             : 
     261             :     virtual void dumpNormalGetCppuType(FileStream & out);
     262             : 
     263             :     virtual void dumpComprehensiveGetCppuType(FileStream & out);
     264             : 
     265             :     sal_Bool    dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType);
     266             : 
     267             : protected:
     268             :     virtual void addLightGetCppuTypeIncludes(
     269             :         codemaker::cppumaker::Includes & includes) const;
     270             : 
     271             :     virtual void addNormalGetCppuTypeIncludes(
     272             :         codemaker::cppumaker::Includes & includes) const;
     273             : 
     274             :     virtual void addComprehensiveGetCppuTypeIncludes(
     275             :         codemaker::cppumaker::Includes & includes) const;
     276             : 
     277             :     virtual bool isPolymorphic() const;
     278             : 
     279             :     virtual void dumpTemplateHead(FileStream & out) const;
     280             : 
     281             :     virtual void dumpTemplateParameters(FileStream & out) const;
     282             : };
     283             : 
     284             : class ExceptionType : public CppuType
     285             : {
     286             : public:
     287             :     ExceptionType(typereg::Reader& typeReader,
     288             :                   const ::rtl::OString& typeName,
     289             :                   const TypeManager& typeMgr);
     290             : 
     291             :     virtual ~ExceptionType();
     292             : 
     293             :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     294             :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     295             :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     296             : 
     297             :     sal_Bool    dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType);
     298             : };
     299             : 
     300             : class EnumType : public CppuType
     301             : {
     302             : public:
     303             :     EnumType(typereg::Reader& typeReader,
     304             :               const ::rtl::OString& typeName,
     305             :               const TypeManager& typeMgr);
     306             : 
     307             :     virtual ~EnumType();
     308             : 
     309             :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     310             :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     311             :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     312             : 
     313             :     void        dumpNormalGetCppuType(FileStream& o);
     314             :     void        dumpComprehensiveGetCppuType(FileStream& o);
     315             : };
     316             : 
     317             : class TypeDefType : public CppuType
     318             : {
     319             : public:
     320             :     TypeDefType(typereg::Reader& typeReader,
     321             :               const ::rtl::OString& typeName,
     322             :               const TypeManager& typeMgr);
     323             : 
     324             :     virtual ~TypeDefType();
     325             : 
     326             :     virtual void dumpDeclaration(FileStream& o) throw( CannotDumpException );
     327             :     sal_Bool    dumpHFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     328             :     sal_Bool    dumpHxxFile(FileStream& o, codemaker::cppumaker::Includes & includes) throw( CannotDumpException );
     329             : };
     330             : 
     331        3001 : class ConstructiveType: public CppuType {
     332             : public:
     333        3001 :     ConstructiveType(
     334             :         typereg::Reader & reader, rtl::OString const & name,
     335             :         TypeManager const & manager):
     336        3001 :         CppuType(reader, name, manager) {}
     337             : 
     338             :     virtual sal_Bool dumpHFile(
     339             :         FileStream & o, codemaker::cppumaker::Includes & includes)
     340             :         throw (CannotDumpException);
     341             : 
     342             : protected:
     343             :     virtual bool dumpFiles(CppuOptions * options, rtl::OString const & outPath);
     344             : };
     345             : 
     346        2820 : class ServiceType: public ConstructiveType {
     347             : public:
     348        2820 :     ServiceType(
     349             :         typereg::Reader & reader, rtl::OString const & name,
     350             :         TypeManager const & manager):
     351        2820 :         ConstructiveType(reader, name, manager) {}
     352             : 
     353             :     bool isSingleInterfaceBased();
     354             : 
     355             :     virtual sal_Bool dumpHxxFile(
     356             :         FileStream & o, codemaker::cppumaker::Includes & includes)
     357             :         throw (CannotDumpException);
     358             : 
     359             : private:
     360             :     virtual void addSpecialDependencies();
     361             : 
     362             :     bool isDefaultConstructor(sal_uInt16 ctorIndex) const;
     363             : 
     364             :     bool hasRestParameter(sal_uInt16 ctorIndex) const;
     365             : 
     366             :     void dumpCatchClauses(
     367             :         FileStream & out, codemaker::ExceptionTreeNode const * node);
     368             : };
     369             : 
     370         181 : class SingletonType: public ConstructiveType {
     371             : public:
     372         181 :     SingletonType(
     373             :         typereg::Reader & reader, rtl::OString const & name,
     374             :         TypeManager const & manager):
     375         181 :         ConstructiveType(reader, name, manager) {}
     376             : 
     377             :     bool isInterfaceBased();
     378             : 
     379             :     virtual sal_Bool dumpHxxFile(
     380             :         FileStream & o, codemaker::cppumaker::Includes & includes)
     381             :         throw (CannotDumpException);
     382             : };
     383             : 
     384             : bool produceType(const ::rtl::OString& typeName,
     385             :                      TypeManager const & typeMgr,
     386             :                      codemaker::GeneratedTypeSet & generated,
     387             :                      CppuOptions* pOptions)
     388             :                  throw( CannotDumpException );
     389             : 
     390             : bool produceType(RegistryKey& typeName, bool bIsExtraType,
     391             :                      TypeManager const & typeMgr,
     392             :                      codemaker::GeneratedTypeSet & generated,
     393             :                      CppuOptions* pOptions)
     394             :                  throw( CannotDumpException );
     395             : 
     396             : #endif // INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_CPPUTYPE_HXX
     397             : 
     398             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10