1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _STORE_STORPAGE_HXX_
30 #define _STORE_STORPAGE_HXX_
32 #include "sal/types.h"
35 #include "lockbyte.hxx"
37 #include "storbase.hxx"
38 #include "storbios.hxx"
39 #include "stortree.hxx"
44 struct OStoreDirectoryPageData
;
45 class OStoreDirectoryPageObject
;
47 /*========================================================================
49 * OStorePageManager interface.
51 *======================================================================*/
52 class OStorePageManager
: public store::OStorePageBIOS
57 OStorePageManager (void);
59 /** Initialization (two-phase construction).
61 virtual storeError
initialize (
62 ILockBytes
* pLockBytes
,
63 storeAccessMode eAccessMode
,
64 sal_uInt16
& rnPageSize
);
67 * @return sal_True upon successful initialization,
68 * sal_False otherwise.
70 inline sal_Bool
isValid (void) const;
72 /** DirectoryPage I/O (managed).
74 static storeError
namei (
75 const rtl_String
*pPath
,
76 const rtl_String
*pName
,
80 OStoreDirectoryPageObject
& rPage
, // [out]
82 const rtl_String
* pPath
,
83 const rtl_String
* pName
,
84 storeAccessMode eMode
);
88 OStorePageLink
& rLink
,
89 sal_uInt32
& rAttrib
);
91 /** attrib [nAttrib = ((nAttrib & ~nMask1) | nMask2)].
95 const OStorePageKey
&rKey
,
100 /** link (insert Source Key as hardlink to Destination).
104 const OStorePageKey
&rSrcKey
,
105 const OStorePageKey
&rDstKey
);
107 /** symlink (insert Source DirectoryPage as symlink to Destination).
108 * @see store_symlink()
111 const rtl_String
*pSrcPath
,
112 const rtl_String
*pSrcName
,
113 const OStorePageKey
&rDstKey
);
116 * @see store_rename()
119 const OStorePageKey
&rSrcKey
,
120 const rtl_String
*pDstPath
,
121 const rtl_String
*pDstName
);
124 * @see store_remove()
127 const OStorePageKey
&rKey
);
129 /** rebuild (combines recover and compact from 'Src' to 'Dst').
130 * @param pSrcLB [in] accessed readonly.
131 * @param pDstLB [in] truncated and accessed readwrite (as initialize()).
132 * @return store_E_None upon success.
134 * @see store_rebuildFile()
142 virtual sal_Bool SAL_CALL
isKindOf (sal_uInt32 nTypeId
);
147 virtual ~OStorePageManager (void);
152 typedef OStorePageBIOS base
;
153 typedef OStorePageManager self
;
155 typedef OStoreBTreeEntry entry
;
156 typedef OStoreBTreeNodeData page
;
157 typedef OStoreBTreeNodeObject node
;
159 typedef OStoreDirectoryPageData inode
;
160 typedef PageHolderObject
< inode
> inode_holder_type
;
162 /** IStoreHandle TypeId.
164 static const sal_uInt32 m_nTypeId
;
166 /** IStoreHandle query() template function specialization.
168 friend OStorePageManager
*
169 SAL_CALL query
<> (IStoreHandle
*pHandle
, OStorePageManager
*);
173 OStoreBTreeRootObject m_aRoot
;
175 /** DirectoryPage I/O (managed).
177 storeError
load_dirpage_Impl ( // @@@ => private: iget() @@@
178 const OStorePageKey
&rKey
,
179 OStoreDirectoryPageObject
&rPage
);
181 storeError
save_dirpage_Impl ( // @@@ => private: iget(), rebuild() @@@
182 const OStorePageKey
&rKey
,
183 OStoreDirectoryPageObject
&rPage
);
185 /** find_lookup (node page and index, w/o split).
187 storeError
find_lookup (
188 OStoreBTreeNodeObject
& rNode
,
190 OStorePageKey
const & rKey
);
192 /** remove (possibly down from root).
194 storeError
remove_Impl (entry
& rEntry
);
198 OStorePageManager (const OStorePageManager
&);
199 OStorePageManager
& operator= (const OStorePageManager
&);
202 inline sal_Bool
OStorePageManager::isValid (void) const
204 return (base::isValid() /* @@@ NYI && (m_aRoot.is()) */);
207 template<> inline OStorePageManager
*
208 SAL_CALL
query (IStoreHandle
*pHandle
, SAL_UNUSED_PARAMETER OStorePageManager
*)
210 if (pHandle
&& pHandle
->isKindOf (OStorePageManager::m_nTypeId
))
212 // Handle is kind of OStorePageManager.
213 return static_cast<OStorePageManager
*>(pHandle
);
218 /*========================================================================
222 *======================================================================*/
226 #endif /* !_STORE_STORPAGE_HXX_ */
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */