File Archive question

Started by
-1 comments, last by beebs1 16 years, 10 months ago
Hiya, I'm just designing a file archiving system, and I'm not sure which of the two methods I'm considering to use. I have an interface called IArchiveReader, and I'm wondering if it's worth implementing a seperate class for the file headers that are in the archive files. I'll try and demonstrate how each way would be used to try and explain better.

IArchiveReader *pReader;

// first method
int iIndex = pReader->GetFileIndex( "myfile.bmp" );

int iSize = pReader->GetFileSize( iIndex );

char *pBuffer = new char[iSize];
pReader->GetFileData( iIndex, pBuffer, iSize );

// or, second method
int iIndex = pReader->GetFileIndex( "myfile.bmp" );

IArchiveFileHeader *pHeader;
pHeader = pReader->GetFileHeader( iIndex );

int iSize = pHeader->GetSize();
char *pBuffer = new char[iSize];

pReader->GetFileData( iIndex, pBuffer, iSize );
Using only the reader class seems easier to use, but using a file header class seems more object-oriented and could be handy when I need to write archive files. I know its only a small detail, but any thoughts would be appreciated :)

This topic is closed to new replies.

Advertisement