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

  1. /* -*- Mode: C++; tab-width: 8; 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. #ifndef _wfDlm_H_
  21. #define _wfDlm_H_
  22.  
  23. #include "libfont.h"
  24. #include "nf.h"
  25.  
  26. #include "Mnffp.h"
  27. #include "Mnfdlm.h"
  28.  
  29. typedef struct nfdlm *nfdlm_OBJECT_CREATE_PROC(struct JMCException *);
  30.  
  31. class wfDlm {
  32. protected:
  33.   // 0 : stat on file was never done
  34.   // 1 : stat on file was done and was successful
  35.   // -1: stat on file was done and was unsuccessful
  36.   // -2: file cannot be loaded
  37.   // -3: file is not a Displayer dlm
  38.   int m_state;
  39.   
  40.   char *m_filename;
  41.   PRTime m_modifyTime;
  42.   PRUint32 m_fileSize;
  43.  
  44.   PRLibrary *m_lib;
  45.   struct nfdlm *m_dlmInterface;
  46.  
  47. public:
  48.   wfDlm(const char *filename, const char *describeStr = NULL);
  49.   ~wfDlm();
  50.   int finalize(void);
  51.   
  52.   // isEmpty: returns positive if filename is either non-existent or 0 size
  53.   //            else returns 0.
  54.   static int isEmpty(const char *filename);
  55.  
  56.   // returns the current status of the dlm object
  57.   // -ve    : invalid
  58.   // 0, +ve    : valid
  59.   int status(void);
  60.   
  61.   // Describes the status and attributes of the class as a string
  62.   // This string can be stored and later used to recreate the exact state of
  63.   // this class.
  64.   char *describe();
  65.   int reconstruct(const char *describeString);
  66.  
  67.   const char *filename();
  68.   
  69.   // This tracks if a file has changed since the last time we saw it. The
  70.   // criterion for file changing is
  71.   //        1. file modified time
  72.   //        2. file size
  73.   int isChanged();
  74.  
  75.   //
  76.   // Sync with the current modified time and size of the file
  77.   int sync();
  78.  
  79.   // Load/Unload the Displayer dlm to memory
  80.   int load(void);
  81.   int unload(int force = 0);
  82.   FARPROC findSymbol(const char *symbol);
  83.  
  84.   // Maybe we should move this off to a subclass
  85.   struct nffp *createDisplayerObject(struct nffbp* brokerDisplayerInterface);
  86. };
  87. #endif /* _wfDlm_H_ */
  88.  
  89.