Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

convert.h

00001 /*******************************************************************************
00002  *
00003  *   Copyright (C) 1998-1999, International Business Machines
00004  *   Corporation and others.  All Rights Reserved.
00005  *
00006  *
00007  *   Change history:
00008  *
00009  *   06/29/2000  helena      Major rewrite of the callback APIs.
00010  *******************************************************************************/
00011 
00012 #ifndef CONVERT_H
00013 #define CONVERT_H
00014 
00015 
00016 #include "unicode/unistr.h"
00017 #include "unicode/ucnv.h"
00018 
00019 class U_COMMON_API UnicodeConverter
00020 {
00021  private:
00022   /*Internal Data representation of the Converter*/
00023   UConverter* myUnicodeConverter;
00024   /*Debug method*/
00025   void printRef(void) const;
00026 
00027   /* list of converter and alias names */
00028   static const char **availableConverterNames;
00029   static int32_t availableConverterNamesCount;
00030 
00031  public:
00032 
00033 //Constructors and a destructor
00034 
00040  UnicodeConverter();
00041 
00052  UnicodeConverter(const char*             name,
00053              UErrorCode&              err);
00054 
00066  UnicodeConverter(const UnicodeString&    name,
00067              UErrorCode&              err);
00068 
00078  UnicodeConverter(int32_t                      codepageNumber,
00079              UConverterPlatform  platform,
00080              UErrorCode&                   err);
00081 
00082  ~UnicodeConverter();
00083 
00084 
00099 void fromUnicodeString(char*                    target,
00100                int32_t&                 targetSize,
00101                const UnicodeString&     source,
00102                UErrorCode&               err) const;
00103 
00117 void  toUnicodeString(UnicodeString&    target,
00118                       const char*       source,
00119                       int32_t           sourceSize,
00120                       UErrorCode&        err) const;
00121 
00142 void fromUnicode(char*&         target,
00143                  const char*    targetLimit,
00144                  const UChar*&      source,
00145                  const UChar* sourceLimit,
00146                  int32_t * offsets,
00147                  UBool         flush,
00148                  UErrorCode&     err);
00149 
00150 
00170  void toUnicode(UChar*&        target,
00171         const UChar*   targetLimit,
00172         const char*&     source,
00173         const char*      sourceLimit,
00174         int32_t * offsets,
00175         UBool           flush,
00176         UErrorCode&       err);
00177 
00178 
00184 int8_t getMaxBytesPerChar(void) const;
00185 
00192 int8_t getMinBytesPerChar(void) const;
00193 
00200 UConverterType getType(void) const;
00201 
00214  void getStarters(UBool starters[256],
00215                   UErrorCode& err) const;
00226 void getSubstitutionChars(char*         subChars,
00227                           int8_t&       len,
00228                           UErrorCode&    err) const;
00240 void setSubstitutionChars(const char*   subChars,
00241                           int8_t        len,
00242                           UErrorCode&    err);
00243 
00249 void resetState(void);
00250 
00259 const char*  getName( UErrorCode&  err) const;
00260 
00261 
00272  int32_t  getCodepage(UErrorCode& err) const;
00273 
00281  void getMissingCharAction(UConverterToUCallback *action,
00282                            void **context) const;
00283 
00291  void getMissingUnicodeAction(UConverterFromUCallback *action,
00292                               void **context) const;
00293 
00304  void  setMissingCharAction(UConverterToUCallback     newAction,
00305                 void* newContext,
00306                 UConverterToUCallback *oldAction, 
00307                 void** oldContext,
00308                 UErrorCode&            err);
00309 
00321  void  setMissingUnicodeAction(UConverterFromUCallback  newAction,
00322                    void* newContext,
00323                    UConverterFromUCallback *oldAction,
00324                    void** oldContext,
00325                    UErrorCode&            err);
00333 void getDisplayName(const Locale&   displayLocale,
00334                     UnicodeString&  displayName) const;
00335 
00343 UConverterPlatform  getCodepagePlatform(UErrorCode& err) const;
00344 
00345 
00346  UnicodeConverter&   operator=(const UnicodeConverter& that);
00347  UBool              operator==(const UnicodeConverter& that) const;
00348  UBool              operator!=(const UnicodeConverter& that) const;
00349  UnicodeConverter(const UnicodeConverter&  that);
00350 
00358 static  const char* const* getAvailableNames(int32_t&   num,
00359                          UErrorCode&  err);
00360 
00366 static   int32_t flushCache(void);
00377 void fixFileSeparator(UnicodeString& source) const;
00378 
00386 UBool isAmbiguous(void) const;
00387 
00388 };
00389 
00390 typedef UnicodeConverter UnicodeConverterCPP;   /* Backwards compatibility. */
00391 
00392 #endif

Generated at Wed Aug 16 16:05:33 2000 for ICU1.6 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999