deserializer.cpp revision 12107abbb78a8201106786c55ec2dda6b2cdab2d
/**
* Inkboard message -> XML::Event* deserializer
*
* Authors:
* David Yip <yipdw@rose-hulman.edu>
*
* Copyright (c) 2005 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "xml/log-builder.h"
#include "gc-anchored.h"
#include "jabber_whiteboard/message-utilities.h"
#include "jabber_whiteboard/typedefs.h"
#include "jabber_whiteboard/node-utilities.h"
#include "jabber_whiteboard/node-tracker.h"
#include "jabber_whiteboard/deserializer.h"
#include <glibmm.h>
namespace Inkscape {
namespace Whiteboard {
void
{
// 1. Extract required attributes: parent, child, node name, and node type.
// If any of these cannot be found, return.
return;
}
return;
}
return;
}
}
return;
} else {
}
return;
} else {
}
// 2. Extract optional attributes: the node previous to the new child node.
}
// 3. Check if the received child node is a special node. If it is, and we are already
// tracking it, then we should not add the node.
return;
}
}
// 4. Look up the parent node. If we cannot find it, return.
if (parentRepr == NULL) {
return;
}
// 5. Look up the node previous to the child, if it exists.
// If we cannot find it, we may be in a change conflict situation.
// In that case, just append the node.
g_warning("Prev node %s could not be found; appending incoming node. Document may not be synchronized.", prev.c_str());
}
}
if (prevRepr) {
g_warning("ref mismatch on node %s: child=%s ref=%p parent=%p ref->parent()=%p", prev.c_str(), child.c_str(), prevRepr, parentRepr, prevRepr->parent());
g_warning("parent_child_map[%p (%s)] = %p (%s)", prevRepr, this->_xnt->get(*prevRepr).c_str(), this->_parent_child_map[prevRepr], this->_xnt->get(*(this->_parent_child_map[prevRepr])).c_str());
return;
}
}
}
// 6. Create the child node.
} else {
}
break;
case XML::DOCUMENT_NODE:
// TODO
case XML::COMMENT_NODE:
} else {
}
break;
case XML::ELEMENT_NODE:
default:
break;
}
// 8. Deserialize the event.
}
void
{
// 1. Extract required attributes: parent, child. If we do not know these,
// return.
return;
}
return;
}
return;
}
}
// 2. Extract optional attributes: previous node.
}
// 3. Retrieve nodes. If we cannot find all nodes involved, return.
return;
}
}
// 4. Deserialize the event.
if (parentRepr && childRepr) {
// this->_actions.push_back(SerializedEventNodeAction(KeyNodePair(child, childRepr), NODE_REMOVE));
// 5. Mark the removed node and all its children for removal from the tracker.
this->_recursiveMarkForRemoval(childRepr);
} else {
g_warning("child->parent() == parent mismatch on child=%s (%p), parent=%s: parent=%p child->parent()=%p", child.c_str(), childRepr, parent.c_str(), parentRepr, childRepr->parent());
}
} else {
}
}
void
{
// 1. Extract required attributes: node ID, parent ID, new previous node ID.
// If we do not know these, return.
} else {
return;
}
} else {
return;
}
// 2. Extract optional attributes: old previous node, new previous node.
}
} else {
return;
}
// 3. Find the identified nodes. If we do not know about the parent and child, return.
}
}
// 4. Deserialize the event.
} else {
return;
}
}
void
{
// 1. Extract required attributes: node ID. If we do not know these, return.
return;
} else {
}
// 2. Extract optional attributes: old value, new value.
} else {
}
} else {
}
// 3. Find the node identified by the ID. If we cannot find it, return.
return;
}
// 4. Deserialize the event.
}
void
{
// 1. Extract required attributes: node ID, attribute key. If we do not know these,
// return.
return;
}
return;
}
// 2. Extract optional attributes: new value. If we do not find it in the message,
// assume there is no new value.
} else {
}
// 3. Extract optional attributes: old value. If we do not find it in the message,
// assume that there is no old value.
} else {
}
// 4. Look up this node in the local node database and external tracker.
// If it cannot be found, return.
return;
}
// 5. If this node is in the actions queue and is marked as "new", we need to apply
// _all_ received attributes to it _before_ adding it to the document tree.
}
// 6. Deserialize the event.
}
void
{
}
} else {
}
this->_recursiveMarkForRemoval(child);
}
}
}
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :