blob: ef6b3689c50eb771f0a68abcb3446e29de885405 [file] [log] [blame]
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +00001/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19#ifndef __RDR_EXCEPTION_H__
20#define __RDR_EXCEPTION_H__
21
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000022namespace rdr {
23
24 struct Exception {
25 enum { len = 256 };
26 char str_[len];
Adam Tkac20e0d712008-11-14 14:48:21 +000027 Exception(const char *format = 0, ...);
Constantin Kaplinskya1958b72007-09-05 09:31:08 +000028 virtual ~Exception() {}
Constantin Kaplinskya2adc8d2006-05-25 05:01:55 +000029 virtual const char* str() const { return str_; }
30 };
31
32 struct SystemException : public Exception {
33 int err;
34 SystemException(const char* s, int err_);
35 };
36
37 struct TimedOut : public Exception {
38 TimedOut(const char* s="Timed out") : Exception(s) {}
39 };
40
41 struct EndOfStream : public Exception {
42 EndOfStream(const char* s="End of stream") : Exception(s) {}
43 };
44
45 struct FrameException : public Exception {
46 FrameException(const char* s="Frame exception") : Exception(s) {}
47 };
48}
49
50#endif