Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / store / source / storlckb.hxx
blob10013af71e835b2ea4e50a2441f7143d8a7840a5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _STORE_STORLCKB_HXX_
30 #define _STORE_STORLCKB_HXX_
32 #include "sal/types.h"
34 #include "rtl/ustring.h"
35 #include "rtl/ref.hxx"
37 #include "object.hxx"
38 #include "storbase.hxx"
39 #include "storpage.hxx"
41 namespace store
44 struct OStoreDataPageData;
45 struct OStoreDirectoryPageData;
47 /*========================================================================
49 * OStoreLockBytes interface.
51 *======================================================================*/
52 class OStoreLockBytes : public store::OStoreObject
54 public:
55 /** Construction.
57 OStoreLockBytes (void);
59 /** create (two-phase construction).
60 * @param pManager [in]
61 * @param pPath [in]
62 * @param pName [in]
63 * @param eMode [in]
64 * @return store_E_None upon success
66 storeError create (
67 OStorePageManager *pManager,
68 rtl_String *pPath,
69 rtl_String *pName,
70 storeAccessMode eAccessMode);
72 /** Read at Offset into Buffer.
73 * @param nOffset [in]
74 * @param pBuffer [out]
75 * @param nBytes [in]
76 * @param rnDone [out]
77 * @return store_E_None upon success
79 storeError readAt (
80 sal_uInt32 nOffset,
81 void *pBuffer,
82 sal_uInt32 nBytes,
83 sal_uInt32 &rnDone);
85 /** Write at Offset from Buffer.
86 * @param nOffset [in]
87 * @param pBuffer [in]
88 * @param nBytes [in]
89 * @param rnDone [out]
90 * @return store_E_None upon success
92 storeError writeAt (
93 sal_uInt32 nOffset,
94 const void *pBuffer,
95 sal_uInt32 nBytes,
96 sal_uInt32 &rnDone);
98 /** flush.
99 * @return store_E_None upon success
101 storeError flush (void);
103 /** setSize.
104 * @param nSize [in]
105 * @return store_E_None upon success
107 storeError setSize (sal_uInt32 nSize);
109 /** stat.
110 * @paran rnSize [out]
111 * @return store_E_None upon success
113 storeError stat (sal_uInt32 &rnSize);
115 /** IStoreHandle.
117 virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nMagic);
119 protected:
120 /** Destruction (OReference).
122 virtual ~OStoreLockBytes (void);
124 private:
125 /** IStoreHandle TypeId.
127 static const sal_uInt32 m_nTypeId;
129 /** IStoreHandle query() template specialization.
131 friend OStoreLockBytes*
132 SAL_CALL query<> (IStoreHandle *pHandle, OStoreLockBytes*);
134 /** Representation.
136 rtl::Reference<OStorePageManager> m_xManager;
138 typedef OStoreDataPageData data;
139 typedef OStoreDirectoryPageData inode;
141 typedef PageHolderObject< inode > inode_holder_type;
142 inode_holder_type m_xNode;
144 bool m_bWriteable;
146 /** Not implemented.
148 OStoreLockBytes (const OStoreLockBytes&);
149 OStoreLockBytes& operator= (const OStoreLockBytes&);
152 template<> inline OStoreLockBytes*
153 SAL_CALL query (IStoreHandle *pHandle, SAL_UNUSED_PARAMETER OStoreLockBytes*)
155 if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
157 // Handle is kind of OStoreLockBytes.
158 return static_cast<OStoreLockBytes*>(pHandle);
160 return 0;
163 /*========================================================================
165 * The End.
167 *======================================================================*/
169 } // namespace store
171 #endif /* !_STORE_STORLCKB_HXX_ */
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */