netwerk/base/src/nsUnicharStreamLoader.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 nsUnicharStreamLoader_h__
     7 #define nsUnicharStreamLoader_h__
     9 #include "nsIChannel.h"
    10 #include "nsIUnicharStreamLoader.h"
    11 #include "nsIUnicodeDecoder.h"
    12 #include "nsCOMPtr.h"
    13 #include "nsString.h"
    15 class nsIInputStream;
    17 class nsUnicharStreamLoader : public nsIUnicharStreamLoader
    18 {
    19 public:
    20   NS_DECL_ISUPPORTS
    21   NS_DECL_NSIUNICHARSTREAMLOADER
    22   NS_DECL_NSIREQUESTOBSERVER
    23   NS_DECL_NSISTREAMLISTENER
    25   nsUnicharStreamLoader() {}
    26   virtual ~nsUnicharStreamLoader() {}
    28   static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
    30 protected:
    31   nsresult DetermineCharset();
    33   /**
    34    * callback method used for ReadSegments
    35    */
    36   static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
    37                                    uint32_t, uint32_t, uint32_t *);
    39   nsCOMPtr<nsIUnicharStreamLoaderObserver> mObserver;
    40   nsCOMPtr<nsIUnicodeDecoder>              mDecoder;
    41   nsCOMPtr<nsISupports>                    mContext;
    42   nsCOMPtr<nsIChannel>                     mChannel;
    43   nsCString                                mCharset;
    45   // This holds the first up-to-512 bytes of the raw stream.
    46   // It will be passed to the OnDetermineCharset callback.
    47   nsCString                                mRawData;
    49   // This holds the complete contents of the stream so far, after
    50   // decoding to UTF-16.  It will be passed to the OnStreamComplete
    51   // callback.
    52   nsString                                 mBuffer;
    53 };
    55 #endif // nsUnicharStreamLoader_h__

mercurial