IStringGeneratorRefMemberFn

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: Objects of the IStringGeneratorRefMemberFn class require that the object passed on the stringFor member function is a pointer or an object that supports the operator->. IStringGeneratorMemberFn objects generate strings from objects that are not pointers.


IStringGeneratorRefMemberFn - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~IStringGeneratorRefMemberFn
public:
virtual ~IStringGeneratorRefMemberFn()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IStringGeneratorRefMemberFn
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.

member
A pointer to the member 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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Miscellaneous Members


[view class]
stringFor
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.

object
Reference to the object against which it dispatches the member function.
Note: The object parameter must be an object of type T, which is a pointer to an object of type U (where T and U are the template class arguments) and class U contains the member function that is dispatched.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IStringGeneratorRefMemberFn - Inherited Member Functions and Data

Inherited Public Functions

IStringGeneratorFn
IMRefCounted

Inherited Public Data

Inherited Protected Functions

IMRefCounted

Inherited Protected Data