LCOV - code coverage report
Current view: top level - libreoffice/connectivity/source/drivers/file - fcode.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 221 0.0 %
Date: 2012-12-27 Functions: 0 153 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 "file/fcode.hxx"
      21             : #include <osl/diagnose.h>
      22             : #include "connectivity/sqlparse.hxx"
      23             : #include <i18npool/mslangid.hxx>
      24             : #include <tools/debug.hxx>
      25             : #include <tools/string.hxx>
      26             : #include "TConnection.hxx"
      27             : #include <com/sun/star/sdb/SQLFilterOperator.hpp>
      28             : #include <comphelper/types.hxx>
      29             : #include <rtl/logfile.hxx>
      30             : 
      31             : using namespace ::comphelper;
      32             : using namespace connectivity;
      33             : using namespace connectivity::file;
      34             : using namespace ::com::sun::star::sdbc;
      35             : using namespace ::com::sun::star::sdb;
      36             : 
      37           0 : TYPEINIT0(OCode);
      38           0 : TYPEINIT1(OOperand, OCode);
      39           0 : TYPEINIT1(OOperandRow, OOperand);
      40           0 : TYPEINIT1(OOperandAttr, OOperandRow);
      41           0 : TYPEINIT1(OOperandParam, OOperandRow);
      42           0 : TYPEINIT1(OOperandValue, OOperand);
      43           0 : TYPEINIT1(OOperandConst, OOperandValue);
      44           0 : TYPEINIT1(OOperandResult, OOperandValue);
      45           0 : TYPEINIT1(OStopOperand, OOperandValue);
      46             : 
      47           0 : TYPEINIT1(OOperator, OCode);
      48           0 : TYPEINIT1(OBoolOperator,OOperator);
      49           0 : TYPEINIT1(OOp_NOT, OBoolOperator);
      50           0 : TYPEINIT1(OOp_AND, OBoolOperator);
      51           0 : TYPEINIT1(OOp_OR, OBoolOperator);
      52           0 : TYPEINIT1(OOp_ISNULL, OBoolOperator);
      53           0 : TYPEINIT1(OOp_ISNOTNULL, OOp_ISNULL);
      54           0 : TYPEINIT1(OOp_LIKE, OBoolOperator);
      55           0 : TYPEINIT1(OOp_NOTLIKE, OOp_LIKE);
      56           0 : TYPEINIT1(OOp_COMPARE, OBoolOperator);
      57           0 : TYPEINIT1(ONumOperator, OOperator);
      58           0 : TYPEINIT1(ONthOperator, OOperator);
      59           0 : TYPEINIT1(OBinaryOperator, OOperator);
      60           0 : TYPEINIT1(OUnaryOperator, OOperator);
      61             : 
      62             : //------------------------------------------------------------------
      63             : DBG_NAME(OCode )
      64           0 : OCode::OCode()
      65             : {
      66             :     DBG_CTOR(OCode ,NULL);
      67           0 : }
      68             : // -----------------------------------------------------------------------------
      69           0 : OCode::~OCode()
      70             : {
      71             :     DBG_DTOR(OCode,NULL);
      72           0 : }
      73             : 
      74             : //------------------------------------------------------------------
      75           0 : OEvaluateSet* OOperand::preProcess(OBoolOperator* /*pOp*/, OOperand* /*pRight*/)
      76             : {
      77           0 :     return NULL;
      78             : }
      79             : // -----------------------------------------------------------------------------
      80           0 : OOperandRow::OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType)
      81             :     : OOperand(_rType)
      82           0 :     , m_nRowPos(_nPos)
      83           0 : {}
      84             : //------------------------------------------------------------------
      85           0 : void OOperandRow::bindValue(const OValueRefRow& _pRow)
      86             : {
      87             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::OOperandRow" );
      88             :     OSL_ENSURE(_pRow.is(),"NO EMPTY row allowed!");
      89           0 :     m_pRow = _pRow;
      90             :     OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
      91           0 :     (m_pRow->get())[m_nRowPos]->setBound(sal_True);
      92           0 : }
      93             : // -----------------------------------------------------------------------------
      94           0 : void OOperandRow::setValue(const ORowSetValue& _rVal)
      95             : {
      96             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::setValue" );
      97             :     OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
      98           0 :     (*(m_pRow->get())[m_nRowPos]) = _rVal;
      99           0 : }
     100             : //------------------------------------------------------------------
     101           0 : const ORowSetValue& OOperandRow::getValue() const
     102             : {
     103             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandRow::getValue" );
     104             :     OSL_ENSURE(m_pRow.is() && m_nRowPos < m_pRow->get().size(),"Invalid RowPos is >= vector.size()");
     105           0 :     return (m_pRow->get())[m_nRowPos]->getValue();
     106             : }
     107             : 
     108             : // -----------------------------------------------------------------------------
     109           0 : void OOperandValue::setValue(const ORowSetValue& _rVal)
     110             : {
     111             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::setValue" );
     112           0 :     m_aValue = _rVal;
     113           0 : }
     114             : // -------------------------------------------------------------------------
     115           0 : sal_Bool OOperandAttr::isIndexed() const
     116             : {
     117           0 :     return sal_False;
     118             : }
     119             : //------------------------------------------------------------------
     120           0 : OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos)
     121           0 :     : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR)         // Standard-Type
     122             : {
     123             :     OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument ist kein Parameter");
     124             :     OSL_ENSURE(pNode->count() > 0,"Fehler im Parse Tree");
     125           0 :     OSQLParseNode *pMark = pNode->getChild(0);
     126             : 
     127           0 :     String aParameterName;
     128           0 :     if (SQL_ISPUNCTUATION(pMark,"?"))
     129           0 :         aParameterName = '?';
     130           0 :     else if (SQL_ISPUNCTUATION(pMark,":"))
     131           0 :         aParameterName = pNode->getChild(1)->getTokenValue();
     132             :     else
     133             :     {
     134             :         OSL_FAIL("Fehler im Parse Tree");
     135           0 :     }
     136             : 
     137             :     // set up Parameter-Column with default type, can be specified more precisely later using Describe-Parameter
     138             : 
     139             :     // save Identity (not escpecially necessary here, just for the sake of symmetry)
     140             : 
     141             :     // todo
     142             :     //  OColumn* pColumn = new OFILEColumn(aParameterName,eDBType,255,0,SQL_FLAGS_NULLALLOWED);
     143             :     //  rParamColumns->AddColumn(pColumn);
     144             : 
     145             :     // the value will be set just before the evaluation
     146           0 : }
     147             : 
     148             : 
     149             : //------------------------------------------------------------------
     150           0 : const ORowSetValue& OOperandValue::getValue() const
     151             : {
     152             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandValue::getValue" );
     153           0 :     return m_aValue;
     154             : }
     155             : 
     156             : //------------------------------------------------------------------
     157           0 : OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue)
     158             : {
     159             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandConst::OOperandConst" );
     160           0 :     switch (rColumnRef.getNodeType())
     161             :     {
     162             :         case SQL_NODE_STRING:
     163           0 :             m_aValue    = aStrValue;
     164           0 :             m_eDBType   = DataType::VARCHAR;
     165           0 :             m_aValue.setBound(sal_True);
     166           0 :             return;
     167             :         case SQL_NODE_INTNUM:
     168             :         case SQL_NODE_APPROXNUM:
     169             :         {
     170           0 :             m_aValue    = aStrValue.toDouble();
     171           0 :             m_eDBType   = DataType::DOUBLE;
     172           0 :             m_aValue.setBound(sal_True);
     173           0 :             return;
     174             :         }
     175             :         default:
     176           0 :             break;
     177             :     }
     178             : 
     179           0 :     if (SQL_ISTOKEN(&rColumnRef,TRUE))
     180             :     {
     181           0 :         m_aValue = 1.0;
     182           0 :         m_eDBType = DataType::BIT;
     183             :     }
     184           0 :     else if (SQL_ISTOKEN(&rColumnRef,FALSE))
     185             :     {
     186           0 :         m_aValue = 0.0;
     187           0 :         m_eDBType = DataType::BIT;
     188             :     }
     189             :     else
     190             :     {
     191             :         OSL_FAIL("Parse Error");
     192             :     }
     193           0 :     m_aValue.setBound(sal_True);
     194             : }
     195             : 
     196             : /////////////////////////////////////////////////////////////////////////////////////////
     197             : // Implementation of the operators
     198             : 
     199             : //------------------------------------------------------------------
     200           0 : sal_uInt16 OOperator::getRequestedOperands() const {return 2;}
     201             : 
     202             : //------------------------------------------------------------------
     203           0 : sal_Bool OBoolOperator::operate(const OOperand*, const OOperand*) const
     204             : {
     205             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::operate" );
     206           0 :     return sal_False;
     207             : }
     208             : 
     209             : 
     210             : //------------------------------------------------------------------
     211           0 : void OBoolOperator::Exec(OCodeStack& rCodeStack)
     212             : {
     213             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBoolOperator::Exec" );
     214           0 :     OOperand  *pRight   = rCodeStack.top();
     215           0 :     rCodeStack.pop();
     216           0 :     OOperand  *pLeft    = rCodeStack.top();
     217           0 :     rCodeStack.pop();
     218             : 
     219           0 :     rCodeStack.push(new OOperandResultBOOL(operate(pLeft, pRight)));
     220           0 :     if (IS_TYPE(OOperandResult,pLeft))
     221           0 :         delete pLeft;
     222           0 :     if (IS_TYPE(OOperandResult,pRight))
     223           0 :         delete pRight;
     224           0 : }
     225             : //------------------------------------------------------------------
     226           0 : sal_Bool OOp_NOT::operate(const OOperand* pLeft, const OOperand* ) const
     227             : {
     228             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
     229           0 :     return !pLeft->isValid();
     230             : }
     231             : //------------------------------------------------------------------
     232           0 : void OOp_NOT::Exec(OCodeStack& rCodeStack)
     233             : {
     234             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
     235           0 :     OOperand* pOperand = rCodeStack.top();
     236           0 :     rCodeStack.pop();
     237             : 
     238           0 :     rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
     239           0 :     if (IS_TYPE(OOperandResult,pOperand))
     240           0 :         delete pOperand;
     241           0 : }
     242             : //------------------------------------------------------------------
     243           0 : sal_uInt16 OOp_NOT::getRequestedOperands() const
     244             : {
     245             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOT::getRequestedOperands" );
     246           0 :     return 1;
     247             : }
     248             : 
     249             : //------------------------------------------------------------------
     250           0 : sal_Bool OOp_AND::operate(const OOperand* pLeft, const OOperand* pRight) const
     251             : {
     252             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_AND::operate" );
     253           0 :     return pLeft->isValid() && pRight->isValid();
     254             : }
     255             : 
     256             : //------------------------------------------------------------------
     257           0 : sal_Bool OOp_OR::operate(const OOperand* pLeft, const OOperand* pRight) const
     258             : {
     259             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_OR::operate" );
     260           0 :     return pLeft->isValid() || pRight->isValid();
     261             : }
     262             : 
     263             : //------------------------------------------------------------------
     264           0 : sal_uInt16 OOp_ISNULL::getRequestedOperands() const
     265             : {
     266             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::getRequestedOperands" );
     267           0 :     return 1;
     268             : }
     269             : 
     270             : //------------------------------------------------------------------
     271           0 : void OOp_ISNULL::Exec(OCodeStack& rCodeStack)
     272             : {
     273             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::Exec" );
     274           0 :     OOperand* pOperand = rCodeStack.top();
     275           0 :     rCodeStack.pop();
     276             : 
     277           0 :     rCodeStack.push(new OOperandResultBOOL(operate(pOperand)));
     278           0 :     if (IS_TYPE(OOperandResult,pOperand))
     279           0 :         delete pOperand;
     280           0 : }
     281             : 
     282             : //------------------------------------------------------------------
     283           0 : sal_Bool OOp_ISNULL::operate(const OOperand* pOperand, const OOperand*) const
     284             : {
     285             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" );
     286           0 :     return pOperand->getValue().isNull();
     287             : }
     288             : 
     289             : //------------------------------------------------------------------
     290           0 : sal_Bool OOp_ISNOTNULL::operate(const OOperand* pOperand, const OOperand*) const
     291             : {
     292           0 :     return !OOp_ISNULL::operate(pOperand);
     293             : }
     294             : 
     295             : //------------------------------------------------------------------
     296           0 : sal_Bool OOp_LIKE::operate(const OOperand* pLeft, const OOperand* pRight) const
     297             : {
     298             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ISNULL::operate" );
     299             :     sal_Bool bMatch;
     300           0 :     ORowSetValue aLH(pLeft->getValue());
     301           0 :     ORowSetValue aRH(pRight->getValue());
     302             : 
     303           0 :     if (aLH.isNull() || aRH.isNull())
     304           0 :         bMatch = sal_False;
     305             :     else
     306             :     {
     307           0 :         bMatch = match(aRH.getString(), aLH.getString(), cEscape);
     308             :     }
     309           0 :     return bMatch;
     310             : }
     311             : 
     312             : //------------------------------------------------------------------
     313           0 : sal_Bool OOp_NOTLIKE::operate(const OOperand* pLeft, const OOperand* pRight) const
     314             : {
     315             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_NOTLIKE::operate" );
     316           0 :     return !OOp_LIKE::operate(pLeft, pRight);
     317             : }
     318             : 
     319             : //------------------------------------------------------------------
     320           0 : sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) const
     321             : {
     322             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_COMPARE::operate" );
     323           0 :     ORowSetValue aLH(pLeft->getValue());
     324           0 :     ORowSetValue aRH(pRight->getValue());
     325             : 
     326           0 :     if (aLH.isNull() || aRH.isNull()) // if (!aLH.getValue() || !aRH.getValue())
     327           0 :         return sal_False;
     328             : 
     329           0 :     sal_Bool bResult = sal_False;
     330           0 :     sal_Int32 eDBType = pLeft->getDBType();
     331             : 
     332             :     // Comparison (depending on Data-type):
     333           0 :     switch (eDBType)
     334             :     {
     335             :         case DataType::CHAR:
     336             :         case DataType::VARCHAR:
     337             :         case DataType::LONGVARCHAR:
     338             :         {
     339           0 :             rtl::OUString sLH = aLH, sRH = aRH;
     340             :             sal_Int32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength
     341             :                 (
     342             :                  sLH.pData->buffer,
     343             :                  sLH.pData->length,
     344             :                  sRH.pData->buffer,
     345           0 :                  sRH.pData->length );
     346           0 :             switch(aPredicateType)
     347             :             {
     348           0 :                 case SQLFilterOperator::EQUAL:          bResult = (nRes == 0); break;
     349           0 :                 case SQLFilterOperator::NOT_EQUAL:          bResult = (nRes != 0); break;
     350           0 :                 case SQLFilterOperator::LESS:               bResult = (nRes <  0); break;
     351           0 :                 case SQLFilterOperator::LESS_EQUAL:     bResult = (nRes <= 0); break;
     352           0 :                 case SQLFilterOperator::GREATER:            bResult = (nRes >  0); break;
     353           0 :                 case SQLFilterOperator::GREATER_EQUAL:  bResult = (nRes >= 0); break;
     354           0 :                 default:                        bResult = sal_False;
     355           0 :             }
     356           0 :         } break;
     357             :         case DataType::TINYINT:
     358             :         case DataType::SMALLINT:
     359             :         case DataType::INTEGER:
     360             :         case DataType::DECIMAL:
     361             :         case DataType::NUMERIC:
     362             :         case DataType::REAL:
     363             :         case DataType::DOUBLE:
     364             :         case DataType::BIT:
     365             :         case DataType::TIMESTAMP:
     366             :         case DataType::DATE:
     367             :         case DataType::TIME:
     368             :         {
     369           0 :             double n = aLH ,m = aRH;
     370             : 
     371           0 :             switch (aPredicateType)
     372             :             {
     373           0 :                 case SQLFilterOperator::EQUAL:          bResult = (n == m); break;
     374           0 :                 case SQLFilterOperator::LIKE:               bResult = (n == m); break;
     375           0 :                 case SQLFilterOperator::NOT_EQUAL:          bResult = (n != m); break;
     376           0 :                 case SQLFilterOperator::NOT_LIKE:           bResult = (n != m); break;
     377           0 :                 case SQLFilterOperator::LESS:               bResult = (n < m); break;
     378           0 :                 case SQLFilterOperator::LESS_EQUAL:     bResult = (n <= m); break;
     379           0 :                 case SQLFilterOperator::GREATER:            bResult = (n > m); break;
     380           0 :                 case SQLFilterOperator::GREATER_EQUAL:  bResult = (n >= m); break;
     381           0 :                 default:                        bResult = sal_False;
     382             :             }
     383           0 :         } break;
     384             :         default:
     385           0 :             bResult = aLH == aRH;
     386             :     }
     387           0 :     return bResult;
     388             : }
     389             : 
     390             : //------------------------------------------------------------------
     391           0 : void ONumOperator::Exec(OCodeStack& rCodeStack)
     392             : {
     393             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONumOperator::Exec" );
     394             : 
     395           0 :     OOperand  *pRight   = rCodeStack.top();
     396           0 :     rCodeStack.pop();
     397           0 :     OOperand  *pLeft    = rCodeStack.top();
     398           0 :     rCodeStack.pop();
     399             : 
     400           0 :     rCodeStack.push(new OOperandResultNUM(operate(pLeft->getValue(), pRight->getValue())));
     401           0 :     if (IS_TYPE(OOperandResult,pLeft))
     402           0 :         delete pLeft;
     403           0 :     if (IS_TYPE(OOperandResult,pRight))
     404           0 :         delete pRight;
     405           0 : }
     406             : //------------------------------------------------------------------
     407           0 : double OOp_ADD::operate(const double& fLeft,const double& fRight) const
     408             : {
     409             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_ADD::operate" );
     410           0 :     return fLeft + fRight;
     411             : }
     412             : 
     413             : //------------------------------------------------------------------
     414           0 : double OOp_SUB::operate(const double& fLeft,const double& fRight) const
     415             : {
     416             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_SUB::operate" );
     417           0 :     return fLeft - fRight;
     418             : }
     419             : 
     420             : //------------------------------------------------------------------
     421           0 : double OOp_MUL::operate(const double& fLeft,const double& fRight) const
     422             : {
     423             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_MUL::operate" );
     424           0 :     return fLeft * fRight;
     425             : }
     426             : 
     427             : //------------------------------------------------------------------
     428           0 : double OOp_DIV::operate(const double& fLeft,const double& fRight) const
     429             : {
     430             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOp_DIV::operate" );
     431           0 :     return fLeft / fRight;
     432             : }
     433             : // -----------------------------------------------------------------------------
     434           0 : OEvaluateSet* OOperandAttr::preProcess(OBoolOperator* /*pOp*/, OOperand* /*pRight*/)
     435             : {
     436             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OOperandAttr::preProcess" );
     437           0 :     return NULL;
     438             : }
     439             : //------------------------------------------------------------------
     440           0 : void ONthOperator::Exec(OCodeStack& rCodeStack)
     441             : {
     442             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ONthOperator::Exec" );
     443           0 :     ::std::vector<ORowSetValue> aValues;
     444           0 :     ::std::vector<OOperand*> aOperands;
     445             :     OOperand* pOperand;
     446           0 :     do
     447             :     {
     448             :         OSL_ENSURE(!rCodeStack.empty(),"Stack must be none empty!");
     449           0 :         pOperand    = rCodeStack.top();
     450           0 :         rCodeStack.pop();
     451           0 :         if ( !IS_TYPE(OStopOperand,pOperand) )
     452           0 :             aValues.push_back( pOperand->getValue() );
     453           0 :         aOperands.push_back( pOperand );
     454             :     }
     455           0 :     while ( !IS_TYPE(OStopOperand,pOperand) );
     456             : 
     457           0 :     rCodeStack.push(new OOperandResult(operate(aValues)));
     458             : 
     459           0 :     ::std::vector<OOperand*>::iterator aIter = aOperands.begin();
     460           0 :     ::std::vector<OOperand*>::iterator aEnd = aOperands.end();
     461           0 :     for (; aIter != aEnd; ++aIter)
     462             :     {
     463           0 :         if (IS_TYPE(OOperandResult,*aIter))
     464           0 :             delete *aIter;
     465           0 :     }
     466           0 : }
     467             : //------------------------------------------------------------------
     468           0 : void OBinaryOperator::Exec(OCodeStack& rCodeStack)
     469             : {
     470             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OBinaryOperator::Exec" );
     471           0 :     OOperand  *pRight   = rCodeStack.top();
     472           0 :     rCodeStack.pop();
     473           0 :     OOperand  *pLeft    = rCodeStack.top();
     474           0 :     rCodeStack.pop();
     475             : 
     476           0 :     if ( !rCodeStack.empty() && IS_TYPE(OStopOperand,rCodeStack.top()) )
     477           0 :         rCodeStack.pop();
     478             : 
     479           0 :     rCodeStack.push(new OOperandResult(operate(pLeft->getValue(),pRight->getValue())));
     480           0 :     if (IS_TYPE(OOperandResult,pRight))
     481           0 :         delete pRight;
     482           0 :     if (IS_TYPE(OOperandResult,pLeft))
     483           0 :         delete pLeft;
     484           0 : }
     485             : //------------------------------------------------------------------
     486           0 : void OUnaryOperator::Exec(OCodeStack& rCodeStack)
     487             : {
     488             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OUnaryOperator::Exec" );
     489             :     OSL_ENSURE(!rCodeStack.empty(),"Stack is empty!");
     490           0 :     OOperand* pOperand = rCodeStack.top();
     491           0 :     rCodeStack.pop();
     492             : 
     493           0 :     rCodeStack.push(new OOperandResult(operate(pOperand->getValue())));
     494           0 :     if (IS_TYPE(OOperandResult,pOperand))
     495           0 :         delete pOperand;
     496           0 : }
     497             : // -----------------------------------------------------------------------------
     498           0 : sal_uInt16 OUnaryOperator::getRequestedOperands() const {return 1;}
     499             : 
     500             : 
     501             : 
     502             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10