NVDA Helper
In-process and lite high-speed utilities for NVDA
|
a node that represents a field in a buffer. More...
#include <storage.h>
Public Member Functions | |
bool | matchAttributes (const std::vector< std::wstring > &attribs, const std::wregex ®exp) |
work out if the attributes in the given string exist on this node. | |
VBufStorage_controlFieldNode_t * | getParent () |
points to this node's parent control field node. | |
VBufStorage_fieldNode_t * | getPrevious () |
points to the node directly before this node that shares the same parent as this node. | |
VBufStorage_fieldNode_t * | getNext () |
points to the node directly after this node that shares the same parent as this node. | |
VBufStorage_fieldNode_t * | getFirstChild () |
points to this node's first child. | |
VBufStorage_fieldNode_t * | getLastChild () |
points to this node's last child. | |
bool | addAttribute (const std::wstring &name, const std::wstring &value) |
Adds an attribute to this field. | |
std::optional< std::wstring > | getAttribute (const std::wstring &name) |
Gets an attribute value for this field. | |
std::wstring | getAttributesString () const |
virtual void | getTextInRange (int startOffset, int endOffset, std::wstring &text, bool useMarkup=false, bool(*filter)(VBufStorage_fieldNode_t *)=NULL) |
fetches the text between given offsets in this node and its descendants, with optional markup. | |
virtual std::wstring | getDebugInfo () const |
int | getLength () |
Retreave the length of this node. | |
Public Attributes | |
bool | isBlock |
true if this field should cause a line break at its start and end when a buffer is calculating lines. | |
bool | isHidden |
True if this node his hidden - searches will not locate this node. | |
Protected Member Functions | |
VBufStorage_fieldNode_t * | nextNodeInTree (int direction, VBufStorage_fieldNode_t *limitNode, int *relativeStartOffset) |
moves to the next node, in depth-first order. | |
int | calculateOffsetInTree () const |
Calculates the offset for this node relative to the surrounding tree. | |
virtual VBufStorage_textFieldNode_t * | locateTextFieldNodeAtOffset (int offset, int *relativeOffset) |
Locates the descendant textFieldNode that is positioned at the given offset in this node. | |
virtual void | generateMarkupTagName (std::wstring &text)=0 |
generates this field's markup tag name | |
virtual void | generateAttributesForMarkupOpeningTag (std::wstring &text, int startOffset, int endOffset) |
Generates the attributes within a markup opening tag. | |
void | generateMarkupOpeningTag (std::wstring &text, int startOffset, int endOffset) |
generates a markup opening tag for this field. | |
void | generateMarkupClosingTag (std::wstring &text) |
generates a markup closing tag for this field. | |
virtual void | disassociateFromBuffer (VBufStorage_buffer_t *buffer) |
Disassociates this node from its buffer. | |
VBufStorage_fieldNode_t (int length, bool isBlock) | |
constructor. | |
virtual | ~VBufStorage_fieldNode_t () |
destructor | |
Protected Attributes | |
VBufStorage_controlFieldNode_t * | parent |
points to this node's parent control field node. | |
VBufStorage_fieldNode_t * | previous |
points to the node directly before this node that shares the same parent as this node. | |
VBufStorage_fieldNode_t * | next |
points to the node directly after this node that shares the same parent as this node. | |
VBufStorage_fieldNode_t * | firstChild |
points to this node's first child. | |
VBufStorage_fieldNode_t * | lastChild |
points to this node's last child. | |
int | length |
The length of this node in characters. | |
VBufStorage_attributeMap_t | attributes |
a map to hold attributes for this field. | |
Friends | |
class | VBufStorage_buffer_t |
a node that represents a field in a buffer.
Nodes have relationships with other nodes (giving the ability to form a tree structure), they have a length in characters (how many characters they span in the buffer), and they can hold name value attribute paires. Their constructor and destructor is protected and their only friend is a buffer, thus they can only be created by a buffer.
|
protected |
constructor.
length | the length in characters this node should be, usually left as its default. |
isBlock | true if this node should be a block element, false otherwise |
|
protectedvirtual |
destructor
References LOG_DEBUG.
|
protected |
moves to the next node, in depth-first order.
direction | the direction to walk |
limitNode | the node which can not be passed |
relativeStartOffset | memory to place the start offset of the next node relative to the start offset of the original node |
References firstChild, lastChild, length, LOG_DEBUG, next, parent, previous, TREEDIRECTION_BACK, TREEDIRECTION_FORWARD, and TREEDIRECTION_SYMMETRICAL_BACK.
Referenced by VBufStorage_buffer_t::findNodeByAttributes(), and VBufStorage_buffer_t::getLineOffsets().
|
protected |
Calculates the offset for this node relative to the surrounding tree.
References calculateOffsetInTree(), length, LOG_DEBUG, parent, and previous.
Referenced by calculateOffsetInTree(), and VBufStorage_buffer_t::getFieldNodeOffsets().
|
protectedvirtual |
Locates the descendant textFieldNode that is positioned at the given offset in this node.
offset | the offset with in this node. |
relativeOffset | memory where the offset relative to the found node can be placed |
Reimplemented in VBufStorage_textFieldNode_t.
References firstChild, length, VBufStorage_textFieldNode_t::locateTextFieldNodeAtOffset(), LOG_DEBUG, next, and nhAssert.
Referenced by VBufStorage_buffer_t::locateTextFieldNodeAtOffset().
|
protectedpure virtual |
generates this field's markup tag name
text | where to place the generated name |
Implemented in VBufStorage_controlFieldNode_t, VBufStorage_referenceNode_t, and VBufStorage_textFieldNode_t.
Referenced by generateMarkupClosingTag(), and generateMarkupOpeningTag().
|
protectedvirtual |
Generates the attributes within a markup opening tag.
text | where to place the generated text |
the | offset within the node where text is being requested from |
the | offset within the node the text is being requested to. |
Reimplemented in MshtmlVBufStorage_controlFieldNode_t, and VBufStorage_controlFieldNode_t.
References appendCharToXML(), attributes, firstChild, isBlock, isHidden, length, next, previous, and sanitizeXMLAttribName().
Referenced by VBufStorage_controlFieldNode_t::generateAttributesForMarkupOpeningTag(), and generateMarkupOpeningTag().
|
protected |
generates a markup opening tag for this field.
text | a string to append the tag to. |
the | offset within the node where text is being requested from |
the | offset within the node the text is being requested to. |
References generateAttributesForMarkupOpeningTag(), and generateMarkupTagName().
Referenced by getTextInRange(), and VBufStorage_textFieldNode_t::getTextInRange().
|
protected |
generates a markup closing tag for this field.
text | a string to append the tag to. |
References generateMarkupTagName().
Referenced by getTextInRange(), and VBufStorage_textFieldNode_t::getTextInRange().
|
protectedvirtual |
Disassociates this node from its buffer.
buffer | the buffer to disassociate from |
Reimplemented in VBufStorage_controlFieldNode_t.
References LOG_DEBUG, and nhAssert.
Referenced by VBufStorage_buffer_t::deleteNode(), and VBufStorage_controlFieldNode_t::disassociateFromBuffer().
bool VBufStorage_fieldNode_t::matchAttributes | ( | const std::vector< std::wstring > & | attribs, |
const std::wregex & | regexp ) |
work out if the attributes in the given string exist on this node.
attribsString | the string containing the attributes, each attribute can have multiple values to match on. |
References attributes, LOG_DEBUGWARNING, outputEscapedAttribute(), and parent.
Referenced by VBufStorage_buffer_t::findNodeByAttributes().
|
inline |
points to this node's parent control field node.
it is garenteed that this node will be one of the parent's children (firstChild [next next...] or lastChild [previous previous...]).
References parent.
Referenced by fillTextFormatting_helper(), MshtmlVBufBackend_t::fillVBuf(), CHTMLChangeSink::IHTMLChangeSink::Notify(), VBufBackend_t::invalidateSubtree(), and markNodeAsNonreusableIfInAncestor().
|
inline |
points to the node directly before this node that shares the same parent as this node.
References previous.
Referenced by MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion(), and VBufBackend_t::reuseExistingNodeInRender().
|
inline |
points to the node directly after this node that shares the same parent as this node.
References next.
Referenced by MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion().
|
inline |
points to this node's first child.
The child will have no previous node, and it will have this node as its parent.
References firstChild.
Referenced by isNodeInLiveRegion(), and MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion().
|
inline |
points to this node's last child.
the child will have no next node, and it will have this node as its parent.
References lastChild.
Referenced by MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion().
bool VBufStorage_fieldNode_t::addAttribute | ( | const std::wstring & | name, |
const std::wstring & | value ) |
Adds an attribute to this field.
name | the name of the attribute |
value | the value of the attribute. |
References attributes, and LOG_DEBUG.
Referenced by _extendDetailsRolesAttribute(), VBufStorage_buffer_t::addTextFieldNode(), fillExplicitTableHeadersForCell(), fillExplicitTableHeadersForCell(), fillTextFormatting_helper(), MshtmlVBufBackend_t::fillVBuf(), lotusNotesRichTextVBufBackend_t::render(), and renderText().
std::optional< std::wstring > VBufStorage_fieldNode_t::getAttribute | ( | const std::wstring & | name | ) |
Gets an attribute value for this field.
name | the name of the attribute |
References attributes, and LOG_DEBUG.
Referenced by _extendDetailsRolesAttribute().
std::wstring VBufStorage_fieldNode_t::getAttributesString | ( | ) | const |
References attributes.
Referenced by getDebugInfo().
|
virtual |
fetches the text between given offsets in this node and its descendants, with optional markup.
startOffset | the offset to start from. |
endOffset | the offset to end at. Use -1 to mean node's end offset. |
text | a string in whish to append the text. |
useMarkup | if true then markup indicating opening and closing of fields will be included. |
filter | a function that takes the current recursive node and returns true if text should be fetched and false if it should be skipped. |
Reimplemented in VBufStorage_textFieldNode_t.
References firstChild, generateMarkupClosingTag(), generateMarkupOpeningTag(), length, LOG_DEBUG, next, and nhAssert.
Referenced by VBufStorage_buffer_t::getLineOffsets(), VBufStorage_buffer_t::getTextInRange(), nodeContentMatchesString(), nodeHasUsefulContent(), MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion(), and MshtmlVBufStorage_controlFieldNode_t::reportLiveAddition().
|
virtual |
Reimplemented in VBufStorage_controlFieldNode_t, and VBufStorage_textFieldNode_t.
References firstChild, getAttributesString(), lastChild, length, next, parent, and previous.
Referenced by VBufStorage_buffer_t::deleteSubtree(), VBufStorage_buffer_t::findNodeByAttributes(), VBufStorage_controlFieldNode_t::getDebugInfo(), VBufStorage_textFieldNode_t::getDebugInfo(), VBufStorage_buffer_t::getLineOffsets(), and VBufStorage_buffer_t::insertNode().
|
inline |
Retreave the length of this node.
References length.
Referenced by MshtmlVBufBackend_t::fillVBuf(), nodeContentMatchesString(), nodeHasUsefulContent(), MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion(), and MshtmlVBufStorage_controlFieldNode_t::reportLiveAddition().
|
friend |
|
protected |
points to this node's parent control field node.
it is garenteed that this node will be one of the parent's children (firstChild [next next...] or lastChild [previous previous...]).
Referenced by calculateOffsetInTree(), VBufStorage_buffer_t::findNodeByAttributes(), getDebugInfo(), VBufStorage_buffer_t::getLineOffsets(), getParent(), VBufStorage_buffer_t::insertNode(), VBufStorage_buffer_t::isDescendantNode(), VBufStorage_buffer_t::locateControlFieldNodeAtOffset(), matchAttributes(), nextNodeInTree(), MshtmlVBufStorage_controlFieldNode_t::preProcessLiveRegion(), VBufStorage_buffer_t::replaceSubtrees(), and VBufStorage_buffer_t::unlinkFieldNode().
|
protected |
points to the node directly before this node that shares the same parent as this node.
Referenced by calculateOffsetInTree(), VBufStorage_buffer_t::findNodeByAttributes(), generateAttributesForMarkupOpeningTag(), getDebugInfo(), getPrevious(), VBufStorage_buffer_t::insertNode(), VBufStorage_buffer_t::locateControlFieldNodeAtOffset(), nextNodeInTree(), VBufStorage_buffer_t::replaceSubtrees(), and VBufStorage_buffer_t::unlinkFieldNode().
|
protected |
points to the node directly after this node that shares the same parent as this node.
Referenced by VBufStorage_buffer_t::deleteSubtree(), generateAttributesForMarkupOpeningTag(), getDebugInfo(), getNext(), getTextInRange(), VBufStorage_buffer_t::insertNode(), locateTextFieldNodeAtOffset(), nextNodeInTree(), and VBufStorage_buffer_t::unlinkFieldNode().
|
protected |
points to this node's first child.
The child will have no previous node, and it will have this node as its parent.
Referenced by VBufStorage_buffer_t::deleteSubtree(), generateAttributesForMarkupOpeningTag(), getDebugInfo(), getFirstChild(), VBufStorage_buffer_t::getLineOffsets(), getTextInRange(), VBufStorage_buffer_t::insertNode(), locateTextFieldNodeAtOffset(), nextNodeInTree(), and VBufStorage_buffer_t::unlinkFieldNode().
|
protected |
points to this node's last child.
the child will have no next node, and it will have this node as its parent.
Referenced by getDebugInfo(), getLastChild(), VBufStorage_buffer_t::insertNode(), nextNodeInTree(), and VBufStorage_buffer_t::unlinkFieldNode().
|
protected |
The length of this node in characters.
represents the amount of characters this node spans in its buffer. Node lengths could be used together to calculate an actual character offset for a particular node in a buffer.
Referenced by calculateOffsetInTree(), VBufStorage_buffer_t::findNodeByAttributes(), generateAttributesForMarkupOpeningTag(), getDebugInfo(), VBufStorage_buffer_t::getFieldNodeOffsets(), getLength(), VBufStorage_buffer_t::getLineOffsets(), VBufStorage_buffer_t::getSelectionOffsets(), VBufStorage_buffer_t::getTextInRange(), getTextInRange(), VBufStorage_textFieldNode_t::getTextInRange(), VBufStorage_buffer_t::getTextLength(), VBufStorage_buffer_t::insertNode(), VBufStorage_buffer_t::locateControlFieldNodeAtOffset(), VBufStorage_buffer_t::locateTextFieldNodeAtOffset(), locateTextFieldNodeAtOffset(), VBufStorage_textFieldNode_t::locateTextFieldNodeAtOffset(), nextNodeInTree(), VBufStorage_buffer_t::replaceSubtrees(), VBufStorage_buffer_t::unlinkFieldNode(), VBufStorage_fieldNode_t(), and VBufStorage_textFieldNode_t::VBufStorage_textFieldNode_t().
|
protected |
a map to hold attributes for this field.
Referenced by addAttribute(), generateAttributesForMarkupOpeningTag(), getAttribute(), getAttributesString(), and matchAttributes().
bool VBufStorage_fieldNode_t::isBlock |
true if this field should cause a line break at its start and end when a buffer is calculating lines.
Referenced by MshtmlVBufBackend_t::fillVBuf(), generateAttributesForMarkupOpeningTag(), and VBufStorage_buffer_t::getLineOffsets().
bool VBufStorage_fieldNode_t::isHidden |
True if this node his hidden - searches will not locate this node.
Referenced by MshtmlVBufBackend_t::fillVBuf(), VBufStorage_buffer_t::findNodeByAttributes(), and generateAttributesForMarkupOpeningTag().