Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Auto_String_Free Class Reference

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

#include <SString.h>

List of all members.

Public Methods

ACE_EXPLICIT ACE_Auto_String_Free (char *p=0)
 ACE_Auto_String_Free (ACE_Auto_String_Free &rhs)
ACE_Auto_String_Free & operator= (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 461 of file SString.h.


Constructor & Destructor Documentation

ACE_INLINE ACE_Auto_String_Free::ACE_Auto_String_Free char *    p = 0
 

Definition at line 223 of file SString.i.

00224   :  p_ (p)
00225 {
00226 }

ACE_INLINE ACE_Auto_String_Free::ACE_Auto_String_Free ACE_Auto_String_Free &    rhs
 

Definition at line 229 of file SString.i.

00230   :  p_ (rhs.p_)
00231 {
00232   rhs.p_ = 0;
00233 }

ACE_INLINE ACE_Auto_String_Free::~ACE_Auto_String_Free void   
 

Definition at line 255 of file SString.i.

References reset.

00256 {
00257   this->reset (0);
00258 }


Member Function Documentation

ACE_INLINE char * ACE_Auto_String_Free::get void    const
 

Definition at line 273 of file SString.i.

References p_.

00274 {
00275   return this->p_;
00276 }

ACE_INLINE char * ACE_Auto_String_Free::operator *   const
 

Definition at line 261 of file SString.i.

References p_.

00262 {
00263   return this->p_;
00264 }

ACE_INLINE ACE_Auto_String_Free & ACE_Auto_String_Free::operator= ACE_Auto_String_Free &    rhs
 

Definition at line 244 of file SString.i.

References p_, and reset.

00245 {
00246   if (this != &rhs)
00247     {
00248       this->reset (rhs.p_);
00249       rhs.p_ = 0;
00250     }
00251   return *this;
00252 }

ACE_INLINE char ACE_Auto_String_Free::operator[] int    i const
 

Definition at line 267 of file SString.i.

References p_.

00268 {
00269   return this->p_[i];
00270 }

ACE_INLINE char * ACE_Auto_String_Free::release void   
 

Definition at line 279 of file SString.i.

References p_.

00280 {
00281   char* p = this->p_;
00282   this->p_ = 0;
00283   return p;
00284 }

ACE_INLINE void ACE_Auto_String_Free::reset char *    p = 0
 

Definition at line 236 of file SString.i.

References ACE_OS_Memory::free, and p_.

Referenced by operator=, and ~ACE_Auto_String_Free.

00237 {
00238   if (this->p_ != 0)
00239     ACE_OS::free (this->p_);
00240   this->p_ = p;
00241 }


Member Data Documentation

char* ACE_Auto_String_Free::p_ [private]
 

Definition at line 476 of file SString.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:46:02 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002