nss: upgrade to release 3.73
[LibreOffice.git] / store / source / lockbyte.hxx
blob04634328a922f0f61202b27b25f1f69265210f6a
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_LOCKBYTE_HXX
21 #define INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
23 #include <sal/config.h>
25 #include <memory>
27 #include <sal/types.h>
29 #include <rtl/ustring.h>
30 #include <salhelper/simplereferenceobject.hxx>
32 #include <store/types.h>
33 #include "storbase.hxx"
35 namespace rtl { template <class reference_type> class Reference; }
37 namespace store
40 class ILockBytes : public virtual salhelper::SimpleReferenceObject
42 public:
43 /**
44 @param rxAllocator [out]
45 @param nPageSize [in]
47 storeError initialize (
48 rtl::Reference< PageData::Allocator > & rxAllocator,
49 sal_uInt16 nPageSize);
51 /**
52 @param rPage [out]
53 @param nOffset [in]
55 storeError readPageAt (
56 std::shared_ptr<PageData> & rPage,
57 sal_uInt32 nOffset);
59 /**
60 @param rPage [in]
61 @param nOffset [in]
63 storeError writePageAt (
64 std::shared_ptr<PageData> const & rPage,
65 sal_uInt32 nOffset);
67 /**
68 @param nOffset [in]
69 @param pBuffer [out]
70 @param nBytes [in]
71 @return store_E_None upon success
73 storeError readAt (
74 sal_uInt32 nOffset,
75 void *pBuffer,
76 sal_uInt32 nBytes);
78 /**
79 @param nOffset [in]
80 @param pBuffer [in]
81 @param nBytes [in]
82 @return store_E_None upon success
84 storeError writeAt (
85 sal_uInt32 nOffset,
86 const void *pBuffer,
87 sal_uInt32 nBytes);
89 /**
90 @param rnSize [out]
91 @return store_E_None upon success
93 storeError getSize (sal_uInt32 & rnSize);
95 /**
96 @param nSize [in]
97 @return store_E_None upon success
99 storeError setSize (sal_uInt32 nSize);
102 @return store_E_None upon success
104 storeError flush();
106 protected:
107 virtual ~ILockBytes() override {}
109 private:
110 /** Implementation (abstract).
112 virtual storeError initialize_Impl (
113 rtl::Reference< PageData::Allocator > & rxAllocator,
114 sal_uInt16 nPageSize) = 0;
116 virtual storeError readPageAt_Impl (
117 std::shared_ptr<PageData> & rPage,
118 sal_uInt32 nOffset) = 0;
120 virtual storeError writePageAt_Impl (
121 std::shared_ptr<PageData> const & rPage,
122 sal_uInt32 nOffset) = 0;
124 virtual storeError readAt_Impl (
125 sal_uInt32 nOffset,
126 void *pBuffer,
127 sal_uInt32 nBytes) = 0;
129 virtual storeError writeAt_Impl (
130 sal_uInt32 nOffset,
131 const void *pBuffer,
132 sal_uInt32 nBytes) = 0;
134 virtual storeError getSize_Impl (
135 sal_uInt32 & rnSize) = 0;
137 virtual storeError setSize_Impl (
138 sal_uInt32 nSize) = 0;
140 virtual storeError flush_Impl() = 0;
143 storeError FileLockBytes_createInstance (
144 rtl::Reference< store::ILockBytes > & rxLockBytes,
145 rtl_uString * pFilename,
146 storeAccessMode eAccessMode
149 storeError MemoryLockBytes_createInstance (
150 rtl::Reference< store::ILockBytes > & rxLockBytes
153 } // namespace store
155 #endif // INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */