Game Development Reference
In-Depth Information
And try to resize it:
if ( !FContainer->SafeResize(
static_cast<size_t>( Position ) + 1 ))
{ return; }
}
FPosition = Position;
}
Write data to the current position of this ile:
virtual uint64 Write( const void* Buf, const uint64 Size )
{
uint64 ThisPos = FPosition;
Ensure there is enough space:
Seek( ThisPos + Size );
if ( FPosition + Size > FMaxSize ) { return 0; }
void* DestPtr = ( void* )( &( ( ( ubyte* )(
FContainer->GetData() ) )[ThisPos] ) );
Write the actual data:
memcpy( DestPtr, Buf, static_cast<size_t>( Size ) );
return Size;
}
}
private:
…
};
We omit the trivial implementations of
GetFileName()
,
GetFilePos()
,
GetMaxSize()
,
SetContainer()
,
GetContainer()
,
GetMaxSize()
, and
SetMaxSize()
member
functions, along with ields declarations. You will ind the full source code of them in the code
bundle of the topic.
See also
F
Working with in-memory iles