Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

Prefix.C

00001 #include <citrus/config.h>
00002 
00003 #include <citrus/Prefix.H>
00004 #include <citrus/Unit.H>
00005 
00028 Prefix* thePrefixes = 0 ;
00029 
00031 Prefix::Prefix( const char* name, const char* abbr, int exp )
00032 {
00033   m_name = new char[strlen(name)+1] ;
00034   strcpy( m_name, name ) ;
00035 
00036   m_abbr = new char[strlen(abbr)+1] ;
00037   strcpy( m_abbr, abbr ) ;
00038 
00039   m_exp = exp ;
00040   // now for the default settings
00041   m_avoid       = false ;
00042 
00043   if ( thePrefixes)
00044     m_next = thePrefixes ;
00045   else
00046     m_next = 0 ;
00047 
00048   thePrefixes = this ;
00049 }
00050 
00052 Prefix::~Prefix()
00053 {
00054   if (m_name)
00055     delete [] m_name ;
00056 
00057   if (m_abbr)
00058     delete [] m_abbr ;
00059 
00060   if ( thePrefixes == this ) {
00061     thePrefixes = m_next ;
00062   } else {
00063     Prefix*     tmp = thePrefixes ;
00064     while ( tmp && tmp->m_next != this )
00065       tmp = tmp->m_next ;
00066     tmp->m_next = m_next ;
00067   }
00068 }
00069 
Citrus C++ Reference Manual  20010520