intl/uconv/ucvlatin/nsUnicodeToUTF16.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF16.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     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 nsUnicodeToUTF16_h_
    1.10 +#define nsUnicodeToUTF16_h_
    1.11 +
    1.12 +#include "nsUCSupport.h"
    1.13 +#include "mozilla/Endian.h"
    1.14 +
    1.15 +class nsUnicodeToUTF16BE: public nsBasicEncoder
    1.16 +{
    1.17 +public:
    1.18 +  nsUnicodeToUTF16BE() { mBOM = 0;}
    1.19 +
    1.20 +  //--------------------------------------------------------------------
    1.21 +  // Interface nsIUnicodeEncoder [declaration]
    1.22 +
    1.23 +  NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength, 
    1.24 +      char * aDest, int32_t * aDestLength);
    1.25 +  NS_IMETHOD GetMaxLength(const char16_t * aSrc, int32_t aSrcLength, 
    1.26 +      int32_t * aDestLength);
    1.27 +  NS_IMETHOD Finish(char * aDest, int32_t * aDestLength);
    1.28 +  NS_IMETHOD Reset();
    1.29 +  NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, 
    1.30 +      nsIUnicharEncoder * aEncoder, char16_t aChar);
    1.31 +
    1.32 +protected:
    1.33 +  char16_t mBOM;
    1.34 +  NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen  );
    1.35 +};
    1.36 +
    1.37 +class nsUnicodeToUTF16LE: public nsUnicodeToUTF16BE
    1.38 +{
    1.39 +public:
    1.40 +  nsUnicodeToUTF16LE() { mBOM = 0;}
    1.41 +
    1.42 +protected:
    1.43 +  NS_IMETHOD CopyData(char* aDest, const char16_t* aSrc, int32_t aLen  );
    1.44 +};
    1.45 +
    1.46 +#if MOZ_LITTLE_ENDIAN
    1.47 +class nsUnicodeToUTF16: public nsUnicodeToUTF16LE
    1.48 +#else
    1.49 +class nsUnicodeToUTF16: public nsUnicodeToUTF16BE
    1.50 +#endif
    1.51 +{
    1.52 +public:
    1.53 +  nsUnicodeToUTF16() { mBOM = 0xFEFF;}
    1.54 +};
    1.55 +
    1.56 +#endif /* nsUnicodeToUTF16_h_ */

mercurial