Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

convert.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  *   Copyright (C) 1998-2001, 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 #include "unicode/utypes.h"
00016 #include "unicode/uobject.h"
00017 #include "unicode/unistr.h"
00018 #include "unicode/ucnv.h"
00019 
00020 U_NAMESPACE_BEGIN
00040 class U_COMMON_API UnicodeConverter : public UObject {
00041  private:
00042   /*Internal Data representation of the Converter*/
00043   UConverter* myUnicodeConverter;
00044   /*Debug method*/
00045   void printRef(void) const;
00046 
00047  public:
00048 
00049 //Constructors and a destructor
00050 
00056  UnicodeConverter();
00057 
00068  UnicodeConverter(const char*             name,
00069              UErrorCode&              err);
00070 
00082  UnicodeConverter(const UnicodeString&    name,
00083              UErrorCode&              err);
00084 
00095  UnicodeConverter(int32_t                      codepageNumber,
00096              UConverterPlatform  platform,
00097              UErrorCode&                   err);
00098 
00099  ~UnicodeConverter();
00100 
00101 
00116 void fromUnicodeString(char*                    target,
00117                int32_t&                 targetSize,
00118                const UnicodeString&     source,
00119                UErrorCode&               err) const;
00120 
00134 void  toUnicodeString(UnicodeString&    target,
00135                       const char*       source,
00136                       int32_t           sourceSize,
00137                       UErrorCode&        err) const;
00138 
00168 void fromUnicode(char*&         target,
00169                  const char*    targetLimit,
00170                  const UChar*&      source,
00171                  const UChar* sourceLimit,
00172                  int32_t * offsets,
00173                  UBool         flush,
00174                  UErrorCode&     err);
00175 
00176 
00205  void toUnicode(UChar*&        target,
00206         const UChar*   targetLimit,
00207         const char*&     source,
00208         const char*      sourceLimit,
00209         int32_t * offsets,
00210         UBool           flush,
00211         UErrorCode&       err);
00212 
00213 
00219 int8_t getMaxBytesPerChar(void) const;
00220 
00227 int8_t getMinBytesPerChar(void) const;
00228 
00235 UConverterType getType(void) const;
00236 
00249  void getStarters(UBool starters[256],
00250                   UErrorCode& err) const;
00261 void getSubstitutionChars(char*         subChars,
00262                           int8_t&       len,
00263                           UErrorCode&    err) const;
00275 void setSubstitutionChars(const char*   subChars,
00276                           int8_t        len,
00277                           UErrorCode&    err);
00278 
00284 void resetState(void);
00285 
00294 const char*  getName( UErrorCode&  err) const;
00295 
00296 
00307  int32_t  getCodepage(UErrorCode& err) const;
00308 
00316  void getMissingCharAction(UConverterToUCallback *action,
00317                            const void **context) const;
00318 
00326  void getMissingUnicodeAction(UConverterFromUCallback *action,
00327                               const void **context) const;
00328 
00339  void  setMissingCharAction(UConverterToUCallback     newAction,
00340                 const void* newContext,
00341                 UConverterToUCallback *oldAction, 
00342                 const void** oldContext,
00343                 UErrorCode&            err);
00344 
00356  void  setMissingUnicodeAction(UConverterFromUCallback  newAction,
00357                    const void* newContext,
00358                    UConverterFromUCallback *oldAction,
00359                    const void** oldContext,
00360                    UErrorCode&            err);
00368 void getDisplayName(const Locale&   displayLocale,
00369                     UnicodeString&  displayName) const;
00370 
00378 UConverterPlatform  getCodepagePlatform(UErrorCode& err) const;
00379 
00385  UnicodeConverter&   operator=(const UnicodeConverter& that);
00386  
00395  UBool              operator==(const UnicodeConverter& that) const;
00396  
00407  UBool              operator!=(const UnicodeConverter& that) const;
00408  
00409  /* copy constructor
00410   * @param that The UnicodeConverter to be copied.
00411   * @return the newly created Unicode Converter.
00412   * */
00413  UnicodeConverter(const UnicodeConverter&  that);
00414 
00422 static  const char* const* getAvailableNames(int32_t&   num,
00423                          UErrorCode&  err);
00424 
00430 static   int32_t flushCache(void);
00441 void fixFileSeparator(UnicodeString& source) const;
00442 
00450 UBool isAmbiguous(void) const;
00451 
00457   virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
00458 
00464   static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
00465 
00466 private:
00467 
00472   static const char fgClassID;
00473 };
00474 
00475 U_NAMESPACE_END
00476 #endif

Generated on Thu Aug 15 14:13:24 2002 for ICU 2.2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001