00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Benjamin Hadorn (bhadorn@swissinfo.org) * 00003 *************************************************************************** 00004 * Projekt : Zeus 00005 * Module : Base64OutputStream 00006 * Package : System 00007 * Author : Benjamin Hadorn 00008 * Datum : $Date: 11.10.07 6:58 $ 00009 * Ablage : $File$ 00010 * System : Cell Computing Model 00011 *************************************************************************** 00012 * Licence: * 00013 * This library is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU Lesser General Public License as * 00015 * published by the Free Software Foundation; either version * 00016 * 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00026 ***************************************************************************/ 00027 00028 /*************************************************************************** 00029 Changes : 00030 $Log: /WinSteuerung2/dev/Zeus/src/zeusbase/System/Base64OutputStream.h $ 00031 ** 00032 ** 7 11.10.07 6:58 bha 00033 ** Optimized filter streams reading/writing block data 00034 ** 00035 ** 6 3.09.07 17:21 Mabbuehl 00036 ** VS6 warnings removed. 00037 ** 00038 ** 5 26.02.07 9:00 bha 00039 ***************************************************************************/ 00040 00041 #ifndef Base64OutputStreamH 00042 #define Base64OutputStreamH 00043 00044 #include <zeusbase/System/FilterOutputStream.h> 00045 #include <zeusbase/System/ZObject.h> 00046 00047 #ifdef _MSC_VER 00048 #pragma warning(push, 1) 00049 #endif 00050 00051 #include <stdio.h> 00052 #include <sstream> 00053 #include <iostream> 00054 00055 #ifdef _MSC_VER 00056 #pragma warning(pop) 00057 #endif 00058 00059 00060 BEGIN_NAMESPACE_Zeus 00061 00062 /***************************************************************************/ 00066 /***************************************************************************/ 00067 zeusbase_class TBase64OutputStream : public TFilterOutputStream 00068 { 00069 public: 00070 TBase64OutputStream(IOutputStream& rParentStream, Int iMaxColumns = 76); 00071 00072 //Methods of IOutputStream 00073 virtual Retval MQUALIFIER write(const char* pBuffer, Int iBufferSize); 00074 virtual Retval MQUALIFIER writeInt8(Int8 cData); 00075 virtual void MQUALIFIER flush(); 00076 00077 protected: 00078 virtual ~TBase64OutputStream(); 00079 00080 private: 00082 static char m_cToBase64[64]; 00084 Int m_iByteIndex; 00086 Int m_iColumn; 00088 Int m_iMaxColumns; 00090 unsigned char m_ucInputBuffer[3]; 00091 }; 00092 00093 /***************************************************************************/ 00096 /***************************************************************************/ 00097 inline Retval MQUALIFIER TBase64OutputStream::write(const char* pBuffer, Int iBufferSize) 00098 { 00099 return delegateWriteBlockToWriteInt8(pBuffer, iBufferSize); 00100 } 00101 00102 END_NAMESPACE_Zeus 00103 00104 00105 #endif 00106