Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

MCFlogifstream Class Reference

#include <MCFlogifstream.h>

Collaboration diagram for MCFlogifstream:

Collaboration graph
[legend]

Public Member Functions

int getarg (const int narg, const string line, string arg)
 MCFlogifstream (const string filenamebase)
int nextMCF (string line)
int nextUSR (string line)
void resetMCF ()
void resetUSR ()
 ~MCFlogifstream ()

Private Attributes

string _filenamelog
int _filenotfound
ifstream * _ifs
int _mcfeof
int _mcffilepos
int _usreof
int _usrfilepos

Constructor & Destructor Documentation

MCFlogifstream::MCFlogifstream const string  filenamebase  ) 
 

Definition at line 26 of file MCFlogifstream.cpp.

References mcflogfilename().

00027   : _mcffilepos(0), _mcfeof(0), _usrfilepos(0), _usreof(0)
00028 { 
00029    mcflogfilename( filenamebase, _filenamelog );
00030    _ifs = new ifstream( _filenamelog.c_str() );
00031    (*_ifs).good() ? _filenotfound = 0 : _filenotfound = 1;
00032 };

MCFlogifstream::~MCFlogifstream  ) 
 

Definition at line 34 of file MCFlogifstream.cpp.

00035 { 
00036    delete _ifs;
00037 };


Member Function Documentation

int MCFlogifstream::getarg const int  narg,
const string  line,
string  arg
 

Definition at line 115 of file MCFlogifstream.cpp.

References j.

00116 {
00117    int i = 0;
00118    int found = 0;
00119    int eol = 0;
00120    int iarg = 0;
00121 
00122    int j;
00123    char c;
00124 
00125    while ( found==0 && eol==0 ) {
00126       c = ' '; 
00127 
00128       while ( c == ' ' ) { c = line[i++]; }
00129 
00130       arg="";
00131       while ( ( c != ' ' ) && ( i < (int)line.size() ) ) { 
00132          arg += c;
00133          c = line[i++]; 
00134       }
00135 
00136       if ( i == (int)line.size() ) eol = 1;
00137       if ( (++iarg) == narg ) found = 1;
00138    }
00139 
00140    if ( found == 0 ) arg = "";
00141 
00142    return !found;
00143 
00144 };

int MCFlogifstream::nextMCF string  line  ) 
 

Definition at line 39 of file MCFlogifstream.cpp.

References _mcfeof, and _mcffilepos.

00040 {
00041    if ( ( _filenotfound == 1 ) || ( _mcfeof == 1 ) ) return 1;
00042 
00043    string tmpbuf="";
00044 
00045    int found = 0;
00046    (*_ifs).seekg( _mcffilepos, ios::beg );
00047   
00048    int i; 
00049    char c;
00050 
00051    while ( ( found == 0 ) && ( _mcfeof == 0 ) ) {
00052       c=' '; 
00053       i=0;
00054       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00055       while ( ( c != ' ' ) && ( c != 10 ) && (*_ifs).good() ) { 
00056          tmpbuf += c; 
00057          (*_ifs).get(c); 
00058       }
00059       if ( (*_ifs).eof() ) _mcfeof = 1;
00060       if ( tmpbuf == "MCF" ) found = 1;
00061          c=' '; 
00062          i=0;
00063          while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00064          while ( ( c != 10 ) && (*_ifs).good() ) { 
00065             tmpbuf += c; 
00066             (*_ifs).get(c); 
00067          }
00068    }
00069 
00070    if ( (*_ifs).eof() ) _mcfeof=1;
00071    line = tmpbuf;
00072    _mcffilepos = (*_ifs).tellg();
00073    (*_ifs).clear();
00074    return _mcfeof;
00075 };

int MCFlogifstream::nextUSR string  line  ) 
 

Definition at line 77 of file MCFlogifstream.cpp.

00078 {
00079    if ( ( _filenotfound == 1 ) || ( _usreof == 1 ) ) return 1;
00080    string tmpbuf="";
00081    int found=0;
00082    (*_ifs).seekg( _usrfilepos, ios::beg );
00083 
00084    int i;
00085    char c;
00086 
00087    while ( ( found == 0 ) && ( _usreof == 0 ) ) {
00088       c=' '; 
00089       i=0;
00090       tmpbuf = "";
00091       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00092       while ( ( c != ' ' ) && ( c != 10 ) && (*_ifs).good() ) { 
00093          tmpbuf += c; 
00094          (*_ifs).get(c); 
00095       }
00096       if ( (*_ifs).eof() ) _usreof = 1;
00097       c = ' '; 
00098       i = 0;
00099       while ( ( c == ' ' ) && (*_ifs).good() ) { (*_ifs).get(c); }
00100       while ( ( c != 10 ) && (*_ifs).good() ) { 
00101          tmpbuf += c; 
00102          (*_ifs).get(c); 
00103       }
00104       cout << tmpbuf << found << endl;
00105    }
00106    cout << tmpbuf << found << endl;
00107 
00108    if ( (*_ifs).eof() ) _usreof = 1;
00109    line = tmpbuf;
00110    _usrfilepos = (*_ifs).tellg();
00111    (*_ifs).clear();
00112    return _usreof;
00113 };

void MCFlogifstream::resetMCF  ) 
 

Definition at line 39 of file MCFlogifstream.h.

References _mcfeof, and _mcffilepos.

00040 { 
00041    _mcfeof = 0;
00042    _mcffilepos = 0;
00043 }

void MCFlogifstream::resetUSR  ) 
 

Definition at line 46 of file MCFlogifstream.h.

00047 {
00048    _usreof = 0;
00049    _usrfilepos = 0;
00050 }


Field Documentation

string MCFlogifstream._filenamelog [private]
 

Definition at line 29 of file MCFlogifstream.h.

int MCFlogifstream._filenotfound [private]
 

Definition at line 31 of file MCFlogifstream.h.

ifstream* MCFlogifstream._ifs [private]
 

Definition at line 30 of file MCFlogifstream.h.

int MCFlogifstream._mcfeof [private]
 

Definition at line 32 of file MCFlogifstream.h.

Referenced by nextMCF(), and resetMCF().

int MCFlogifstream._mcffilepos [private]
 

Definition at line 33 of file MCFlogifstream.h.

Referenced by nextMCF(), and resetMCF().

int MCFlogifstream._usreof [private]
 

Definition at line 34 of file MCFlogifstream.h.

int MCFlogifstream._usrfilepos [private]
 

Definition at line 35 of file MCFlogifstream.h.


The documentation for this class was generated from the following files:
Generated on Mon May 31 21:41:10 2004 for SR2k4 Assembler by doxygen 1.3.6