Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | pmbaty | 1 | /* |
2 | SMPEG - SDL MPEG Player Library |
||
3 | Copyright (C) 1999 Loki Entertainment Software |
||
4 | |||
5 | This library is free software; you can redistribute it and/or |
||
6 | modify it under the terms of the GNU Library General Public |
||
7 | License as published by the Free Software Foundation; either |
||
8 | version 2 of the License, or (at your option) any later version. |
||
9 | |||
10 | This library is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
13 | Library General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU Library General Public |
||
16 | License along with this library; if not, write to the Free |
||
17 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
||
18 | */ |
||
19 | |||
20 | /* A class used for error reporting in the MPEG classes */ |
||
21 | |||
22 | #ifndef _MPEGERROR_H_ |
||
23 | #define _MPEGERROR_H_ |
||
24 | |||
25 | #include <stdio.h> |
||
26 | #include <stdarg.h> |
||
27 | |||
28 | class MPEGerror { |
||
29 | public: |
||
30 | MPEGerror() { |
||
31 | ClearError(); |
||
32 | } |
||
33 | |||
34 | /* Set an error message */ |
||
35 | void SetError(const char *fmt, ...) { |
||
36 | va_list ap; |
||
37 | |||
38 | va_start(ap, fmt); |
||
39 | vsprintf(errbuf, fmt, ap); |
||
40 | va_end(ap); |
||
41 | error = errbuf; |
||
42 | } |
||
43 | |||
44 | /* Find out if an error occurred */ |
||
45 | bool WasError(void) { |
||
46 | return(error != NULL); |
||
47 | } |
||
48 | char *TheError(void) { |
||
49 | return(error); |
||
50 | } |
||
51 | |||
52 | /* Clear any error message */ |
||
53 | void ClearError(void) { |
||
54 | error = NULL; |
||
55 | } |
||
56 | |||
57 | protected: |
||
58 | char errbuf[512]; |
||
59 | char *error; |
||
60 | }; |
||
61 | |||
62 | #endif /* _MPEGERROR_H_ */ |