LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/inc/toolkit - out_node.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 12 12 100.0 %
Date: 2012-12-27 Functions: 8 8 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 ADC_DISPLAY_OUT_NODE_HXX
      21             : #define ADC_DISPLAY_OUT_NODE_HXX
      22             : 
      23             : namespace output
      24             : {
      25             : 
      26             : 
      27             : /** @resp
      28             :     Represents a tree of names where each node can have only one parent,
      29             :     but a list of children.
      30             : 
      31             :     @see    Position
      32             :     @see    Tree
      33             : */
      34             : class Node
      35             : {
      36             : public:
      37             :     typedef std::vector< Node* >    NodeList;
      38             :     typedef UINT32                  relative_id;
      39             : 
      40             :       // LIFECYCLE
      41             :     enum E_NullObject   { null_object };
      42             : 
      43             :                         Node();
      44             :     explicit            Node( E_NullObject );
      45             :                         ~Node();
      46             : 
      47             :     // OPERATORS
      48       47620 :     bool                operator==( const Node& i_node ) const
      49       47620 :                         { return pParent == i_node.pParent AND sName == i_node.sName; }
      50             : 
      51       47620 :     bool                operator!=( const Node& i_node ) const
      52       47620 :                         { return NOT operator==(i_node); }
      53             : 
      54             :     // OPERATIONS
      55             :     /// Seek, and if not existent, create.
      56             :     Node&               Provide_Child( const String& i_name );
      57             : 
      58             :     /// Seek, and if not existent, create.
      59       86675 :     Node&               Provide_Child( const StringVector& i_path )
      60       86675 :                         { return provide_Child(i_path.begin(), i_path.end()); }
      61             :       // INQUIRY
      62      388778 :     intt                Depth() const           { return nDepth; }
      63             : 
      64     2190135 :     const String &      Name() const            { return sName; }
      65             : 
      66             :     /// @return Id of a namespace or class etc. this directory represents.
      67         998 :     relative_id         RelatedNameRoom() const { return nNameRoomId; }
      68             :     /// @return No delimiter at start, with delimiter at end.
      69             :     void                Get_Path(
      70             :                             StreamStr &         o_result,
      71             :                             intt                i_maxDepth = -1
      72             :                         ) const;
      73             : 
      74             :     void                Get_Chain(
      75             :                             StringVector &      o_result,
      76             :                             intt                i_maxDepth = -1
      77             :                         ) const;
      78             : 
      79             :     // ACCESS
      80          55 :     void                Set_RelatedNameRoom( relative_id i_nNameRoomId )
      81          55 :                         { nNameRoomId = i_nNameRoomId; }
      82             : 
      83      425791 :     Node*               Parent()                { return pParent; }
      84             :     Node*               Child( const String& i_name )
      85             :                         { return find_Child(i_name); }
      86             : 
      87             :     /// @return a reference to a Node with Depth() == -1.
      88             :     static Node&        Null_();
      89             : 
      90             : private:
      91             :     // Local
      92             :                         Node(
      93             :                             const String&   i_name,
      94             :                             Node&           i_parent
      95             :                         );
      96             : 
      97             :     Node*               find_Child( const String& i_name );
      98             : 
      99             :     Node&               add_Child( const String& i_name );
     100             : 
     101             :     Node&               provide_Child(
     102             :                             StringVector::const_iterator i_next,
     103             :                             StringVector::const_iterator i_end
     104             :                         );
     105             :     // Data
     106             :     String              sName;
     107             :     Node*               pParent;
     108             :     NodeList            aChildren;
     109             :     intt                nDepth;
     110             :     relative_id         nNameRoomId;
     111             : };
     112             : 
     113             : 
     114             : }   // namespace output
     115             : #endif
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10