#include <StringPimpl.h>
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 & | StringPimpl::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. |
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 that takes in a const char. The char is copied to the private String.
|
|
Standard copy construtor.
|
|
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. |
|
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.
|
|
Predicate which returns true if the internal string is empty and false if it is not empty.
|
|
Private method to avoid duplicate code between the constructor and the copy constructor.
|
|
Standard assignment operator. Performs a deep copy of the internal string.
|
|
The private String which I do not expose. The memory for this is handled automatically inside of the constructor and destructor of this class. |