00001 //## begin module%37BB862900F5.cm preserve=no 00002 // %X% %Q% %Z% %W% 00003 //## end module%37BB862900F5.cm 00004 00005 //## begin module%37BB862900F5.cp preserve=no 00006 //## end module%37BB862900F5.cp 00007 00008 //## Module: IfstreamWithComments%37BB862900F5; Pseudo Package body 00009 //## Source file: E:\mpk\code\additional\streams\IfstreamWithComments.cpp 00010 00011 //## begin module%37BB862900F5.additionalIncludes preserve=no 00012 //## end module%37BB862900F5.additionalIncludes 00013 00014 //## begin module%37BB862900F5.includes preserve=yes 00015 #include "mystreams.h" 00016 //## end module%37BB862900F5.includes 00017 00018 // IfstreamWithComments 00019 #include "IfstreamWithComments.h" 00020 #include <stdlib.h> 00021 //## begin module%37BB862900F5.additionalDeclarations preserve=yes 00022 //## end module%37BB862900F5.additionalDeclarations 00023 00024 00025 // Class IfstreamWithComments 00026 00027 IfstreamWithComments::IfstreamWithComments () 00028 //## begin IfstreamWithComments::IfstreamWithComments%935034313.hasinit preserve=no 00029 : commentChar('%') 00030 //## end IfstreamWithComments::IfstreamWithComments%935034313.hasinit 00031 //## begin IfstreamWithComments::IfstreamWithComments%935034313.initialization preserve=yes 00032 //## end IfstreamWithComments::IfstreamWithComments%935034313.initialization 00033 { 00034 //## begin IfstreamWithComments::IfstreamWithComments%935034313.body preserve=yes 00035 //## end IfstreamWithComments::IfstreamWithComments%935034313.body 00036 } 00037 00038 00039 IfstreamWithComments::~IfstreamWithComments() 00040 { 00041 //## begin IfstreamWithComments::~IfstreamWithComments%.body preserve=yes 00042 //## end IfstreamWithComments::~IfstreamWithComments%.body 00043 } 00044 00045 00046 void IfstreamWithComments::open( const char* szName, int nMode) 00047 { 00048 char pathNoDrive[_MAX_PATH]; 00049 char fileExt[_MAX_EXT]; 00050 _splitpath( szName, path, pathNoDrive, filename, fileExt ); 00051 strcat(path, pathNoDrive); 00052 strcat(filename, fileExt); 00053 ifstream::open( szName, nMode); 00054 } 00055 00056 //## Other Operations (implementation) 00057 IfstreamWithComments& IfstreamWithComments::getline (char* s, int streamsize, char delim) 00058 { 00059 //## begin IfstreamWithComments::getline%935034311.body preserve=yes 00060 ifstream::getline( s, streamsize, delim ) ; 00061 00062 while( s[ 0 ] == commentChar ) 00063 { 00064 ifstream::getline( s, streamsize, delim ) ; 00065 } 00066 return *this ; 00067 00068 //## end IfstreamWithComments::getline%935034311.body 00069 } 00070 00071 void IfstreamWithComments::eatwhite () 00072 { 00073 //## begin IfstreamWithComments::eatwhite%935034314.body preserve=yes 00074 ::eatwhite( *this ) ; 00075 00076 char next = peek() ; 00077 while( next == commentChar ) 00078 { 00079 char temp[ 1000 ] = "" ; 00080 ifstream::getline( temp, 1000 ) ; 00081 next = peek() ; 00082 ::eatwhite( *this ) ; 00083 } 00084 //## end IfstreamWithComments::eatwhite%935034314.body 00085 } 00086 00087 IfstreamWithComments& IfstreamWithComments::GetSolidLine (char* s, int streamsize, char delim) 00088 { 00089 //## begin IfstreamWithComments::GetSolidLine%935034316.body preserve=yes 00090 eatwhite(); 00091 getline( s, streamsize, delim ); 00092 return *this ; 00093 //## end IfstreamWithComments::GetSolidLine%935034316.body 00094 } 00095 00096 // Additional Declarations 00097 //## begin IfstreamWithComments%37BB862900F5.declarations preserve=yes 00098 //## end IfstreamWithComments%37BB862900F5.declarations 00099 00100 //## begin module%37BB862900F5.epilog preserve=yes 00101 //## end module%37BB862900F5.epilog