Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

vos/corelibs/typechain/handlers/type_base64.hh

Go to the documentation of this file.
00001 /* $Id: type_base64.hh,v 1.10 2003/07/04 16:36:26 reed Exp $ */
00002 
00003 /** @file type_base64.hh    
00004     Defines type handler class for base64-encoded data.
00005     @author Reed 10/01
00006 */
00007 
00008 /*
00009     This file is part of the Virtual Object System of
00010     the Interreality project (http://interreality.org).
00011 
00012     Copyright (C) 2001, 2002 Reed Hedges <reed@zerohour.net>
00013 
00014     This library is free software; you can redistribute it and/or
00015     modify it under the terms of the GNU Lesser General Public
00016     License as published by the Free Software Foundation; either
00017     version 2 of the License, or (at your option) any later version.
00018 
00019     This library is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022     Lesser General Public License for more details.
00023 
00024     You should have received a copy of the GNU Lesser General Public
00025     License along with this library; if not, write to the Free Software
00026     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00027 */
00028 
00029 #ifndef _TYPE_BASE64_HH_
00030 #define _TYPE_BASE64_HH_
00031 
00032 #include "typechain/typehandler.hh"
00033 
00034 #define LINELEN 72            /* Encoded line length (max 76) */
00035 
00036 typedef unsigned char byte;       /* Byte type */
00037 
00038 
00039 
00040 
00041 /** Class to encode and decode base64 data.
00042     @see TypeHandler
00043     @see TypeChain
00044     @author Reed Hedges <reed@zerohour.net> December, 2001
00045 
00046 */
00047 
00048 class TypeBase64 : public TypeHandler  {
00049 protected:
00050     byte dtable[256];         /* Encode / decode table */
00051     int linelength;       /* Length of encoded output line */
00052 
00053 public:
00054     char* eol;          /* End of line sequence */
00055     int errcheck;  /* Check decode input for errors ? */
00056 
00057     TypeBase64();
00058     
00059     /** Decode data. 
00060     @param data the base64 data to decode.
00061     @param params not used.
00062     @warning Returns partial data on error, and prints message to stderr (i think).
00063     */
00064     virtual void decode(string& data, TypeParams& params); 
00065     
00066     /** Encode data. 
00067     @todo not finished yet.
00068     @param data the data to encode into base64.
00069     @param params not used.
00070     */
00071     virtual void encode(string& data, TypeParams& params);
00072 };
00073 
00074 
00075 #endif

Generated on Tue Aug 12 03:55:38 2003 for Interreality Project - VOS by doxygen 1.3.2