IStringTest

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.

Windows Considerations

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.


IStringTest - Member Functions and Data by Group

Constructors & Destructor

You 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.


[view class]
~IStringTest
public:
virtual ~IStringTest()
Destructs the string test object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IStringTest
Constructs a string test object.


Overload 1
public:
IStringTest(CFunction& cFunc)

Accepts a pointer to a C function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IStringTest(FnType type, void* userData)

Accepts a function type and a pointer to user data.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Function Types

Use these typedefs to identify the test function.


[view class]
type
protected:
FnType type
Data member FnType. FnType is an enumeration describing the various flavors of functions supported: user-defined, C, C++ static or nonmember function, C++ member function, or const C++ member function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Testing

Use these members to implement an actual test.


[view class]
test
public:
virtual bool test(int c) const
Tests the specified integer (character) and returns true or false as returned by the C/C++ function provided at construction. Derived classes should override this function to implement their own testing function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IStringTest - Enumerations


[view class]
FnType
enum FnType { user, 
              c, 
              cpp, 
              memFn, 
              cMemFn }

Use these enumerators to specify the type of functions supported:

user
User-defined.
c
C.
cpp
C++ static or non-member function.
memFn
C++ member function.
cMemFn
Const C++ member function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IStringTest - Type Definitions


[view class]
CFunction
typedef ICStrTestFn CFunction
Pointer to the C/C++ function that accepts an integer parameter and returns a boolean.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IStringTest - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data