author Robert O'Callahan <robert@ocallahan.org>
Wed, 24 Jul 2013 12:38:57 +1200
changeset 148027 8ac9338cb526e78afaa212d47eaa44b6b1c0b318
parent 108463 a16372ce30b5f6b747246b01fcd215a4bf3b6342
child 178109 5a9badd6db004310b9d1aca5db25ef4c275a4362
permissions -rw-r--r--
Backed out changeset 5a6f73ab541d

/* 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 _nsos2uni_h
#define _nsos2uni_h

#include <uconv.h>
#include "nsTArray.h"
#include "nsICharsetConverterManager.h"
#include "gfxCore.h"

enum ConverterRequest {

class OS2Uni {
  static nsISupports* GetUconvObject(int CodePage, ConverterRequest aReq);
  static void FreeUconvObjects();
  static nsICharsetConverterManager* gCharsetManager;

#define CHAR_BUFFER_SIZE 1024
typedef nsAutoTArray<char, CHAR_BUFFER_SIZE> nsAutoCharBuffer;
typedef nsAutoTArray<PRUnichar, CHAR_BUFFER_SIZE> nsAutoChar16Buffer;

nsresult WideCharToMultiByte(int aCodePage, const PRUnichar* aSrc,
                             int32_t aSrcLength, nsAutoCharBuffer& aResult,
                             int32_t& aResultLength);
nsresult MultiByteToWideChar(int aCodePage, const char* aSrc,
                             int32_t aSrcLength, nsAutoChar16Buffer& aResult,
                             int32_t& aResultLength);