Introduction
The systems need to exchange data to communicate between two parts of a software system. The data types Classes represent this data. These classes are public (or static) classes with no methods. These classes wrap C++ data types.

Let's now briefly discuss Data Types Classes with some examples.
Data Types Classes
The data transfer class is a static class in the Active Template Library (ATL) that transports the data between the subsystems. The primary purpose of these classes is to reduce the amount of overhead created, which in turn will reduce the number of system calls needed between the subsystems.

CComBSTR
Wraps the BSTR data type
Syntax
class CComBSTR
Public Constructors
Name | Description | Syntax |
CComBSTR::CComBSTR | The constructor creates an object to receive notifications related to the asynchronous data transfer. For every bind operation, typically, one object is created. | CBindStatusCallback(); |
CComBSTR::~CComBSTR | The destructor frees all allocated resources. | ~CBindStatusCallback(); |
Public Methods
Name | Description | Syntax |
CComBSTR::Append | It appends a string(either lpsz or the BSTR member of bstrSrc ) to m_str. |
HRESULT Append(const CComBSTR& bstrSrc) throw(); HRESULT Append(wchar_t ch) throw(); HRESULT Append(char ch) throw(); HRESULT Append(LPCOLESTR lpsz) throw(); HRESULT Append(LPCSTR lpsz) throw(); HRESULT Append(LPCOLESTR lpsz, int nLen) throw(); |
CComBSTR::AppendBSTR | Appends the specified BSTR to m_str. | HRESULT AppendBSTR(BSTR p) throw(); |
CComBSTR::AppendBytes | It appends the required number of bytes to m_str. | HRESULT AppendBytes(const char* lpsz, int nLen) throw(); |
CComBSTR::ArrayToBSTR | It creates a BSTR from the first character of each element in the safe array and attaches it to the CComBSTR object. |
HRESULT ArrayToBSTR(const SAFEARRAY* pSrc) throw();
|
CComBSTR::AssignBSTR | Assigns a BSTR to m_str. | HRESULT AssignBSTR(const BSTR bstrSrc) throw(); |
CComBSTR::Attach | It connects the BSTR to the CComBSTR object by setting up the m_str member to src. |
void Attach(BSTR src) throw();
|
CComBSTR::BSTRToArray | It creates a zero-based one-dimensional safearray, where each array element is a character from the CComBSTR object. | HRESULT BSTRToArray(LPSAFEARRAY* ppArray) throw(); |
CComBSTR::ByteLength | Returns the length or number of m_str in bytes, excluding the terminating null character. |
unsigned int ByteLength() const throw();
|
CComBSTR::Copy | This constructor class allocates and returns a copy of m_str. | BSTR Copy() const throw(); |
Public Operators
CComBSTR::operator BSTR | Casts a CComBSTR object to a BSTR. | operator BSTR() const throw(); |
CComBSTR::operator ! | Checks whether the BSTR string is NULL. | bool operator!() const throw(); |
CComBSTR::operator != | Returns the logical opposite of operator ==. |
bool operator!= (const CComBSTR& bstrSrc) const throw(); bool operator!= (LPCOLESTR pszSrc) const; bool operator!= (LPCSTR pszSrc) const; bool operator!= (int nNull) const throw(); |
CComBSTR::operator & | Returns the address of the BSTR stored in the m_str member. | BSTR* operator&() throw(); |
CComBSTR::operator == | Compares a CComBSTR with a string. CComBSTRs are compared textually in the context of the user's default locale. |
bool operator== (const CComBSTR& bstrSrc) const throw(); bool operator== (LPCOLESTR pszSrc) const; bool operator== (LPCSTR pszSrc) const; bool operator== (int nNull) const throw(); |
Public Data Members
CComBSTR::m_str | Contains the BSTR associated with the CComBSTR object. | BSTR m_str; |
CComVariant Class
This class wraps the VARIANT type, providing a member indicating the type of data stored.
Syntax
class CComVariant : public tagVARIANT
Members
Public Constructors
Name | Description | Syntax |
CComVariant::CComVariant | It is the constructor. | CBindStatusCallback(); |
CComVariant::~CComVariant | The destructor that frees all allocated resources. | ~CBindStatusCallback(); |
Public Methods
Name | Description | Syntax |
CComVariant::Attach | Attaches a VARIANT to the CComVariant object. |
HRESULT DAdvise( HRESULT Attach(VARIANT* pSrc); |
CComVariant::ChangeType | Converts the CComVariant object to a new type. | HRESULT ChangeType(VARTYPE vtNew, const VARIANT* pSrc = NULL); |
CComVariant::Clear | Clears the CComVariant object. | HRESULT Clear(); |
CComVariant::Copy | Copies a VARIANT to the CComVariant object. | HRESULT Copy(const VARIANT* pSrc); |
CComVariant::CopyTo | Copies the contents of the CComVariant object. | HRESULT CopyTo(BSTR* pstrDest); |
CComVariant::Detach | Detaches the underlying VARIANT from the CComVariant object. | HRESULT Detach(VARIANT* pDest); |
CComVariant::GetSize | Returns the size in the number of bytes of the contents of the CComVariant object. | ULONG GetSize() const; |
CComVariant::ReadFromStream | Loads a VARIANT from a stream. Sets the underlying VARIANT to the VARIANT contained in the specified stream. | HRESULT ReadFromStream(IStream* pStream); |
CComVariant::SetByRef | Initializes the CComVariant object and sets the vt member to VT_BYREF. |
template < typename T > void SetByRef(T* pT) throw(); |
CComVariant::WriteToStream | Saves the underlying VARIANT to a stream. | HRESULT WriteToStream(IStream* pStream); |
Public Operators
CComVariant::operator < | Indicates whether the CComVariant object is less than the specified VARIANT. | bool operator<(const VARIANT& varSrc) const throw(); |
CComVariant::operator > | Indicates whether the CComVariant object is greater than the specified VARIANT. | bool operator>(const VARIANT& varSrc) const throw(); |
CComVariant::operator != | Indicates whether the CComVariant object doesn't equal the specified VARIANT. | bool operator!=(const VARIANT& varSrc) const throw(); |
CComVariant::operator == | Indicates whether the CComVariant object equals the specified VARIANT. |
bool operator==(const VARIANT& varSrc) const throw(); bool operator== (LPCOLESTR pszSrc) const; bool operator== (LPCSTR pszSrc) const; bool operator== (int nNull) const throw(); |