00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#ifndef CONVERT_H
00013
#define CONVERT_H
00014
00015
00016
#include "unicode/unistr.h"
00017
#include "unicode/ucnv.h"
00018
00019 U_NAMESPACE_BEGIN
00039 class U_COMMON_API UnicodeConverter
00040 {
00041
private:
00042
00043
UConverter* myUnicodeConverter;
00044
00045
void printRef(
void)
const;
00046
00047
public:
00048
00049
00050
00056 UnicodeConverter();
00057
00068 UnicodeConverter(
const char* name,
00069 UErrorCode& err);
00070
00082 UnicodeConverter(
const UnicodeString& name,
00083 UErrorCode& err);
00084
00094 UnicodeConverter(int32_t codepageNumber,
00095
UConverterPlatform platform,
00096 UErrorCode& err);
00097
00098 ~UnicodeConverter();
00099
00100
00115
void fromUnicodeString(
char* target,
00116 int32_t& targetSize,
00117
const UnicodeString& source,
00118 UErrorCode& err)
const;
00119
00133
void toUnicodeString(
UnicodeString& target,
00134
const char* source,
00135 int32_t sourceSize,
00136 UErrorCode& err)
const;
00137
00167
void fromUnicode(
char*& target,
00168
const char* targetLimit,
00169
const UChar*& source,
00170
const UChar* sourceLimit,
00171 int32_t * offsets,
00172 UBool flush,
00173 UErrorCode& err);
00174
00175
00204
void toUnicode(
UChar*& target,
00205
const UChar* targetLimit,
00206
const char*& source,
00207
const char* sourceLimit,
00208 int32_t * offsets,
00209 UBool flush,
00210 UErrorCode& err);
00211
00212
00218 int8_t getMaxBytesPerChar(
void)
const;
00219
00226 int8_t getMinBytesPerChar(
void)
const;
00227
00234
UConverterType getType(
void)
const;
00235
00248
void getStarters(UBool starters[256],
00249 UErrorCode& err)
const;
00260
void getSubstitutionChars(
char* subChars,
00261 int8_t& len,
00262 UErrorCode& err)
const;
00274
void setSubstitutionChars(
const char* subChars,
00275 int8_t len,
00276 UErrorCode& err);
00277
00283
void resetState(
void);
00284
00293
const char* getName( UErrorCode& err)
const;
00294
00295
00306 int32_t getCodepage(UErrorCode& err)
const;
00307
00315
void getMissingCharAction(UConverterToUCallback *action,
00316
const void **context)
const;
00317
00325
void getMissingUnicodeAction(UConverterFromUCallback *action,
00326
const void **context)
const;
00327
00338
void setMissingCharAction(UConverterToUCallback newAction,
00339
const void* newContext,
00340 UConverterToUCallback *oldAction,
00341
const void** oldContext,
00342 UErrorCode& err);
00343
00355
void setMissingUnicodeAction(UConverterFromUCallback newAction,
00356
const void* newContext,
00357 UConverterFromUCallback *oldAction,
00358
const void** oldContext,
00359 UErrorCode& err);
00367
void getDisplayName(
const Locale& displayLocale,
00368
UnicodeString& displayName)
const;
00369
00377
UConverterPlatform getCodepagePlatform(UErrorCode& err)
const;
00378
00379
00380 UnicodeConverter& operator=(
const UnicodeConverter& that);
00381 UBool operator==(
const UnicodeConverter& that)
const;
00382 UBool operator!=(
const UnicodeConverter& that)
const;
00383 UnicodeConverter(
const UnicodeConverter& that);
00384
00392
static const char*
const* getAvailableNames(int32_t& num,
00393 UErrorCode& err);
00394
00400
static int32_t flushCache(
void);
00411
void fixFileSeparator(
UnicodeString& source)
const;
00412
00420 UBool isAmbiguous(
void)
const;
00421
00422 };
00423
00428
typedef UnicodeConverter
UnicodeConverterCPP;
00429
00430 U_NAMESPACE_END
00431
#endif