LCOV - code coverage report
Current view: top level - include/codemaker - exceptiontree.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 7 0.0 %
Date: 2014-04-14 Functions: 0 6 0.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_EXCEPTIONTREE_HXX
      21             : #define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
      22             : 
      23             : #include <codemaker/global.hxx>
      24             : #include <rtl/ref.hxx>
      25             : #include <rtl/string.hxx>
      26             : 
      27             : #include <vector>
      28             : 
      29             : class TypeManager;
      30             : 
      31             : namespace codemaker {
      32             : 
      33             : /**
      34             :    Represents a node of the hierarchy from the ExceptionTree class.
      35             :  */
      36             : struct ExceptionTreeNode {
      37             :     typedef std::vector< ExceptionTreeNode * > Children;
      38             : 
      39             :     // Internally used by ExceptionTree:
      40           0 :     ExceptionTreeNode(rtl::OString const & theName):
      41           0 :         name(theName), present(false) {}
      42             : 
      43             :     // Internally used by ExceptionTree:
      44           0 :     ~ExceptionTreeNode() { clearChildren(); }
      45             : 
      46             :     // Internally used by ExceptionTree:
      47           0 :     void setPresent() { present = true; clearChildren(); }
      48             : 
      49             :     // Internally used by ExceptionTree:
      50             :     ExceptionTreeNode * add(rtl::OString const & theName);
      51             : 
      52             :     rtl::OString name;
      53             :     bool present;
      54             :     Children children;
      55             : 
      56             : private:
      57             :     ExceptionTreeNode(ExceptionTreeNode &); // not implemented
      58             :     void operator =(ExceptionTreeNode); // not implemented
      59             : 
      60             :     void clearChildren();
      61             : };
      62             : 
      63             : /**
      64             :    Represents the hierarchy formed by a set of UNO exception types.
      65             : 
      66             :    The hierarchy is rooted at com.sun.star.uno.Exception.  For each exception E
      67             :    from the given set S, the hierarchy from com.sun.star.uno.Exception to the
      68             :    first supertype E' of E which is itself a member of S is represented (i.e.,
      69             :    subtypes that are hidden by supertypes are pruned from the hierarchy).  The
      70             :    exception com.sun.star.uno.RuntimeException and its subtypes are pruned
      71             :    completely from the hierarchy.  Each node of the hierarchy is represented by
      72             :    an instance of ExceptionTreeNode, where name gives the name of the UNO
      73             :    exception type, present is true iff the given exception type is a member of
      74             :    the set S, and children contains all the relevant direct subtypes of the
      75             :    given exception type, in no particular order (for nodes other than the root
      76             :    node it holds that children is non-empty iff present is false).
      77             :  */
      78             : class ExceptionTree {
      79             : public:
      80           0 :     ExceptionTree(): m_root("com.sun.star.uno.Exception") {}
      81             : 
      82           0 :     ~ExceptionTree() {}
      83             : 
      84             :     /**
      85             :        Builds the exception hierarchy, by adding one exception type at a time.
      86             : 
      87             :        This function can be called more than once for the same exception name.
      88             : 
      89             :        @param name the name of a UNO exception type; it is an error if the given
      90             :        name does not represent a UNO exception type
      91             : 
      92             :        @param manager a type manager, used to resolve type names; it is an error
      93             :        if different calls to this member function use different, incompatible
      94             :        type managers
      95             :      */
      96             :     void add(
      97             :         rtl::OString const & name,
      98             :         rtl::Reference< TypeManager > const & manager);
      99             : 
     100             :     /**
     101             :        Gives access to the resultant exception hierarchy.
     102             : 
     103             :        @return a non-null pointer to the root of the exception hierarchy, as
     104             :        formed by all previous calls to add; it is an error if any calls to add
     105             :        follow the first call to getRoot
     106             :      */
     107           0 :     ExceptionTreeNode const * getRoot() const { return &m_root; }
     108             : 
     109             : private:
     110             :     ExceptionTree(ExceptionTree &); // not implemented
     111             :     void operator =(ExceptionTree); // not implemented
     112             : 
     113             :     ExceptionTreeNode m_root;
     114             : };
     115             : 
     116             : }
     117             : 
     118             : #endif
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10