intl/uconv/ucvlatin/nsUnicodeToUTF16.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: 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 nsUnicodeToUTF16_h_
     7 #define nsUnicodeToUTF16_h_
     9 #include "nsUCSupport.h"
    10 #include "mozilla/Endian.h"
    12 class nsUnicodeToUTF16BE: public nsBasicEncoder
    13 {
    14 public:
    15   nsUnicodeToUTF16BE() { mBOM = 0;}
    17   //--------------------------------------------------------------------
    18   // Interface nsIUnicodeEncoder [declaration]
    20   NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, 
    21       char * aDest, int32_t * aDestLength);
    22   NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, 
    23       int32_t * aDestLength);
    24   NS_IMETHOD Finish(char * aDest, int32_t * aDestLength);
    25   NS_IMETHOD Reset();
    26   NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, 
    27       nsIUnicharEncoder * aEncoder, char16_t aChar);
    29 protected:
    30   char16_t mBOM;
    31   NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen  );
    32 };
    34 class nsUnicodeToUTF16LE: public nsUnicodeToUTF16BE
    35 {
    36 public:
    37   nsUnicodeToUTF16LE() { mBOM = 0;}
    39 protected:
    40   NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen  );
    41 };
    43 #if MOZ_LITTLE_ENDIAN
    44 class nsUnicodeToUTF16: public nsUnicodeToUTF16LE
    45 #else
    46 class nsUnicodeToUTF16: public nsUnicodeToUTF16BE
    47 #endif
    48 {
    49 public:
    50   nsUnicodeToUTF16() { mBOM = 0xFEFF;}
    51 };
    53 #endif /* nsUnicodeToUTF16_h_ */

mercurial