summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_structtree.cpp
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-04-06 13:38:54 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-06 18:09:57 +0000
commit7f389615a0fca78532482d6f4070d18c5d2f9f5d (patch)
tree9e47feb57a5bfd57abe48eb0104c5952fe394ab0 /fpdfsdk/fpdf_structtree.cpp
parent25553aa8f74ddccbfcb3bb7b8f55d3f2ac00338f (diff)
downloadpdfium-7f389615a0fca78532482d6f4070d18c5d2f9f5d.tar.xz
Cleanup the tagged code
This CL removes the IPDF_Struct* classes in favour of their only implementation. The tagged code was split out into files matching the classes they contain. The friendship between CPDF_StructTree and CPDF_StructElement was broken in favour of accessors. Bug: pdfium:672 Change-Id: Iade83b608fb7168b3b0f41338d10d5fd8ab91a6e Reviewed-on: https://pdfium-review.googlesource.com/3820 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_structtree.cpp')
-rw-r--r--fpdfsdk/fpdf_structtree.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp
index 8a93d2299d..96d40b41c2 100644
--- a/fpdfsdk/fpdf_structtree.cpp
+++ b/fpdfsdk/fpdf_structtree.cpp
@@ -8,17 +8,18 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
-#include "core/fpdfdoc/fpdf_tagged.h"
+#include "core/fpdfdoc/cpdf_structelement.h"
+#include "core/fpdfdoc/cpdf_structtree.h"
#include "fpdfsdk/fsdk_define.h"
namespace {
-IPDF_StructTree* ToStructTree(FPDF_STRUCTTREE struct_tree) {
- return reinterpret_cast<IPDF_StructTree*>(struct_tree);
+CPDF_StructTree* ToStructTree(FPDF_STRUCTTREE struct_tree) {
+ return reinterpret_cast<CPDF_StructTree*>(struct_tree);
}
-IPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) {
- return reinterpret_cast<IPDF_StructElement*>(struct_element);
+CPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) {
+ return reinterpret_cast<CPDF_StructElement*>(struct_element);
}
unsigned long WideStringToBuffer(const CFX_WideString& str,
@@ -40,23 +41,23 @@ DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return nullptr;
- return IPDF_StructTree::LoadPage(pPage->m_pDocument, pPage->m_pFormDict)
+ return CPDF_StructTree::LoadPage(pPage->m_pDocument, pPage->m_pFormDict)
.release();
}
DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree) {
- std::unique_ptr<IPDF_StructTree>(ToStructTree(struct_tree));
+ std::unique_ptr<CPDF_StructTree>(ToStructTree(struct_tree));
}
DLLEXPORT int STDCALL
FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree) {
- IPDF_StructTree* tree = ToStructTree(struct_tree);
+ CPDF_StructTree* tree = ToStructTree(struct_tree);
return tree ? tree->CountTopElements() : -1;
}
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index) {
- IPDF_StructTree* tree = ToStructTree(struct_tree);
+ CPDF_StructTree* tree = ToStructTree(struct_tree);
if (!tree || index < 0 || index >= tree->CountTopElements())
return nullptr;
return tree->GetTopElement(index);
@@ -66,7 +67,7 @@ DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
return (elem && elem->GetDict())
? WideStringToBuffer(elem->GetDict()->GetUnicodeTextFor("Alt"),
buffer, buflen)
@@ -77,21 +78,21 @@ DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
return elem ? WideStringToBuffer(elem->GetType().UTF8Decode(), buffer, buflen)
: 0;
}
DLLEXPORT int STDCALL
FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
return elem ? elem->CountKids() : -1;
}
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index) {
- IPDF_StructElement* elem = ToStructTreeElement(struct_element);
+ CPDF_StructElement* elem = ToStructTreeElement(struct_element);
if (!elem || index < 0 || index >= elem->CountKids())
return nullptr;