File: plexcept.h

package info (click to toggle)
paintlib 2.6.2-14
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,920 kB
  • ctags: 3,874
  • sloc: cpp: 25,209; sh: 10,605; ansic: 1,891; makefile: 120
file content (178 lines) | stat: -rw-r--r-- 5,492 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

/*
/--------------------------------------------------------------------
|
|      $Id: plexcept.h,v 1.12 2004/09/15 14:52:09 artcom Exp $
|
|      Copyright (c) 1996-2002 Ulrich von Zadow
|
\--------------------------------------------------------------------
*/

#ifndef INCL_PLEXCEPT
#define INCL_PLEXCEPT

#ifndef AFX_PLOBJECT_H__E40881E3_C809_11D3_97BC_0050046F615E__INCLUDED_
#include "plobject.h"
#endif


// Error codes
#define PL_ERROK              0            // No error
#define PL_ERRWRONG_SIGNATURE 1            // Expected file signature
                                           // not found.
#define PL_ERRFORMAT_UNKNOWN  2            // Sanity check failed.

#define PL_ERRPATH_NOT_FOUND  3            // <--
#define PL_ERRFILE_NOT_FOUND  4            // <-- Problems with the file
#define PL_ERRACCESS_DENIED   5            // <-- system.

#define PL_ERRFORMAT_NOT_SUPPORTED 6       // Known but unsupported
                                           // format.
#define PL_ERRINTERNAL        7            // Internal error of some sort.
#define PL_ERRUNKNOWN_FILE_TYPE    8       // Couldn't recognize the
                                           // file type.
#define PL_ERRDIB_TOO_LARGE   9            // Maximum size for 1 bmp was
                                           // exceeded.
#define PL_ERRNO_MEMORY      10            // Out of memory.
#define PL_ERREND_OF_FILE    11            // End of file reached before
                                           // end of image.
#define PL_ERRFORMAT_NOT_COMPILED 12       // Support for this file format
                                           // was #ifdef'ed out.
#define PL_ERRURL_SOURCE     13            // Curl returned error.
#define PL_ERRBAD_EXIF       14            //


//! An object of this class is thrown by other classes when an error
//! occurs. It contains an error code and a string describing the
//! error. The error code is meant to be used internally in the
//! program; the descriptive string can be output to the user. Error
//! codes and strings do not correspond 1:1. The strings are more
//! precise.
class PLTextException : public PLObject
{

public:
  //! Creates an exception.
  PLTextException
    ( int Code,
      const char * pszErr
    );

  //! Creates an exception.
  PLTextException
    ( int Code,
      int MinorCode,
      const char * pszErr
    );

  //! Copy constructor.
  PLTextException
    ( const PLTextException& ex
    );

  //! Destroys an exception
  virtual ~PLTextException
    ();

  //! Returns the code of the error that caused the exception. Valid
  //! error codes are:
  //!
  //! PL_ERRWRONG_SIGNATURE (1): Expected file signature not found.
  //!
  //! PL_ERRFORMAT_UNKNOWN (2): Unexpected data encountered. This
  //! probably indicates a corrupt file or an unknown file
  //! sub-format.
  //!
  //! PL_ERRPATH_NOT_FOUND (3), PL_ERRFILE_NOT_FOUND (4),
  //! PL_ERRACCESS_DENIED (5): Problems with the file system.
  //!
  //! PL_ERRFORMAT_NOT_SUPPORTED (6): Known but unsupported format.
  //!
  //! PL_ERRINTERNAL (7): Kaputt. Tell me about it.
  //!
  //! PL_ERRUNKNOWN_FILE_TYPE (8): Couldn't recognize the file type.
  //!
  //! PL_ERRDIB_TOO_LARGE (9): Maximum size for 1 bmp was exceeded.
  //! (See MAX_BITMAP_SIZE above for an explanation).
  //!
  //! PL_ERRNO_MEMORY (10): Out of memory.
  //!
  //! PL_ERREND_OF_FILE (11): End of file reached before end of image.
  //!
  //! PL_ERRFORMAT_NOT_COMPILED (12): Support for this file format
  //! was #ifdef'ed out.
  //!
  //! PL_ERRURL_SOURCE (13): Curl returned error.
  //!
  //! PL_ERRBAD_EXIF (14): Error decoding EXIF data.
  virtual int GetCode
    ()
    const;

  //! In case of PL_ERRURL_SOURCE, the actual curl error code (from curl.h) is
  //! placed here.
  int GetMinorCode
    ()
    const;

  //! This operator allows the exception to be treated as a string
  //! whenever needed. The string contains the error message.
  virtual operator const char *
    ()
    const;

private:
  int     m_Code;
  int     m_MinorCode;
  char *  m_pszErr;
};

#endif
/*
/--------------------------------------------------------------------
|
|      $Log: plexcept.h,v $
|      Revision 1.12  2004/09/15 14:52:09  artcom
|      - added PLPixelformatTest
|      - added DICOM Decoder
|
|      Revision 1.11  2004/09/11 12:41:35  uzadow
|      removed plstdpch.h
|
|      Revision 1.10  2004/06/06 12:56:38  uzadow
|      Doxygenified documentation.
|
|      Revision 1.9  2003/11/21 23:35:44  uzadow
|      Removed files built by the autotools.
|
|      Revision 1.8  2003/08/03 12:03:20  uzadow
|      Added unicode support; fixed some header includes.
|
|      Revision 1.7  2003/04/20 12:44:47  uzadow
|      Added EXIF documentation.
|
|      Revision 1.6  2003/04/13 20:13:21  uzadow
|      Added counted pointer classes (windows ver.)
|
|      Revision 1.5  2003/02/15 21:26:58  uzadow
|      Added win32 version of url data source.
|
|      Revision 1.4  2002/11/18 14:44:46  uzadow
|      Added PNG compression support, fixed docs.
|
|      Revision 1.3  2002/08/07 18:50:38  uzadow
|      More cygwin compatibility changes.
|
|      Revision 1.2  2002/03/03 16:29:55  uzadow
|      Re-added BPPWanted.
|
|      Revision 1.1  2001/09/16 19:03:22  uzadow
|      Added global name prefix PL, changed most filenames.
|
|      Revision 1.4  2000/01/17 23:38:07  Ulrich von Zadow
|      MFC removal aftermath.
|
|
\--------------------------------------------------------------------
*/