00001 /* 00002 * ExternalReadAppendStream.cc 00003 * 00004 * Smalltalk like class library for C++ 00005 * External read and append stream. 00006 * 00007 * Copyright (c) 2003 Milan Cermak 00008 */ 00009 /* 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 #include <stlib/ExternalReadAppendStream.h> 00025 #include <stlib/ExternalWriteStream.h> 00026 #include <stlib/LineEndConvention.h> 00027 #include <stlib/String.h> 00028 00029 ExternalReadAppendStream::ExternalReadAppendStream(IOAccessor *accessor) 00030 : ExternalReadStream(accessor) 00031 { 00032 writeStream = new ExternalWriteStream(accessor); 00033 } 00034 00035 /* Class-accessing protocol */ 00036 String *ExternalReadAppendStream::className(void) const 00037 { 00038 return new String("ExternalReadAppendStream"); 00039 } 00040 00041 /* Accessing protocol */ 00042 void ExternalReadAppendStream::commit(void) 00043 { 00044 writeStream->commit(); 00045 } 00046 00047 void ExternalReadAppendStream::flush(void) 00048 { 00049 writeStream->flush(); 00050 } 00051 00052 void ExternalReadAppendStream::nextPut(Object *object) 00053 { 00054 writeStream->nextPut(object); 00055 } 00056 00057 void ExternalReadAppendStream::nextPut(const char object) 00058 { 00059 writeStream->nextPut(object); 00060 } 00061 00062 void ExternalReadAppendStream::nextPutAll(const Collection *collection) 00063 { 00064 writeStream->nextPutAll(collection); 00065 } 00066 00067 void ExternalReadAppendStream::nextPutAll(const char *string) 00068 { 00069 writeStream->nextPutAll(string); 00070 } 00071 00072 void ExternalReadAppendStream::nextPutAll(const SequenceableCollection *collection, 00073 long size, long startIndex) 00074 { 00075 writeStream->nextPutAll(collection, size, startIndex); 00076 } 00077 00078 /* Positioning protocol */ 00079 void ExternalReadAppendStream::position(long position) 00080 { 00081 flush(); 00082 ExternalReadStream::position(position); 00083 } 00084 00085 long ExternalReadAppendStream::writePosition(void) 00086 { 00087 writeStream->writePosition(); 00088 } 00089 00090 /* Status protocol */ 00091 void ExternalReadAppendStream::close(void) 00092 { 00093 writeStream->close(); 00094 ExternalReadStream::close(); 00095 } 00096 00097 /* Testing protocol */ 00098 bool ExternalReadAppendStream::isWritable(void) 00099 { 00100 return true; 00101 }