intl/uconv/src/nsUTF8ToUnicode.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; 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 nsUTF8ToUnicode_h___
     7 #define nsUTF8ToUnicode_h___
     9 #include "nsUCSupport.h"
    11 // Class ID for our UTF8ToUnicode charset converter
    12 // {5534DDC0-DD96-11d2-8AAC-00600811A836}
    13 #define NS_UTF8TOUNICODE_CID \
    14   { 0x5534ddc0, 0xdd96, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
    16 #define NS_UTF8TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=UTF-8"
    18 //#define NS_ERROR_UCONV_NOUTF8TOUNICODE  
    19 //  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
    21 //----------------------------------------------------------------------
    22 // Class nsUTF8ToUnicode [declaration]
    25 /**
    26  * A character set converter from UTF8 to Unicode.
    27  *
    28  * @created         18/Mar/1998
    29  * @modified        04/Feb/2000
    30  * @author  Catalin Rotaru [CATA]
    31  */
    33 class nsUTF8ToUnicode : public nsBasicDecoderSupport
    34 {
    35 public:
    37   /**
    38    * Class constructor.
    39    */
    40   nsUTF8ToUnicode();
    42 protected:
    44   uint32_t mUcs4; // cached Unicode character
    45   uint8_t mState; // cached expected number of bytes per UTF8 character sequence
    46   uint8_t mBytes;
    47   bool mFirst;
    49   //--------------------------------------------------------------------
    50   // Subclassing of nsDecoderSupport class [declaration]
    52   NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, 
    53       int32_t * aDestLength);
    55   //--------------------------------------------------------------------
    56   // Subclassing of nsBasicDecoderSupport class [declaration]
    58   NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, 
    59       char16_t * aDest, int32_t * aDestLength);
    61   //--------------------------------------------------------------------
    62   // Subclassing of nsBasicDecoderSupport class [declaration]
    64   NS_IMETHOD Reset();
    66 };
    68 #endif /* nsUTF8ToUnicode_h___ */

mercurial