Code

* Lots of documentation for the Inkscape::XML namespace
[inkscape.git] / src / xml / log-builder.h
1 /** @file
2  * @brief Object building an event log
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  */
14 #ifndef SEEN_INKSCAPE_XML_LOG_BUILDER_H
15 #define SEEN_INKSCAPE_XML_LOG_BUILDER_H
17 #include "gc-managed.h"
18 #include "xml/xml-forward.h"
19 #include "xml/node-observer.h"
21 namespace Inkscape {
22 namespace XML {
24 /**
25  * @brief Event log builder
26  *
27  * This object records all events sent to it via the public methods in an internal event log.
28  * Calling detach() then returns the built log. Calling discard() will clear all the events
29  * recorded so far.
30  */
31 class LogBuilder {
32 public:
33     LogBuilder() : _log(NULL) {}
34     ~LogBuilder() { discard(); }
36     /** @name Manipulate the recorded event log
37      * @{ */
38     /**
39      * @brief Clear the internal log
40      */
41     void discard();
42     /**
43      * @brief Get the internal event log
44      * @return The recorded event chain
45      */
46     Event *detach();
47     /*@}*/
49     /** @name Record events in the log
50      * @{ */
51     void addChild(Node &node, Node &child, Node *prev);
53     void removeChild(Node &node, Node &child, Node *prev);
55     void setChildOrder(Node &node, Node &child,
56                        Node *old_prev, Node *new_prev);
58     void setContent(Node &node,
59                     Util::ptr_shared<char> old_content,
60                     Util::ptr_shared<char> new_content);
62     void setAttribute(Node &node, GQuark name,
63                       Util::ptr_shared<char> old_value,
64                       Util::ptr_shared<char> new_value);
65     /*@}*/
67 private:
68     Event *_log;
69 };
71 }
72 }
74 #endif
75 /*
76   Local Variables:
77   mode:c++
78   c-file-style:"stroustrup"
79   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
80   indent-tabs-mode:nil
81   fill-column:99
82   End:
83 */
84 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :