Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 #ifndef Converters_h___
2 #define Converters_h___
4 #include "nsIStreamConverter.h"
5 #include "nsIFactory.h"
6 #include "nsCOMPtr.h"
7 #include "nsStringAPI.h"
9 #include <algorithm>
11 /* This file defines stream converter components, and their accompanying factory class.
12 * These converters implement the nsIStreamConverter interface and support both
13 * asynchronous and synchronous stream conversion.
14 */
16 ///////////////////////////////////////////////
17 // TestConverter
19 extern const nsCID kTestConverterCID;
21 class TestConverter : public nsIStreamConverter {
22 public:
23 NS_DECL_ISUPPORTS
24 NS_DECL_NSIREQUESTOBSERVER
25 NS_DECL_NSISTREAMLISTENER
27 TestConverter();
28 virtual ~TestConverter() {}
30 // nsIStreamConverter methods
31 NS_IMETHOD Convert(nsIInputStream *aFromStream, const char *aFromType,
32 const char *aToType, nsISupports *ctxt, nsIInputStream **_retval);
35 NS_IMETHOD AsyncConvertData(const char *aFromType, const char *aToType,
36 nsIStreamListener *aListener, nsISupports *ctxt);
38 // member data
39 nsCOMPtr<nsIStreamListener> mListener;
40 nsCString fromType;
41 nsCString toType;
42 };
44 nsresult CreateTestConverter(nsISupports* aOuter, REFNSIID aIID, void** aResult);
46 static inline uint32_t
47 saturated(uint64_t aValue)
48 {
49 return (uint32_t) std::min(aValue, (uint64_t) UINT32_MAX);
50 }
52 #endif /* !Converters_h___ */