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

Generated by: LCOV version 1.10