1 /*
2 * XML::Subtree - proxy for an XML subtree
3 *
4 * Copyright 2005 MenTaLguY <mental@rydia.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * See the file COPYING for details.
12 *
13 */
15 #ifndef SEEN_INKSCAPE_XML_SUBTREE_H
16 #define SEEN_INKSCAPE_XML_SUBTREE_H
18 #include "xml/node-observer.h"
19 #include "xml/composite-node-observer.h"
20 #include "gc-finalized.h"
22 namespace Inkscape {
23 namespace XML {
25 class Node;
27 class Subtree : public GC::Managed<GC::SCANNED, GC::MANUAL>,
28 private NodeObserver
29 {
30 public:
31 Subtree(Node &root);
32 ~Subtree();
34 void synthesizeEvents(NodeObserver &observer);
35 void addObserver(NodeObserver &observer);
36 void removeObserver(NodeObserver &observer);
38 private:
39 void notifyChildAdded(Node &node, Node &child, Node *prev);
41 void notifyChildRemoved(Node &node, Node &child, Node *prev);
43 void notifyChildOrderChanged(Node &node, Node &child,
44 Node *old_prev, Node *new_prev);
46 void notifyContentChanged(Node &node,
47 Util::ptr_shared<char> old_content,
48 Util::ptr_shared<char> new_content);
50 void notifyAttributeChanged(Node &node, GQuark name,
51 Util::ptr_shared<char> old_value,
52 Util::ptr_shared<char> new_value);
54 Node &_root;
55 CompositeNodeObserver _observers;
56 };
58 }
59 }
61 #endif
62 /*
63 Local Variables:
64 mode:c++
65 c-file-style:"stroustrup"
66 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
67 indent-tabs-mode:nil
68 fill-column:99
69 End:
70 */
71 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :