1*1a5fa39bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1a5fa39bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1a5fa39bSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1a5fa39bSAndrew Rist * distributed with this work for additional information
6*1a5fa39bSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1a5fa39bSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1a5fa39bSAndrew Rist * "License"); you may not use this file except in compliance
9*1a5fa39bSAndrew Rist * with the License. You may obtain a copy of the License at
10*1a5fa39bSAndrew Rist *
11*1a5fa39bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1a5fa39bSAndrew Rist *
13*1a5fa39bSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1a5fa39bSAndrew Rist * software distributed under the License is distributed on an
15*1a5fa39bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1a5fa39bSAndrew Rist * KIND, either express or implied. See the License for the
17*1a5fa39bSAndrew Rist * specific language governing permissions and limitations
18*1a5fa39bSAndrew Rist * under the License.
19*1a5fa39bSAndrew Rist *
20*1a5fa39bSAndrew Rist *************************************************************/
21*1a5fa39bSAndrew Rist
22*1a5fa39bSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef _STORE_STORLCKB_HXX_
25cdf0e10cSrcweir #define _STORE_STORLCKB_HXX_ "$Revision: 1.6.8.1 $"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "sal/types.h"
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "rtl/ustring.h"
30cdf0e10cSrcweir #include "rtl/ref.hxx"
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include "object.hxx"
33cdf0e10cSrcweir #include "storbase.hxx"
34cdf0e10cSrcweir #include "storpage.hxx"
35cdf0e10cSrcweir
36cdf0e10cSrcweir namespace store
37cdf0e10cSrcweir {
38cdf0e10cSrcweir
39cdf0e10cSrcweir struct OStoreDataPageData;
40cdf0e10cSrcweir struct OStoreDirectoryPageData;
41cdf0e10cSrcweir
42cdf0e10cSrcweir /*========================================================================
43cdf0e10cSrcweir *
44cdf0e10cSrcweir * OStoreLockBytes interface.
45cdf0e10cSrcweir *
46cdf0e10cSrcweir *======================================================================*/
47cdf0e10cSrcweir class OStoreLockBytes : public store::OStoreObject
48cdf0e10cSrcweir {
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir /** Construction.
51cdf0e10cSrcweir */
52cdf0e10cSrcweir OStoreLockBytes (void);
53cdf0e10cSrcweir
54cdf0e10cSrcweir /** create (two-phase construction).
55cdf0e10cSrcweir * @param pManager [in]
56cdf0e10cSrcweir * @param pPath [in]
57cdf0e10cSrcweir * @param pName [in]
58cdf0e10cSrcweir * @param eMode [in]
59cdf0e10cSrcweir * @return store_E_None upon success
60cdf0e10cSrcweir */
61cdf0e10cSrcweir storeError create (
62cdf0e10cSrcweir OStorePageManager *pManager,
63cdf0e10cSrcweir rtl_String *pPath,
64cdf0e10cSrcweir rtl_String *pName,
65cdf0e10cSrcweir storeAccessMode eAccessMode);
66cdf0e10cSrcweir
67cdf0e10cSrcweir /** Read at Offset into Buffer.
68cdf0e10cSrcweir * @param nOffset [in]
69cdf0e10cSrcweir * @param pBuffer [out]
70cdf0e10cSrcweir * @param nBytes [in]
71cdf0e10cSrcweir * @param rnDone [out]
72cdf0e10cSrcweir * @return store_E_None upon success
73cdf0e10cSrcweir */
74cdf0e10cSrcweir storeError readAt (
75cdf0e10cSrcweir sal_uInt32 nOffset,
76cdf0e10cSrcweir void *pBuffer,
77cdf0e10cSrcweir sal_uInt32 nBytes,
78cdf0e10cSrcweir sal_uInt32 &rnDone);
79cdf0e10cSrcweir
80cdf0e10cSrcweir /** Write at Offset from Buffer.
81cdf0e10cSrcweir * @param nOffset [in]
82cdf0e10cSrcweir * @param pBuffer [in]
83cdf0e10cSrcweir * @param nBytes [in]
84cdf0e10cSrcweir * @param rnDone [out]
85cdf0e10cSrcweir * @return store_E_None upon success
86cdf0e10cSrcweir */
87cdf0e10cSrcweir storeError writeAt (
88cdf0e10cSrcweir sal_uInt32 nOffset,
89cdf0e10cSrcweir const void *pBuffer,
90cdf0e10cSrcweir sal_uInt32 nBytes,
91cdf0e10cSrcweir sal_uInt32 &rnDone);
92cdf0e10cSrcweir
93cdf0e10cSrcweir /** flush.
94cdf0e10cSrcweir * @return store_E_None upon success
95cdf0e10cSrcweir */
96cdf0e10cSrcweir storeError flush (void);
97cdf0e10cSrcweir
98cdf0e10cSrcweir /** setSize.
99cdf0e10cSrcweir * @param nSize [in]
100cdf0e10cSrcweir * @return store_E_None upon success
101cdf0e10cSrcweir */
102cdf0e10cSrcweir storeError setSize (sal_uInt32 nSize);
103cdf0e10cSrcweir
104cdf0e10cSrcweir /** stat.
105cdf0e10cSrcweir * @paran rnSize [out]
106cdf0e10cSrcweir * @return store_E_None upon success
107cdf0e10cSrcweir */
108cdf0e10cSrcweir storeError stat (sal_uInt32 &rnSize);
109cdf0e10cSrcweir
110cdf0e10cSrcweir /** IStoreHandle.
111cdf0e10cSrcweir */
112cdf0e10cSrcweir virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nMagic);
113cdf0e10cSrcweir
114cdf0e10cSrcweir protected:
115cdf0e10cSrcweir /** Destruction (OReference).
116cdf0e10cSrcweir */
117cdf0e10cSrcweir virtual ~OStoreLockBytes (void);
118cdf0e10cSrcweir
119cdf0e10cSrcweir private:
120cdf0e10cSrcweir /** IStoreHandle TypeId.
121cdf0e10cSrcweir */
122cdf0e10cSrcweir static const sal_uInt32 m_nTypeId;
123cdf0e10cSrcweir
124cdf0e10cSrcweir /** IStoreHandle query() template specialization.
125cdf0e10cSrcweir */
126cdf0e10cSrcweir friend OStoreLockBytes*
127cdf0e10cSrcweir SAL_CALL query<> (IStoreHandle *pHandle, OStoreLockBytes*);
128cdf0e10cSrcweir
129cdf0e10cSrcweir /** Representation.
130cdf0e10cSrcweir */
131cdf0e10cSrcweir rtl::Reference<OStorePageManager> m_xManager;
132cdf0e10cSrcweir
133cdf0e10cSrcweir typedef OStoreDataPageData data;
134cdf0e10cSrcweir typedef OStoreDirectoryPageData inode;
135cdf0e10cSrcweir
136cdf0e10cSrcweir typedef PageHolderObject< inode > inode_holder_type;
137cdf0e10cSrcweir inode_holder_type m_xNode;
138cdf0e10cSrcweir
139cdf0e10cSrcweir bool m_bWriteable;
140cdf0e10cSrcweir
141cdf0e10cSrcweir /** Not implemented.
142cdf0e10cSrcweir */
143cdf0e10cSrcweir OStoreLockBytes (const OStoreLockBytes&);
144cdf0e10cSrcweir OStoreLockBytes& operator= (const OStoreLockBytes&);
145cdf0e10cSrcweir };
146cdf0e10cSrcweir
147cdf0e10cSrcweir template<> inline OStoreLockBytes*
query(IStoreHandle * pHandle,OStoreLockBytes *)148cdf0e10cSrcweir SAL_CALL query (IStoreHandle *pHandle, OStoreLockBytes*)
149cdf0e10cSrcweir {
150cdf0e10cSrcweir if (pHandle && pHandle->isKindOf (OStoreLockBytes::m_nTypeId))
151cdf0e10cSrcweir {
152cdf0e10cSrcweir // Handle is kind of OStoreLockBytes.
153cdf0e10cSrcweir return static_cast<OStoreLockBytes*>(pHandle);
154cdf0e10cSrcweir }
155cdf0e10cSrcweir return 0;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
158cdf0e10cSrcweir /*========================================================================
159cdf0e10cSrcweir *
160cdf0e10cSrcweir * The End.
161cdf0e10cSrcweir *
162cdf0e10cSrcweir *======================================================================*/
163cdf0e10cSrcweir
164cdf0e10cSrcweir } // namespace store
165cdf0e10cSrcweir
166cdf0e10cSrcweir #endif /* !_STORE_STORLCKB_HXX_ */
167cdf0e10cSrcweir
168