home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libimg / src / MPSIMGCB.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.6 KB  |  160 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. /*******************************************************************************
  20.  * Source date: 22 Feb 1997 07:07:50 GMT
  21.  * netscape/libimg/PSIMGCB module C stub file
  22.  * Generated by jmc version 1.8 -- DO NOT EDIT
  23.  ******************************************************************************/
  24.  
  25. #include <stdlib.h>
  26. #include <string.h>
  27. #include "xp_mem.h"
  28.  
  29. /* Include the implementation-specific header: */
  30. #include "PPSIMGCB.h"
  31.  
  32. /* Include other interface headers: */
  33.  
  34. /*******************************************************************************
  35.  * PSIMGCB Methods
  36.  ******************************************************************************/
  37.  
  38. #ifndef OVERRIDE_PSIMGCB_getInterface
  39. JMC_PUBLIC_API(void*)
  40. _PSIMGCB_getInterface(struct PSIMGCB* self, jint op, const JMCInterfaceID* iid, JMCException* *exc)
  41. {
  42.     if (memcmp(iid, &PSIMGCB_ID, sizeof(JMCInterfaceID)) == 0)
  43.         return PSIMGCBImpl2PSIMGCB(PSIMGCB2PSIMGCBImpl(self));
  44.     return _PSIMGCB_getBackwardCompatibleInterface(self, iid, exc);
  45. }
  46. #endif
  47.  
  48. #ifndef OVERRIDE_PSIMGCB_addRef
  49. JMC_PUBLIC_API(void)
  50. _PSIMGCB_addRef(struct PSIMGCB* self, jint op, JMCException* *exc)
  51. {
  52.     PSIMGCBImplHeader* impl = (PSIMGCBImplHeader*)PSIMGCB2PSIMGCBImpl(self);
  53.     impl->refcount++;
  54. }
  55. #endif
  56.  
  57. #ifndef OVERRIDE_PSIMGCB_release
  58. JMC_PUBLIC_API(void)
  59. _PSIMGCB_release(struct PSIMGCB* self, jint op, JMCException* *exc)
  60. {
  61.     PSIMGCBImplHeader* impl = (PSIMGCBImplHeader*)PSIMGCB2PSIMGCBImpl(self);
  62.     if (--impl->refcount == 0) {
  63.         PSIMGCB_finalize(self, exc);
  64.     }
  65. }
  66. #endif
  67.  
  68. #ifndef OVERRIDE_PSIMGCB_hashCode
  69. JMC_PUBLIC_API(jint)
  70. _PSIMGCB_hashCode(struct PSIMGCB* self, jint op, JMCException* *exc)
  71. {
  72.     return (jint)self;
  73. }
  74. #endif
  75.  
  76. #ifndef OVERRIDE_PSIMGCB_equals
  77. JMC_PUBLIC_API(jbool)
  78. _PSIMGCB_equals(struct PSIMGCB* self, jint op, void* obj, JMCException* *exc)
  79. {
  80.     return self == obj;
  81. }
  82. #endif
  83.  
  84. #ifndef OVERRIDE_PSIMGCB_clone
  85. JMC_PUBLIC_API(void*)
  86. _PSIMGCB_clone(struct PSIMGCB* self, jint op, JMCException* *exc)
  87. {
  88.     PSIMGCBImpl* impl = PSIMGCB2PSIMGCBImpl(self);
  89.     PSIMGCBImpl* newImpl = (PSIMGCBImpl*)malloc(sizeof(PSIMGCBImpl));
  90.     if (newImpl == NULL) return NULL;
  91.     memcpy(newImpl, impl, sizeof(PSIMGCBImpl));
  92.     ((PSIMGCBImplHeader*)newImpl)->refcount = 1;
  93.     return newImpl;
  94. }
  95. #endif
  96.  
  97. #ifndef OVERRIDE_PSIMGCB_toString
  98. JMC_PUBLIC_API(const char*)
  99. _PSIMGCB_toString(struct PSIMGCB* self, jint op, JMCException* *exc)
  100. {
  101.     return NULL;
  102. }
  103. #endif
  104.  
  105. #ifndef OVERRIDE_PSIMGCB_finalize
  106. JMC_PUBLIC_API(void)
  107. _PSIMGCB_finalize(struct PSIMGCB* self, jint op, JMCException* *exc)
  108. {
  109.     /* Override this method and add your own finalization here. */
  110.     XP_FREEIF(self);
  111. }
  112. #endif
  113.  
  114. /*******************************************************************************
  115.  * Jump Tables
  116.  ******************************************************************************/
  117.  
  118. const struct PSIMGCBInterface PSIMGCBVtable = {
  119.     _PSIMGCB_getInterface,
  120.     _PSIMGCB_addRef,
  121.     _PSIMGCB_release,
  122.     _PSIMGCB_hashCode,
  123.     _PSIMGCB_equals,
  124.     _PSIMGCB_clone,
  125.     _PSIMGCB_toString,
  126.     _PSIMGCB_finalize,
  127.     _PSIMGCB_NewPixmap,
  128.     _PSIMGCB_UpdatePixmap,
  129.     _PSIMGCB_ControlPixmapBits,
  130.     _PSIMGCB_DestroyPixmap,
  131.     _PSIMGCB_DisplayPixmap,
  132.     _PSIMGCB_DisplayIcon,
  133.     _PSIMGCB_GetIconDimensions
  134. };
  135.  
  136. /*******************************************************************************
  137.  * Factory Operations
  138.  ******************************************************************************/
  139.  
  140. JMC_PUBLIC_API(PSIMGCB*)
  141. PSIMGCBFactory_Create(JMCException* *exception)
  142. {
  143.     PSIMGCBImplHeader* impl = (PSIMGCBImplHeader*)XP_NEW_ZAP(PSIMGCBImpl);
  144.     PSIMGCB* self;
  145.     if (impl == NULL) {
  146.         JMC_EXCEPTION(exception, JMCEXCEPTION_OUT_OF_MEMORY);
  147.         return NULL;
  148.     }
  149.     self = PSIMGCBImpl2PSIMGCB(impl);
  150.     impl->vtablePSIMGCB = &PSIMGCBVtable;
  151.     impl->refcount = 1;
  152.     _PSIMGCB_init(self, exception);
  153.     if (JMC_EXCEPTION_RETURNED(exception)) {
  154.         XP_FREE(impl);
  155.         return NULL;
  156.     }
  157.     return self;
  158. }
  159.  
  160.