ACE_Auto_String_Free Class Reference

Simple class to automatically de-allocate strings. More...

#include <SString.h>

List of all members.

Public Member Functions

 ACE_Auto_String_Free (char *p=0)
 ACE_Auto_String_Free (ACE_Auto_String_Free &rhs)
ACE_Auto_String_Freeoperator= (ACE_Auto_String_Free &rhs)
 ~ACE_Auto_String_Free (void)
char * operator * () const
char operator[] (int i) const
char * get (void) const
char * release (void)
void reset (char *p=0)

Private Attributes

char * p_


Detailed Description

Simple class to automatically de-allocate strings.

Keeps a pointer to a string and deallocates it (using <ACE_OS::free>) on its destructor. If you need to delete using "delete[]" the ACE_Auto_Array_Ptr<char> is your choice. The class plays the same role as auto_ptr<>

Definition at line 468 of file SString.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_Auto_String_Free::ACE_Auto_String_Free char *  p = 0  )  [explicit]
 

Definition at line 235 of file SString.inl.

00236   :  p_ (p)
00237 {
00238 }

ACE_INLINE ACE_Auto_String_Free::ACE_Auto_String_Free ACE_Auto_String_Free rhs  ) 
 

Definition at line 241 of file SString.inl.

References p_.

00242   :  p_ (rhs.p_)
00243 {
00244   rhs.p_ = 0;
00245 }

ACE_INLINE ACE_Auto_String_Free::~ACE_Auto_String_Free void   ) 
 

Definition at line 267 of file SString.inl.

References reset().

00268 {
00269   this->reset (0);
00270 }


Member Function Documentation

ACE_INLINE char * ACE_Auto_String_Free::get void   )  const
 

Definition at line 285 of file SString.inl.

00286 {
00287   return this->p_;
00288 }

ACE_INLINE char * ACE_Auto_String_Free::operator *  )  const
 

Definition at line 273 of file SString.inl.

00274 {
00275   return this->p_;
00276 }

ACE_INLINE ACE_Auto_String_Free & ACE_Auto_String_Free::operator= ACE_Auto_String_Free rhs  ) 
 

Definition at line 256 of file SString.inl.

References p_, and reset().

00257 {
00258   if (this != &rhs)
00259     {
00260       this->reset (rhs.p_);
00261       rhs.p_ = 0;
00262     }
00263   return *this;
00264 }

ACE_INLINE char ACE_Auto_String_Free::operator[] int  i  )  const
 

Definition at line 279 of file SString.inl.

00280 {
00281   return this->p_[i];
00282 }

ACE_INLINE char * ACE_Auto_String_Free::release void   ) 
 

Definition at line 291 of file SString.inl.

00292 {
00293   char* p = this->p_;
00294   this->p_ = 0;
00295   return p;
00296 }

ACE_INLINE void ACE_Auto_String_Free::reset char *  p = 0  ) 
 

Definition at line 248 of file SString.inl.

References ACE_OS::free().

Referenced by operator=(), and ~ACE_Auto_String_Free().

00249 {
00250   if (this->p_ != 0)
00251     ACE_OS::free (this->p_);
00252   this->p_ = p;
00253 }


Member Data Documentation

char* ACE_Auto_String_Free::p_ [private]
 

Definition at line 483 of file SString.h.

Referenced by ACE_Auto_String_Free(), and operator=().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:20:15 2006 for ACE by doxygen 1.3.6