当前位置: 首页>>代码示例>>C++>>正文


C++ FArchive::Write方法代码示例

本文整理汇总了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;
	}
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:46,代码来源:farchive.cpp

示例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);
}
开发者ID:Quaker540,项目名称:gzdoom,代码行数:14,代码来源:g_level.cpp

示例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();
}
开发者ID:ddraigcymraeg,项目名称:scoredoomst,代码行数:15,代码来源:g_hub.cpp

示例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];
	}
}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:23,代码来源:r_translate.cpp


注:本文中的FArchive::Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。