2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-09-06 11:41:00 -07:00
|
|
|
|
|
|
|
#ifndef _nsos2uni_h
|
|
|
|
#define _nsos2uni_h
|
|
|
|
|
|
|
|
#include <uconv.h>
|
2007-09-18 16:12:06 -07:00
|
|
|
#include "nsTArray.h"
|
2007-09-06 11:41:01 -07:00
|
|
|
#include "nsICharsetConverterManager.h"
|
2007-09-06 11:41:03 -07:00
|
|
|
#include "gfxCore.h"
|
2007-09-06 11:41:01 -07:00
|
|
|
|
|
|
|
enum ConverterRequest {
|
|
|
|
eConv_Encoder,
|
|
|
|
eConv_Decoder
|
|
|
|
};
|
2007-09-06 11:41:00 -07:00
|
|
|
|
2007-09-09 02:07:20 -07:00
|
|
|
class OS2Uni {
|
2007-09-06 11:41:00 -07:00
|
|
|
public:
|
2007-09-06 11:41:01 -07:00
|
|
|
static nsISupports* GetUconvObject(int CodePage, ConverterRequest aReq);
|
2007-09-06 11:41:00 -07:00
|
|
|
static void FreeUconvObjects();
|
|
|
|
private:
|
2007-09-06 11:41:01 -07:00
|
|
|
static nsICharsetConverterManager* gCharsetManager;
|
2007-09-06 11:41:00 -07:00
|
|
|
};
|
|
|
|
|
2007-09-06 11:41:01 -07:00
|
|
|
#define CHAR_BUFFER_SIZE 1024
|
2007-09-18 16:12:06 -07:00
|
|
|
typedef nsAutoTArray<char, CHAR_BUFFER_SIZE> nsAutoCharBuffer;
|
|
|
|
typedef nsAutoTArray<PRUnichar, CHAR_BUFFER_SIZE> nsAutoChar16Buffer;
|
2007-09-06 11:41:01 -07:00
|
|
|
|
2007-09-09 02:07:20 -07:00
|
|
|
nsresult WideCharToMultiByte(int aCodePage, const PRUnichar* aSrc,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aSrcLength, nsAutoCharBuffer& aResult,
|
|
|
|
int32_t& aResultLength);
|
2007-09-09 02:07:20 -07:00
|
|
|
nsresult MultiByteToWideChar(int aCodePage, const char* aSrc,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aSrcLength, nsAutoChar16Buffer& aResult,
|
|
|
|
int32_t& aResultLength);
|
2007-09-09 02:07:20 -07:00
|
|
|
|
2007-09-06 11:41:00 -07:00
|
|
|
#endif
|