1 : /******************************************************************************
2 : *
3 : * Purpose: Declaration of the PCIDSKException class. All exceptions thrown
4 : * by the PCIDSK library will be of this type.
5 : *
6 : ******************************************************************************
7 : * Copyright (c) 2009
8 : * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada
9 : *
10 : * Permission is hereby granted, free of charge, to any person obtaining a
11 : * copy of this software and associated documentation files (the "Software"),
12 : * to deal in the Software without restriction, including without limitation
13 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 : * and/or sell copies of the Software, and to permit persons to whom the
15 : * Software is furnished to do so, subject to the following conditions:
16 : *
17 : * The above copyright notice and this permission notice shall be included
18 : * in all copies or substantial portions of the Software.
19 : *
20 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 : * DEALINGS IN THE SOFTWARE.
27 : ****************************************************************************/
28 : #ifndef __INCLUDE_PCIDSK_EXCEPTION_H
29 : #define __INCLUDE_PCIDSK_EXCEPTION_H
30 :
31 : #include "pcidsk_config.h"
32 :
33 : #include <string>
34 : #include <cstdarg>
35 : #include <stdexcept>
36 :
37 : namespace PCIDSK
38 : {
39 : /************************************************************************/
40 : /* Exception */
41 : /************************************************************************/
42 :
43 : class PCIDSKException : public std::exception
44 0 : {
45 : public:
46 : PCIDSKException(const char *fmt, ... );
47 : virtual ~PCIDSKException() throw();
48 :
49 : void vPrintf( const char *fmt, va_list list );
50 0 : virtual const char *what() const throw() { return message.c_str(); }
51 : private:
52 : std::string message;
53 : };
54 :
55 : void PCIDSK_DLL ThrowPCIDSKException( const char *fmt, ... );
56 :
57 : } // end namespace PCIDSK
58 :
59 : #endif // __INCLUDE_PCIDSK_EXCEPTION_H
|