xref: /AOO41X/main/sal/inc/osl/file.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir /** @HTML */
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #ifndef _OSL_FILE_HXX_
31*cdf0e10cSrcweir #define _OSL_FILE_HXX_
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #ifdef __cplusplus
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <osl/time.h>
36*cdf0e10cSrcweir #	include <rtl/memory.h>
37*cdf0e10cSrcweir #	include <rtl/ustring.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <osl/file.h>
40*cdf0e10cSrcweir #	include <rtl/byteseq.hxx>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <stdio.h>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir namespace osl
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir // -----------------------------------------------------------------------------
49*cdf0e10cSrcweir /** Base class for all File System specific objects.
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir     @see Directory
52*cdf0e10cSrcweir     @see DirectoryItem
53*cdf0e10cSrcweir     @see File
54*cdf0e10cSrcweir  */
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir class FileBase
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir public:
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 	enum RC {
61*cdf0e10cSrcweir         E_None         = osl_File_E_None,
62*cdf0e10cSrcweir         E_PERM         = osl_File_E_PERM,
63*cdf0e10cSrcweir 		E_NOENT        = osl_File_E_NOENT,
64*cdf0e10cSrcweir 		E_SRCH         = osl_File_E_SRCH,
65*cdf0e10cSrcweir 		E_INTR         = osl_File_E_INTR,
66*cdf0e10cSrcweir 		E_IO           = osl_File_E_IO,
67*cdf0e10cSrcweir 		E_NXIO         = osl_File_E_NXIO,
68*cdf0e10cSrcweir 		E_2BIG         = osl_File_E_2BIG,
69*cdf0e10cSrcweir 		E_NOEXEC       = osl_File_E_NOEXEC,
70*cdf0e10cSrcweir 		E_BADF         = osl_File_E_BADF,
71*cdf0e10cSrcweir 		E_CHILD        = osl_File_E_CHILD,
72*cdf0e10cSrcweir 		E_AGAIN        = osl_File_E_AGAIN,
73*cdf0e10cSrcweir 		E_NOMEM        = osl_File_E_NOMEM,
74*cdf0e10cSrcweir 		E_ACCES        = osl_File_E_ACCES,
75*cdf0e10cSrcweir 		E_FAULT        = osl_File_E_FAULT,
76*cdf0e10cSrcweir 		E_BUSY         = osl_File_E_BUSY,
77*cdf0e10cSrcweir 		E_EXIST        = osl_File_E_EXIST,
78*cdf0e10cSrcweir 		E_XDEV         = osl_File_E_XDEV,
79*cdf0e10cSrcweir 		E_NODEV        = osl_File_E_NODEV,
80*cdf0e10cSrcweir 		E_NOTDIR       = osl_File_E_NOTDIR,
81*cdf0e10cSrcweir 		E_ISDIR        = osl_File_E_ISDIR,
82*cdf0e10cSrcweir 		E_INVAL        = osl_File_E_INVAL,
83*cdf0e10cSrcweir 		E_NFILE        = osl_File_E_NFILE,
84*cdf0e10cSrcweir 		E_MFILE        = osl_File_E_MFILE,
85*cdf0e10cSrcweir 		E_NOTTY        = osl_File_E_NOTTY,
86*cdf0e10cSrcweir 		E_FBIG         = osl_File_E_FBIG,
87*cdf0e10cSrcweir 		E_NOSPC        = osl_File_E_NOSPC,
88*cdf0e10cSrcweir 		E_SPIPE        = osl_File_E_SPIPE,
89*cdf0e10cSrcweir 		E_ROFS         = osl_File_E_ROFS,
90*cdf0e10cSrcweir 		E_MLINK        = osl_File_E_MLINK,
91*cdf0e10cSrcweir 		E_PIPE         = osl_File_E_PIPE,
92*cdf0e10cSrcweir 		E_DOM          = osl_File_E_DOM,
93*cdf0e10cSrcweir 		E_RANGE        = osl_File_E_RANGE,
94*cdf0e10cSrcweir 		E_DEADLK       = osl_File_E_DEADLK,
95*cdf0e10cSrcweir 		E_NAMETOOLONG  = osl_File_E_NAMETOOLONG,
96*cdf0e10cSrcweir 		E_NOLCK        = osl_File_E_NOLCK,
97*cdf0e10cSrcweir 		E_NOSYS        = osl_File_E_NOSYS,
98*cdf0e10cSrcweir 		E_NOTEMPTY     = osl_File_E_NOTEMPTY,
99*cdf0e10cSrcweir 		E_LOOP         = osl_File_E_LOOP,
100*cdf0e10cSrcweir 		E_ILSEQ        = osl_File_E_ILSEQ,
101*cdf0e10cSrcweir 		E_NOLINK       = osl_File_E_NOLINK,
102*cdf0e10cSrcweir 		E_MULTIHOP     = osl_File_E_MULTIHOP,
103*cdf0e10cSrcweir 		E_USERS        = osl_File_E_USERS,
104*cdf0e10cSrcweir 		E_OVERFLOW     = osl_File_E_OVERFLOW,
105*cdf0e10cSrcweir 		E_NOTREADY     = osl_File_E_NOTREADY,
106*cdf0e10cSrcweir 		E_invalidError = osl_File_E_invalidError,	/* unmapped error: always last entry in enum! */
107*cdf0e10cSrcweir         E_TIMEDOUT     = osl_File_E_TIMEDOUT,
108*cdf0e10cSrcweir 		E_NETWORK      = osl_File_E_NETWORK
109*cdf0e10cSrcweir 	};
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir public:
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	/**	Determine a valid unused canonical name for a requested name.
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir         Determines a valid unused canonical name for a requested name.
117*cdf0e10cSrcweir         Depending on the Operating System and the File System the illegal characters are replaced by valid ones.
118*cdf0e10cSrcweir         If a file or directory with the requested name already exists a new name is generated following
119*cdf0e10cSrcweir         the common rules on the actual Operating System and File System.
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	    @param ustrRequestedURL [in]
122*cdf0e10cSrcweir 	    Requested name of a file or directory.
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	    @param pustrValidURL [out]
125*cdf0e10cSrcweir 	    On success receives a name which is unused and valid on the actual Operating System and
126*cdf0e10cSrcweir 	    File System.
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	    @return
129*cdf0e10cSrcweir 	    E_None on success
130*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	    @see DirectoryItem::getFileStatus()
133*cdf0e10cSrcweir 	*/
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	static inline RC getCanonicalName( const ::rtl::OUString& ustrRequestedURL, ::rtl::OUString& ustrValidURL )
136*cdf0e10cSrcweir 	{
137*cdf0e10cSrcweir 		return (RC) osl_getCanonicalName( ustrRequestedURL.pData, &ustrValidURL.pData );
138*cdf0e10cSrcweir 	}
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 	/**	Convert a path relative to a given directory into an full qualified file URL.
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	    Convert a path relative to a given directory into an full qualified file URL.
143*cdf0e10cSrcweir 	    The function resolves symbolic links if possible and path ellipses, so on success
144*cdf0e10cSrcweir 	    the resulting absolute path is fully resolved.
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	    @param ustrBaseDirectoryURL [in]
147*cdf0e10cSrcweir 	    Base directory URL to which the relative path is related to.
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	    @param ustrRelativeFileURL [in]
150*cdf0e10cSrcweir 	    An URL of a file or directory relative to the directory path specified by ustrBaseDirectoryURL
151*cdf0e10cSrcweir 	    or an absolute path.
152*cdf0e10cSrcweir 	    If ustrRelativeFileURL denotes an absolute path ustrBaseDirectoryURL will be ignored.
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	    @param ustrAbsoluteFileURL [out]
155*cdf0e10cSrcweir 	    On success it receives the full qualified absoulte file URL.
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	    @return
158*cdf0e10cSrcweir 	    E_None on success
159*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
160*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
161*cdf0e10cSrcweir 	    E_NOTDIR not a directory
162*cdf0e10cSrcweir 	    E_ACCES permission denied
163*cdf0e10cSrcweir 	    E_NOENT no such file or directory
164*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
165*cdf0e10cSrcweir 	    E_OVERFLOW value too large for defined data type
166*cdf0e10cSrcweir 	    E_FAULT bad address
167*cdf0e10cSrcweir 	    E_INTR function call was interrupted
168*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
169*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
170*cdf0e10cSrcweir 	    E_NOLINK link has been severed
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	    @see DirectoryItem::getFileStatus()
173*cdf0e10cSrcweir 	*/
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	static inline RC getAbsoluteFileURL( const ::rtl::OUString& ustrBaseDirectoryURL, const ::rtl::OUString& ustrRelativeFileURL, ::rtl::OUString& ustrAbsoluteFileURL )
176*cdf0e10cSrcweir 	{
177*cdf0e10cSrcweir 		return (RC) osl_getAbsoluteFileURL( ustrBaseDirectoryURL.pData, ustrRelativeFileURL.pData, &ustrAbsoluteFileURL.pData );
178*cdf0e10cSrcweir 	}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     /**	Convert a file URL into a system dependend path.
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	    @param ustrFileURL [in]
183*cdf0e10cSrcweir 	    A File URL.
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	    @param ustrSystemPath [out]
186*cdf0e10cSrcweir 	    On success it receives the system path.
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 	    @return
189*cdf0e10cSrcweir 	    E_None on success
190*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	    @see getFileURLFromSystemPath()
193*cdf0e10cSrcweir 	*/
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	static inline RC getSystemPathFromFileURL( const ::rtl::OUString& ustrFileURL, ::rtl::OUString& ustrSystemPath )
196*cdf0e10cSrcweir 	{
197*cdf0e10cSrcweir 		return (RC) osl_getSystemPathFromFileURL( ustrFileURL.pData, &ustrSystemPath.pData );
198*cdf0e10cSrcweir 	}
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir     /**	Convert a system dependend path into a file URL.
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 	    @param ustrSystemPath [in]
203*cdf0e10cSrcweir 	    A System dependent path of a file or directory.
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	    @param ustrFileURL [out]
206*cdf0e10cSrcweir 	    On success it receives the file URL.
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 	    @return
209*cdf0e10cSrcweir 	    E_None on success
210*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	    @see getSystemPathFromFileURL()
213*cdf0e10cSrcweir 	*/
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir     static inline RC getFileURLFromSystemPath( const ::rtl::OUString& ustrSystemPath, ::rtl::OUString& ustrFileURL )
216*cdf0e10cSrcweir 	{
217*cdf0e10cSrcweir 		return (RC) osl_getFileURLFromSystemPath( ustrSystemPath.pData, &ustrFileURL.pData );
218*cdf0e10cSrcweir 	}
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     /**	Searche a full qualified system path or a file URL.
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir         @param ustrFileName [in]
223*cdf0e10cSrcweir         A system dependent path, a file URL, a file or relative directory
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir         @param ustrSearchPath [in]
226*cdf0e10cSrcweir         A list of system paths, in which a given file has to be searched. The Notation of a path list is
227*cdf0e10cSrcweir         system dependend, e.g. on UNIX system "/usr/bin:/bin" and on Windows "C:\BIN;C:\BATCH".
228*cdf0e10cSrcweir         These paths are only for the search of a file or a relative path, otherwise it will be ignored.
229*cdf0e10cSrcweir         If ustrSearchPath is NULL or while using the search path the search failed, the function searches for
230*cdf0e10cSrcweir         a matching file in all system directories and in the directories listed in the PATH environment
231*cdf0e10cSrcweir         variable.
232*cdf0e10cSrcweir         The value of an environment variable should be used (e.g. LD_LIBRARY_PATH) if the caller is not
233*cdf0e10cSrcweir         aware of the Operating System and so doesn't know which path list delimiter to use.
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 	    @param ustrFileURL [out]
236*cdf0e10cSrcweir 	    On success it receives the full qualified file URL.
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	    @return
239*cdf0e10cSrcweir 	    E_None on success
240*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
241*cdf0e10cSrcweir 	    E_NOTDIR not a directory
242*cdf0e10cSrcweir 	    E_NOENT no such file or directory not found
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 	    @see getFileURLFromSystemPath()
245*cdf0e10cSrcweir 	    @see getSystemPathFromFileURL()
246*cdf0e10cSrcweir 	*/
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir     static inline RC searchFileURL( const ::rtl::OUString& ustrFileName, const ::rtl::OUString& ustrSearchPath, ::rtl::OUString& ustrFileURL )
249*cdf0e10cSrcweir 	{
250*cdf0e10cSrcweir 		return (RC) osl_searchFileURL( ustrFileName.pData, ustrSearchPath.pData, &ustrFileURL.pData );
251*cdf0e10cSrcweir 	}
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	/**	Retrieves the file URL of the system's temporary directory path.
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 		@param ustrTempDirURL[out]
256*cdf0e10cSrcweir 		On success receives the URL of system's	temporary directory path.
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 		@return
259*cdf0e10cSrcweir 		E_None on success
260*cdf0e10cSrcweir 		E_NOENT	no such file or directory not found
261*cdf0e10cSrcweir 	*/
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 	static inline RC getTempDirURL( ::rtl::OUString& ustrTempDirURL )
264*cdf0e10cSrcweir 	{
265*cdf0e10cSrcweir 		return (RC) osl_getTempDirURL( &ustrTempDirURL.pData );
266*cdf0e10cSrcweir 	}
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	/** Creates a temporary file in the directory provided by the caller or the
269*cdf0e10cSrcweir         directory returned by getTempDirURL.
270*cdf0e10cSrcweir         Under UNIX Operating Systems the file will be created with read and write
271*cdf0e10cSrcweir         access for the user exclusively.
272*cdf0e10cSrcweir         If the caller requests only a handle to the open file but not the name of
273*cdf0e10cSrcweir         it, the file will be automatically removed on close else the caller is
274*cdf0e10cSrcweir         responsible for removing the file on success.<br><br>
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir         @param  pustrDirectoryURL [in]
277*cdf0e10cSrcweir 		Specifies the full qualified URL where the temporary file should be created.
278*cdf0e10cSrcweir         If pustrDirectoryURL is 0 the path returned by osl_getTempDirURL will be used.
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir         @param  pHandle [out]
281*cdf0e10cSrcweir 		On success receives a handle to the open file.
282*cdf0e10cSrcweir         If pHandle is 0 the file will be closed on return, in this case
283*cdf0e10cSrcweir         pustrTempFileURL must not be 0.
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir         @param  pustrTempFileURL [out]
286*cdf0e10cSrcweir 		On success receives the full qualified URL of the temporary file.
287*cdf0e10cSrcweir         If pustrTempFileURL is 0 the file will be automatically removed
288*cdf0e10cSrcweir         on close, in this case pHandle must not be 0.
289*cdf0e10cSrcweir         If pustrTempFileURL is not 0 the caller receives the name of the
290*cdf0e10cSrcweir         created file and is responsible for removing the file.
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir         @descr
293*cdf0e10cSrcweir 		Description of the different pHandle, ppustrTempFileURL parameter combinations.
294*cdf0e10cSrcweir         pHandle is 0 and pustrTempDirURL is 0 - this combination is invalid<br>
295*cdf0e10cSrcweir         pHandle is not 0 and pustrTempDirURL is 0 - a handle to the open file
296*cdf0e10cSrcweir         will be returned on success and the file will be automatically removed on close<br>
297*cdf0e10cSrcweir         pHandle is 0 and pustrTempDirURL is not 0 - the name of the file will be
298*cdf0e10cSrcweir         returned, the caller is responsible for opening, closing and removing the file.<br>
299*cdf0e10cSrcweir         pHandle is not 0 and pustrTempDirURL is not 0 - a handle to the open file as well as
300*cdf0e10cSrcweir         the file name will be returned, the caller is responsible for closing and removing
301*cdf0e10cSrcweir         the file.<br>
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         @return
304*cdf0e10cSrcweir 		E_None   on success
305*cdf0e10cSrcweir         E_INVAL  the format of the parameter is invalid
306*cdf0e10cSrcweir         E_NOMEM  not enough memory for allocating structures
307*cdf0e10cSrcweir 	    E_ACCES  Permission denied
308*cdf0e10cSrcweir 	    E_NOENT  No such file or directory
309*cdf0e10cSrcweir 	    E_NOTDIR Not a directory
310*cdf0e10cSrcweir 	    E_ROFS   Read-only file system
311*cdf0e10cSrcweir 	    E_NOSPC  No space left on device
312*cdf0e10cSrcweir 	    E_DQUOT  Quota exceeded
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 	    @see getTempDirURL()
315*cdf0e10cSrcweir     */
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 	static inline RC createTempFile(
318*cdf0e10cSrcweir 	    ::rtl::OUString* pustrDirectoryURL,
319*cdf0e10cSrcweir 	    oslFileHandle*   pHandle,
320*cdf0e10cSrcweir 	    ::rtl::OUString* pustrTempFileURL)
321*cdf0e10cSrcweir 	{
322*cdf0e10cSrcweir         rtl_uString*  pustr_dir_url       = pustrDirectoryURL ? pustrDirectoryURL->pData : 0;
323*cdf0e10cSrcweir         rtl_uString** ppustr_tmp_file_url = pustrTempFileURL  ? &pustrTempFileURL->pData : 0;
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir         return (RC) osl_createTempFile(pustr_dir_url, pHandle, ppustr_tmp_file_url);
326*cdf0e10cSrcweir 	}
327*cdf0e10cSrcweir };
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir // -----------------------------------------------------------------------------
331*cdf0e10cSrcweir /** The VolumeDevice class.
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     @see VolumeInfo
334*cdf0e10cSrcweir */
335*cdf0e10cSrcweir #ifdef OS2
336*cdf0e10cSrcweir class VolumeInfo;
337*cdf0e10cSrcweir #endif
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir class VolumeDevice : public FileBase
340*cdf0e10cSrcweir {
341*cdf0e10cSrcweir #ifdef OS2
342*cdf0e10cSrcweir public:
343*cdf0e10cSrcweir #endif
344*cdf0e10cSrcweir 	oslVolumeDeviceHandle	_aHandle;
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir public:
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir     /** Constructor.
349*cdf0e10cSrcweir     */
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	VolumeDevice() : _aHandle( NULL )
352*cdf0e10cSrcweir 	{
353*cdf0e10cSrcweir 	}
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     /** Copy constructor.
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir         @param rDevice
358*cdf0e10cSrcweir         The other volume device.
359*cdf0e10cSrcweir     */
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir 	VolumeDevice( const VolumeDevice & rDevice )
362*cdf0e10cSrcweir 	{
363*cdf0e10cSrcweir 		_aHandle = rDevice._aHandle;
364*cdf0e10cSrcweir 		if ( _aHandle )
365*cdf0e10cSrcweir 			osl_acquireVolumeDeviceHandle( _aHandle );
366*cdf0e10cSrcweir 	}
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir     /** Destructor.
369*cdf0e10cSrcweir     */
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 	~VolumeDevice()
372*cdf0e10cSrcweir 	{
373*cdf0e10cSrcweir 		if ( _aHandle )
374*cdf0e10cSrcweir 			osl_releaseVolumeDeviceHandle( _aHandle );
375*cdf0e10cSrcweir 	}
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir     /** Assignment operator.
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir         @param rDevice
380*cdf0e10cSrcweir         The other volume device.
381*cdf0e10cSrcweir     */
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 	inline VolumeDevice & operator =( const VolumeDevice & rDevice )
384*cdf0e10cSrcweir 	{
385*cdf0e10cSrcweir 		oslVolumeDeviceHandle	newHandle = rDevice._aHandle;
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 		if ( newHandle )
388*cdf0e10cSrcweir 			osl_acquireVolumeDeviceHandle( newHandle );
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 		if ( _aHandle )
391*cdf0e10cSrcweir 			osl_releaseVolumeDeviceHandle( _aHandle );
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 		_aHandle = newHandle;
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 		return *this;
396*cdf0e10cSrcweir 	}
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir     /** Automount a volume device.
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir         @return
401*cdf0e10cSrcweir         E_None on success
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir         @todo
404*cdf0e10cSrcweir         specify all error codes that may be returned
405*cdf0e10cSrcweir     */
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 	inline RC automount()
408*cdf0e10cSrcweir 	{
409*cdf0e10cSrcweir 		return (RC)osl_automountVolumeDevice( _aHandle );
410*cdf0e10cSrcweir 	}
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir     /** Unmount a volume device.
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir         @return
415*cdf0e10cSrcweir         E_None on success
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir         @todo
418*cdf0e10cSrcweir         specify all error codes that may be returned
419*cdf0e10cSrcweir     */
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 	inline RC unmount()
422*cdf0e10cSrcweir 	{
423*cdf0e10cSrcweir 		return (RC)osl_unmountVolumeDevice( _aHandle );
424*cdf0e10cSrcweir 	}
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir     /** Get the full qualified URL where a device is mounted to.
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir 	   	@return
429*cdf0e10cSrcweir 	    The full qualified URL where the device is mounted to.
430*cdf0e10cSrcweir     */
431*cdf0e10cSrcweir 	inline rtl::OUString getMountPath()
432*cdf0e10cSrcweir 	{
433*cdf0e10cSrcweir 		rtl::OUString	aPath;
434*cdf0e10cSrcweir 		osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
435*cdf0e10cSrcweir 		return aPath;
436*cdf0e10cSrcweir 	}
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir 	friend class VolumeInfo;
439*cdf0e10cSrcweir };
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir // -----------------------------------------------------------------------------
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir #define VolumeInfoMask_Attributes             osl_VolumeInfo_Mask_Attributes
444*cdf0e10cSrcweir #define VolumeInfoMask_TotalSpace             osl_VolumeInfo_Mask_TotalSpace
445*cdf0e10cSrcweir #define VolumeInfoMask_UsedSpace              osl_VolumeInfo_Mask_UsedSpace
446*cdf0e10cSrcweir #define VolumeInfoMask_FreeSpace              osl_VolumeInfo_Mask_FreeSpace
447*cdf0e10cSrcweir #define VolumeInfoMask_MaxNameLength          osl_VolumeInfo_Mask_MaxNameLength
448*cdf0e10cSrcweir #define VolumeInfoMask_MaxPathLength          osl_VolumeInfo_Mask_MaxPathLength
449*cdf0e10cSrcweir #define VolumeInfoMask_FileSystemName         osl_VolumeInfo_Mask_FileSystemName
450*cdf0e10cSrcweir #define VolumeInfoMask_FileSystemCaseHandling osl_VolumeInfo_Mask_FileSystemCaseHandling
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir class Directory;
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir /** The VolumeInfo class.
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir     Neither copy nor assignment is allowed for this class.
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir     @see Directory::getVolumeInfo
459*cdf0e10cSrcweir */
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir class VolumeInfo
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir 	oslVolumeInfo	_aInfo;
465*cdf0e10cSrcweir     sal_uInt32		_nMask;
466*cdf0e10cSrcweir 	VolumeDevice	_aDevice;
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir     /** Copy constructor.
469*cdf0e10cSrcweir     */
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 	VolumeInfo( VolumeInfo& );
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir 	/** Assginment operator.
474*cdf0e10cSrcweir 	*/
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 	VolumeInfo& operator = ( VolumeInfo& );
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir public:
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir     /** Constructor.
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir         @param nMask
483*cdf0e10cSrcweir         Set of flaggs decribing the demanded information.
484*cdf0e10cSrcweir     */
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir 	VolumeInfo( sal_uInt32 nMask ): _nMask( nMask )
487*cdf0e10cSrcweir 	{
488*cdf0e10cSrcweir         _aInfo.uStructSize = sizeof( oslVolumeInfo );
489*cdf0e10cSrcweir         rtl_fillMemory( &_aInfo.uValidFields, sizeof( oslVolumeInfo ) - sizeof( sal_uInt32 ), 0 );
490*cdf0e10cSrcweir 		_aInfo.pDeviceHandle = &_aDevice._aHandle;
491*cdf0e10cSrcweir 	}
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir     /** Destructor.
494*cdf0e10cSrcweir     */
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir     ~VolumeInfo()
497*cdf0e10cSrcweir 	{
498*cdf0e10cSrcweir         if( _aInfo.ustrFileSystemName )
499*cdf0e10cSrcweir             rtl_uString_release( _aInfo.ustrFileSystemName );
500*cdf0e10cSrcweir 	}
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     /** Check if specified fields are valid.
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir         @param nMask
505*cdf0e10cSrcweir         Set of flags for the fields to check.
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir         @return sal_True if all fields are valid else sal_False.
508*cdf0e10cSrcweir     */
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir     inline sal_Bool isValid( sal_uInt32 nMask ) const
511*cdf0e10cSrcweir 	{
512*cdf0e10cSrcweir         return ( nMask & _aInfo.uValidFields ) == nMask;
513*cdf0e10cSrcweir 	}
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir     /** Check the remote flag.
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir         @return
518*cdf0e10cSrcweir         sal_True if Attributes are valid and the volume is remote else sal_False.
519*cdf0e10cSrcweir     */
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir     inline sal_Bool getRemoteFlag() const
522*cdf0e10cSrcweir 	{
523*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_Remote);
524*cdf0e10cSrcweir 	}
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir     /** Check the removeable flag.
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir         @return
529*cdf0e10cSrcweir         sal_True if attributes are valid and the volume is removable else sal_False.
530*cdf0e10cSrcweir     */
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir     inline sal_Bool getRemoveableFlag() const
533*cdf0e10cSrcweir 	{
534*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_Removeable);
535*cdf0e10cSrcweir 	}
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir     /** Check the compact disc flag.
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir         @return
540*cdf0e10cSrcweir         sal_True if attributes are valid and the volume is a CDROM else sal_False.
541*cdf0e10cSrcweir     */
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir     inline sal_Bool getCompactDiscFlag() const
544*cdf0e10cSrcweir 	{
545*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_CompactDisc);
546*cdf0e10cSrcweir 	}
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir     /** Check the floppy disc flag.
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir         @return
551*cdf0e10cSrcweir         sal_True if attributes are valid and the volume is a floppy disk else sal_False.
552*cdf0e10cSrcweir     */
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir     inline sal_Bool getFloppyDiskFlag() const
555*cdf0e10cSrcweir 	{
556*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_FloppyDisk);
557*cdf0e10cSrcweir 	}
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir     /** Check the fixed disk flag.
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir         @return
562*cdf0e10cSrcweir         sal_True if attributes are valid and the volume is a fixed disk else sal_False.
563*cdf0e10cSrcweir     */
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir     inline sal_Bool getFixedDiskFlag() const
566*cdf0e10cSrcweir 	{
567*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_FixedDisk);
568*cdf0e10cSrcweir 	}
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir     /** Check the RAM disk flag.
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir         @return
573*cdf0e10cSrcweir         sal_True if attributes are valid and the volume is a RAM disk else sal_False.
574*cdf0e10cSrcweir     */
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir     inline sal_Bool getRAMDiskFlag() const
577*cdf0e10cSrcweir 	{
578*cdf0e10cSrcweir         return 0 != (_aInfo.uAttributes & osl_Volume_Attribute_RAMDisk);
579*cdf0e10cSrcweir 	}
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir     /** Determine the total space of a volume device.
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir         @return
584*cdf0e10cSrcweir         The total diskspace of this volume if this information is valid,
585*cdf0e10cSrcweir 	    0 otherwise.
586*cdf0e10cSrcweir     */
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir     inline sal_uInt64 getTotalSpace() const
589*cdf0e10cSrcweir 	{
590*cdf0e10cSrcweir         return _aInfo.uTotalSpace;
591*cdf0e10cSrcweir 	}
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir     /** Determine the free space of a volume device.
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir         @return
596*cdf0e10cSrcweir         The free diskspace of this volume if this information is valid,
597*cdf0e10cSrcweir 	    0 otherwise.
598*cdf0e10cSrcweir     */
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir     inline sal_uInt64 getFreeSpace() const
601*cdf0e10cSrcweir 	{
602*cdf0e10cSrcweir         return _aInfo.uFreeSpace;
603*cdf0e10cSrcweir 	}
604*cdf0e10cSrcweir 
605*cdf0e10cSrcweir     /** Determine the used space of a volume device.
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir         @return
608*cdf0e10cSrcweir         The used diskspace of this volume if this information is valid,
609*cdf0e10cSrcweir 	    0 otherwise.
610*cdf0e10cSrcweir     */
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir     inline sal_uInt64 getUsedSpace() const
613*cdf0e10cSrcweir 	{
614*cdf0e10cSrcweir         return _aInfo.uUsedSpace;
615*cdf0e10cSrcweir 	}
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir     /** Determine the maximal length of a file name.
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir         @return
620*cdf0e10cSrcweir         The maximal length of a file name if this information is valid,
621*cdf0e10cSrcweir         0 otherwise.
622*cdf0e10cSrcweir     */
623*cdf0e10cSrcweir 
624*cdf0e10cSrcweir     inline sal_uInt32 getMaxNameLength() const
625*cdf0e10cSrcweir 	{
626*cdf0e10cSrcweir         return _aInfo.uMaxNameLength;
627*cdf0e10cSrcweir 	}
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir     /** Determine the maximal length of a path name.
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir         @return
632*cdf0e10cSrcweir         The maximal length of a path if this information is valid,
633*cdf0e10cSrcweir 	    0 otherwise.
634*cdf0e10cSrcweir     */
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir     inline sal_uInt32 getMaxPathLength() const
637*cdf0e10cSrcweir 	{
638*cdf0e10cSrcweir         return _aInfo.uMaxPathLength;
639*cdf0e10cSrcweir 	}
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir     /** Determine the name of the volume device's File System.
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir         @return
644*cdf0e10cSrcweir         The name of the volume's fielsystem if this information is valid,
645*cdf0e10cSrcweir 	    otherwise an empty string.
646*cdf0e10cSrcweir     */
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 	inline ::rtl::OUString getFileSystemName() const
649*cdf0e10cSrcweir 	{
650*cdf0e10cSrcweir         return _aInfo.ustrFileSystemName ? ::rtl::OUString( _aInfo.ustrFileSystemName ) : ::rtl::OUString();
651*cdf0e10cSrcweir 	}
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir     /** Get the volume device handle.
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir         @return
657*cdf0e10cSrcweir         The device handle of the volume if this information is valid,
658*cdf0e10cSrcweir 	    otherwise returns NULL;
659*cdf0e10cSrcweir     */
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir 	inline VolumeDevice getDeviceHandle() const
662*cdf0e10cSrcweir 	{
663*cdf0e10cSrcweir         return _aDevice;
664*cdf0e10cSrcweir 	}
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir     /** Return whether the file system is case sensitive or
667*cdf0e10cSrcweir         case insensitive
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir         @return
670*cdf0e10cSrcweir         true if the file system is case sensitive false otherwise
671*cdf0e10cSrcweir     */
672*cdf0e10cSrcweir     bool isCaseSensitiveFileSystem() const
673*cdf0e10cSrcweir     {
674*cdf0e10cSrcweir         return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Sensitive);
675*cdf0e10cSrcweir     }
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir     /** Return whether the file system preserves the case of
678*cdf0e10cSrcweir         file and directory names or not
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir         @return
681*cdf0e10cSrcweir         true if the file system preserves the case of file and
682*cdf0e10cSrcweir         directory names false otherwise
683*cdf0e10cSrcweir     */
684*cdf0e10cSrcweir     bool isCasePreservingFileSystem() const
685*cdf0e10cSrcweir     {
686*cdf0e10cSrcweir         return (_aInfo.uAttributes & osl_Volume_Attribute_Case_Is_Preserved);
687*cdf0e10cSrcweir     }
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir     friend class Directory;
690*cdf0e10cSrcweir };
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir // -----------------------------------------------------------------------------
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir #define	FileStatusMask_Type				osl_FileStatus_Mask_Type
695*cdf0e10cSrcweir #define FileStatusMask_Attributes		osl_FileStatus_Mask_Attributes
696*cdf0e10cSrcweir #define FileStatusMask_CreationTime		osl_FileStatus_Mask_CreationTime
697*cdf0e10cSrcweir #define FileStatusMask_AccessTime		osl_FileStatus_Mask_AccessTime
698*cdf0e10cSrcweir #define FileStatusMask_ModifyTime		osl_FileStatus_Mask_ModifyTime
699*cdf0e10cSrcweir #define FileStatusMask_FileSize			osl_FileStatus_Mask_FileSize
700*cdf0e10cSrcweir #define FileStatusMask_FileName			osl_FileStatus_Mask_FileName
701*cdf0e10cSrcweir #define FileStatusMask_FileURL			osl_FileStatus_Mask_FileURL
702*cdf0e10cSrcweir #define FileStatusMask_LinkTargetURL	osl_FileStatus_Mask_LinkTargetURL
703*cdf0e10cSrcweir #define FileStatusMask_All				osl_FileStatus_Mask_All
704*cdf0e10cSrcweir #define FileStatusMask_Validate			osl_FileStatus_Mask_Validate
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir #define Attribute_ReadOnly     osl_File_Attribute_ReadOnly
707*cdf0e10cSrcweir #define Attribute_Hidden       osl_File_Attribute_Hidden
708*cdf0e10cSrcweir #define Attribute_Executable   osl_File_Attribute_Executable
709*cdf0e10cSrcweir #define Attribute_GrpWrite     osl_File_Attribute_GrpWrite
710*cdf0e10cSrcweir #define Attribute_GrpRead      osl_File_Attribute_GrpRead
711*cdf0e10cSrcweir #define Attribute_GrpExe       osl_File_Attribute_GrpExe
712*cdf0e10cSrcweir #define Attribute_OwnWrite     osl_File_Attribute_OwnWrite
713*cdf0e10cSrcweir #define Attribute_OwnRead      osl_File_Attribute_OwnRead
714*cdf0e10cSrcweir #define Attribute_OwnExe       osl_File_Attribute_OwnExe
715*cdf0e10cSrcweir #define Attribute_OthWrite     osl_File_Attribute_OthWrite
716*cdf0e10cSrcweir #define Attribute_OthRead      osl_File_Attribute_OthRead
717*cdf0e10cSrcweir #define Attribute_OthExe       osl_File_Attribute_OthExe
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir class DirectoryItem;
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir /** The FileStatus class.
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir     @see DirectoryItem::getFileStatus
724*cdf0e10cSrcweir */
725*cdf0e10cSrcweir 
726*cdf0e10cSrcweir class FileStatus
727*cdf0e10cSrcweir {
728*cdf0e10cSrcweir     oslFileStatus	_aStatus;
729*cdf0e10cSrcweir     sal_uInt32		_nMask;
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir     /** Copy constructor.
732*cdf0e10cSrcweir     */
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir 	FileStatus( FileStatus& );
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 	/** Assignment operator.
737*cdf0e10cSrcweir 	*/
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 	FileStatus& operator = ( FileStatus& );
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir public:
742*cdf0e10cSrcweir 
743*cdf0e10cSrcweir 	enum Type {
744*cdf0e10cSrcweir         Directory =	osl_File_Type_Directory,
745*cdf0e10cSrcweir 		Volume    = osl_File_Type_Volume,
746*cdf0e10cSrcweir 		Regular   = osl_File_Type_Regular,
747*cdf0e10cSrcweir 		Fifo      = osl_File_Type_Fifo,
748*cdf0e10cSrcweir 		Socket    = osl_File_Type_Socket,
749*cdf0e10cSrcweir 		Link      = osl_File_Type_Link,
750*cdf0e10cSrcweir 		Special   = osl_File_Type_Special,
751*cdf0e10cSrcweir 		Unknown   = osl_File_Type_Unknown
752*cdf0e10cSrcweir 	};
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir     /** Constructor.
755*cdf0e10cSrcweir 
756*cdf0e10cSrcweir         @param nMask
757*cdf0e10cSrcweir         Set of flaggs decribing the demanded information.
758*cdf0e10cSrcweir     */
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir 	FileStatus( sal_uInt32 nMask ): _nMask( nMask )
761*cdf0e10cSrcweir 	{
762*cdf0e10cSrcweir         _aStatus.uStructSize = sizeof( oslFileStatus );
763*cdf0e10cSrcweir         rtl_fillMemory( &_aStatus.uValidFields, sizeof( oslFileStatus ) - sizeof( sal_uInt32 ), 0 );
764*cdf0e10cSrcweir 	}
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir     /** Destructor.
767*cdf0e10cSrcweir     */
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir     ~FileStatus()
770*cdf0e10cSrcweir 	{
771*cdf0e10cSrcweir 		if ( _aStatus.ustrFileURL )
772*cdf0e10cSrcweir 			rtl_uString_release( _aStatus.ustrFileURL );
773*cdf0e10cSrcweir 		if ( _aStatus.ustrLinkTargetURL )
774*cdf0e10cSrcweir 			rtl_uString_release( _aStatus.ustrLinkTargetURL );
775*cdf0e10cSrcweir 		if ( _aStatus.ustrFileName )
776*cdf0e10cSrcweir 			rtl_uString_release( _aStatus.ustrFileName );
777*cdf0e10cSrcweir 	}
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir     /** Check if specified fields are valid.
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir         @param nMask
782*cdf0e10cSrcweir         Set of flags for the fields to check.
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir         @return
785*cdf0e10cSrcweir         sal_True if all fields are valid else sal_False.
786*cdf0e10cSrcweir     */
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir     inline sal_Bool isValid( sal_uInt32 nMask ) const
789*cdf0e10cSrcweir 	{
790*cdf0e10cSrcweir         return ( nMask & _aStatus.uValidFields ) == nMask;
791*cdf0e10cSrcweir 	}
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir     /** Get the file type.
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir         @return
796*cdf0e10cSrcweir         The file type if this information is valid, Unknown otherwise.
797*cdf0e10cSrcweir     */
798*cdf0e10cSrcweir     inline Type getFileType() const
799*cdf0e10cSrcweir 	{
800*cdf0e10cSrcweir 		return (_aStatus.uValidFields & FileStatusMask_Type) ?  (Type) _aStatus.eType : Unknown;
801*cdf0e10cSrcweir 	}
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir     /** Get the file attributes.
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir         @return
806*cdf0e10cSrcweir         The set of attribute flags of this file.
807*cdf0e10cSrcweir     */
808*cdf0e10cSrcweir 
809*cdf0e10cSrcweir     inline sal_uInt64 getAttributes() const
810*cdf0e10cSrcweir 	{
811*cdf0e10cSrcweir         return _aStatus.uAttributes;
812*cdf0e10cSrcweir 	}
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir     /** Get the creation time of this file.
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir         @return
817*cdf0e10cSrcweir         The creation time if this information is valid,
818*cdf0e10cSrcweir 	    an uninitialized TimeValue otherwise.
819*cdf0e10cSrcweir     */
820*cdf0e10cSrcweir 
821*cdf0e10cSrcweir     inline TimeValue getCreationTime() const
822*cdf0e10cSrcweir 	{
823*cdf0e10cSrcweir         return _aStatus.aCreationTime;
824*cdf0e10cSrcweir 	}
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir     /** Get the file access time.
827*cdf0e10cSrcweir 
828*cdf0e10cSrcweir         @return
829*cdf0e10cSrcweir         The last access time if this information is valid,
830*cdf0e10cSrcweir 	    an uninitialized TimeValue otherwise.
831*cdf0e10cSrcweir     */
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir     inline TimeValue getAccessTime() const
834*cdf0e10cSrcweir 	{
835*cdf0e10cSrcweir         return _aStatus.aAccessTime;
836*cdf0e10cSrcweir 	}
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir     /** Get the file modification time.
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir         @return
841*cdf0e10cSrcweir         The last modified time if this information is valid,
842*cdf0e10cSrcweir 	    an uninitialized TimeValue otherwise.
843*cdf0e10cSrcweir     */
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir     inline TimeValue getModifyTime() const
846*cdf0e10cSrcweir 	{
847*cdf0e10cSrcweir         return _aStatus.aModifyTime;
848*cdf0e10cSrcweir 	}
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir     /** Get the size of the file.
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir         @return
853*cdf0e10cSrcweir         The actual file size if this information is valid, 0 otherwise.
854*cdf0e10cSrcweir     */
855*cdf0e10cSrcweir 
856*cdf0e10cSrcweir     inline sal_uInt64 getFileSize() const
857*cdf0e10cSrcweir 	{
858*cdf0e10cSrcweir         return _aStatus.uFileSize;
859*cdf0e10cSrcweir 	}
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir     /** Get the file name.
862*cdf0e10cSrcweir 
863*cdf0e10cSrcweir         @return
864*cdf0e10cSrcweir         The file name if this information is valid, an empty string otherwise.
865*cdf0e10cSrcweir     */
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir     inline ::rtl::OUString getFileName() const
868*cdf0e10cSrcweir 	{
869*cdf0e10cSrcweir         return _aStatus.ustrFileName ? ::rtl::OUString(_aStatus.ustrFileName) : ::rtl::OUString();
870*cdf0e10cSrcweir 	}
871*cdf0e10cSrcweir 
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir     /** Get the URL of the file.
874*cdf0e10cSrcweir 
875*cdf0e10cSrcweir         @return
876*cdf0e10cSrcweir         The full qualified URL of the file if this information is valid, an empty string otherwise.
877*cdf0e10cSrcweir     */
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir     inline ::rtl::OUString getFileURL() const
880*cdf0e10cSrcweir 	{
881*cdf0e10cSrcweir         return _aStatus.ustrFileURL ? ::rtl::OUString(_aStatus.ustrFileURL) : ::rtl::OUString();
882*cdf0e10cSrcweir 	}
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir     /** Get the link target URL.
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir         @return
887*cdf0e10cSrcweir         The link target URL if this information is valid, an empty string otherwise.
888*cdf0e10cSrcweir     */
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir     inline ::rtl::OUString getLinkTargetURL() const
891*cdf0e10cSrcweir 	{
892*cdf0e10cSrcweir 		return _aStatus.ustrLinkTargetURL ? ::rtl::OUString(_aStatus.ustrLinkTargetURL) : ::rtl::OUString();
893*cdf0e10cSrcweir 	}
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir     friend class DirectoryItem;
896*cdf0e10cSrcweir };
897*cdf0e10cSrcweir 
898*cdf0e10cSrcweir 
899*cdf0e10cSrcweir // -----------------------------------------------------------------------------
900*cdf0e10cSrcweir /** The file class object provides access to file contents and attributes.
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir     @see Directory
903*cdf0e10cSrcweir     @see DirectoryItem
904*cdf0e10cSrcweir  */
905*cdf0e10cSrcweir 
906*cdf0e10cSrcweir class File: public FileBase
907*cdf0e10cSrcweir {
908*cdf0e10cSrcweir     oslFileHandle   _pData;
909*cdf0e10cSrcweir 	::rtl::OUString _aPath;
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir     /** Copy constructor.
912*cdf0e10cSrcweir     */
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 	File( File& );
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir 	/** Assginment operator.
917*cdf0e10cSrcweir 	*/
918*cdf0e10cSrcweir 
919*cdf0e10cSrcweir 	File& operator = ( File& );
920*cdf0e10cSrcweir 
921*cdf0e10cSrcweir public:
922*cdf0e10cSrcweir 
923*cdf0e10cSrcweir     /** Constructor.
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir 	    @param  ustrFileURL [in]
926*cdf0e10cSrcweir 	    The full qualified URL of the file. Relative paths are not allowed.
927*cdf0e10cSrcweir     */
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir     File( const ::rtl::OUString& ustrFileURL ): _pData( 0 ), _aPath( ustrFileURL ) {}
930*cdf0e10cSrcweir 
931*cdf0e10cSrcweir     /** Destructor
932*cdf0e10cSrcweir     */
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir 	inline ~File()
935*cdf0e10cSrcweir 	{
936*cdf0e10cSrcweir 		close();
937*cdf0e10cSrcweir 	}
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir     #define OpenFlag_Read   osl_File_OpenFlag_Read
940*cdf0e10cSrcweir     #define OpenFlag_Write  osl_File_OpenFlag_Write
941*cdf0e10cSrcweir     #define OpenFlag_Create osl_File_OpenFlag_Create
942*cdf0e10cSrcweir     #define OpenFlag_NoLock osl_File_OpenFlag_NoLock
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir 	/** Open a regular file.
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir         Open a file. Only regular files	can be openend.
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir 	    @param uFlags [in]
949*cdf0e10cSrcweir 	    Specifies the open mode.
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir 	    @return
952*cdf0e10cSrcweir 	    E_None on success
953*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
954*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
955*cdf0e10cSrcweir 	    E_NAMETOOLONG pathname was too long
956*cdf0e10cSrcweir 	    E_NOENT no such file or directory
957*cdf0e10cSrcweir 	    E_ACCES permission denied
958*cdf0e10cSrcweir 	    E_AGAIN a write lock could not be established
959*cdf0e10cSrcweir 	    E_NOTDIR not a directory
960*cdf0e10cSrcweir 	    E_NXIO no such device or address
961*cdf0e10cSrcweir 	    E_NODEV no such device
962*cdf0e10cSrcweir 	    E_ROFS read-only file system
963*cdf0e10cSrcweir 	    E_TXTBSY text file busy
964*cdf0e10cSrcweir 	    E_FAULT bad address
965*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
966*cdf0e10cSrcweir 	    E_NOSPC no space left on device
967*cdf0e10cSrcweir 	    E_ISDIR is a directory
968*cdf0e10cSrcweir 	    E_MFILE too many open files used by the process
969*cdf0e10cSrcweir 	    E_NFILE too many open files in the system
970*cdf0e10cSrcweir 	    E_DQUOT quota exceeded
971*cdf0e10cSrcweir 	    E_EXIST file exists
972*cdf0e10cSrcweir 	    E_INTR function call was interrupted
973*cdf0e10cSrcweir 	    E_IO on I/O errors
974*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
975*cdf0e10cSrcweir 	    E_NOLINK link has been severed
976*cdf0e10cSrcweir 	    E_EOVERFLOW value too large for defined data type
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir 	    @see close()
979*cdf0e10cSrcweir 	    @see setPos()
980*cdf0e10cSrcweir 	    @see getPos()
981*cdf0e10cSrcweir 	    @see read()
982*cdf0e10cSrcweir 	    @see write()
983*cdf0e10cSrcweir 	    @see getSize()
984*cdf0e10cSrcweir 	    @see setSize()
985*cdf0e10cSrcweir     */
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir     inline RC open( sal_uInt32 uFlags )
988*cdf0e10cSrcweir 	{
989*cdf0e10cSrcweir         return (RC) osl_openFile( _aPath.pData, &_pData, uFlags );
990*cdf0e10cSrcweir 	}
991*cdf0e10cSrcweir 
992*cdf0e10cSrcweir 	/**	Close an open file.
993*cdf0e10cSrcweir 
994*cdf0e10cSrcweir 	    @return
995*cdf0e10cSrcweir 	    E_None on success
996*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
997*cdf0e10cSrcweir 	    E_BADF Bad file
998*cdf0e10cSrcweir 	    E_INTR function call was interrupted
999*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1000*cdf0e10cSrcweir 	    E_NOSPC no space left on device
1001*cdf0e10cSrcweir 	    E_IO on I/O errors
1002*cdf0e10cSrcweir 
1003*cdf0e10cSrcweir 	    @see open()
1004*cdf0e10cSrcweir     */
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir     inline RC close()
1007*cdf0e10cSrcweir 	{
1008*cdf0e10cSrcweir         oslFileError Error = osl_File_E_BADF;
1009*cdf0e10cSrcweir 
1010*cdf0e10cSrcweir         if( _pData )
1011*cdf0e10cSrcweir 		{
1012*cdf0e10cSrcweir 			Error=osl_closeFile( _pData );
1013*cdf0e10cSrcweir             _pData = NULL;
1014*cdf0e10cSrcweir 		}
1015*cdf0e10cSrcweir 
1016*cdf0e10cSrcweir 		return (RC) Error;
1017*cdf0e10cSrcweir     }
1018*cdf0e10cSrcweir 
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir     #define Pos_Absolut osl_Pos_Absolut
1021*cdf0e10cSrcweir     #define Pos_Current osl_Pos_Current
1022*cdf0e10cSrcweir     #define Pos_End     osl_Pos_End
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir     /** Set the internal position pointer of an open file.
1025*cdf0e10cSrcweir 
1026*cdf0e10cSrcweir 	    @param uHow [in]
1027*cdf0e10cSrcweir 	    Distance to move the internal position pointer (from uPos).
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir 	    @param uPos [in]
1030*cdf0e10cSrcweir 	    Absolute position from the beginning of the file.
1031*cdf0e10cSrcweir 
1032*cdf0e10cSrcweir 	    @return
1033*cdf0e10cSrcweir 	    E_None on success
1034*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1035*cdf0e10cSrcweir 	    E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir 	    @see open()
1038*cdf0e10cSrcweir 	    @see getPos()
1039*cdf0e10cSrcweir     */
1040*cdf0e10cSrcweir 
1041*cdf0e10cSrcweir     inline RC setPos( sal_uInt32 uHow, sal_Int64 uPos )
1042*cdf0e10cSrcweir 	{
1043*cdf0e10cSrcweir         return (RC) osl_setFilePos( _pData, uHow, uPos );
1044*cdf0e10cSrcweir 	}
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir 	/**	Retrieve the current position of the internal pointer of an open file.
1047*cdf0e10cSrcweir 
1048*cdf0e10cSrcweir 	    @param uPos [out]
1049*cdf0e10cSrcweir 	    On success receives the current position of the file pointer.
1050*cdf0e10cSrcweir 
1051*cdf0e10cSrcweir 	    @return
1052*cdf0e10cSrcweir 	    E_None on success
1053*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1054*cdf0e10cSrcweir 	    E_OVERFLOW the resulting file offset would be a value which cannot be represented correctly for regular files
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir 	    @see open()
1057*cdf0e10cSrcweir 	    @see setPos()
1058*cdf0e10cSrcweir 	    @see read()
1059*cdf0e10cSrcweir 	    @see write()
1060*cdf0e10cSrcweir     */
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir     inline RC getPos( sal_uInt64& uPos )
1063*cdf0e10cSrcweir 	{
1064*cdf0e10cSrcweir         return (RC) osl_getFilePos( _pData, &uPos );
1065*cdf0e10cSrcweir 	}
1066*cdf0e10cSrcweir 
1067*cdf0e10cSrcweir     /**	Test if the end of a file is reached.
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir 	    @param pIsEOF [out]
1070*cdf0e10cSrcweir 	    Points to a variable that receives the end-of-file status.
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 	    @return
1073*cdf0e10cSrcweir 	    E_None on success
1074*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1075*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1076*cdf0e10cSrcweir 	    E_IO on I/O errors
1077*cdf0e10cSrcweir 	    E_ISDIR is a directory
1078*cdf0e10cSrcweir 	    E_BADF bad file
1079*cdf0e10cSrcweir 	    E_FAULT bad address
1080*cdf0e10cSrcweir 	    E_AGAIN operation would block
1081*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1082*cdf0e10cSrcweir 
1083*cdf0e10cSrcweir 	    @see open()
1084*cdf0e10cSrcweir 	    @see read()
1085*cdf0e10cSrcweir         @see readLine()
1086*cdf0e10cSrcweir 	    @see setPos()
1087*cdf0e10cSrcweir     */
1088*cdf0e10cSrcweir 
1089*cdf0e10cSrcweir     inline RC isEndOfFile( sal_Bool *pIsEOF )
1090*cdf0e10cSrcweir     {
1091*cdf0e10cSrcweir         return (RC) osl_isEndOfFile( _pData, pIsEOF );
1092*cdf0e10cSrcweir     }
1093*cdf0e10cSrcweir 
1094*cdf0e10cSrcweir 	/**	Set the file size of an open file.
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir         Sets the file size of an open file. The file can be truncated or enlarged by the function.
1097*cdf0e10cSrcweir 	    The position of the file pointer is not affeced by this function.
1098*cdf0e10cSrcweir 
1099*cdf0e10cSrcweir 	    @param uSize [in]
1100*cdf0e10cSrcweir 	    New size in bytes.
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir 	    @return
1103*cdf0e10cSrcweir 	    E_None on success
1104*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1105*cdf0e10cSrcweir 	    E_OVERFLOW the resulting file offset would be a value which cannot	be represented correctly for regular files
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir 	    @see open()
1108*cdf0e10cSrcweir 	    @see setPos()
1109*cdf0e10cSrcweir 	    @see getStatus()
1110*cdf0e10cSrcweir     */
1111*cdf0e10cSrcweir 
1112*cdf0e10cSrcweir     inline RC setSize( sal_uInt64 uSize )
1113*cdf0e10cSrcweir 	{
1114*cdf0e10cSrcweir         return (RC) osl_setFileSize( _pData, uSize );
1115*cdf0e10cSrcweir 	}
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir 	/**	Get the file size of an open file.
1118*cdf0e10cSrcweir 
1119*cdf0e10cSrcweir         Gets the file size of an open file.
1120*cdf0e10cSrcweir 	    The position of the file pointer is not affeced by this function.
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir 	    @param rSize [out]
1123*cdf0e10cSrcweir 	    Current size in bytes.
1124*cdf0e10cSrcweir 
1125*cdf0e10cSrcweir 	    @return
1126*cdf0e10cSrcweir 	    E_None on success
1127*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1128*cdf0e10cSrcweir 	    E_OVERFLOW the resulting file offset would be a value which cannot	be represented correctly for regular files
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir 	    @see open()
1131*cdf0e10cSrcweir 	    @see setPos()
1132*cdf0e10cSrcweir 	    @see getSize()
1133*cdf0e10cSrcweir 	    @see setSize()
1134*cdf0e10cSrcweir 	    @see getStatus()
1135*cdf0e10cSrcweir     */
1136*cdf0e10cSrcweir 
1137*cdf0e10cSrcweir     inline RC getSize( sal_uInt64 &rSize )
1138*cdf0e10cSrcweir 	{
1139*cdf0e10cSrcweir         return (RC) osl_getFileSize( _pData, &rSize );
1140*cdf0e10cSrcweir 	}
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir 	/**	Read a number of bytes from a file.
1143*cdf0e10cSrcweir 
1144*cdf0e10cSrcweir         Reads a number of bytes from a file. The internal file pointer is
1145*cdf0e10cSrcweir         increased by the number of bytes read.
1146*cdf0e10cSrcweir 
1147*cdf0e10cSrcweir 	    @param pBuffer [out]
1148*cdf0e10cSrcweir 	    Points to a buffer which receives data. The buffer must be large enough
1149*cdf0e10cSrcweir 	    to hold uBytesRequested bytes.
1150*cdf0e10cSrcweir 
1151*cdf0e10cSrcweir 	    @param uBytesRequested [in]
1152*cdf0e10cSrcweir 	    Number of bytes which should be retrieved.
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir 	    @param rBytesRead [out]
1155*cdf0e10cSrcweir 	    On success the number of bytes which have actually been retrieved.
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir 	    @return
1158*cdf0e10cSrcweir 	    E_None on success
1159*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1160*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1161*cdf0e10cSrcweir 	    E_IO on I/O errors
1162*cdf0e10cSrcweir 	    E_ISDIR is a directory
1163*cdf0e10cSrcweir 	    E_BADF bad file
1164*cdf0e10cSrcweir 	    E_FAULT bad address
1165*cdf0e10cSrcweir 	    E_AGAIN operation would block
1166*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir 	    @see open()
1169*cdf0e10cSrcweir 	    @see write()
1170*cdf0e10cSrcweir         @see readLine()
1171*cdf0e10cSrcweir 	    @see setPos()
1172*cdf0e10cSrcweir     */
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir     inline RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
1175*cdf0e10cSrcweir 	{
1176*cdf0e10cSrcweir         return (RC) osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead );
1177*cdf0e10cSrcweir 	}
1178*cdf0e10cSrcweir 
1179*cdf0e10cSrcweir 	/** Write a number of bytes to a file.
1180*cdf0e10cSrcweir 
1181*cdf0e10cSrcweir 	    Writes a number of bytes to a file.
1182*cdf0e10cSrcweir 	    The internal file pointer is increased by the number of bytes read.
1183*cdf0e10cSrcweir 
1184*cdf0e10cSrcweir 	    @param pBuffer [in]
1185*cdf0e10cSrcweir 	    Points to a buffer which contains the data.
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir 	    @param uBytesToWrite [in]
1188*cdf0e10cSrcweir 	    Number of bytes which should be written.
1189*cdf0e10cSrcweir 
1190*cdf0e10cSrcweir 	    @param rBytesWritten [out]
1191*cdf0e10cSrcweir 	    On success the number of bytes which have actually been written.
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir 	    @return
1194*cdf0e10cSrcweir 	    E_None on success
1195*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1196*cdf0e10cSrcweir 	    E_FBIG file too large
1197*cdf0e10cSrcweir 	    E_DQUOT quota exceeded
1198*cdf0e10cSrcweir 	    E_AGAIN operation would block
1199*cdf0e10cSrcweir 	    E_BADF bad file
1200*cdf0e10cSrcweir 	    E_FAULT bad address
1201*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1202*cdf0e10cSrcweir 	    E_IO on I/O errosr
1203*cdf0e10cSrcweir 	    E_NOLCK no record locks available
1204*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1205*cdf0e10cSrcweir 	    E_NOSPC no space left on device
1206*cdf0e10cSrcweir 	    E_NXIO no such device or address
1207*cdf0e10cSrcweir 
1208*cdf0e10cSrcweir 	    @see open()
1209*cdf0e10cSrcweir 	    @see read()
1210*cdf0e10cSrcweir 	    @see setPos()
1211*cdf0e10cSrcweir     */
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir     inline RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
1214*cdf0e10cSrcweir 	{
1215*cdf0e10cSrcweir         return (RC) osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten );
1216*cdf0e10cSrcweir 	}
1217*cdf0e10cSrcweir 
1218*cdf0e10cSrcweir 
1219*cdf0e10cSrcweir     /** Read a line from a file.
1220*cdf0e10cSrcweir 
1221*cdf0e10cSrcweir         Reads a line from a file. The new line delimiter is NOT returned!
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir 	    @param	aSeq [in/out]
1224*cdf0e10cSrcweir 	    A reference to a ::rtl::ByteSequence that will hold the line read on success.
1225*cdf0e10cSrcweir 
1226*cdf0e10cSrcweir 	    @return
1227*cdf0e10cSrcweir 	    E_None on success
1228*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1229*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1230*cdf0e10cSrcweir 	    E_IO on I/O errors
1231*cdf0e10cSrcweir 	    E_ISDIR is a directory
1232*cdf0e10cSrcweir 	    E_BADF bad file
1233*cdf0e10cSrcweir 	    E_FAULT bad address
1234*cdf0e10cSrcweir 	    E_AGAIN operation would block
1235*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1236*cdf0e10cSrcweir 
1237*cdf0e10cSrcweir 	    @see open()
1238*cdf0e10cSrcweir 	    @see read()
1239*cdf0e10cSrcweir 	    @see write()
1240*cdf0e10cSrcweir 	    @see setPos()
1241*cdf0e10cSrcweir     */
1242*cdf0e10cSrcweir 
1243*cdf0e10cSrcweir     inline RC readLine( ::rtl::ByteSequence& aSeq )
1244*cdf0e10cSrcweir     {
1245*cdf0e10cSrcweir         return (RC) osl_readLine( _pData, reinterpret_cast<sal_Sequence**>(&aSeq) );
1246*cdf0e10cSrcweir     }
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir     /** Synchronize the memory representation of a file with that on the physical medium.
1249*cdf0e10cSrcweir 
1250*cdf0e10cSrcweir     The function ensures that all modified data and attributes of the file associated with
1251*cdf0e10cSrcweir     the given file handle have been written to the physical medium.
1252*cdf0e10cSrcweir     In case the hard disk has a write cache enabled, the data may not really be on
1253*cdf0e10cSrcweir     permanent storage when osl_syncFile returns.
1254*cdf0e10cSrcweir 
1255*cdf0e10cSrcweir     @return
1256*cdf0e10cSrcweir     <dl>
1257*cdf0e10cSrcweir     <dt>E_None</dt>
1258*cdf0e10cSrcweir     <dd>On success</dd>
1259*cdf0e10cSrcweir     <dt>E_INVAL</dt>
1260*cdf0e10cSrcweir     <dd>The value of the input parameter is invalid</dd>
1261*cdf0e10cSrcweir     </dl>
1262*cdf0e10cSrcweir     <br><p><strong>In addition to these error codes others may occur as well, for instance:</strong></p><br>
1263*cdf0e10cSrcweir     <dt>E_BADF</dt>
1264*cdf0e10cSrcweir     <dd>The file is not open for writing</dd>
1265*cdf0e10cSrcweir     <dt>E_IO</dt>
1266*cdf0e10cSrcweir     <dd>An I/O error occurred</dd>
1267*cdf0e10cSrcweir     <dt>E_NOSPC</dt>
1268*cdf0e10cSrcweir     <dd>There is no enough space on the target device</dd>
1269*cdf0e10cSrcweir     <dt>E_ROFS</dt>
1270*cdf0e10cSrcweir     <dd>The file is located on a read only file system</dd>
1271*cdf0e10cSrcweir     <dt>E_TIMEDOUT</dt>
1272*cdf0e10cSrcweir     <dd>A remote connection timed out. This may happen when a file is on a remote location</dd>
1273*cdf0e10cSrcweir     </dl>
1274*cdf0e10cSrcweir 
1275*cdf0e10cSrcweir     @see osl_syncFile()
1276*cdf0e10cSrcweir     @see open()
1277*cdf0e10cSrcweir     @see write()
1278*cdf0e10cSrcweir     */
1279*cdf0e10cSrcweir     inline RC sync() const
1280*cdf0e10cSrcweir     {
1281*cdf0e10cSrcweir         OSL_PRECOND(_pData, "File::sync(): File not open");
1282*cdf0e10cSrcweir         return (RC)osl_syncFile(_pData);
1283*cdf0e10cSrcweir     }
1284*cdf0e10cSrcweir 
1285*cdf0e10cSrcweir 	/** Copy a file to a new destination.
1286*cdf0e10cSrcweir 
1287*cdf0e10cSrcweir         Copies a file to a new destination. Copies only files not directories.
1288*cdf0e10cSrcweir         No assumptions should be made about preserving attributes or file time.
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir 	    @param ustrSourceFileURL [in]
1291*cdf0e10cSrcweir 	    Full qualified URL of the source file.
1292*cdf0e10cSrcweir 
1293*cdf0e10cSrcweir 	    @param ustrDestFileURL [in]
1294*cdf0e10cSrcweir 	    Full qualified URL of the destination file. A directory is NOT a valid destination file!
1295*cdf0e10cSrcweir 
1296*cdf0e10cSrcweir 	    @return
1297*cdf0e10cSrcweir 	    E_None on success
1298*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1299*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1300*cdf0e10cSrcweir 	    E_ACCES permission denied
1301*cdf0e10cSrcweir 	    E_PERM operation not permitted
1302*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1303*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1304*cdf0e10cSrcweir 	    E_ISDIR is a directory
1305*cdf0e10cSrcweir 	    E_ROFS read-only file system
1306*cdf0e10cSrcweir 
1307*cdf0e10cSrcweir 	    @see move()
1308*cdf0e10cSrcweir 	    @see remove()
1309*cdf0e10cSrcweir     */
1310*cdf0e10cSrcweir 
1311*cdf0e10cSrcweir 	inline static RC copy( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
1312*cdf0e10cSrcweir 	{
1313*cdf0e10cSrcweir         return (RC) osl_copyFile( ustrSourceFileURL.pData, ustrDestFileURL.pData );
1314*cdf0e10cSrcweir 	}
1315*cdf0e10cSrcweir 
1316*cdf0e10cSrcweir 	/** Move a file or directory to a new destination or renames it.
1317*cdf0e10cSrcweir 
1318*cdf0e10cSrcweir         Moves a file or directory to a new destination or renames it.
1319*cdf0e10cSrcweir         File time and attributes are preserved.
1320*cdf0e10cSrcweir 
1321*cdf0e10cSrcweir 	    @param ustrSourceFileURL [in]
1322*cdf0e10cSrcweir 	    Full qualified URL of the source file.
1323*cdf0e10cSrcweir 
1324*cdf0e10cSrcweir 	    @param ustrDestFileURL [in]
1325*cdf0e10cSrcweir 	    Full qualified URL of the destination file. An existing directory is NOT a valid destination !
1326*cdf0e10cSrcweir 
1327*cdf0e10cSrcweir 	    @return
1328*cdf0e10cSrcweir 	    E_None on success
1329*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1330*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1331*cdf0e10cSrcweir 	    E_ACCES permission denied
1332*cdf0e10cSrcweir 	    E_PERM operation not permitted
1333*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1334*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1335*cdf0e10cSrcweir 	    E_ROFS read-only file system
1336*cdf0e10cSrcweir 
1337*cdf0e10cSrcweir 	    @see copy()
1338*cdf0e10cSrcweir     */
1339*cdf0e10cSrcweir 
1340*cdf0e10cSrcweir     inline static RC move( const ::rtl::OUString& ustrSourceFileURL, const ::rtl::OUString& ustrDestFileURL )
1341*cdf0e10cSrcweir 	{
1342*cdf0e10cSrcweir         return (RC) osl_moveFile( ustrSourceFileURL.pData, ustrDestFileURL.pData );
1343*cdf0e10cSrcweir 	}
1344*cdf0e10cSrcweir 
1345*cdf0e10cSrcweir 	/** Remove a regular file.
1346*cdf0e10cSrcweir 
1347*cdf0e10cSrcweir 	    @param ustrFileURL [in]
1348*cdf0e10cSrcweir 	    Full qualified URL of the file to remove.
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir 	    @return
1351*cdf0e10cSrcweir 	    E_None on success
1352*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1353*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1354*cdf0e10cSrcweir 	    E_ACCES permission denied
1355*cdf0e10cSrcweir 	    E_PERM operation not permitted
1356*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1357*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1358*cdf0e10cSrcweir 	    E_ISDIR is a directory
1359*cdf0e10cSrcweir 	    E_ROFS read-only file system
1360*cdf0e10cSrcweir 	    E_FAULT bad address
1361*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1362*cdf0e10cSrcweir 	    E_IO on I/O errors
1363*cdf0e10cSrcweir 	    E_BUSY device or resource busy
1364*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1365*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1366*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
1367*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1368*cdf0e10cSrcweir 	    E_TXTBSY text file busy
1369*cdf0e10cSrcweir 
1370*cdf0e10cSrcweir 	    @see open()
1371*cdf0e10cSrcweir     */
1372*cdf0e10cSrcweir 
1373*cdf0e10cSrcweir     inline static RC remove( const ::rtl::OUString& ustrFileURL )
1374*cdf0e10cSrcweir 	{
1375*cdf0e10cSrcweir         return (RC) osl_removeFile( ustrFileURL.pData );
1376*cdf0e10cSrcweir 	}
1377*cdf0e10cSrcweir 
1378*cdf0e10cSrcweir 	/**	Set file attributes.
1379*cdf0e10cSrcweir 
1380*cdf0e10cSrcweir 	    @param ustrFileURL [in]
1381*cdf0e10cSrcweir 	    The full qualified file URL.
1382*cdf0e10cSrcweir 
1383*cdf0e10cSrcweir 	    @param uAttributes [in]
1384*cdf0e10cSrcweir 	    Attributes of the file to be set.
1385*cdf0e10cSrcweir 
1386*cdf0e10cSrcweir 	    @return
1387*cdf0e10cSrcweir 	    E_None on success
1388*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir 	    @see FileStatus
1391*cdf0e10cSrcweir     */
1392*cdf0e10cSrcweir 
1393*cdf0e10cSrcweir     inline static RC setAttributes( const ::rtl::OUString& ustrFileURL, sal_uInt64 uAttributes )
1394*cdf0e10cSrcweir 	{
1395*cdf0e10cSrcweir         return (RC) osl_setFileAttributes( ustrFileURL.pData, uAttributes );
1396*cdf0e10cSrcweir 	}
1397*cdf0e10cSrcweir 
1398*cdf0e10cSrcweir 	/**	Set the file time.
1399*cdf0e10cSrcweir 
1400*cdf0e10cSrcweir 	    @param ustrFileURL [in]
1401*cdf0e10cSrcweir 	    The full qualified URL of the file.
1402*cdf0e10cSrcweir 
1403*cdf0e10cSrcweir 	    @param rCreationTime [in]
1404*cdf0e10cSrcweir 	    Creation time of the given file.
1405*cdf0e10cSrcweir 
1406*cdf0e10cSrcweir 	    @param rLastAccessTime [in]
1407*cdf0e10cSrcweir 	    Time of the last access of the given file.
1408*cdf0e10cSrcweir 
1409*cdf0e10cSrcweir 	    @param rLastWriteTime [in]
1410*cdf0e10cSrcweir 	    Time of the last modifying of the given file.
1411*cdf0e10cSrcweir 
1412*cdf0e10cSrcweir 	    @return
1413*cdf0e10cSrcweir 	    E_None on success
1414*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1415*cdf0e10cSrcweir 	    E_NOENT no such file or directory not found
1416*cdf0e10cSrcweir 
1417*cdf0e10cSrcweir 	    @see FileStatus
1418*cdf0e10cSrcweir     */
1419*cdf0e10cSrcweir 
1420*cdf0e10cSrcweir     inline static RC setTime(
1421*cdf0e10cSrcweir 		const ::rtl::OUString& ustrFileURL,
1422*cdf0e10cSrcweir 		const TimeValue& rCreationTime,
1423*cdf0e10cSrcweir 		const TimeValue& rLastAccessTime,
1424*cdf0e10cSrcweir 		const TimeValue& rLastWriteTime )
1425*cdf0e10cSrcweir 	{
1426*cdf0e10cSrcweir         return (RC)  osl_setFileTime(
1427*cdf0e10cSrcweir 			ustrFileURL.pData,
1428*cdf0e10cSrcweir 			&rCreationTime,
1429*cdf0e10cSrcweir 			&rLastAccessTime,
1430*cdf0e10cSrcweir 			&rLastWriteTime );
1431*cdf0e10cSrcweir 	}
1432*cdf0e10cSrcweir 
1433*cdf0e10cSrcweir     friend class DirectoryItem;
1434*cdf0e10cSrcweir };
1435*cdf0e10cSrcweir 
1436*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1437*cdf0e10cSrcweir /** The directory item class object provides access to file status information.
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir     @see FileStatus
1440*cdf0e10cSrcweir  */
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir class DirectoryItem: public FileBase
1443*cdf0e10cSrcweir {
1444*cdf0e10cSrcweir     oslDirectoryItem _pData;
1445*cdf0e10cSrcweir 
1446*cdf0e10cSrcweir public:
1447*cdf0e10cSrcweir 
1448*cdf0e10cSrcweir     /** Constructor.
1449*cdf0e10cSrcweir     */
1450*cdf0e10cSrcweir 
1451*cdf0e10cSrcweir 	DirectoryItem(): _pData( NULL )
1452*cdf0e10cSrcweir 	{
1453*cdf0e10cSrcweir 	}
1454*cdf0e10cSrcweir 
1455*cdf0e10cSrcweir     /** Copy constructor.
1456*cdf0e10cSrcweir     */
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir 	DirectoryItem( const DirectoryItem& rItem ): _pData( rItem._pData)
1459*cdf0e10cSrcweir 	{
1460*cdf0e10cSrcweir 		if( _pData )
1461*cdf0e10cSrcweir             osl_acquireDirectoryItem( _pData );
1462*cdf0e10cSrcweir 	}
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir 	/** Destructor.
1465*cdf0e10cSrcweir 	*/
1466*cdf0e10cSrcweir 
1467*cdf0e10cSrcweir 	~DirectoryItem()
1468*cdf0e10cSrcweir 	{
1469*cdf0e10cSrcweir 		if( _pData )
1470*cdf0e10cSrcweir 			osl_releaseDirectoryItem( _pData );
1471*cdf0e10cSrcweir 	}
1472*cdf0e10cSrcweir 
1473*cdf0e10cSrcweir     /** Assignment operator.
1474*cdf0e10cSrcweir     */
1475*cdf0e10cSrcweir 
1476*cdf0e10cSrcweir 	DirectoryItem& operator=(const DirectoryItem& rItem )
1477*cdf0e10cSrcweir 	{
1478*cdf0e10cSrcweir 	    if (&rItem != this)
1479*cdf0e10cSrcweir 	    {
1480*cdf0e10cSrcweir             if( _pData )
1481*cdf0e10cSrcweir                 osl_releaseDirectoryItem( _pData );
1482*cdf0e10cSrcweir 
1483*cdf0e10cSrcweir             _pData = rItem._pData;
1484*cdf0e10cSrcweir 
1485*cdf0e10cSrcweir             if( _pData )
1486*cdf0e10cSrcweir                 osl_acquireDirectoryItem( _pData );
1487*cdf0e10cSrcweir         }
1488*cdf0e10cSrcweir 		return *this;
1489*cdf0e10cSrcweir     }
1490*cdf0e10cSrcweir 
1491*cdf0e10cSrcweir     /** Check for validity of this instance.
1492*cdf0e10cSrcweir 
1493*cdf0e10cSrcweir         @return
1494*cdf0e10cSrcweir         sal_True if object is valid directory item else sal_False.
1495*cdf0e10cSrcweir      */
1496*cdf0e10cSrcweir 
1497*cdf0e10cSrcweir     inline sal_Bool is()
1498*cdf0e10cSrcweir 	{
1499*cdf0e10cSrcweir         return _pData != NULL;
1500*cdf0e10cSrcweir 	}
1501*cdf0e10cSrcweir 
1502*cdf0e10cSrcweir     /**	Retrieve a single directory item.
1503*cdf0e10cSrcweir 
1504*cdf0e10cSrcweir         Retrieves a single directory item. The returned handle has an initial refcount of 1.
1505*cdf0e10cSrcweir         Due to performance issues it is not recommended to use this function while
1506*cdf0e10cSrcweir         enumerating the contents of a directory. In this case use osl_getNextDirectoryItem() instead.
1507*cdf0e10cSrcweir 
1508*cdf0e10cSrcweir 	    @param ustrFileURL [in]
1509*cdf0e10cSrcweir 	    An absolute file URL.
1510*cdf0e10cSrcweir 
1511*cdf0e10cSrcweir 	    @param rItem [out]
1512*cdf0e10cSrcweir 	    On success it receives a handle which can be used for subsequent calls to osl_getFileStatus().
1513*cdf0e10cSrcweir 	    The handle has to be released by a call to osl_releaseDirectoryItem().
1514*cdf0e10cSrcweir 
1515*cdf0e10cSrcweir 	    @return
1516*cdf0e10cSrcweir 	    E_None on success
1517*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1518*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1519*cdf0e10cSrcweir 	    E_ACCES permission denied
1520*cdf0e10cSrcweir 	    E_MFILE too many open files used by the process
1521*cdf0e10cSrcweir 	    E_NFILE too many open files in the system
1522*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1523*cdf0e10cSrcweir 	    E_LOOP	too many symbolic links encountered
1524*cdf0e10cSrcweir 	    E_NAMETOOLONG the file name is too long
1525*cdf0e10cSrcweir 	    E_NOTDIR a component of the path prefix of path is not a directory
1526*cdf0e10cSrcweir 	    E_IO on I/O errors
1527*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
1528*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1529*cdf0e10cSrcweir 	    E_FAULT bad address
1530*cdf0e10cSrcweir 	    E_INTR the function call was interrupted
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir 	    @see FileStatus
1533*cdf0e10cSrcweir 	    @see Directory::getNextItem()
1534*cdf0e10cSrcweir     */
1535*cdf0e10cSrcweir 
1536*cdf0e10cSrcweir     static inline RC get( const ::rtl::OUString& ustrFileURL, DirectoryItem& rItem )
1537*cdf0e10cSrcweir 	{
1538*cdf0e10cSrcweir         if( rItem._pData)
1539*cdf0e10cSrcweir         {
1540*cdf0e10cSrcweir 			osl_releaseDirectoryItem( rItem._pData );
1541*cdf0e10cSrcweir             rItem._pData = NULL;
1542*cdf0e10cSrcweir         }
1543*cdf0e10cSrcweir 
1544*cdf0e10cSrcweir 		return (RC) osl_getDirectoryItem( ustrFileURL.pData, &rItem._pData );
1545*cdf0e10cSrcweir 	}
1546*cdf0e10cSrcweir 
1547*cdf0e10cSrcweir 	/**	Retrieve information about a single file or directory.
1548*cdf0e10cSrcweir 
1549*cdf0e10cSrcweir 	    @param	rStatus [in|out]
1550*cdf0e10cSrcweir 	    Reference to a class which receives the information of the file or directory
1551*cdf0e10cSrcweir 	    represented by this directory item.
1552*cdf0e10cSrcweir 
1553*cdf0e10cSrcweir 	    @return
1554*cdf0e10cSrcweir 	    E_None on success
1555*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1556*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1557*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1558*cdf0e10cSrcweir 	    E_ACCES permission denied
1559*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1560*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1561*cdf0e10cSrcweir 	    E_BADF invalid oslDirectoryItem parameter
1562*cdf0e10cSrcweir 	    E_FAULT bad address
1563*cdf0e10cSrcweir 	    E_OVERFLOW value too large for defined data type
1564*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1565*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1566*cdf0e10cSrcweir 	    E_MULTIHOP components of path require hopping to multiple remote machines and the file system does not allow it
1567*cdf0e10cSrcweir 	    E_MFILE too many open files used by the process
1568*cdf0e10cSrcweir 	    E_NFILE too many open files in the system
1569*cdf0e10cSrcweir 	    E_NOSPC no space left on device
1570*cdf0e10cSrcweir 	    E_NXIO no such device or address
1571*cdf0e10cSrcweir 	    E_IO on I/O errors
1572*cdf0e10cSrcweir 	    E_NOSYS function not implemented
1573*cdf0e10cSrcweir 
1574*cdf0e10cSrcweir 	    @see get()
1575*cdf0e10cSrcweir 	    @see Directory::getNextItem()
1576*cdf0e10cSrcweir 	    @see FileStatus
1577*cdf0e10cSrcweir     */
1578*cdf0e10cSrcweir 
1579*cdf0e10cSrcweir     inline RC getFileStatus( FileStatus& rStatus )
1580*cdf0e10cSrcweir 	{
1581*cdf0e10cSrcweir 		return (RC) osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask );
1582*cdf0e10cSrcweir 	}
1583*cdf0e10cSrcweir 
1584*cdf0e10cSrcweir     friend class Directory;
1585*cdf0e10cSrcweir };
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir //###########################################
1588*cdf0e10cSrcweir 
1589*cdf0e10cSrcweir /** Base class for observers of directory creation notifications.
1590*cdf0e10cSrcweir 
1591*cdf0e10cSrcweir     Clients which uses the method createDirectoryPath of the class
1592*cdf0e10cSrcweir     Directory may want to be informed about the directories that
1593*cdf0e10cSrcweir     have been created. This may be accomplished by deriving from
1594*cdf0e10cSrcweir     this base class and overwriting the virtual function
1595*cdf0e10cSrcweir     DirectoryCreated.
1596*cdf0e10cSrcweir 
1597*cdf0e10cSrcweir     @see Directory::createPath
1598*cdf0e10cSrcweir */
1599*cdf0e10cSrcweir class DirectoryCreationObserver
1600*cdf0e10cSrcweir {
1601*cdf0e10cSrcweir public:
1602*cdf0e10cSrcweir     virtual ~DirectoryCreationObserver() {};
1603*cdf0e10cSrcweir 
1604*cdf0e10cSrcweir     /** This method will be called when a new directory has been
1605*cdf0e10cSrcweir         created and needs to be overwritten by derived classes.
1606*cdf0e10cSrcweir         You must not delete the directory that was just created
1607*cdf0e10cSrcweir         otherwise you will run into an endless loop.
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir         @param aDirectoryUrl
1610*cdf0e10cSrcweir         [in]The absolute file URL of the directory that was just created by
1611*cdf0e10cSrcweir         ::osl::Directory::createPath.
1612*cdf0e10cSrcweir     */
1613*cdf0e10cSrcweir     virtual void DirectoryCreated(const rtl::OUString& aDirectoryUrl) = 0;
1614*cdf0e10cSrcweir };
1615*cdf0e10cSrcweir 
1616*cdf0e10cSrcweir //###########################################
1617*cdf0e10cSrcweir // This just an internal helper function for
1618*cdf0e10cSrcweir // private use.
1619*cdf0e10cSrcweir extern "C" inline void SAL_CALL onDirectoryCreated(void* pData, rtl_uString* aDirectoryUrl)
1620*cdf0e10cSrcweir {
1621*cdf0e10cSrcweir     (static_cast<DirectoryCreationObserver*>(pData))->DirectoryCreated(aDirectoryUrl);
1622*cdf0e10cSrcweir }
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir /** The directory class object provides a enumeration of DirectoryItems.
1625*cdf0e10cSrcweir 
1626*cdf0e10cSrcweir     @see DirectoryItem
1627*cdf0e10cSrcweir     @see File
1628*cdf0e10cSrcweir  */
1629*cdf0e10cSrcweir 
1630*cdf0e10cSrcweir class Directory: public FileBase
1631*cdf0e10cSrcweir {
1632*cdf0e10cSrcweir     oslDirectory    _pData;
1633*cdf0e10cSrcweir 	::rtl::OUString _aPath;
1634*cdf0e10cSrcweir 
1635*cdf0e10cSrcweir     /** Copy constructor.
1636*cdf0e10cSrcweir     */
1637*cdf0e10cSrcweir 
1638*cdf0e10cSrcweir 	Directory( Directory& );
1639*cdf0e10cSrcweir 
1640*cdf0e10cSrcweir 	/**  Assignment operator.
1641*cdf0e10cSrcweir 	*/
1642*cdf0e10cSrcweir 
1643*cdf0e10cSrcweir 	Directory& operator = ( Directory& );
1644*cdf0e10cSrcweir 
1645*cdf0e10cSrcweir public:
1646*cdf0e10cSrcweir 
1647*cdf0e10cSrcweir     /** Constructor.
1648*cdf0e10cSrcweir 
1649*cdf0e10cSrcweir 	    @param strPath [in]
1650*cdf0e10cSrcweir 	    The full qualified URL of the directory.
1651*cdf0e10cSrcweir 	    Relative URLs are not allowed.
1652*cdf0e10cSrcweir      */
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir 	Directory( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath )
1655*cdf0e10cSrcweir 	{
1656*cdf0e10cSrcweir 	}
1657*cdf0e10cSrcweir 
1658*cdf0e10cSrcweir     /** Destructor.
1659*cdf0e10cSrcweir     */
1660*cdf0e10cSrcweir 
1661*cdf0e10cSrcweir     ~Directory()
1662*cdf0e10cSrcweir 	{
1663*cdf0e10cSrcweir 		close();
1664*cdf0e10cSrcweir 	}
1665*cdf0e10cSrcweir 
1666*cdf0e10cSrcweir     /** Open a directory for enumerating its contents.
1667*cdf0e10cSrcweir 
1668*cdf0e10cSrcweir 	    @return
1669*cdf0e10cSrcweir 	    E_None on success
1670*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1671*cdf0e10cSrcweir 	    E_NOENT the specified path doesn't exist
1672*cdf0e10cSrcweir 	    E_NOTDIR the specified path is not an directory
1673*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1674*cdf0e10cSrcweir 	    E_ACCES permission denied
1675*cdf0e10cSrcweir 	    E_MFILE too many open files used by the process
1676*cdf0e10cSrcweir 	    E_NFILE too many open files in the system
1677*cdf0e10cSrcweir 	    E_NAMETOOLONG File name too long
1678*cdf0e10cSrcweir 	    E_LOOP Too many symbolic links encountered
1679*cdf0e10cSrcweir 
1680*cdf0e10cSrcweir 	    @see getNextItem()
1681*cdf0e10cSrcweir 	    @see close()
1682*cdf0e10cSrcweir     */
1683*cdf0e10cSrcweir 
1684*cdf0e10cSrcweir     inline RC open()
1685*cdf0e10cSrcweir 	{
1686*cdf0e10cSrcweir         return (RC) osl_openDirectory( _aPath.pData, &_pData );
1687*cdf0e10cSrcweir 	}
1688*cdf0e10cSrcweir 
1689*cdf0e10cSrcweir     /** Query if directory is open.
1690*cdf0e10cSrcweir 
1691*cdf0e10cSrcweir         Query if directory is open and so item enumeration is valid.
1692*cdf0e10cSrcweir 
1693*cdf0e10cSrcweir         @return
1694*cdf0e10cSrcweir         sal_True if the directory is open else sal_False.
1695*cdf0e10cSrcweir 
1696*cdf0e10cSrcweir         @see open()
1697*cdf0e10cSrcweir         @see close()
1698*cdf0e10cSrcweir     */
1699*cdf0e10cSrcweir 
1700*cdf0e10cSrcweir 	inline sal_Bool isOpen() { return _pData != NULL; };
1701*cdf0e10cSrcweir 
1702*cdf0e10cSrcweir 	/**	Close a directory.
1703*cdf0e10cSrcweir 
1704*cdf0e10cSrcweir  	    @return
1705*cdf0e10cSrcweir 	    E_None on success
1706*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1707*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1708*cdf0e10cSrcweir 	    E_BADF invalid oslDirectory parameter
1709*cdf0e10cSrcweir 	    E_INTR the function call was interrupted
1710*cdf0e10cSrcweir 
1711*cdf0e10cSrcweir 	    @see open()
1712*cdf0e10cSrcweir 	*/
1713*cdf0e10cSrcweir 
1714*cdf0e10cSrcweir     inline RC close()
1715*cdf0e10cSrcweir 	{
1716*cdf0e10cSrcweir         oslFileError Error = osl_File_E_BADF;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir         if( _pData )
1719*cdf0e10cSrcweir 		{
1720*cdf0e10cSrcweir 			Error=osl_closeDirectory( _pData );
1721*cdf0e10cSrcweir             _pData = NULL;
1722*cdf0e10cSrcweir 		}
1723*cdf0e10cSrcweir 
1724*cdf0e10cSrcweir 		return (RC) Error;
1725*cdf0e10cSrcweir 	}
1726*cdf0e10cSrcweir 
1727*cdf0e10cSrcweir 
1728*cdf0e10cSrcweir     /** Resets the directory item enumeration to the beginning.
1729*cdf0e10cSrcweir 
1730*cdf0e10cSrcweir         @return
1731*cdf0e10cSrcweir         E_None on success
1732*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1733*cdf0e10cSrcweir 	    E_NOENT the specified path doesn't exist
1734*cdf0e10cSrcweir 	    E_NOTDIR the specified path is not an directory
1735*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1736*cdf0e10cSrcweir 	    E_ACCES permission denied
1737*cdf0e10cSrcweir 	    E_MFILE too many open files used by the process
1738*cdf0e10cSrcweir 	    E_NFILE too many open files in the system
1739*cdf0e10cSrcweir 	    E_NAMETOOLONG File name too long
1740*cdf0e10cSrcweir 	    E_LOOP Too many symbolic links encountered
1741*cdf0e10cSrcweir 
1742*cdf0e10cSrcweir         @see open()
1743*cdf0e10cSrcweir     */
1744*cdf0e10cSrcweir 
1745*cdf0e10cSrcweir     inline RC reset()
1746*cdf0e10cSrcweir 	{
1747*cdf0e10cSrcweir         close();
1748*cdf0e10cSrcweir         return open();
1749*cdf0e10cSrcweir 	}
1750*cdf0e10cSrcweir 
1751*cdf0e10cSrcweir 	/**	Retrieve the next item of a previously opened directory.
1752*cdf0e10cSrcweir 
1753*cdf0e10cSrcweir         Retrieves the next item of a previously opened directory.
1754*cdf0e10cSrcweir 
1755*cdf0e10cSrcweir 	    @param	rItem [out]
1756*cdf0e10cSrcweir 	    On success a valid DirectoryItem.
1757*cdf0e10cSrcweir 
1758*cdf0e10cSrcweir 	    @param	nHint [in]
1759*cdf0e10cSrcweir 	    With this parameter the caller can tell the implementation that (s)he
1760*cdf0e10cSrcweir         is going to call this function uHint times afterwards. This enables the implementation to
1761*cdf0e10cSrcweir         get the information for more than one file and cache it until the next calls.
1762*cdf0e10cSrcweir 
1763*cdf0e10cSrcweir 	    @return
1764*cdf0e10cSrcweir 	    E_None on success
1765*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1766*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1767*cdf0e10cSrcweir 	    E_NOENT no more entries in this directory
1768*cdf0e10cSrcweir 	    E_BADF invalid oslDirectory parameter
1769*cdf0e10cSrcweir 	    E_OVERFLOW the value too large for defined data type
1770*cdf0e10cSrcweir 
1771*cdf0e10cSrcweir 	    @see DirectoryItem
1772*cdf0e10cSrcweir     */
1773*cdf0e10cSrcweir 
1774*cdf0e10cSrcweir     inline RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
1775*cdf0e10cSrcweir 	{
1776*cdf0e10cSrcweir         if( rItem._pData )
1777*cdf0e10cSrcweir         {
1778*cdf0e10cSrcweir             osl_releaseDirectoryItem( rItem._pData );
1779*cdf0e10cSrcweir             rItem._pData = 0;
1780*cdf0e10cSrcweir         }
1781*cdf0e10cSrcweir 		return ( RC) osl_getNextDirectoryItem( _pData, &rItem._pData, nHint );
1782*cdf0e10cSrcweir 	}
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir 
1785*cdf0e10cSrcweir 	/** Retrieve information about a volume.
1786*cdf0e10cSrcweir 
1787*cdf0e10cSrcweir         Retrieves information about a volume. A volume can either be a mount point, a network
1788*cdf0e10cSrcweir 	    resource or a drive depending on Operating System and File System.
1789*cdf0e10cSrcweir 
1790*cdf0e10cSrcweir 	    @param ustrDirectoryURL [in]
1791*cdf0e10cSrcweir 	    Full qualified URL of the volume
1792*cdf0e10cSrcweir 
1793*cdf0e10cSrcweir 	    @param rInfo [out]
1794*cdf0e10cSrcweir 	    On success it receives information about the volume.
1795*cdf0e10cSrcweir 
1796*cdf0e10cSrcweir 	    @return
1797*cdf0e10cSrcweir 	    E_None on success
1798*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1799*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1800*cdf0e10cSrcweir 	    E_NOTDIR not a directory
1801*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1802*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1803*cdf0e10cSrcweir 	    E_ACCES permission denied
1804*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1805*cdf0e10cSrcweir 	    E_FAULT Bad address
1806*cdf0e10cSrcweir 	    E_IO on I/O errors
1807*cdf0e10cSrcweir 	    E_NOSYS function not implemented
1808*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
1809*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1810*cdf0e10cSrcweir 	    E_INTR function call was interrupted
1811*cdf0e10cSrcweir 
1812*cdf0e10cSrcweir 	    @see FileStatus
1813*cdf0e10cSrcweir 	    @see VolumeInfo
1814*cdf0e10cSrcweir     */
1815*cdf0e10cSrcweir 
1816*cdf0e10cSrcweir     inline static RC getVolumeInfo( const ::rtl::OUString& ustrDirectoryURL, VolumeInfo& rInfo )
1817*cdf0e10cSrcweir 	{
1818*cdf0e10cSrcweir         return (RC) osl_getVolumeInformation( ustrDirectoryURL.pData, &rInfo._aInfo, rInfo._nMask );
1819*cdf0e10cSrcweir 	}
1820*cdf0e10cSrcweir 
1821*cdf0e10cSrcweir     /**	Create a directory.
1822*cdf0e10cSrcweir 
1823*cdf0e10cSrcweir 	    @param ustrDirectoryURL [in]
1824*cdf0e10cSrcweir 	    Full qualified URL of the directory to create.
1825*cdf0e10cSrcweir 
1826*cdf0e10cSrcweir 	    @return
1827*cdf0e10cSrcweir 	    E_None on success
1828*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1829*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1830*cdf0e10cSrcweir 	    E_EXIST file exists
1831*cdf0e10cSrcweir 	    E_ACCES permission denied
1832*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1833*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1834*cdf0e10cSrcweir 	    E_NOTDIR not a directory
1835*cdf0e10cSrcweir 	    E_ROFS read-only file system
1836*cdf0e10cSrcweir 	    E_NOSPC no space left on device
1837*cdf0e10cSrcweir 	    E_DQUOT quota exceeded
1838*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1839*cdf0e10cSrcweir 	    E_FAULT bad address
1840*cdf0e10cSrcweir 	    E_IO on I/O errors
1841*cdf0e10cSrcweir 	    E_MLINK too many links
1842*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
1843*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1844*cdf0e10cSrcweir 
1845*cdf0e10cSrcweir 	    @see remove()
1846*cdf0e10cSrcweir     */
1847*cdf0e10cSrcweir 
1848*cdf0e10cSrcweir 	inline static RC create( const ::rtl::OUString& ustrDirectoryURL )
1849*cdf0e10cSrcweir 	{
1850*cdf0e10cSrcweir         return (RC) osl_createDirectory( ustrDirectoryURL.pData );
1851*cdf0e10cSrcweir 	}
1852*cdf0e10cSrcweir 
1853*cdf0e10cSrcweir 	/**	Remove an empty directory.
1854*cdf0e10cSrcweir 
1855*cdf0e10cSrcweir 	    @param ustrDirectoryURL [in]
1856*cdf0e10cSrcweir 	    Full qualified URL of the directory.
1857*cdf0e10cSrcweir 
1858*cdf0e10cSrcweir 	    @return
1859*cdf0e10cSrcweir 	    E_None on success
1860*cdf0e10cSrcweir 	    E_INVAL the format of the parameters was not valid
1861*cdf0e10cSrcweir 	    E_NOMEM not enough memory for allocating structures
1862*cdf0e10cSrcweir 	    E_PERM operation not permitted
1863*cdf0e10cSrcweir 	    E_ACCES permission denied
1864*cdf0e10cSrcweir 	    E_NOENT no such file or directory
1865*cdf0e10cSrcweir 	    E_NOTDIR not a directory
1866*cdf0e10cSrcweir 	    E_NOTEMPTY directory not empty
1867*cdf0e10cSrcweir 	    E_FAULT bad address
1868*cdf0e10cSrcweir 	    E_NAMETOOLONG file name too long
1869*cdf0e10cSrcweir 	    E_BUSY device or resource busy
1870*cdf0e10cSrcweir 	    E_ROFS read-only file system
1871*cdf0e10cSrcweir 	    E_LOOP too many symbolic links encountered
1872*cdf0e10cSrcweir 	    E_BUSY device or resource busy
1873*cdf0e10cSrcweir 	    E_EXIST file exists
1874*cdf0e10cSrcweir 	    E_IO on I/O errors
1875*cdf0e10cSrcweir 	    E_MULTIHOP multihop attempted
1876*cdf0e10cSrcweir 	    E_NOLINK link has been severed
1877*cdf0e10cSrcweir 
1878*cdf0e10cSrcweir 	    @see create()
1879*cdf0e10cSrcweir     */
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir 	inline static RC remove( const ::rtl::OUString& ustrDirectoryURL )
1882*cdf0e10cSrcweir 	{
1883*cdf0e10cSrcweir         return (RC) osl_removeDirectory( ustrDirectoryURL.pData );
1884*cdf0e10cSrcweir 	}
1885*cdf0e10cSrcweir 
1886*cdf0e10cSrcweir     /** Create a directory path.
1887*cdf0e10cSrcweir 
1888*cdf0e10cSrcweir         The osl_createDirectoryPath function creates a specified directory path.
1889*cdf0e10cSrcweir         All nonexisting sub directories will be created.
1890*cdf0e10cSrcweir         <p><strong>PLEASE NOTE:</strong> You cannot rely on getting the error code
1891*cdf0e10cSrcweir 		E_EXIST for existing directories. Programming against this error code is
1892*cdf0e10cSrcweir 		in general a strong indication of a wrong usage of osl_createDirectoryPath.</p>
1893*cdf0e10cSrcweir 
1894*cdf0e10cSrcweir         @param aDirectoryUrl
1895*cdf0e10cSrcweir         [in] The absolute file URL of the directory path to create.
1896*cdf0e10cSrcweir         A relative file URL will not be accepted.
1897*cdf0e10cSrcweir 
1898*cdf0e10cSrcweir         @param aDirectoryCreationObserver
1899*cdf0e10cSrcweir         [in] Pointer to an instance of type DirectoryCreationObserver that will
1900*cdf0e10cSrcweir         be informed about the creation of a directory. The value of this
1901*cdf0e10cSrcweir         parameter may be NULL, in this case notifications will not be sent.
1902*cdf0e10cSrcweir 
1903*cdf0e10cSrcweir         @return
1904*cdf0e10cSrcweir         <dl>
1905*cdf0e10cSrcweir         <dt>E_None</dt>
1906*cdf0e10cSrcweir         <dd>On success</dd>
1907*cdf0e10cSrcweir         <dt>E_INVAL</dt>
1908*cdf0e10cSrcweir         <dd>The format of the parameters was not valid</dd>
1909*cdf0e10cSrcweir         <dt>E_ACCES</dt>
1910*cdf0e10cSrcweir         <dd>Permission denied</dd>
1911*cdf0e10cSrcweir         <dt>E_EXIST</dt>
1912*cdf0e10cSrcweir         <dd>The final node of the specified directory path already exist</dd>
1913*cdf0e10cSrcweir         <dt>E_NAMETOOLONG</dt>
1914*cdf0e10cSrcweir         <dd>The name of the specified directory path exceeds the maximum allowed length</dd>
1915*cdf0e10cSrcweir         <dt>E_NOTDIR</dt>
1916*cdf0e10cSrcweir         <dd>A component of the specified directory path already exist as file in any part of the directory path</dd>
1917*cdf0e10cSrcweir         <dt>E_ROFS</dt>
1918*cdf0e10cSrcweir         <dd>Read-only file system</dd>
1919*cdf0e10cSrcweir 	    <dt>E_NOSPC</dt>
1920*cdf0e10cSrcweir 	    <dd>No space left on device</dd>
1921*cdf0e10cSrcweir 	    <dt>E_DQUOT</dt>
1922*cdf0e10cSrcweir 	    <dd>Quota exceeded</dd>
1923*cdf0e10cSrcweir 	    <dt>E_FAULT</dt>
1924*cdf0e10cSrcweir 	    <dd>Bad address</dd>
1925*cdf0e10cSrcweir 	    <dt>E_IO</dt>
1926*cdf0e10cSrcweir 	    <dd>I/O error</dd>
1927*cdf0e10cSrcweir 	    <dt>E_LOOP</dt>
1928*cdf0e10cSrcweir 	    <dd>Too many symbolic links encountered</dd>
1929*cdf0e10cSrcweir         <dt>E_NOLINK</dt>
1930*cdf0e10cSrcweir         <dd>Link has been severed</dd>
1931*cdf0e10cSrcweir         <dt>E_invalidError</dt>
1932*cdf0e10cSrcweir         <dd>An unknown error occurred</dd>
1933*cdf0e10cSrcweir 	    </dl>
1934*cdf0e10cSrcweir 
1935*cdf0e10cSrcweir 	    @see DirectoryCreationObserver
1936*cdf0e10cSrcweir 	    @see create
1937*cdf0e10cSrcweir 	*/
1938*cdf0e10cSrcweir 	static RC createPath(
1939*cdf0e10cSrcweir 	    const ::rtl::OUString& aDirectoryUrl,
1940*cdf0e10cSrcweir 	    DirectoryCreationObserver* aDirectoryCreationObserver = NULL)
1941*cdf0e10cSrcweir 	{
1942*cdf0e10cSrcweir 	    return (RC)osl_createDirectoryPath(
1943*cdf0e10cSrcweir 	        aDirectoryUrl.pData,
1944*cdf0e10cSrcweir 	        (aDirectoryCreationObserver) ? onDirectoryCreated : NULL,
1945*cdf0e10cSrcweir 	        aDirectoryCreationObserver);
1946*cdf0e10cSrcweir 	}
1947*cdf0e10cSrcweir };
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir } /* namespace osl */
1950*cdf0e10cSrcweir 
1951*cdf0e10cSrcweir #endif  /* __cplusplus */
1952*cdf0e10cSrcweir #endif	/* _OSL_FILE_HXX_ */
1953*cdf0e10cSrcweir 
1954