Back to index

lightning-sunbird  0.9+nobinonly
nsMimeConverter.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK *****
00038  * This Original Code has been modified by IBM Corporation. Modifications made by IBM 
00039  * described herein are Copyright (c) International Business Machines Corporation, 2000.
00040  * Modifications to Mozilla code or documentation identified per MPL Section 3.3
00041  *
00042  * Date             Modified by     Description of modification
00043  * 04/20/2000       IBM Corp.      OS/2 VisualAge build.
00044  */
00045  
00046 /*
00047  * This interface is implemented by libmime. This interface is used by 
00048  * a Content-Type handler "Plug In" (i.e. vCard) for accessing various 
00049  * internal information about the object class system of libmime. When 
00050  * libmime progresses to a C++ object class, this would probably change.
00051  */
00052 #ifndef nsMimeConverter_h_
00053 #define nsMimeConverter_h_
00054 
00055 #include "nsISupports.h"
00056 #include "prtypes.h"
00057 #include "nsIMimeConverter.h"
00058 #include "nsICharsetConverterManager.h"
00059 #include "nsCOMPtr.h"
00060 
00061 class nsMimeConverter : public nsIMimeConverter {
00062 public: 
00063   nsMimeConverter();
00064   virtual ~nsMimeConverter();
00065        
00066   /* this macro defines QueryInterface, AddRef and Release for this class */
00067   NS_DECL_ISUPPORTS 
00068 
00069   // These methods are all implemented by libmime to be used by 
00070   // content type handler plugins for processing stream data. 
00071 
00072   // Decode routine
00073   NS_IMETHOD DecodeMimeHeader(const char *header, 
00074                               char **decodedString,
00075                               const char *default_charset = 0,
00076                               PRBool override_charset = PR_FALSE,
00077                               PRBool eatContinuations = PR_TRUE);
00078 
00079   // Decode routine (also converts output to unicode)
00080   // On success, decodedString is never null
00081   NS_IMETHOD DecodeMimeHeader(const char *header,
00082                               PRUnichar **decodedString,
00083                               const char *default_charset = 0,
00084                               PRBool override_charset = PR_FALSE,
00085                               PRBool eatContinuations = PR_TRUE);
00086 
00087   // Decode routine (also converts output to unicode)
00088   // On success, decodedString is never null
00089   NS_IMETHOD DecodeMimeHeader(const char *header, 
00090                               nsAString& decodedString,
00091                               const char *default_charset = nsnull,
00092                               PRBool override_charset = PR_FALSE,
00093                               PRBool eatContinuations = PR_TRUE);
00094 
00095   // Encode routine
00096   NS_IMETHOD EncodeMimePartIIStr(const char    *header, 
00097                                  PRBool        structured, 
00098                                  const char    *mailCharset, 
00099                                  PRInt32       fieldnamelen,
00100                                  PRInt32       encodedWordSize, 
00101                                  char          **encodedString);
00102 
00103   // Encode routine (utf-8 input)
00104   NS_IMETHOD EncodeMimePartIIStr_UTF8(const char    *header, 
00105                                       PRBool        structured, 
00106                                       const char    *mailCharset, 
00107                                       PRInt32       fieldnamelen,
00108                                       PRInt32       encodedWordSize, 
00109                                       char          **encodedString);
00110 
00111   NS_IMETHOD B64EncoderInit(nsresult (*PR_CALLBACK output_fn) (const char *buf, PRInt32 size, void *closure), 
00112                                 void *closure, MimeEncoderData **returnEncoderData);
00113 
00114   NS_IMETHOD QPEncoderInit (nsresult (*PR_CALLBACK output_fn) (const char *buf, 
00115                                 PRInt32 size, void *closure), void *closure, 
00116                                 MimeEncoderData ** returnEncoderData);
00117 
00118   NS_IMETHOD UUEncoderInit (char *filename, nsresult (*PR_CALLBACK output_fn) 
00119                                (const char *buf, PRInt32 size, void *closure), void *closure, 
00120                                MimeEncoderData ** returnEncoderData);
00121 
00122   NS_IMETHOD EncoderDestroy(MimeEncoderData *data, PRBool abort_p);
00123 
00124   NS_IMETHOD EncoderWrite (MimeEncoderData *data, const char *buffer, PRInt32 size, PRInt32 *written);
00125 
00126 }; 
00127 
00128 #endif /* nsMimeConverter_h_ */