Loading a .red File
The .red file API is exposed through the RED::IREDFile
interface. To create an instance of a .red file, you need to use the RED::Factory
:
RED::Object* red_file = RED::Factory::CreateInstance( CID_REDFile );
and get back its interface with:
RED::IREDFile* ired_file = red_file->As< RED::IREDFile >();
Now we can load a .red file using our object:
Case of File on Disk
// iresmgr is a pointer to the RED::IResourceManager interface.
RED::StreamingPolicy policy;
RED::FileHeader fheader;
RED::FileInfo finfo;
RED::Vector< unsigned int > context;
RC_TEST( ired_file->Load( "./my_file.red", iresmgr->GetState(), policy, fheader, finfo, context ) );
More Generic Case of a RED::IStream
// iresmgr is a pointer to the RED::IResourceManager interface.
// stream is a pointer to a RED stream.
RC_TEST( ired_file->Load( *stream, iresmgr->GetState(), policy, fheader, finfo, context ) );