lok: assert that tabs are not locked.
[LibreOffice.git] / store / source / storpage.hxx
blob4a03c736c495335ec0a5a0d789c001f90bea8746
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
26 #include "object.hxx"
28 #include "storbase.hxx"
29 #include "storbios.hxx"
30 #include "stortree.hxx"
32 namespace store
35 class ILockBytes;
36 struct OStoreDirectoryPageData;
37 class OStoreDirectoryPageObject;
39 class OStorePageManager : public store::OStorePageBIOS
41 public:
42 OStorePageManager();
44 /** Initialization (two-phase construction).
46 virtual storeError initialize (
47 ILockBytes * pLockBytes,
48 storeAccessMode eAccessMode,
49 sal_uInt16 & rnPageSize) override;
51 /** isValid.
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,
62 OStorePageKey &rKey);
64 storeError iget (
65 OStoreDirectoryPageObject & rPage, // [out]
66 sal_uInt32 nAttrib,
67 const rtl_String * pPath,
68 const rtl_String * pName,
69 storeAccessMode eMode);
71 storeError iterate (
72 OStorePageKey & rKey,
73 OStorePageLink & rLink,
74 sal_uInt32 & rAttrib);
76 /** remove.
77 * @see store_remove()
79 storeError remove (
80 const OStorePageKey &rKey);
82 /** IStoreHandle.
84 virtual bool isKindOf (sal_uInt32 nTypeId) override;
86 protected:
87 virtual ~OStorePageManager() override;
89 private:
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*);
109 /** Representation.
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,
127 sal_uInt16 & rIndex,
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);
151 return nullptr;
154 } // namespace store
156 #endif // INCLUDED_STORE_SOURCE_STORPAGE_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */