home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / libmime / mimeleaf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.5 KB  |  68 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. /* mimeleaf.h --- definition of the MimeLeaf class (see mimei.h)
  20.    Created: Jamie Zawinski <jwz@netscape.com>, 15-May-96.
  21.  */
  22.  
  23. #ifndef _MIMELEAF_H_
  24. #define _MIMELEAF_H_
  25.  
  26. #include "mimeobj.h"
  27. #include "mimeenc.h"
  28.  
  29. /* MimeLeaf is the class for the objects representing all MIME types which
  30.    are not containers for other MIME objects.  The implication of this is
  31.    that they are MIME types which can have Content-Transfer-Encodings 
  32.    applied to their data.  This class provides that service in its 
  33.    parse_buffer() method:
  34.  
  35.      int (*parse_decoded_buffer) (char *buf, int32 size, MimeObject *obj)
  36.  
  37.    The `parse_buffer' method of MimeLeaf passes each block of data through
  38.    the appropriate decoder (if any) and then calls `parse_decoded_buffer'
  39.    on each block (not line) of output.
  40.  
  41.    The default `parse_decoded_buffer' method of MimeLeaf line-buffers the
  42.    now-decoded data, handing each line to the `parse_line' method in turn.
  43.    If different behavior is desired (for example, if a class wants access
  44.    to the decoded data before it is line-buffered) the `parse_decoded_buffer'
  45.    method should be overridden.  (MimeExternalObject does this.)
  46.  */
  47.  
  48. typedef struct MimeLeafClass MimeLeafClass;
  49. typedef struct MimeLeaf      MimeLeaf;
  50.  
  51. struct MimeLeafClass {
  52.   MimeObjectClass object;
  53.   /* This is the callback that is handed to the decoder. */
  54.   int (*parse_decoded_buffer) (char *buf, int32 size, MimeObject *obj);
  55. };
  56.  
  57. extern MimeLeafClass mimeLeafClass;
  58.  
  59. struct MimeLeaf {
  60.   MimeObject object;        /* superclass variables */
  61.  
  62.   /* If we're doing Base64, Quoted-Printable, or UU decoding, this is the
  63.      state object for the decoder. */
  64.   MimeDecoderData *decoder_data;
  65. };
  66.  
  67. #endif /* _MIMELEAF_H_ */
  68.