LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetRow.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 14 100.0 %
Date: 2012-08-25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 4 75.0 %

           Branch data     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                 :            : #ifndef DBACCESS_CORE_API_ROWSETROW_HXX
      20                 :            : #define DBACCESS_CORE_API_ROWSETROW_HXX
      21                 :            : 
      22                 :            : #include <rtl/ref.hxx>
      23                 :            : #include <connectivity/CommonTools.hxx>
      24                 :            : #include "connectivity/FValue.hxx"
      25                 :            : #include <comphelper/types.hxx>
      26                 :            : 
      27                 :            : namespace dbaccess
      28                 :            : {
      29                 :            :     typedef connectivity::ORowVector< connectivity::ORowSetValue >  ORowSetValueVector;
      30                 :            :     typedef ::rtl::Reference< ORowSetValueVector >                      ORowSetRow;
      31                 :            :     typedef ::std::vector< ORowSetRow >                             ORowSetMatrix;
      32                 :            : 
      33                 :         44 :     class ORowSetOldRowHelper
      34                 :            :     {
      35                 :            :         oslInterlockedCount         m_refCount;
      36                 :            :         ORowSetRow                  m_aRow;
      37                 :            : 
      38                 :            :         ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH);
      39                 :            :         ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh);
      40                 :            :     public:
      41                 :            :         ORowSetOldRowHelper() : m_refCount(0){}
      42                 :         44 :         ORowSetOldRowHelper(const ORowSetRow& _rRow)
      43                 :            :             : m_refCount(0)
      44                 :         44 :             , m_aRow(_rRow)
      45                 :         44 :         {}
      46                 :            : 
      47                 :        136 :         void acquire()
      48                 :            :         {
      49                 :        136 :             osl_incrementInterlockedCount( &m_refCount );
      50                 :        136 :         }
      51                 :        136 :         void release()
      52                 :            :         {
      53         [ +  + ]:        136 :             if (! osl_decrementInterlockedCount( &m_refCount ))
      54         [ +  - ]:         44 :                 delete this;
      55                 :        136 :         }
      56                 :        408 :         inline ORowSetRow getRow() const { return m_aRow; }
      57                 :         92 :         inline void clearRow() { m_aRow = NULL; }
      58                 :        212 :         inline void setRow(const ORowSetRow& _rRow) { m_aRow = _rRow; }
      59                 :            :     };
      60                 :            : 
      61                 :            :     typedef ::rtl::Reference< ORowSetOldRowHelper > TORowSetOldRowHelperRef;
      62                 :            : 
      63                 :            :     class ORowSetValueCompare
      64                 :            :     {
      65                 :            :         const ::com::sun::star::uno::Any& m_rAny;
      66                 :            :     public:
      67                 :            :         ORowSetValueCompare(const ::com::sun::star::uno::Any& _rAny) : m_rAny(_rAny){}
      68                 :            : 
      69                 :            :         sal_Bool operator ()(const ORowSetRow& _rRH)
      70                 :            :         {
      71                 :            :             switch((_rRH->get())[0].getTypeKind())
      72                 :            :             {
      73                 :            :                 case ::com::sun::star::sdbc::DataType::TINYINT:
      74                 :            :                 case ::com::sun::star::sdbc::DataType::SMALLINT:
      75                 :            :                 case ::com::sun::star::sdbc::DataType::INTEGER:
      76                 :            :                     return comphelper::getINT32(m_rAny) == (sal_Int32)(_rRH->get())[0];
      77                 :            :                 default:
      78                 :            :                 {
      79                 :            :                     ::com::sun::star::uno::Sequence<sal_Int8> aSeq;
      80                 :            :                     m_rAny >>= aSeq;
      81                 :            :                     return aSeq == (_rRH->get())[0];
      82                 :            :                 }
      83                 :            :             }
      84                 :            :         }
      85                 :            :     };
      86                 :            : }
      87                 :            : #endif // DBACCESS_CORE_API_ROWSETROW_HXX
      88                 :            : 
      89                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10