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"
00028 class U_COMMON_API UnicodeConverter
00029 {
00030 private:
00031
00032 UConverter* myUnicodeConverter;
00033
00034 void printRef(void) const;
00035
00036
00037 static const char **availableConverterNames;
00038 static int32_t availableConverterNamesCount;
00039
00040 public:
00041
00042
00043
00049 UnicodeConverter();
00050
00061 UnicodeConverter(const char* name,
00062 UErrorCode& err);
00063
00075 UnicodeConverter(const UnicodeString& name,
00076 UErrorCode& err);
00077
00087 UnicodeConverter(int32_t codepageNumber,
00088 UConverterPlatform platform,
00089 UErrorCode& err);
00090
00091 ~UnicodeConverter();
00092
00093
00108 void fromUnicodeString(char* target,
00109 int32_t& targetSize,
00110 const UnicodeString& source,
00111 UErrorCode& err) const;
00112
00126 void toUnicodeString(UnicodeString& target,
00127 const char* source,
00128 int32_t sourceSize,
00129 UErrorCode& err) const;
00130
00151 void fromUnicode(char*& target,
00152 const char* targetLimit,
00153 const UChar*& source,
00154 const UChar* sourceLimit,
00155 int32_t * offsets,
00156 UBool flush,
00157 UErrorCode& err);
00158
00159
00179 void toUnicode(UChar*& target,
00180 const UChar* targetLimit,
00181 const char*& source,
00182 const char* sourceLimit,
00183 int32_t * offsets,
00184 UBool flush,
00185 UErrorCode& err);
00186
00187
00193 int8_t getMaxBytesPerChar(void) const;
00194
00201 int8_t getMinBytesPerChar(void) const;
00202
00209 UConverterType getType(void) const;
00210
00223 void getStarters(UBool starters[256],
00224 UErrorCode& err) const;
00235 void getSubstitutionChars(char* subChars,
00236 int8_t& len,
00237 UErrorCode& err) const;
00249 void setSubstitutionChars(const char* subChars,
00250 int8_t len,
00251 UErrorCode& err);
00252
00258 void resetState(void);
00259
00268 const char* getName( UErrorCode& err) const;
00269
00270
00281 int32_t getCodepage(UErrorCode& err) const;
00282
00290 void getMissingCharAction(UConverterToUCallback *action,
00291 void **context) const;
00292
00300 void getMissingUnicodeAction(UConverterFromUCallback *action,
00301 void **context) const;
00302
00313 void setMissingCharAction(UConverterToUCallback newAction,
00314 void* newContext,
00315 UConverterToUCallback *oldAction,
00316 void** oldContext,
00317 UErrorCode& err);
00318
00330 void setMissingUnicodeAction(UConverterFromUCallback newAction,
00331 void* newContext,
00332 UConverterFromUCallback *oldAction,
00333 void** oldContext,
00334 UErrorCode& err);
00342 void getDisplayName(const Locale& displayLocale,
00343 UnicodeString& displayName) const;
00344
00352 UConverterPlatform getCodepagePlatform(UErrorCode& err) const;
00353
00354
00355 UnicodeConverter& operator=(const UnicodeConverter& that);
00356 UBool operator==(const UnicodeConverter& that) const;
00357 UBool operator!=(const UnicodeConverter& that) const;
00358 UnicodeConverter(const UnicodeConverter& that);
00359
00367 static const char* const* getAvailableNames(int32_t& num,
00368 UErrorCode& err);
00369
00375 static int32_t flushCache(void);
00386 void fixFileSeparator(UnicodeString& source) const;
00387
00395 UBool isAmbiguous(void) const;
00396
00397 };
00398
00403 typedef UnicodeConverter UnicodeConverterCPP;
00404
00405 #endif