home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / src / cdoer.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.8 KB  |  98 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.  * Implements the Observer
  21.  *
  22.  * dp Suresh <dp@netscape.com>
  23.  */
  24.  
  25.  
  26. #include "libfont.h"
  27.  
  28. #include "Pcdoer.h"
  29. #include "nf.h"
  30. #include "coremem.h"
  31.  
  32. /****************************************************************************
  33.  *                 Implementation of common interface methods
  34.  ****************************************************************************/
  35.  
  36. #ifdef OVERRIDE_cdoer_getInterface
  37. #include "Mnfdoer.h"
  38.  
  39. extern "C" JMC_PUBLIC_API(void*)
  40. /* ARGSUSED */
  41. _cdoer_getInterface(struct cdoer* self, jint op, const JMCInterfaceID* iid, JMCException* *exc)
  42. {
  43.     if (memcmp(iid, &nfdoer_ID, sizeof(JMCInterfaceID)) == 0)
  44.         return cdoerImpl2cdoer(cdoer2cdoerImpl(self));
  45.     return _cdoer_getBackwardCompatibleInterface(self, iid, exc);
  46. }
  47. #endif /* OVERRIDE_cdoer_getInterface */
  48.  
  49. extern "C" JMC_PUBLIC_API(void*)
  50. /* ARGSUSED */
  51. _cdoer_getBackwardCompatibleInterface(struct cdoer* self,
  52.                                     const JMCInterfaceID* iid,
  53.                                     struct JMCException* *exceptionThrown)
  54. {
  55.     return (NULL);
  56. }
  57.  
  58. extern "C" JMC_PUBLIC_API(void)
  59. /* ARGSUSED */
  60. _cdoer_init(struct cdoer* self, JMCException* *exception,
  61.             nfFontObserverCallback callback, void *client_data)
  62.  
  63. {
  64.     struct cdoerImpl *oimpl = cdoer2cdoerImpl(self);
  65.     oimpl->update_callback = callback;
  66.     oimpl->client_data = client_data;
  67. }
  68.  
  69. #ifdef OVERRIDE_cdoer_finalize
  70. extern "C" JMC_PUBLIC_API(void)
  71. /* ARGSUSED */
  72. _cdoer_finalize(struct cdoer* self, jint op, JMCException* *exc)
  73. {
  74.     /* Finally, free the memory for the object containter. */
  75.     XP_FREEIF(self);
  76. }
  77. #endif /* OVERRIDE_cdoer_finalize */
  78.  
  79.  
  80.  
  81. /****************************************************************************
  82.  *                 Implementation of Object specific methods
  83.  ****************************************************************************/
  84.  
  85.  
  86. extern "C" JMC_PUBLIC_API(void)
  87. /* ARGSUSED */
  88. _cdoer_Update(struct cdoer* self, jint op, struct nff *f,
  89.               JMCException* *exception)
  90. {
  91.     struct cdoerImpl *oimpl = cdoer2cdoerImpl(self);
  92.     if (oimpl->update_callback)
  93.     {
  94.         (*oimpl->update_callback)(f, oimpl->client_data);
  95.     }
  96. }
  97.  
  98.