LCOV - code coverage report
Current view: top level - rdbmaker/inc/codemaker - dependency.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 10 100.0 %
Date: 2012-08-25 Functions: 6 6 100.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 _CODEMAKER_DEPENDENCY_HXX_
      21                 :            : #define _CODEMAKER_DEPENDENCY_HXX_
      22                 :            : 
      23                 :            : #include    <boost/unordered_map.hpp>
      24                 :            : #include    <registry/registry.hxx>
      25                 :            : #include    <registry/reflread.hxx>
      26                 :            : #include    <codemaker/typemanager.hxx>
      27                 :            : #include    <codemaker/global.hxx>
      28                 :            : #include <osl/diagnose.h>
      29                 :            : 
      30                 :            : #define TYPEUSE_NORMAL      0x0001
      31                 :            : #define TYPEUSE_SUPER       0x0002
      32                 :            : #define TYPEUSE_MEMBER      0x0004
      33                 :            : #define TYPEUSE_INPARAM     0x0008
      34                 :            : #define TYPEUSE_OUTPARAM    0x0010
      35                 :            : #define TYPEUSE_INOUTPARAM  0x0020
      36                 :            : #define TYPEUSE_RETURN      0x0040
      37                 :            : #define TYPEUSE_EXCEPTION   0x0080
      38                 :            : #define TYPEUSE_SCOPE       0x0100
      39                 :            : 
      40                 :            : /**
      41                 :            :  * Flag shows the state of the code generation. If the Flag is set
      42                 :            :  * the code for this type is generated.
      43                 :            :  */
      44                 :            : #define CODEGEN_DEFAULT     0x0001
      45                 :            : 
      46                 :       8896 : struct TypeUsing
      47                 :            : {
      48                 :       1996 :     TypeUsing(const ::rtl::OString& type, sal_uInt16 use)
      49                 :            :         : m_type(type)
      50                 :       1996 :         , m_use(use)
      51                 :       1996 :         {}
      52                 :            : 
      53                 :            :     ::rtl::OString  m_type;
      54                 :            :     sal_uInt16      m_use;
      55                 :            : 
      56                 :            :     sal_Bool operator == (const TypeUsing & typeUsing) const
      57                 :            :     {
      58                 :            :         OSL_ASSERT(0);
      59                 :            :         return m_type == typeUsing.m_type && m_use == typeUsing.m_use;
      60                 :            :     }
      61                 :            : };
      62                 :            : 
      63                 :            : struct LessTypeUsing
      64                 :            : {
      65                 :      12928 :     sal_Bool operator()(const TypeUsing& tuse1, const TypeUsing& tuse2) const
      66                 :            :     {
      67                 :      12928 :         return (tuse1.m_type < tuse2.m_type);
      68                 :            :     }
      69                 :            : };
      70                 :            : 
      71                 :            : typedef ::std::set< TypeUsing, LessTypeUsing > TypeUsingSet;
      72                 :            : 
      73                 :            : 
      74                 :            : typedef ::boost::unordered_map
      75                 :            : <
      76                 :            :     ::rtl::OString,
      77                 :            :     TypeUsingSet,
      78                 :            :     HashString,
      79                 :            :     EqualString
      80                 :            : > DependencyMap;
      81                 :            : 
      82                 :            : typedef ::boost::unordered_map
      83                 :            : <
      84                 :            :     ::rtl::OString,
      85                 :            :     sal_uInt16,
      86                 :            :     HashString,
      87                 :            :     EqualString
      88                 :            : > GenerationMap;
      89                 :            : 
      90         [ +  - ]:          2 : struct TypeDependencyImpl
      91                 :            : {
      92                 :          2 :     TypeDependencyImpl()
      93 [ +  - ][ +  - ]:          2 :         : m_refCount(0)
      94                 :          2 :         {}
      95                 :            : 
      96                 :            :     sal_Int32       m_refCount;
      97                 :            :     DependencyMap   m_dependencies;
      98                 :            :     GenerationMap   m_generatedTypes;
      99                 :            : };
     100                 :            : 
     101                 :            : class TypeDependency
     102                 :            : {
     103                 :            : public:
     104                 :            :     TypeDependency();
     105                 :            :     ~TypeDependency();
     106                 :            : 
     107                 :            :     TypeDependency( const TypeDependency& value )
     108                 :            :         : m_pImpl( value.m_pImpl )
     109                 :            :     {
     110                 :            :         acquire();
     111                 :            :     }
     112                 :            : 
     113                 :            :     TypeDependency& operator = ( const TypeDependency& value )
     114                 :            :     {
     115                 :            :         release();
     116                 :            :         m_pImpl = value.m_pImpl;
     117                 :            :         acquire();
     118                 :            :         return *this;
     119                 :            :     }
     120                 :            : 
     121                 :            :     sal_Bool        insert(const ::rtl::OString& type, const ::rtl::OString& depend, sal_uInt16);
     122                 :            :     TypeUsingSet    getDependencies(const ::rtl::OString& type);
     123                 :            :     sal_Bool        hasDependencies(const ::rtl::OString& type);
     124                 :            : 
     125                 :            :     void        setGenerated(const ::rtl::OString& type, sal_uInt16 genFlag=CODEGEN_DEFAULT);
     126                 :            :     sal_Bool    isGenerated(const ::rtl::OString& type, sal_uInt16 genFlag=CODEGEN_DEFAULT);
     127                 :            : 
     128                 :            :     sal_Int32 getSize() { return m_pImpl->m_generatedTypes.size(); }
     129                 :            : protected:
     130                 :            :     void acquire();
     131                 :            :     void release();
     132                 :            : 
     133                 :            : protected:
     134                 :            :     TypeDependencyImpl* m_pImpl;
     135                 :            : };
     136                 :            : 
     137                 :            : sal_Bool checkTypeDependencies(TypeManager& typeMgr, TypeDependency& dependencies, const ::rtl::OString& type, sal_Bool bDepend = sal_False);
     138                 :            : 
     139                 :            : #endif // _CODEMAKER_DEPENDENCY_HXX_
     140                 :            : 
     141                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10