mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Added |CallQueryInterface|, a type-safe interface to |QueryInterface|
This commit is contained in:
parent
d686c1191e
commit
6bab6751e6
@ -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 */
|
||||||
|
@ -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 */
|
||||||
|
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user