LCOV - code coverage report
Current view: top level - store/source - lockbyte.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 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                 :            : 
      20                 :            : #ifndef _STORE_LOCKBYTE_HXX_
      21                 :            : #define _STORE_LOCKBYTE_HXX_
      22                 :            : 
      23                 :            : #include "sal/types.h"
      24                 :            : 
      25                 :            : #include "rtl/ref.hxx"
      26                 :            : #include "rtl/ustring.h"
      27                 :            : 
      28                 :            : #include "store/types.h"
      29                 :            : #include "storbase.hxx"
      30                 :            : 
      31                 :            : namespace store
      32                 :            : {
      33                 :            : 
      34                 :            : /*========================================================================
      35                 :            :  *
      36                 :            :  * ILockBytes interface.
      37                 :            :  *
      38                 :            :  *======================================================================*/
      39                 :      17794 : class ILockBytes : public rtl::IReference
      40                 :            : {
      41                 :            : public:
      42                 :            :     /**
      43                 :            :         @param  rxAllocator [out]
      44                 :            :         @param  nPageSize [in]
      45                 :            :     */
      46                 :            :     storeError initialize (
      47                 :            :         rtl::Reference< PageData::Allocator > & rxAllocator,
      48                 :            :         sal_uInt16                              nPageSize);
      49                 :            : 
      50                 :            :     /**
      51                 :            :         @param  rPage [out]
      52                 :            :         @param  nOffset [in]
      53                 :            :      */
      54                 :            :     storeError readPageAt (
      55                 :            :         PageHolder & rPage,
      56                 :            :         sal_uInt32   nOffset);
      57                 :            : 
      58                 :            :     /**
      59                 :            :         @param  rPage [in]
      60                 :            :         @param  nOffset [in]
      61                 :            :      */
      62                 :            :     storeError writePageAt (
      63                 :            :         PageHolder const & rPage,
      64                 :            :         sal_uInt32         nOffset);
      65                 :            : 
      66                 :            :     /**
      67                 :            :         @param  nOffset [in]
      68                 :            :         @param  pBuffer [out]
      69                 :            :         @param  nBytes [in]
      70                 :            :         @return store_E_None upon success
      71                 :            :      */
      72                 :            :     storeError readAt (
      73                 :            :         sal_uInt32  nOffset,
      74                 :            :         void       *pBuffer,
      75                 :            :         sal_uInt32  nBytes);
      76                 :            : 
      77                 :            :     /**
      78                 :            :         @param  nOffset [in]
      79                 :            :         @param  pBuffer [in]
      80                 :            :         @param  nBytes [in]
      81                 :            :         @return store_E_None upon success
      82                 :            :      */
      83                 :            :     storeError writeAt (
      84                 :            :         sal_uInt32  nOffset,
      85                 :            :         const void *pBuffer,
      86                 :            :         sal_uInt32  nBytes);
      87                 :            : 
      88                 :            :     /**
      89                 :            :         @param  rnSize [out]
      90                 :            :         @return store_E_None upon success
      91                 :            :      */
      92                 :            :     storeError getSize (sal_uInt32 & rnSize);
      93                 :            : 
      94                 :            :     /**
      95                 :            :         @param  nSize [in]
      96                 :            :         @return store_E_None upon success
      97                 :            :      */
      98                 :            :     storeError setSize (sal_uInt32 nSize);
      99                 :            : 
     100                 :            :     /**
     101                 :            :         @return store_E_None upon success
     102                 :            :      */
     103                 :            :     storeError flush();
     104                 :            : 
     105                 :            : protected:
     106                 :      17043 :     ~ILockBytes() {}
     107                 :            : 
     108                 :            : private:
     109                 :            :     /** Implementation (abstract).
     110                 :            :      */
     111                 :            :     virtual storeError initialize_Impl (
     112                 :            :         rtl::Reference< PageData::Allocator > & rxAllocator,
     113                 :            :         sal_uInt16                              nPageSize) = 0;
     114                 :            : 
     115                 :            :     virtual storeError readPageAt_Impl (
     116                 :            :         PageHolder & rPage,
     117                 :            :         sal_uInt32   nOffset) = 0;
     118                 :            : 
     119                 :            :     virtual storeError writePageAt_Impl (
     120                 :            :         PageHolder const & rPage,
     121                 :            :         sal_uInt32         nOffset) = 0;
     122                 :            : 
     123                 :            :     virtual storeError readAt_Impl (
     124                 :            :         sal_uInt32  nOffset,
     125                 :            :         void       *pBuffer,
     126                 :            :         sal_uInt32  nBytes) = 0;
     127                 :            : 
     128                 :            :     virtual storeError writeAt_Impl (
     129                 :            :         sal_uInt32  nOffset,
     130                 :            :         const void *pBuffer,
     131                 :            :         sal_uInt32  nBytes) = 0;
     132                 :            : 
     133                 :            :     virtual storeError getSize_Impl (
     134                 :            :         sal_uInt32 & rnSize) = 0;
     135                 :            : 
     136                 :            :     virtual storeError setSize_Impl (
     137                 :            :         sal_uInt32 nSize) = 0;
     138                 :            : 
     139                 :            :     virtual storeError flush_Impl() = 0;
     140                 :            : };
     141                 :            : 
     142                 :            : /*========================================================================
     143                 :            :  *
     144                 :            :  * ILockBytes factories.
     145                 :            :  *
     146                 :            :  *======================================================================*/
     147                 :            : 
     148                 :            : storeError
     149                 :            : FileLockBytes_createInstance (
     150                 :            :   rtl::Reference< store::ILockBytes > & rxLockBytes,
     151                 :            :   rtl_uString *   pFilename,
     152                 :            :   storeAccessMode eAccessMode
     153                 :            : );
     154                 :            : 
     155                 :            : storeError
     156                 :            : MemoryLockBytes_createInstance (
     157                 :            :   rtl::Reference< store::ILockBytes > & rxLockBytes
     158                 :            : );
     159                 :            : 
     160                 :            : /*========================================================================
     161                 :            :  *
     162                 :            :  * The End.
     163                 :            :  *
     164                 :            :  *======================================================================*/
     165                 :            : 
     166                 :            : } // namespace store
     167                 :            : 
     168                 :            : #endif /* !_STORE_LOCKBYTE_HXX_ */
     169                 :            : 
     170                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10