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.
 StringPimpl () throw (Exception &)
 Constructor that takes no arguments.
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

StringPimpl  )  throw (Exception &)
 

Constructor that takes no arguments.

The private string's empty constructor is called.

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.

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.

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 ~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* 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 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 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& 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* 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 Tue Feb 14 22:44:36 2006 for RebeccaAIML by  doxygen 1.4.5