/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/moz2_slave/mozilla-central-win32-xulrunner/build/modules/libpr0n/public/imgIDecoder.idl
 */

#ifndef __gen_imgIDecoder_h__
#define __gen_imgIDecoder_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIInputStream; /* forward declaration */

class imgIContainer; /* forward declaration */

class imgIDecoderObserver; /* forward declaration */


/* starting interface:    imgIDecoder */
#define IMGIDECODER_IID_STR "139c6f97-cd2f-4a4f-890d-8d9f4a693682"

#define IMGIDECODER_IID \
  {0x139c6f97, 0xcd2f, 0x4a4f, \
    { 0x89, 0x0d, 0x8d, 0x9f, 0x4a, 0x69, 0x36, 0x82 }}

/**
 * imgIDecoder interface
 *
 * @author Stuart Parmenter <pavlov@netscape.com>
 * @version 0.2
 * @see imagelib2
 */
class NS_NO_VTABLE NS_SCRIPTABLE imgIDecoder : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(IMGIDECODER_IID)

  /**
   * Bits that can be passed to the decoder to affect decoding.
   * @name decodeflags
   *
   * Meanings:
   *
   * DECODER_FLAG_NONE: No flags
   *
   * DECODER_FLAG_HEADERONLY: Read basic data from the image in order to 
   * set up the image container,  but don't read any actual image data.
   */
  enum { DECODER_FLAG_NONE = 0 };

  enum { DECODER_FLAG_HEADERONLY = 1 };

  /**
   * Initialize an image decoder.
   * @param aContainer The image container to decode to.
   * @param aObserver The observer for decode notification events.
   * @param aFlags Flags for the decoder
   *
   * @note The decoder should always pass NULL as the 
   * first two parameters to all of the imgIDecoderObserver APIs.
   */
  /* void init (in imgIContainer aImage, in imgIDecoderObserver aObserver, in unsigned long aFlags); */
  NS_SCRIPTABLE NS_IMETHOD Init(imgIContainer *aImage, imgIDecoderObserver *aObserver, PRUint32 aFlags) = 0;

  /** 
   * Closes the stream.
   * @param aFlags Close flags of the CLOSE_FLAG_* Variety
   *
   * Resources are always freed with this call. If notifications are sent,
   * OnStopDecode is guaranteed to be called if it hasn't been called already.
   *
   * CLOSE_FLAG_DONTNOTIFY - Don't send any observer notifications, and don't
   * call imgIContainer::decodingComplete().
   */
  enum { CLOSE_FLAG_DONTNOTIFY = 1 };

  /* void close (in PRUint32 aFlags); */
  NS_SCRIPTABLE NS_IMETHOD Close(PRUint32 aFlags) = 0;

  /**
   * Flushes the stream.
   */
  /* void flush (); */
  NS_SCRIPTABLE NS_IMETHOD Flush(void) = 0;

  /**
   * Writes data into the stream from an input stream.
   *
   * For Header-Only decodes, OnStartContainer is the only notification
   * fired.
   *
   * If a decoding error occurs, an internal flag is set and an error is
   * returned. Each subsequent call to writeFrom will fail immediately
   * for the lifetime of the decoder. Shutdown notifications of the OnStopX
   * variety, as well as DecodingComplete(), are guaranteed not to be called
   * if a decoding error occurs.
   *
   * Implementer's note: This method is defined by this interface in order
   * to allow the output stream to efficiently copy the data from the input
   * stream into its internal buffer (if any). If this method was provide
   * as an external facility, a separate char* buffer would need to be used
   * in order to call the output stream's other Write method.
   * @param fromStream the stream from which the data is read
   * @param count the maximun number of bytes to write
   */
  /* void writeFrom (in nsIInputStream inStr, in unsigned long count); */
  NS_SCRIPTABLE NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(imgIDecoder, IMGIDECODER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_IMGIDECODER \
  NS_SCRIPTABLE NS_IMETHOD Init(imgIContainer *aImage, imgIDecoderObserver *aObserver, PRUint32 aFlags); \
  NS_SCRIPTABLE NS_IMETHOD Close(PRUint32 aFlags); \
  NS_SCRIPTABLE NS_IMETHOD Flush(void); \
  NS_SCRIPTABLE NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_IMGIDECODER(_to) \
  NS_SCRIPTABLE NS_IMETHOD Init(imgIContainer *aImage, imgIDecoderObserver *aObserver, PRUint32 aFlags) { return _to Init(aImage, aObserver, aFlags); } \
  NS_SCRIPTABLE NS_IMETHOD Close(PRUint32 aFlags) { return _to Close(aFlags); } \
  NS_SCRIPTABLE NS_IMETHOD Flush(void) { return _to Flush(); } \
  NS_SCRIPTABLE NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count) { return _to WriteFrom(inStr, count); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_IMGIDECODER(_to) \
  NS_SCRIPTABLE NS_IMETHOD Init(imgIContainer *aImage, imgIDecoderObserver *aObserver, PRUint32 aFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aImage, aObserver, aFlags); } \
  NS_SCRIPTABLE NS_IMETHOD Close(PRUint32 aFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->Close(aFlags); } \
  NS_SCRIPTABLE NS_IMETHOD Flush(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Flush(); } \
  NS_SCRIPTABLE NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count) { return !_to ? NS_ERROR_NULL_POINTER : _to->WriteFrom(inStr, count); } 

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

/* Header file */
class _MYCLASS_ : public imgIDecoder
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_IMGIDECODER

  _MYCLASS_();

private:
  ~_MYCLASS_();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, imgIDecoder)

_MYCLASS_::_MYCLASS_()
{
  /* member initializers and constructor code */
}

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

/* void init (in imgIContainer aImage, in imgIDecoderObserver aObserver, in unsigned long aFlags); */
NS_IMETHODIMP _MYCLASS_::Init(imgIContainer *aImage, imgIDecoderObserver *aObserver, PRUint32 aFlags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void close (in PRUint32 aFlags); */
NS_IMETHODIMP _MYCLASS_::Close(PRUint32 aFlags)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void flush (); */
NS_IMETHODIMP _MYCLASS_::Flush()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void writeFrom (in nsIInputStream inStr, in unsigned long count); */
NS_IMETHODIMP _MYCLASS_::WriteFrom(nsIInputStream *inStr, PRUint32 count)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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


#endif /* __gen_imgIDecoder_h__ */
