NVDA Helper
In-process and lite high-speed utilities for NVDA
VBufStorage_fieldNode_t Class Referenceabstract

a node that represents a field in a buffer. More...

#include <storage.h>

Inheritance diagram for VBufStorage_fieldNode_t:
VBufStorage_controlFieldNode_t VBufStorage_textFieldNode_t AdobeAcrobatVBufStorage_controlFieldNode_t MshtmlVBufStorage_controlFieldNode_t VBufStorage_referenceNode_t

Public Member Functions

bool matchAttributes (const std::vector< std::wstring > &attribs, const std::wregex &regexp)
 work out if the attributes in the given string exist on this node.
 
VBufStorage_controlFieldNode_tgetParent ()
 points to this node's parent control field node.
 
VBufStorage_fieldNode_tgetPrevious ()
 points to the node directly before this node that shares the same parent as this node.
 
VBufStorage_fieldNode_tgetNext ()
 points to the node directly after this node that shares the same parent as this node.
 
VBufStorage_fieldNode_tgetFirstChild ()
 points to this node's first child.
 
VBufStorage_fieldNode_tgetLastChild ()
 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_tnextNodeInTree (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_tlocateTextFieldNodeAtOffset (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_tparent
 points to this node's parent control field node.
 
VBufStorage_fieldNode_tprevious
 points to the node directly before this node that shares the same parent as this node.
 
VBufStorage_fieldNode_tnext
 points to the node directly after this node that shares the same parent as this node.
 
VBufStorage_fieldNode_tfirstChild
 points to this node's first child.
 
VBufStorage_fieldNode_tlastChild
 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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ VBufStorage_fieldNode_t()

VBufStorage_fieldNode_t::VBufStorage_fieldNode_t ( int length,
bool isBlock )
protected

constructor.

Parameters
lengththe length in characters this node should be, usually left as its default.
isBlocktrue if this node should be a block element, false otherwise
Remarks
Protected because this class is always dynamically allocated and memory is managed by friend classes

References length, and LOG_DEBUG.

◆ ~VBufStorage_fieldNode_t()

VBufStorage_fieldNode_t::~VBufStorage_fieldNode_t ( )
protectedvirtual

destructor

Remarks
Protected: This and derived classes are always dynamically allocated and memory managed by friends

References LOG_DEBUG.

Member Function Documentation

◆ nextNodeInTree()

VBufStorage_fieldNode_t * VBufStorage_fieldNode_t::nextNodeInTree ( int direction,
VBufStorage_fieldNode_t * limitNode,
int * relativeStartOffset )
protected

moves to the next node, in depth-first order.

Parameters
directionthe direction to walk
limitNodethe node which can not be passed
relativeStartOffsetmemory to place the start offset of the next node relative to the start offset of the original node
Returns
the next 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().

◆ calculateOffsetInTree()

int VBufStorage_fieldNode_t::calculateOffsetInTree ( ) const
protected

Calculates the offset for this node relative to the surrounding tree.

Returns
the offset of the node.

References calculateOffsetInTree(), length, LOG_DEBUG, parent, and previous.

Referenced by calculateOffsetInTree(), and VBufStorage_buffer_t::getFieldNodeOffsets().

◆ locateTextFieldNodeAtOffset()

VBufStorage_textFieldNode_t * VBufStorage_fieldNode_t::locateTextFieldNodeAtOffset ( int offset,
int * relativeOffset )
protectedvirtual

Locates the descendant textFieldNode that is positioned at the given offset in this node.

Parameters
offsetthe offset with in this node.
relativeOffsetmemory where the offset relative to the found node can be placed
Returns
the descendant textFieldNode at that offset, or NULL if none there.

Reimplemented in VBufStorage_textFieldNode_t.

References firstChild, length, VBufStorage_textFieldNode_t::locateTextFieldNodeAtOffset(), LOG_DEBUG, next, and nhAssert.

Referenced by VBufStorage_buffer_t::locateTextFieldNodeAtOffset().

◆ generateMarkupTagName()

virtual void VBufStorage_fieldNode_t::generateMarkupTagName ( std::wstring & text)
protectedpure virtual

generates this field's markup tag name

Parameters
textwhere to place the generated name

Implemented in VBufStorage_controlFieldNode_t, VBufStorage_referenceNode_t, and VBufStorage_textFieldNode_t.

Referenced by generateMarkupClosingTag(), and generateMarkupOpeningTag().

◆ generateAttributesForMarkupOpeningTag()

void VBufStorage_fieldNode_t::generateAttributesForMarkupOpeningTag ( std::wstring & text,
int startOffset,
int endOffset )
protectedvirtual

Generates the attributes within a markup opening tag.

Parameters
textwhere to place the generated text
theoffset within the node where text is being requested from
theoffset 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().

◆ generateMarkupOpeningTag()

void VBufStorage_fieldNode_t::generateMarkupOpeningTag ( std::wstring & text,
int startOffset,
int endOffset )
protected

generates a markup opening tag for this field.

Parameters
texta string to append the tag to.
theoffset within the node where text is being requested from
theoffset within the node the text is being requested to.

References generateAttributesForMarkupOpeningTag(), and generateMarkupTagName().

Referenced by getTextInRange(), and VBufStorage_textFieldNode_t::getTextInRange().

◆ generateMarkupClosingTag()

void VBufStorage_fieldNode_t::generateMarkupClosingTag ( std::wstring & text)
protected

generates a markup closing tag for this field.

Parameters
texta string to append the tag to.

References generateMarkupTagName().

Referenced by getTextInRange(), and VBufStorage_textFieldNode_t::getTextInRange().

◆ disassociateFromBuffer()

void VBufStorage_fieldNode_t::disassociateFromBuffer ( VBufStorage_buffer_t * buffer)
protectedvirtual

Disassociates this node from its buffer.

Parameters
bufferthe 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().

◆ matchAttributes()

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.

Parameters
attribsStringthe string containing the attributes, each attribute can have multiple values to match on.
Returns
true if the attributes exist, false otherwize.

References attributes, LOG_DEBUGWARNING, outputEscapedAttribute(), and parent.

Referenced by VBufStorage_buffer_t::findNodeByAttributes().

◆ getParent()

VBufStorage_controlFieldNode_t * VBufStorage_fieldNode_t::getParent ( )
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().

◆ getPrevious()

VBufStorage_fieldNode_t * VBufStorage_fieldNode_t::getPrevious ( )
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().

◆ getNext()

VBufStorage_fieldNode_t * VBufStorage_fieldNode_t::getNext ( )
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().

◆ getFirstChild()

VBufStorage_fieldNode_t * VBufStorage_fieldNode_t::getFirstChild ( )
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().

◆ getLastChild()

VBufStorage_fieldNode_t * VBufStorage_fieldNode_t::getLastChild ( )
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().

◆ addAttribute()

bool VBufStorage_fieldNode_t::addAttribute ( const std::wstring & name,
const std::wstring & value )

Adds an attribute to this field.

Parameters
namethe name of the attribute
valuethe value of the attribute.
Returns
true if the attribute was added, false if there was an error.

References attributes, and LOG_DEBUG.

Referenced by _extendDetailsRolesAttribute(), VBufStorage_buffer_t::addTextFieldNode(), fillExplicitTableHeadersForCell(), fillExplicitTableHeadersForCell(), fillTextFormatting_helper(), MshtmlVBufBackend_t::fillVBuf(), lotusNotesRichTextVBufBackend_t::render(), and renderText().

◆ getAttribute()

std::optional< std::wstring > VBufStorage_fieldNode_t::getAttribute ( const std::wstring & name)

Gets an attribute value for this field.

Parameters
namethe name of the attribute
Returns
the attribute if the attribute exists, NULL if it doesn't exist.

References attributes, and LOG_DEBUG.

Referenced by _extendDetailsRolesAttribute().

◆ getAttributesString()

std::wstring VBufStorage_fieldNode_t::getAttributesString ( ) const
Returns
a string of all the attributes in this field, format of name:value pares separated by a semi colon.

References attributes.

Referenced by getDebugInfo().

◆ getTextInRange()

void VBufStorage_fieldNode_t::getTextInRange ( int startOffset,
int endOffset,
std::wstring & text,
bool useMarkup = false,
bool(* filter )(VBufStorage_fieldNode_t *) = NULL )
virtual

fetches the text between given offsets in this node and its descendants, with optional markup.

Parameters
startOffsetthe offset to start from.
endOffsetthe offset to end at. Use -1 to mean node's end offset.
texta string in whish to append the text.
useMarkupif true then markup indicating opening and closing of fields will be included.
filtera function that takes the current recursive node and returns true if text should be fetched and false if it should be skipped.
Returns
true if successfull, false otherwize.

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().

◆ getDebugInfo()

◆ getLength()

Friends And Related Symbol Documentation

◆ VBufStorage_buffer_t

friend class VBufStorage_buffer_t
friend

Member Data Documentation

◆ parent

◆ previous

◆ next

◆ firstChild

VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::firstChild
protected

◆ lastChild

VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::lastChild
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().

◆ length

◆ attributes

VBufStorage_attributeMap_t VBufStorage_fieldNode_t::attributes
protected

a map to hold attributes for this field.

Referenced by addAttribute(), generateAttributesForMarkupOpeningTag(), getAttribute(), getAttributesString(), and matchAttributes().

◆ isBlock

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().

◆ isHidden

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().


The documentation for this class was generated from the following files: