mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
split the nsEncoderSupport to two classes
This commit is contained in:
parent
fe9acedc33
commit
174aa29224
@ -335,6 +335,54 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
@ -348,15 +396,12 @@ nsEncoderSupport::nsEncoderSupport()
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
@ -436,41 +481,6 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsEncoderSupport);
|
||||
NS_IMPL_RELEASE(nsEncoderSupport);
|
||||
|
||||
nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvLatinSupport.
|
||||
* The class source files for this class are in /ucvlatin/nsUCvCnSupport.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
@ -235,6 +235,25 @@ protected:
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
@ -249,9 +268,8 @@ protected:
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -335,6 +335,54 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
@ -348,15 +396,12 @@ nsEncoderSupport::nsEncoderSupport()
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
@ -436,41 +481,6 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsEncoderSupport);
|
||||
NS_IMPL_RELEASE(nsEncoderSupport);
|
||||
|
||||
nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvLatinSupport.
|
||||
* The class source files for this class are in /ucvlatin/nsUCvJaSupport.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
@ -235,6 +235,25 @@ protected:
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
@ -249,9 +268,8 @@ protected:
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -335,6 +335,54 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
@ -348,15 +396,12 @@ nsEncoderSupport::nsEncoderSupport()
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
@ -436,41 +481,6 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsEncoderSupport);
|
||||
NS_IMPL_RELEASE(nsEncoderSupport);
|
||||
|
||||
nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvLatinSupport.
|
||||
* The class source files for this class are in /ucvlatin/nsUCvKOSupport.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
@ -235,6 +235,25 @@ protected:
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
@ -249,9 +268,8 @@ protected:
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -335,6 +335,54 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
@ -348,15 +396,12 @@ nsEncoderSupport::nsEncoderSupport()
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
@ -436,41 +481,6 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsEncoderSupport);
|
||||
NS_IMPL_RELEASE(nsEncoderSupport);
|
||||
|
||||
nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvLatinSupport.
|
||||
* The class source files for this class are in /ucvlatin/nsUCvTWSupport.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
@ -235,6 +235,25 @@ protected:
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
@ -249,9 +268,8 @@ protected:
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -335,6 +335,54 @@ NS_IMETHODIMP nsOneByteDecoderSupport::Reset()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [implementation]
|
||||
nsBasicEncoder::nsBasicEncoder()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsBasicEncoder::~nsBasicEncoder()
|
||||
{
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsBasicEncoder);
|
||||
NS_IMPL_RELEASE(nsBasicEncoder);
|
||||
|
||||
nsresult nsBasicEncoder::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [implementation]
|
||||
|
||||
@ -348,15 +396,12 @@ nsEncoderSupport::nsEncoderSupport()
|
||||
mErrEncoder = NULL;
|
||||
|
||||
Reset();
|
||||
NS_INIT_REFCNT();
|
||||
PR_AtomicIncrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
nsEncoderSupport::~nsEncoderSupport()
|
||||
{
|
||||
delete [] mBuffer;
|
||||
NS_IF_RELEASE(mErrEncoder);
|
||||
PR_AtomicDecrement(&g_InstanceCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEncoderSupport::ConvertNoBuff(const PRUnichar * aSrc,
|
||||
@ -436,41 +481,6 @@ nsresult nsEncoderSupport::FlushBuffer(char ** aDest, const char * aDestEnd)
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsISupports [implementation]
|
||||
|
||||
NS_IMPL_ADDREF(nsEncoderSupport);
|
||||
NS_IMPL_RELEASE(nsEncoderSupport);
|
||||
|
||||
nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aInstancePtr = NULL;
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
if (aIID.Equals(kIUnicodeEncoderIID)) {
|
||||
*aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(nsICharRepresentable::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [implementation]
|
||||
|
@ -34,7 +34,7 @@
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvLatinSupport.
|
||||
* The class source files for this class are in /ucvlatin/nsUCvTW2Support.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
@ -235,6 +235,25 @@ protected:
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
@ -249,9 +268,8 @@ protected:
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user