Rediger

Del via


CW2CWEX Class

This class is used by the string conversion macros CW2CTEX and CT2CWEX, and the typedef CW2W.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

Syntax

template<int t_nBufferLength = 128>
class CW2CWEX

Parameters

t_nBufferLength
The size of the buffer used in the translation process. The default length is 128 bytes.

Members

Public Constructors

Name Description
CW2CWEX::CW2CWEX The constructor.
CW2CWEX::~CW2CWEX The destructor.

Public Operators

Name Description
CW2CWEX::operator LPCWSTR Conversion operator.

Public Data Members

Name Description
CW2CWEX::m_psz The data member that stores the source string.

Remarks

Unless extra functionality is required, use CW2CTEX, CT2CWEX, or CW2W in your code.

This class is safe to use in loops and won't overflow the stack. By default, the ATL conversion classes and macros use the current thread's ANSI code page for the conversion.

The following macros are based on this class:

  • CW2CTEX

  • CT2CWEX

The following typedef is based on this class:

  • CW2W

For a discussion of these text conversion macros, see ATL and MFC String Conversion Macros.

Example

See ATL and MFC String Conversion Macros for an example of using these string conversion macros.

Requirements

Header: atlconv.h

CW2CWEX::CW2CWEX

The constructor.

CW2CWEX(LPCWSTR psz, UINT nCodePage) throw(...);
CW2CWEX(LPCWSTR psz) throw(...);

Parameters

psz
The text string to be converted.

nCodePage
The code page. Not used in this class.

Remarks

Allocates the buffer used in the translation process.

CW2CWEX::~CW2CWEX

The destructor.

~CW2CWEX() throw();

Remarks

Frees the allocated buffer.

CW2CWEX::m_psz

The data member that stores the source string.

LPCWSTR m_psz;

CW2CWEX::operator LPCWSTR

Conversion operator.

operator LPCWSTR() const throw();

Return Value

Returns the text string as type LPCWSTR.

See also

CA2AEX Class
CA2CAEX Class
CA2WEX Class
CW2AEX Class
CW2WEX Class
Class Overview