Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / netwerk / streamconv / test / Converters.h
blob0a76fedb62e8a5281fba6e7e7ea4b475f443c979
1 #include "nsIStreamConverter.h"
2 #include "nsIFactory.h"
3 #include "nsCOMPtr.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.
9 */
11 ///////////////////////////////////////////////
12 // TestConverter
13 #define NS_TESTCONVERTER_CID \
14 { /* B8A067B0-4450-11d3-A16E-0050041CAF44 */ \
15 0xb8a067b0, \
16 0x4450, \
17 0x11d3, \
18 {0xa1, 0x6e, 0x00, 0x50, 0x04, 0x1c, 0xaf, 0x44} \
20 static NS_DEFINE_CID(kTestConverterCID, NS_TESTCONVERTER_CID);
22 class TestConverter : public nsIStreamConverter {
23 public:
24 NS_DECL_ISUPPORTS
25 NS_DECL_NSIREQUESTOBSERVER
26 NS_DECL_NSISTREAMLISTENER
28 TestConverter();
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);
39 // member data
40 nsCOMPtr<nsIStreamListener> mListener;
41 nsCString fromType;
42 nsCString toType;
45 //////////////////////////////////////////////////
46 // FACTORY
47 class TestConverterFactory : public nsIFactory
49 public:
50 TestConverterFactory(const nsCID &aClass, const char* className, const char* contractID);
52 // nsISupports methods
53 NS_DECL_ISUPPORTS
55 // nsIFactory methods
56 NS_IMETHOD CreateInstance(nsISupports *aOuter,
57 const nsIID &aIID,
58 void **aResult);
60 NS_IMETHOD LockFactory(PRBool aLock);
62 protected:
63 virtual ~TestConverterFactory();
65 protected:
66 nsCID mClassID;
67 const char* mClassName;
68 const char* mContractID;