StructElement Class Documentation
classStructElementNamespace:datalogics_interface
Detailed Description
Owns a non-owning reference to its CDocument. Exposes type (/S) access, the backing dict (for arbitrary attribute reads/writes), child creation, and marked-content reference insertion.
Threading: single-thread use. A StructElement is bound to its owning Document's thread; do not share it across threads. See datalogics_interface.hpp for the full threading model.
Lifetime: a StructElement must not outlive the Document that produced it.
Referenced by
Constructor & Destructor Documentation
StructElement
StructElement(StructElement &&)Parameters
~StructElement
~StructElement()Member Function Documentation
add_child
StructElementadd_child(const std::string &struct_type)Parameters
struct_type: const std::string &
Returns:
StructElementCreate and append a child element with the given struct type (/S).
add_marked_content_ref
voidadd_marked_content_ref(Page &page, const Container &container)Parameters
page: Page &container: const Container &
Returns:
voidAppend a marked-content reference. /StructParents on the page and the parent tree are wired automatically.
as_pdf_object
PDFObjectas_pdf_object()Returns:
PDFObjectNon-owning indirect handle for use in containers.
get_kid_as_element
StructElementget_kid_as_element(size_tindex)Parameters
index: size_t
Returns:
StructElementKid at index interpreted as a child struct element.
get_kid_as_marked_content_mcid
intget_kid_as_marked_content_mcid(size_tindex)Parameters
index: size_t
Returns:
intMCID of the marked-content kid at index.
get_kid_as_marked_content_page
Pageget_kid_as_marked_content_page(size_tindex)Parameters
index: size_t
Returns:
PagePage containing the marked-content kid at index.
get_kid_count
size_tget_kid_count()Returns:
size_tNumber of kids in this element's /K array.
get_kid_type
StructKidTypeget_kid_type(size_tindex)Parameters
index: size_t
Returns:
StructKidTypeClassify the kid at index. Caller should gate type-specific accessors on this result.
get_parent
std::optional< StructElement >get_parent()Returns:
std::optional< StructElement >Immediate parent element in the tree, or std::nullopt when the parent is the struct tree root (use parent_is_tree_root() to tell the two nullopt conditions apart explicitly).
get_pdf_dict
PDFDictget_pdf_dict()Returns:
PDFDictFull backing dict — escape hatch for all attributes (/Alt, /ActualText, /Lang, /E, /T, /ID, /A, etc.).
get_type
std::stringget_type()Returns:
std::stringStruct type (/S) value as a string.
operator=
StructElement &operator=(StructElement &&)Parameters
Returns:
StructElement &parent_is_tree_root
boolparent_is_tree_root()Returns:
boolTrue when this element's immediate parent is the struct tree root.