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

FXTextCodec.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                   U n i c o d e   T e x t   C o d e c                         *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002 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: FXTextCodec.h,v 1.4 2002/09/24 22:49:37 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXTEXTCODEC_H
00025 #define FXTEXTCODEC_H
00026 
00027 
00028 //////////////////////////////  UNDER DEVELOPMENT  //////////////////////////////
00029 
00030 
00031 namespace FX {
00032 
00033 /**
00034  * Abstract base class for a stateless coder/decoder.
00035  */
00036 class FXTextCodec {
00037 protected:
00038   FXTextCodec(){}
00039 public:
00040 
00041   /**
00042    * Convert a sequence of wide characters from Unicode to the specified
00043    * 8-bit encoding. Reads at most n wide characters from src and writes
00044    * at most m bytes into dest. Returns the number of characters actually
00045    * written into dest.
00046    *
00047    * On exit, the src and dest pointers are updated to point to the next
00048    * available character (or byte) for reading (writing).
00049    */
00050   virtual unsigned long fromUnicode(FXuchar*& dest,unsigned long m,const FXwchar*& src,unsigned long n) = 0;
00051 
00052   /**
00053    * Convert a sequence of bytes in some 8-bit encoding to a sequence
00054    * of wide characters (Unicode). Reads at most n bytes from src and
00055    * writes at most m characters into dest. Returns the number of characters
00056    * actually read from src.
00057    *
00058    * On exit, the src and dest pointers are updated to point to the next
00059    * available byte (or character) for writing (reading).
00060    */
00061   virtual unsigned long toUnicode(FXwchar*& dest,unsigned long m,const FXuchar*& src,unsigned long n) = 0;
00062 
00063   /**
00064   * Return the IANA mime name for this codec; this is used for example
00065   * as "text/utf-8" in drag and drop protocols.
00066   */
00067   virtual const FXchar* mimeName() const = 0;
00068   
00069   /**
00070   * Return the Management Information Base (MIBenum) for the character set.
00071   */
00072   virtual FXint mibEnum() const = 0;
00073   
00074   /// Destructor
00075   virtual ~FXTextCodec(){}
00076   };
00077 
00078 }
00079 
00080 #endif