1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: file_url.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /***************************************************
32 * Internal header file, declares all functions
33 * that are not part of the offical API and are
34 * not defined in the osl header files
35 **************************************************/
45 /***************************************************
47 **************************************************/
49 #define _tcslen(a) wcslen((const wchar_t *) a)
50 #define _tcsspn(a,b) wcsspn((const wchar_t *) a, (const wchar_t *) b)
51 #define _istalpha(a) iswalpha((wint_t) a)
53 const sal_Unicode UNICHAR_SLASH
= ((sal_Unicode
)'/');
54 const sal_Unicode UNICHAR_COLON
= ((sal_Unicode
)':');
55 const sal_Unicode UNICHAR_DOT
= ((sal_Unicode
)'.');
57 #define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
59 #if OSL_DEBUG_LEVEL > 0
60 #define OSL_ENSURE_FILE( cond, msg, file ) ( (cond) ? (void)0 : _osl_warnFile( msg, file ) )
62 #define OSL_ENSURE_FILE( cond, msg, file ) ((void)0)
65 typedef sal_Unicode TCHAR
;
66 typedef sal_Unicode
*LPTSTR
;
67 typedef const sal_Unicode
*LPCTSTR
;
68 typedef wchar_t *LPWSTR
;
69 typedef const wchar_t *LPCWSTR
;
70 typedef sal_Unicode DWORD
;
73 #define CHARSET_SEPARATOR L"\\/"
74 #define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
77 /******************************************************************************
79 * Data Type Definition
81 ******************************************************************************/
83 #define PATHTYPE_ERROR 0
84 #define PATHTYPE_RELATIVE 1
85 #define PATHTYPE_ABSOLUTE_UNC 2
86 #define PATHTYPE_ABSOLUTE_LOCAL 3
87 #define PATHTYPE_MASK_TYPE 0xFF
88 #define PATHTYPE_IS_VOLUME 0x0100
89 #define PATHTYPE_IS_SERVER 0x0200
91 #define VALIDATEPATH_NORMAL 0x0000
92 #define VALIDATEPATH_ALLOW_WILDCARDS 0x0001
93 #define VALIDATEPATH_ALLOW_ELLIPSE 0x0002
94 #define VALIDATEPATH_ALLOW_RELATIVE 0x0004
95 #define VALIDATEPATH_ALLOW_UNC 0x0008
99 rtl_uString
* ustrDrive
;
100 rtl_uString
* ustrFilePath
; /* holds native directory path */
101 int d_attr
; /* OS/2 file attributes */
105 #define DIRECTORYTYPE_LOCALROOT 0
106 #define DIRECTORYTYPE_NETROOT 1
107 #define DIRECTORYTYPE_NETRESORCE 2
108 #define DIRECTORYTYPE_FILESYSTEM 3
110 #define DIRECTORYITEM_DRIVE 0
111 #define DIRECTORYITEM_FILE 1
112 #define DIRECTORYITEM_SERVER 2
117 rtl_uString
* ustrPath
; /* holds native directory path */
121 ULONG ulNextDriveMask
;
124 /* Different types of paths */
125 typedef enum _PATHTYPE
127 PATHTYPE_SYNTAXERROR
= 0,
134 DWORD WINAPI
IsValidFilePath(LPCTSTR
, LPCTSTR
*, DWORD
);
138 rtl_uString
* ustrFilePath
; /* holds native file path */
144 typedef struct _oslVolumeDeviceHandleImpl
146 sal_Char pszMountPoint
[PATH_MAX
];
147 sal_Char pszFilePath
[PATH_MAX
];
148 sal_Char pszDevice
[PATH_MAX
];
151 } oslVolumeDeviceHandleImpl
;
153 /* OS error to errno values mapping table */
155 unsigned long oscode
; /* OS return value */
156 int errnocode
; /* System V error code */
164 /**************************************************
165 * _osl_getSystemPathFromFileURL
166 *************************************************/
168 #define FURL_ALLOW_RELATIVE sal_True
169 #define FURL_DENY_RELATIVE sal_False
171 oslFileError
osl_getSystemPathFromFileURL_Ex(rtl_uString
*ustrFileURL
, rtl_uString
**pustrSystemPath
, sal_Bool bAllowRelative
);
173 /**************************************************
175 *************************************************/
177 oslFileError
FileURLToPath(char * buffer
, size_t bufLen
, rtl_uString
* ustrFileURL
);
185 #endif /* #define _FILE_URL_H_ */