1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: lockbyte.hxx,v $
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,
34 ************************************************************************/
36 #ifndef _STORE_LOCKBYTE_HXX_
37 #define _STORE_LOCKBYTE_HXX_ "$Revision: 1.1.2.1 $"
40 #include "sal/types.h"
44 #include "rtl/ref.hxx"
46 #ifndef _RTL_USTRING_H_
47 #include "rtl/ustring.h"
50 #ifndef _STORE_TYPES_H_
51 #include "store/types.h"
53 #ifndef _STORE_STORBASE_HXX_
54 #include "storbase.hxx"
60 /*========================================================================
62 * ILockBytes interface.
64 *======================================================================*/
65 class ILockBytes
: public rtl::IReference
69 @param rxAllocator [out]
72 storeError
initialize (
73 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
74 sal_uInt16 nPageSize
);
80 storeError
readPageAt (
88 storeError
writePageAt (
89 PageHolder
const & rPage
,
96 @return store_E_None upon success
107 @return store_E_None upon success
116 @return store_E_None upon success
118 storeError
getSize (sal_uInt32
& rnSize
);
122 @return store_E_None upon success
124 storeError
setSize (sal_uInt32 nSize
);
127 @return store_E_None upon success
134 @return store_E_None upon success
135 store_E_LockingViolation
137 storeError
lockRange (
144 @return store_E_None upon success
145 store_E_LockingViolation
147 storeError
unlockRange (
152 /** Implementation (abstract).
154 virtual storeError
initialize_Impl (
155 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
156 sal_uInt16 nPageSize
) = 0;
158 virtual storeError
readPageAt_Impl (
160 sal_uInt32 nOffset
) = 0;
162 virtual storeError
writePageAt_Impl (
163 PageHolder
const & rPage
,
164 sal_uInt32 nOffset
) = 0;
166 virtual storeError
readAt_Impl (
169 sal_uInt32 nBytes
) = 0;
171 virtual storeError
writeAt_Impl (
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 (
187 sal_uInt32 nBytes
) = 0;
189 virtual storeError
unlockRange_Impl (
191 sal_uInt32 nBytes
) = 0;
192 #endif /* STORE_FEATURE_LOCKING */
195 /*========================================================================
197 * ILockBytes factories.
199 *======================================================================*/
202 FileLockBytes_createInstance (
203 rtl::Reference
< store::ILockBytes
> & rxLockBytes
,
204 rtl_uString
* pFilename
,
205 storeAccessMode eAccessMode
209 MemoryLockBytes_createInstance (
210 rtl::Reference
< store::ILockBytes
> & rxLockBytes
213 /*========================================================================
217 *======================================================================*/
221 #endif /* !_STORE_LOCKBYTE_HXX_ */