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


C++ Reference::SetTo方法代码示例

本文整理汇总了C++中Reference::SetTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Reference::SetTo方法的具体用法?C++ Reference::SetTo怎么用?C++ Reference::SetTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reference的用法示例。


在下文中一共展示了Reference::SetTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: inputInterface

status_t
DwarfImageDebugInfo::GetType(GlobalTypeCache* cache,
	const BString& name, Type*& _type)
{
	int32 registerCount = fArchitecture->CountRegisters();
	const Register* registers = fArchitecture->Registers();

	// get the DWARF -> architecture register map
	RegisterMap* fromDwarfMap;
	status_t error = fArchitecture->GetDwarfRegisterMaps(NULL, &fromDwarfMap);
	if (error != B_OK)
		return error;
	Reference<RegisterMap> fromDwarfMapReference(fromDwarfMap, true);

	// create the target interface
	BasicTargetInterface inputInterface(registers, registerCount, fromDwarfMap,
		fArchitecture, fTeamMemory);

	// iterate through all compilation units
	for (int32 i = 0; CompilationUnit* unit = fFile->CompilationUnitAt(i);
		i++) {
		DwarfTypeContext* typeContext = NULL;
		Reference<DwarfTypeContext> typeContextReference;

		// iterate through all types of the compilation unit
		for (DebugInfoEntryList::ConstIterator it
				= unit->UnitEntry()->Types().GetIterator();
			DIEType* typeEntry = dynamic_cast<DIEType*>(it.Next());) {
			if (typeEntry->IsDeclaration())
				continue;

			BString typeEntryName;
			DwarfUtils::GetFullyQualifiedDIEName(typeEntry, typeEntryName);
			if (typeEntryName != name)
				continue;

			// The name matches and the entry is not just a declaration --
			// create the type. First create the type context lazily.
			if (typeContext == NULL) {
				typeContext = new(std::nothrow)
					DwarfTypeContext(fArchitecture, fImageInfo.ImageID(), fFile,
					unit, NULL, 0, 0, &inputInterface, fromDwarfMap);
				if (typeContext == NULL)
					return B_NO_MEMORY;
				typeContextReference.SetTo(typeContext, true);
			}

			// create the type
			DwarfType* type;
			DwarfTypeFactory typeFactory(typeContext, fTypeLookup, cache);
			error = typeFactory.CreateType(typeEntry, type);
			if (error != B_OK)
				continue;

			_type = type;
			return B_OK;
		}
	}

	return B_ENTRY_NOT_FOUND;
}
开发者ID:mariuz,项目名称:haiku,代码行数:61,代码来源:DwarfImageDebugInfo.cpp


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