Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_916 / libraries / libjni-gdal / include / cpl_error.h @ 12327

History | View | Annotate | Download (5.63 KB)

1
/**********************************************************************
2
 * $Id: cpl_error.h 7765 2006-10-03 07:05:18Z 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.3  2006-10-03 07:05:18  nacho
33
 * *** empty log message ***
34
 *
35
 * Revision 1.1  2006/07/18 16:21:00  nacho
36
 * *** empty log message ***
37
 *
38
 * Revision 1.1  2006/06/29 16:23:27  nacho
39
 * *** empty log message ***
40
 *
41
 * Revision 1.2  2006/01/09 12:50:13  nacho
42
 * *** empty log message ***
43
 *
44
 * Revision 1.1  2005/07/27 08:22:55  igbrotru
45
 * *** empty log message ***
46
 *
47
 * Revision 1.1  2004/12/28 14:06:59  igbrotru
48
 * *** empty log message ***
49
 *
50
 * Revision 1.1  2004/10/28 12:08:47  igbrotru
51
 * *** empty log message ***
52
 *
53
 * Revision 1.1  2004/09/27 08:27:48  igbrotru
54
 * *** empty log message ***
55
 *
56
 * Revision 1.1  2004/09/08 12:39:04  igbrotru
57
 * *** empty log message ***
58
 *
59
 * Revision 1.16  2001/11/02 22:07:58  warmerda
60
 * added logging error handler
61
 *
62
 * Revision 1.15  2001/01/19 21:16:41  warmerda
63
 * expanded tabs
64
 *
65
 * Revision 1.14  2000/11/30 17:30:10  warmerda
66
 * added CPLGetLastErrorType
67
 *
68
 * Revision 1.13  2000/08/24 18:08:17  warmerda
69
 * made default and quiet error handlers public on windows
70
 *
71
 * Revision 1.12  2000/06/26 21:44:07  warmerda
72
 * added CPLE_UserInterrupt for progress terminations
73
 *
74
 * Revision 1.11  2000/03/31 14:11:55  warmerda
75
 * added CPLErrorV
76
 *
77
 * Revision 1.10  2000/01/10 17:35:45  warmerda
78
 * added push down stack of error handlers
79
 *
80
 * Revision 1.9  1999/07/23 14:27:47  warmerda
81
 * CPLSetErrorHandler returns old handler
82
 *
83
 * Revision 1.8  1999/05/20 14:59:05  warmerda
84
 * added CPLDebug()
85
 *
86
 * Revision 1.7  1999/05/20 02:54:38  warmerda
87
 * Added API documentation
88
 *
89
 * Revision 1.6  1999/02/17 05:40:47  danmo
90
 * Fixed CPLAssert() macro to work with EGCS.
91
 *
92
 * Revision 1.5  1999/01/11 15:34:29  warmerda
93
 * added reserved range comment
94
 *
95
 * Revision 1.4  1998/12/15 19:02:27  warmerda
96
 * Avoid use of errno as a variable
97
 *
98
 * Revision 1.3  1998/12/06 22:20:42  warmerda
99
 * Added error code.
100
 *
101
 * Revision 1.2  1998/12/06 02:52:52  warmerda
102
 * Implement assert support
103
 *
104
 * Revision 1.1  1998/12/03 18:26:02  warmerda
105
 * New
106
 *
107
 **********************************************************************/
108

    
109
#ifndef _CPL_ERROR_H_INCLUDED_
110
#define _CPL_ERROR_H_INCLUDED_
111

    
112
#include "cpl_port.h"
113

    
114
/*=====================================================================
115
                   Error handling functions (cpl_error.c)
116
 =====================================================================*/
117

    
118
/**
119
 * \file cpl_error.h
120
 *
121
 * CPL error handling services.
122
 */
123
  
124
CPL_C_START
125

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

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

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

    
151
void CPL_DLL CPLDebug( const char *, const char *, ... );
152
void CPL_DLL _CPLAssert( const char *, const char *, int );
153

    
154
#ifdef DEBUG
155
#  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
156
#else
157
#  define CPLAssert(expr)
158
#endif
159

    
160
CPL_C_END
161

    
162
/* ==================================================================== */
163
/*      Well known error codes.                                         */
164
/* ==================================================================== */
165

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

    
177
/* 100 - 299 reserved for GDAL */
178

    
179
#endif /* _CPL_ERROR_H_INCLUDED_ */