LCOV - code coverage report
Current view: top level - store/source - storlckb.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 4 75.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.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             : #ifndef INCLUDED_STORE_SOURCE_STORLCKB_HXX
      21             : #define INCLUDED_STORE_SOURCE_STORLCKB_HXX
      22             : 
      23             : #include "sal/types.h"
      24             : 
      25             : #include "rtl/ustring.h"
      26             : #include "rtl/ref.hxx"
      27             : 
      28             : #include "object.hxx"
      29             : #include "storbase.hxx"
      30             : #include "storpage.hxx"
      31             : 
      32             : namespace store
      33             : {
      34             : 
      35             : struct OStoreDataPageData;
      36             : struct OStoreDirectoryPageData;
      37             : 
      38             : /*========================================================================
      39             :  *
      40             :  * OStoreLockBytes interface.
      41             :  *
      42             :  *======================================================================*/
      43             : class OStoreLockBytes : public store::OStoreObject
      44             : {
      45             : public:
      46             :     /** Construction.
      47             :      */
      48             :     OStoreLockBytes();
      49             : 
      50             :     /** create (two-phase construction).
      51             :      *  @param  pManager [in]
      52             :      *  @param  pPath [in]
      53             :      *  @param  pName [in]
      54             :      *  @param  eMode [in]
      55             :      *  @return store_E_None upon success
      56             :      */
      57             :     storeError create (
      58             :         OStorePageManager *pManager,
      59             :         rtl_String        *pPath,
      60             :         rtl_String        *pName,
      61             :         storeAccessMode    eAccessMode);
      62             : 
      63             :     /** Read at Offset into Buffer.
      64             :      *  @param  nOffset [in]
      65             :      *  @param  pBuffer [out]
      66             :      *  @param  nBytes [in]
      67             :      *  @param  rnDone [out]
      68             :      *  @return store_E_None upon success
      69             :      */
      70             :     storeError readAt (
      71             :         sal_uInt32  nOffset,
      72             :         void       *pBuffer,
      73             :         sal_uInt32  nBytes,
      74             :         sal_uInt32 &rnDone);
      75             : 
      76             :     /** Write at Offset from Buffer.
      77             :      *  @param  nOffset [in]
      78             :      *  @param  pBuffer [in]
      79             :      *  @param  nBytes [in]
      80             :      *  @param  rnDone [out]
      81             :      *  @return store_E_None upon success
      82             :      */
      83             :     storeError writeAt (
      84             :         sal_uInt32  nOffset,
      85             :         const void *pBuffer,
      86             :         sal_uInt32  nBytes,
      87             :         sal_uInt32 &rnDone);
      88             : 
      89             :     /** flush.
      90             :      *  @return store_E_None upon success
      91             :      */
      92             :     storeError flush();
      93             : 
      94             :     /** setSize.
      95             :      *  @param  nSize [in]
      96             :      *  @return store_E_None upon success
      97             :      */
      98             :     storeError setSize (sal_uInt32 nSize);
      99             : 
     100             :     /** stat.
     101             :      *  @paran  rnSize [out]
     102             :      *  @return store_E_None upon success
     103             :      */
     104             :     storeError stat (sal_uInt32 &rnSize);
     105             : 
     106             :     /** IStoreHandle.
     107             :      */
     108             :     virtual bool isKindOf (sal_uInt32 nMagic) SAL_OVERRIDE;
     109             : 
     110             : protected:
     111             :     /** Destruction (OReference).
     112             :      */
     113             :     virtual ~OStoreLockBytes();
     114             : 
     115             : private:
     116             :     /** IStoreHandle TypeId.
     117             :      */
     118             :     static const sal_uInt32 m_nTypeId;
     119             : 
     120             :     /** IStoreHandle query() template specialization.
     121             :      */
     122             :     friend OStoreLockBytes*
     123             :     SAL_CALL query<> (IStoreHandle *pHandle, OStoreLockBytes*);
     124             : 
     125             :     /** Representation.
     126             :      */
     127             :     rtl::Reference<OStorePageManager> m_xManager;
     128             : 
     129             :     typedef OStoreDataPageData        data;
     130             :     typedef OStoreDirectoryPageData   inode;
     131             : 
     132             :     typedef PageHolderObject< inode > inode_holder_type;
     133             :     inode_holder_type                 m_xNode;
     134             : 
     135             :     bool m_bWriteable;
     136             : 
     137             :     OStoreLockBytes (const OStoreLockBytes&) SAL_DELETED_FUNCTION;
     138             :     OStoreLockBytes& operator= (const OStoreLockBytes&) SAL_DELETED_FUNCTION;
     139             : };
     140             : 
     141             : template<> inline OStoreLockBytes*
     142         410 : SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*)
     143             : {
     144         410 :     if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
     145             :     {
     146             :         // Handle is kind of OStoreLockBytes.
     147         410 :         return static_cast<OStoreLockBytes*>(pHandle);
     148             :     }
     149           0 :     return 0;
     150             : }
     151             : 
     152             : /*========================================================================
     153             :  *
     154             :  * The End.
     155             :  *
     156             :  *======================================================================*/
     157             : 
     158             : } // namespace store
     159             : 
     160             : #endif // INCLUDED_STORE_SOURCE_STORLCKB_HXX
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11