Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / errcode.hxx
blob22ab86fbf22ce9d2600fe7730cc794791a59d7f5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_ERRCODE_HXX
21 #define INCLUDED_VCL_ERRCODE_HXX
23 #ifndef __RSC
24 #include <tools/solar.h>
25 #define CAST_TO_UINT32(a) ((sal_uInt32)(a))
26 #else
27 #define CAST_TO_UINT32(a) (a)
28 #endif
32 01234567012345670123456701234567
33 || || ||| || |
34 Warning || || |
35 | || || || |
36 Dynamic || || |
37 | || || |
38 Subsystemarea| || |
39 | || |
40 | || |
41 | || |
42 Class| |
43 | |
44 | |
45 | |
46 Code
49 #define ERRCODE_ERROR_MASK 0x3fffffffUL
50 #define ERRCODE_WARNING_MASK 0x80000000UL
51 #define ERRCODE_RES_MASK 0x7fff
53 #define ERRCODE_CLASS_SHIFT 8
54 #define ERRCODE_AREA_SHIFT 13
55 #define ERRCODE_DYNAMIC_SHIFT 26
57 #define ERRCODE_CLASS_MASK CAST_TO_UINT32(31UL <<ERRCODE_CLASS_SHIFT)
59 #define ERRCODE_DYNAMIC_START CAST_TO_UINT32(1UL <<ERRCODE_DYNAMIC_SHIFT)
60 #define ERRCODE_DYNAMIC_COUNT 31UL
61 #define ERRCODE_DYNAMIC_MASK CAST_TO_UINT32(31UL <<ERRCODE_DYNAMIC_SHIFT)
63 #ifdef __RSC
65 #define ERRCODE_TOERROR(x) \
66 ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK))
68 #else
70 typedef sal_uInt32 ErrCode;
72 inline sal_uInt32 ERRCODE_TOERROR( ErrCode x )
74 return ((x & ERRCODE_WARNING_MASK) ? 0 : (x & ERRCODE_ERROR_MASK));
77 #endif
79 #define ERRCODE_AREA_TOOLS CAST_TO_UINT32(0UL << ERRCODE_AREA_SHIFT)
80 #define ERRCODE_AREA_SV CAST_TO_UINT32(1UL << ERRCODE_AREA_SHIFT)
81 #define ERRCODE_AREA_SFX CAST_TO_UINT32(2UL << ERRCODE_AREA_SHIFT)
82 #define ERRCODE_AREA_INET CAST_TO_UINT32(3UL << ERRCODE_AREA_SHIFT)
83 #define ERRCODE_AREA_IO ERRCODE_AREA_TOOLS
85 #define ERRCODE_AREA_LIB1 CAST_TO_UINT32(8UL << ERRCODE_AREA_SHIFT)
86 #define ERRCODE_AREA_SVX ERRCODE_AREA_LIB1
87 #define ERRCODE_AREA_SVX_END (ERRCODE_AREA_SO-1)
88 #define ERRCODE_AREA_SO CAST_TO_UINT32(9UL << ERRCODE_AREA_SHIFT)
89 #define ERRCODE_AREA_SO_END (ERRCODE_AREA_SBX-1)
90 #define ERRCODE_AREA_SBX CAST_TO_UINT32(10UL << ERRCODE_AREA_SHIFT)
91 #define ERRCODE_AREA_SBX_END CAST_TO_UINT32((11UL << ERRCODE_AREA_SHIFT) - 1)
92 #define ERRCODE_AREA_DB CAST_TO_UINT32(11UL << ERRCODE_AREA_SHIFT)
93 #define ERRCODE_AREA_DB_END CAST_TO_UINT32((12UL << ERRCODE_AREA_SHIFT) - 1)
94 #define ERRCODE_AREA_JAVA CAST_TO_UINT32(12UL << ERRCODE_AREA_SHIFT)
95 #define ERRCODE_AREA_JAVA_END CAST_TO_UINT32((13UL << ERRCODE_AREA_SHIFT) - 1)
96 #define ERRCODE_AREA_UUI CAST_TO_UINT32(13UL << ERRCODE_AREA_SHIFT)
97 #define ERRCODE_AREA_UUI_END CAST_TO_UINT32((14UL << ERRCODE_AREA_SHIFT) - 1)
98 #define ERRCODE_AREA_LIB2 CAST_TO_UINT32(14UL << ERRCODE_AREA_SHIFT)
99 #define ERRCODE_AREA_LIB2_END CAST_TO_UINT32((15UL << ERRCODE_AREA_SHIFT) - 1)
101 #define ERRCODE_AREA_APP1 CAST_TO_UINT32(32UL << ERRCODE_AREA_SHIFT)
102 #define ERRCODE_AREA_APP2 CAST_TO_UINT32(40UL << ERRCODE_AREA_SHIFT)
103 #define ERRCODE_AREA_APP3 CAST_TO_UINT32(48UL << ERRCODE_AREA_SHIFT)
104 #define ERRCODE_AREA_APP4 CAST_TO_UINT32(56UL << ERRCODE_AREA_SHIFT)
105 #define ERRCODE_AREA_APP5 CAST_TO_UINT32(64UL << ERRCODE_AREA_SHIFT)
106 #define ERRCODE_AREA_APP6 CAST_TO_UINT32(72UL << ERRCODE_AREA_SHIFT)
108 #define ERRCODE_AREA_SC ERRCODE_AREA_APP1
109 #define ERRCODE_AREA_SC_END (ERRCODE_AREA_APP2-1)
111 #define ERRCODE_AREA_SD ERRCODE_AREA_APP2
112 #define ERRCODE_AREA_SD_END (ERRCODE_AREA_APP3-1)
114 #define ERRCODE_AREA_SW ERRCODE_AREA_APP4
115 #define ERRCODE_AREA_SW_END (ERRCODE_AREA_APP5-1)
117 #define ERRCODE_AREA_OFA_END (ERRCODE_AREA_APP6-1)
119 #define ERRCODE_CLASS_NONE CAST_TO_UINT32(0UL << ERRCODE_CLASS_SHIFT)
120 #define ERRCODE_CLASS_ABORT CAST_TO_UINT32(1UL << ERRCODE_CLASS_SHIFT)
121 #define ERRCODE_CLASS_GENERAL CAST_TO_UINT32(2UL << ERRCODE_CLASS_SHIFT)
122 #define ERRCODE_CLASS_NOTEXISTS CAST_TO_UINT32(3UL << ERRCODE_CLASS_SHIFT)
123 #define ERRCODE_CLASS_ALREADYEXISTS CAST_TO_UINT32(4UL << ERRCODE_CLASS_SHIFT)
124 #define ERRCODE_CLASS_ACCESS CAST_TO_UINT32(5UL << ERRCODE_CLASS_SHIFT)
125 #define ERRCODE_CLASS_PATH CAST_TO_UINT32(6UL << ERRCODE_CLASS_SHIFT)
126 #define ERRCODE_CLASS_LOCKING CAST_TO_UINT32(7UL << ERRCODE_CLASS_SHIFT)
127 #define ERRCODE_CLASS_PARAMETER CAST_TO_UINT32(8UL << ERRCODE_CLASS_SHIFT)
128 #define ERRCODE_CLASS_SPACE CAST_TO_UINT32(9UL << ERRCODE_CLASS_SHIFT)
129 #define ERRCODE_CLASS_NOTSUPPORTED CAST_TO_UINT32(10UL << ERRCODE_CLASS_SHIFT)
130 #define ERRCODE_CLASS_READ CAST_TO_UINT32(11UL << ERRCODE_CLASS_SHIFT)
131 #define ERRCODE_CLASS_WRITE CAST_TO_UINT32(12UL << ERRCODE_CLASS_SHIFT)
132 #define ERRCODE_CLASS_UNKNOWN CAST_TO_UINT32(13UL << ERRCODE_CLASS_SHIFT)
133 #define ERRCODE_CLASS_VERSION CAST_TO_UINT32(14UL << ERRCODE_CLASS_SHIFT)
134 #define ERRCODE_CLASS_FORMAT CAST_TO_UINT32(15UL << ERRCODE_CLASS_SHIFT)
135 #define ERRCODE_CLASS_CREATE CAST_TO_UINT32(16UL << ERRCODE_CLASS_SHIFT)
136 #define ERRCODE_CLASS_IMPORT CAST_TO_UINT32(17UL << ERRCODE_CLASS_SHIFT)
137 #define ERRCODE_CLASS_EXPORT CAST_TO_UINT32(18UL << ERRCODE_CLASS_SHIFT)
138 #define ERRCODE_CLASS_FILTER CAST_TO_UINT32(19UL << ERRCODE_CLASS_SHIFT)
139 #define ERRCODE_CLASS_SO CAST_TO_UINT32(20UL << ERRCODE_CLASS_SHIFT)
140 #define ERRCODE_CLASS_SBX CAST_TO_UINT32(21UL << ERRCODE_CLASS_SHIFT)
141 #define ERRCODE_CLASS_RUNTIME CAST_TO_UINT32(22UL << ERRCODE_CLASS_SHIFT)
142 #define ERRCODE_CLASS_COMPILER CAST_TO_UINT32(23UL << ERRCODE_CLASS_SHIFT)
144 #define ERRCODE_NONE CAST_TO_UINT32(0UL)
145 #define ERRCODE_ABORT ERRCODE_IO_ABORT
147 #define ERRCODE_IO_MISPLACEDCHAR CAST_TO_UINT32(1UL |ERRCODE_CLASS_PARAMETER|\
148 ERRCODE_AREA_IO)
149 #define ERRCODE_IO_NOTEXISTS CAST_TO_UINT32(2UL |ERRCODE_CLASS_NOTEXISTS|\
150 ERRCODE_AREA_IO)
151 #define ERRCODE_IO_ALREADYEXISTS CAST_TO_UINT32(3UL |ERRCODE_CLASS_ALREADYEXISTS|\
152 ERRCODE_AREA_IO)
153 #define ERRCODE_IO_NOTADIRECTORY CAST_TO_UINT32(4UL |ERRCODE_CLASS_PARAMETER|\
154 ERRCODE_AREA_IO)
155 #define ERRCODE_IO_NOTAFILE CAST_TO_UINT32(5UL |ERRCODE_CLASS_PARAMETER|\
156 ERRCODE_AREA_IO)
157 #define ERRCODE_IO_INVALIDDEVICE CAST_TO_UINT32(6UL |ERRCODE_CLASS_PATH|\
158 ERRCODE_AREA_IO)
159 #define ERRCODE_IO_ACCESSDENIED CAST_TO_UINT32(7UL |ERRCODE_CLASS_ACCESS|\
160 ERRCODE_AREA_IO)
161 #define ERRCODE_IO_LOCKVIOLATION CAST_TO_UINT32(8UL |ERRCODE_CLASS_LOCKING|\
162 ERRCODE_AREA_IO)
163 #define ERRCODE_IO_OUTOFSPACE CAST_TO_UINT32(9UL |ERRCODE_CLASS_SPACE|\
164 ERRCODE_AREA_IO)
165 #define ERRCODE_IO_ISWILDCARD CAST_TO_UINT32(11UL|ERRCODE_CLASS_PARAMETER|\
166 ERRCODE_AREA_IO)
167 #define ERRCODE_IO_NOTSUPPORTED CAST_TO_UINT32(12UL|ERRCODE_CLASS_NOTSUPPORTED|\
168 ERRCODE_AREA_IO)
169 #define ERRCODE_IO_GENERAL CAST_TO_UINT32(13UL|ERRCODE_CLASS_GENERAL|\
170 ERRCODE_AREA_IO)
171 #define ERRCODE_IO_TOOMANYOPENFILES CAST_TO_UINT32(14UL|ERRCODE_CLASS_SPACE|\
172 ERRCODE_AREA_IO)
173 #define ERRCODE_IO_CANTREAD CAST_TO_UINT32(15UL|ERRCODE_CLASS_READ|\
174 ERRCODE_AREA_IO)
175 #define ERRCODE_IO_CANTWRITE CAST_TO_UINT32(16UL|ERRCODE_CLASS_WRITE|\
176 ERRCODE_AREA_IO)
177 #define ERRCODE_IO_OUTOFMEMORY CAST_TO_UINT32(17UL|ERRCODE_CLASS_SPACE|\
178 ERRCODE_AREA_IO)
179 #define ERRCODE_IO_CANTSEEK CAST_TO_UINT32(18UL|ERRCODE_CLASS_GENERAL|\
180 ERRCODE_AREA_IO)
181 #define ERRCODE_IO_CANTTELL CAST_TO_UINT32(19UL|ERRCODE_CLASS_GENERAL|\
182 ERRCODE_AREA_IO)
183 #define ERRCODE_IO_WRONGVERSION CAST_TO_UINT32(20UL|ERRCODE_CLASS_VERSION|\
184 ERRCODE_AREA_IO)
185 #define ERRCODE_IO_WRONGFORMAT CAST_TO_UINT32(21UL|ERRCODE_CLASS_FORMAT|\
186 ERRCODE_AREA_IO)
187 #define ERRCODE_IO_INVALIDCHAR CAST_TO_UINT32(22UL|ERRCODE_CLASS_PARAMETER|\
188 ERRCODE_AREA_IO)
189 #define ERRCODE_IO_UNKNOWN CAST_TO_UINT32(23UL|ERRCODE_CLASS_UNKNOWN|\
190 ERRCODE_AREA_IO)
191 #define ERRCODE_IO_INVALIDACCESS CAST_TO_UINT32(24UL|ERRCODE_CLASS_ACCESS|\
192 ERRCODE_AREA_IO)
193 #define ERRCODE_IO_CANTCREATE CAST_TO_UINT32(25UL|ERRCODE_CLASS_CREATE|\
194 ERRCODE_AREA_IO)
195 #define ERRCODE_IO_INVALIDPARAMETER CAST_TO_UINT32(26UL|ERRCODE_CLASS_PARAMETER|\
196 ERRCODE_AREA_IO)
197 #define ERRCODE_IO_ABORT CAST_TO_UINT32(27UL|ERRCODE_CLASS_ABORT|\
198 ERRCODE_AREA_IO)
199 #define ERRCODE_IO_NOTEXISTSPATH CAST_TO_UINT32(28UL |ERRCODE_CLASS_NOTEXISTS|\
200 ERRCODE_AREA_IO)
201 #define ERRCODE_IO_PENDING CAST_TO_UINT32(29UL |ERRCODE_CLASS_NOTEXISTS|\
202 ERRCODE_AREA_IO)
203 #define ERRCODE_IO_RECURSIVE CAST_TO_UINT32(30UL |ERRCODE_CLASS_PARAMETER|\
204 ERRCODE_AREA_IO)
205 #define ERRCODE_IO_NAMETOOLONG CAST_TO_UINT32(31UL |ERRCODE_CLASS_PARAMETER|\
206 ERRCODE_AREA_IO)
207 #define ERRCODE_IO_INVALIDLENGTH CAST_TO_UINT32(32UL |ERRCODE_CLASS_PARAMETER|\
208 ERRCODE_AREA_IO)
209 #define ERRCODE_IO_CURRENTDIR CAST_TO_UINT32(33UL |ERRCODE_CLASS_PARAMETER|\
210 ERRCODE_AREA_IO)
211 #define ERRCODE_IO_NOTSAMEDEVICE CAST_TO_UINT32(34UL |ERRCODE_CLASS_PARAMETER|\
212 ERRCODE_AREA_IO)
213 #define ERRCODE_IO_DEVICENOTREADY CAST_TO_UINT32(35UL |ERRCODE_CLASS_READ|\
214 ERRCODE_AREA_IO)
215 #define ERRCODE_IO_BADCRC CAST_TO_UINT32(36UL |ERRCODE_CLASS_READ|\
216 ERRCODE_AREA_IO)
217 #define ERRCODE_IO_WRITEPROTECTED CAST_TO_UINT32(37UL |ERRCODE_CLASS_ACCESS|\
218 ERRCODE_AREA_IO)
219 #define ERRCODE_IO_BROKENPACKAGE CAST_TO_UINT32(38UL |ERRCODE_CLASS_FORMAT|\
220 ERRCODE_AREA_IO)
221 #define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT CAST_TO_UINT32(39UL |ERRCODE_CLASS_FORMAT|\
222 ERRCODE_AREA_IO)
224 // FsysErrorCodes
226 // StreamErrorCodes
227 #define SVSTREAM_OK ERRCODE_NONE
229 #define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL
230 #define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS
231 #define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH
232 #define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES
233 #define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED
234 #define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION
235 #define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION
236 #define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION
238 #define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS
239 #define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL
240 #define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE
241 #define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER
243 #define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD
244 #define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE
245 #define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK
247 #define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY
249 #define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT
250 #define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION
252 #define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE
254 // For the EditEngine:
255 #define SVSTREAM_ERRBASE_USER ERRCODE_AREA_LIB1
257 #define PRINTER_OK ERRCODE_NONE
258 #define PRINTER_ABORT ERRCODE_IO_ABORT
259 #define PRINTER_GENERALERROR ERRCODE_IO_GENERAL
261 #define ERRCODE_INET_NAME_RESOLVE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 1)
262 #define ERRCODE_INET_CONNECT (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 2)
263 #define ERRCODE_INET_READ (ERRCODE_AREA_INET | ERRCODE_CLASS_READ | 3)
264 #define ERRCODE_INET_WRITE (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE| 4)
265 #define ERRCODE_INET_GENERAL (ERRCODE_AREA_INET | ERRCODE_CLASS_WRITE |5)
266 #define ERRCODE_INET_OFFLINE (ERRCODE_AREA_INET | ERRCODE_CLASS_READ |6)
268 #endif
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */