1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: storpage.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _STORE_STORPAGE_HXX_
32 #define _STORE_STORPAGE_HXX_ "$Revision: 1.6.8.2 $"
34 #include "sal/types.h"
37 #include "lockbyte.hxx"
39 #include "storbase.hxx"
40 #include "storbios.hxx"
41 #include "stortree.hxx"
46 struct OStoreDirectoryPageData
;
47 class OStoreDirectoryPageObject
;
49 /*========================================================================
51 * OStorePageManager interface.
53 *======================================================================*/
54 class OStorePageManager
: public store::OStorePageBIOS
59 OStorePageManager (void);
61 /** Initialization (two-phase construction).
63 virtual storeError
initialize (
64 ILockBytes
* pLockBytes
,
65 storeAccessMode eAccessMode
,
66 sal_uInt16
& rnPageSize
);
69 * @return sal_True upon successful initialization,
70 * sal_False otherwise.
72 inline sal_Bool
isValid (void) const;
74 /** DirectoryPage I/O (managed).
76 static storeError
namei (
77 const rtl_String
*pPath
,
78 const rtl_String
*pName
,
82 OStoreDirectoryPageObject
& rPage
, // [out]
84 const rtl_String
* pPath
,
85 const rtl_String
* pName
,
86 storeAccessMode eMode
);
90 OStorePageLink
& rLink
,
91 sal_uInt32
& rAttrib
);
93 /** attrib [nAttrib = ((nAttrib & ~nMask1) | nMask2)].
97 const OStorePageKey
&rKey
,
100 sal_uInt32
&rAttrib
);
102 /** link (insert Source Key as hardlink to Destination).
106 const OStorePageKey
&rSrcKey
,
107 const OStorePageKey
&rDstKey
);
109 /** symlink (insert Source DirectoryPage as symlink to Destination).
110 * @see store_symlink()
113 const rtl_String
*pSrcPath
,
114 const rtl_String
*pSrcName
,
115 const OStorePageKey
&rDstKey
);
118 * @see store_rename()
121 const OStorePageKey
&rSrcKey
,
122 const rtl_String
*pDstPath
,
123 const rtl_String
*pDstName
);
126 * @see store_remove()
129 const OStorePageKey
&rKey
);
131 /** rebuild (combines recover and compact from 'Src' to 'Dst').
132 * @param pSrcLB [in] accessed readonly.
133 * @param pDstLB [in] truncated and accessed readwrite (as initialize()).
134 * @return store_E_None upon success.
136 * @see store_rebuildFile()
144 virtual sal_Bool SAL_CALL
isKindOf (sal_uInt32 nTypeId
);
149 virtual ~OStorePageManager (void);
154 typedef OStorePageBIOS base
;
155 typedef OStorePageManager self
;
157 typedef OStoreBTreeEntry entry
;
158 typedef OStoreBTreeNodeData page
;
159 typedef OStoreBTreeNodeObject node
;
161 typedef OStoreDirectoryPageData inode
;
162 typedef PageHolderObject
< inode
> inode_holder_type
;
164 /** IStoreHandle TypeId.
166 static const sal_uInt32 m_nTypeId
;
168 /** IStoreHandle query() template function specialization.
170 friend OStorePageManager
*
171 SAL_CALL query
<> (IStoreHandle
*pHandle
, OStorePageManager
*);
175 OStoreBTreeRootObject m_aRoot
;
177 /** DirectoryPage I/O (managed).
179 storeError
load_dirpage_Impl ( // @@@ => private: iget() @@@
180 const OStorePageKey
&rKey
,
181 OStoreDirectoryPageObject
&rPage
);
183 storeError
save_dirpage_Impl ( // @@@ => private: iget(), rebuild() @@@
184 const OStorePageKey
&rKey
,
185 OStoreDirectoryPageObject
&rPage
);
187 /** find_lookup (node page and index, w/o split).
189 storeError
find_lookup (
190 OStoreBTreeNodeObject
& rNode
,
192 OStorePageKey
const & rKey
);
194 /** remove (possibly down from root).
196 storeError
remove_Impl (entry
& rEntry
);
200 OStorePageManager (const OStorePageManager
&);
201 OStorePageManager
& operator= (const OStorePageManager
&);
204 inline sal_Bool
OStorePageManager::isValid (void) const
206 return (base::isValid() /* @@@ NYI && (m_aRoot.is()) */);
209 template<> inline OStorePageManager
*
210 SAL_CALL
query (IStoreHandle
*pHandle
, OStorePageManager
*)
212 if (pHandle
&& pHandle
->isKindOf (OStorePageManager::m_nTypeId
))
214 // Handle is kind of OStorePageManager.
215 return static_cast<OStorePageManager
*>(pHandle
);
220 /*========================================================================
224 *======================================================================*/
228 #endif /* !_STORE_STORPAGE_HXX_ */