home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / modules / libfont / src / wfMime.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.3 KB  |  77 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.  * wfMime.h (wfMimeList.h)
  20.  *
  21.  * Implements a list of mime types. This doesn't know anything about how the
  22.  * mime type list is being used. It can track mimetypes being enabled or not.
  23.  *
  24.  * dp Suresh <dp@netscape.com>
  25.  */
  26.  
  27.  
  28. #ifndef _wfMime_H_
  29. #define _wfMime_H_
  30.  
  31. #include <string.h>
  32.  
  33. #include "libfont.h"
  34. #include "wfList.h"
  35.  
  36. struct mime_store {
  37.     char *mimetype;
  38.     char *extensions;        // comma seperated list of extension. Dot is optional
  39.     char *description;
  40.     int isEnabled;            // 0 if disabled; else enabled
  41. };
  42.  
  43. class wfMimeList : public wfList {
  44. private:
  45.     struct mime_store *find(const char *mimetype);
  46.     const char *scanToken(const char *str, char *buf, int len, char *stopChars,
  47.         int noSpacesOnOutput);
  48.     const char *skipSpaces(const char *str);
  49.  
  50. public:
  51.     // Constructor
  52.     wfMimeList(const char *mimeString = NULL);
  53.  
  54.     // Destructor
  55.     ~wfMimeList();
  56.  
  57.     int finalize(void);
  58.     
  59.     // Sets the enabled status for mimetype. Valid status values are
  60.     //    0    : Disabled
  61.     // +ve    : Enabled
  62.     // Returns 0 if success; -1 if error (mimetype not found, ...)
  63.     int setEnabledStatus(const char *mimetype, int enabledStatus);
  64.   
  65.     int isEnabled(const char *mimetype);
  66.     const char *getMimetypeFromExtension(const char *ext);
  67.  
  68.     // Describes the status and attributes of all mimetypes as a string
  69.     // This string can be stored and later used to recreate the exact state of
  70.     // this wfMimeList using wfMimeList::recreate()
  71.     char *describe();
  72.     int reconstruct(const char *describeString);
  73. };
  74.  
  75. #endif /* _wfMime_H_ */
  76.  
  77.