Logo Search packages:      
Sourcecode: inkscape version File versions

Node * previous_node ( Node node  )  [related, inherited]

Get the previous node in sibling order.

This method, unlike Node::next(), is a linear search over the children of node's parent. The return value is NULL when the node has no parent or is first in the sibling order.

node The origin node
The previous node in sibling order, or NULL

Definition at line 61 of file node-fns.cpp.

References Inkscape::XML::Node::firstChild(), Inkscape::XML::Node::next(), and Inkscape::XML::Node::parent().

Referenced by Inkscape::XML::SimpleNode::changeOrder(), and Inkscape::XML::SimpleNode::removeChild().

    using Inkscape::Algorithms::find_if_before;

    if ( !node || !node->parent() ) {
        return NULL;

    Node *previous=find_if_before<NodeSiblingIterator>(
        node->parent()->firstChild(), NULL, node_matches(*node)

    g_assert(previous == NULL
             ? node->parent()->firstChild() == node
             : previous->next() == node);

    return previous;

Generated by  Doxygen 1.6.0   Back to index