LCOV - code coverage report
Current view: top level - rsc/source/res - rscclobj.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 54 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : 
      21             : #include <rscclobj.hxx>
      22             : #include <rsctop.hxx>
      23             : 
      24             : 
      25           0 : RefNode::RefNode( Atom nTyp )
      26             : {
      27           0 :     pObjBiTree = 0;
      28           0 :     nTypNameId = nTyp;
      29           0 : }
      30             : 
      31           0 : sal_uInt32 RefNode::GetId() const
      32             : {
      33           0 :     return nTypNameId;
      34             : }
      35             : 
      36             : // insert a node in the b-tree pObjBiTree
      37             : // if the node with the same name is in pObjBiTree,
      38             : // return sal_False and no insert,
      39             : 
      40           0 : bool RefNode::PutObjNode( ObjNode * pPutObject )
      41             : {
      42           0 :     if( pObjBiTree )
      43           0 :         return pObjBiTree->Insert( pPutObject );
      44             : 
      45           0 :     pObjBiTree = pPutObject;
      46           0 :     return true;
      47             : }
      48             : 
      49             : // insert a node in the b-tree pObjBiTree
      50             : // if the node with the same name is in pObjBiTree,
      51             : // return NULL and no insert,
      52             : // if not return the pointer to the Object
      53           0 : ObjNode * RefNode :: GetObjNode( const RscId & rRscId )
      54             : {
      55           0 :     if( pObjBiTree )
      56           0 :         return pObjBiTree->Search( rRscId );
      57           0 :     return NULL;
      58             : }
      59             : 
      60           0 : ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey )
      61             : {
      62           0 :     pRscObj  = pData;
      63           0 :     aRscId   = rId;
      64           0 :     lFileKey = lKey;
      65           0 : }
      66             : 
      67           0 : ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey )
      68             : {
      69           0 :     ObjNode * pRetNode = this;
      70             : 
      71           0 :     if( Right() )
      72           0 :         pRight = ((ObjNode *)Right())->DelObjNode( pClass, nFileKey );
      73           0 :     if( Left() )
      74           0 :         pLeft = ((ObjNode *)Left())->DelObjNode( pClass, nFileKey );
      75             : 
      76           0 :     if( GetFileKey() == nFileKey )
      77             :     {
      78           0 :         if( GetRscObj() )
      79             :         {
      80           0 :             pClass->Destroy( RSCINST( pClass, GetRscObj() ) );
      81           0 :             rtl_freeMemory( GetRscObj() );
      82             :         }
      83           0 :         pRetNode = (ObjNode *)Right();
      84           0 :         if( pRetNode )
      85             :         {
      86           0 :             if( Left() )
      87           0 :                 pRetNode->Insert( (ObjNode *)Left() );
      88             :         }
      89             :         else
      90           0 :             pRetNode = (ObjNode *)Left();
      91             : 
      92           0 :         delete this;
      93             :     }
      94           0 :     return pRetNode;
      95             : }
      96             : 
      97           0 : sal_uInt32 ObjNode::GetId() const
      98             : {
      99           0 :     return (sal_uInt32)(long)aRscId;
     100             : }
     101             : 
     102           0 : bool ObjNode::IsConsistent()
     103             : {
     104           0 :     bool bRet = true;
     105             : 
     106           0 :     if( (long)aRscId > 0x7FFF || (long)aRscId < 1 )
     107             :     {
     108           0 :         bRet = false;
     109             :     }
     110             :     else
     111             :     {
     112           0 :         if( Left() )
     113             :         {
     114           0 :             if( !((ObjNode *)Left())->IsConsistent() )
     115             :             {
     116           0 :                 bRet = false;
     117             :             }
     118           0 :             if( ((ObjNode *)Left())->aRscId >= aRscId )
     119             :             {
     120           0 :                 bRet = false;
     121             :             }
     122             :         };
     123           0 :         if( Right() )
     124             :         {
     125           0 :             if( ((ObjNode *)Right())->aRscId <= aRscId )
     126             :             {
     127           0 :                 bRet = false;
     128             :             }
     129           0 :             if( !((ObjNode *)Right())->IsConsistent() )
     130             :             {
     131           0 :                 bRet = false;
     132             :             }
     133             :         };
     134             :     };
     135             : 
     136           0 :     return bRet;
     137             : }
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10