Поделиться через


CArchive::ReadClass

Call this member function to read a reference to a class previously stored with WriteClass.

CRuntimeClass* ReadClass( 
   const CRuntimeClass* pClassRefRequested = NULL, 
   UINT* pSchema = NULL, 
   DWORD* pObTag = NULL  
);

Параметры

  • pClassRefRequested
    A pointer to the CRuntimeClass structure that corresponds to the class reference requested. Can be NULL.

  • pSchema
    A pointer to a schema of the run-time class previously stored.

  • pObTag
    A number that refers to an object's unique tag. Used internally by the implementation of ReadObject. Exposed for advanced programming only; pObTag normally should be NULL.

Возвращаемое значение

A pointer to the CRuntimeClass structure.

Заметки

If pClassRefRequested is not NULL, ReadClass verifies that the archived class information is compatible with your runtime class. If it is not compatible, ReadClass will throw a CArchiveException.

Your runtime class must use DECLARE_SERIAL and IMPLEMENT_SERIAL; otherwise, ReadClass will throw a CNotSupportedException.

If pSchema is NULL, the schema of the stored class can be retrieved by calling CArchive::GetObjectSchema; otherwise, *****pSchema will contain the schema of the run-time class that was previously stored.

You can use SerializeClass instead of ReadClass, which handles both reading and writing of the class reference.

Пример

See the example for CArchive::WriteClass.

Требования

Header: afx.h

См. также

Основные понятия

CArchive Class

CArchive Members

Hierarchy Chart

CArchive::WriteClass

CArchive::GetObjectSchema

CArchive::SetObjectSchema

CArchiveException Class

CNotSupportedException Class

CArchive::SerializeClass