Exemplo n.º 1
0
void pawsTreeNode::InsertChild(pawsTreeNode* node, pawsTreeNode* nextSibling)
{
    pawsTreeNode* prevSibling;

    if(nextSibling != NULL)
        prevSibling = nextSibling->GetPrevSibling();
    else
        prevSibling = FindLastChild();

    node->SetNextSibling(nextSibling);
    node->SetPrevSibling(prevSibling);

    if(nextSibling != NULL)
        nextSibling->SetPrevSibling(node);
    if(prevSibling != NULL)
        prevSibling->SetNextSibling(node);
    else
        firstChild = node;
    node->SetParent(this);
    node->SetTree(tree);

    tree->NewNode(node);

    if(tree != NULL)
        tree->NodeChanged();
}
Exemplo n.º 2
0
pawsTreeNode* pawsTreeNode::FindLowestSubtreeNode()
{
    pawsTreeNode* lastChild;

    lastChild = FindLastChild();
    if(lastChild == NULL)
        return this;
    else
        return lastChild->FindLowestSubtreeNode();
}
Exemplo n.º 3
0
Arquivo: dom4c.c Projeto: vhly/cstudy
void addNode(Node *parent, Node *node)
{
    if (parent != NULL && node != NULL) {
        Node *last = FindLastChild(parent);
        if (last == NULL) {
            parent->children = node;
        } else {
            last->nextSub = node;
            node->prevSub = last;
        }
    }
}
Exemplo n.º 4
0
Arquivo: dom4c.c Projeto: vhly/cstudy
void SetAttribute(Element *element, Attribute *attr)
{
    if (element != NULL && attr != NULL) {
        // Check attribute is exists?
        Attribute *tmp = FindNodeByName(element->children, NODE_TYPE_ATTRIBUTE, attr->nodeName);
        if (tmp != NULL) {
            // Set exists attribute by attribute's name
            tmp->nodeValue = attr->nodeValue;
        }else{
            // set new attribute
            Node *last = FindLastChild(element);
            if (last == NULL) {
                element->children = attr;
            } else {
                last->nextSub = attr;
                attr->prevSub = last;
            }
        }
    }
}