/******************************************************************************* * * Copyright (C) 1998-1999, International Business Machines * Corporation and others. All Rights Reserved. * * * Change history: * * 06/29/2000 helena Major rewrite of the callback APIs. *******************************************************************************/ #ifndef CONVERT_H #define CONVERT_H #include "unicode/unistr.h" #include "unicode/ucnv.h" class U_COMMON_API UnicodeConverter { private: /*Internal Data representation of the Converter*/ UConverter* myUnicodeConverter; /*Debug method*/ void printRef(void) const; /* list of converter and alias names */ static const char **availableConverterNames; static int32_t availableConverterNamesCount; public: //Constructors and a destructor UnicodeConverter(); UnicodeConverter(const char* name, UErrorCode& err); UnicodeConverter(const UnicodeString& name, UErrorCode& err); UnicodeConverter(int32_t codepageNumber, UConverterPlatform platform, UErrorCode& err); ~UnicodeConverter(); void fromUnicodeString(char* target, int32_t& targetSize, const UnicodeString& source, UErrorCode& err) const; void toUnicodeString(UnicodeString& target, const char* source, int32_t sourceSize, UErrorCode& err) const; void fromUnicode(char*& target, const char* targetLimit, const UChar*& source, const UChar* sourceLimit, int32_t * offsets, UBool flush, UErrorCode& err); void toUnicode(UChar*& target, const UChar* targetLimit, const char*& source, const char* sourceLimit, int32_t * offsets, UBool flush, UErrorCode& err); int8_t getMaxBytesPerChar(void) const; int8_t getMinBytesPerChar(void) const; UConverterType getType(void) const; void getStarters(UBool starters[256], UErrorCode& err) const; void getSubstitutionChars(char* subChars, int8_t& len, UErrorCode& err) const; void setSubstitutionChars(const char* subChars, int8_t len, UErrorCode& err); void resetState(void); const char* getName( UErrorCode& err) const; int32_t getCodepage(UErrorCode& err) const; void getMissingCharAction(UConverterToUCallback *action, void **context) const; void getMissingUnicodeAction(UConverterFromUCallback *action, void **context) const; void setMissingCharAction(UConverterToUCallback newAction, void* newContext, UConverterToUCallback *oldAction, void** oldContext, UErrorCode& err); void setMissingUnicodeAction(UConverterFromUCallback newAction, void* newContext, UConverterFromUCallback *oldAction, void** oldContext, UErrorCode& err); void getDisplayName(const Locale& displayLocale, UnicodeString& displayName) const; UConverterPlatform getCodepagePlatform(UErrorCode& err) const; UnicodeConverter& operator=(const UnicodeConverter& that); UBool operator==(const UnicodeConverter& that) const; UBool operator!=(const UnicodeConverter& that) const; UnicodeConverter(const UnicodeConverter& that); static const char* const* getAvailableNames(int32_t& num, UErrorCode& err); static int32_t flushCache(void); void fixFileSeparator(UnicodeString& source) const; UBool isAmbiguous(void) const; }; typedef UnicodeConverter UnicodeConverterCPP; /* Backwards compatibility. */ #endif