本文整理汇总了C++中FArchive::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::Write方法的具体用法?C++ FArchive::Write怎么用?C++ FArchive::Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::Write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void FLZOMemFile::Serialize (FArchive &arc)
{
if (arc.IsStoring ())
{
if (m_ImplodedBuffer == NULL)
{
I_Error ("FLZOMemFile must be imploded before storing\n");
// Q: How do we get here without closing FLZOMemFile first?
Close ();
}
arc.Write (LZOSig, 4);
DWORD sizes[2];
sizes[0] = ((DWORD *)m_ImplodedBuffer)[0];
sizes[1] = ((DWORD *)m_ImplodedBuffer)[1];
SWAP_DWORD (sizes[0]);
SWAP_DWORD (sizes[1]);
arc.Write (m_ImplodedBuffer, (sizes[0] ? sizes[0] : sizes[1])+8);
}
else
{
Close ();
m_Mode = EReading;
char sig[4];
DWORD sizes[2];
arc.Read (sig, 4);
if (sig[0] != LZOSig[0] || sig[1] != LZOSig[1] || sig[2] != LZOSig[2] || sig[3] != LZOSig[3])
I_Error ("Expected to extract an LZO-compressed file\n");
arc >> sizes[0] >> sizes[1];
DWORD len = sizes[0] == 0 ? sizes[1] : sizes[0];
m_Buffer = (BYTE *)Malloc (len+8);
SWAP_DWORD (sizes[0]);
SWAP_DWORD (sizes[1]);
((DWORD *)m_Buffer)[0] = sizes[0];
((DWORD *)m_Buffer)[1] = sizes[1];
arc.Read (m_Buffer+8, len);
m_ImplodedBuffer = m_Buffer;
m_Buffer = NULL;
m_Mode = EWriting;
}
}
示例2: writeMapName
static void writeMapName (FArchive &arc, const char *name)
{
BYTE size;
if (name[7] != 0)
{
size = 8;
}
else
{
size = (BYTE)strlen (name);
}
arc << size;
arc.Write (name, size);
}
示例3: G_SerializeHub
static void G_SerializeHub(FArchive & arc)
{
int i=hubdata.Size();
arc << i;
if (i>0)
{
if (arc.IsStoring()) arc.Write(&hubdata[0], i * sizeof(wbstartstruct_t));
else
{
hubdata.Resize(i);
arc.Read(&hubdata[0], i * sizeof(wbstartstruct_t));
}
}
else hubdata.Clear();
}
示例4: Serialize
void FRemapTable::Serialize(FArchive &arc)
{
int n = NumEntries;
arc << NumEntries;
if (arc.IsStoring())
{
arc.Write (Remap, NumEntries);
}
else
{
if (n != NumEntries)
{
Free();
Alloc(NumEntries);
}
arc.Read (Remap, NumEntries);
}
for (int j = 0; j < NumEntries; ++j)
{
arc << Palette[j];
}
}