xref: /AOO41X/main/store/source/stordir.hxx (revision 1a5fa39be4c30003d60dac254349a6f82563f140)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _STORE_STORDIR_HXX_
25 #define _STORE_STORDIR_HXX_
26 
27 #ifndef _SAL_TYPES_H_
28 #include <sal/types.h>
29 #endif
30 
31 #ifndef _RTL_TEXTCVT_H_
32 #include <rtl/textcvt.h>
33 #endif
34 #ifndef _RTL_STRING_H_
35 #include <rtl/string.h>
36 #endif
37 #ifndef _RTL_REF_HXX_
38 #include <rtl/ref.hxx>
39 #endif
40 
41 #ifndef _STORE_OBJECT_HXX_
42 #include "object.hxx"
43 #endif
44 #ifndef _STORE_STORBASE_HXX_
45 #include "storbase.hxx"
46 #endif
47 #ifndef _STORE_STORPAGE_HXX_
48 #include "storpage.hxx"
49 #endif
50 
51 namespace store
52 {
53 
54 struct OStoreDirectoryPageData;
55 
56 /*========================================================================
57  *
58  * OStoreDirectory_Impl interface.
59  *
60  *======================================================================*/
61 class OStoreDirectory_Impl : public store::OStoreObject
62 {
63 public:
64     /** Construction.
65      */
66     OStoreDirectory_Impl (void);
67 
68     /** create (two-phase construction).
69      *  @param  pManager [in]
70      *  @param  pPath [in]
71      *  @param  pName [in]
72      *  @param  eAccessMode [in]
73      *  @return store_E_None upon success.
74      */
75     storeError create (
76         OStorePageManager *pManager,
77         rtl_String        *pPath,
78         rtl_String        *pName,
79         storeAccessMode    eAccessMode);
80 
81     /** iterate.
82      *  @param  rFindData [out]
83      *  @return store_E_None        upon success,
84      *          store_E_NoMoreFiles upon end of iteration.
85      */
86     storeError iterate (
87         storeFindData &rFindData);
88 
89     /** IStoreHandle.
90      */
91     virtual sal_Bool SAL_CALL isKindOf (sal_uInt32 nTypeId);
92 
93 protected:
94     /** Destruction.
95      */
96     virtual ~OStoreDirectory_Impl (void);
97 
98 private:
99     /** IStoreHandle TypeId.
100      */
101     static const sal_uInt32 m_nTypeId;
102 
103     /** IStoreHandle query() template function specialization.
104      */
105     friend OStoreDirectory_Impl*
106     SAL_CALL query<> (IStoreHandle *pHandle, OStoreDirectory_Impl*);
107 
108     /** Representation.
109      */
110     typedef OStoreDirectoryPageData   inode;
111     typedef PageHolderObject< inode > inode_holder_type;
112 
113     rtl::Reference<OStorePageManager> m_xManager;
114 
115     OStorePageDescriptor       m_aDescr;
116     sal_uInt32                 m_nPath;
117     rtl_TextToUnicodeConverter m_hTextCvt;
118 
119     /** Not implemented.
120      */
121     OStoreDirectory_Impl (const OStoreDirectory_Impl&);
122     OStoreDirectory_Impl& operator= (const OStoreDirectory_Impl&);
123 };
124 
125 template<> inline OStoreDirectory_Impl*
query(IStoreHandle * pHandle,OStoreDirectory_Impl *)126 SAL_CALL query (IStoreHandle *pHandle, OStoreDirectory_Impl*)
127 {
128     if (pHandle && pHandle->isKindOf (OStoreDirectory_Impl::m_nTypeId))
129     {
130         // Handle is kind of OStoreDirectory_Impl.
131         return static_cast<OStoreDirectory_Impl*>(pHandle);
132     }
133     return 0;
134 }
135 
136 /*========================================================================
137  *
138  * The End.
139  *
140  *======================================================================*/
141 
142 } // namespace store
143 
144 #endif /* !_STORE_STORDIR_HXX_ */
145 
146