simple-node.cpp revision d0d9dc8846169ff203ce93b6fd6bf331e663a7cd
/** @file
* @brief Garbage collected 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 <cstring>
#include <string>
#include <glib.h>
#include "preferences.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"
#include "attribute-rel-util.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._cached_position;
}
index--;
}
return child;
}
{
return true;
}
}
return false;
}
if (_parent) {
}
if (parent) {
}
}
if (new_content) {
} else {
}
if ( _content != old_content ) {
}
}
void
{
// Check usefulness of attributes on elements in the svg namespace, optionally don't add them to tree.
//g_warning("setAttribute: %s: %s: %s", element.c_str(), name, value);
// Only check elements in SVG name space and don't block setting attribute to NULL.
unsigned int flags = sp_attribute_clean_get_prefs();
// Check attributes
if( !is_useful && attr_remove ) {
return; // Don't add to tree.
}
}
// Check style properties -- Note: if element is not yet inserted into
// tree (and thus has no parent), default values will not be tested.
// if( g_strcmp0( value, cleaned_value ) ) {
// g_warning( "SimpleNode::setAttribute: %s", id.c_str() );
// g_warning( " original: %s", value);
// g_warning( " cleaned: %s", cleaned_value);
// }
}
}
}
break;
}
}
if (~cleaned_value.empty()) {
if (!existing) {
if (ref) {
} else {
}
} else {
}
} else {
if (existing) {
if (ref) {
} else {
}
}
}
//g_warning( "setAttribute notified: %s: %s: %s: %s", name, element.c_str(), old_value, new_value );
}
}
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->_cached_position = 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 (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--;
}
/* 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;
}
// 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:fileencoding=utf-8:textwidth=99 :