MFC Compatibility Classes
Toward the same goal of MFC source-code compatibility, SFL also offers a CString-compatible class and a set of collection classes that also share the public interfaces of MFC collections.
SFL’s CString offers the possibility of reusing with virtually no change chunks of code that make use of MFC’s CString, but eliminating the MFC linkage. This is attractive for ATL projects where up until now no string-processing capabilities were easily available.
SFL’s CString class can be distinguished from its MFC counterpart because it is contained in the stingray::foundation namespace. However, in a project that uses MFC it is recommended to avoid the inclusion of SFL’s version since it would lead to duplication of functionality and larger executable code.
SFL’s CString is implemented in terms of the basic_string_ex<> class described in a previous section. This class, in turn, is derived from the Standard C++ Library string. What CString contributes is to change the programming interface in order to provide source code compatibility with MFC. Every routine is translated to its equivalent in the basic_string<> interface. The definition of SFL’s CString is located in the header file <string\SflString.h>.
SFL also offers a set of collection classes that follow this same pattern: they are implemented on top of the corresponding containers in the Standard C++ Library portion commonly known as STL, but offer the same interface as the familiar MFC collections.
The following MFC collections are included in the header <string\sflcoll.h>:
*CMap
*CTypedPtrMap
*CArray
*CTypedPtrArray
*CList
*CTypedPtrList
In addition, there are explicit type definitions as instantiations of the templatized classes for the following MFC collections:
*CMapPtrToPtr
*CMapPtrToWord
*CMapWordToPtr
*CMapStringToPtr
*CMapPtrToString
*CWordArray
*CDWordArray
*CUIntArray
*CStringArray
*CPtrArray
*CPtrList
*CStringList