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

C:/temp/src/j2k/Deprecated/old_18mar_diff/Str14dec/StrBuild.cpp

Go to the documentation of this file.
00001 #ifndef __J2K__JString_Build_CPP__
00002 #define __J2K__JString_Build_CPP__
00003 
00004 #include <j2k/Fred/String/String.hpp>
00005 
00006 ////////////////////////////////////////////////////////////////////////////
00007 /// Constructor, Copy Constructor and Destructor                         ///
00008 ////////////////////////////////////////////////////////////////////////////
00009 
00010 JString::JString() 
00011   : pData( strNull ) { }
00012 
00013 JString::JString( JStringData* sd )
00014   : pData( sd ) 
00015 { 
00016   if ( sd == NULL ) {
00017     pData = strNull;
00018   }
00019 }
00020 
00021 JString::JString( const char* s ) 
00022 {
00023   if ( s != NULL  &&  *s != NULL ) {
00024     pData = new JStringData( s );
00025   } else {
00026     pData = strNull;
00027   }
00028 }
00029 
00030 // Deprecated due to NULL problems
00031 #if 0
00032 // Why not doing it in a single shot, since it's possible ! =)
00033 /*
00034 JString::JString( ULONG nBuffer ) {
00035   if ( nBuffer < 1 ) {
00036     pData = strNull; 
00037   } else {
00038     pData = new JStringData( nBuffer );
00039   }
00040 }
00041 */
00042 #endif
00043 
00044 JString::JString( const char* s, ULONG nBuffer )
00045 {
00046   if ( nBuffer < 1 ) {
00047     pData = strNull; 
00048   } else {
00049     pData = new JStringData( s, nBuffer );
00050   }
00051 }
00052 
00053 JString::JString( char ch )
00054   : pData( new JStringData( ch, 1 ) ) { }
00055 
00056 JString::JString( char ch, ULONG nRepeat )
00057   : pData( new JStringData( ch, nRepeat ) ) { }
00058 
00059 // There should be no copy done, the optimize way for that one,
00060 // unless it's lock or something like that...
00061 JString::JString( const JString& src )
00062   : pData( src.pData )
00063 {
00064   pData->Inc();
00065 }
00066 
00067 // Free any attached data
00068 JString::~JString() {
00069 
00070 #ifdef __J2K__DEBUG
00071   printf("\nDelete JString[%s]\n", pData->data );
00072 #endif
00073 
00074   pData->Dec();
00075 }
00076 
00077 #endif

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