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[] (size_t 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 474 of file SString.h.


Constructor & Destructor Documentation

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

Definition at line 237 of file SString.inl.

00238   :  p_ (p)
00239 {
00240 }

ACE_INLINE ACE_Auto_String_Free::ACE_Auto_String_Free ( ACE_Auto_String_Free rhs  ) 

Definition at line 243 of file SString.inl.

References p_.

00244   :  p_ (rhs.p_)
00245 {
00246   rhs.p_ = 0;
00247 }

ACE_INLINE ACE_Auto_String_Free::~ACE_Auto_String_Free ( void   ) 

Definition at line 268 of file SString.inl.

References reset().

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


Member Function Documentation

ACE_INLINE char * ACE_Auto_String_Free::get ( void   )  const

Definition at line 286 of file SString.inl.

References p_.

00287 {
00288   return this->p_;
00289 }

ACE_INLINE char * ACE_Auto_String_Free::operator * (  )  const

Definition at line 274 of file SString.inl.

References p_.

00275 {
00276   return this->p_;
00277 }

ACE_INLINE ACE_Auto_String_Free & ACE_Auto_String_Free::operator= ( ACE_Auto_String_Free rhs  ) 

Definition at line 257 of file SString.inl.

References p_, and reset().

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

ACE_INLINE char ACE_Auto_String_Free::operator[] ( size_t  i  )  const

Definition at line 280 of file SString.inl.

References p_.

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

ACE_INLINE char * ACE_Auto_String_Free::release ( void   ) 

Definition at line 292 of file SString.inl.

References p_.

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

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

Definition at line 250 of file SString.inl.

References ACE_OS::free(), and p_.

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

00251 {
00252   ACE_OS::free (this->p_);
00253   this->p_ = p;
00254 }


Member Data Documentation

char* ACE_Auto_String_Free::p_ [private]

Definition at line 489 of file SString.h.

Referenced by ACE_Auto_String_Free(), get(), operator *(), operator=(), operator[](), release(), and reset().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:34:56 2010 for ACE by  doxygen 1.4.7