pjs/intl/uconv/ucvja2/nsISO2022JPToUnicode.h

95 строки
2.6 KiB
C
Исходник Обычный вид История

1999-02-12 22:35:59 +03:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsISO2022JPToUnicode_h___
#define nsISO2022JPToUnicode_h___
1999-04-24 02:14:11 +04:00
#include "nsUCvJa2Support.h"
1999-02-25 16:15:07 +03:00
//----------------------------------------------------------------------
// Class nsISO2022JPToUnicode [declaration]
1999-02-12 22:35:59 +03:00
/**
1999-02-25 16:15:07 +03:00
* A character set converter from ISO-2022-JP to Unicode.
*
* The state machine is:
* S0 + ESC -> S1
* S0 + * -> S0; convert using the current mCharset
* S1 + '(' -> S2
* S1 + '$' -> S3
* S1 + * -> ERR
* S2 + 'B' -> S0; mCharset = kASCII
* S2 + 'J' -> S0; mCharset = kJISX0201_1976
* S2 + * -> ERR
* S3 + '@' -> S0; mCharset = kJISX0208_1978
* S3 + 'B' -> S0; mCharset = kJISX0208_1983
* S3 + * -> ERR
* ERR + * -> ERR
*
1999-02-12 22:35:59 +03:00
* @created 09/Feb/1998
* @author Catalin Rotaru [CATA]
*/
1999-04-24 02:14:11 +04:00
class nsISO2022JPToUnicode : public nsBufferDecoderSupport
1999-02-12 22:35:59 +03:00
{
public:
/**
* Class constructor.
*/
1999-02-25 16:15:07 +03:00
nsISO2022JPToUnicode();
1999-02-12 22:35:59 +03:00
/**
* Class destructor.
*/
1999-02-26 19:58:33 +03:00
virtual ~nsISO2022JPToUnicode();
1999-02-25 16:15:07 +03:00
/**
* Static class constructor.
*/
1999-04-24 02:14:11 +04:00
static nsresult CreateInstance(nsISupports ** aResult);
1999-02-12 22:35:59 +03:00
1999-04-24 02:14:11 +04:00
protected:
1999-02-12 22:35:59 +03:00
1999-02-25 16:15:07 +03:00
enum {
kASCII,
kJISX0201_1976,
kJISX0208_1978,
kJISX0208_1983
};
1999-02-12 22:35:59 +03:00
1999-02-25 16:15:07 +03:00
PRInt32 mState; // current state of the state machine
PRInt32 mCharset; // current character set
1999-04-24 02:14:11 +04:00
nsIUnicodeDecodeHelper * mHelper; // decoder helper object
1999-02-12 22:35:59 +03:00
1999-04-24 02:14:11 +04:00
NS_IMETHOD ConvertBuffer(const char ** aSrc, const char * aSrcEnd,
1999-02-25 16:15:07 +03:00
PRUnichar ** aDest, PRUnichar * aDestEnd);
1999-04-24 02:14:11 +04:00
//--------------------------------------------------------------------
// Subclassing of nsBufferDecoderSupport class [declaration]
NS_IMETHOD ConvertNoBuff(const char * aSrc, PRInt32 * aSrcLength,
PRUnichar * aDest, PRInt32 * aDestLength);
NS_IMETHOD GetMaxLength(const char * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
NS_IMETHOD Reset();
1999-02-25 16:15:07 +03:00
};
1999-02-12 22:35:59 +03:00
#endif /* nsISO2022JPToUnicode_h___ */