intl/uconv/src/nsUTF8ToUnicode.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/src/nsUTF8ToUnicode.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,69 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsUTF8ToUnicode_h___
    1.10 +#define nsUTF8ToUnicode_h___
    1.11 +
    1.12 +#include "nsUCSupport.h"
    1.13 +
    1.14 +// Class ID for our UTF8ToUnicode charset converter
    1.15 +// {5534DDC0-DD96-11d2-8AAC-00600811A836}
    1.16 +#define NS_UTF8TOUNICODE_CID \
    1.17 +  { 0x5534ddc0, 0xdd96, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
    1.18 +
    1.19 +#define NS_UTF8TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=UTF-8"
    1.20 +
    1.21 +//#define NS_ERROR_UCONV_NOUTF8TOUNICODE  
    1.22 +//  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
    1.23 +
    1.24 +//----------------------------------------------------------------------
    1.25 +// Class nsUTF8ToUnicode [declaration]
    1.26 +
    1.27 +
    1.28 +/**
    1.29 + * A character set converter from UTF8 to Unicode.
    1.30 + *
    1.31 + * @created         18/Mar/1998
    1.32 + * @modified        04/Feb/2000
    1.33 + * @author  Catalin Rotaru [CATA]
    1.34 + */
    1.35 +
    1.36 +class nsUTF8ToUnicode : public nsBasicDecoderSupport
    1.37 +{
    1.38 +public:
    1.39 +
    1.40 +  /**
    1.41 +   * Class constructor.
    1.42 +   */
    1.43 +  nsUTF8ToUnicode();
    1.44 +
    1.45 +protected:
    1.46 +
    1.47 +  uint32_t mUcs4; // cached Unicode character
    1.48 +  uint8_t mState; // cached expected number of bytes per UTF8 character sequence
    1.49 +  uint8_t mBytes;
    1.50 +  bool mFirst;
    1.51 +
    1.52 +  //--------------------------------------------------------------------
    1.53 +  // Subclassing of nsDecoderSupport class [declaration]
    1.54 +
    1.55 +  NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength, 
    1.56 +      int32_t * aDestLength);
    1.57 +
    1.58 +  //--------------------------------------------------------------------
    1.59 +  // Subclassing of nsBasicDecoderSupport class [declaration]
    1.60 +
    1.61 +  NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength, 
    1.62 +      char16_t * aDest, int32_t * aDestLength);
    1.63 +
    1.64 +  //--------------------------------------------------------------------
    1.65 +  // Subclassing of nsBasicDecoderSupport class [declaration]
    1.66 +
    1.67 +  NS_IMETHOD Reset();
    1.68 +
    1.69 +};
    1.70 +
    1.71 +#endif /* nsUTF8ToUnicode_h___ */
    1.72 +

mercurial