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

FXUTF8Codec.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                      U T F - 8  T e x t   C o d e c                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002,2004 by Lyle Johnson.   All Rights Reserved.               *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXUTF8Codec.h,v 1.6 2004/02/08 17:17:34 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXUTF8CODEC_H
00025 #define FXUTF8CODEC_H
00026 
00027 #ifndef FXTEXTCODEC_H
00028 #include "FXTextCodec.h"
00029 #endif
00030 
00031 
00032 //////////////////////////////  UNDER DEVELOPMENT  //////////////////////////////
00033 
00034 
00035 namespace FX {
00036 
00037 /**
00038  * Codec for UTF-8
00039  */
00040 class FXUTF8Codec : public FXTextCodec {
00041 public:
00042 
00043   /// Constructor
00044   FXUTF8Codec(){}
00045 
00046   /**
00047    * Convert a sequence of wide characters from Unicode to UTF-8.
00048    * Reads at most n wide characters from src and writes at most m
00049    * bytes into dest. Returns the number of characters actually
00050    * written into dest.
00051    *
00052    * On exit, the src and dest pointers are updated to point to the next
00053    * available character (or byte) for reading (writing).
00054    */
00055   virtual unsigned long fromUnicode(FXuchar*& dest,unsigned long m,const FXwchar*& src,unsigned long n);
00056 
00057   /**
00058    * Convert a sequence of bytes in UTF-8 encoding to a sequence
00059    * of wide characters (Unicode). Reads at most n bytes from src and
00060    * writes at most m characters into dest. Returns the number of characters
00061    * actually read from src.
00062    *
00063    * On exit, the src and dest pointers are updated to point to the next
00064    * available byte (or character) for writing (reading).
00065    */
00066   virtual unsigned long toUnicode(FXwchar*& dest,unsigned long m,const FXuchar*& src,unsigned long n);
00067 
00068   /**
00069   * Return the IANA mime name for this codec; this is used for example
00070   * as "text/utf-8" in drag and drop protocols.
00071   */
00072   virtual const FXchar* mimeName() const;
00073 
00074   /**
00075   * Return the Management Information Base (MIBenum) for the character set.
00076   */
00077   virtual FXint mibEnum() const;
00078 
00079   /// Destructor
00080   virtual ~FXUTF8Codec(){}
00081   };
00082 
00083 }
00084 
00085 #endif
00086 

Copyright © 1997-2004 Jeroen van der Zijp