~vaifrax/inkscape/bugfix170049

« back to all changes in this revision

Viewing changes to src/xml/log-builder.cpp

  • Committer: mental
  • Date: 2006-01-16 02:36:01 UTC
  • Revision ID: mental@users.sourceforge.net-20060116023601-wkr0h7edl5veyudq
moving trunk for module inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Inkscape::XML::LogBuilder - NodeObserver which builds 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
 *
 
13
 */
 
14
 
 
15
#include "xml/log-builder.h"
 
16
#include "xml/event.h"
 
17
#include "xml/event-fns.h"
 
18
 
 
19
namespace Inkscape {
 
20
namespace XML {
 
21
 
 
22
void LogBuilder::discard() {
 
23
    sp_repr_free_log(_log);
 
24
    _log = NULL;
 
25
}
 
26
 
 
27
Event *LogBuilder::detach() {
 
28
    Event *log=_log;
 
29
    _log = NULL;
 
30
    return log;
 
31
}
 
32
 
 
33
void LogBuilder::addChild(Node &node, Node &child, Node *prev) {
 
34
    _log = new Inkscape::XML::EventAdd(&node, &child, prev, _log);
 
35
    _log = _log->optimizeOne();
 
36
}
 
37
 
 
38
void LogBuilder::removeChild(Node &node, Node &child, Node *prev) {
 
39
    _log = new Inkscape::XML::EventDel(&node, &child, prev, _log);
 
40
    _log = _log->optimizeOne();
 
41
}
 
42
 
 
43
void LogBuilder::setChildOrder(Node &node, Node &child,
 
44
                               Node *old_prev, Node *new_prev)
 
45
{
 
46
    _log = new Inkscape::XML::EventChgOrder(&node, &child, old_prev, new_prev, _log);
 
47
    _log = _log->optimizeOne();
 
48
}
 
49
 
 
50
void LogBuilder::setContent(Node &node,
 
51
                            Util::SharedCStringPtr old_content,
 
52
                            Util::SharedCStringPtr new_content)
 
53
{
 
54
    _log = new Inkscape::XML::EventChgContent(&node, old_content, new_content, _log);
 
55
    _log = _log->optimizeOne();
 
56
}
 
57
 
 
58
void LogBuilder::setAttribute(Node &node, GQuark name,
 
59
                              Util::SharedCStringPtr old_value,
 
60
                              Util::SharedCStringPtr new_value)
 
61
{
 
62
    _log = new Inkscape::XML::EventChgAttr(&node, name, old_value, new_value, _log);
 
63
    _log = _log->optimizeOne();
 
64
}
 
65
 
 
66
}
 
67
}
 
68
 
 
69
/*
 
70
  Local Variables:
 
71
  mode:c++
 
72
  c-file-style:"stroustrup"
 
73
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
74
  indent-tabs-mode:nil
 
75
  fill-column:99
 
76
  End:
 
77
*/
 
78
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :