LCOV - code coverage report
Current view: top level - idlc/source - astoperation.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 54 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : #include <idlc/astoperation.hxx>
      21             : #include <idlc/asttype.hxx>
      22             : #include <idlc/astbasetype.hxx>
      23             : #include <idlc/astparameter.hxx>
      24             : #include <idlc/errorhandler.hxx>
      25             : 
      26             : #include "registry/writer.hxx"
      27             : 
      28             : using namespace ::rtl;
      29             : 
      30           0 : void AstOperation::setExceptions(DeclList const * pExceptions)
      31             : {
      32           0 :     if (pExceptions != 0) {
      33           0 :         m_exceptions = *pExceptions;
      34             :     }
      35           0 : }
      36             : 
      37           0 : bool AstOperation::isVariadic() const {
      38           0 :     DeclList::const_iterator i(getIteratorEnd());
      39           0 :     return i != getIteratorBegin()
      40           0 :         && static_cast< AstParameter const * >(*(--i))->isRest();
      41             : }
      42             : 
      43           0 : bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
      44             : {
      45           0 :     sal_uInt16      nParam = getNodeCount(NT_parameter);
      46           0 :     sal_uInt16      nExcep = nExceptions();
      47           0 :     RTMethodMode    methodMode = RT_MODE_TWOWAY;
      48             : 
      49           0 :     OUString returnTypeName;
      50           0 :     if (m_pReturnType == 0) {
      51           0 :         returnTypeName = "void";
      52             :     } else {
      53           0 :         returnTypeName = OStringToOUString(
      54           0 :             m_pReturnType->getRelativName(), RTL_TEXTENCODING_UTF8);
      55             :     }
      56             :     rBlob.setMethodData(
      57           0 :         index, getDocumentation(), methodMode,
      58           0 :         OStringToOUString(getLocalName(), RTL_TEXTENCODING_UTF8),
      59           0 :         returnTypeName, nParam, nExcep);
      60             : 
      61           0 :     if ( nParam )
      62             :     {
      63           0 :         DeclList::const_iterator iter = getIteratorBegin();
      64           0 :         DeclList::const_iterator end = getIteratorEnd();
      65           0 :         AstDeclaration* pDecl = NULL;
      66             :         RTParamMode paramMode;
      67           0 :         sal_uInt16 paramIndex = 0;
      68           0 :         while ( iter != end )
      69             :         {
      70           0 :             pDecl = *iter;
      71           0 :             if ( pDecl->getNodeType() == NT_parameter )
      72             :             {
      73           0 :                 AstParameter* pParam = (AstParameter*)pDecl;
      74           0 :                 switch (pParam->getDirection())
      75             :                 {
      76             :                     case DIR_IN :
      77           0 :                         paramMode = RT_PARAM_IN;
      78           0 :                         break;
      79             :                     case DIR_OUT :
      80           0 :                         paramMode = RT_PARAM_OUT;
      81           0 :                         break;
      82             :                     case DIR_INOUT :
      83           0 :                         paramMode = RT_PARAM_INOUT;
      84           0 :                         break;
      85             :                     default:
      86           0 :                         paramMode = RT_PARAM_INVALID;
      87           0 :                         break;
      88             :                 }
      89           0 :                 if (pParam->isRest()) {
      90             :                     paramMode = static_cast< RTParamMode >(
      91           0 :                         paramMode | RT_PARAM_REST);
      92             :                 }
      93             : 
      94             :                 rBlob.setMethodParameterData(
      95             :                     index, paramIndex++, paramMode,
      96             :                     OStringToOUString(
      97           0 :                         pDecl->getLocalName(), RTL_TEXTENCODING_UTF8),
      98             :                     OStringToOUString(
      99           0 :                         pParam->getType()->getRelativName(),
     100           0 :                         RTL_TEXTENCODING_UTF8));
     101             :             }
     102           0 :             ++iter;
     103             :         }
     104             :     }
     105             : 
     106           0 :     if ( nExcep )
     107             :     {
     108           0 :         DeclList::iterator iter = m_exceptions.begin();
     109           0 :         DeclList::iterator end = m_exceptions.end();
     110           0 :         sal_uInt16 exceptIndex = 0;
     111           0 :         while ( iter != end )
     112             :         {
     113             :             rBlob.setMethodExceptionTypeName(
     114             :                 index, exceptIndex++,
     115             :                 OStringToOUString(
     116           0 :                     (*iter)->getRelativName(), RTL_TEXTENCODING_UTF8));
     117           0 :             ++iter;
     118             :         }
     119             :     }
     120             : 
     121           0 :     return true;
     122             : }
     123             : 
     124           0 : AstDeclaration* AstOperation::addDeclaration(AstDeclaration* pDecl)
     125             : {
     126           0 :     return AstScope::addDeclaration(pDecl);
     127             : }
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10