update dev300-m58
[ooovba.git] / store / source / lockbyte.hxx
blob20a8b0b77073659598d70f46954c75bb92038ecb
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: lockbyte.hxx,v $
7 * $Revision: 1.1.2.1 $
9 * last change: $Author: mhu $ $Date: 2008/09/18 16:10:50 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 #ifndef _STORE_LOCKBYTE_HXX_
37 #define _STORE_LOCKBYTE_HXX_ "$Revision: 1.1.2.1 $"
39 #ifndef _SAL_TYPES_H_
40 #include "sal/types.h"
41 #endif
43 #ifndef _RTL_REF_HXX_
44 #include "rtl/ref.hxx"
45 #endif
46 #ifndef _RTL_USTRING_H_
47 #include "rtl/ustring.h"
48 #endif
50 #ifndef _STORE_TYPES_H_
51 #include "store/types.h"
52 #endif
53 #ifndef _STORE_STORBASE_HXX_
54 #include "storbase.hxx"
55 #endif
57 namespace store
60 /*========================================================================
62 * ILockBytes interface.
64 *======================================================================*/
65 class ILockBytes : public rtl::IReference
67 public:
68 /**
69 @param rxAllocator [out]
70 @param nPageSize [in]
72 storeError initialize (
73 rtl::Reference< PageData::Allocator > & rxAllocator,
74 sal_uInt16 nPageSize);
76 /**
77 @param rPage [out]
78 @param nOffset [in]
80 storeError readPageAt (
81 PageHolder & rPage,
82 sal_uInt32 nOffset);
84 /**
85 @param rPage [in]
86 @param nOffset [in]
88 storeError writePageAt (
89 PageHolder const & rPage,
90 sal_uInt32 nOffset);
92 /**
93 @param nOffset [in]
94 @param pBuffer [out]
95 @param nBytes [in]
96 @return store_E_None upon success
98 storeError readAt (
99 sal_uInt32 nOffset,
100 void *pBuffer,
101 sal_uInt32 nBytes);
104 @param nOffset [in]
105 @param pBuffer [in]
106 @param nBytes [in]
107 @return store_E_None upon success
109 storeError writeAt (
110 sal_uInt32 nOffset,
111 const void *pBuffer,
112 sal_uInt32 nBytes);
115 @param rnSize [out]
116 @return store_E_None upon success
118 storeError getSize (sal_uInt32 & rnSize);
121 @param nSize [in]
122 @return store_E_None upon success
124 storeError setSize (sal_uInt32 nSize);
127 @return store_E_None upon success
129 storeError flush();
132 @param nOffset [in]
133 @param nBytes [in]
134 @return store_E_None upon success
135 store_E_LockingViolation
137 storeError lockRange (
138 sal_uInt32 nOffset,
139 sal_uInt32 nBytes);
142 @param nOffset [in]
143 @param nBytes [in]
144 @return store_E_None upon success
145 store_E_LockingViolation
147 storeError unlockRange (
148 sal_uInt32 nOffset,
149 sal_uInt32 nBytes);
151 private:
152 /** Implementation (abstract).
154 virtual storeError initialize_Impl (
155 rtl::Reference< PageData::Allocator > & rxAllocator,
156 sal_uInt16 nPageSize) = 0;
158 virtual storeError readPageAt_Impl (
159 PageHolder & rPage,
160 sal_uInt32 nOffset) = 0;
162 virtual storeError writePageAt_Impl (
163 PageHolder const & rPage,
164 sal_uInt32 nOffset) = 0;
166 virtual storeError readAt_Impl (
167 sal_uInt32 nOffset,
168 void *pBuffer,
169 sal_uInt32 nBytes) = 0;
171 virtual storeError writeAt_Impl (
172 sal_uInt32 nOffset,
173 const void *pBuffer,
174 sal_uInt32 nBytes) = 0;
176 virtual storeError getSize_Impl (
177 sal_uInt32 & rnSize) = 0;
179 virtual storeError setSize_Impl (
180 sal_uInt32 nSize) = 0;
182 virtual storeError flush_Impl() = 0;
184 #ifdef STORE_FEATURE_LOCKING
185 virtual storeError lockRange_Impl (
186 sal_uInt32 nOffset,
187 sal_uInt32 nBytes) = 0;
189 virtual storeError unlockRange_Impl (
190 sal_uInt32 nOffset,
191 sal_uInt32 nBytes) = 0;
192 #endif /* STORE_FEATURE_LOCKING */
195 /*========================================================================
197 * ILockBytes factories.
199 *======================================================================*/
201 storeError
202 FileLockBytes_createInstance (
203 rtl::Reference< store::ILockBytes > & rxLockBytes,
204 rtl_uString * pFilename,
205 storeAccessMode eAccessMode
208 storeError
209 MemoryLockBytes_createInstance (
210 rtl::Reference< store::ILockBytes > & rxLockBytes
213 /*========================================================================
215 * The End.
217 *======================================================================*/
219 } // namespace store
221 #endif /* !_STORE_LOCKBYTE_HXX_ */