Added |CallQueryInterface|, a type-safe interface to |QueryInterface|

This commit is contained in:
scc%netscape.com 1999-05-04 09:44:27 +00:00
parent d686c1191e
commit 6bab6751e6
3 changed files with 42 additions and 0 deletions

View File

@ -554,4 +554,18 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// A type-safe interface for calling |QueryInterface()|. A similar implementation
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
template <class T>
inline
nsresult
CallQueryInterface( nsISupports* aSource, T** aDestination )
// a type-safe shortcut for calling the |QueryInterface()| member function
{
NS_PRECONDITION(aSource, "null parameter");
return aSource->QueryInterface(T::GetIID(), aDestination);
}
#endif /* __nsISupportsUtils_h */ #endif /* __nsISupportsUtils_h */

View File

@ -554,4 +554,18 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// A type-safe interface for calling |QueryInterface()|. A similar implementation
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
template <class T>
inline
nsresult
CallQueryInterface( nsISupports* aSource, T** aDestination )
// a type-safe shortcut for calling the |QueryInterface()| member function
{
NS_PRECONDITION(aSource, "null parameter");
return aSource->QueryInterface(T::GetIID(), aDestination);
}
#endif /* __nsISupportsUtils_h */ #endif /* __nsISupportsUtils_h */

View File

@ -554,4 +554,18 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// A type-safe interface for calling |QueryInterface()|. A similar implementation
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
template <class T>
inline
nsresult
CallQueryInterface( nsISupports* aSource, T** aDestination )
// a type-safe shortcut for calling the |QueryInterface()| member function
{
NS_PRECONDITION(aSource, "null parameter");
return aSource->QueryInterface(T::GetIID(), aDestination);
}
#endif /* __nsISupportsUtils_h */ #endif /* __nsISupportsUtils_h */