1 #include "nsIStreamConverter.h"
2 #include "nsIFactory.h"
4 #include "nsStringAPI.h"
6 /* This file defines stream converter components, and their accompanying factory class.
7 * These converters implement the nsIStreamConverter interface and support both
8 * asynchronous and synchronous stream conversion.
11 ///////////////////////////////////////////////
13 #define NS_TESTCONVERTER_CID \
14 { /* B8A067B0-4450-11d3-A16E-0050041CAF44 */ \
18 {0xa1, 0x6e, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
20 static NS_DEFINE_CID(kTestConverterCID
, NS_TESTCONVERTER_CID
);
22 class TestConverter
: public nsIStreamConverter
{
25 NS_DECL_NSIREQUESTOBSERVER
26 NS_DECL_NSISTREAMLISTENER
29 virtual ~TestConverter() {}
31 // nsIStreamConverter methods
32 NS_IMETHOD
Convert(nsIInputStream
*aFromStream
, const char *aFromType
,
33 const char *aToType
, nsISupports
*ctxt
, nsIInputStream
**_retval
);
36 NS_IMETHOD
AsyncConvertData(const char *aFromType
, const char *aToType
,
37 nsIStreamListener
*aListener
, nsISupports
*ctxt
);
40 nsCOMPtr
<nsIStreamListener
> mListener
;
45 //////////////////////////////////////////////////
47 class TestConverterFactory
: public nsIFactory
50 TestConverterFactory(const nsCID
&aClass
, const char* className
, const char* contractID
);
52 // nsISupports methods
56 NS_IMETHOD
CreateInstance(nsISupports
*aOuter
,
60 NS_IMETHOD
LockFactory(PRBool aLock
);
63 virtual ~TestConverterFactory();
67 const char* mClassName
;
68 const char* mContractID
;