tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / store / source / storlckb.hxx
blobd6712a897e600b4eb00ee8b2eceecad8635eb9d3
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/types.h>
24 #include <rtl/string.h>
25 #include <rtl/ref.hxx>
27 #include "object.hxx"
28 #include "storbase.hxx"
30 namespace store
33 class OStorePageManager;
34 struct OStoreDataPageData;
35 struct OStoreDirectoryPageData;
37 class OStoreLockBytes : public store::OStoreObject
39 public:
40 OStoreLockBytes();
42 /** create (two-phase construction).
43 * @param pManager [in]
44 * @param pPath [in]
45 * @param pName [in]
46 * @param eMode [in]
47 * @return store_E_None upon success
49 storeError create (
50 OStorePageManager *pManager,
51 rtl_String const *pPath,
52 rtl_String const *pName,
53 storeAccessMode eAccessMode);
55 /** Read at Offset into Buffer.
56 * @param nOffset [in]
57 * @param pBuffer [out]
58 * @param nBytes [in]
59 * @param rnDone [out]
60 * @return store_E_None upon success
62 storeError readAt (
63 sal_uInt32 nOffset,
64 void *pBuffer,
65 sal_uInt32 nBytes,
66 sal_uInt32 &rnDone);
68 /** Write at Offset from Buffer.
69 * @param nOffset [in]
70 * @param pBuffer [in]
71 * @param nBytes [in]
72 * @param rnDone [out]
73 * @return store_E_None upon success
75 storeError writeAt (
76 sal_uInt32 nOffset,
77 const void *pBuffer,
78 sal_uInt32 nBytes,
79 sal_uInt32 &rnDone);
81 /** setSize.
82 * @param nSize [in]
83 * @return store_E_None upon success
85 storeError setSize (sal_uInt32 nSize);
87 /** IStoreHandle.
89 virtual bool isKindOf (sal_uInt32 nMagic) override;
91 protected:
92 virtual ~OStoreLockBytes() override;
94 private:
95 /** IStoreHandle TypeId.
97 static const sal_uInt32 m_nTypeId;
99 /** IStoreHandle query() template specialization.
101 friend OStoreLockBytes*
102 SAL_CALL query<> (OStoreObject *pHandle, OStoreLockBytes*);
104 rtl::Reference<OStorePageManager> m_xManager;
106 typedef OStoreDataPageData data;
107 typedef OStoreDirectoryPageData inode;
109 typedef PageHolderObject< inode > inode_holder_type;
110 inode_holder_type m_xNode;
112 bool m_bWriteable;
114 OStoreLockBytes (const OStoreLockBytes&) = delete;
115 OStoreLockBytes& operator= (const OStoreLockBytes&) = delete;
118 template<> inline OStoreLockBytes*
119 SAL_CALL query (OStoreObject *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*)
121 if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
123 // Handle is kind of OStoreLockBytes.
124 return static_cast<OStoreLockBytes*>(pHandle);
126 return nullptr;
129 } // namespace store
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */