Class ObjectPath
- Namespace
- iText.Kernel.Utils.Objectpathitems
- Assembly
- itext.kernel.dll
Class that helps to find two corresponding objects in the compared documents and also keeps track of the already met during comparing process parent indirect objects.
public class ObjectPath
- Inheritance
-
ObjectPath
- Derived
- Inherited Members
Remarks
Class that helps to find two corresponding objects in the compared documents and also keeps track of the already met during comparing process parent indirect objects.
You could say that CompareObjectPath instance consists of two parts: direct path and indirect path. Direct path defines path to the currently comparing objects in relation to base objects. It could be empty, which would mean that currently comparing objects are base objects themselves. Base objects are the two indirect objects from the comparing documents which are in the same position in the pdf trees. Another part, indirect path, defines which indirect objects were met during comparison process to get to the current base objects. Indirect path is needed to avoid infinite loops during comparison.Constructors
ObjectPath()
Creates empty ObjectPath.
public ObjectPath()
ObjectPath(PdfIndirectReference, PdfIndirectReference)
Creates CompareObjectPath with corresponding base objects in two documents.
public ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject)
Parameters
baseCmpObject
PdfIndirectReferencebase object in cmp document.
baseOutObject
PdfIndirectReferencebase object in out document.
ObjectPath(PdfIndirectReference, PdfIndirectReference, Stack<LocalPathItem>, Stack<IndirectPathItem>)
Creates CompareObjectPath with corresponding base objects in two documents.
public ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject, Stack<LocalPathItem> path, Stack<IndirectPathItem> indirects)
Parameters
baseCmpObject
PdfIndirectReferencebase object in cmp document
baseOutObject
PdfIndirectReferencebase object in out document
path
Stack<LocalPathItem>local path that denotes sequence of the path items from base object to the comparing direct object
indirects
Stack<IndirectPathItem>indirect path which denotes sequence of the indirect references that were passed in comparing process to get to the current base objects
ObjectPath(ObjectPath)
Creates an ObjectPath object from another ObjectPath object, passed as argument.
public ObjectPath(ObjectPath objectPath)
Parameters
objectPath
ObjectPathan ObjectPath object to create from.
Fields
path
protected Stack<LocalPathItem> path
Field Value
Methods
Equals(object)
Method returns true if this ObjectPath instance equals to the passed object.
public override bool Equals(object obj)
Parameters
obj
object
Returns
- bool
true - if this ObjectPath instance equals to the passed object.
GetBaseCmpObject()
Method returns current base PdfIndirectReference object in the cmp document.
public virtual PdfIndirectReference GetBaseCmpObject()
Returns
- PdfIndirectReference
current base PdfIndirectReference object in the cmp document.
GetBaseOutObject()
Method returns current base PdfIndirectReference object in the out document.
public virtual PdfIndirectReference GetBaseOutObject()
Returns
- PdfIndirectReference
current base object in the out document.
GetHashCode()
Method returns a hash code of this ObjectPath instance.
public override int GetHashCode()
Returns
- int
a int hash code of this ObjectPath instance.
GetIndirectPath()
Gets indirect path which denotes sequence of the indirect references that were passed in comparing process to get to the current base objects.
public virtual Stack<IndirectPathItem> GetIndirectPath()
Returns
- Stack<IndirectPathItem>
indirect path to the current base objects.
GetLocalPath()
Gets local (or direct) path that denotes sequence of the path items from base object to the comparing direct object.
public virtual Stack<LocalPathItem> GetLocalPath()
Returns
- Stack<LocalPathItem>
direct path to the comparing object.
IsComparing(PdfIndirectReference, PdfIndirectReference)
This method is used to define if given objects were already met in the path to the current base objects.
public virtual bool IsComparing(PdfIndirectReference cmpObject, PdfIndirectReference outObject)
Parameters
cmpObject
PdfIndirectReferencecmp object to check if it was already met in base objects path.
outObject
PdfIndirectReferenceout object to check if it was already met in base objects path.
Returns
- bool
true if given objects are contained in the path and therefore were already compared.
Remarks
This method is used to define if given objects were already met in the path to the current base objects. If this method returns true it basically means that we found a loop in the objects structure and that we already compared these objects.
Pop()
Removes the last path item from the direct path.
public virtual void Pop()
PushArrayItemToPath(int)
Adds array item to the direct path.
public virtual void PushArrayItemToPath(int index)
Parameters
index
intindex in the array of the direct object to be compared.
Remarks
Adds array item to the direct path. See ArrayPathItem.
PushDictItemToPath(PdfName)
Adds dictionary item to the direct path.
public virtual void PushDictItemToPath(PdfName key)
Parameters
key
PdfNamekey in the dictionary to which corresponds direct object to be compared.
Remarks
Adds dictionary item to the direct path. See DictPathItem.
PushOffsetToPath(int)
Adds offset item to the direct path.
public virtual void PushOffsetToPath(int offset)
Parameters
offset
intoffset to the specific byte in the stream that is compared.
Remarks
Adds offset item to the direct path. See OffsetPathItem.
ResetDirectPath(PdfIndirectReference, PdfIndirectReference)
Creates a new ObjectPath instance with two new given base objects, which are supposed to be nested in the base objects of the current instance of the ObjectPath.
public virtual ObjectPath ResetDirectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject)
Parameters
baseCmpObject
PdfIndirectReferencenew base object in cmp document.
baseOutObject
PdfIndirectReferencenew base object in out document.
Returns
- ObjectPath
new ObjectPath instance, which stores chain of the indirect references which were already met to get to the new base objects.
Remarks
Creates a new ObjectPath instance with two new given base objects, which are supposed to be nested in the base objects of the current instance of the ObjectPath. This method is used to avoid infinite loop in case of circular references in pdf documents objects structure.
Basically, this method creates copy of the current CompareObjectPath instance, but resets information of the direct paths, and also adds current CompareObjectPath instance base objects to the indirect references chain that denotes a path to the new base objects.ToString()
Method returns a string representation of the direct path stored in this ObjectPath instance.
public override string ToString()
Returns
- string
a string representation of the direct path.
ToXmlNode(XmlDocument)
Creates an xml node that describes a direct path stored in this ObjectPath instance.
public virtual XmlNode ToXmlNode(XmlDocument document)
Parameters
document
XmlDocumentxml document, to which this xml node will be added.
Returns
- XmlNode
an xml node describing direct path.