LCOV - code coverage report
Current view: top level - rsc/source/res - rsctop.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 97 196 49.5 %
Date: 2015-06-13 12:38:46 Functions: 24 47 51.1 %
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 <stdio.h>
      22             : #include <string.h>
      23             : #include <rsctop.hxx>
      24             : 
      25       76311 : RscTop::RscTop( Atom nId, sal_uInt32 nTypIdent, RscTop * pSuperCl )
      26             :     : RefNode( nId )
      27             :     , pSuperClass( pSuperCl )
      28       76311 :     , nTypId( nTypIdent )
      29             : {
      30       76311 :     pRefClass = this;
      31       76311 :     if( pSuperClass )
      32             :         SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2,
      33       20850 :                     pSuperClass->aCallParType );
      34       76311 : }
      35             : 
      36       35028 : void RscTop::SetCallPar(const OString& rPar1, const OString& rPar2,
      37             :     const OString& rParType)
      38             : {
      39       35028 :     aCallPar1 = rPar1;
      40       35028 :     aCallPar2 = rPar2;
      41       35028 :     aCallParType = rParType;
      42       35028 : }
      43             : 
      44       54755 : RSCINST RscTop::GetDefault()
      45             : {
      46       54755 :     if( !aDfltInst.IsInst() )
      47        1193 :         aDfltInst = this->Create( NULL, RSCINST() );
      48       54755 :     return aDfltInst;
      49             : }
      50             : 
      51       73809 : void RscTop :: Pre_dtor()
      52             : {
      53       73809 :     if( aDfltInst.IsInst() )
      54             :     {
      55         769 :         aDfltInst.pClass->Destroy( aDfltInst );
      56         769 :         rtl_freeMemory( aDfltInst.pData );
      57         769 :         aDfltInst = RSCINST();
      58             :     };
      59       73809 : }
      60             : 
      61           0 : Atom    RscTop :: GetConstant( sal_uInt32 )
      62             : {
      63           0 :     return InvalidAtom;
      64             : }
      65             : 
      66           0 : RscTop * RscTop::GetTypeClass() const
      67             : {
      68           0 :     if( pSuperClass )
      69           0 :         return pSuperClass->GetTypeClass();
      70             :     else
      71           0 :         return NULL;
      72             : }
      73             : 
      74       26271 : sal_uInt32 RscTop :: Size()
      75             : {
      76       26271 :     if( pSuperClass )
      77       20850 :         return pSuperClass->Size();
      78             :     else
      79        5421 :         return 0;
      80             : }
      81             : 
      82        4530 : ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId )
      83             : {
      84        4530 :     if( pSuperClass )
      85           6 :         return pSuperClass->GetRef( rInst, pRscId );
      86             :     else
      87        4524 :         return ERR_UNKNOWN_METHOD;
      88             : }
      89             : 
      90      120546 : bool RscTop::InHierarchy( RscTop * pClass )
      91             : {
      92      120546 :     if( this == pClass )
      93       70333 :         return true;
      94       50213 :     if( pSuperClass )
      95       44953 :         return pSuperClass->InHierarchy( pClass );
      96        5260 :     return false;
      97             : }
      98             : 
      99           0 : ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass,
     100             :                      RSCINST * pDflt, RSCVAR nVarType, sal_uInt32 nMask,
     101             :                      Atom nDataBaseName )
     102             : {
     103           0 :     if( pSuperClass )
     104             :         return pSuperClass->SetVariable( nVarName, pClass, pDflt,
     105           0 :                                          nVarType, nMask, nDataBaseName );
     106             :     else
     107           0 :         return ERR_UNKNOWN_METHOD;
     108             : }
     109             : 
     110           0 : void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc )
     111             : {
     112           0 :     if( pSuperClass )
     113           0 :         pSuperClass->EnumVariables( pData, pProc );
     114           0 : }
     115             : 
     116        7362 : RSCINST RscTop::GetVariable( const RSCINST & rInst,
     117             :                              Atom nVarName,
     118             :                              const RSCINST & rInitInst,
     119             :                              bool bInitDflt,
     120             :                              RscTop * pCreateClass)
     121             : {
     122        7362 :     if( pSuperClass )
     123        7362 :         return pSuperClass->GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass );
     124             :     else
     125           0 :         return RSCINST();
     126             : }
     127             : 
     128        4883 : RSCINST RscTop::GetCopyVar( const RSCINST & rInst, Atom nVarName )
     129             : {
     130        4883 :     if( pSuperClass )
     131        4883 :         return pSuperClass->GetCopyVar( rInst, nVarName );
     132             :     else
     133           0 :         return RSCINST();
     134             : }
     135             : 
     136           0 : RSCINST RscTop::GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
     137             :                             const RSCINST & rInitInst )
     138             : {
     139           0 :     if( pSuperClass )
     140           0 :         return pSuperClass->GetTupelVar( rInst, nPos, rInitInst );
     141             :     else
     142           0 :         return RSCINST();
     143             : }
     144             : 
     145       16446 : ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName,
     146             :                     RscTop *pCreateClass, const RSCINST & rCreateInst,
     147             :                     RSCINST * pGetInst )
     148             : {
     149       16446 :     if( pSuperClass )
     150             :         return pSuperClass-> GetElement( rInst, rEleName,
     151             :                                          pCreateClass, rCreateInst,
     152       16446 :                                          pGetInst );
     153             :     else
     154           0 :         return ERR_UNKNOWN_METHOD;
     155             : }
     156             : 
     157           0 : ERRTYPE RscTop::GetArrayEle( const RSCINST & rInst,
     158             :                              Atom nId,
     159             :                              RscTop * pCreateClass,
     160             :                              RSCINST * pGetInst)
     161             : {
     162           0 :     if( pSuperClass )
     163           0 :         return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst );
     164             :     else
     165           0 :         return ERR_UNKNOWN_METHOD;
     166             : }
     167             : 
     168           0 : ERRTYPE RscTop::GetValueEle( const RSCINST & rInst,
     169             :                              sal_Int32 lValue,
     170             :                              RscTop * pCreateClass,
     171             :                              RSCINST * pGetInst)
     172             : {
     173           0 :     if( pSuperClass )
     174           0 :         return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst );
     175             :     else
     176           0 :         return ERR_UNKNOWN_METHOD;
     177             : }
     178             : 
     179           0 : RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName,
     180             :                            RscTop * pClass )
     181             : {
     182           0 :     if( pSuperClass )
     183           0 :         return pSuperClass->SearchEle( rInst, rEleName, pClass );
     184             :     else
     185           0 :         return RSCINST();
     186             : }
     187             : 
     188           0 : RSCINST RscTop::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos )
     189             : {
     190           0 :     if( pSuperClass )
     191           0 :         return pSuperClass->GetPosEle( rInst, nPos );
     192             :     else
     193           0 :         return RSCINST();
     194             : }
     195             : 
     196           0 : ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
     197             :                             sal_uInt32 nSourcePos )
     198             : {
     199           0 :     if( pSuperClass )
     200           0 :         return pSuperClass->MovePosEle( rInst, nDestPos, nSourcePos );
     201             :     else
     202           0 :         return ERR_UNKNOWN_METHOD;
     203             : }
     204             : 
     205           0 : ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
     206             :                      const RscId & rRscId )
     207             : {
     208           0 :     if( pSuperClass )
     209           0 :         return pSuperClass->SetPosRscId( rInst, nPos, rRscId );
     210             :     else
     211           0 :         return ERR_UNKNOWN_METHOD;
     212             : }
     213             : 
     214           0 : SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos )
     215             : {
     216           0 :     if( pSuperClass )
     217           0 :         return pSuperClass->GetInfoEle( rInst, nPos );
     218             :     else
     219           0 :         return SUBINFO_STRUCT();
     220             : }
     221             : 
     222        4417 : sal_uInt32  RscTop::GetCount( const RSCINST & rInst )
     223             : {
     224        4417 :     if( pSuperClass )
     225        4380 :         return pSuperClass->GetCount( rInst );
     226             :     else
     227          37 :         return 0;
     228             : }
     229             : 
     230        4524 : ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue )
     231             : {
     232        4524 :     if( pSuperClass )
     233           0 :         return pSuperClass->SetNumber( rInst, lValue );
     234             :     else
     235        4524 :         return ERR_UNKNOWN_METHOD;
     236             : }
     237             : 
     238           0 : ERRTYPE RscTop::SetBool( const RSCINST & rInst, bool bValue )
     239             : {
     240           0 :     if( pSuperClass )
     241           0 :         return pSuperClass->SetBool( rInst, bValue );
     242             :     else
     243           0 :         return ERR_UNKNOWN_METHOD;
     244             : }
     245             : 
     246           0 : ERRTYPE RscTop::SetConst( const RSCINST & rInst, Atom nId, sal_Int32 nVal )
     247             : {
     248           0 :     if( pSuperClass )
     249           0 :         return pSuperClass->SetConst( rInst, nId, nVal );
     250             :     else
     251           0 :         return ERR_UNKNOWN_METHOD;
     252             : }
     253             : 
     254           0 : ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, Atom nId )
     255             : {
     256           0 :     if( pSuperClass )
     257           0 :         return pSuperClass->SetNotConst( rInst, nId );
     258             :     else
     259           0 :         return ERR_UNKNOWN_METHOD;
     260             : }
     261             : 
     262       21611 : ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr )
     263             : {
     264       21611 :     if( pSuperClass )
     265       21611 :         return pSuperClass->SetString( rInst, pStr );
     266             :     else
     267           0 :         return ERR_UNKNOWN_METHOD;
     268             : }
     269             : 
     270           0 : ERRTYPE RscTop::GetNumber( const RSCINST & rInst, sal_Int32 * pN )
     271             : {
     272           0 :     if( pSuperClass )
     273           0 :         return pSuperClass->GetNumber( rInst, pN );
     274             :     else
     275           0 :         return ERR_UNKNOWN_METHOD;
     276             : }
     277             : 
     278           0 : ERRTYPE RscTop::GetBool( const RSCINST & rInst, bool * pB )
     279             : {
     280           0 :     if( pSuperClass )
     281           0 :         return pSuperClass->GetBool( rInst, pB );
     282             :     else
     283           0 :         return ERR_UNKNOWN_METHOD;
     284             : }
     285             : 
     286           0 : ERRTYPE RscTop::GetConst( const RSCINST & rInst, Atom * pH )
     287             : {
     288           0 :     if( pSuperClass )
     289           0 :         return pSuperClass->GetConst( rInst, pH );
     290             :     else
     291           0 :         return ERR_UNKNOWN_METHOD;
     292             : }
     293             : 
     294         922 : ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr )
     295             : {
     296         922 :     if( pSuperClass )
     297           0 :         return pSuperClass->GetString( rInst, ppStr );
     298             :     else
     299         922 :         return ERR_UNKNOWN_METHOD;
     300             : }
     301             : 
     302      172407 : RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, bool bOwnRange )
     303             : {
     304      172407 :     if( pSuperClass )
     305      123289 :         return pSuperClass->Create( pInst, rDefInst, bOwnRange );
     306             :     else
     307             :     {
     308       49118 :         if( pInst )
     309       49118 :             return *pInst;
     310           0 :         return RSCINST();
     311             :     }
     312             : }
     313             : 
     314      222709 : void    RscTop::Destroy( const RSCINST & rInst )
     315             : {
     316      222709 :     if( pSuperClass )
     317      122940 :         pSuperClass->Destroy( rInst );
     318      222709 : }
     319             : 
     320           0 : bool RscTop::IsConsistent( const RSCINST & rInst )
     321             : {
     322           0 :     if( pSuperClass )
     323           0 :         return pSuperClass->IsConsistent( rInst );
     324             :     else
     325           0 :         return true;
     326             : }
     327             : 
     328         144 : void    RscTop::SetToDefault( const RSCINST & rInst )
     329             : {
     330         144 :     if( pSuperClass )
     331           0 :         pSuperClass->SetToDefault( rInst );
     332         144 : }
     333             : 
     334        3203 : bool    RscTop::IsDefault( const RSCINST & rInst )
     335             : {
     336        3203 :     if( pSuperClass )
     337        3203 :         return pSuperClass->IsDefault( rInst );
     338             :     else
     339           0 :         return true;
     340             : }
     341             : 
     342       21911 : bool    RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
     343             : {
     344       21911 :     if( pSuperClass )
     345       20236 :         return pSuperClass->IsValueDefault( rInst, pDef );
     346             :     else
     347        1675 :         return true;
     348             : }
     349             : 
     350           0 : void    RscTop::SetDefault( const RSCINST & rInst, Atom nVarId )
     351             : {
     352           0 :     if( pSuperClass )
     353           0 :         pSuperClass->SetDefault( rInst, nVarId );
     354           0 : }
     355             : 
     356           0 : RSCINST RscTop::GetDefault( Atom nVarId )
     357             : {
     358           0 :     if( pSuperClass )
     359           0 :         return pSuperClass->GetDefault( nVarId );
     360             :     else
     361           0 :         return RSCINST();
     362             : }
     363             : 
     364           0 : void    RscTop::Delete( const RSCINST & rInst, RscTop * pClass,
     365             :                         const RscId & rId )
     366             : {
     367           0 :     if( pSuperClass )
     368           0 :         pSuperClass->Delete( rInst, pClass, rId );
     369           0 : }
     370             : 
     371           0 : void    RscTop::DeletePos( const RSCINST & rInst, sal_uInt32 nPos )
     372             : {
     373           0 :     if( pSuperClass )
     374           0 :         pSuperClass->DeletePos( rInst, nPos );
     375           0 : }
     376             : 
     377        3618 : ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId )
     378             : {
     379        3618 :     if( pSuperClass )
     380           3 :         return pSuperClass->SetRef( rInst, rRefId );
     381             :     else
     382        3615 :         return ERR_UNKNOWN_METHOD;
     383             : }
     384             : 
     385       71706 : void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
     386             :                              RscTypCont * pTC, sal_uInt32 nTab,
     387             :                              const RscId & rId, const char * pVarName )
     388             : {
     389       71706 :     if( pSuperClass )
     390       20970 :         pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName );
     391             :     else
     392       50736 :         rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
     393       71706 : }
     394             : 
     395       65903 : void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput,
     396             :                        RscTypCont * pTC, sal_uInt32 nTab, const char * pVarName )
     397             : {
     398       65903 :     if( pSuperClass )
     399       42151 :         pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
     400       65903 : }
     401             : 
     402      101756 : ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
     403             :                                RscTypCont * pTC, const RscId & rId,
     404             :                                sal_uInt32 nDeep, bool bExtra )
     405             : {
     406      101756 :     if( pSuperClass )
     407       40736 :         return pSuperClass->WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra );
     408             :     else
     409       61020 :         return rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
     410             : }
     411             : 
     412       92716 : ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
     413             :                          RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
     414             : {
     415       92716 :     if( pSuperClass )
     416       46969 :         return pSuperClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
     417             :     else
     418       45747 :         return ERR_OK;
     419             : }
     420             : 
     421             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11