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

git-svn-id: svn://10.0.0.236/trunk@30100 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%netscape.com 1999-05-04 09:44:27 +00:00
parent c2578a9d5f
commit 8a9c9eb0d5
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 */

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 */

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 */