src/stream/ZStream_CRLF.h

00001 /*  @(#) $Id: ZStream_CRLF.h,v 1.2 2006/04/10 20:44:21 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2004 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 __ZStream_CRLF__
00026 #define __ZStream_CRLF__ 1
00027 #include "zconfig.h"
00028 
00029 #include "ZStream.h"
00030 
00031 #include <string>
00032 
00033 // =================================================================================================
00034 #pragma mark -
00035 #pragma mark * ZStreamR_CRLFRemove
00036 
00037 class ZStreamR_CRLFRemove : public ZStreamR
00038         {
00039 public:
00040         ZStreamR_CRLFRemove(const ZStreamR& iStreamSource);
00041         ZStreamR_CRLFRemove(char iReplaceChar, const ZStreamR& iStreamSource);
00042         ~ZStreamR_CRLFRemove();
00043 
00044 // From ZStreamR
00045         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00046 
00047 protected:
00048         const ZStreamR& fStreamSource;
00049         char fReplaceChar;
00050         bool fLastWasCR;
00051         };
00052 
00053 // =================================================================================================
00054 #pragma mark -
00055 #pragma mark * ZStreamR_CRLFInsert
00056 
00057 class ZStreamR_CRLFInsert : public ZStreamR
00058         {
00059 public:
00060         ZStreamR_CRLFInsert(const ZStreamR& iStreamSource);
00061         ~ZStreamR_CRLFInsert();
00062 
00063 // From ZStreamR
00064         virtual void Imp_Read(void* iDest, size_t iCount, size_t* oCountRead);
00065 
00066 protected:
00067         const ZStreamR& fStreamSource;
00068         bool fLastWasCR;
00069         bool fHasBuffChar;
00070         char fBuffChar;
00071         };
00072 
00073 // =================================================================================================
00074 #pragma mark -
00075 #pragma mark * ZStreamW_CRLFRemove
00076 
00077 class ZStreamW_CRLFRemove : public ZStreamW
00078         {
00079 public:
00080         ZStreamW_CRLFRemove(const ZStreamW& iStreamSink);
00081         ZStreamW_CRLFRemove(char iReplaceChar, const ZStreamW& iStreamSink);
00082         ~ZStreamW_CRLFRemove();
00083 
00084 // From ZStreamW
00085         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00086         virtual void Imp_Flush();
00087 
00088 protected:
00089         const ZStreamW& fStreamSink;
00090         char fReplaceChar;
00091         bool fLastWasCR;
00092         };
00093 
00094 // =================================================================================================
00095 #pragma mark -
00096 #pragma mark * ZStreamW_CRLFInsert
00097 
00098 class ZStreamW_CRLFInsert : public ZStreamW
00099         {
00100 public:
00101         ZStreamW_CRLFInsert(const ZStreamW& iStreamSink);
00102         ~ZStreamW_CRLFInsert();
00103 
00104 // From ZStreamW
00105         virtual void Imp_Write(const void* iSource, size_t iCount, size_t* oCountWritten);
00106         virtual void Imp_Flush();
00107 
00108 protected:
00109         const ZStreamW& fStreamSink;
00110         bool fLastWasCR;
00111         };
00112 
00113 #endif // __ZStream_CRLF__

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