2002-07-25 01:27:57 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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/. */
|
2002-07-25 01:27:57 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsUCSupport.h"
|
|
|
|
#include "nsUCConstructors.h"
|
|
|
|
|
|
|
|
template<class T>
|
2002-09-07 05:17:57 +04:00
|
|
|
inline NS_METHOD StabilizedQueryInterface(T* aNewObject,
|
2002-07-25 01:27:57 +04:00
|
|
|
REFNSIID aIID,
|
|
|
|
void **aResult)
|
|
|
|
{
|
|
|
|
NS_ADDREF(aNewObject);
|
|
|
|
nsresult rv = aNewObject->QueryInterface(aIID, aResult);
|
|
|
|
NS_RELEASE(aNewObject);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2002-09-07 05:17:57 +04:00
|
|
|
NS_METHOD
|
2012-08-22 19:56:38 +04:00
|
|
|
CreateMultiTableDecoder(int32_t aTableCount, const uRange * aRangeArray,
|
2006-08-07 11:57:31 +04:00
|
|
|
uScanClassID * aScanClassArray,
|
2002-07-25 01:27:57 +04:00
|
|
|
uMappingTable ** aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2002-07-25 01:27:57 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (aOuter)
|
|
|
|
return NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
nsMultiTableDecoderSupport* decoder =
|
|
|
|
new nsMultiTableDecoderSupport(aTableCount, aRangeArray,
|
2006-08-07 11:57:31 +04:00
|
|
|
aScanClassArray, aMappingTable,
|
2002-07-25 01:27:57 +04:00
|
|
|
aMaxLengthFactor);
|
|
|
|
if (!decoder)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return StabilizedQueryInterface(decoder, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
2002-09-07 05:17:57 +04:00
|
|
|
NS_METHOD
|
2012-08-22 19:56:38 +04:00
|
|
|
CreateMultiTableEncoder(int32_t aTableCount,
|
2006-08-07 11:57:31 +04:00
|
|
|
uScanClassID * aScanClassArray,
|
|
|
|
uShiftOutTable ** aShiftOutTable,
|
2002-07-25 01:27:57 +04:00
|
|
|
uMappingTable ** aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2002-07-25 01:27:57 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (aOuter)
|
|
|
|
return NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
nsMultiTableEncoderSupport* encoder =
|
|
|
|
new nsMultiTableEncoderSupport(aTableCount,
|
2006-08-07 11:57:31 +04:00
|
|
|
aScanClassArray,
|
|
|
|
aShiftOutTable,
|
|
|
|
aMappingTable,
|
2002-07-25 01:27:57 +04:00
|
|
|
aMaxLengthFactor);
|
|
|
|
if (!encoder)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return StabilizedQueryInterface(encoder, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
2002-09-07 05:17:57 +04:00
|
|
|
NS_METHOD
|
2012-08-22 19:56:38 +04:00
|
|
|
CreateMultiTableEncoder(int32_t aTableCount,
|
2006-08-07 11:57:31 +04:00
|
|
|
uScanClassID * aScanClassArray,
|
|
|
|
uMappingTable ** aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2006-08-07 11:57:31 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
|
|
|
return CreateMultiTableEncoder(aTableCount, aScanClassArray,
|
2012-07-30 18:20:58 +04:00
|
|
|
nullptr,
|
2006-08-07 11:57:31 +04:00
|
|
|
aMappingTable, aMaxLengthFactor,
|
|
|
|
aOuter, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD
|
|
|
|
CreateTableEncoder(uScanClassID aScanClass,
|
|
|
|
uShiftOutTable * aShiftOutTable,
|
2002-09-07 05:17:57 +04:00
|
|
|
uMappingTable * aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2002-09-07 05:17:57 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
2002-07-25 01:27:57 +04:00
|
|
|
{
|
|
|
|
if (aOuter)
|
|
|
|
return NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
nsTableEncoderSupport* encoder =
|
2006-08-07 11:57:31 +04:00
|
|
|
new nsTableEncoderSupport(aScanClass,
|
|
|
|
aShiftOutTable, aMappingTable,
|
2002-07-25 01:27:57 +04:00
|
|
|
aMaxLengthFactor);
|
|
|
|
if (!encoder)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return StabilizedQueryInterface(encoder, aIID, aResult);
|
|
|
|
}
|
2002-09-07 05:17:57 +04:00
|
|
|
|
|
|
|
NS_METHOD
|
2006-08-07 11:57:31 +04:00
|
|
|
CreateTableEncoder(uScanClassID aScanClass,
|
|
|
|
uMappingTable * aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2006-08-07 11:57:31 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return CreateTableEncoder(aScanClass, nullptr,
|
2006-08-07 11:57:31 +04:00
|
|
|
aMappingTable, aMaxLengthFactor,
|
|
|
|
aOuter, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD
|
|
|
|
CreateTableDecoder(uScanClassID aScanClass,
|
|
|
|
uShiftInTable * aShiftInTable,
|
2002-09-07 05:17:57 +04:00
|
|
|
uMappingTable * aMappingTable,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aMaxLengthFactor,
|
2002-09-07 05:17:57 +04:00
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
|
|
|
if (aOuter)
|
|
|
|
return NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
nsTableDecoderSupport* decoder =
|
2006-08-07 11:57:31 +04:00
|
|
|
new nsTableDecoderSupport(aScanClass, aShiftInTable, aMappingTable,
|
2002-09-07 05:17:57 +04:00
|
|
|
aMaxLengthFactor);
|
|
|
|
if (!decoder)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return StabilizedQueryInterface(decoder, aIID, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_METHOD
|
2006-08-07 11:57:31 +04:00
|
|
|
CreateOneByteDecoder(uMappingTable * aMappingTable,
|
2002-09-07 05:17:57 +04:00
|
|
|
|
|
|
|
nsISupports* aOuter,
|
|
|
|
REFNSIID aIID,
|
|
|
|
void** aResult)
|
|
|
|
{
|
|
|
|
if (aOuter) return NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
nsOneByteDecoderSupport* decoder =
|
2006-08-07 11:57:31 +04:00
|
|
|
new nsOneByteDecoderSupport(aMappingTable);
|
2002-09-07 05:17:57 +04:00
|
|
|
|
|
|
|
if (!decoder)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
return StabilizedQueryInterface(decoder, aIID, aResult);
|
|
|
|
}
|