LCOV - code coverage report
Current view: top level - codemaker/source/cppumaker - dependencies.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 15 15 100.0 %
Date: 2015-06-13 12:38:46 Functions: 13 13 100.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_DEPENDENCIES_HXX
      21             : #define INCLUDED_CODEMAKER_SOURCE_CPPUMAKER_DEPENDENCIES_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <map>
      26             : 
      27             : #include "boost/noncopyable.hpp"
      28             : #include "rtl/ref.hxx"
      29             : 
      30             : namespace rtl { class OUString; }
      31             : class TypeManager;
      32             : 
      33             : /// @HTML
      34             : 
      35             : namespace codemaker { namespace cppumaker {
      36             : 
      37             : /**
      38             :    A simple class to track which other entites a given entity depends on.
      39             : 
      40             :    <p>This class is not multi-thread&ndash;safe.</p>
      41             :  */
      42             : class Dependencies: private boost::noncopyable {
      43             : public:
      44             :     /**
      45             :        Flags to distinguish whether or not one entity depends on another entity
      46             :        because the second is a direct base of the first.
      47             :      */
      48             :     enum Kind { KIND_NO_BASE, KIND_BASE };
      49             : 
      50             :     typedef std::map< rtl::OUString, Kind > Map;
      51             : 
      52             :     /**
      53             :        Constructs the dependencies for a given entity.
      54             : 
      55             :        @param manager a type manager, to obtain information about the given
      56             :        entity; must not be null
      57             : 
      58             :        @param name the UNOIDL name of an enum type, plain struct type,
      59             :        polymorphic struct type template, exception type, interface type,
      60             :        typedef, constant group, single-interface--based service, or
      61             :        interface-based singleton entity
      62             :      */
      63             :     Dependencies(
      64             :         rtl::Reference< TypeManager > const & manager,
      65             :         rtl::OUString const & name);
      66             : 
      67             :     ~Dependencies();
      68             : 
      69             :     /**
      70             :        Add a special dependency (which is not obvious from the entity's data
      71             :        available at the type manager).
      72             : 
      73             :        @param name a UNOIDL entity name
      74             :      */
      75             :     void add(rtl::OUString const & name) { insert(name); }
      76             : 
      77       22433 :     Map const & getMap() const { return m_map; }
      78             : 
      79             :     bool hasVoidDependency() const { return m_voidDependency; }
      80             : 
      81       15632 :     bool hasBooleanDependency() const { return m_booleanDependency; }
      82             : 
      83       13266 :     bool hasByteDependency() const { return m_byteDependency; }
      84             : 
      85       12873 :     bool hasShortDependency() const { return m_shortDependency; }
      86             : 
      87       19493 :     bool hasUnsignedShortDependency() const
      88       19493 :     { return m_unsignedShortDependency; }
      89             : 
      90       11565 :     bool hasLongDependency() const { return m_longDependency; }
      91             : 
      92             :     bool hasUnsignedLongDependency() const { return m_unsignedLongDependency; }
      93             : 
      94        7918 :     bool hasHyperDependency() const { return m_hyperDependency; }
      95             : 
      96        7866 :     bool hasUnsignedHyperDependency() const
      97        7866 :     { return m_unsignedHyperDependency; }
      98             : 
      99             :     bool hasFloatDependency() const { return m_floatDependency; }
     100             : 
     101             :     bool hasDoubleDependency() const { return m_doubleDependency; }
     102             : 
     103        7860 :     bool hasCharDependency() const { return m_charDependency; }
     104             : 
     105       15632 :     bool hasStringDependency() const { return m_stringDependency; }
     106             : 
     107       15632 :     bool hasTypeDependency() const { return m_typeDependency; }
     108             : 
     109       15632 :     bool hasAnyDependency() const { return m_anyDependency; }
     110             : 
     111       15632 :     bool hasSequenceDependency() const { return m_sequenceDependency; }
     112             : 
     113             : private:
     114             :     void insert(rtl::OUString const & name, bool base = false);
     115             : 
     116             :     rtl::Reference< TypeManager > m_manager;
     117             :     Map m_map;
     118             :     bool m_voidDependency;
     119             :     bool m_booleanDependency;
     120             :     bool m_byteDependency;
     121             :     bool m_shortDependency;
     122             :     bool m_unsignedShortDependency;
     123             :     bool m_longDependency;
     124             :     bool m_unsignedLongDependency;
     125             :     bool m_hyperDependency;
     126             :     bool m_unsignedHyperDependency;
     127             :     bool m_floatDependency;
     128             :     bool m_doubleDependency;
     129             :     bool m_charDependency;
     130             :     bool m_stringDependency;
     131             :     bool m_typeDependency;
     132             :     bool m_anyDependency;
     133             :     bool m_sequenceDependency;
     134             : };
     135             : 
     136             : } }
     137             : 
     138             : #endif
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11