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

C:/temp/src/j2k/DataType/Parenth.Frd/DBase.cpp

Go to the documentation of this file.
00001 // DBase.cpp - DBase Class Implementation
00002 
00003 #include "DBase.hpp"
00004 
00005 DBase::DBase() {                 // Default constructor
00006    _pos = 0;
00007 }
00008 
00009 DBase::DBase( int pos )             // Primary Constructor
00010 {
00011    if ( pos >= 0 ) {
00012       _pos = pos;
00013    } else {
00014       _pos = 0;
00015    }
00016 }
00017 
00018 DBase::DBase( DBase& db )               // Copy Constructor
00019 {
00020    _pos = db._pos;
00021 }
00022 
00023 // N.B. Safety Net Feature:
00024 // ========================
00025 // If we simply copy the DataStructure without testing,
00026 // we won't be able to write code such as:  db = db;
00027 // because we would loose the data before we copy it in the new one !
00028 // For sure, we don't explicitly write this kind of code
00029 // but some compiler are really enough stupid to do so ! =(
00030 
00031 DBase&  DBase::operator= (DBase& db)
00032 {
00033    if ( &db != this )  {
00034       _pos  = db._pos;
00035    }
00036 
00037    return *this;
00038 }
00039 
00040 const char* DBase::string() const      // return a char* result
00041 {
00042     char* temp = new char[ ( _pos / 10 ) + 2 ];
00043    sprintf( temp, "%d", _pos );
00044    return temp;
00045 }
00046 
00047 const bool  DBase::operator== ( DBase& db )
00048 {
00049   return ( _pos == db._pos );
00050 }
00051 
00052 // strcmp return True if Different !
00053 const bool  DBase::operator!= ( DBase& db )
00054 {
00055   return ( _pos != db._pos );
00056 }

Generated on Sun Oct 14 18:46:17 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001