xref: /aoo42x/main/store/source/stordir.hxx (revision 1a5fa39b)
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_STORDIR_HXX_
25cdf0e10cSrcweir #define _STORE_STORDIR_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _SAL_TYPES_H_
28cdf0e10cSrcweir #include <sal/types.h>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _RTL_TEXTCVT_H_
32cdf0e10cSrcweir #include <rtl/textcvt.h>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _RTL_STRING_H_
35cdf0e10cSrcweir #include <rtl/string.h>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #ifndef _RTL_REF_HXX_
38cdf0e10cSrcweir #include <rtl/ref.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #ifndef _STORE_OBJECT_HXX_
42cdf0e10cSrcweir #include "object.hxx"
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef _STORE_STORBASE_HXX_
45cdf0e10cSrcweir #include "storbase.hxx"
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #ifndef _STORE_STORPAGE_HXX_
48cdf0e10cSrcweir #include "storpage.hxx"
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace store
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 
54cdf0e10cSrcweir struct OStoreDirectoryPageData;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir /*========================================================================
57cdf0e10cSrcweir  *
58cdf0e10cSrcweir  * OStoreDirectory_Impl interface.
59cdf0e10cSrcweir  *
60cdf0e10cSrcweir  *======================================================================*/
61cdf0e10cSrcweir class OStoreDirectory_Impl : public store::OStoreObject
62cdf0e10cSrcweir {
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir 	/** Construction.
65cdf0e10cSrcweir 	 */
66cdf0e10cSrcweir 	OStoreDirectory_Impl (void);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	/** create (two-phase construction).
69cdf0e10cSrcweir 	 *  @param  pManager [in]
70cdf0e10cSrcweir 	 *  @param  pPath [in]
71cdf0e10cSrcweir 	 *  @param  pName [in]
72cdf0e10cSrcweir 	 *  @param  eAccessMode [in]
73cdf0e10cSrcweir 	 *  @return store_E_None upon success.
74cdf0e10cSrcweir 	 */
75cdf0e10cSrcweir 	storeError create (
76cdf0e10cSrcweir 		OStorePageManager *pManager,
77cdf0e10cSrcweir 		rtl_String        *pPath,
78cdf0e10cSrcweir 		rtl_String        *pName,
79cdf0e10cSrcweir 		storeAccessMode    eAccessMode);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	/** iterate.
82cdf0e10cSrcweir 	 *  @param  rFindData [out]
83cdf0e10cSrcweir 	 *  @return store_E_None        upon success,
84cdf0e10cSrcweir 	 *          store_E_NoMoreFiles upon end of iteration.
85cdf0e10cSrcweir 	 */
86cdf0e10cSrcweir 	storeError iterate (
87cdf0e10cSrcweir 		storeFindData &rFindData);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	/** IStoreHandle.
90cdf0e10cSrcweir 	 */
91cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nTypeId);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir protected:
94cdf0e10cSrcweir 	/** Destruction.
95cdf0e10cSrcweir 	 */
96cdf0e10cSrcweir 	virtual ~OStoreDirectory_Impl (void);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir private:
99cdf0e10cSrcweir 	/** IStoreHandle TypeId.
100cdf0e10cSrcweir 	 */
101cdf0e10cSrcweir 	static const sal_uInt32 m_nTypeId;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	/** IStoreHandle query() template function specialization.
104cdf0e10cSrcweir 	 */
105cdf0e10cSrcweir 	friend OStoreDirectory_Impl*
106cdf0e10cSrcweir 	SAL_CALL query<> (IStoreHandle *pHandle, OStoreDirectory_Impl*);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	/** Representation.
109cdf0e10cSrcweir 	 */
110cdf0e10cSrcweir 	typedef OStoreDirectoryPageData   inode;
111cdf0e10cSrcweir     typedef PageHolderObject< inode > inode_holder_type;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	rtl::Reference<OStorePageManager> m_xManager;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	OStorePageDescriptor       m_aDescr;
116cdf0e10cSrcweir 	sal_uInt32                 m_nPath;
117cdf0e10cSrcweir 	rtl_TextToUnicodeConverter m_hTextCvt;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	/** Not implemented.
120cdf0e10cSrcweir 	 */
121cdf0e10cSrcweir 	OStoreDirectory_Impl (const OStoreDirectory_Impl&);
122cdf0e10cSrcweir 	OStoreDirectory_Impl& operator= (const OStoreDirectory_Impl&);
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir template<> inline OStoreDirectory_Impl*
query(IStoreHandle * pHandle,OStoreDirectory_Impl *)126cdf0e10cSrcweir SAL_CALL query (IStoreHandle *pHandle, OStoreDirectory_Impl*)
127cdf0e10cSrcweir {
128cdf0e10cSrcweir 	if (pHandle && pHandle->isKindOf (OStoreDirectory_Impl::m_nTypeId))
129cdf0e10cSrcweir 	{
130cdf0e10cSrcweir 		// Handle is kind of OStoreDirectory_Impl.
131cdf0e10cSrcweir 		return static_cast<OStoreDirectory_Impl*>(pHandle);
132cdf0e10cSrcweir 	}
133cdf0e10cSrcweir 	return 0;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir /*========================================================================
137cdf0e10cSrcweir  *
138cdf0e10cSrcweir  * The End.
139cdf0e10cSrcweir  *
140cdf0e10cSrcweir  *======================================================================*/
141cdf0e10cSrcweir 
142cdf0e10cSrcweir } // namespace store
143cdf0e10cSrcweir 
144cdf0e10cSrcweir #endif /* !_STORE_STORDIR_HXX_ */
145cdf0e10cSrcweir 
146