Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Tools/Streams/OutStreams.cpp

Go to the documentation of this file.
00001 /**
00002 * @file OutStreams.cpp
00003 *
00004 * Implementation of out stream classes.
00005 *
00006 * @author Thomas Röfer
00007 * @author Martin Lötzsch
00008 */
00009 
00010 #include "OutStreams.h"
00011 
00012 void OutText::writeString(const char* value, PhysicalOutStream& stream)
00013 {
00014   char c=' ';
00015   stream.writeToStream(&c,1);
00016   for(; *value; ++value)
00017   {
00018     if(*value == ' ')
00019       sprintf(buf,"\\ ");
00020     else if(*value == '\n')
00021       sprintf(buf,"\\\n");
00022     else if(*value == '\r')
00023       sprintf(buf,"\\\r");
00024     else if(*value == '\t')
00025       sprintf(buf,"\\\t");
00026     else if(*value == '\\')
00027       sprintf(buf,"\\\\");
00028     else
00029       sprintf(buf,"%c",*value);
00030 
00031     stream.writeToStream(buf,(int)strlen(buf));
00032   }
00033 }
00034 
00035 void OutText::writeData(const void *p,int size, PhysicalOutStream& stream)
00036 {
00037   for(int i = 0; i < size; ++i)
00038     writeChar(*((const char*&) p)++, stream);
00039 }
00040 
00041 void OutTextRaw::writeString(const char* value, PhysicalOutStream& stream)
00042 {
00043   stream.writeToStream(value,(int)strlen(value));
00044 }
00045 
00046 void OutTextRaw::writeData(const void *p,int size, PhysicalOutStream& stream)
00047 {
00048   for(int i = 0; i < size; ++i)
00049     writeChar(*((const char*&) p)++, stream);
00050 }

Generated on Mon Mar 20 22:00:09 2006 for GT2005 by doxygen 1.3.6