|
reSIProcate/rutil
9694
|
00001 #ifndef RESIP_DataStream_hxx 00002 #define RESIP_DataStream_hxx 00003 00004 #ifdef HAVE_CONFIG_H 00005 #include "config.h" 00006 #endif 00007 00008 #include <iostream> 00009 #include "resipfaststreams.hxx" 00010 00011 namespace resip 00012 { 00013 00014 class Data; 00015 00019 class DataBuffer : 00020 #ifdef RESIP_USE_STL_STREAMS 00021 public std::streambuf 00022 #else 00023 public ResipStreamBuf 00024 #endif 00025 { 00026 public: 00027 DataBuffer(Data& str); 00028 virtual ~DataBuffer(); 00029 00030 protected: 00031 #ifdef RESIP_USE_STL_STREAMS 00032 virtual int sync(); 00033 virtual int overflow(int c = -1); 00034 #else 00035 virtual size_t writebuf(const char *s, size_t count); 00036 virtual size_t readbuf(char *buf, size_t count); 00037 virtual size_t putbuf(char ch); 00038 virtual void flushbuf(void) 00039 {} 00040 virtual UInt64 tellpbuf(void); 00041 #endif 00042 Data& mStr; 00043 private: 00044 DataBuffer(const DataBuffer&); 00045 DataBuffer& operator=(const DataBuffer&); 00046 }; 00047 00056 class DataStream : private DataBuffer 00057 #ifdef RESIP_USE_STL_STREAMS 00058 , public std::iostream 00059 #else 00060 , public ResipFastOStream 00061 #endif 00062 00063 { 00064 public: 00068 DataStream(Data& str); 00072 ~DataStream(); 00073 00074 private: 00075 DataStream(const DataStream&); 00076 DataStream& operator=(const DataStream&); 00077 }; 00078 00082 class iDataStream : private DataBuffer, public DecodeStream 00083 { 00084 public: 00088 iDataStream(Data& str); 00089 ~iDataStream(); 00090 00091 private: 00092 iDataStream(const iDataStream&); 00093 iDataStream& operator=(const iDataStream&); 00094 00095 }; 00096 00103 class oDataStream : private DataBuffer, public EncodeStream 00104 { 00105 public: 00109 oDataStream(Data& str); 00113 ~oDataStream(); 00114 00116 void reset(); 00117 00118 private: 00119 oDataStream(const oDataStream&); 00120 oDataStream& operator=(const oDataStream&); 00121 }; 00122 } 00123 #endif 00124 00125 /* ==================================================================== 00126 * The Vovida Software License, Version 1.0 00127 * 00128 * Copyright (c) 2000-2005 00129 * 00130 * Redistribution and use in source and binary forms, with or without 00131 * modification, are permitted provided that the following conditions 00132 * are met: 00133 * 00134 * 1. Redistributions of source code must retain the above copyright 00135 * notice, this list of conditions and the following disclaimer. 00136 * 00137 * 2. Redistributions in binary form must reproduce the above copyright 00138 * notice, this list of conditions and the following disclaimer in 00139 * the documentation and/or other materials provided with the 00140 * distribution. 00141 * 00142 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00143 * and "Vovida Open Communication Application Library (VOCAL)" must 00144 * not be used to endorse or promote products derived from this 00145 * software without prior written permission. For written 00146 * permission, please contact vocal@vovida.org. 00147 * 00148 * 4. Products derived from this software may not be called "VOCAL", nor 00149 * may "VOCAL" appear in their name, without prior written 00150 * permission of Vovida Networks, Inc. 00151 * 00152 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00153 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00154 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00155 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00156 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00157 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00158 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00159 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00160 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00161 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00162 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00163 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00164 * DAMAGE. 00165 * 00166 * ==================================================================== 00167 * 00168 * This software consists of voluntary contributions made by Vovida 00169 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00170 * Inc. For more information on Vovida Networks, Inc., please see 00171 * <http://www.vovida.org/>. 00172 * 00173 */
1.7.5.1