LCOV - code coverage report
Current view: top level - idlc/inc/idlc - astinterface.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 13 84.6 %
Date: 2012-08-25 Functions: 10 12 83.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 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                 :            : #ifndef _IDLC_ASTINTERFACE_HXX_
      20                 :            : #define _IDLC_ASTINTERFACE_HXX_
      21                 :            : 
      22                 :            : #include <idlc/asttype.hxx>
      23                 :            : #include <idlc/astscope.hxx>
      24                 :            : #include "idlc/inheritedinterface.hxx"
      25                 :            : 
      26                 :            : #include <map>
      27                 :            : #include <vector>
      28                 :            : 
      29                 :        116 : class AstInterface : public AstType
      30                 :            :                    , public AstScope
      31                 :            : {
      32                 :            : public:
      33                 :            :     typedef std::vector< InheritedInterface > InheritedInterfaces;
      34                 :            : 
      35                 :            :     typedef std::vector< AstInterface const * > DoubleInterfaceDeclarations;
      36                 :            : 
      37                 :            :     struct DoubleMemberDeclaration {
      38                 :            :         AstDeclaration const * first;
      39                 :            :         AstDeclaration const * second;
      40                 :            :     };
      41                 :            : 
      42                 :            :     typedef std::vector< DoubleMemberDeclaration > DoubleMemberDeclarations;
      43                 :            : 
      44         [ +  - ]:       4234 :     struct DoubleDeclarations {
      45                 :            :         DoubleInterfaceDeclarations interfaces;
      46                 :            :         DoubleMemberDeclarations members;
      47                 :            :     };
      48                 :            : 
      49                 :            :     AstInterface(
      50                 :            :         const ::rtl::OString& name, AstInterface const * pInherits,
      51                 :            :         AstScope* pScope);
      52                 :            :     virtual ~AstInterface();
      53                 :            : 
      54                 :          0 :     InheritedInterfaces const & getAllInheritedInterfaces() const
      55                 :          0 :     { return m_inheritedInterfaces; }
      56                 :            : 
      57                 :      30375 :     bool hasMandatoryInheritedInterfaces() const
      58                 :      30375 :     { return m_mandatoryInterfaces > 0; }
      59                 :            : 
      60                 :            :     void setForwarded(sal_Bool bForwarded)
      61                 :            :         { m_bForwarded = bForwarded; }
      62                 :            :     sal_Bool isForwarded()
      63                 :            :         { return m_bForwarded; }
      64                 :            :     void setForwardedInSameFile(sal_Bool bForwarded)
      65                 :            :         { m_bForwardedInSameFile = bForwarded; }
      66                 :            :     sal_Bool isForwardedInSameFile()
      67                 :            :         { return m_bForwardedInSameFile; }
      68                 :            : 
      69                 :      30541 :     void setDefined() { m_bIsDefined = true; }
      70                 :      31149 :     sal_Bool isDefined() const
      71                 :      31149 :         { return m_bIsDefined; }
      72                 :            : 
      73                 :       1579 :     bool usesSingleInheritance() const { return m_bSingleInheritance; }
      74                 :            : 
      75                 :            :     DoubleDeclarations checkInheritedInterfaceClashes(
      76                 :            :         AstInterface const * ifc, bool optional) const;
      77                 :            : 
      78                 :            :     void addInheritedInterface(
      79                 :            :         AstType const * ifc, bool optional,
      80                 :            :         rtl::OUString const & documentation);
      81                 :            : 
      82                 :            :     DoubleMemberDeclarations checkMemberClashes(
      83                 :            :         AstDeclaration const * member) const;
      84                 :            : 
      85                 :            :     void addMember(AstDeclaration /*TODO: const*/ * member);
      86                 :            : 
      87                 :            :     void forwardDefined(AstInterface const & def);
      88                 :            : 
      89                 :            :     virtual sal_Bool dump(RegistryKey& rKey);
      90                 :            : 
      91                 :            : private:
      92                 :            :     enum InterfaceKind {
      93                 :            :         INTERFACE_INDIRECT_OPTIONAL, INTERFACE_DIRECT_OPTIONAL,
      94                 :            :         INTERFACE_INDIRECT_MANDATORY, INTERFACE_DIRECT_MANDATORY };
      95                 :            : 
      96                 :     961752 :     struct VisibleMember {
      97                 :     239314 :         explicit VisibleMember(AstDeclaration const * theMandatory = 0):
      98                 :     239314 :             mandatory(theMandatory) {}
      99                 :            : 
     100                 :            :         typedef std::map< rtl::OString, AstDeclaration const * > Optionals;
     101                 :            : 
     102                 :            :         AstDeclaration const * mandatory;
     103                 :            :         Optionals optionals;
     104                 :            :     };
     105                 :            : 
     106                 :            :     typedef std::map< rtl::OString, InterfaceKind > VisibleInterfaces;
     107                 :            :     typedef std::map< rtl::OString, VisibleMember > VisibleMembers;
     108                 :            : 
     109                 :            :     void checkInheritedInterfaceClashes(
     110                 :            :         DoubleDeclarations & doubleDeclarations,
     111                 :            :         std::set< rtl::OString > & seenInterfaces, AstInterface const * ifc,
     112                 :            :         bool optional, bool direct, bool mainOptional) const;
     113                 :            : 
     114                 :            :     void checkMemberClashes(
     115                 :            :         DoubleMemberDeclarations & doubleMembers, AstDeclaration const * member,
     116                 :            :         bool checkOptional) const;
     117                 :            : 
     118                 :            :     void addVisibleInterface(
     119                 :            :         AstInterface const * ifc, bool direct, bool optional);
     120                 :            : 
     121                 :            :     void addOptionalVisibleMembers(AstInterface const * ifc);
     122                 :            : 
     123                 :            :     bool increment(sal_uInt16 * counter, char const * sort) const;
     124                 :            : 
     125                 :            :     InheritedInterfaces m_inheritedInterfaces;
     126                 :            :     InheritedInterfaces::size_type m_mandatoryInterfaces;
     127                 :            :     sal_Bool    m_bIsDefined;
     128                 :            :     sal_Bool    m_bForwarded;
     129                 :            :     sal_Bool    m_bForwardedInSameFile;
     130                 :            :     bool m_bSingleInheritance;
     131                 :            :     VisibleInterfaces m_visibleInterfaces;
     132                 :            :     VisibleMembers m_visibleMembers;
     133                 :            : };
     134                 :            : 
     135                 :            : #endif // _IDLC_ASTINTERFACE_HXX_
     136                 :            : 
     137                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10