xref: /aoo41x/main/store/source/stordir.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _STORE_STORDIR_HXX_
29 #define _STORE_STORDIR_HXX_
30 
31 #ifndef _SAL_TYPES_H_
32 #include <sal/types.h>
33 #endif
34 
35 #ifndef _RTL_TEXTCVT_H_
36 #include <rtl/textcvt.h>
37 #endif
38 #ifndef _RTL_STRING_H_
39 #include <rtl/string.h>
40 #endif
41 #ifndef _RTL_REF_HXX_
42 #include <rtl/ref.hxx>
43 #endif
44 
45 #ifndef _STORE_OBJECT_HXX_
46 #include "object.hxx"
47 #endif
48 #ifndef _STORE_STORBASE_HXX_
49 #include "storbase.hxx"
50 #endif
51 #ifndef _STORE_STORPAGE_HXX_
52 #include "storpage.hxx"
53 #endif
54 
55 namespace store
56 {
57 
58 struct OStoreDirectoryPageData;
59 
60 /*========================================================================
61  *
62  * OStoreDirectory_Impl interface.
63  *
64  *======================================================================*/
65 class OStoreDirectory_Impl : public store::OStoreObject
66 {
67 public:
68 	/** Construction.
69 	 */
70 	OStoreDirectory_Impl (void);
71 
72 	/** create (two-phase construction).
73 	 *  @param  pManager [in]
74 	 *  @param  pPath [in]
75 	 *  @param  pName [in]
76 	 *  @param  eAccessMode [in]
77 	 *  @return store_E_None upon success.
78 	 */
79 	storeError create (
80 		OStorePageManager *pManager,
81 		rtl_String        *pPath,
82 		rtl_String        *pName,
83 		storeAccessMode    eAccessMode);
84 
85 	/** iterate.
86 	 *  @param  rFindData [out]
87 	 *  @return store_E_None        upon success,
88 	 *          store_E_NoMoreFiles upon end of iteration.
89 	 */
90 	storeError iterate (
91 		storeFindData &rFindData);
92 
93 	/** IStoreHandle.
94 	 */
95 	virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nTypeId);
96 
97 protected:
98 	/** Destruction.
99 	 */
100 	virtual ~OStoreDirectory_Impl (void);
101 
102 private:
103 	/** IStoreHandle TypeId.
104 	 */
105 	static const sal_uInt32 m_nTypeId;
106 
107 	/** IStoreHandle query() template function specialization.
108 	 */
109 	friend OStoreDirectory_Impl*
110 	SAL_CALL query<> (IStoreHandle *pHandle, OStoreDirectory_Impl*);
111 
112 	/** Representation.
113 	 */
114 	typedef OStoreDirectoryPageData   inode;
115     typedef PageHolderObject< inode > inode_holder_type;
116 
117 	rtl::Reference<OStorePageManager> m_xManager;
118 
119 	OStorePageDescriptor       m_aDescr;
120 	sal_uInt32                 m_nPath;
121 	rtl_TextToUnicodeConverter m_hTextCvt;
122 
123 	/** Not implemented.
124 	 */
125 	OStoreDirectory_Impl (const OStoreDirectory_Impl&);
126 	OStoreDirectory_Impl& operator= (const OStoreDirectory_Impl&);
127 };
128 
129 template<> inline OStoreDirectory_Impl*
130 SAL_CALL query (IStoreHandle *pHandle, OStoreDirectory_Impl*)
131 {
132 	if (pHandle && pHandle->isKindOf (OStoreDirectory_Impl::m_nTypeId))
133 	{
134 		// Handle is kind of OStoreDirectory_Impl.
135 		return static_cast<OStoreDirectory_Impl*>(pHandle);
136 	}
137 	return 0;
138 }
139 
140 /*========================================================================
141  *
142  * The End.
143  *
144  *======================================================================*/
145 
146 } // namespace store
147 
148 #endif /* !_STORE_STORDIR_HXX_ */
149 
150