LCOV - code coverage report
Current view: top level - idl/source/objects - basobj.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 96 108 88.9 %
Date: 2015-06-13 12:38:46 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       11770 : TYPEINIT1( SvMetaObject, SvRttiBase )
      32       30244 : SvMetaObject::SvMetaObject()
      33             : {
      34       30244 : }
      35             : 
      36       44076 : void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab )
      37             : {
      38      239157 :     while( nTab-- )
      39      151005 :         rOutStm.WriteCharPtr( "    " );
      40       44076 : }
      41             : 
      42         620 : void SvMetaObject::WriteStars( SvStream & rOutStm )
      43             : {
      44         620 :     rOutStm.WriteChar( '/' );
      45        4340 :     for( int i = 6; i > 0; i-- )
      46        3720 :         rOutStm.WriteCharPtr( "**********" );
      47         620 :     rOutStm.WriteChar( '/' ) << endl;
      48         620 : }
      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       11770 : TYPEINIT1( SvMetaName, SvMetaObject );
      76       30244 : SvMetaName::SvMetaName()
      77             : {
      78       30244 : }
      79             : 
      80       20622 : bool SvMetaName::SetName( const OString& rName, SvIdlDataBase * )
      81             : {
      82       20622 :     aName.setString(rName);
      83       20622 :     return true;
      84             : }
      85             : 
      86       16618 : bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
      87             :                                 SvTokenStream & rInStm )
      88             : {
      89       16618 :     sal_uInt32 nTokPos = rInStm.Tell();
      90       16618 :     SvToken * pTok = rInStm.GetToken_Next();
      91             : 
      92             :     // read module name
      93       16618 :     if( pTok->IsIdentifier() )
      94       16399 :         if( SetName( pTok->GetString(), &rBase ) )
      95       16399 :             return true;
      96             : 
      97         219 :     rInStm.Seek( nTokPos );
      98         219 :     return false;
      99             : }
     100             : 
     101      163780 : void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     102             :                                       SvTokenStream & rInStm )
     103             : {
     104      163780 :     sal_uInt32 nTokPos = rInStm.Tell();
     105      163780 :     if( aName.ReadSvIdl( SvHash_Name(), rInStm ) )
     106             :     {
     107           0 :         if( !SetName( aName.getString(), &rBase ) )
     108           0 :             rInStm.Seek( nTokPos );
     109             :     }
     110             : 
     111      163780 :     aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm );
     112      163780 :     aHelpText.ReadSvIdl( rBase, rInStm );
     113      163780 :     aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm );
     114      163780 :     aDescription.ReadSvIdl( SvHash_Description(), rInStm );
     115      163780 : }
     116             : 
     117        5131 : void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase,
     118             :                                    SvTokenStream & rInStm, char cDel )
     119             : {
     120        5131 :     sal_uInt32 nBeginPos = 0; // can not happen with Tell
     121       26082 :     while( nBeginPos != rInStm.Tell() )
     122             :     {
     123       15820 :         nBeginPos = rInStm.Tell();
     124       15820 :         ReadContextSvIdl( rBase, rInStm );
     125       15820 :         if( cDel == '\0' )
     126       15820 :             rInStm.ReadDelemiter();
     127             :         else
     128           0 :             (void)rInStm.Read( cDel );
     129             :     }
     130        5131 : }
     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       18989 : bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     142             : {
     143       18989 :     sal_uInt32 nTokPos = rInStm.Tell();
     144       18989 :     bool bOk = true;
     145       18989 :     if( rInStm.Read( '[' ) )
     146             :     {
     147       12341 :         sal_uInt32 nBeginPos = 0; // can not happen with Tell
     148      188462 :         while( nBeginPos != rInStm.Tell() )
     149             :         {
     150      163780 :             nBeginPos = rInStm.Tell();
     151      163780 :             ReadAttributesSvIdl( rBase, rInStm );
     152      163780 :             rInStm.ReadDelemiter();
     153             :         }
     154       12341 :         bOk = rInStm.Read( ']' );
     155             :     }
     156             : 
     157       18989 :     if( bOk )
     158             :     {
     159       18989 :         if( rInStm.Read( '{' ) )
     160             :         {
     161         724 :             DoReadContextSvIdl( rBase, rInStm );
     162         724 :             bOk = rInStm.Read( '}' );
     163             :         }
     164             :     }
     165             : 
     166       18989 :     if( !bOk )
     167           0 :         rInStm.Seek( nTokPos );
     168       18989 :     return bOk;
     169             : }
     170             : 
     171       11770 : TYPEINIT1( SvMetaReference, SvMetaName );
     172             : 
     173       28545 : SvMetaReference::SvMetaReference()
     174             : {
     175       28545 : }
     176             : 
     177       11738 : TYPEINIT1( SvMetaExtern, SvMetaReference );
     178             : 
     179        6408 : SvMetaExtern::SvMetaExtern()
     180             :     : pModule( NULL )
     181             :     , bReadUUId( false )
     182        6408 :     , bReadVersion( false )
     183             : {
     184        6408 : }
     185             : 
     186        1480 : SvMetaModule * SvMetaExtern::GetModule() const
     187             : {
     188             :     DBG_ASSERT( pModule != NULL, "module not set" );
     189        1480 :     return pModule;
     190             : }
     191             : 
     192        1480 : const SvGlobalName & SvMetaExtern::GetUUId() const
     193             : {
     194        1480 :     if( aUUId == SvGlobalName() )
     195        1480 :         GetModule()->FillNextName( &const_cast<SvMetaExtern *>(this)->aUUId );
     196        1480 :     return aUUId;
     197             : }
     198             : 
     199        3377 : void SvMetaExtern::SetModule( SvIdlDataBase & rBase )
     200             : {
     201        3377 :     pModule = static_cast<SvMetaModule *>(rBase.GetStack().Get( TYPE( SvMetaModule ) ));
     202        3377 : }
     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        1480 : bool SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     215             : {
     216        1480 :     SetModule( rBase );
     217        1480 :     GetUUId(); // id gets created
     218        1480 :     return SvMetaReference::ReadSvIdl( rBase, rInStm );
     219             : }
     220             : 
     221             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11