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>
24 #include <rtl/string.h>
28 #include "storbase.hxx"
29 #include "storbios.hxx"
30 #include "stortree.hxx"
36 struct OStoreDirectoryPageData
;
37 class OStoreDirectoryPageObject
;
39 class OStorePageManager
: public store::OStorePageBIOS
44 /** Initialization (two-phase construction).
46 virtual storeError
initialize (
47 ILockBytes
* pLockBytes
,
48 storeAccessMode eAccessMode
,
49 sal_uInt16
& rnPageSize
) override
;
52 * @return sal_True upon successful initialization,
53 * sal_False otherwise.
55 inline bool isValid() const;
57 /** DirectoryPage I/O (managed).
59 static storeError
namei (
60 const rtl_String
*pPath
,
61 const rtl_String
*pName
,
65 OStoreDirectoryPageObject
& rPage
, // [out]
67 const rtl_String
* pPath
,
68 const rtl_String
* pName
,
69 storeAccessMode eMode
);
73 OStorePageLink
& rLink
,
74 sal_uInt32
& rAttrib
);
80 const OStorePageKey
&rKey
);
84 virtual bool isKindOf (sal_uInt32 nTypeId
) override
;
87 virtual ~OStorePageManager() override
;
90 typedef OStorePageBIOS base
;
91 typedef OStorePageManager self
;
93 typedef OStoreBTreeEntry entry
;
94 typedef OStoreBTreeNodeData page
;
95 typedef OStoreBTreeNodeObject node
;
97 typedef OStoreDirectoryPageData inode
;
98 typedef PageHolderObject
< inode
> inode_holder_type
;
100 /** IStoreHandle TypeId.
102 static const sal_uInt32 m_nTypeId
;
104 /** IStoreHandle query() template function specialization.
106 friend OStorePageManager
*
107 SAL_CALL query
<> (OStoreObject
*pHandle
, OStorePageManager
*);
111 OStoreBTreeRootObject m_aRoot
;
113 /** DirectoryPage I/O (managed).
115 storeError
load_dirpage_Impl(
116 const OStorePageKey
&rKey
,
117 OStoreDirectoryPageObject
&rPage
);
119 storeError
save_dirpage_Impl(
120 const OStorePageKey
&rKey
,
121 OStoreDirectoryPageObject
&rPage
);
123 /** find_lookup (node page and index, w/o split).
125 storeError
find_lookup (
126 OStoreBTreeNodeObject
& rNode
,
128 OStorePageKey
const & rKey
);
130 /** remove (possibly down from root).
132 storeError
remove_Impl (entry
& rEntry
);
134 OStorePageManager (const OStorePageManager
&) = delete;
135 OStorePageManager
& operator= (const OStorePageManager
&) = delete;
138 inline bool OStorePageManager::isValid() const
140 return base::isValid();
143 template<> inline OStorePageManager
*
144 SAL_CALL
query (OStoreObject
*pHandle
, SAL_UNUSED_PARAMETER OStorePageManager
*)
146 if (pHandle
&& pHandle
->isKindOf (OStorePageManager::m_nTypeId
))
148 // Handle is kind of OStorePageManager.
149 return static_cast<OStorePageManager
*>(pHandle
);
156 #endif // INCLUDED_STORE_SOURCE_STORPAGE_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */