tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / store / source / lockbyte.hxx
blob41c6145f16745e6d0a52b826eb9761129cf1fc6f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <sal/config.h>
24 #include <memory>
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; }
36 namespace store
39 class ILockBytes : public virtual salhelper::SimpleReferenceObject
41 public:
42 /**
43 @param rxAllocator [out]
44 @param nPageSize [in]
46 storeError initialize (
47 rtl::Reference< PageData::Allocator > & rxAllocator,
48 sal_uInt16 nPageSize);
50 /**
51 @param rPage [out]
52 @param nOffset [in]
54 storeError readPageAt (
55 std::shared_ptr<PageData> & rPage,
56 sal_uInt32 nOffset);
58 /**
59 @param rPage [in]
60 @param nOffset [in]
62 storeError writePageAt (
63 std::shared_ptr<PageData> const & rPage,
64 sal_uInt32 nOffset);
66 /**
67 @param nOffset [in]
68 @param pBuffer [out]
69 @param nBytes [in]
70 @return store_E_None upon success
72 storeError readAt (
73 sal_uInt32 nOffset,
74 void *pBuffer,
75 sal_uInt32 nBytes);
77 /**
78 @param nOffset [in]
79 @param pBuffer [in]
80 @param nBytes [in]
81 @return store_E_None upon success
83 storeError writeAt (
84 sal_uInt32 nOffset,
85 const void *pBuffer,
86 sal_uInt32 nBytes);
88 /**
89 @param rnSize [out]
90 @return store_E_None upon success
92 storeError getSize (sal_uInt32 & rnSize);
94 /**
95 @param nSize [in]
96 @return store_E_None upon success
98 storeError setSize (sal_uInt32 nSize);
101 @return store_E_None upon success
103 storeError flush();
105 protected:
106 virtual ~ILockBytes() override {}
108 private:
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 (
124 sal_uInt32 nOffset,
125 void *pBuffer,
126 sal_uInt32 nBytes) = 0;
128 virtual storeError writeAt_Impl (
129 sal_uInt32 nOffset,
130 const void *pBuffer,
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
152 } // namespace store
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */