00001 #ifndef __LINEENDCONVERTOR_H 00002 #define __LINEENDCONVERTOR_H 00003 00004 #include "StreamDecorator.h" 00005 00006 #include "LineEndConvention.h" 00007 00008 namespace Core { 00009 00010 class Character; 00011 00012 class LineEndConvertor : public Core::StreamDecorator 00013 { 00014 protected: 00015 Character *line_end_character; 00016 LineEndConvention line_end_convention; 00017 00018 public: 00019 LineEndConvertor(LineEndConvention convention, Stream *stream); 00020 00021 /* Instance creation protocol */ 00022 static LineEndConvertor *lineEndCROn(Stream *stream); 00023 static LineEndConvertor *lineEndLFOn(Stream *stream); 00024 static LineEndConvertor *lineEndCRLFOn(Stream *stream); 00025 00026 /* Accessing protocol */ 00027 virtual Object *next(void); 00028 virtual SequenceableCollection *next(long items) 00029 { return StreamDecorator::next(items); } 00030 virtual SequenceableCollection *next(long items, SequenceableCollection *newColl, long index) 00031 { return StreamDecorator::next(items, newColl, index); } 00032 virtual void nextPut(Object *object); 00033 virtual void nextPut(const char object) 00034 { StreamDecorator::nextPut(object); } 00035 00036 /* Testing protocol */ 00037 virtual bool isBinary(void); 00038 00039 /* Private protocol */ 00040 virtual void setLineEndCharacter(void); 00041 00042 protected: 00043 virtual SequenceableCollection *contentSpeciesFor(long items); 00044 }; 00045 00046 }; 00047 00048 #endif /* __LINEENDCONVERTOR_H */