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  

interface_cast_test Class Template Reference
[Interface Library]

Interface cast that tests whether a given interface pointer can be successfully queried. More...

#include <comstl_interface_cast.h>

Inheritance diagram for interface_cast_test:

interface_cast_base< I, noaddref_release< I >, ignore_interface_cast_exception > List of all members.

Public Types

typedef interface_cast_test<
I > 
class_type
 The type of the current parameterisation.

typedef parent_class_type::interface_pointer_type interface_pointer_type
 The interface pointer type.

typedef parent_class_type::interface_type interface_type
 The interface type.


Public Methods

template<typename J>  interface_cast_test (J &j)
 Constructor that attempts the speculative cast.

 interface_cast_test (interface_pointer_type pi)
 Constructor that directly casts (without calling QueryInterface()).

State
 operator operator_bool_type () const
cs_bool_t operator! () const
 Represents whether the cast failed.


Protected Types

typedef noaddref_release< I > release_type
 The release type.

typedef ignore_interface_cast_exception exception_policy_type
 The exception type.

typedef exception_policy_type::thrown_type thrown_type
 The thrown type.


Protected Methods

interface_pointer_type const & get_pointer_ ()
 Returns a non-mutating reference to the acquired interface pointer.

interface_pointer_type get_pointer_ () const
 Returns a copy of the acquired interface pointer.


Static Protected Methods

interface_pointer_type do_cast (LPUNKNOWN punk) comstl_throw_1(thrown_type)
 Perform the cast, throwing the exception_policy_type's thrown_type if the requested interface cannot be acquired.


Detailed Description

template<typename I>
class comstl::interface_cast_test< I >

Interface cast that tests whether a given interface pointer can be successfully queried.

This class performs a cast to ascertain whether the requested interface is available, but then releases the resultant interface, so no net changes are made to the reference count on the tested object.

Parameters:
I  The interface pointer type


Member Typedef Documentation

typedef interface_cast_test<I> class_type
 

The type of the current parameterisation.

Reimplemented from interface_cast_base< I, noaddref_release< I >, ignore_interface_cast_exception >.

typedef ignore_interface_cast_exception exception_policy_type [inherited]
 

The exception type.

typedef parent_class_type::interface_pointer_type interface_pointer_type
 

The interface pointer type.

Reimplemented from interface_cast_base< I, noaddref_release< I >, ignore_interface_cast_exception >.

typedef parent_class_type::interface_type interface_type
 

The interface type.

Reimplemented from interface_cast_base< I, noaddref_release< I >, ignore_interface_cast_exception >.

typedef noaddref_release< I > release_type [inherited]
 

The release type.

typedef exception_policy_type::thrown_type thrown_type [inherited]
 

The thrown type.


Constructor & Destructor Documentation

interface_cast_test J &    j [inline, explicit]
 

Constructor that attempts the speculative cast.

interface_cast_test interface_pointer_type    pi [inline, explicit]
 

Constructor that directly casts (without calling QueryInterface()).


Member Function Documentation

interface_pointer_type do_cast LPUNKNOWN    punk [inline, static, protected, inherited]
 

Perform the cast, throwing the exception_policy_type's thrown_type if the requested interface cannot be acquired.

Parameters:
punk  The interface pointer to cast
Returns:
The converted interface pointer

interface_pointer_type get_pointer_   const [inline, protected, inherited]
 

Returns a copy of the acquired interface pointer.

interface_pointer_type const& get_pointer_   [inline, protected, inherited]
 

Returns a non-mutating reference to the acquired interface pointer.

operator operator_bool_type   const [inline]
 

Represents whether the cast succeeded

Return values:
true  The interface cast succeeded
false  The interface cast failed

cs_bool_t operator!   const [inline]
 

Represents whether the cast failed.

Return values:
true  The interface cast failed
false  The interface cast succeeded


The documentation for this class was generated from the following file:

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