summaryrefslogtreecommitdiffstats
path: root/intl/uconv/nsConverterInputStream.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /intl/uconv/nsConverterInputStream.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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 'intl/uconv/nsConverterInputStream.h')
-rw-r--r--intl/uconv/nsConverterInputStream.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/intl/uconv/nsConverterInputStream.h b/intl/uconv/nsConverterInputStream.h
new file mode 100644
index 000000000..5e83fac26
--- /dev/null
+++ b/intl/uconv/nsConverterInputStream.h
@@ -0,0 +1,64 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsConverterInputStream_h
+#define nsConverterInputStream_h
+
+#include "nsIInputStream.h"
+#include "nsIConverterInputStream.h"
+#include "nsIUnicharLineInputStream.h"
+#include "nsTArray.h"
+#include "nsAutoPtr.h"
+#include "nsCOMPtr.h"
+#include "nsIUnicodeDecoder.h"
+#include "nsReadLine.h"
+
+#define NS_CONVERTERINPUTSTREAM_CONTRACTID "@mozilla.org/intl/converter-input-stream;1"
+
+// {2BC2AD62-AD5D-4b7b-A9DB-F74AE203C527}
+#define NS_CONVERTERINPUTSTREAM_CID \
+ { 0x2bc2ad62, 0xad5d, 0x4b7b, \
+ { 0xa9, 0xdb, 0xf7, 0x4a, 0xe2, 0x3, 0xc5, 0x27 } }
+
+
+
+class nsConverterInputStream : public nsIConverterInputStream,
+ public nsIUnicharLineInputStream {
+
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIUNICHARINPUTSTREAM
+ NS_DECL_NSIUNICHARLINEINPUTSTREAM
+ NS_DECL_NSICONVERTERINPUTSTREAM
+
+ nsConverterInputStream() :
+ mLastErrorCode(NS_OK),
+ mLeftOverBytes(0),
+ mUnicharDataOffset(0),
+ mUnicharDataLength(0),
+ mReplacementChar(DEFAULT_REPLACEMENT_CHARACTER),
+ mLineBuffer(nullptr) { }
+
+ private:
+ virtual ~nsConverterInputStream() { Close(); }
+
+ uint32_t Fill(nsresult *aErrorCode);
+
+ nsCOMPtr<nsIUnicodeDecoder> mConverter;
+ FallibleTArray<char> mByteData;
+ FallibleTArray<char16_t> mUnicharData;
+ nsCOMPtr<nsIInputStream> mInput;
+
+ nsresult mLastErrorCode;
+ uint32_t mLeftOverBytes;
+ uint32_t mUnicharDataOffset;
+ uint32_t mUnicharDataLength;
+ char16_t mReplacementChar;
+
+ nsAutoPtr<nsLineBuffer<char16_t> > mLineBuffer;
+};
+
+#endif
+