intl/uconv/util/nsUnicodeDecodeHelper.h
author Kyle Machulis <kyle@nonpolynomial.com>
Mon, 01 Apr 2013 11:36:59 -0700
changeset 126871 5f4f68f0041964124afe3ee7012de446c946c2df
parent 106706 c4f83d9d8243f3f853a5356188164a5fddee2b5a
child 149027 19af7baaf26e984eceec910174b968386bbd7ed2
permissions -rw-r--r--
Bug 855465 - Add emacs python mode comments to moz.build files; r=gps

/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsUnicodeDecodeHelper_h__
#define nsUnicodeDecodeHelper_h__

#include "nsIUnicodeDecoder.h"
#include "uconvutil.h"
//----------------------------------------------------------------------
// Class nsUnicodeDecodeHelper [declaration]

/**
 *
 * @created         18/Mar/1998
 * @author  Catalin Rotaru [CATA]
 */
class nsUnicodeDecodeHelper
{
public:
  /**
   * Converts data using a lookup table and optional shift table
   */
  static nsresult ConvertByTable(const char * aSrc, int32_t * aSrcLength, 
                                 PRUnichar * aDest, int32_t * aDestLength,
                                 uScanClassID aScanClass,
                                 uShiftInTable * aShiftInTable,
                                 uMappingTable  * aMappingTable,
                                 bool aErrorSignal = false);

  /**
   * Converts data using a set of lookup tables.
   */
  static nsresult ConvertByMultiTable(const char * aSrc, int32_t * aSrcLength,
      PRUnichar * aDest, int32_t * aDestLength, int32_t aTableCount, 
      const uRange * aRangeArray, uScanClassID * aScanClassArray,
      uMappingTable ** aMappingTable, bool aErrorSignal = false);

  /**
   * Converts data using a fast lookup table.
   */
  static nsresult ConvertByFastTable(const char * aSrc, int32_t * aSrcLength, 
      PRUnichar * aDest, int32_t * aDestLength, const PRUnichar * aFastTable, 
      int32_t aTableSize, bool aErrorSignal);

  /**
   * Create a cache-like fast lookup table from a normal one.
   */
  static nsresult CreateFastTable(uMappingTable * aMappingTable,
      PRUnichar * aFastTable,  int32_t aTableSize);
};

#endif // nsUnicodeDecodeHelper_h__