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

MCFheader.h

Go to the documentation of this file.
00001 // MCFheader.h
00002 //////////////////////////////////////////////////////////////////////
00003 //          (c) Copyright 2002 Brown Deer Technology, LLC.        
00004 //                        All rights reserved.              
00005 //////////////////////////////////////////////////////////////////////
00006 
00007 #ifndef MCFHEADER_H
00008 #define MCFHEADER_H
00009 
00010 #ifdef USE_STD
00011 #include <iostream>
00012 #include <string>
00013 using namespace std;
00014 #else
00015 #include <iostream.h>
00016 #include <string.h>
00017 #endif
00018 
00019 #include "BufferBase.h"
00020 
00021 class MCFTPheader;
00022 
00023 class MCFheader
00024 {
00025    public:
00026 
00027       MCFheader();
00028       MCFheader( const MCFTPheader& rhs );
00029       MCFheader( const MCFheader& rhs );
00030 
00031       MCFheader& operator () ();
00032       MCFheader& operator () ( const MCFheader& );
00033       MCFheader& operator () ( const MCFTPheader& );
00034 
00035       MCFheader& copy( const MCFheader& rhs );
00036       MCFheader& copy( const MCFTPheader& rhs );
00037       MCFheader& operator = ( const MCFheader& rhs );
00038       MCFheader& operator = ( const MCFTPheader& rhs );
00039 
00040       bool is_equal( const MCFheader& rhs );
00041       bool operator == ( const MCFheader& rhs );
00042       bool operator != ( const MCFheader& rhs );
00043 
00044       void write( BufferBase& );
00045       MCFheader& operator << ( BufferBase& );
00046       void read( BufferBase& );
00047       MCFheader& operator >> ( BufferBase& );
00048 
00049       void write( istream& );
00050       MCFheader& operator << ( istream& );
00051       void read( ostream& );
00052       MCFheader& operator >> ( ostream& );
00053 
00054       void set_tag( string& tag );
00055       void set_tag( char* tag );
00056       void set_mcfsizeb( int mcfsizeb );
00057       void set_version( int version );
00058       void set_revision( int revision );
00059       void set_release( int release );
00060       void set_author( int author );
00061       void set_descript( string& descript );
00062       void set_descript( char* descript );
00063 
00064       string& tag();
00065       int mcfsizeb();
00066       int version();
00067       int revision();
00068       int release();
00069       int author();
00070       int descriptsize();
00071       string& descript();
00072 
00073       int sizeb();
00074 
00075       void report( ostream& = cout );
00076 
00077    protected:
00078       string _tag;
00079       int _mcfsizeb;
00080       int _version;
00081       int _revision;
00082       int _release;
00083       int _author;
00084       string _descript;
00085 
00086    friend class MCFTPheader;
00087 
00088    friend BufferBase& operator >> ( BufferBase&, MCFheader& );
00089    friend BufferBase& operator << ( BufferBase&, MCFheader& );
00090 
00091    friend istream& operator >> ( istream&, MCFheader& );
00092    friend ostream& operator << ( ostream&, MCFheader& );
00093 
00094 };
00095 
00096 #include "MCFTPheader.h"
00097 
00098 inline
00099 MCFheader::MCFheader()
00100   : _tag("MCF_____"), _mcfsizeb(0), 
00101     _version(0), _revision(2), _release(0),
00102     _author(0), _descript("")
00103 {}
00104 
00105 inline
00106 MCFheader::MCFheader( const MCFTPheader& rhs )
00107   : _tag(rhs._tag), _mcfsizeb(rhs._mcftpsizeb), 
00108     _version(rhs._version), _revision(rhs._revision), _release(rhs._release),
00109     _author(rhs._author), _descript(rhs._descript)
00110 {}
00111 
00112 inline
00113 MCFheader::MCFheader( const MCFheader& rhs )
00114   : _tag(rhs._tag), _mcfsizeb(rhs._mcfsizeb), 
00115     _version(rhs._version), _revision(rhs._revision), _release(rhs._release),
00116     _author(rhs._author), _descript(rhs._descript)
00117 {}
00118 
00119 inline
00120 MCFheader& MCFheader::operator = ( const MCFheader& rhs ) 
00121 { 
00122    return copy(rhs);
00123 }
00124 
00125 inline
00126 MCFheader& MCFheader::operator = ( const MCFTPheader& rhs ) 
00127 { 
00128    return copy(rhs);
00129 }
00130 
00131 inline
00132 bool MCFheader::operator == ( const MCFheader& rhs ) { return is_equal(rhs); }
00133 
00134 inline
00135 bool MCFheader::operator != ( const MCFheader& rhs ) { return !is_equal(rhs); }
00136 
00137 inline
00138 MCFheader& MCFheader::operator << ( BufferBase& buffer )
00139 {
00140    write(buffer);
00141    return *this;
00142 }
00143 
00144 inline
00145 MCFheader& MCFheader::operator >> ( BufferBase& buffer )
00146 {
00147    read(buffer);
00148    return *this;
00149 }
00150 
00151 inline
00152 MCFheader& MCFheader::operator << ( istream& is )
00153 {
00154    write(is);
00155    return *this;
00156 }
00157 
00158 inline
00159 MCFheader& MCFheader::operator >> ( ostream& os )
00160 {
00161    read(os);
00162    return *this;
00163 }
00164 
00165 inline
00166 void MCFheader::set_tag( string& tag ) { _tag = tag; }
00167 
00168 inline
00169 void MCFheader::set_tag( char* tag ) { _tag = tag; }
00170 
00171 inline
00172 void MCFheader::set_mcfsizeb( int mcfsizeb ) { _mcfsizeb = mcfsizeb; }
00173 
00174 inline
00175 void MCFheader::set_version( int version ) { _version = version; }
00176 
00177 inline
00178 void MCFheader::set_revision( int revision ) { _revision = revision; }
00179 
00180 inline
00181 void MCFheader::set_release( int release ) { _release = release; }
00182 
00183 inline
00184 void MCFheader::set_author( int author ) { _author = author; }
00185 
00186 inline
00187 void MCFheader::set_descript( string& descript ) { _descript = descript; }
00188 
00189 inline
00190 void MCFheader::set_descript( char* descript ) { _descript = descript; }
00191 
00192 inline
00193 string& MCFheader::tag() { return _tag; }
00194 
00195 inline
00196 int MCFheader::mcfsizeb() { return _mcfsizeb; }
00197 
00198 inline
00199 int MCFheader::version() { return _version; }
00200 
00201 inline
00202 int MCFheader::revision() { return _revision; }
00203 
00204 inline
00205 int MCFheader::release() { return _release; }
00206 
00207 inline
00208 int MCFheader::author() { return _author; }
00209 
00210 //inline
00211 //int MCFheader::descriptsize() { return _descript.size(); }
00212 
00213 inline
00214 string& MCFheader::descript() { return _descript; }
00215 
00216 inline
00217 int MCFheader::sizeb() { return 17 + _descript.size(); }
00218 
00219 #endif
00220 

Generated on Mon May 31 21:38:49 2004 for SR2k4 Assembler by doxygen 1.3.6