Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

mondocrd.cpp

Go to the documentation of this file.
00001 //**********************************************************************
00002 //                                                                     *
00003 //    Filename:      mondocrd.cpp                                      *
00004 //    Date:          16 Feb 2002                                       *
00005 //    File Version:  1                                                 *
00006 //                                                                     *
00007 //    Author:        Chris White (whitecf@bcs.org.uk)                  *
00008 //    Company:       Monitor Computing Services Ltd.                   *
00009 //                                                                     *
00010 //**********************************************************************
00011 //                                                                     *
00012 //    Copyright (C) 2002  Monitor Computing Services Ltd.              *
00013 //                                                                     *
00014 //    This program is free software; you can redistribute it and/or    *
00015 //    modify it under the terms of the GNU General Public License      *
00016 //    as published by the Free Software Foundation; either version 2   *
00017 //    of the License, or any later version.                            *
00018 //                                                                     *
00019 //    This program is distributed in the hope that it will be useful,  *
00020 //    but WITHOUT ANY WARRANTY; without even the implied warranty of   *
00021 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
00022 //    GNU General Public License for more details.                     *
00023 //                                                                     *
00024 //    You should have received a copy of the GNU General Public        *
00025 //    License (http://www.gnu.org/copyleft/gpl.html) along with this   *
00026 //    program; if not, write to:                                       *
00027 //       The Free Software Foundation Inc.,                            *
00028 //       59 Temple Place - Suite 330,                                  *
00029 //       Boston, MA  02111-1307,                                       *
00030 //       USA.                                                          *
00031 //                                                                     *
00032 //**********************************************************************
00033 //                                                                     *
00034 //    Notes:                                                           *
00035 //                                                                     *
00036 //**********************************************************************
00037 
00038 #include  <ctype.h>
00039 #include  <fstream.h>
00040 
00041 
00042 #include "mondocrd.h"
00043 
00044 
00045 MonDocReader::MonDocReader(
00046   ifstream            *newSource,
00047   class MonDocWriter  *newWriter,
00048   void                *newTraceObj,
00049   void                (*newTraceFunc)(void*, const char*)) :
00050   source(newSource), writer(newWriter), traceObj(newTraceObj),
00051   traceFunc(newTraceFunc)
00052 {;}
00053 
00054 
00055 int
00056 MonDocReader::convertInteger()
00057 {
00058   int  outputInt = 0;
00059 
00060   while(isdigit(source->peek()))
00061   {
00062      outputInt *= 10;
00063      outputInt += (0x0F & source->get());
00064   }
00065 
00066   return outputInt;
00067 }
00068 
00069 
00070 void
00071 MonDocReader::traceAdd(char  newChar)
00072 {
00073   if (0 != traceObj)
00074   {
00075      static char  traceText[] = {'\0', '\0'};
00076 
00077      *traceText  =  newChar;
00078      traceString += traceText;
00079   }
00080 }
00081 
00082 
00083 void
00084 MonDocReader::traceAdd(int  newChar)
00085 {
00086   if (0 != traceObj)
00087   {
00088      static  char  traceText[] = {'\0', '\0'};
00089 
00090      traceString += " ";
00091      *traceText = ((newChar >> 4) & 0xF) | 0x30;
00092      if ('9' < *traceText)
00093      {
00094         *traceText += 7;
00095      }
00096      traceString += traceText;
00097 
00098      *traceText = (newChar & 0xF) | 0x30;
00099      if ('9' < *traceText)
00100      {
00101         *traceText += 7;
00102      }
00103      traceString += traceText;
00104      traceString += " ";
00105   }
00106 }
00107 
00108 
00109 void
00110 MonDocReader::traceWrite()
00111 {
00112   if ((0 != traceObj) && (0 != traceFunc))
00113   {
00114      traceString += "\r\n";
00115      traceFunc(traceObj, traceString.c_str());
00116      traceString.resize(0);
00117   }
00118 }
00119 
00120 void
00121 MonDocReader::traceWrite(char  *traceText)
00122 {
00123   if ((0 != traceObj) && (0 != traceFunc))
00124   {
00125      traceString += "\r\n";
00126      traceFunc(traceObj, traceString.c_str());
00127      traceFunc(traceObj, traceText);
00128      traceFunc(traceObj, "\r\n");
00129      traceString.resize(0);
00130   }
00131 }

Generated on Sun Jul 20 02:35:50 2003 for WordWise to RTF, Win32 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002