nss: upgrade to release 3.73
[LibreOffice.git] / store / source / storlckb.hxx
blobb31bcd28de6ef36fe4789cc2d5a05f4ba089083d
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_STORLCKB_HXX
21 #define INCLUDED_STORE_SOURCE_STORLCKB_HXX
23 #include <sal/types.h>
25 #include <rtl/string.h>
26 #include <rtl/ref.hxx>
28 #include "object.hxx"
29 #include "storbase.hxx"
31 namespace store
34 class OStorePageManager;
35 struct OStoreDataPageData;
36 struct OStoreDirectoryPageData;
38 class OStoreLockBytes : public store::OStoreObject
40 public:
41 /** Construction.
43 OStoreLockBytes();
45 /** create (two-phase construction).
46 * @param pManager [in]
47 * @param pPath [in]
48 * @param pName [in]
49 * @param eMode [in]
50 * @return store_E_None upon success
52 storeError create (
53 OStorePageManager *pManager,
54 rtl_String const *pPath,
55 rtl_String const *pName,
56 storeAccessMode eAccessMode);
58 /** Read at Offset into Buffer.
59 * @param nOffset [in]
60 * @param pBuffer [out]
61 * @param nBytes [in]
62 * @param rnDone [out]
63 * @return store_E_None upon success
65 storeError readAt (
66 sal_uInt32 nOffset,
67 void *pBuffer,
68 sal_uInt32 nBytes,
69 sal_uInt32 &rnDone);
71 /** Write at Offset from Buffer.
72 * @param nOffset [in]
73 * @param pBuffer [in]
74 * @param nBytes [in]
75 * @param rnDone [out]
76 * @return store_E_None upon success
78 storeError writeAt (
79 sal_uInt32 nOffset,
80 const void *pBuffer,
81 sal_uInt32 nBytes,
82 sal_uInt32 &rnDone);
84 /** setSize.
85 * @param nSize [in]
86 * @return store_E_None upon success
88 storeError setSize (sal_uInt32 nSize);
90 /** IStoreHandle.
92 virtual bool isKindOf (sal_uInt32 nMagic) override;
94 protected:
95 /** Destruction (OReference).
97 virtual ~OStoreLockBytes() override;
99 private:
100 /** IStoreHandle TypeId.
102 static const sal_uInt32 m_nTypeId;
104 /** IStoreHandle query() template specialization.
106 friend OStoreLockBytes*
107 SAL_CALL query<> (OStoreObject *pHandle, OStoreLockBytes*);
109 /** Representation.
111 rtl::Reference<OStorePageManager> m_xManager;
113 typedef OStoreDataPageData data;
114 typedef OStoreDirectoryPageData inode;
116 typedef PageHolderObject< inode > inode_holder_type;
117 inode_holder_type m_xNode;
119 bool m_bWriteable;
121 OStoreLockBytes (const OStoreLockBytes&) = delete;
122 OStoreLockBytes& operator= (const OStoreLockBytes&) = delete;
125 template<> inline OStoreLockBytes*
126 SAL_CALL query (OStoreObject *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*)
128 if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
130 // Handle is kind of OStoreLockBytes.
131 return static_cast<OStoreLockBytes*>(pHandle);
133 return nullptr;
136 } // namespace store
138 #endif // INCLUDED_STORE_SOURCE_STORLCKB_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */