Removal of non-Haiku target platform logic from build system (part 1.)
[haiku.git] / src / apps / icon-o-matic / import_export / svg / SVGException.h
blobce88429198b1378bebaa046afce867d0eba6825b
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.2
3 // Copyright (C) 2002-2004 Maxim Shemanarev (http://www.antigrain.com)
4 //
5 // Permission to copy, use, modify, sell and distribute this software
6 // is granted provided this copyright notice appears in all copies.
7 // This software is provided "as is" without express or implied
8 // warranty, and with no claim as to its suitability for any purpose.
9 //
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 // mcseemagg@yahoo.com
13 // http://www.antigrain.com
14 //----------------------------------------------------------------------------
16 // SVG exception
18 //----------------------------------------------------------------------------
20 #ifndef SVG_EXCEPTION_H
21 #define SVG_EXCEPTION_H
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdarg.h>
27 namespace agg {
28 namespace svg {
30 class exception {
31 public:
33 ~exception()
35 delete [] m_msg;
38 exception() : m_msg(0) {}
40 exception(const char* fmt, ...) :
41 m_msg(0)
43 if(fmt)
45 m_msg = new char [4096];
46 va_list arg;
47 va_start(arg, fmt);
48 vsprintf(m_msg, fmt, arg);
49 va_end(arg);
53 exception(const exception& exc) :
54 m_msg(exc.m_msg ? new char[strlen(exc.m_msg) + 1] : 0)
56 if(m_msg) strcpy(m_msg, exc.m_msg);
59 const char* msg() const { return m_msg; }
61 private:
62 char* m_msg;
65 } // namespace svg
66 } // namespace agg
68 #endif // SVG_EXCEPTION_H