本文整理汇总了C++中CPDF_Object::AsReference方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Object::AsReference方法的具体用法?C++ CPDF_Object::AsReference怎么用?C++ CPDF_Object::AsReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPDF_Object
的用法示例。
在下文中一共展示了CPDF_Object::AsReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPageKids
bool CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
if (!pParser) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
CPDF_Dictionary* pDict = pPages->GetDict();
CPDF_Object* pKids = pDict ? pDict->GetObjectFor("Kids") : nullptr;
if (!pKids)
return true;
switch (pKids->GetType()) {
case CPDF_Object::REFERENCE:
m_PageObjList.Add(pKids->AsReference()->GetRefObjNum());
break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i)))
m_PageObjList.Add(pRef->GetRefObjNum());
}
} break;
default:
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
return true;
}
示例2: CheckUnkownPageNode
bool CPDF_DataAvail::CheckUnkownPageNode(uint32_t dwPageNo,
PageNode* pPageNode,
DownloadHints* pHints) {
bool bExist = false;
std::unique_ptr<CPDF_Object> pPage = GetObject(dwPageNo, pHints, &bExist);
if (!bExist) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
if (!pPage) {
if (m_docStatus == PDF_DATAAVAIL_ERROR)
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
if (pPage->IsArray()) {
pPageNode->m_dwPageNo = dwPageNo;
pPageNode->m_type = PDF_PAGENODE_ARRAY;
return true;
}
if (!pPage->IsDictionary()) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
CFX_ByteString type = pDict->GetStringFor("Type");
if (type == "Pages") {
pPageNode->m_type = PDF_PAGENODE_PAGES;
CPDF_Object* pKids = pDict->GetObjectFor("Kids");
if (!pKids) {
m_docStatus = PDF_DATAAVAIL_PAGE;
return true;
}
switch (pKids->GetType()) {
case CPDF_Object::REFERENCE: {
CPDF_Reference* pKid = pKids->AsReference();
PageNode* pNode = new PageNode();
pPageNode->m_childNode.Add(pNode);
pNode->m_dwPageNo = pKid->GetRefObjNum();
} break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i));
if (!pKid)
continue;
PageNode* pNode = new PageNode();
pPageNode->m_childNode.Add(pNode);
pNode->m_dwPageNo = pKid->GetRefObjNum();
}
} break;
default:
break;
}
} else if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
} else {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
}
return true;
}