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