rebecca::impl::StringPimpl Class Reference

A String Private Implementation. More...

#include <StringPimpl.h>

List of all members.

Public Member Functions

const char * c_str () const throw (Exception &)
 Just like the Standard String's c_str, this returns the internal string in the form of a const char.
bool empty () const throw (Exception &)
 Predicate which returns true if the internal string is empty and false if it is not empty.
 StringPimpl (const StringPimpl &stringPimpl)
 Standard copy construtor.
 StringPimpl (const char *const stringPimpl) throw (Exception &)
 Constructor that takes in a const char.
StringPimplStringPimpl::operator= (const StringPimpl &stringPimpl)
 Standard assignment operator.
virtual ~StringPimpl ()
 Standard virtual destructor.

Private Member Functions

void init (const char *const stringPimpl)
 Private method to avoid duplicate code between the constructor and the copy constructor.

Private Attributes

StringPrivate * m_pimpl
 The private String which I do not expose.


Detailed Description

A String Private Implementation.

This Private implementation's purpose (also commonly known on the internet as pimpl) is to not tie the user of RebeccaAIML to a particular Standard Library by using a Standard Library string.

Also, this private implementation handles the memory management of strings inside the RebeccaAIML dll which is a requirement for Dll memory boundary safety. Standard Libraries could and sometimes do break Dll memory boundary safeties, hence another reason this class is needed.

Only a few needed methods are provided. Once you get this string object back, you should copy it into your own standard string container.

Example: StringPimpl s = someFoo(); std::string myString(s.c_str);


Constructor & Destructor Documentation

rebecca::impl::StringPimpl::StringPimpl const char *const   stringPimpl  )  throw (Exception &)
 

Constructor that takes in a const char.

The char is copied to the private String.

Parameters:
stringPimpl The const char which is copied to the private String.
Exceptions:
This will not explicitly throw an exception, but an underlying method might. More than likely only a (bad_alloc) will be thrown for a out of memory exception. If so, the bad_alloc's message will be wrapped in the Exception class.

rebecca::impl::StringPimpl::StringPimpl const StringPimpl stringPimpl  ) 
 

Standard copy construtor.

Parameters:
stringPimpl Standard secondary const StringPimpl reference needed for a copy constructor.
Exceptions:
This can throw anything but will not explicitly throw an exception.

virtual rebecca::impl::StringPimpl::~StringPimpl  )  [virtual]
 

Standard virtual destructor.

This destorys the internal memory of the internal string private implementation. The deallocation of the memory occurs inside of the dll, therefore this satisfies the requirement to be dll memory boundary safe.


Member Function Documentation

const char* rebecca::impl::StringPimpl::c_str  )  const throw (Exception &)
 

Just like the Standard String's c_str, this returns the internal string in the form of a const char.

Use this to copy the string into whichever type of String you deem suitable.

Exceptions:
It will not explicitly throw an exception, but an underlying method might. More than likely this will never throw an exception.

bool rebecca::impl::StringPimpl::empty  )  const throw (Exception &)
 

Predicate which returns true if the internal string is empty and false if it is not empty.

Returns:
True if the internal string is empty, false if the internal string is not empty.
Exceptions:
It will not explicitly throw an exception, but an underlying method might. More than likely this will never throw an exception.

void rebecca::impl::StringPimpl::init const char *const   stringPimpl  )  [private]
 

Private method to avoid duplicate code between the constructor and the copy constructor.

Parameters:
stringPimpl The const char which is copied to the private String.
Exceptions:
This can throw anything.

StringPimpl& rebecca::impl::StringPimpl::StringPimpl::operator= const StringPimpl stringPimpl  ) 
 

Standard assignment operator.

Performs a deep copy of the internal string.

Parameters:
stringPimpl Standard secondary reference
Exceptions:
This can throw anything but will not explicitly throw an exception.


Member Data Documentation

StringPrivate* rebecca::impl::StringPimpl::m_pimpl [private]
 

The private String which I do not expose.

The memory for this is handled automatically inside of the constructor and destructor of this class.


The documentation for this class was generated from the following file:
Generated on Wed Oct 12 23:40:34 2005 for RebeccaAIML by  doxygen 1.4.5