The IStringTest class defines the basic protocol for test objects that you can pass to IString functions or I0String functions to assist in performing various test and search functions. This class also provides concrete implementation for the common case of using a C/C++ function for such testing.
The Open Class Library provides a derived template class, IStringTestMemberFn, to facilitate using member functions of any class on the IString functions that support IStringTest.
Derived classes should reimplement the virtual function IStringTest::test to test characters passed by the IString and return the appropriate result.
A constructor for this class accepts a pointer to a C/C++ function that in turn accepts an integer as a parameter and returns a boolean. You can use such functions anywhere an IStringTest can be used. Note that this is the type of the standard C Library "is" functions that check the type of C characters.
If I18N sementic is turned on, the integer parameter passed to the test function will be the wide-character representation of the character being tested.
Constructors & DestructorYou can construct and destruct objects of this class with a pointer to the C/C++ function to be used to implement the member IStringTest::test. Such members can be used anywhere an IStringTest can be used. Note that these members are the same as the standard C library "is" functions that check the type of C characters.
This class also provides a protected constructor, which derived classes can use to reuse the space for the C/C++ function pointer.
![]() |
public:
virtual ~IStringTest()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IStringTest(CFunction& cFunc)
Accepts a pointer to a C function.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IStringTest(FnType type, void* userData)
Accepts a function type and a pointer to user data.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Function TypesUse these typedefs to identify the test function.
![]() |
protected:
FnType type
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
TestingUse these members to implement an actual test.
![]() |
public:
virtual bool test(int c) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
enum FnType { user,
c,
cpp,
memFn,
cMemFn }Use these enumerators to specify the type of functions supported:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
typedef ICStrTestFn CFunction
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |