STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

comstl_bad_interface_cast.h

Go to the documentation of this file.
00001 /* 
00002  * File:        comstl_interface_bad_cast.h
00003  *
00004  * Purpose:     Exception thrown when interface casts fail.
00005  *
00006  * Created:     22nd December 2003
00007  * Updated:     11th September 2004
00008  *
00009  * Home:        http://stlsoft.org/
00010  *
00011  * Copyright (c) 2003-2004, Matthew Wilson and Synesis Software
00012  * All rights reserved.
00013  *
00014  * Redistribution and use in source and binary forms, with or without
00015  * modification, are permitted provided that the following conditions are met:
00016  *
00017  * - Redistributions of source code must retain the above copyright notice, this
00018  *   list of conditions and the following disclaimer.
00019  * - Redistributions in binary form must reproduce the above copyright notice,
00020  *   this list of conditions and the following disclaimer in the documentation
00021  *   and/or other materials provided with the distribution.
00022  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
00023  *   any contributors may be used to endorse or promote products derived from
00024  *   this software without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00027  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00029  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00030  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00031  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00032  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00033  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00034  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00035  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00036  * POSSIBILITY OF SUCH DAMAGE.
00037  *
00038  * 
00039 
00040 
00044 
00045 #ifndef COMSTL_INCL_H_COMSTL_BAD_INTERFACE_CAST
00046 #define COMSTL_INCL_H_COMSTL_BAD_INTERFACE_CAST
00047 
00048 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00049 # define COMSTL_VER_H_COMSTL_BAD_INTERFACE_CAST_MAJOR       2
00050 # define COMSTL_VER_H_COMSTL_BAD_INTERFACE_CAST_MINOR       0
00051 # define COMSTL_VER_H_COMSTL_BAD_INTERFACE_CAST_REVISION    1
00052 # define COMSTL_VER_H_COMSTL_BAD_INTERFACE_CAST_EDIT        11
00053 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00054 
00055 /* 
00056  * Includes
00057  */
00058 
00059 #ifndef COMSTL_INCL_H_COMSTL
00060 # include "comstl.h"    // Include the COMSTL root header
00061 #endif /* !COMSTL_INCL_H_COMSTL */
00062 #include <typeinfo>
00063 
00064 /* 
00065  * Namespace
00066  *
00067  * The COMSTL components are contained within the comstl namespace. This is
00068  * actually an alias for stlsoft::comstl_project,
00069  *
00070  * The definition matrix is as follows:
00071  *
00072  * _STLSOFT_NO_NAMESPACE    _COMSTL_NO_NAMESPACE    comstl definition
00073  * ---------------------    --------------------    -----------------
00074  *  not defined              not defined             = stlsoft::comstl_project
00075  *  not defined              defined                 not defined
00076  *  defined                  not defined             comstl
00077  *  defined                  defined                 not defined
00078  *
00079  */
00080 
00081 #ifndef _COMSTL_NO_NAMESPACE
00082 # if defined(_STLSOFT_NO_NAMESPACE) || \
00083      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00084 /* There is no stlsoft namespace, so must define ::comstl */
00085 namespace comstl
00086 {
00087 # else
00088 /* Define stlsoft::comstl_project */
00089 
00090 namespace stlsoft
00091 {
00092 
00093 namespace comstl_project
00094 {
00095 
00096 # endif /* _STLSOFT_NO_NAMESPACE */
00097 #endif /* !_COMSTL_NO_NAMESPACE */
00098 
00099 /* 
00100 
00105 
00106 /* 
00107  * Classes
00108  */
00109 
00111 class bad_interface_cast
00112 #if defined(__STLSOFT_COMPILER_IS_DMC)
00113     : public std::bad_cast
00114 #else /* ? compiler */
00115     : public comstl_ns_qual_std(bad_cast)
00116 #endif /* compiler */
00117 {
00118 public:
00119 #if defined(__STLSOFT_COMPILER_IS_DMC)
00120     typedef std::bad_cast                   parent_class_type;
00121 #else /* ? compiler */
00122     typedef comstl_ns_qual_std(bad_cast)    parent_class_type;
00123 #endif /* compiler */
00124     typedef bad_interface_cast              class_type;
00125 
00126 public:
00127     bad_interface_cast(REFIID riid, HRESULT hr) comstl_throw_0()
00128         : m_riid(riid)
00129         , m_hr(hr)
00130     {}
00131 
00132 #if defined(__STLSOFT_COMPILER_IS_DMC)
00133     char const  *what() const throw()
00134 #else /* ? compiler */
00135     char const  *what() const comstl_throw_0()
00136 #endif /* compiler */
00137     {
00138         return "Failed to acquire requested interface";
00139     }
00140 
00141     REFIID      iid() const comstl_throw_0()
00142     {
00143         return m_riid;
00144     }
00145 
00146     HRESULT     hresult() const comstl_throw_0()
00147     {
00148         return m_hr;
00149     }
00150 
00151 private:
00152     REFIID          m_riid;
00153     HRESULT const   m_hr;
00154 
00155 // Not to be implemented
00156 private:
00157     class_type &operator =(class_type const &);
00158 };
00159 
00160 /* 
00161 
00163 
00164 /* 
00165 
00166 #ifndef _COMSTL_NO_NAMESPACE
00167 # if defined(_STLSOFT_NO_NAMESPACE) || \
00168      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00169 } // namespace comstl
00170 # else
00171 } // namespace comstl_project
00172 } // namespace stlsoft
00173 # endif /* _STLSOFT_NO_NAMESPACE */
00174 #endif /* !_COMSTL_NO_NAMESPACE */
00175 
00176 /* 
00177 
00178 #endif /* !COMSTL_INCL_H_COMSTL_BAD_INTERFACE_CAST */
00179 
00180 /* 

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004