diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /netwerk/streamconv/test/Converters.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/streamconv/test/Converters.h')
-rw-r--r-- | netwerk/streamconv/test/Converters.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/netwerk/streamconv/test/Converters.h b/netwerk/streamconv/test/Converters.h new file mode 100644 index 000000000..d7203262c --- /dev/null +++ b/netwerk/streamconv/test/Converters.h @@ -0,0 +1,52 @@ +#ifndef Converters_h___ +#define Converters_h___ + +#include "nsIStreamConverter.h" +#include "nsIFactory.h" +#include "nsCOMPtr.h" +#include "nsStringAPI.h" + +#include <algorithm> + +/* This file defines stream converter components, and their accompanying factory class. + * These converters implement the nsIStreamConverter interface and support both + * asynchronous and synchronous stream conversion. + */ + +/////////////////////////////////////////////// +// TestConverter + +extern const nsCID kTestConverterCID; + +class TestConverter : public nsIStreamConverter { + virtual ~TestConverter() {} +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + + TestConverter(); + + // nsIStreamConverter methods + NS_IMETHOD Convert(nsIInputStream *aFromStream, const char *aFromType, + const char *aToType, nsISupports *ctxt, nsIInputStream **_retval) override; + + + NS_IMETHOD AsyncConvertData(const char *aFromType, const char *aToType, + nsIStreamListener *aListener, nsISupports *ctxt) override; + + // member data + nsCOMPtr<nsIStreamListener> mListener; + nsCString fromType; + nsCString toType; +}; + +nsresult CreateTestConverter(nsISupports* aOuter, REFNSIID aIID, void** aResult); + +static inline uint32_t +saturated(uint64_t aValue) +{ + return (uint32_t) std::min(aValue, (uint64_t) UINT32_MAX); +} + +#endif /* !Converters_h___ */ |