LCOV - code coverage report
Current view: top level - store/source - storpage.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 6 83.3 %
Date: 2015-06-13 12:38:46 Functions: 2 2 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_STORPAGE_HXX
      21             : #define INCLUDED_STORE_SOURCE_STORPAGE_HXX
      22             : 
      23             : #include "sal/types.h"
      24             : 
      25             : #include "object.hxx"
      26             : #include "lockbyte.hxx"
      27             : 
      28             : #include "storbase.hxx"
      29             : #include "storbios.hxx"
      30             : #include "stortree.hxx"
      31             : 
      32             : namespace store
      33             : {
      34             : 
      35             : struct OStoreDirectoryPageData;
      36             : class  OStoreDirectoryPageObject;
      37             : 
      38             : /*========================================================================
      39             :  *
      40             :  * OStorePageManager interface.
      41             :  *
      42             :  *======================================================================*/
      43             : class OStorePageManager : public store::OStorePageBIOS
      44             : {
      45             : public:
      46             :     /** Construction.
      47             :      */
      48             :     OStorePageManager();
      49             : 
      50             :     /** Initialization (two-phase construction).
      51             :      */
      52             :     virtual storeError initialize (
      53             :         ILockBytes *    pLockBytes,
      54             :         storeAccessMode eAccessMode,
      55             :         sal_uInt16 &    rnPageSize) SAL_OVERRIDE;
      56             : 
      57             :     /** isValid.
      58             :      *  @return sal_True  upon successful initialization,
      59             :      *          sal_False otherwise.
      60             :      */
      61             :     inline bool isValid() const;
      62             : 
      63             :     /** DirectoryPage I/O (managed).
      64             :      */
      65             :     static storeError namei (
      66             :         const rtl_String *pPath,
      67             :         const rtl_String *pName,
      68             :         OStorePageKey    &rKey);
      69             : 
      70             :     storeError iget (
      71             :         OStoreDirectoryPageObject & rPage, // [out]
      72             :         sal_uInt32                  nAttrib,
      73             :         const rtl_String *          pPath,
      74             :         const rtl_String *          pName,
      75             :         storeAccessMode             eMode);
      76             : 
      77             :     storeError iterate (
      78             :         OStorePageKey &  rKey,
      79             :         OStorePageLink & rLink,
      80             :         sal_uInt32 &     rAttrib);
      81             : 
      82             :     /** attrib [nAttrib = ((nAttrib & ~nMask1) | nMask2)].
      83             :      *  @see store_attrib()
      84             :      */
      85             :     storeError attrib (
      86             :         const OStorePageKey &rKey,
      87             :         sal_uInt32           nMask1,
      88             :         sal_uInt32           nMask2,
      89             :         sal_uInt32          &rAttrib);
      90             : 
      91             :     /** link (insert Source Key as hardlink to Destination).
      92             :      *  @see store_link()
      93             :      */
      94             :     storeError link (
      95             :         const OStorePageKey &rSrcKey,
      96             :         const OStorePageKey &rDstKey);
      97             : 
      98             :     /** symlink (insert Source DirectoryPage as symlink to Destination).
      99             :      *  @see store_symlink()
     100             :      */
     101             :     storeError symlink (
     102             :         const rtl_String    *pSrcPath,
     103             :         const rtl_String    *pSrcName,
     104             :         const OStorePageKey &rDstKey);
     105             : 
     106             :     /** rename.
     107             :      *  @see store_rename()
     108             :      */
     109             :     storeError rename (
     110             :         const OStorePageKey &rSrcKey,
     111             :         const rtl_String    *pDstPath,
     112             :         const rtl_String    *pDstName);
     113             : 
     114             :     /** remove.
     115             :      *  @see store_remove()
     116             :      */
     117             :     storeError remove (
     118             :         const OStorePageKey &rKey);
     119             : 
     120             :     /** rebuild (combines recover and compact from 'Src' to 'Dst').
     121             :      *  @param  pSrcLB [in] accessed readonly.
     122             :      *  @param  pDstLB [in] truncated and accessed readwrite (as initialize()).
     123             :      *  @return store_E_None upon success.
     124             :      *
     125             :      *  @see store_rebuildFile()
     126             :      */
     127             :     storeError rebuild (
     128             :         ILockBytes *pSrcLB,
     129             :         ILockBytes *pDstLB);
     130             : 
     131             :     /** IStoreHandle.
     132             :      */
     133             :     virtual bool isKindOf (sal_uInt32 nTypeId) SAL_OVERRIDE;
     134             : 
     135             : protected:
     136             :     /** Destruction.
     137             :     */
     138             :     virtual ~OStorePageManager();
     139             : 
     140             : private:
     141             :     /** Implementation.
     142             :     */
     143             :     typedef OStorePageBIOS            base;
     144             :     typedef OStorePageManager         self;
     145             : 
     146             :     typedef OStoreBTreeEntry          entry;
     147             :     typedef OStoreBTreeNodeData       page;
     148             :     typedef OStoreBTreeNodeObject     node;
     149             : 
     150             :     typedef OStoreDirectoryPageData   inode;
     151             :     typedef PageHolderObject< inode > inode_holder_type;
     152             : 
     153             :     /** IStoreHandle TypeId.
     154             :      */
     155             :     static const sal_uInt32 m_nTypeId;
     156             : 
     157             :     /** IStoreHandle query() template function specialization.
     158             :      */
     159             :     friend OStorePageManager*
     160             :     SAL_CALL query<> (IStoreHandle *pHandle, OStorePageManager*);
     161             : 
     162             :     /** Representation.
     163             :     */
     164             :     OStoreBTreeRootObject m_aRoot;
     165             : 
     166             :     /** DirectoryPage I/O (managed).
     167             :      */
     168             :     storeError load_dirpage_Impl ( // @@@ => private: iget() @@@
     169             :         const OStorePageKey       &rKey,
     170             :         OStoreDirectoryPageObject &rPage);
     171             : 
     172             :     storeError save_dirpage_Impl ( // @@@ => private: iget(), rebuild() @@@
     173             :         const OStorePageKey       &rKey,
     174             :         OStoreDirectoryPageObject &rPage);
     175             : 
     176             :     /** find_lookup (node page and index, w/o split).
     177             :     */
     178             :     storeError find_lookup (
     179             :         OStoreBTreeNodeObject & rNode,
     180             :         sal_uInt16 &            rIndex,
     181             :         OStorePageKey const &   rKey);
     182             : 
     183             :     /** remove (possibly down from root).
     184             :     */
     185             :     storeError remove_Impl (entry & rEntry);
     186             : 
     187             :     OStorePageManager (const OStorePageManager&) SAL_DELETED_FUNCTION;
     188             :     OStorePageManager& operator= (const OStorePageManager&) SAL_DELETED_FUNCTION;
     189             : };
     190             : 
     191        1417 : inline bool OStorePageManager::isValid() const
     192             : {
     193        1417 :     return (base::isValid() /* @@@ NYI && (m_aRoot.is()) */);
     194             : }
     195             : 
     196             : template<> inline OStorePageManager*
     197        1487 : SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStorePageManager*)
     198             : {
     199        1487 :     if (pHandle && pHandle->isKindOf (OStorePageManager::m_nTypeId))
     200             :     {
     201             :         // Handle is kind of OStorePageManager.
     202        1487 :         return static_cast<OStorePageManager*>(pHandle);
     203             :     }
     204           0 :     return 0;
     205             : }
     206             : 
     207             : /*========================================================================
     208             :  *
     209             :  * The End.
     210             :  *
     211             :  *======================================================================*/
     212             : 
     213             : } // namespace store
     214             : 
     215             : #endif // INCLUDED_STORE_SOURCE_STORPAGE_HXX
     216             : 
     217             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11