1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_STORE_SOURCE_STORPAGE_HXX
21 #define INCLUDED_STORE_SOURCE_STORPAGE_HXX
23 #include "sal/types.h"
26 #include "lockbyte.hxx"
28 #include "storbase.hxx"
29 #include "storbios.hxx"
30 #include "stortree.hxx"
35 struct OStoreDirectoryPageData
;
36 class OStoreDirectoryPageObject
;
38 /*========================================================================
40 * OStorePageManager interface.
42 *======================================================================*/
43 class OStorePageManager
: public store::OStorePageBIOS
50 /** Initialization (two-phase construction).
52 virtual storeError
initialize (
53 ILockBytes
* pLockBytes
,
54 storeAccessMode eAccessMode
,
55 sal_uInt16
& rnPageSize
) override
;
58 * @return sal_True upon successful initialization,
59 * sal_False otherwise.
61 inline bool isValid() const;
63 /** DirectoryPage I/O (managed).
65 static storeError
namei (
66 const rtl_String
*pPath
,
67 const rtl_String
*pName
,
71 OStoreDirectoryPageObject
& rPage
, // [out]
73 const rtl_String
* pPath
,
74 const rtl_String
* pName
,
75 storeAccessMode eMode
);
79 OStorePageLink
& rLink
,
80 sal_uInt32
& rAttrib
);
86 const OStorePageKey
&rKey
);
90 virtual bool isKindOf (sal_uInt32 nTypeId
) override
;
95 virtual ~OStorePageManager() override
;
100 typedef OStorePageBIOS base
;
101 typedef OStorePageManager self
;
103 typedef OStoreBTreeEntry entry
;
104 typedef OStoreBTreeNodeData page
;
105 typedef OStoreBTreeNodeObject node
;
107 typedef OStoreDirectoryPageData inode
;
108 typedef PageHolderObject
< inode
> inode_holder_type
;
110 /** IStoreHandle TypeId.
112 static const sal_uInt32 m_nTypeId
;
114 /** IStoreHandle query() template function specialization.
116 friend OStorePageManager
*
117 SAL_CALL query
<> (OStoreObject
*pHandle
, OStorePageManager
*);
121 OStoreBTreeRootObject m_aRoot
;
123 /** DirectoryPage I/O (managed).
125 storeError
load_dirpage_Impl ( // @@@ => private: iget() @@@
126 const OStorePageKey
&rKey
,
127 OStoreDirectoryPageObject
&rPage
);
129 storeError
save_dirpage_Impl ( // @@@ => private: iget(), rebuild() @@@
130 const OStorePageKey
&rKey
,
131 OStoreDirectoryPageObject
&rPage
);
133 /** find_lookup (node page and index, w/o split).
135 storeError
find_lookup (
136 OStoreBTreeNodeObject
& rNode
,
138 OStorePageKey
const & rKey
);
140 /** remove (possibly down from root).
142 storeError
remove_Impl (entry
& rEntry
);
144 OStorePageManager (const OStorePageManager
&) = delete;
145 OStorePageManager
& operator= (const OStorePageManager
&) = delete;
148 inline bool OStorePageManager::isValid() const
150 return (base::isValid() /* @@@ NYI && (m_aRoot.is()) */);
153 template<> inline OStorePageManager
*
154 SAL_CALL
query (OStoreObject
*pHandle
, SAL_UNUSED_PARAMETER OStorePageManager
*)
156 if (pHandle
&& pHandle
->isKindOf (OStorePageManager::m_nTypeId
))
158 // Handle is kind of OStorePageManager.
159 return static_cast<OStorePageManager
*>(pHandle
);
164 /*========================================================================
168 *======================================================================*/
172 #endif // INCLUDED_STORE_SOURCE_STORPAGE_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */