home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / jmcgen / src / Mwinrf.c < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.6 KB  |  166 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.  * Source date: 26 Feb 1998 01:03:40 GMT
  20.  * netscape/fonts/winrf module C stub file
  21.  * Generated by jmc version 1.8 -- DO NOT EDIT
  22.  ******************************************************************************/
  23.  
  24. #include <stdlib.h>
  25. #include <string.h>
  26. #include "xp_mem.h"
  27.  
  28. /* Include the implementation-specific header: */
  29. #include "Pwinrf.h"
  30.  
  31. /* Include other interface headers: */
  32.  
  33. /*******************************************************************************
  34.  * winrf Methods
  35.  ******************************************************************************/
  36.  
  37. #ifndef OVERRIDE_winrf_getInterface
  38. JMC_PUBLIC_API(void*)
  39. _winrf_getInterface(struct winrf* self, jint op, const JMCInterfaceID* iid, JMCException* *exc)
  40. {
  41.     if (memcmp(iid, &winrf_ID, sizeof(JMCInterfaceID)) == 0)
  42.         return winrfImpl2winrf(winrf2winrfImpl(self));
  43.     return _winrf_getBackwardCompatibleInterface(self, iid, exc);
  44. }
  45. #endif
  46.  
  47. #ifndef OVERRIDE_winrf_addRef
  48. JMC_PUBLIC_API(void)
  49. _winrf_addRef(struct winrf* self, jint op, JMCException* *exc)
  50. {
  51.     winrfImplHeader* impl = (winrfImplHeader*)winrf2winrfImpl(self);
  52.     impl->refcount++;
  53. }
  54. #endif
  55.  
  56. #ifndef OVERRIDE_winrf_release
  57. JMC_PUBLIC_API(void)
  58. _winrf_release(struct winrf* self, jint op, JMCException* *exc)
  59. {
  60.     winrfImplHeader* impl = (winrfImplHeader*)winrf2winrfImpl(self);
  61.     if (--impl->refcount == 0) {
  62.         winrf_finalize(self, exc);
  63.     }
  64. }
  65. #endif
  66.  
  67. #ifndef OVERRIDE_winrf_hashCode
  68. JMC_PUBLIC_API(jint)
  69. _winrf_hashCode(struct winrf* self, jint op, JMCException* *exc)
  70. {
  71.     return (jint)self;
  72. }
  73. #endif
  74.  
  75. #ifndef OVERRIDE_winrf_equals
  76. JMC_PUBLIC_API(jbool)
  77. _winrf_equals(struct winrf* self, jint op, void* obj, JMCException* *exc)
  78. {
  79.     return self == obj;
  80. }
  81. #endif
  82.  
  83. #ifndef OVERRIDE_winrf_clone
  84. JMC_PUBLIC_API(void*)
  85. _winrf_clone(struct winrf* self, jint op, JMCException* *exc)
  86. {
  87.     winrfImpl* impl = winrf2winrfImpl(self);
  88.     winrfImpl* newImpl = (winrfImpl*)malloc(sizeof(winrfImpl));
  89.     if (newImpl == NULL) return NULL;
  90.     memcpy(newImpl, impl, sizeof(winrfImpl));
  91.     ((winrfImplHeader*)newImpl)->refcount = 1;
  92.     return newImpl;
  93. }
  94. #endif
  95.  
  96. #ifndef OVERRIDE_winrf_toString
  97. JMC_PUBLIC_API(const char*)
  98. _winrf_toString(struct winrf* self, jint op, JMCException* *exc)
  99. {
  100.     return NULL;
  101. }
  102. #endif
  103.  
  104. #ifndef OVERRIDE_winrf_finalize
  105. JMC_PUBLIC_API(void)
  106. _winrf_finalize(struct winrf* self, jint op, JMCException* *exc)
  107. {
  108.     /* Override this method and add your own finalization here. */
  109.     XP_FREEIF(self);
  110. }
  111. #endif
  112.  
  113. /*******************************************************************************
  114.  * Jump Tables
  115.  ******************************************************************************/
  116.  
  117. const struct winrfInterface winrfVtable = {
  118.     _winrf_getInterface,
  119.     _winrf_addRef,
  120.     _winrf_release,
  121.     _winrf_hashCode,
  122.     _winrf_equals,
  123.     _winrf_clone,
  124.     _winrf_toString,
  125.     _winrf_finalize,
  126.     _winrf_GetMatchInfo,
  127.     _winrf_GetPointSize,
  128.     _winrf_GetMaxWidth,
  129.     _winrf_GetFontAscent,
  130.     _winrf_GetFontDescent,
  131.     _winrf_GetMaxLeftBearing,
  132.     _winrf_GetMaxRightBearing,
  133.     _winrf_SetTransformMatrix,
  134.     _winrf_GetTransformMatrix,
  135.     _winrf_MeasureText,
  136.     _winrf_MeasureBoundingBox,
  137.     _winrf_DrawText,
  138.     _winrf_PrepareDraw,
  139.     _winrf_EndDraw
  140. };
  141.  
  142. /*******************************************************************************
  143.  * Factory Operations
  144.  ******************************************************************************/
  145.  
  146. JMC_PUBLIC_API(winrf*)
  147. winrfFactory_Create(JMCException* *exception)
  148. {
  149.     winrfImplHeader* impl = (winrfImplHeader*)XP_NEW_ZAP(winrfImpl);
  150.     winrf* self;
  151.     if (impl == NULL) {
  152.         JMC_EXCEPTION(exception, JMCEXCEPTION_OUT_OF_MEMORY);
  153.         return NULL;
  154.     }
  155.     self = winrfImpl2winrf(impl);
  156.     impl->vtablewinrf = &winrfVtable;
  157.     impl->refcount = 1;
  158.     _winrf_init(self, exception);
  159.     if (JMC_EXCEPTION_RETURNED(exception)) {
  160.         XP_FREE(impl);
  161.         return NULL;
  162.     }
  163.     return self;
  164. }
  165.  
  166.