Back to index

lightning-sunbird  0.9+nobinonly
nsIFastLoadService.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla FastLoad code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Brendan Eich <brendan@mozilla.org> (original author)
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 
00039 #include "nsISupports.idl"
00040 #include "nsrootidl.idl"
00041 
00042 interface nsIFastLoadReadControl;
00043 interface nsIFile;
00044 interface nsIInputStream;
00045 interface nsIOutputStream;
00046 interface nsIObjectInputStream;
00047 interface nsIObjectOutputStream;
00048 
00049 [scriptable, uuid(715577db-d9c5-464a-a32e-0a40c29b22d4)]
00050 interface nsIFastLoadFileIO : nsISupports
00051 {
00052     readonly attribute nsIInputStream  inputStream;
00053     readonly attribute nsIOutputStream outputStream;
00054 };
00055 
00056 [scriptable, uuid(759e475e-0c23-4dbf-b1b8-78c9369e3072)]
00057 interface nsIFastLoadService : nsISupports
00058 {
00059     nsIFile newFastLoadFile(in string aBaseName);
00060 
00061     nsIObjectInputStream  newInputStream(in nsIInputStream aSrcStream);
00062     nsIObjectOutputStream newOutputStream(in nsIOutputStream aDestStream);
00063 
00064     // Flag values for the direction attribute and the aDirectionFlags
00065     // parameter to startMuxedDocument.
00066     const PRInt32 NS_FASTLOAD_READ = 1;
00067     const PRInt32 NS_FASTLOAD_WRITE = 2;
00068 
00069     attribute nsIObjectInputStream  inputStream;
00070     attribute nsIObjectOutputStream outputStream;
00071     attribute nsIFastLoadFileIO     fileIO;
00072     readonly attribute PRInt32      direction;
00073 
00089     void        startMuxedDocument(in nsISupports aURI,
00090                                    in string aURISpec,
00091                                    in PRInt32 aDirectionFlags);
00092     nsISupports selectMuxedDocument(in nsISupports aURI);
00093     void        endMuxedDocument(in nsISupports aURI);
00094 
00095     void        addDependency(in nsIFile aFile);
00096 
00097     PRUint32    computeChecksum(in nsIFile aFile,
00098                                 in nsIFastLoadReadControl aControl);
00099     void        cacheChecksum(in nsIFile aFile,
00100                               in nsIObjectOutputStream aStream);
00101 
00102     [noscript] void getFastLoadReferent(inout nsISupports aPtr);
00103 
00104     [noscript] void readFastLoadPtr(in nsIObjectInputStream aInputStream,
00105                                     inout nsISupports aPtr);
00106 
00107     [noscript] void writeFastLoadPtr(in nsIObjectOutputStream aOutputStream,
00108                                      in nsISupports aPtr);
00109 
00114     boolean     hasMuxedDocument(in string aURISpec);
00115 };
00116 
00117 %{C++
00118 #define NS_FASTLOADSERVICE_CLASSNAME "Mozilla FastLoad Service"
00119 
00120 #define NS_FASTLOADSERVICE_CID \
00121     {0xc943093c,0xac94,0x4bee,{0x84,0x0b,0x8b,0x5a,0x6e,0x31,0x4f,0xa7}}
00122 
00123 #define NS_FASTLOADSERVICE_CONTRACTID \
00124     "@mozilla.org/fast-load-service;1"
00125 
00126 #ifndef nsCOMPtr_h___
00127 # include "nsCOMPtr.h"
00128 #endif
00129 #ifndef __gen_nsIFile_h__
00130 # include "nsIFile.h"
00131 #endif
00132 #ifndef nsIServiceManager_h___
00133 # include "nsIServiceManager.h"
00134 #endif
00135 
00136 inline const nsGetServiceByCIDWithError
00137 do_GetFastLoadService(nsresult *aResultCode = 0)
00138 {
00139     static NS_DEFINE_CID(kFastLoadServiceCID, NS_FASTLOADSERVICE_CID);
00140     return nsGetServiceByCIDWithError(kFastLoadServiceCID, aResultCode);
00141 }
00142 
00143 inline nsresult
00144 NS_AddFastLoadDependency(nsIFile* aFile)
00145 {
00146     nsCOMPtr<nsIFastLoadService> fastLoadService(do_GetFastLoadService());
00147     if (fastLoadService) {
00148         nsresult rv = fastLoadService->AddDependency(aFile);
00149         if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE)
00150             return rv;
00151     }
00152     return NS_OK;
00153 }
00154 
00155 #if defined(XP_UNIX) || defined(XP_BEOS)
00156 #define PLATFORM_FASL_SUFFIX ".mfasl"
00157 #elif defined(XP_WIN) || defined(XP_OS2)
00158 #define PLATFORM_FASL_SUFFIX ".mfl"
00159 #endif
00160 
00161 %}