The IStringGeneratorRefMemberFn template class is an IStringGeneratorFn-derived class. It dispatches C++ member functions against an object pointer to generate an IString. These objects represent member functions of class U to be applied against objects of type T, where T and U are template arguments and T is defined as typedef U* T;. This makes objects of type T the pointers to objects of class U. Objects of this class apply the stored member function against type T objects in the stringFor(const T& object) function, where object is a reference to a type T object.
The constructor for these objects requires a pointer to a class U member function; this member function returns an IString and accepts no arguments. Derive a class from this class to support member functions with additional parameters.
The following example creates an IStringGeneratorRefMemberFn object:
class MyClass {
public:
IString myString()
{
// Code to generate a string
}
// ......
};
//...
typedef MyClass * pMyClass;
MyClass myObj;
IStringGeneratorRefMemberFn * genFunction = new
IStringGeneratorRefMemberFn( pMyClass, MyClass::myString );
Note:
Constructors & DestructorYou can construct and destruct objects of this class.
![]() |
public:
virtual ~IStringGeneratorRefMemberFn()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IStringGeneratorRefMemberFn(IString ( U::* member ) ( ))
Create from a pointer to a member function of class U, where U is a template argument. The member function must return an IString, accept no arguments, and be a non-const function.
This constructor requires a pointer to a class U member function. This member function should return an IString, accept no parameters and be a non-const function.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Miscellaneous Members![]() |
public:
virtual IString stringFor(const T& object) const
This function calls the appropriate member function on the object reference parameter. The called member function is initialized from the parameter on the IStringGeneratorMemberFn constructor. The object parameter should be a pointer.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
virtual ~IStringGeneratorFn()
IStringGeneratorFn()
virtual IString stringFor(const T& object) const = 0
void addRef()
unsigned long count() const
void removeRef()
virtual ~IMRefCounted()
IMRefCounted()
IMRefCounted(const IMRefCounted&)
IMRefCounted& operator =(const IMRefCounted&)