LCOV - code coverage report
Current view: top level - idl/source/objects - basobj.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 96 108 88.9 %
Date: 2014-11-03 Functions: 25 40 62.5 %
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 <ctype.h>
      22             : #include <stdio.h>
      23             : 
      24             : #include <tools/debug.hxx>
      25             : 
      26             : #include <basobj.hxx>
      27             : #include <module.hxx>
      28             : #include <globals.hxx>
      29             : #include <database.hxx>
      30             : 
      31       11696 : TYPEINIT1( SvMetaObject, SvRttiBase )
      32       30089 : SvMetaObject::SvMetaObject()
      33             : {
      34       30089 : }
      35             : 
      36       43804 : void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab )
      37             : {
      38      237639 :     while( nTab-- )
      39      150031 :         rOutStm.WriteCharPtr( "    " );
      40       43804 : }
      41             : 
      42         616 : void SvMetaObject::WriteStars( SvStream & rOutStm )
      43             : {
      44         616 :     rOutStm.WriteChar( '/' );
      45        4312 :     for( int i = 6; i > 0; i-- )
      46        3696 :         rOutStm.WriteCharPtr( "**********" );
      47         616 :     rOutStm.WriteChar( '/' ) << endl;
      48         616 : }
      49             : 
      50         137 : void SvMetaObject::Back2Delemitter( SvStream & rOutStm )
      51             : {
      52             :     // write no empty brackets
      53         137 :     sal_uLong nPos = rOutStm.Tell();
      54         137 :     rOutStm.SeekRel( -1 );
      55         137 :     char c = 0;
      56         137 :     rOutStm.ReadChar( c );
      57             : 
      58         411 :     while( isspace( c ) && rOutStm.Tell() != 1 )
      59             :     {
      60         137 :         rOutStm.SeekRel( -2 );
      61         137 :         rOutStm.ReadChar( c );
      62             :     }
      63             : 
      64         137 :     if( c == ';' || c == ',' )
      65         137 :         rOutStm.SeekRel( -1 );
      66             :     else
      67           0 :         rOutStm.Seek( nPos );
      68         137 : }
      69             : 
      70           0 : bool SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & )
      71             : {
      72           0 :     return false;
      73             : }
      74             : 
      75       11696 : TYPEINIT1( SvMetaName, SvMetaObject );
      76       30089 : SvMetaName::SvMetaName()
      77             : {
      78       30089 : }
      79             : 
      80       20509 : bool SvMetaName::SetName( const OString& rName, SvIdlDataBase * )
      81             : {
      82       20509 :     aName.setString(rName);
      83       20509 :     return true;
      84             : }
      85             : 
      86       16534 : bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
      87             :                                 SvTokenStream & rInStm )
      88             : {
      89       16534 :     sal_uInt32 nTokPos = rInStm.Tell();
      90       16534 :     SvToken * pTok = rInStm.GetToken_Next();
      91             : 
      92             :     // read module name
      93       16534 :     if( pTok->IsIdentifier() )
      94       16315 :         if( SetName( pTok->GetString(), &rBase ) )
      95       16315 :             return true;
      96             : 
      97         219 :     rInStm.Seek( nTokPos );
      98         219 :     return false;
      99             : }
     100             : 
     101      162866 : void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     102             :                                       SvTokenStream & rInStm )
     103             : {
     104      162866 :     sal_uInt32 nTokPos = rInStm.Tell();
     105      162866 :     if( aName.ReadSvIdl( SvHash_Name(), rInStm ) )
     106             :     {
     107           0 :         if( !SetName( aName.getString(), &rBase ) )
     108           0 :             rInStm.Seek( nTokPos );
     109             :     }
     110             : 
     111      162866 :     aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm );
     112      162866 :     aHelpText.ReadSvIdl( rBase, rInStm );
     113      162866 :     aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm );
     114      162866 :     aDescription.ReadSvIdl( SvHash_Description(), rInStm );
     115      162866 : }
     116             : 
     117        5110 : void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase,
     118             :                                    SvTokenStream & rInStm, char cDel )
     119             : {
     120        5110 :     sal_uInt32 nBeginPos = 0; // can not happen with Tell
     121       25960 :     while( nBeginPos != rInStm.Tell() )
     122             :     {
     123       15740 :         nBeginPos = rInStm.Tell();
     124       15740 :         ReadContextSvIdl( rBase, rInStm );
     125       15740 :         if( cDel == '\0' )
     126       15740 :             rInStm.ReadDelemiter();
     127             :         else
     128           0 :             rInStm.Read( cDel );
     129             :     }
     130        5110 : }
     131             : 
     132           0 : void SvMetaName::ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & )
     133             : {
     134           0 : }
     135             : 
     136           0 : bool SvMetaName::Test( SvIdlDataBase &, SvTokenStream & )
     137             : {
     138           0 :     return true;
     139             : }
     140             : 
     141       18876 : bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     142             : {
     143       18876 :     sal_uInt32 nTokPos = rInStm.Tell();
     144       18876 :     bool bOk = true;
     145       18876 :     if( rInStm.Read( '[' ) )
     146             :     {
     147       12265 :         sal_uInt32 nBeginPos = 0; // can not happen with Tell
     148      187396 :         while( nBeginPos != rInStm.Tell() )
     149             :         {
     150      162866 :             nBeginPos = rInStm.Tell();
     151      162866 :             ReadAttributesSvIdl( rBase, rInStm );
     152      162866 :             rInStm.ReadDelemiter();
     153             :         }
     154       12265 :         bOk = rInStm.Read( ']' );
     155             :     }
     156             : 
     157       18876 :     if( bOk )
     158             :     {
     159       18876 :         if( rInStm.Read( '{' ) )
     160             :         {
     161         724 :             DoReadContextSvIdl( rBase, rInStm );
     162         724 :             bOk = rInStm.Read( '}' );
     163             :         }
     164             :     }
     165             : 
     166       18876 :     if( !bOk )
     167           0 :         rInStm.Seek( nTokPos );
     168       18876 :     return bOk;
     169             : }
     170             : 
     171       11696 : TYPEINIT1( SvMetaReference, SvMetaName );
     172             : 
     173       28390 : SvMetaReference::SvMetaReference()
     174             : {
     175       28390 : }
     176             : 
     177       11664 : TYPEINIT1( SvMetaExtern, SvMetaReference );
     178             : 
     179        6380 : SvMetaExtern::SvMetaExtern()
     180             :     : pModule( NULL )
     181             :     , bReadUUId( false )
     182        6380 :     , bReadVersion( false )
     183             : {
     184        6380 : }
     185             : 
     186        1473 : SvMetaModule * SvMetaExtern::GetModule() const
     187             : {
     188             :     DBG_ASSERT( pModule != NULL, "module not set" );
     189        1473 :     return pModule;
     190             : }
     191             : 
     192        1473 : const SvGlobalName & SvMetaExtern::GetUUId() const
     193             : {
     194        1473 :     if( aUUId == SvGlobalName() )
     195        1473 :         GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId );
     196        1473 :     return aUUId;
     197             : }
     198             : 
     199        3363 : void SvMetaExtern::SetModule( SvIdlDataBase & rBase )
     200             : {
     201        3363 :     pModule = static_cast<SvMetaModule *>(rBase.GetStack().Get( TYPE( SvMetaModule ) ));
     202        3363 : }
     203             : 
     204         205 : void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     205             :                                         SvTokenStream & rInStm )
     206             : {
     207         205 :     SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
     208         205 :     if( aUUId.ReadSvIdl( rBase, rInStm ) )
     209          68 :         bReadUUId = true;
     210         205 :     if( aVersion.ReadSvIdl( rInStm ) )
     211           0 :         bReadVersion = true;
     212         205 : }
     213             : 
     214        1473 : bool SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     215             : {
     216        1473 :     SetModule( rBase );
     217        1473 :     GetUUId(); // id gets created
     218        1473 :     return SvMetaReference::ReadSvIdl( rBase, rInStm );
     219             : }
     220             : 
     221             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10