Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / intl / uconv / nsConverterInputStream.h
blob55555fc6799342517d546d52f616d373d8ece6e2
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsConverterInputStream_h
7 #define nsConverterInputStream_h
9 #include "nsIInputStream.h"
10 #include "nsIConverterInputStream.h"
11 #include "nsIUnicharLineInputStream.h"
12 #include "nsTArray.h"
13 #include "nsCOMPtr.h"
14 #include "nsReadLine.h"
15 #include "mozilla/Encoding.h"
16 #include "mozilla/UniquePtr.h"
18 #define NS_CONVERTERINPUTSTREAM_CONTRACTID \
19 "@mozilla.org/intl/converter-input-stream;1"
21 // {2BC2AD62-AD5D-4b7b-A9DB-F74AE203C527}
22 #define NS_CONVERTERINPUTSTREAM_CID \
23 { \
24 0x2bc2ad62, 0xad5d, 0x4b7b, { \
25 0xa9, 0xdb, 0xf7, 0x4a, 0xe2, 0x3, 0xc5, 0x27 \
26 } \
29 class nsConverterInputStream : public nsIConverterInputStream,
30 public nsIUnicharLineInputStream {
31 public:
32 NS_DECL_ISUPPORTS
33 NS_DECL_NSIUNICHARINPUTSTREAM
34 NS_DECL_NSIUNICHARLINEINPUTSTREAM
35 NS_DECL_NSICONVERTERINPUTSTREAM
37 nsConverterInputStream()
38 : mLastErrorCode(NS_OK),
39 mLeftOverBytes(0),
40 mUnicharDataOffset(0),
41 mUnicharDataLength(0),
42 mErrorsAreFatal(false),
43 mLineBuffer(nullptr) {}
45 private:
46 virtual ~nsConverterInputStream() { Close(); }
48 uint32_t Fill(nsresult* aErrorCode);
50 mozilla::UniquePtr<mozilla::Decoder> mConverter;
51 FallibleTArray<char> mByteData;
52 FallibleTArray<char16_t> mUnicharData;
53 nsCOMPtr<nsIInputStream> mInput;
55 nsresult mLastErrorCode;
56 uint32_t mLeftOverBytes;
57 uint32_t mUnicharDataOffset;
58 uint32_t mUnicharDataLength;
59 bool mErrorsAreFatal;
61 mozilla::UniquePtr<nsLineBuffer<char16_t> > mLineBuffer;
64 #endif