intl/uconv/src/nsConverterInputStream.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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     virtual ~nsConverterInputStream() { Close(); }
    46  private:
    49     uint32_t Fill(nsresult *aErrorCode);
    51     nsCOMPtr<nsIUnicodeDecoder> mConverter;
    52     FallibleTArray<char> mByteData;
    53     FallibleTArray<char16_t> mUnicharData;
    54     nsCOMPtr<nsIInputStream> mInput;
    56     nsresult  mLastErrorCode;
    57     uint32_t  mLeftOverBytes;
    58     uint32_t  mUnicharDataOffset;
    59     uint32_t  mUnicharDataLength;
    60     char16_t mReplacementChar;
    62     nsAutoPtr<nsLineBuffer<char16_t> > mLineBuffer;
    63 };
    65 #endif

mercurial