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/String/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 JString::JString( const char* s ) 
00017 {
00018   if ( s != NULL  &&  *s != NULL ) {
00019     pData = new JStringData( s );
00020   } else {
00021     pData = &strNull;
00022   }
00023 }
00024 
00025 // Deprecated due to NULL problems
00026 #if 0
00027 // Why not doing it in a single shot, since it's possible ! =)
00028 /*
00029 JString::JString( size_t nBuffer ) {
00030   if ( nBuffer < 1 ) {
00031     pData = &strNull; 
00032   } else {
00033     pData = new JStringData( nBuffer );
00034   }
00035 }
00036 */
00037 #endif
00038 
00039 JString::JString( const char* s, size_t nBuffer )
00040   : pData( new JStringData( s, nBuffer ) ) { }
00041 
00042 JString::JString( char ch )
00043   : pData( new JStringData( ch, 1 ) ) { }
00044 
00045 JString::JString( char ch, size_t nRepeat )
00046   : pData( new JStringData( ch, nRepeat ) ) { }
00047 
00048 // There should be no copy done, the optimize way for that one,
00049 // unless it's lock or something like that...
00050 JString::JString( const JString& src )
00051   : pData( src.pData )
00052 {
00053   pData->Inc();
00054 }
00055 
00056 // Free any attached data
00057 JString::~JString() {
00058 
00059 #ifdef __J2K__DEBUG
00060   printf("\nDelete JString[%s]\n", pData->data );
00061 #endif
00062 
00063   pData->Dec();
00064 }
00065 
00066 #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