Go to the documentation of this file.
28 #ifndef __SB_CLASSINFO_UTILS_H__
29 #define __SB_CLASSINFO_UTILS_H__
31 #include <nsComponentManagerUtils.h>
32 #include <nsIClassInfoImpl.h>
33 #include <nsIProgrammingLanguage.h>
35 #include <nsStringGlue.h>
38 #define SB_IMPL_CLASSINFO( _class, \
46 _class::GetInterfaces( PRUint32 *aCount, nsIID ***aArray ) \
48 NS_ENSURE_ARG_POINTER(aCount); \
49 NS_ENSURE_ARG_POINTER(aArray); \
50 return NS_CI_INTERFACE_GETTER_NAME(_class)( aCount, aArray ); \
53 _class::GetHelperForLanguage( PRUint32 language, nsISupports **_retval ) \
59 _class::GetContractID( char **aContractID ) \
61 if ( _contractID ) { \
62 *aContractID = ToNewCString( NS_LITERAL_CSTRING(_contractID) ); \
63 return *aContractID ? NS_OK : NS_ERROR_OUT_OF_MEMORY; \
68 _class::GetClassDescription( char **aClassDescription ) \
70 *aClassDescription = ToNewCString( NS_LITERAL_CSTRING(_description) ); \
71 return *aClassDescription ? NS_OK : NS_ERROR_OUT_OF_MEMORY; \
74 _class::GetClassID( nsCID **aClassID ) \
76 *aClassID = (nsCID*) nsMemory::Alloc( sizeof(nsCID) ); \
77 return *aClassID ? GetClassIDNoAlloc(*aClassID) : NS_ERROR_OUT_OF_MEMORY; \
80 _class::GetImplementationLanguage( PRUint32 *aImplementationLanguage ) \
82 *aImplementationLanguage = _language; \
86 _class::GetFlags( PRUint32 *aFlags ) \
92 _class::GetClassIDNoAlloc( nsCID *aClassIDNoAlloc ) \
94 *aClassIDNoAlloc = _classID; \
99 #define SB_IMPL_CLASSINFO_INTERFACES_ONLY(_class) \
101 _class::GetInterfaces(PRUint32 *aCount, nsIID ***aArray) \
103 NS_ENSURE_ARG_POINTER(aCount); \
104 NS_ENSURE_ARG_POINTER(aArray); \
105 return NS_CI_INTERFACE_GETTER_NAME(_class)(aCount, aArray); \
108 _class::GetHelperForLanguage(PRUint32 language, nsISupports **_retval) \
114 _class::GetContractID(char **aContractID) \
116 *aContractID = nsnull; \
120 _class::GetClassDescription(char **aClassDescription) \
122 *aClassDescription = nsnull; \
126 _class::GetClassID(nsCID **aClassID) \
128 *aClassID = nsnull; \
132 _class::GetImplementationLanguage(PRUint32 *aImplementationLanguage) \
134 *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS; \
138 _class::GetFlags(PRUint32 *aFlags) \
144 _class::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) \
146 return NS_ERROR_NOT_AVAILABLE; \
149 #endif // __SB_CLASSINFO_UTILS_H__