SetaPDF_Core_DataStructure_NameTree Data structure class for Name Trees
File: /SetaPDF v2/Core/DataStructure/NameTree.php
Class hierarchy
Implements
Summary
Static Properties
Properties
$_values
A cache for resolved entries
The index is the key while the value is an array of both key and value object.
Static Methods
adjustNameCallback()
Callback function to build unique names.
Parameters
- $name : string
- $i : string
Attempt count
Methods
__construct()
The constructor.
Parameters
- $rootDictionary : SetaPDF_Core_Type_Dictionary
- $document : SetaPDF_Core_Document
_findLastLeafNode()
Finds the last leaf node.
Parameters
- $node : SetaPDF_Core_Type_Dictionary
- $intermediateNodes : array
Exceptions
Throws SetaPDF_Core_Type_Exception
_findLeaveNodeByKey()
Find a appropriate leaf node by a key.
Parameters
- $node : SetaPDF_Core_Type_Dictionary
- $key : int
- $exactMatch : bool
- $intermediateNodes : array
- $kidsInfo
Exceptions
Throws SetaPDF_Core_Type_Exception
_get()
Gets a key value pair by a root node and a key.
Parameters
- $node : SetaPDF_Core_Type_Dictionary
- $key : string
Exceptions
Throws SetaPDF_Core_Type_Exception
_getBlankLeafNodeObject()
Helper method to create a blank leaf node
Parameters
- $intermediate : boolean
add()
Add a keyed value to the tree.
For name trees: Make sure you pass the name in PDFDocEncoding or UTF-16BE including BOM.
Parameters
- $key : int|string|SetaPDF_Core_Type_ScalarValue
Depends on the implementation
- $value : SetaPDF_Core_Type_AbstractType
Exceptions
Throws SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException
Throws SetaPDF_Core_Type_Exception
See
cleanUp()
Release objects to free memory and cycled references
After calling this method the instance of this object is unusable!
get()
Get an object by a key.
Parameters
- $key : string|int
- $className : string
Exceptions
Throws SetaPDF_Core_Type_Exception
getAll()
Get all keyed objects.
Parameters
- $keysOnly : bool
- $className : null|string
Exceptions
Throws SetaPDF_Core_Type_Exception
merge()
Merges another tree into this tree.
As all items have to be unique this method will call a callback function given in $alreadyExistsCallback if an item already exists.
Parameters
- $tree : SetaPDF_Core_DataStructure_Tree
- $alreadyExistsCallback : null|callback
Will be called if a item already exists.
This method can take control over the renaming of the item. The method will be called as long as it will not throw an exception ofSetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException
.
The parameter of the callback function are: The key value and an incremental number of renaming attempts.
Return Values
An array of renamed items
Exceptions
Throws SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException
Throws SetaPDF_Core_Type_Exception