00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef CONVERT_H
00013 #define CONVERT_H
00014
00015 #include "unicode/utypes.h"
00016
00017 #ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
00018 #include "unicode/uobject.h"
00019 #include "unicode/unistr.h"
00020 #include "unicode/ucnv.h"
00021
00022 U_NAMESPACE_BEGIN
00042 class U_COMMON_API UnicodeConverter : public UObject {
00043 private:
00044
00045 UConverter* myUnicodeConverter;
00046
00047 void printRef(void) const;
00048
00049 public:
00050
00051
00052
00058 UnicodeConverter();
00059
00070 UnicodeConverter(const char* name,
00071 UErrorCode& err);
00072
00084 UnicodeConverter(const UnicodeString& name,
00085 UErrorCode& err);
00086
00097 UnicodeConverter(int32_t codepageNumber,
00098 UConverterPlatform platform,
00099 UErrorCode& err);
00100
00101 ~UnicodeConverter();
00102
00103
00118 void fromUnicodeString(char* target,
00119 int32_t& targetSize,
00120 const UnicodeString& source,
00121 UErrorCode& err) const;
00122
00136 void toUnicodeString(UnicodeString& target,
00137 const char* source,
00138 int32_t sourceSize,
00139 UErrorCode& err) const;
00140
00170 void fromUnicode(char*& target,
00171 const char* targetLimit,
00172 const UChar*& source,
00173 const UChar* sourceLimit,
00174 int32_t * offsets,
00175 UBool flush,
00176 UErrorCode& err);
00177
00178
00207 void toUnicode(UChar*& target,
00208 const UChar* targetLimit,
00209 const char*& source,
00210 const char* sourceLimit,
00211 int32_t * offsets,
00212 UBool flush,
00213 UErrorCode& err);
00214
00215
00221 int8_t getMaxBytesPerChar(void) const;
00222
00229 int8_t getMinBytesPerChar(void) const;
00230
00237 UConverterType getType(void) const;
00238
00251 void getStarters(UBool starters[256],
00252 UErrorCode& err) const;
00263 void getSubstitutionChars(char* subChars,
00264 int8_t& len,
00265 UErrorCode& err) const;
00277 void setSubstitutionChars(const char* subChars,
00278 int8_t len,
00279 UErrorCode& err);
00280
00286 void resetState(void);
00287
00296 const char* getName( UErrorCode& err) const;
00297
00298
00309 int32_t getCodepage(UErrorCode& err) const;
00310
00318 void getMissingCharAction(UConverterToUCallback *action,
00319 const void **context) const;
00320
00328 void getMissingUnicodeAction(UConverterFromUCallback *action,
00329 const void **context) const;
00330
00341 void setMissingCharAction(UConverterToUCallback newAction,
00342 const void* newContext,
00343 UConverterToUCallback *oldAction,
00344 const void** oldContext,
00345 UErrorCode& err);
00346
00358 void setMissingUnicodeAction(UConverterFromUCallback newAction,
00359 const void* newContext,
00360 UConverterFromUCallback *oldAction,
00361 const void** oldContext,
00362 UErrorCode& err);
00370 void getDisplayName(const Locale& displayLocale,
00371 UnicodeString& displayName) const;
00372
00380 UConverterPlatform getCodepagePlatform(UErrorCode& err) const;
00381
00387 UnicodeConverter& operator=(const UnicodeConverter& that);
00388
00397 UBool operator==(const UnicodeConverter& that) const;
00398
00409 UBool operator!=(const UnicodeConverter& that) const;
00410
00411
00412
00413
00414
00415 UnicodeConverter(const UnicodeConverter& that);
00416
00424 static const char* const* getAvailableNames(int32_t& num,
00425 UErrorCode& err);
00426
00432 static int32_t flushCache(void);
00443 void fixFileSeparator(UnicodeString& source) const;
00444
00452 UBool isAmbiguous(void) const;
00453
00459 virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00460
00466 static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00467
00468 private:
00469
00474 static const char fgClassID;
00475 };
00476
00477 U_NAMESPACE_END
00478 #else
00479
00480 #error "The unicode/convert.h header is obsolete. Please use the converter C API in unicode/ucnv.h instead."
00481
00482 #endif
00483
00484 #endif