Public Member Functions | Private Attributes

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 278 of file SString.h.


Constructor & Destructor Documentation

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

Definition at line 237 of file SString.inl.

  :  p_ (p)
{
}

ACE_Auto_String_Free::ACE_Auto_String_Free ( ACE_Auto_String_Free rhs  ) 

Definition at line 243 of file SString.inl.

  :  p_ (rhs.p_)
{
  rhs.p_ = 0;
}

ACE_Auto_String_Free::~ACE_Auto_String_Free ( void   ) 

Definition at line 268 of file SString.inl.

{
  this->reset (0);
}


Member Function Documentation

char * ACE_Auto_String_Free::get ( void   )  const

Definition at line 286 of file SString.inl.

{
  return this->p_;
}

char * ACE_Auto_String_Free::operator* ( void   )  const

Definition at line 274 of file SString.inl.

{
  return this->p_;
}

ACE_Auto_String_Free & ACE_Auto_String_Free::operator= ( ACE_Auto_String_Free rhs  ) 

Definition at line 257 of file SString.inl.

{
  if (this != &rhs)
    {
      this->reset (rhs.p_);
      rhs.p_ = 0;
    }
  return *this;
}

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

Definition at line 280 of file SString.inl.

{
  return this->p_[i];
}

char * ACE_Auto_String_Free::release ( void   ) 

Definition at line 292 of file SString.inl.

{
  char* p = this->p_;
  this->p_ = 0;
  return p;
}

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

Definition at line 250 of file SString.inl.

{
  ACE_OS::free (this->p_);
  this->p_ = p;
}


Member Data Documentation

char* ACE_Auto_String_Free::p_ [private]

Definition at line 293 of file SString.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines