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