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 .
22 #include <sal/config.h>
26 #include <sal/types.h>
28 #include <rtl/ustring.h>
29 #include <salhelper/simplereferenceobject.hxx>
31 #include <store/types.h>
32 #include "storbase.hxx"
34 namespace rtl
{ template <class reference_type
> class Reference
; }
39 class ILockBytes
: public virtual salhelper::SimpleReferenceObject
43 @param rxAllocator [out]
46 storeError
initialize (
47 rtl::Reference
< PageData::Allocator
> & rxAllocator
,
48 sal_uInt16 nPageSize
);
54 storeError
readPageAt (
55 std::shared_ptr
<PageData
> & rPage
,
62 storeError
writePageAt (
63 std::shared_ptr
<PageData
> 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
106 virtual ~ILockBytes() override
{}
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 std::shared_ptr
<PageData
> & rPage
,
117 sal_uInt32 nOffset
) = 0;
119 virtual storeError
writePageAt_Impl (
120 std::shared_ptr
<PageData
> 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 storeError
FileLockBytes_createInstance (
143 rtl::Reference
< store::ILockBytes
> & rxLockBytes
,
144 rtl_uString
* pFilename
,
145 storeAccessMode eAccessMode
148 storeError
MemoryLockBytes_createInstance (
149 rtl::Reference
< store::ILockBytes
> & rxLockBytes
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */