bump product version to 4.1.6.2
[LibreOffice.git] / store / source / lockbyte.hxx
blobd0e18557704a6eb10e99c2df5c8fecdd052dd33a
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 _STORE_LOCKBYTE_HXX_
21 #define _STORE_LOCKBYTE_HXX_
23 #include "sal/types.h"
25 #include "rtl/ref.hxx"
26 #include "rtl/ustring.h"
28 #include "store/types.h"
29 #include "storbase.hxx"
31 namespace store
34 /*========================================================================
36 * ILockBytes interface.
38 *======================================================================*/
39 class ILockBytes : public rtl::IReference
41 public:
42 /**
43 @param rxAllocator [out]
44 @param nPageSize [in]
46 storeError initialize (
47 rtl::Reference< PageData::Allocator > & rxAllocator,
48 sal_uInt16 nPageSize);
50 /**
51 @param rPage [out]
52 @param nOffset [in]
54 storeError readPageAt (
55 PageHolder & rPage,
56 sal_uInt32 nOffset);
58 /**
59 @param rPage [in]
60 @param nOffset [in]
62 storeError writePageAt (
63 PageHolder const & rPage,
64 sal_uInt32 nOffset);
66 /**
67 @param nOffset [in]
68 @param pBuffer [out]
69 @param nBytes [in]
70 @return store_E_None upon success
72 storeError readAt (
73 sal_uInt32 nOffset,
74 void *pBuffer,
75 sal_uInt32 nBytes);
77 /**
78 @param nOffset [in]
79 @param pBuffer [in]
80 @param nBytes [in]
81 @return store_E_None upon success
83 storeError writeAt (
84 sal_uInt32 nOffset,
85 const void *pBuffer,
86 sal_uInt32 nBytes);
88 /**
89 @param rnSize [out]
90 @return store_E_None upon success
92 storeError getSize (sal_uInt32 & rnSize);
94 /**
95 @param nSize [in]
96 @return store_E_None upon success
98 storeError setSize (sal_uInt32 nSize);
101 @return store_E_None upon success
103 storeError flush();
105 protected:
106 ~ILockBytes() {}
108 private:
109 /** Implementation (abstract).
111 virtual storeError initialize_Impl (
112 rtl::Reference< PageData::Allocator > & rxAllocator,
113 sal_uInt16 nPageSize) = 0;
115 virtual storeError readPageAt_Impl (
116 PageHolder & rPage,
117 sal_uInt32 nOffset) = 0;
119 virtual storeError writePageAt_Impl (
120 PageHolder const & rPage,
121 sal_uInt32 nOffset) = 0;
123 virtual storeError readAt_Impl (
124 sal_uInt32 nOffset,
125 void *pBuffer,
126 sal_uInt32 nBytes) = 0;
128 virtual storeError writeAt_Impl (
129 sal_uInt32 nOffset,
130 const void *pBuffer,
131 sal_uInt32 nBytes) = 0;
133 virtual storeError getSize_Impl (
134 sal_uInt32 & rnSize) = 0;
136 virtual storeError setSize_Impl (
137 sal_uInt32 nSize) = 0;
139 virtual storeError flush_Impl() = 0;
142 /*========================================================================
144 * ILockBytes factories.
146 *======================================================================*/
148 storeError
149 FileLockBytes_createInstance (
150 rtl::Reference< store::ILockBytes > & rxLockBytes,
151 rtl_uString * pFilename,
152 storeAccessMode eAccessMode
155 storeError
156 MemoryLockBytes_createInstance (
157 rtl::Reference< store::ILockBytes > & rxLockBytes
160 /*========================================================================
162 * The End.
164 *======================================================================*/
166 } // namespace store
168 #endif /* !_STORE_LOCKBYTE_HXX_ */
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */