home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
strgen.zip
/
MYSTRGEN.HPP
< prev
next >
Wrap
Text File
|
1996-03-15
|
1KB
|
53 lines
#ifndef _MYSTRGEN_
#define _MYSTRGEN_
#ifndef _CUSTOMER_ // replace this with your own header file
#include "customer.hpp"
#endif
#ifndef _ISTRGEN_
#include <istrgen.hpp>
#endif
#ifndef _ISTRING_
#include <istring.hpp>
#endif
// change the typedef to point to the object you want
// a string generated for
typedef Customer* Element;
class StrgenFn: public IStringGeneratorFn<Element>
{
public:
// string generation function - modify this function to return
// the string generated for your object
IString stringFor(Element const& element)
{ return (element->Name() +
" " +
element->Street()) ;
}
};
static StrgenFn strgenfn; // static global variable which is local
// to its translation unit, and has internal
// linkage.
// This object is required for initializing
// the IStringGenerator object
class MyStringGen: public IStringGenerator < Element >
{
public:
MyStringGen(): IStringGenerator< Element >
(IReference< IStringGeneratorFn< Element > > (&strgenfn)) {}
};
#endif