merge the formfield patch from ooo-build
[ooovba.git] / sal / osl / os2 / file_url.h
blob91536c0315455069b6d628e80e4ff067846ca473
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: file_url.h,v $
10 * $Revision: 1.5 $
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 **************************************************/
37 #ifndef _FILE_URL_H_
38 #define _FILE_URL_H_
40 #ifndef _FILE_H_
41 #include <osl/file.h>
42 #endif
45 /***************************************************
46 * constants
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 ) )
61 #else
62 #define OSL_ENSURE_FILE( cond, msg, file ) ((void)0)
63 #endif
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;
71 #define WINAPI
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
97 typedef struct {
98 UINT uType;
99 rtl_uString* ustrDrive;
100 rtl_uString* ustrFilePath; /* holds native directory path */
101 int d_attr; /* OS/2 file attributes */
102 int nRefCount;
103 }DirectoryItem_Impl;
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
114 typedef struct
116 UINT uType;
117 rtl_uString* ustrPath; /* holds native directory path */
118 DIR* pDirStruct;
119 ULONG ulDriveMap;
120 ULONG ulNextDrive;
121 ULONG ulNextDriveMask;
122 } DirectoryImpl;
124 /* Different types of paths */
125 typedef enum _PATHTYPE
127 PATHTYPE_SYNTAXERROR = 0,
128 PATHTYPE_NETROOT,
129 PATHTYPE_NETSERVER,
130 PATHTYPE_VOLUME,
131 PATHTYPE_FILE
132 } PATHTYPE;
134 DWORD WINAPI IsValidFilePath(LPCTSTR, LPCTSTR*, DWORD);
136 typedef struct
138 rtl_uString* ustrFilePath; /* holds native file path */
139 int fd;
140 sal_Bool bLocked;
141 } oslFileHandleImpl;
144 typedef struct _oslVolumeDeviceHandleImpl
146 sal_Char pszMountPoint[PATH_MAX];
147 sal_Char pszFilePath[PATH_MAX];
148 sal_Char pszDevice[PATH_MAX];
149 sal_Char ident[4];
150 sal_uInt32 RefCount;
151 } oslVolumeDeviceHandleImpl;
153 /* OS error to errno values mapping table */
154 struct errentry {
155 unsigned long oscode; /* OS return value */
156 int errnocode; /* System V error code */
159 #ifdef __cplusplus
160 extern "C"
162 #endif
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 /**************************************************
174 * FileURLToPath
175 *************************************************/
177 oslFileError FileURLToPath(char * buffer, size_t bufLen, rtl_uString* ustrFileURL);
180 #ifdef __cplusplus
182 #endif
185 #endif /* #define _FILE_URL_H_ */