Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-exception.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-execpetion.h : exception utils */
3
4 /* 
5  *
6  * Author : 
7  *  Bertrand Guiheneuf <bertrand@helixcode.com>
8  *
9  * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
10  *
11  * This program is free software; you can redistribute it and/or 
12  * modify it under the terms of version 2 of the GNU Lesser General Public 
13  * License as published by the Free Software Foundation.
14  *
15  * This program 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 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23  * USA
24  */
25
26
27
28 #ifndef CAMEL_EXCEPTION_H
29 #define CAMEL_EXCEPTION_H 1
30
31 #include <camel/camel-types.h>
32
33 G_BEGIN_DECLS
34
35 typedef enum {
36 #include "camel-exception-list.def"
37
38 } ExceptionId;
39
40 struct _CamelException {
41         /* do not access the fields directly */
42         ExceptionId id;
43         char *desc;
44 };
45
46 #define CAMEL_EXCEPTION_INITIALISER { 0, NULL }
47
48 /* creation and destruction functions */
49 CamelException *          camel_exception_new           (void);
50 void                      camel_exception_free          (CamelException *ex);
51 void                      camel_exception_init          (CamelException *ex);
52
53
54 /* exception content manipulation */
55 void                      camel_exception_clear         (CamelException *ex);
56 void                      camel_exception_set           (CamelException *ex,
57                                                          ExceptionId id,
58                                                          const char *desc);
59 void                      camel_exception_setv          (CamelException *ex,
60                                                          ExceptionId id,
61                                                          const char *format,  
62                                                          ...);
63
64 /* exception content transfer */
65 void                      camel_exception_xfer          (CamelException *ex_dst,
66                                                          CamelException *ex_src);
67
68
69 /* exception content retrieval */
70 ExceptionId               camel_exception_get_id        (CamelException *ex);
71 const char *             camel_exception_get_description (CamelException *ex);
72
73 #define camel_exception_is_set(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
74
75 G_END_DECLS
76
77 #endif /* CAMEL_EXCEPTION_H */
78