Data Model > Extending the UNICOM Intelligence Data Model > Creating a CDSC > Development standards > String handling
 
String handling
Use the following guidelines when working with strings:
Implement strings using the CString class.
Where direct BSTR support is required, use the ATL CComBSTR class. For any substring manipulation or more complex string processing, convert a BSTR to an STL wstring.
Put all application messages and labels in a Windows resource file or a message map.
For application messages that require replacement text, use the FormatMessage function from CString. FormatMessage is implemented using the Platform SDK ::FormatMessage function. This function uses numbered escape sequences for dynamically formatting the message. This facilitates localizing message text, because the order of the replacement text can be changed in the message without changing the code.
Use the TCHAR type, routine, constant, and variable mappings. Periodically perform an ANSI and UNICODE build to ensure that the mapping macros are being used correctly.
When using the #import generated COM wrappers, the _bstr_t support class should be used.
See also
Component development
Coding standards
Naming conventions
Layout
Comments
Dealing with existing source code
Class library usage
Best practice
Development standards