/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIStreamAsFile.idl
 */

#ifndef __gen_nsIStreamAsFile_h__
#define __gen_nsIStreamAsFile_h__

#include "nsrootidl.h"
#include "nsISupports.h"

class nsIFile; /* forward declaration */

class nsIStreamAsFileObserver; /* forward declaration */


/* starting interface:    nsIStreamAsFile */
#define NS_ISTREAMASFILE_IID_STR "0eedbbf0-92d9-11d3-90d3-0040056a906e"

#define NS_ISTREAMASFILE_IID \
  {0x0eedbbf0, 0x92d9, 0x11d3, \
    { 0x90, 0xd3, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e }}

/**
 * In addition to enhancing effective network response time via caching, the
 * cache manager serves a second purpose by providing the stream-as-file
 * service required by traditional browser plugins and the jar: protocol
 * handler.  The interface below provides a means for a client to determine the
 * filename associated with a stream and to detect modification/deletion of
 * that file.
 */
class NS_NO_VTABLE nsIStreamAsFile : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTREAMASFILE_IID)

  /**
     * Filename containing stream-as-file
     */
  /* readonly attribute nsIFile file; */
  NS_IMETHOD GetFile(nsIFile * *aFile) = 0;

  /**
     * Add an observer for this cache record.  When the cache wants to delete
     * or truncate a record, so as to make space for another cache entry's
     * content data, it will call <code>aObserver</code>'s Observe() method,
     * passing the nsIStreamAsFile instance as the <code>aSubject</code>
     * argument and an appropriate message.  If the observer does not wish to
     * inhibit deletion/truncation, it should Release() any references it has to the
     * cache record.
     *
     * @See nsIStreamAsFileObserver
     */
  /* void addObserver (in nsIStreamAsFileObserver aObserver); */
  NS_IMETHOD AddObserver(nsIStreamAsFileObserver *aObserver) = 0;

  /**
     * Delete an observer that was added by the AddObserver() method.
     */
  /* void removeObserver (in nsIStreamAsFileObserver aObserver); */
  NS_IMETHOD RemoveObserver(nsIStreamAsFileObserver *aObserver) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISTREAMASFILE \
  NS_IMETHOD GetFile(nsIFile * *aFile); \
  NS_IMETHOD AddObserver(nsIStreamAsFileObserver *aObserver); \
  NS_IMETHOD RemoveObserver(nsIStreamAsFileObserver *aObserver); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISTREAMASFILE(_to) \
  NS_IMETHOD GetFile(nsIFile * *aFile) { return _to ## GetFile(aFile); } \
  NS_IMETHOD AddObserver(nsIStreamAsFileObserver *aObserver) { return _to ## AddObserver(aObserver); } \
  NS_IMETHOD RemoveObserver(nsIStreamAsFileObserver *aObserver) { return _to ## RemoveObserver(aObserver); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsStreamAsFile : public nsIStreamAsFile
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSISTREAMASFILE

  nsStreamAsFile();
  virtual ~nsStreamAsFile();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsStreamAsFile, nsIStreamAsFile)

nsStreamAsFile::nsStreamAsFile()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsStreamAsFile::~nsStreamAsFile()
{
  /* destructor code */
}

/* readonly attribute nsIFile file; */
NS_IMETHODIMP nsStreamAsFile::GetFile(nsIFile * *aFile)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void addObserver (in nsIStreamAsFileObserver aObserver); */
NS_IMETHODIMP nsStreamAsFile::AddObserver(nsIStreamAsFileObserver *aObserver)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void removeObserver (in nsIStreamAsFileObserver aObserver); */
NS_IMETHODIMP nsStreamAsFile::RemoveObserver(nsIStreamAsFileObserver *aObserver)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


/* starting interface:    nsIStreamAsFileObserver */
#define NS_ISTREAMASFILEOBSERVER_IID_STR "a26e27c0-92da-11d3-90d3-0040056a906e"

#define NS_ISTREAMASFILEOBSERVER_IID \
  {0xa26e27c0, 0x92da, 0x11d3, \
    { 0x90, 0xd3, 0x00, 0x40, 0x05, 0x6a, 0x90, 0x6e }}

class NS_NO_VTABLE nsIStreamAsFileObserver : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTREAMASFILEOBSERVER_IID)

  /**
 * This interface can be implemented by a client to receive notifications of
 * either modification or deletion of a file created by the cache manager using
 * the stream-as-file semantics.
 */
/**
     * Flag bits for argument to observeStreamAsFile() method.
     */
  enum { NOTIFY_AVAILABLE = 1 };

  enum { NOTIFY_ERROR = 2 };

  enum { REQUEST_DELETION = 4 };

  enum { INVALIDATE = 8 };

  enum { MAKE_UNAVAILABLE = 12 };

  /**
     * Receive either a notification or a request concerning a file that has
     * been opened using stream-as-file.  The aMessage and aError arguments
     * have varying values depending on the nature of the notification.
     * aMessage is set to NOTIFY_AVAILABLE when a complete stream has been read
     * and stored on disk in a file.  At that point, and no sooner, may the
     * filename attribute of the associated nsIStreamAsFile be accessed via the
     * associated nsIStreamAsFile interface.  If the aMessage argument is
     * NOTIFY_ERROR, the aError argument contains the relevant error code.  If
     * the aMessage argument is either REQUEST_DELETION or REQUEST_TRUNCATION,
     * the callee should immediately Release() all references to the
     * nsIStreamAsFile (and any references to its associated nsICachedNetData
     * instances), unless it wishes to inhibit the requested file modification.
     * If the aMessage argument is INVALIDATE, the cache manager is replacing
     * the file with a more recent version.  If a client wants to continue
     * using the (now out-of-date) file, it must delete it when it has finished,
     * as the cache manager will effectively relinquished ownership of the
     * file.
     */
  /* void observeStreamAsFile (in nsIStreamAsFile aStreamAsFile, in PRUint32 aMessage, in nsresult aError); */
  NS_IMETHOD ObserveStreamAsFile(nsIStreamAsFile *aStreamAsFile, PRUint32 aMessage, nsresult aError) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISTREAMASFILEOBSERVER \
  NS_IMETHOD ObserveStreamAsFile(nsIStreamAsFile *aStreamAsFile, PRUint32 aMessage, nsresult aError); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISTREAMASFILEOBSERVER(_to) \
  NS_IMETHOD ObserveStreamAsFile(nsIStreamAsFile *aStreamAsFile, PRUint32 aMessage, nsresult aError) { return _to ## ObserveStreamAsFile(aStreamAsFile, aMessage, aError); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsStreamAsFileObserver : public nsIStreamAsFileObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSISTREAMASFILEOBSERVER

  nsStreamAsFileObserver();
  virtual ~nsStreamAsFileObserver();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsStreamAsFileObserver, nsIStreamAsFileObserver)

nsStreamAsFileObserver::nsStreamAsFileObserver()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsStreamAsFileObserver::~nsStreamAsFileObserver()
{
  /* destructor code */
}

/* void observeStreamAsFile (in nsIStreamAsFile aStreamAsFile, in PRUint32 aMessage, in nsresult aError); */
NS_IMETHODIMP nsStreamAsFileObserver::ObserveStreamAsFile(nsIStreamAsFile *aStreamAsFile, PRUint32 aMessage, nsresult aError)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif


#endif /* __gen_nsIStreamAsFile_h__ */
