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 INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
21 #define INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
23 #include <sal/config.h>
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
; }
40 class ILockBytes
: public virtual salhelper::SimpleReferenceObject
44 @param rxAllocator [out]
47 storeError
initialize (
48 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
49 sal_uInt16 nPageSize
);
55 storeError
readPageAt (
56 std::shared_ptr
<PageData
> & rPage
,
63 storeError
writePageAt (
64 std::shared_ptr
<PageData
> const & rPage
,
71 @return store_E_None upon success
82 @return store_E_None upon success
91 @return store_E_None upon success
93 storeError
getSize (sal_uInt32
& rnSize
);
97 @return store_E_None upon success
99 storeError
setSize (sal_uInt32 nSize
);
102 @return store_E_None upon success
107 virtual ~ILockBytes() override
{}
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 (
127 sal_uInt32 nBytes
) = 0;
129 virtual storeError
writeAt_Impl (
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
155 #endif // INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */