ICU-484 add _MBCSGetType() for MBCS to handle all table-based codepages

X-SVN-Rev: 3352
This commit is contained in:
Markus Scherer 2001-01-02 23:01:38 +00:00
parent 2fae985450
commit eda9b41095
2 changed files with 23 additions and 1 deletions

View file

@ -3033,6 +3033,19 @@ _MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
}
}
U_CFUNC UConverterType
_MBCSGetType(const UConverter* converter) {
/* SBCS, DBCS, and EBCDIC_STATEFUL are replaced by MBCS, but here we cheat a little */
if(converter->sharedData->table->mbcs.countStates==1) {
return (UConverterType)UCNV_SBCS;
} else if((converter->sharedData->table->mbcs.outputType&0xff)==MBCS_OUTPUT_2_SISO) {
return (UConverterType)UCNV_EBCDIC_STATEFUL;
} else if(converter->sharedData->staticData->minBytesPerChar==2 && converter->sharedData->staticData->maxBytesPerChar==2) {
return (UConverterType)UCNV_DBCS;
}
return (UConverterType)UCNV_MBCS;
}
static const UConverterImpl _MBCSImpl={
UCNV_MBCS,
@ -3050,7 +3063,8 @@ static const UConverterImpl _MBCSImpl={
_MBCSGetNextUChar,
_MBCSGetStarters,
NULL
NULL,
_MBCSWriteSub
};

View file

@ -18,6 +18,7 @@
#define __UCNVMBCS_H__
#include "unicode/utypes.h"
#include "unicode/ucnv.h"
/* MBCS converter data and state -------------------------------------------- */
@ -203,4 +204,11 @@ _MBCSSingleFromUChar32(UConverterSharedData *sharedData,
UChar32 c,
UBool useFallback);
/**
* SBCS, DBCS, and EBCDIC_STATEFUL are replaced by MBCS, but
* we cheat a little about the type, returning the old types if appropriate.
*/
U_CFUNC UConverterType
_MBCSGetType(const UConverter* converter);
#endif