Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

DBase Class Reference

#include <DBase.hpp>

List of all members.

Public Methods

 DBase ()
 DBase (const char *cmd)
 DBase (const char *id, const char *name, const char *tel)
 DBase (JString &id, JString &name, JString &tel)
 DBase (DBase &db)
DBase & operator= (DBase &db)
const bool operator== (DBase &db)
const bool operator!= (DBase &db)
const bool operator< (DBase &db)
const bool operator> (DBase &db)
const bool CompareID (DBase &db)
const char * string () const
const bool valid () const
void DBase::display () const
 DBase ()
 DBase (int pos)
 DBase (DBase &db)
DBase & operator= (DBase &db)
virtual ~DBase ()
const bool operator== (DBase &db)
const bool operator!= (DBase &db)
const char * string () const
void DBase::display () const
int pos () const
int valid () const

Public Attributes

JString_id
JString_name
JString_tel

Private Attributes

int _pos

Friends

ostream & operator<< (ostream &os, DBase &db)
ostream & operator<< (ostream &os, DBase &db)


Constructor & Destructor Documentation

DBase::DBase  
 

Definition at line 5 of file DBase.cpp.

00005              {                      // Default constructor
00006  _id   = new String();
00007  _name = new String();
00008  _tel  = new String();
00009 }

DBase::DBase const char *    cmd
 

Definition at line 18 of file DBase.cpp.

00019 {
00020  _id   = new String( cmd,  3,  6 );
00021  _name = new String( cmd, 13, 17 );
00022 
00023  if ( _name->parseInt()  > 0 ) {      // If it's a 2 parameters command
00024    _tel  = _name;                     // with a phone number only.
00025    _name = new String( 17, ' ' );
00026 
00027  } else {
00028    _tel  = new String( cmd, 32,  7 );
00029  }
00030 
00031    int l = _name->length();
00032    l -= 17;
00033 
00034 
00035    if ( l < 0 ) {       // Fill the rest of name with space
00036       int m = (-1 * l) + 2;
00037       _name->addChar( m, ' ');
00038    }
00039 }

DBase::DBase const char *    id,
const char *    name,
const char *    tel
 

Definition at line 41 of file DBase.cpp.

00042 {
00043   _id   = new String( id   );
00044   _name = new String( name );
00045   _tel  = new String( tel  );
00046 }

DBase::DBase JString   id,
JString   name,
JString   tel
 

Definition at line 49 of file DBase.cpp.

00049                                                   {
00050  _id   = new String( id   );
00051  _name = new String( name );
00052  _tel  = new String( tel  );
00053 }

DBase::DBase DBase &    db
 

Definition at line 11 of file DBase.cpp.

00012 {
00013  _id   = new String( *db._id   );
00014  _name = new String( *db._name );
00015  _tel  = new String( *db._tel  );
00016 }

DBase::DBase  
 

DBase::DBase int    pos
 

Definition at line 9 of file DBase.cpp.

00010 {
00011    if ( pos >= 0 ) {
00012       _pos = pos;
00013    } else {
00014       _pos = 0;
00015    }
00016 }

DBase::DBase DBase &    db
 

virtual DBase::~DBase   [inline, virtual]
 

Definition at line 19 of file DBase.hpp.

00019 { };


Member Function Documentation

const bool DBase::CompareID DBase &    db
 

Definition at line 106 of file DBase.cpp.

00106                                        {
00107   return _id->compare( *db._id ) > 0;
00108 }

void DBase::DBase::display   const [inline]
 

Definition at line 27 of file DBase.hpp.

00028 {                                       // on the Screen.
00029       cout << string() << endl;
00030 }

void DBase::DBase::display   const [inline]
 

Definition at line 35 of file DBase.hpp.

00035                                  {
00036   cout << string() << endl;
00037 }

const bool DBase::operator!= DBase &    db
 

const bool DBase::operator!= DBase &    db
 

Definition at line 93 of file DBase.cpp.

00094 {
00095   return ( *_id != *db._id ) || ( *_name != *db._name ) || ( *_tel != *db._tel );
00096 }

const bool DBase::operator< DBase &    db
 

Definition at line 98 of file DBase.cpp.

00098                                        {
00099   return ( *_id < *db._id );
00100 }

DBase& DBase::operator= DBase &    db
 

DBase & DBase::operator= DBase &    db
 

Definition at line 64 of file DBase.cpp.

00064                                    {
00065   if ( &db != this )  {
00066     _id   = db._id;
00067     _name = db._name;
00068     _tel  = db._tel;
00069   }
00070   return *this;
00071 }

const bool DBase::operator== DBase &    db
 

const bool DBase::operator== DBase &    db
 

Definition at line 87 of file DBase.cpp.

00088 {
00089   return ( *_id == *db._id ) && ( *_name == *db._name ) && ( *_tel == *db._tel );
00090 }

const bool DBase::operator> DBase &    db
 

Definition at line 102 of file DBase.cpp.

00102                                        {
00103   return ( *_id > *db._id );
00104 }

int DBase::pos   const [inline]
 

Definition at line 36 of file DBase.hpp.

Referenced by Parenth::read().

00036                           {
00037    return _pos;
00038 }

const char* DBase::string   const
 

const char * DBase::string   const
 

Definition at line 73 of file DBase.cpp.

Referenced by DBase::display(), operator<<(), and BinNode::operator<<().

00073                                 {    // return a char* result
00074 
00075   String* result = new String();      // Give a formatted output
00076 
00077   result->add("  ");
00078   result->add( _id->string() );
00079   result->add("   ");
00080   result->add( _name->string() );
00081   result->add("  ");
00082   result->add( _tel->string()  );
00083   result->add("  ");
00084   return result->string();
00085 }

int DBase::valid   const [inline]
 

Definition at line 40 of file DBase.hpp.

00040                           {
00041    return ( _pos >= 0 );
00042 }

const bool DBase::valid   const
 

Definition at line 110 of file DBase.cpp.

00110                                {
00111   if ( this == NULL ) {
00112      return FALSE;
00113   } else {
00114      return ( _id != NULL ) && ( _name != NULL ) && ( _tel != NULL );
00115   }
00116 }


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
DBase &    db
[friend]
 

Definition at line 32 of file DBase.hpp.

00032                                                           { 
00033    return os << db.string(); 
00034 }

ostream& operator<< ostream &    os,
DBase &    db
[friend]
 

Definition at line 39 of file DBase.hpp.

00039                                                           { 
00040    return os << db.string() << endl;
00041 }


Member Data Documentation

JString* DBase::_id
 

Definition at line 50 of file DBase.hpp.

Referenced by CompareID(), DataBase::findID(), operator!=(), operator<(), operator=(), operator==(), and operator>().

JString* DBase::_name
 

Definition at line 51 of file DBase.hpp.

Referenced by operator!=(), operator=(), operator==(), and DataBase::read().

int DBase::_pos [private]
 

Definition at line 46 of file DBase.hpp.

JString* DBase::_tel
 

Definition at line 52 of file DBase.hpp.

Referenced by operator!=(), operator=(), operator==(), and DataBase::read().


The documentation for this class was generated from the following files:
Generated on Sun Oct 14 18:48:31 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001