home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / xpcom / src / nsIFactory.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.0 KB  |  74 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __nsIFactory_h
  20. #define __nsIFactory_h
  21.  
  22. #include "prtypes.h"
  23. #include "nsISupports.h"
  24.  
  25. /*
  26.  * Datatypes and helper macros
  27.  */
  28.  
  29. typedef nsID nsCID;
  30.  
  31. // Define an CID
  32. #define NS_DEFINE_CID(_name, _cidspec) \
  33.   const nsCID _name = _cidspec
  34.  
  35. #define REFNSCID const nsCID&
  36.  
  37. /*
  38.  * nsIFactory interface
  39.  */
  40.  
  41. // {00000001-0000-0000-c000-000000000046}
  42. #define NS_IFACTORY_IID \
  43. { 0x00000001, 0x0000, 0x0000, \
  44.   { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } }
  45.  
  46. class nsIFactory: public nsISupports {
  47. public:
  48.   NS_IMETHOD CreateInstance(nsISupports *aOuter,
  49.                             const nsIID &aIID,
  50.                             void **aResult) = 0;
  51.  
  52.   NS_IMETHOD_(void) LockFactory(PRBool aLock) = 0;
  53. };
  54.  
  55. /**
  56.  * nsIFactory2 allows passing in a signature token when creating an
  57.  * instance. This allows instance recycling.
  58.  */
  59.  
  60. // {19997C41-A343-11d1-B665-00805F8A2676}
  61. #define NS_IFACTORY2_IID \
  62. { 0x19997c41, 0xa343, 0x11d1, \
  63.   { 0xb6, 0x65, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
  64.  
  65. class nsIFactory2: public nsIFactory {
  66. public:
  67.   NS_IMETHOD CreateInstance2(nsISupports *aOuter,
  68.                              const nsIID &aIID,
  69.                              void *aSignature,
  70.                              void **aResult) = 0;
  71. };
  72.  
  73. #endif
  74.