Bumping manifests a=b2g-bump
[gecko.git] / intl / uconv / nsConverterInputStream.h
blob5e83fac260eb9586060818e69cf23862dafd2a83
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 "nsAutoPtr.h"
14 #include "nsCOMPtr.h"
15 #include "nsIUnicodeDecoder.h"
16 #include "nsReadLine.h"
18 #define NS_CONVERTERINPUTSTREAM_CONTRACTID "@mozilla.org/intl/converter-input-stream;1"
20 // {2BC2AD62-AD5D-4b7b-A9DB-F74AE203C527}
21 #define NS_CONVERTERINPUTSTREAM_CID \
22 { 0x2bc2ad62, 0xad5d, 0x4b7b, \
23 { 0xa9, 0xdb, 0xf7, 0x4a, 0xe2, 0x3, 0xc5, 0x27 } }
27 class nsConverterInputStream : public nsIConverterInputStream,
28 public nsIUnicharLineInputStream {
30 public:
31 NS_DECL_ISUPPORTS
32 NS_DECL_NSIUNICHARINPUTSTREAM
33 NS_DECL_NSIUNICHARLINEINPUTSTREAM
34 NS_DECL_NSICONVERTERINPUTSTREAM
36 nsConverterInputStream() :
37 mLastErrorCode(NS_OK),
38 mLeftOverBytes(0),
39 mUnicharDataOffset(0),
40 mUnicharDataLength(0),
41 mReplacementChar(DEFAULT_REPLACEMENT_CHARACTER),
42 mLineBuffer(nullptr) { }
44 private:
45 virtual ~nsConverterInputStream() { Close(); }
47 uint32_t Fill(nsresult *aErrorCode);
49 nsCOMPtr<nsIUnicodeDecoder> mConverter;
50 FallibleTArray<char> mByteData;
51 FallibleTArray<char16_t> mUnicharData;
52 nsCOMPtr<nsIInputStream> mInput;
54 nsresult mLastErrorCode;
55 uint32_t mLeftOverBytes;
56 uint32_t mUnicharDataOffset;
57 uint32_t mUnicharDataLength;
58 char16_t mReplacementChar;
60 nsAutoPtr<nsLineBuffer<char16_t> > mLineBuffer;
63 #endif