1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
34 /*========================================================================
36 * ILockBytes interface.
38 *======================================================================*/
39 class ILockBytes
: public rtl::IReference
43 @param rxAllocator [out]
46 storeError
initialize (
47 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
48 sal_uInt16 nPageSize
);
54 storeError
readPageAt (
62 storeError
writePageAt (
63 PageHolder
const & rPage
,
70 @return store_E_None upon success
81 @return store_E_None upon success
90 @return store_E_None upon success
92 storeError
getSize (sal_uInt32
& rnSize
);
96 @return store_E_None upon success
98 storeError
setSize (sal_uInt32 nSize
);
101 @return store_E_None upon success
109 /** Implementation (abstract).
111 virtual storeError
initialize_Impl (
112 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
113 sal_uInt16 nPageSize
) = 0;
115 virtual storeError
readPageAt_Impl (
117 sal_uInt32 nOffset
) = 0;
119 virtual storeError
writePageAt_Impl (
120 PageHolder
const & rPage
,
121 sal_uInt32 nOffset
) = 0;
123 virtual storeError
readAt_Impl (
126 sal_uInt32 nBytes
) = 0;
128 virtual storeError
writeAt_Impl (
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 *======================================================================*/
149 FileLockBytes_createInstance (
150 rtl::Reference
< store::ILockBytes
> & rxLockBytes
,
151 rtl_uString
* pFilename
,
152 storeAccessMode eAccessMode
156 MemoryLockBytes_createInstance (
157 rtl::Reference
< store::ILockBytes
> & rxLockBytes
160 /*========================================================================
164 *======================================================================*/
168 #endif /* !_STORE_LOCKBYTE_HXX_ */
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */