simple-node.cpp revision b8ec5550e6e59ed4c0486d2b6da7c02f31e7c51a
/*
* SimpleNode - simple XML node implementation
*
* Copyright 2003-2005 MenTaLguY <mental@rydia.net>
* Copyright 2003 Nathan Hurst
* Copyright 1999-2003 Lauris Kaplinski
* Copyright 2000-2002 Ximian Inc.
*
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* See the file COPYING for details.
*
*/
#include <glib/gstrfuncs.h>
#include "xml/simple-node.h"
#include "xml/node-event-vector.h"
#include "xml/node-fns.h"
#include "debug/event-tracker.h"
#include "debug/simple-event.h"
namespace Inkscape {
namespace XML {
namespace {
case ELEMENT_NODE: {
if (id) {
} else {
}
} break;
case TEXT_NODE:
break;
case COMMENT_NODE:
break;
case DOCUMENT_NODE:
break;
default:
}
return result;
}
class DebugXMLNode : public DebugXML {
public:
{
}
};
class DebugAddChild : public DebugXMLNode {
public:
{
}
};
class DebugRemoveChild : public DebugXMLNode {
public:
{
}
};
class DebugSetChildPosition : public DebugXMLNode {
public:
{
if ( position > old_position ) {
--position;
}
}
};
class DebugSetContent : public DebugXMLNode {
public:
{
}
};
class DebugClearContent : public DebugXMLNode {
public:
{}
};
class DebugSetAttribute : public DebugXMLNode {
public:
{
}
};
class DebugClearAttribute : public DebugXMLNode {
public:
{
}
};
}
using Util::ptr_shared;
using Util::share_string;
using Util::share_unsafe;
using Util::share_static_string;
using Util::MutableList;
_cached_positions_valid(false)
{
}
: Node(),
{
{
child_copy->_setParent(this);
if (_last_child) {
} else {
}
}
{
}
}
return g_quark_to_string(_name);
}
return this->_content;
}
{
}
}
return NULL;
}
unsigned SimpleNode::position() const {
return _parent->_childPosition(*this);
}
if (!_cached_positions_valid) {
unsigned position=0;
{
position++;
}
_cached_positions_valid = true;
}
return child._cachedPosition();
}
index--;
}
return child;
}
{
return true;
}
}
return false;
}
if (new_content) {
} else {
}
if ( _content != old_content ) {
if (_logger) {
}
}
}
void
{
break;
}
}
if (value) {
if (!existing) {
if (ref) {
} else {
}
} else {
}
} else {
if (existing) {
if (ref) {
} else {
}
}
}
if (_logger) {
}
}
}
if (ref) {
} else {
next = _first_child;
}
if (!next) { // appending?
_last_child = child;
// set cached position if possible when appending
if (!ref) {
// if !next && !ref, child is sole child
child->_setCachedPosition(0);
_cached_positions_valid = true;
} else if (_cached_positions_valid) {
}
} else {
// invalidate cached positions otherwise
_cached_positions_valid = false;
}
child->_setParent(this);
_child_count++;
if (_document) {
}
if (_logger) {
}
}
if (!_document) {
}
}
}
if (!_logger) {
}
}
}
if (ref) {
} else {
_first_child = next;
}
if (!next) { // removing the last child?
_last_child = ref;
} else {
// removing any other child invalidates the cached positions
_cached_positions_valid = false;
}
_child_count--;
if (_logger) {
}
}
/* Remove from old position. */
if (prev) {
} else {
_first_child = next;
}
if (!next) {
_last_child = prev;
}
/* Insert at new position. */
if (ref) {
} else {
next = _first_child;
}
if (!next) {
_last_child = child;
}
_cached_positions_valid = false;
if (_logger) {
}
}
// a position beyond the end of the list means the end of the list;
// a negative position is the same as an infinitely large position
{
if ( sibling != this ) {
pos--;
}
}
}
namespace {
}
}
reinterpret_cast<NodeObserver *>(data)->notifyContentChanged(*node, Util::share_unsafe((const char *)old_content), Util::share_unsafe((const char *)new_content));
}
void attr_changed(Node *node, gchar const *name, gchar const *old_value, gchar const *new_value, bool is_interactive, void *data) {
reinterpret_cast<NodeObserver *>(data)->notifyAttributeChanged(*node, g_quark_from_string(name), Util::share_unsafe((const char *)old_value), Util::share_unsafe((const char *)new_value));
}
}
const NodeEventVector OBSERVER_EVENT_VECTOR = {
};
};
if (vector->attr_changed) {
{
}
}
if (vector->child_added) {
{
}
}
if (vector->content_changed) {
}
}
}
}
{
return child;
}
}
return NULL;
return parent;
} else {
return NULL;
}
}
{
if (id) {
if (rch) {
} else {
}
} else {
}
}
{
}
}
}
}
/*
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 :