intl/uconv/src/nsUnicodeToUTF8.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/src/nsUnicodeToUTF8.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     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 nsUnicodeToUTF8_h___
    1.10 +#define nsUnicodeToUTF8_h___
    1.11 +
    1.12 +#include "mozilla/Attributes.h"
    1.13 +#include "nsIUnicodeEncoder.h"
    1.14 +
    1.15 +// Class ID for our UnicodeToUTF8 charset converter
    1.16 +// {7C657D18-EC5E-11d2-8AAC-00600811A836}
    1.17 +#define NS_UNICODETOUTF8_CID \
    1.18 +  { 0x7c657d18, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
    1.19 +
    1.20 +#define NS_UNICODETOUTF8_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=UTF-8"
    1.21 +
    1.22 +//#define NS_ERROR_UCONV_NOUNICODETOUTF8  
    1.23 +//  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
    1.24 +
    1.25 +//----------------------------------------------------------------------
    1.26 +// Class nsUnicodeToUTF8 [declaration]
    1.27 +
    1.28 +/**
    1.29 + * A character set converter from Unicode to UTF8.
    1.30 + *
    1.31 + * @created         05/Apr/1999
    1.32 + * @author  Catalin Rotaru [CATA]
    1.33 + */
    1.34 +class nsUnicodeToUTF8 MOZ_FINAL : public nsIUnicodeEncoder
    1.35 +{
    1.36 +  NS_DECL_ISUPPORTS
    1.37 +
    1.38 +public:
    1.39 +
    1.40 +  /**
    1.41 +   * Class constructor.
    1.42 +   */
    1.43 +  nsUnicodeToUTF8() {mHighSurrogate = 0;}
    1.44 +
    1.45 +  NS_IMETHOD Convert(const char16_t * aSrc, 
    1.46 +                     int32_t * aSrcLength, 
    1.47 +                     char * aDest, 
    1.48 +                     int32_t * aDestLength);
    1.49 +
    1.50 +  NS_IMETHOD Finish(char * aDest, int32_t * aDestLength);
    1.51 +
    1.52 +  NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, 
    1.53 +      int32_t * aDestLength);
    1.54 +
    1.55 +  NS_IMETHOD Reset() {mHighSurrogate = 0; return NS_OK;}
    1.56 +
    1.57 +  NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, 
    1.58 +    nsIUnicharEncoder * aEncoder, char16_t aChar) {return NS_OK;}
    1.59 +
    1.60 +protected:
    1.61 +  char16_t mHighSurrogate;
    1.62 +
    1.63 +};
    1.64 +
    1.65 +#endif /* nsUnicodeToUTF8_h___ */

mercurial