src/stream/ZStrim_Stream.h

00001 /*  @(#) $Id: ZStrim_Stream.h,v 1.15 2006/07/23 21:58:20 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2003 Andrew Green and Learning in Motion, Inc.
00005 http://www.zoolib.org
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 ------------------------------------------------------------ */
00024 
00025 #ifndef __ZStrim_Stream__
00026 #define __ZStrim_Stream__ 1
00027 
00028 #include "ZStrim.h"
00029 
00030 class ZStreamR;
00031 class ZStreamW;
00032 class ZTextDecoder;
00033 class ZTextEncoder;
00034 
00035 // =================================================================================================
00036 #pragma mark -
00037 #pragma mark * ZStrimR_StreamUTF32BE
00038 
00040 
00041 class ZStrimR_StreamUTF32BE : public ZStrimR
00042         {
00043 public:
00044         ZStrimR_StreamUTF32BE(const ZStreamR& iStreamR);
00045 
00046 // From ZStrimR
00047         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00048 
00049 private:
00050         const ZStreamR& fStreamR;
00051         };
00052 
00053 // =================================================================================================
00054 #pragma mark -
00055 #pragma mark * ZStrimR_StreamUTF32LE
00056 
00058 
00059 class ZStrimR_StreamUTF32LE : public ZStrimR
00060         {
00061 public:
00062         ZStrimR_StreamUTF32LE(const ZStreamR& iStreamR);
00063 
00064 // From ZStrimR
00065         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00066 
00067 private:
00068         const ZStreamR& fStreamR;
00069         };
00070 
00071 // =================================================================================================
00072 #pragma mark -
00073 #pragma mark * ZStrimR_StreamUTF16BE
00074 
00076 
00077 class ZStrimR_StreamUTF16BE : public ZStrimR
00078         {
00079 public:
00080         ZStrimR_StreamUTF16BE(const ZStreamR& iStreamR);
00081 
00082 // From ZStrimR
00083         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00084 
00085 private:
00086         const ZStreamR& fStreamR;
00087         };
00088 
00089 // =================================================================================================
00090 #pragma mark -
00091 #pragma mark * ZStrimR_StreamUTF16LE
00092 
00094 
00095 class ZStrimR_StreamUTF16LE : public ZStrimR
00096         {
00097 public:
00098         ZStrimR_StreamUTF16LE(const ZStreamR& iStreamR);
00099 
00100 // From ZStrimR
00101         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00102 
00103 private:
00104         const ZStreamR& fStreamR;
00105         };
00106 
00107 // =================================================================================================
00108 #pragma mark -
00109 #pragma mark * ZStrimR_StreamUTF8
00110 
00112 
00113 class ZStrimR_StreamUTF8 : public ZStrimR
00114         {
00115 public:
00116         ZStrimR_StreamUTF8(const ZStreamR& iStreamR);
00117 
00118 // From ZStrimR
00119         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00120 
00121         virtual void Imp_ReadUTF8(UTF8*
00122                 iDest, size_t iCountCU, size_t* oCountCU, size_t iCountCP, size_t* oCountCP);
00123 
00124 private:
00125         const ZStreamR& fStreamR;
00126         };
00127 
00128 // =================================================================================================
00129 #pragma mark -
00130 #pragma mark * ZStrimW_StreamUTF32BE
00131 
00133 
00134 class ZStrimW_StreamUTF32BE : public ZStrimW_NativeUTF32
00135         {
00136 public:
00137         ZStrimW_StreamUTF32BE(const ZStreamW& iStreamW);
00138 
00139 // From ZStrimW via ZStrimW_NativeUTF32
00140         virtual void Imp_WriteUTF32(const UTF32* iSource, size_t iCountCU, size_t* oCountCU);
00141         virtual void Imp_Flush();
00142 
00143 private:
00144         const ZStreamW& fStreamW;
00145         };
00146 
00147 // =================================================================================================
00148 #pragma mark -
00149 #pragma mark * ZStrimW_StreamUTF32LE
00150 
00152 
00153 class ZStrimW_StreamUTF32LE : public ZStrimW_NativeUTF32
00154         {
00155 public:
00156         ZStrimW_StreamUTF32LE(const ZStreamW& iStreamW);
00157 
00158 // From ZStrimW via ZStrimW_NativeUTF32
00159         virtual void Imp_WriteUTF32(const UTF32* iSource, size_t iCountCU, size_t* oCountCU);
00160         virtual void Imp_Flush();
00161 
00162 private:
00163         const ZStreamW& fStreamW;
00164         };
00165 
00166 // =================================================================================================
00167 #pragma mark -
00168 #pragma mark * ZStrimW_StreamUTF16BE
00169 
00171 
00172 class ZStrimW_StreamUTF16BE : public ZStrimW_NativeUTF16
00173         {
00174 public:
00175         ZStrimW_StreamUTF16BE(const ZStreamW& iStreamW);
00176 
00177 // From ZStrimW via ZStrimW_NativeUTF16
00178         virtual void Imp_WriteUTF16(const UTF16* iSource, size_t iCountCU, size_t* oCountCU);
00179         virtual void Imp_Flush();
00180 
00181 private:
00182         const ZStreamW& fStreamW;
00183         };
00184 
00185 // =================================================================================================
00186 #pragma mark -
00187 #pragma mark * ZStrimW_StreamUTF16LE
00188 
00190 
00191 class ZStrimW_StreamUTF16LE : public ZStrimW_NativeUTF16
00192         {
00193 public:
00194         ZStrimW_StreamUTF16LE(const ZStreamW& iStreamW);
00195 
00196 // From ZStrimW via ZStrimW_NativeUTF16
00197         virtual void Imp_WriteUTF16(const UTF16* iSource, size_t iCountCU, size_t* oCountCU);
00198         virtual void Imp_Flush();
00199 
00200 private:
00201         const ZStreamW& fStreamW;
00202         };
00203 
00204 // =================================================================================================
00205 #pragma mark -
00206 #pragma mark * ZStrimW_StreamUTF8
00207 
00209 
00210 class ZStrimW_StreamUTF8 : public ZStrimW_NativeUTF8
00211         {
00212 public:
00213         ZStrimW_StreamUTF8(const ZStreamW& iStreamW);
00214 
00215 // From ZStrimW via ZStrimW_NativeUTF8
00216         virtual void Imp_WriteUTF8(const UTF8* iSource, size_t iCountCU, size_t* oCountCU);
00217         virtual void Imp_Flush();
00218 
00219 private:
00220         const ZStreamW& fStreamW;
00221         };
00222 
00223 // =================================================================================================
00224 #pragma mark -
00225 #pragma mark * ZStrimR_StreamDecoder
00226 
00230 class ZStrimR_StreamDecoder : public ZStrimR
00231         {
00232 public:
00233         ZStrimR_StreamDecoder(ZTextDecoder* iDecoder, const ZStreamR& iStreamR);
00234         ZStrimR_StreamDecoder(const std::pair<ZTextDecoder*, const ZStreamR*>& iParam);
00235         ~ZStrimR_StreamDecoder();
00236 
00237 // From ZStrimR
00238         virtual void Imp_ReadUTF32(UTF32* iDest, size_t iCount, size_t* oCount);
00239 
00240 // Our protocol
00241         void SetDecoder(ZTextDecoder* iDecoder);
00242         ZTextDecoder* SetDecoderReturnOld(ZTextDecoder* iDecoder);
00243 
00244 private:
00245         const ZStreamR& fStreamR;
00246         ZTextDecoder* fDecoder;
00247         };
00248 
00249 // =================================================================================================
00250 #pragma mark -
00251 #pragma mark * ZStrimW_StreamEncoder
00252 
00256 class ZStrimW_StreamEncoder : public ZStrimW_NativeUTF32
00257         {
00258 public:
00259         ZStrimW_StreamEncoder(ZTextEncoder* iEncoder, const ZStreamW& iStreamW);
00260         ZStrimW_StreamEncoder(const std::pair<ZTextEncoder*, const ZStreamW*>& iParam);
00261         ~ZStrimW_StreamEncoder();
00262 
00263 // From ZStrimW via ZStrimW_NativeUTF32
00264         virtual void Imp_WriteUTF32(const UTF32* iSource, size_t iCountCU, size_t* oCountCU);
00265         virtual void Imp_Flush();
00266 
00267 // Our protocol
00268         void SetEncoder(ZTextEncoder* iEncoder);
00269         ZTextEncoder* SetEncoderReturnOld(ZTextEncoder* iEncoder);
00270 
00271 private:
00272         const ZStreamW& fStreamW;
00273         ZTextEncoder* fEncoder;
00274         };
00275 
00276 #endif // __ZStrim_Stream__

Generated on Thu Jul 26 11:21:55 2007 for ZooLib by  doxygen 1.4.7