本文整理汇总了C++中FilePtr::getFileClass方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::getFileClass方法的具体用法?C++ FilePtr::getFileClass怎么用?C++ FilePtr::getFileClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePtr
的用法示例。
在下文中一共展示了FilePtr::getFileClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
//---------------------------------------------------------------------------
long File::open (FilePtr _parent, unsigned long fileSize, long numChild)
{
if (_parent && (_parent->fastFile == NULL))
{
parent = _parent;
if (parent->getFileMode() != READ)
{
return(CANT_WRITE_TO_CHILD);
}
physicalLength = fileSize;
parentOffset = parent->getLogicalPosition();
logicalPosition = 0;
//-------------------------------------------------------------
fileName = parent->getFilename();
fileMode = parent->getFileMode();
handle = parent->getFileHandle();
if (logFileTraffic)
{
if (!fileTrafficLog)
{
createTrafficLog();
}
char msg[300];
sprintf(msg,"CHILD Length: %010d File: %s",fileSize,_parent->getFilename());
fileTrafficLog->writeLine(msg);
}
long result = parent->addChild(this);
if (result != NO_ERR)
return(result);
//------------------------------------------------------------
// NEW FUNCTIONALITY!!!
//
// Each file may have a number of files open as children which
// use the parent's handle for reads and writes. This would
// allow us to open a packet file and read a packet as a fitIni
// or allow us to write a packet as a fit ini and so forth.
//
// It also allows us to use the packet file extensions as tree
// files to avoid the ten thousand file syndrome.
//
// There is now an open which takes a FilePtr and a size.
//
// IF a numChild parameter is passed in as -1, we want this file in RAM!!
// This means NO CHILDREN!!!!!!!!!!!!!
if (numChild != -1)
{
maxChildren = numChild;
childList = (FilePtr *)systemHeap->Malloc(sizeof(FilePtr) * maxChildren);
gosASSERT(childList != NULL);
numChildren = 0;
for (long i=0;i<(long)maxChildren;i++)
{
childList[i] = NULL;
}
}
else
{
maxChildren = 0;
inRAM = TRUE;
unsigned long result = 0;
fileImage = (MemoryPtr)malloc(fileSize);
if (!fileImage)
inRAM = FALSE;
if (_parent->getFileClass() == PACKETFILE)
{
result = ((PacketFilePtr)_parent)->readPacket(((PacketFilePtr)_parent)->getCurrentPacket(),fileImage);
}
else
{
result = _read(handle,fileImage,fileSize);
if (result != fileSize)
lastError = errno;
}
}
}
else
{
return(PARENT_NULL);
}
return(NO_ERR);
}