merged tag ooo/DEV300_m102
[LibreOffice.git] / sal / osl / os2 / file_url.h
blob052858503b245834c74e7e382a6d8e535874fa13
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 /***************************************************
29 * Internal header file, declares all functions
30 * that are not part of the offical API and are
31 * not defined in the osl header files
32 **************************************************/
34 #ifndef _FILE_URL_H_
35 #define _FILE_URL_H_
37 #ifndef _FILE_H_
38 #include <osl/file.h>
39 #endif
42 /***************************************************
43 * constants
44 **************************************************/
46 #define _tcslen(a) wcslen((const wchar_t *) a)
47 #define _tcsspn(a,b) wcsspn((const wchar_t *) a, (const wchar_t *) b)
48 #define _istalpha(a) iswalpha((wint_t) a)
50 const sal_Unicode UNICHAR_SLASH = ((sal_Unicode)'/');
51 const sal_Unicode UNICHAR_COLON = ((sal_Unicode)':');
52 const sal_Unicode UNICHAR_DOT = ((sal_Unicode)'.');
54 #define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
56 #if OSL_DEBUG_LEVEL > 0
57 #define OSL_ENSURE_FILE( cond, msg, file ) ( (cond) ? (void)0 : _osl_warnFile( msg, file ) )
58 #else
59 #define OSL_ENSURE_FILE( cond, msg, file ) ((void)0)
60 #endif
62 typedef sal_Unicode TCHAR;
63 typedef sal_Unicode *LPTSTR;
64 typedef const sal_Unicode *LPCTSTR;
65 typedef wchar_t *LPWSTR;
66 typedef const wchar_t *LPCWSTR;
67 typedef sal_Unicode DWORD;
68 #define WINAPI
70 #define CHARSET_SEPARATOR L"\\/"
71 #define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
74 /******************************************************************************
76 * Data Type Definition
78 ******************************************************************************/
80 #define PATHTYPE_ERROR 0
81 #define PATHTYPE_RELATIVE 1
82 #define PATHTYPE_ABSOLUTE_UNC 2
83 #define PATHTYPE_ABSOLUTE_LOCAL 3
84 #define PATHTYPE_MASK_TYPE 0xFF
85 #define PATHTYPE_IS_VOLUME 0x0100
86 #define PATHTYPE_IS_SERVER 0x0200
88 #define VALIDATEPATH_NORMAL 0x0000
89 #define VALIDATEPATH_ALLOW_WILDCARDS 0x0001
90 #define VALIDATEPATH_ALLOW_ELLIPSE 0x0002
91 #define VALIDATEPATH_ALLOW_RELATIVE 0x0004
92 #define VALIDATEPATH_ALLOW_UNC 0x0008
94 typedef struct {
95 UINT uType;
96 rtl_uString* ustrDrive;
97 rtl_uString* ustrFilePath; /* holds native directory path */
98 int d_attr; /* OS/2 file attributes */
99 int nRefCount;
100 }DirectoryItem_Impl;
102 #define DIRECTORYTYPE_LOCALROOT 0
103 #define DIRECTORYTYPE_NETROOT 1
104 #define DIRECTORYTYPE_NETRESORCE 2
105 #define DIRECTORYTYPE_FILESYSTEM 3
107 #define DIRECTORYITEM_DRIVE 0
108 #define DIRECTORYITEM_FILE 1
109 #define DIRECTORYITEM_SERVER 2
111 typedef struct
113 UINT uType;
114 rtl_uString* ustrPath; /* holds native directory path */
115 DIR* pDirStruct;
116 ULONG ulDriveMap;
117 ULONG ulNextDrive;
118 ULONG ulNextDriveMask;
119 } DirectoryImpl;
121 /* Different types of paths */
122 typedef enum _PATHTYPE
124 PATHTYPE_SYNTAXERROR = 0,
125 PATHTYPE_NETROOT,
126 PATHTYPE_NETSERVER,
127 PATHTYPE_VOLUME,
128 PATHTYPE_FILE
129 } PATHTYPE;
131 DWORD WINAPI IsValidFilePath(LPCTSTR, LPCTSTR*, DWORD);
133 typedef struct
135 rtl_uString* ustrFilePath; /* holds native file path */
136 int fd;
137 sal_Bool bLocked;
138 } oslFileHandleImpl;
141 typedef struct _oslVolumeDeviceHandleImpl
143 sal_Char pszMountPoint[PATH_MAX];
144 sal_Char pszFilePath[PATH_MAX];
145 sal_Char pszDevice[PATH_MAX];
146 sal_Char ident[4];
147 sal_uInt32 RefCount;
148 } oslVolumeDeviceHandleImpl;
150 /* OS error to errno values mapping table */
151 struct errentry {
152 unsigned long oscode; /* OS return value */
153 int errnocode; /* System V error code */
156 #ifdef __cplusplus
157 extern "C"
159 #endif
161 /**************************************************
162 * _osl_getSystemPathFromFileURL
163 *************************************************/
165 #define FURL_ALLOW_RELATIVE sal_True
166 #define FURL_DENY_RELATIVE sal_False
168 oslFileError osl_getSystemPathFromFileURL_Ex(rtl_uString *ustrFileURL, rtl_uString **pustrSystemPath, sal_Bool bAllowRelative);
170 /**************************************************
171 * FileURLToPath
172 *************************************************/
174 oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL);
177 #ifdef __cplusplus
179 #endif
182 #endif /* #define _FILE_URL_H_ */