StringImp Class Reference

Inheritance diagram for StringImp:

IString NString IBase


Public Methods

 StringImp (const char *in)
 StringImp (const NString &str)
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual long queryInterface (const Guid &id, void **iPtr)
virtual const char * str ()

Detailed Description

This class implements the IString interface by inheriting from the NString class. This allows a class to use an NString to internally represent a string value, and efficiently use the StringImp class to pass this value through plug-in interfaces. This is generally done by creating a new instance of a StringImp using the NString as a constructor parameter. This class is suitable for returning from a function that returns an SRef<IString> by value.


Constructor & Destructor Documentation

StringImp::StringImp const char *    in [inline]
 

This constructor can be used to construct a StringImp from a raw or const string. This constructor allocates a new buffer an copies the incoming string into it.

Parameters:
in The raw string with which to initialize this instance of the StringImp class.

StringImp::StringImp const NString &    str [inline]
 

This constructor is used to construct an StringImp from an NString. This version of the constructor leverages the efficient buffer sharing mechanism of the NString to prevent a string copy.

Parameters:
str A reference to an NString value used to initialize this instance of the StringImp class.


Member Function Documentation

unsigned long StringImp::addRef   [virtual]
 

This function is used to increment the reference count on a component. Each copy of an interface pointer that is in use by a client will have a corresponding reference on the component. Use the SPtr to help manage the references on components in client code.

Implements IBase.

long StringImp::queryInterface const Guid &    id,
void **    iPtr
[virtual]
 

This function is used to query the implementing component for other interfaces. The id of the required interface is passed, and the component tests it against the id's of the interfaces that it implements. If there is a match, the component sets the iPtr parameter to a pointer to that interface and returns IBase::cOK.

Parameters:
id The interface id of the desired interface.
iPtr This parameter is set to a pointer to the required interface if this component implements it. Otherwise it's set to NULL.

Implements IBase.

unsigned long StringImp::release   [virtual]
 

This function is used to increment the reference count on a component. Each copy of an interface pointer that is in use by a client will have a corresponding reference on the component. When the reference count of a component is decremented to zero then the component will delete itself. Use the SPtr to help manage the references on components in client code.

Implements IBase.

const char * StringImp::str   [inline, virtual]
 

This function is used to access the actual character buffer controlled by the StringImp.

Implements IString.


The documentation for this class was generated from the following files:

Return to top of page