本文整理汇总了C++中Archive::addObjectMember方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::addObjectMember方法的具体用法?C++ Archive::addObjectMember怎么用?C++ Archive::addObjectMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::addObjectMember方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: includeMember
/// includeMember - include the object member in the given file offset, and
/// return the size of the object
/// @param pConfig - LinkerConfig
/// @param pArchiveRoot - the archive root
/// @param pFileOffset - file offset of the member header in the archive
size_t GNUArchiveReader::includeMember(const LinkerConfig& pConfig,
Archive& pArchive,
uint32_t pFileOffset)
{
Input* cur_archive = &(pArchive.getARFile());
Input* member = NULL;
uint32_t file_offset = pFileOffset;
size_t size = 0;
do {
uint32_t nested_offset = 0;
// use the file offset in current archive to find out the member we
// want to include
member = readMemberHeader(pArchive,
*cur_archive,
file_offset,
nested_offset,
size);
assert(member != NULL);
// bypass if we get an archive that is already in the map
if (Input::Archive == member->type()) {
cur_archive = member;
file_offset = nested_offset;
continue;
}
// insert a node into the subtree of current archive.
Archive::ArchiveMember* parent =
pArchive.getArchiveMember(cur_archive->name());
assert(NULL != parent);
pArchive.inputs().insert(parent->lastPos, *(parent->move), *member);
// move the iterator to new created node, and also adjust the
// direction to Afterward for next insertion in this subtree
parent->move->move(parent->lastPos);
parent->move = &InputTree::Afterward;
bool doContinue = false;
if (m_ELFObjectReader.isMyFormat(*member, doContinue)) {
member->setType(Input::Object);
pArchive.addObjectMember(pFileOffset, parent->lastPos);
m_ELFObjectReader.readHeader(*member);
m_ELFObjectReader.readSections(*member);
m_ELFObjectReader.readSymbols(*member);
m_Module.getObjectList().push_back(member);
}
else if (doContinue && isMyFormat(*member, doContinue)) {
member->setType(Input::Archive);
// when adding a new archive node, set the iterator to archive
// itself, and set the direction to Downward
pArchive.addArchiveMember(member->name(),
parent->lastPos,
&InputTree::Downward);
cur_archive = member;
file_offset = nested_offset;
}
else {
warning(diag::warn_unrecognized_input_file) << member->path()
<< pConfig.targets().triple().str();
}
} while (Input::Object != member->type());
return size;
}