LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - RowSetRow.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 14 0.0 %
Date: 2014-04-14 Functions: 0 7 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             : #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_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           0 :     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           0 :         ORowSetOldRowHelper(const ORowSetRow& _rRow)
      43             :             : m_refCount(0)
      44           0 :             , m_aRow(_rRow)
      45           0 :         {}
      46             : 
      47           0 :         void acquire()
      48             :         {
      49           0 :             osl_atomic_increment( &m_refCount );
      50           0 :         }
      51           0 :         void release()
      52             :         {
      53           0 :             if (! osl_atomic_decrement( &m_refCount ))
      54           0 :                 delete this;
      55           0 :         }
      56           0 :         inline ORowSetRow getRow() const { return m_aRow; }
      57           0 :         inline void clearRow() { m_aRow = NULL; }
      58           0 :         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 // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10