nsIFactory.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/components/nsIFactory.idl
  3. */
  4. #ifndef __gen_nsIFactory_h__
  5. #define __gen_nsIFactory_h__
  6. #ifndef __gen_nsISupports_h__
  7. #include "nsISupports.h"
  8. #endif
  9. /* For IDL files that don't want to include root IDL files. */
  10. #ifndef NS_NO_VTABLE
  11. #define NS_NO_VTABLE
  12. #endif
  13. /* starting interface: nsIFactory */
  14. #define NS_IFACTORY_IID_STR "00000001-0000-0000-c000-000000000046"
  15. #define NS_IFACTORY_IID \
  16. {0x00000001, 0x0000, 0x0000, \
  17. { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 }}
  18. /**
  19. * A class factory allows the creation of nsISupports derived
  20. * components without specifying a concrete base class.
  21. *
  22. * @status FROZEN
  23. */
  24. class NS_NO_VTABLE nsIFactory : public nsISupports {
  25. public:
  26. NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFACTORY_IID)
  27. /**
  28. * Creates an instance of a component.
  29. *
  30. * @param aOuter Pointer to a component that wishes to be aggregated
  31. * in the resulting instance. This will be nsnull if no
  32. * aggregation is requested.
  33. * @param iid The IID of the interface being requested in
  34. * the component which is being currently created.
  35. * @param result [out] Pointer to the newly created instance, if successful.
  36. * @return NS_OK - Component successfully created and the interface
  37. * being requested was successfully returned in result.
  38. * NS_NOINTERFACE - Interface not accessible.
  39. * NS_ERROR_NO_AGGREGATION - if an 'outer' object is supplied, but the
  40. * component is not aggregatable.
  41. * NS_ERROR* - Method failure.
  42. */
  43. /* void createInstance (in nsISupports aOuter, in nsIIDRef iid, [iid_is (iid), retval] out nsQIResult result); */
  44. NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID & iid, void * *result) = 0;
  45. /**
  46. * LockFactory provides the client a way to keep the component
  47. * in memory until it is finished with it. The client can call
  48. * LockFactory(PR_TRUE) to lock the factory and LockFactory(PR_FALSE)
  49. * to release the factory.
  50. *
  51. * @param lock - Must be PR_TRUE or PR_FALSE
  52. * @return NS_OK - If the lock operation was successful.
  53. * NS_ERROR* - Method failure.
  54. */
  55. /* void lockFactory (in PRBool lock); */
  56. NS_IMETHOD LockFactory(PRBool lock) = 0;
  57. };
  58. /* Use this macro when declaring classes that implement this interface. */
  59. #define NS_DECL_NSIFACTORY \
  60. NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID & iid, void * *result); \
  61. NS_IMETHOD LockFactory(PRBool lock);
  62. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  63. #define NS_FORWARD_NSIFACTORY(_to) \
  64. NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID & iid, void * *result) { return _to CreateInstance(aOuter, iid, result); } \
  65. NS_IMETHOD LockFactory(PRBool lock) { return _to LockFactory(lock); }
  66. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  67. #define NS_FORWARD_SAFE_NSIFACTORY(_to) \
  68. NS_IMETHOD CreateInstance(nsISupports *aOuter, const nsIID & iid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateInstance(aOuter, iid, result); } \
  69. NS_IMETHOD LockFactory(PRBool lock) { return !_to ? NS_ERROR_NULL_POINTER : _to->LockFactory(lock); }
  70. #if 0
  71. /* Use the code below as a template for the implementation class for this interface. */
  72. /* Header file */
  73. class nsFactory : public nsIFactory
  74. {
  75. public:
  76. NS_DECL_ISUPPORTS
  77. NS_DECL_NSIFACTORY
  78. nsFactory();
  79. private:
  80. ~nsFactory();
  81. protected:
  82. /* additional members */
  83. };
  84. /* Implementation file */
  85. NS_IMPL_ISUPPORTS1(nsFactory, nsIFactory)
  86. nsFactory::nsFactory()
  87. {
  88. /* member initializers and constructor code */
  89. }
  90. nsFactory::~nsFactory()
  91. {
  92. /* destructor code */
  93. }
  94. /* void createInstance (in nsISupports aOuter, in nsIIDRef iid, [iid_is (iid), retval] out nsQIResult result); */
  95. NS_IMETHODIMP nsFactory::CreateInstance(nsISupports *aOuter, const nsIID & iid, void * *result)
  96. {
  97. return NS_ERROR_NOT_IMPLEMENTED;
  98. }
  99. /* void lockFactory (in PRBool lock); */
  100. NS_IMETHODIMP nsFactory::LockFactory(PRBool lock)
  101. {
  102. return NS_ERROR_NOT_IMPLEMENTED;
  103. }
  104. /* End of implementation class template. */
  105. #endif
  106. #endif /* __gen_nsIFactory_h__ */