Statistics
| Revision:

svn-gvsig-desktop / tags / v1_9_Build_1245 / libraries / libjni-gdal-macosx / include / cpl_error.h @ 33839

History | View | Annotate | Download (5.56 KB)

1
/**********************************************************************
2
 * $Id: cpl_error.h 8219 2006-10-23 06:25:39Z nacho $
3
 *
4
 * Name:     cpl_error.h
5
 * Project:  CPL - Common Portability Library
6
 * Purpose:  CPL Error handling
7
 * Author:   Daniel Morissette, danmo@videotron.ca
8
 *
9
 **********************************************************************
10
 * Copyright (c) 1998, Daniel Morissette
11
 *
12
 * Permission is hereby granted, free of charge, to any person obtaining a
13
 * copy of this software and associated documentation files (the "Software"),
14
 * to deal in the Software without restriction, including without limitation
15
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
 * and/or sell copies of the Software, and to permit persons to whom the
17
 * Software is furnished to do so, subject to the following conditions:
18
 * 
19
 * The above copyright notice and this permission notice shall be included
20
 * in all copies or substantial portions of the Software.
21
 * 
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
25
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
28
 * DEALINGS IN THE SOFTWARE.
29
 **********************************************************************
30
 *
31
 * $Log$
32
 * Revision 1.1  2006-10-23 06:25:39  nacho
33
 * *** empty log message ***
34
 *
35
 * Revision 1.1  2006/06/29 16:23:27  nacho
36
 * *** empty log message ***
37
 *
38
 * Revision 1.2  2006/01/09 12:50:13  nacho
39
 * *** empty log message ***
40
 *
41
 * Revision 1.1  2005/07/27 08:22:55  igbrotru
42
 * *** empty log message ***
43
 *
44
 * Revision 1.1  2004/12/28 14:06:59  igbrotru
45
 * *** empty log message ***
46
 *
47
 * Revision 1.1  2004/10/28 12:08:47  igbrotru
48
 * *** empty log message ***
49
 *
50
 * Revision 1.1  2004/09/27 08:27:48  igbrotru
51
 * *** empty log message ***
52
 *
53
 * Revision 1.1  2004/09/08 12:39:04  igbrotru
54
 * *** empty log message ***
55
 *
56
 * Revision 1.16  2001/11/02 22:07:58  warmerda
57
 * added logging error handler
58
 *
59
 * Revision 1.15  2001/01/19 21:16:41  warmerda
60
 * expanded tabs
61
 *
62
 * Revision 1.14  2000/11/30 17:30:10  warmerda
63
 * added CPLGetLastErrorType
64
 *
65
 * Revision 1.13  2000/08/24 18:08:17  warmerda
66
 * made default and quiet error handlers public on windows
67
 *
68
 * Revision 1.12  2000/06/26 21:44:07  warmerda
69
 * added CPLE_UserInterrupt for progress terminations
70
 *
71
 * Revision 1.11  2000/03/31 14:11:55  warmerda
72
 * added CPLErrorV
73
 *
74
 * Revision 1.10  2000/01/10 17:35:45  warmerda
75
 * added push down stack of error handlers
76
 *
77
 * Revision 1.9  1999/07/23 14:27:47  warmerda
78
 * CPLSetErrorHandler returns old handler
79
 *
80
 * Revision 1.8  1999/05/20 14:59:05  warmerda
81
 * added CPLDebug()
82
 *
83
 * Revision 1.7  1999/05/20 02:54:38  warmerda
84
 * Added API documentation
85
 *
86
 * Revision 1.6  1999/02/17 05:40:47  danmo
87
 * Fixed CPLAssert() macro to work with EGCS.
88
 *
89
 * Revision 1.5  1999/01/11 15:34:29  warmerda
90
 * added reserved range comment
91
 *
92
 * Revision 1.4  1998/12/15 19:02:27  warmerda
93
 * Avoid use of errno as a variable
94
 *
95
 * Revision 1.3  1998/12/06 22:20:42  warmerda
96
 * Added error code.
97
 *
98
 * Revision 1.2  1998/12/06 02:52:52  warmerda
99
 * Implement assert support
100
 *
101
 * Revision 1.1  1998/12/03 18:26:02  warmerda
102
 * New
103
 *
104
 **********************************************************************/
105

    
106
#ifndef _CPL_ERROR_H_INCLUDED_
107
#define _CPL_ERROR_H_INCLUDED_
108

    
109
#include "cpl_port.h"
110

    
111
/*=====================================================================
112
                   Error handling functions (cpl_error.c)
113
 =====================================================================*/
114

    
115
/**
116
 * \file cpl_error.h
117
 *
118
 * CPL error handling services.
119
 */
120
  
121
CPL_C_START
122

    
123
typedef enum
124
{
125
    CE_None = 0,
126
    CE_Debug = 1,
127
    CE_Warning = 2,
128
    CE_Failure = 3,
129
    CE_Fatal = 4
130
  
131
} CPLErr;
132

    
133
void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
134
void CPL_DLL CPLErrorV(CPLErr, int, const char *, va_list );
135
void CPL_DLL CPLErrorReset();
136
int CPL_DLL CPLGetLastErrorNo();
137
CPLErr CPL_DLL CPLGetLastErrorType();
138
const char CPL_DLL * CPLGetLastErrorMsg();
139

    
140
typedef void (*CPLErrorHandler)(CPLErr, int, const char*);
141
CPLErrorHandler CPL_DLL CPLSetErrorHandler(CPLErrorHandler);
142
void CPL_DLL CPLPushErrorHandler( CPLErrorHandler );
143
void CPL_DLL CPLPopErrorHandler();
144
void CPL_DLL CPLDefaultErrorHandler( CPLErr, int, const char * );
145
void CPL_DLL CPLQuietErrorHandler( CPLErr, int, const char * );
146
void CPL_DLL CPLLoggingErrorHandler( CPLErr, int, const char * );
147

    
148
void CPL_DLL CPLDebug( const char *, const char *, ... );
149
void CPL_DLL _CPLAssert( const char *, const char *, int );
150

    
151
#ifdef DEBUG
152
#  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
153
#else
154
#  define CPLAssert(expr)
155
#endif
156

    
157
CPL_C_END
158

    
159
/* ==================================================================== */
160
/*      Well known error codes.                                         */
161
/* ==================================================================== */
162

    
163
#define CPLE_None                       0
164
#define CPLE_AppDefined                 1
165
#define CPLE_OutOfMemory                2
166
#define CPLE_FileIO                     3
167
#define CPLE_OpenFailed                 4
168
#define CPLE_IllegalArg                 5
169
#define CPLE_NotSupported               6
170
#define CPLE_AssertionFailed            7
171
#define CPLE_NoWriteAccess              8
172
#define CPLE_UserInterrupt              9
173

    
174
/* 100 - 299 reserved for GDAL */
175

    
176
#endif /* _CPL_ERROR_H_INCLUDED_ */