LCOV - code coverage report
Current view: top level - rsc/source/res - rsctop.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 100 196 51.0 %
Date: 2014-11-03 Functions: 25 47 53.2 %
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       83800 : RscTop::RscTop( Atom nId, sal_uInt32 nTypIdent, RscTop * pSuperCl )
      26             :     : RefNode( nId )
      27             :     , pSuperClass( pSuperCl )
      28       83800 :     , nTypId( nTypIdent )
      29             : {
      30       83800 :     pRefClass = this;
      31       83800 :     if( pSuperClass )
      32             :         SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2,
      33       24302 :                     pSuperClass->aCallParType );
      34       83800 : }
      35             : 
      36       41900 : void RscTop::SetCallPar(const OString& rPar1, const OString& rPar2,
      37             :     const OString& rParType)
      38             : {
      39       41900 :     aCallPar1 = rPar1;
      40       41900 :     aCallPar2 = rPar2;
      41       41900 :     aCallParType = rParType;
      42       41900 : }
      43             : 
      44       61024 : RSCINST RscTop::GetDefault()
      45             : {
      46       61024 :     if( !aDfltInst.IsInst() )
      47        1410 :         aDfltInst = this->Create( NULL, RSCINST() );
      48       61024 :     return aDfltInst;
      49             : }
      50             : 
      51       78772 : void RscTop :: Pre_dtor()
      52             : {
      53       78772 :     if( aDfltInst.IsInst() )
      54             :     {
      55         970 :         aDfltInst.pClass->Destroy( aDfltInst );
      56         970 :         rtl_freeMemory( aDfltInst.pData );
      57         970 :         aDfltInst = RSCINST();
      58             :     };
      59       78772 : }
      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       29749 : sal_uInt32 RscTop :: Size()
      75             : {
      76       29749 :     if( pSuperClass )
      77       24302 :         return pSuperClass->Size();
      78             :     else
      79        5447 :         return 0;
      80             : }
      81             : 
      82        4468 : ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId )
      83             : {
      84        4468 :     if( pSuperClass )
      85           6 :         return pSuperClass->GetRef( rInst, pRscId );
      86             :     else
      87        4462 :         return ERR_UNKNOWN_METHOD;
      88             : }
      89             : 
      90      124435 : bool RscTop::InHierarchy( RscTop * pClass )
      91             : {
      92      124435 :     if( this == pClass )
      93       72175 :         return true;
      94       52260 :     if( pSuperClass )
      95       47072 :         return pSuperClass->InHierarchy( pClass );
      96        5188 :     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       20842 : RSCINST RscTop::GetVariable( const RSCINST & rInst,
     117             :                              Atom nVarName,
     118             :                              const RSCINST & rInitInst,
     119             :                              bool bInitDflt,
     120             :                              RscTop * pCreateClass)
     121             : {
     122       20842 :     if( pSuperClass )
     123       20842 :         return pSuperClass->GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass );
     124             :     else
     125           0 :         return RSCINST();
     126             : }
     127             : 
     128       12246 : RSCINST RscTop::GetCopyVar( const RSCINST & rInst, Atom nVarName )
     129             : {
     130       12246 :     if( pSuperClass )
     131       12246 :         return pSuperClass->GetCopyVar( rInst, nVarName );
     132             :     else
     133           0 :         return RSCINST();
     134             : }
     135             : 
     136          12 : RSCINST RscTop::GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
     137             :                             const RSCINST & rInitInst )
     138             : {
     139          12 :     if( pSuperClass )
     140          12 :         return pSuperClass->GetTupelVar( rInst, nPos, rInitInst );
     141             :     else
     142           0 :         return RSCINST();
     143             : }
     144             : 
     145       17966 : ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName,
     146             :                     RscTop *pCreateClass, const RSCINST & rCreateInst,
     147             :                     RSCINST * pGetInst )
     148             : {
     149       17966 :     if( pSuperClass )
     150             :         return pSuperClass-> GetElement( rInst, rEleName,
     151             :                                          pCreateClass, rCreateInst,
     152       17966 :                                          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        5135 : sal_uInt32  RscTop::GetCount( const RSCINST & rInst )
     223             : {
     224        5135 :     if( pSuperClass )
     225        5091 :         return pSuperClass->GetCount( rInst );
     226             :     else
     227          44 :         return 0;
     228             : }
     229             : 
     230        4462 : ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue )
     231             : {
     232        4462 :     if( pSuperClass )
     233           0 :         return pSuperClass->SetNumber( rInst, lValue );
     234             :     else
     235        4462 :         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       22053 : ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr )
     263             : {
     264       22053 :     if( pSuperClass )
     265       22053 :         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         906 : ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr )
     295             : {
     296         906 :     if( pSuperClass )
     297           0 :         return pSuperClass->GetString( rInst, ppStr );
     298             :     else
     299         906 :         return ERR_UNKNOWN_METHOD;
     300             : }
     301             : 
     302      178962 : RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, bool bOwnRange )
     303             : {
     304      178962 :     if( pSuperClass )
     305      128119 :         return pSuperClass->Create( pInst, rDefInst, bOwnRange );
     306             :     else
     307             :     {
     308       50843 :         if( pInst )
     309       50843 :             return *pInst;
     310           0 :         return RSCINST();
     311             :     }
     312             : }
     313             : 
     314      238025 : void    RscTop::Destroy( const RSCINST & rInst )
     315             : {
     316      238025 :     if( pSuperClass )
     317      127768 :         pSuperClass->Destroy( rInst );
     318      238025 : }
     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         163 : void    RscTop::SetToDefault( const RSCINST & rInst )
     329             : {
     330         163 :     if( pSuperClass )
     331           0 :         pSuperClass->SetToDefault( rInst );
     332         163 : }
     333             : 
     334        3254 : bool    RscTop::IsDefault( const RSCINST & rInst )
     335             : {
     336        3254 :     if( pSuperClass )
     337        3254 :         return pSuperClass->IsDefault( rInst );
     338             :     else
     339           0 :         return true;
     340             : }
     341             : 
     342       22916 : bool    RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
     343             : {
     344       22916 :     if( pSuperClass )
     345       21043 :         return pSuperClass->IsValueDefault( rInst, pDef );
     346             :     else
     347        1873 :         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        4018 : ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId )
     378             : {
     379        4018 :     if( pSuperClass )
     380           3 :         return pSuperClass->SetRef( rInst, rRefId );
     381             :     else
     382        4015 :         return ERR_UNKNOWN_METHOD;
     383             : }
     384             : 
     385       76355 : void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
     386             :                              RscTypCont * pTC, sal_uInt32 nTab,
     387             :                              const RscId & rId, const char * pVarName )
     388             : {
     389       76355 :     if( pSuperClass )
     390       22211 :         pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName );
     391             :     else
     392       54144 :         rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
     393       76355 : }
     394             : 
     395       68529 : void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput,
     396             :                        RscTypCont * pTC, sal_uInt32 nTab, const char * pVarName )
     397             : {
     398       68529 :     if( pSuperClass )
     399       44048 :         pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
     400       68529 : }
     401             : 
     402      109866 : ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
     403             :                                RscTypCont * pTC, const RscId & rId,
     404             :                                sal_uInt32 nDeep, bool bExtra )
     405             : {
     406      109866 :     if( pSuperClass )
     407       42468 :         return pSuperClass->WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra );
     408             :     else
     409       67398 :         return rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
     410             : }
     411             : 
     412       97697 : ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
     413             :                          RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra )
     414             : {
     415       97697 :     if( pSuperClass )
     416       49742 :         return pSuperClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
     417             :     else
     418       47955 :         return ERR_OK;
     419             : }
     420             : 
     421             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10